Skip to content

Commit 51a8615

Browse files
committed
edit pass
1 parent 4140c6d commit 51a8615

File tree

21 files changed

+396
-399
lines changed

21 files changed

+396
-399
lines changed

docs/concepts/cancellation/cancellation.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ uid: cancellation
77

88
## Cancellation
99

10-
MCP supports [cancellation] of in-flight requests. Either side can cancel a previously issued request, and `CancellationToken` parameters on MCP methods are wired to send and receive `notifications/cancelled` notifications over the protocol.
10+
MCP supports [cancellation] of in-flight requests. Either side can cancel a previously issued request, and <xref:System.Threading.CancellationToken> parameters on MCP methods are wired to send and receive `notifications/cancelled` notifications over the protocol.
1111

1212
[cancellation]: https://modelcontextprotocol.io/specification/2025-11-25/basic/utilities/cancellation
1313
[task cancellation]: https://learn.microsoft.com/dotnet/standard/parallel-programming/task-cancellation
1414

1515
### How cancellation maps to MCP notifications
1616

17-
When a `CancellationToken` passed to a client method (such as <xref:ModelContextProtocol.Client.McpClient.CallToolAsync*>) is cancelled, a `notifications/cancelled` notification is sent to the server with the request ID. On the server side, the `CancellationToken` provided to the tool method is then triggered, allowing the handler to stop work gracefully. This same mechanism works in reverse for server-to-client requests.
17+
When a <xref:System.Threading.CancellationToken> passed to a client method (such as <xref:ModelContextProtocol.Client.McpClient.CallToolAsync*>) is cancelled, a `notifications/cancelled` notification is sent to the server with the request ID. On the server side, the <xref:System.Threading.CancellationToken> provided to the tool method is then triggered, allowing the handler to stop work gracefully. This same mechanism works in reverse for server-to-client requests.
1818

1919
### Server-side cancellation handling
2020

21-
Server tool methods receive a `CancellationToken` that is triggered when the client sends a cancellation notification. Pass this token through to any async operations so they stop promptly:
21+
Server tool methods receive a <xref:System.Threading.CancellationToken> that is triggered when the client sends a cancellation notification. Pass this token through to any async operations so they stop promptly:
2222

2323
```csharp
2424
[McpServerTool, Description("A long-running computation")]
@@ -35,7 +35,7 @@ public static async Task<string> LongComputation(
3535
}
3636
```
3737

38-
When the client sends a cancellation notification, the `OperationCanceledException` propagates back to the client as a cancellation response.
38+
When the client sends a cancellation notification, the <xref:System.OperationCanceledException> propagates back to the client as a cancellation response.
3939

4040
### Cancellation notification details
4141

docs/concepts/capabilities/capabilities.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ MCP uses a [capability negotiation] mechanism during connection setup. Clients a
1515

1616
<xref:ModelContextProtocol.Protocol.ClientCapabilities> declares what features the client supports:
1717

18-
| Capability | Type | Description |
19-
|-----------|------|-------------|
20-
| `Roots` | <xref:ModelContextProtocol.Protocol.RootsCapability> | Client can provide filesystem root URIs |
21-
| `Sampling` | <xref:ModelContextProtocol.Protocol.SamplingCapability> | Client can handle LLM sampling requests |
22-
| `Elicitation` | <xref:ModelContextProtocol.Protocol.ElicitationCapability> | Client can present forms or URLs to the user |
18+
| Capability | Type | Description |
19+
|----------------|-------------------------------|---------------------------|
20+
| `Roots` | <xref:ModelContextProtocol.Protocol.RootsCapability> | Client can provide filesystem root URIs |
21+
| `Sampling` | <xref:ModelContextProtocol.Protocol.SamplingCapability> | Client can handle LLM sampling requests |
22+
| `Elicitation` | <xref:ModelContextProtocol.Protocol.ElicitationCapability> | Client can present forms or URLs to the user |
2323
| `Experimental` | `IDictionary<string, object>` | Experimental capabilities |
2424

