Add and augment conceptual docs (#1375)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Mike Kistler <mikekistler@microsoft.com>
Co-authored-by: Stephen Toub <stoub@microsoft.com>
Co-authored-by: Stephen Halter <halter73@gmail.com>
This commit is contained in:
Jeff Handley 2026-02-24 17:03:27 -08:00 • committed by GitHub
commit 46668f18de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -34,6 +34,80 @@ For enum types, the SDK supports several schema formats:
- **TitledMultiSelectEnumSchema**: A multi-select enum with display titles for each option.
- **LegacyTitledEnumSchema** (deprecated): The legacy enum schema using `enumNames` for backward compatibility.
#### Default values
Each schema type supports a `Default` property that specifies a pre-populated value for the form field.
Clients should use defaults to pre-fill form fields, making it easier for users to accept common values or see expected input formats.
```csharp
var result = await server.ElicitAsync(new ElicitRequestParams
{
Message = "Configure your preferences",
RequestedSchema = new ElicitRequestParams.RequestSchema
{
Properties = new Dictionary<string, ElicitRequestParams.PrimitiveSchemaDefinition>
{
["name"] = new ElicitRequestParams.StringSchema
{
Description = "Your display name",
Default = "User"
},
["maxResults"] = new ElicitRequestParams.NumberSchema
{
Description = "Maximum number of results",
Default = 25
},
["enableNotifications"] = new ElicitRequestParams.BooleanSchema
{
Description = "Enable push notifications",
Default = true
},
["theme"] = new ElicitRequestParams.UntitledSingleSelectEnumSchema
{
Description = "UI theme",
Enum = ["light", "dark", "system"],
Default = "system"
}
}
}
}, cancellationToken);
```
#### Enum schema formats
Enum schemas allow the server to present a set of choices to the user.
- <xref:ModelContextProtocol.Protocol.ElicitRequestParams.UntitledSingleSelectEnumSchema>: Simple single-select where enum values serve as both the value and display text.
- <xref:ModelContextProtocol.Protocol.ElicitRequestParams.TitledSingleSelectEnumSchema>: Single-select with separate display titles for each option using JSON Schema `oneOf` with `const` and `title`.
- <xref:ModelContextProtocol.Protocol.ElicitRequestParams.UntitledMultiSelectEnumSchema>: Multi-select allowing multiple values.
- <xref:ModelContextProtocol.Protocol.ElicitRequestParams.TitledMultiSelectEnumSchema>: Multi-select with display titles.
```csharp
// Titled single-select: display titles differ from values
["priority"] = new ElicitRequestParams.TitledSingleSelectEnumSchema
{
Description = "Task priority",
OneOf =
[
new() { Const = "p0", Title = "Critical (P0)" },
new() { Const = "p1", Title = "High (P1)" },
new() { Const = "p2", Title = "Normal (P2)" },
],
Default = "p2"
},
// Multi-select: user can select multiple values
["tags"] = new ElicitRequestParams.UntitledMultiSelectEnumSchema
{
Description = "Tags to apply",
Items = new()
{
Enum = ["bug", "feature", "docs", "test"]
},
Default = ["bug"]
}
```
The server can request a single input or multiple inputs at once.
To help distinguish multiple inputs, each input has a unique name.