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/tasks/tasks.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
@@ -8,7 +8,7 @@ uid: tasks
8
8
# MCP Tasks
9
9
10
10
> [!WARNING]
11
-
> Tasks are an **experimental feature** in the MCP specification (version 2025-11-25). The API may change in future releases.
11
+
> Tasks are an **experimental feature** in the MCP specification (version 2025-11-25). The API may change in future releases. See the [Experimental APIs](../../experimental.md) documentation for details on working with experimental APIs.
12
12
13
13
The Model Context Protocol (MCP) supports [task-based execution] for long-running operations. Tasks enable a "call-now, fetch-later" pattern where clients can initiate operations that may take significant time to complete, then poll for status and retrieve results when ready.
description: Working with experimental APIs in the MCP C# SDK
5
+
uid: experimental
6
+
---
7
+
8
+
The Model Context Protocol C# SDK uses the [`[Experimental]`](https://learn.microsoft.com/dotnet/api/system.diagnostics.codeanalysis.experimentalattribute) attribute to mark APIs that are still in development and may change without notice. For more details on the SDK's versioning policy around experimental APIs, see the [Versioning](versioning.md) documentation.
9
+
10
+
## Suppressing experimental diagnostics
11
+
12
+
When you use an experimental API, the compiler produces a diagnostic (e.g., `MCPEXP001`) to ensure you're aware the API may change. If you want to use the API, suppress the diagnostic in one of these ways:
13
+
14
+
### Project-wide suppression
15
+
16
+
Add the diagnostic ID to `<NoWarn>` in your project file:
17
+
18
+
```xml
19
+
<PropertyGroup>
20
+
<NoWarn>$(NoWarn);MCPEXP001</NoWarn>
21
+
</PropertyGroup>
22
+
```
23
+
24
+
### Per-call suppression
25
+
26
+
Use `#pragma warning disable` around specific call sites:
27
+
28
+
```csharp
29
+
#pragmawarningdisable MCPEXP001 // The Tasks feature is experimental per the MCP specification and is subject to change.
30
+
tool.Execution=newToolExecution { ... };
31
+
#pragmawarningrestore MCPEXP001
32
+
```
33
+
34
+
For a full list of experimental diagnostic IDs and their descriptions, see the [list of diagnostics](list-of-diagnostics.md#experimental-apis).
35
+
36
+
## Serialization behavior
37
+
38
+
Experimental properties on protocol types are fully serialized and deserialized when using the SDK's built-in serialization via <xref:ModelContextProtocol.McpJsonUtilities.DefaultOptions>. This means experimental data is transmitted on the wire even if your application code doesn't directly interact with it, preserving protocol compatibility.
39
+
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
+
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
+
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
+
47
+
### Custom `JsonSerializerContext`
48
+
49
+
If you define your own `JsonSerializerContext` that includes MCP protocol types, configure a `TypeInfoResolverChain` so the SDK's resolver handles MCP types:
By placing the SDK's resolver first, MCP types are serialized using the SDK's contract (which includes experimental properties), while your custom context handles your own types. This is recommended even if you aren't currently using experimental APIs, since it ensures your serialization configuration remains correct as new experimental properties are introduced or as you adopt experimental features in the future.
65
+
66
+
## See also
67
+
68
+
-[Versioning](versioning.md)
69
+
-[List of diagnostics](list-of-diagnostics.md#experimental-apis)
0 commit comments