2525
Configure client capabilities when creating an MCP client:
@@ -48,13 +48,13 @@ Handlers for each capability (roots, sampling, elicitation) are covered in their
4848

4949
<xref:ModelContextProtocol.Protocol.ServerCapabilities> declares what features the server supports:
5050

51-
| Capability | Type | Description |
52-
|-----------|------|-------------|
53-
| `Tools` | <xref:ModelContextProtocol.Protocol.ToolsCapability> | Server exposes callable tools |
54-
| `Prompts` | <xref:ModelContextProtocol.Protocol.PromptsCapability> | Server exposes prompt templates |
55-
| `Resources` | <xref:ModelContextProtocol.Protocol.ResourcesCapability> | Server exposes readable resources |
56-
| `Logging` | <xref:ModelContextProtocol.Protocol.LoggingCapability> | Server can send log messages |
57-
| `Completions` | <xref:ModelContextProtocol.Protocol.CompletionsCapability> | Server supports argument completions |
51+
| Capability | Type | Description |
52+
|----------------|-------------------------------|---------------------------|
53+
| `Tools` | <xref:ModelContextProtocol.Protocol.ToolsCapability> | Server exposes callable tools |
54+
| `Prompts` | <xref:ModelContextProtocol.Protocol.PromptsCapability> | Server exposes prompt templates |
55+
| `Resources` | <xref:ModelContextProtocol.Protocol.ResourcesCapability> | Server exposes readable resources |
56+
| `Logging` | <xref:ModelContextProtocol.Protocol.LoggingCapability> | Server can send log messages |
57+
| `Completions` | <xref:ModelContextProtocol.Protocol.CompletionsCapability> | Server supports argument completions |
5858
| `Experimental` | `IDictionary<string, object>` | Experimental capabilities |
5959

6060
Server capabilities are automatically inferred from the configured features. For example, registering tools with `.WithTools<T>()` automatically declares the tools capability.
@@ -63,24 +63,24 @@ Server capabilities are automatically inferred from the configured features. For
6363

6464
Before using an optional feature, check whether the other side declared the corresponding capability.
6565

66-
#### Checking server capabilities from the client
66+
#### Check server capabilities from the client
6767

6868
```csharp
6969
await using var client = await McpClient.CreateAsync(transport);
7070

71-
// Check if the server supports tools
71+
// Check if the server supports tools.
7272
if (client.ServerCapabilities.Tools is not null)
7373
{
7474
var tools = await client.ListToolsAsync();
7575
}
7676

77-
// Check if the server supports resources with subscriptions
77+
// Check if the server supports resources with subscriptions.
7878
if (client.ServerCapabilities.Resources is { Subscribe: true })
7979
{
8080
await client.SubscribeToResourceAsync("config://app/settings");
8181
}
8282

83-
// Check if the server supports prompts with list-changed notifications
83+
// Check if the server supports prompts with list-changed notifications.
8484
if (client.ServerCapabilities.Prompts is { ListChanged: true })
8585
{
8686
mcpClient.RegisterNotificationHandler(
@@ -91,13 +91,13 @@ if (client.ServerCapabilities.Prompts is { ListChanged: true })
9191
});
9292
}
9393

94-
// Check if the server supports logging
94+
// Check if the server supports logging.
9595
if (client.ServerCapabilities.Logging is not null)
9696
{
9797
await client.SetLoggingLevelAsync(LoggingLevel.Info);
9898
}
9999

100-
// Check if the server supports completions
100+
// Check if the server supports completions.
101101
if (client.ServerCapabilities.Completions is not null)
102102
{
103103
var completions = await client.CompleteAsync(
@@ -112,10 +112,10 @@ if (client.ServerCapabilities.Completions is not null)
112112
During connection setup, the client and server negotiate a mutually supported MCP protocol version. After initialization, the negotiated version is available on both sides:
113113

114114
```csharp
115-
// On the client
115+
// On the client.
116116
string? version = client.NegotiatedProtocolVersion;
117117

