You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/concepts/cancellation/cancellation.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -35,7 +35,7 @@ public static async Task<string> LongComputation(
35
35
}
36
36
```
37
37
38
-
When the client sends a cancellation notification, the <xref:System.OperationCanceledException> propagates back to the client as a cancellation response.
38
+
When the client sends a cancellation notification, the `OperationCanceledException` propagates back to the client as a cancellation response.
Copy file name to clipboardExpand all lines: docs/concepts/completions/completions.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -83,7 +83,7 @@ builder.Services.AddMcpServer()
83
83
84
84
### Automatic completions with AllowedValuesAttribute
85
85
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.
86
+
For parameters with a known set of valid values, you can use `AllowedValuesAttribute` on `string` parameters of prompts or resource templates. The server will automatically surface those values as completions without needing a custom completion handler.
Copy file name to clipboardExpand all lines: docs/concepts/httpcontext/httpcontext.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,18 +10,18 @@ uid: httpcontext
10
10
When using the Streamable HTTP transport, an MCP server might need to access the underlying <xref:Microsoft.AspNetCore.Http.HttpContext> for a request.
11
11
The <xref:Microsoft.AspNetCore.Http.HttpContext> object contains request metadata such as the HTTP headers, authorization context, and the actual path and query string for the request.
12
12
13
-
To access the <xref:Microsoft.AspNetCore.Http.HttpContext>, the MCP server should add the <xref:Microsoft.AspNetCore.Http.IHttpContextAccessor> service to the application service collection (typically in Program.cs).
14
-
Then any classes, for example, a class containing MCP tools, should accept an <xref:Microsoft.AspNetCore.Http.IHttpContextAccessor> in their constructor and store this for use by its methods.
15
-
Methods then use the <xref:Microsoft.AspNetCore.Http.IHttpContextAccessor.HttpContext> property of the accessor to get the current context.
13
+
To access the <xref:Microsoft.AspNetCore.Http.HttpContext>, the MCP server should add the `IHttpContextAccessor` service to the application service collection (typically in Program.cs).
14
+
Then any classes, for example, a class containing MCP tools, should accept an `IHttpContextAccessor` in their constructor and store this for use by its methods.
15
+
Methods then use the `HttpContext` property of the accessor to get the current context.
16
16
17
-
The following code snippet illustrates how to add the <xref:Microsoft.AspNetCore.Http.IHttpContextAccessor> service to the application service collection:
17
+
The following code snippet illustrates how to add the `IHttpContextAccessor` service to the application service collection:
Any class that needs access to the <xref:Microsoft.AspNetCore.Http.HttpContext> can accept an <xref:Microsoft.AspNetCore.Http.IHttpContextAccessor> in its constructor and store it for later use.
21
+
Any class that needs access to the <xref:Microsoft.AspNetCore.Http.HttpContext> can accept an `IHttpContextAccessor` in its constructor and store it for later use.
22
22
Methods of the class can then access the current <xref:Microsoft.AspNetCore.Http.HttpContext> using the stored accessor.
23
23
24
-
The following code snippet shows the `ContextTools` class accepting an <xref:Microsoft.AspNetCore.Http.IHttpContextAccessor> in its primary constructor
24
+
The following code snippet shows the `ContextTools` class accepting an `IHttpContextAccessor` in its primary constructor
25
25
and the `GetHttpHeaders` method accessing the current <xref:Microsoft.AspNetCore.Http.HttpContext> to retrieve the HTTP headers from the current request.
Copy file name to clipboardExpand all lines: docs/concepts/progress/progress.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,9 +50,9 @@ await using var handler = mcpClient.RegisterNotificationHandler(NotificationMeth
50
50
});
51
51
```
52
52
53
-
The second way is to pass a [`Progress<T>`](https://learn.microsoft.com/dotnet/api/system.progress-1) instance to the tool method. <xref:System.Progress%601> is a standard .NET type that provides a way to receive progress updates.
53
+
The second way is to pass a [`Progress<T>`](https://learn.microsoft.com/dotnet/api/system.progress-1) instance to the tool method. `Progress\<T>` is a standard .NET type that provides a way to receive progress updates.
54
54
For the purposes of MCP progress notifications, `T` should be <xref:ModelContextProtocol.ProgressNotificationValue>.
55
-
The MCP C# SDK will automatically handle progress notifications and report them through the <xref:System.Progress%601> instance.
55
+
The MCP C# SDK will automatically handle progress notifications and report them through the `Progress\<T>` instance.
56
56
This notification handler will only receive progress updates for the specific request that was made,
57
57
rather than all progress notifications from the server.
Copy file name to clipboardExpand all lines: docs/concepts/tools/tools.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -208,7 +208,7 @@ Tool errors in MCP are distinct from protocol errors. When a tool encounters an
208
208
When a tool method throws an exception, the server catches it and returns a <xref:ModelContextProtocol.Protocol.CallToolResult> with `IsError = true`, with the following exceptions:
209
209
210
210
-<xref:ModelContextProtocol.McpProtocolException> is rethrown as a JSON-RPC error response (not a tool error result).
211
-
-<xref:System.OperationCanceledException> is rethrown when the cancellation token was triggered.
211
+
-`OperationCanceledException` is rethrown when the cancellation token was triggered.
212
212
213
213
For all other exceptions, the error is returned as a tool result. If the exception derives from <xref:ModelContextProtocol.McpException> (excluding <xref:ModelContextProtocol.McpProtocolException>, which is rethrown above), its message is included in the error text; otherwise, a generic message is returned to avoid leaking internal details.
Copy file name to clipboardExpand all lines: docs/experimental.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,14 +39,14 @@ Experimental properties on protocol types are fully serialized and deserialized
39
39
40
40
The behavior of experimental properties differs depending on whether you use [reflection-based or source-generated](https://learn.microsoft.com/dotnet/standard/serialization/system-text-json/source-generation) serialization:
41
41
42
-
-**Reflection-based serialization** (the default when no <xref:System.Text.Json.Serialization.JsonSerializerContext> is used): Experimental properties are included. No special configuration is needed.
43
-
-**Source-generated serialization** (using a custom <xref:System.Text.Json.Serialization.JsonSerializerContext>): Experimental properties are **not** included in your context's serialization contract. This is by design, as it protects your compiled code against binary breaking changes to experimental APIs.
42
+
-**Reflection-based serialization** (the default when no `JsonSerializerContext` is used): Experimental properties are included. No special configuration is needed.
43
+
-**Source-generated serialization** (using a custom `JsonSerializerContext`): Experimental properties are **not** included in your context's serialization contract. This is by design, as it protects your compiled code against binary breaking changes to experimental APIs.
44
44
45
45
This means that switching between reflection-based and source-generated serialization can silently change which properties are serialized. To avoid this, source-generation users should configure a `TypeInfoResolverChain` as described below.
46
46
47
-
### Custom `JsonSerializerContext`
47
+
### Custom JsonSerializerContext
48
48
49
-
If you define your own <xref:System.Text.Json.Serialization.JsonSerializerContext> that includes MCP protocol types, configure a `TypeInfoResolverChain` so the SDK's resolver handles MCP types:
49
+
If you define your own `JsonSerializerContext` that includes MCP protocol types, configure a `TypeInfoResolverChain` so the SDK's resolver handles MCP types:
0 commit comments