Skip to content

Commit 6148b43

Browse files
halter73Copilot
andcommitted
Remove stale 'Deferred Task Creation with MRTR' section from tasks.md to fix docfx warnings
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent a8c60d0 commit 6148b43

1 file changed

Lines changed: 0 additions & 52 deletions

File tree

docs/concepts/tasks/tasks.md

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -137,58 +137,6 @@ Task support levels:
137137
- `Optional` (default for async methods): Tool can be called with or without task augmentation
138138
- `Required`: Tool must be called with task augmentation
139139

140-
### Deferred Task Creation with MRTR
141-
142-
<!-- mlc-disable-next-line -->
143-
> [!WARNING]
144-
> Deferred task creation depends on both the [Tasks](xref:tasks) and [MRTR](xref:mrtr) experimental features.
145-
146-
By default, when a client sends task metadata with a `tools/call` request, the SDK creates a task immediately and runs the tool in the background. **Deferred task creation** delays the task creation, letting the tool perform ephemeral [MRTR](xref:mrtr) exchanges first — for example, to confirm an action with the user or gather required parameters — before committing to a background task.
147-
148-
To opt in, set `DeferTaskCreation = true` on the tool:
149-
150-
```csharp
151-
McpServerTool.Create(
152-
async (string vmName, McpServer server, CancellationToken ct) =>
153-
{
154-
// Ephemeral MRTR — uses incomplete result / retry cycle.
155-
var confirmation = await server.ElicitAsync(new ElicitRequestParams
156-
{
157-
Message = $"Provision VM '{vmName}'? This will incur costs.",
158-
RequestedSchema = new()
159-
}, ct);
160-
161-
if (confirmation.Action != "confirm")
162-
{
163-
return "Cancelled by user.";
164-
}
165-
166-
// Transition to a background task.
167-
await server.CreateTaskAsync(ct);
168-
169-
// Background work — runs as a task, client polls for status.
170-
await Task.Delay(TimeSpan.FromMinutes(5), ct);
171-
return $"VM '{vmName}' provisioned successfully.";
172-
},
173-
new McpServerToolCreateOptions
174-
{
175-
Name = "provision-vm",
176-
Description = "Provisions a VM with user confirmation",
177-
DeferTaskCreation = true,
178-
Execution = new ToolExecution { TaskSupport = ToolTaskSupport.Optional },
179-
})
180-
```
181-
182-
After <xref:ModelContextProtocol.Server.McpServer.CreateTaskAsync*> returns:
183-
184-
- The MRTR phase ends. The client receives a `CreateTaskResult` with the `taskId`.
185-
- Any subsequent `ElicitAsync` or `SampleAsync` calls in the handler use the task's `input_required` / `tasks/input_response` workflow instead of MRTR.
186-
- The handler's cancellation token is re-linked to the task's lifecycle (TTL expiration, explicit `tasks/cancel`).
187-
188-
If the tool returns without calling `CreateTaskAsync`, a normal (non-task) result is sent to the client — no task is created.
189-
190-
For more details on the MRTR mechanism and the transition flow, see [Transitioning from MRTR to Tasks](xref:mrtr#transitioning-from-mrtr-to-tasks).
191-
192140
### Explicit Task Creation with `IMcpTaskStore`
193141

194142
For more control over task lifecycle, tools can directly interact with <xref:ModelContextProtocol.IMcpTaskStore> and return an `McpTask`. This approach allows you to:

0 commit comments

Comments
 (0)