118-
// On the server (within a tool or handler)
118+
// On the server (within a tool or handler).
119119
string? version = server.NegotiatedProtocolVersion;
120120
```
121121

docs/concepts/completions/completions.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ MCP [completions] allow servers to provide argument auto-completion suggestions
1515

1616
Completions work with two types of references:
1717

18-
- **Prompt argument completions**: Suggest values for prompt parameters (e.g., language names, style options)
19-
- **Resource template argument completions**: Suggest values for URI template parameters (e.g., file paths, resource IDs)
18+
- **Prompt argument completions**: Suggest values for prompt parameters (for example, language names and style options).
19+
- **Resource template argument completions**: Suggest values for URI template parameters (for example, file paths and resource IDs).
2020

2121
The server returns a <xref:ModelContextProtocol.Protocol.Completion> object containing a list of suggested values, an optional total count, and a flag indicating if more values are available.
2222

@@ -36,7 +36,7 @@ builder.Services.AddMcpServer()
3636

3737
var argument = @params.Argument;
3838

39-
// Handle prompt argument completions
39+
// Handle prompt argument completions.
4040
if (@params.Ref is PromptReference promptRef)
4141
{
4242
var suggestions = argument.Name switch
@@ -46,7 +46,7 @@ builder.Services.AddMcpServer()
4646
_ => Array.Empty<string>()
4747
};
4848

49-
// Filter suggestions based on what the user has typed so far
49+
// Filter suggestions based on what the user has typed so far.
5050
var filtered = suggestions.Where(s => s.StartsWith(argument.Value, StringComparison.OrdinalIgnoreCase)).ToList();
5151

5252
return new CompleteResult
@@ -60,7 +60,7 @@ builder.Services.AddMcpServer()
6060
};
6161
}
6262

63-
// Handle resource template argument completions
63+
// Handle resource template argument completions.
6464
if (@params.Ref is ResourceTemplateReference resourceRef)
6565
{
6666
var availableIds = new[] { "1", "2", "3", "4", "5" };
@@ -83,7 +83,7 @@ builder.Services.AddMcpServer()
8383

8484
### Automatic completions with AllowedValuesAttribute
8585

86-
For parameters with a known set of valid values, you can use `System.ComponentModel.DataAnnotations.AllowedValuesAttribute` on `string` parameters of prompts or resource templates. The server will automatically surface those values as completions without needing a custom completion handler.
86+
For parameters with a known set of valid values, you can use <xref:System.ComponentModel.DataAnnotations.AllowedValuesAttribute> on `string` parameters of prompts or resource templates. The server will automatically surface those values as completions without needing a custom completion handler.
8787

8888
#### Prompt parameters
8989

@@ -124,13 +124,13 @@ Clients request completions using <xref:ModelContextProtocol.Client.McpClient.Co
124124
#### Prompt argument completions
125125

126126
```csharp
127-
// Get completions for a prompt argument
127+
// Get completions for a prompt argument.
128128
CompleteResult result = await client.CompleteAsync(
129129
new PromptReference { Name = "code_review" },
130130
argumentName: "language",
131131
argumentValue: "type");
132132

133-
// result.Completion.Values might contain: ["typescript"]
133+
// result.Completion.Values might contain: ["typescript"].
134134
foreach (var suggestion in result.Completion.Values)
135135
{
136136
Console.WriteLine($" {suggestion}");
@@ -145,7 +145,7 @@ if (result.Completion.HasMore == true)
145145
#### Resource template argument completions
146146

147147
```csharp
148-
// Get completions for a resource template argument
148+
// Get completions for a resource template argument.
149149
CompleteResult result = await client.CompleteAsync(
150150
new ResourceTemplateReference { Uri = "file:///{path}" },
151151
argumentName: "path",

0 commit comments

Comments
 (0)