|
10 | 10 | This module demonstrates the *interceptive* half of the extension API. A `Tasks` |
11 | 11 | instance: |
12 | 12 |
|
13 | | - - overrides `intercept_tool_call` to branch on `params.task`: a plain call |
14 | | - passes through untouched; a task-augmented call still runs the tool, but its |
15 | | - result is recorded under a task id and returned with that id stamped into |
16 | | - `_meta["io.modelcontextprotocol/related-task"]`, and |
| 13 | + - overrides `intercept_tool_call` to branch on `params.task`: a call WITHOUT a |
| 14 | + `task` field passes through untouched (it is a normal blocking call), so |
| 15 | + plain `tools/call` behaviour is unchanged. Only a call the client explicitly |
| 16 | + augments with a `task` field is recorded under a task id and returned with |
| 17 | + that id stamped into `_meta["io.modelcontextprotocol/related-task"]`, and |
17 | 18 | - overrides `methods` to serve `tasks/get`, `tasks/result`, `tasks/cancel`, |
18 | 19 | and `tasks/list` so a client can poll status and fetch the payload. |
19 | 20 |
|
|
24 | 25 |
|
25 | 26 | - The tool runs to completion inline, so a task is observed as `completed` |
26 | 27 | immediately (no detached/background execution, no TTL eviction). |
| 28 | + - Any tool may be task-augmented when the client sends a `task` field; per-tool |
| 29 | + gating on the declared `ToolExecution.task_support` |
| 30 | + (`forbidden`/`optional`/`required`) is not enforced. A production extension |
| 31 | + would reject a `task`-augmented call to a `forbidden` tool and a plain call |
| 32 | + to a `required` one. |
27 | 33 | - A task-augmented `tools/call` returns a normal `CallToolResult` (with the |
28 | 34 | task id in `_meta`) rather than the spec's `CreateTaskResult`. The wire |
29 | 35 | schema for `tools/call` only admits `CallToolResult | InputRequiredResult` |
|
0 commit comments