mirror of
https://github.com/modelcontextprotocol/servers.git
synced 2026-04-18 00:03:23 +02:00
feat(everything): add SEP-1686 Tasks support
- Add tasks capability with list, cancel, and requests.tools.call - Add InMemoryTaskStore and InMemoryTaskMessageQueue from SDK experimental - Add simulate-research-query tool demonstrating task lifecycle - Task demonstrates working -> input_required -> completed status flow - Uses elicitation for ambiguous queries when client supports it Closes #3037 🦉 Generated with [Claude Code](https://claude.ai/code)
This commit is contained in:
@@ -22,7 +22,8 @@
|
||||
- `trigger-long-running-operation` (tools/trigger-trigger-long-running-operation.ts): Simulates a multi-step operation over a given `duration` and number of `steps`; reports progress via `notifications/progress` when a `progressToken` is provided by the client.
|
||||
- `toggle-simulated-logging` (tools/toggle-simulated-logging.ts): Starts or stops simulated, random‑leveled logging for the invoking session. Respects the client’s selected minimum logging level.
|
||||
- `toggle-subscriber-updates` (tools/toggle-subscriber-updates.ts): Starts or stops simulated resource update notifications for URIs the invoking session has subscribed to.
|
||||
- `trigger-sampling-request` (tools/trigger-sampling-request.ts): Issues a `sampling/createMessage` request to the client/LLM using provided `prompt` and optional generation controls; returns the LLM’s response payload.
|
||||
- `trigger-sampling-request` (tools/trigger-sampling-request.ts): Issues a `sampling/createMessage` request to the client/LLM using provided `prompt` and optional generation controls; returns the LLM's response payload.
|
||||
- `simulate-research-query` (tools/simulate-research-query.ts): Demonstrates MCP Tasks (SEP-1686) with a simulated multi-stage research operation. Accepts `topic` and `ambiguous` parameters. Returns a task that progresses through stages with status updates. If `ambiguous` is true and client supports elicitation, pauses with `input_required` status to gather clarification.
|
||||
|
||||
## Prompts
|
||||
|
||||
@@ -50,3 +51,30 @@
|
||||
- Simulated logging is available but off by default.
|
||||
- Use the `toggle-simulated-logging` tool to start/stop periodic log messages of varying levels (debug, info, notice, warning, error, critical, alert, emergency) per session.
|
||||
- Clients can control the minimum level they receive via the standard MCP `logging/setLevel` request.
|
||||
|
||||
## Tasks (SEP-1686)
|
||||
|
||||
The server advertises support for MCP Tasks, enabling long-running operations with status tracking:
|
||||
|
||||
- **Capabilities advertised**: `tasks.list`, `tasks.cancel`, `tasks.requests.tools.call`
|
||||
- **Task Store**: Uses `InMemoryTaskStore` from SDK experimental for task lifecycle management
|
||||
- **Message Queue**: Uses `InMemoryTaskMessageQueue` for task-related messaging
|
||||
|
||||
### Task Lifecycle
|
||||
|
||||
1. Client calls `tools/call` with `task: true` parameter
|
||||
2. Server returns `CreateTaskResult` with `taskId` instead of immediate result
|
||||
3. Client polls `tasks/get` to check status and receive `statusMessage` updates
|
||||
4. When status is `completed`, client calls `tasks/result` to retrieve the final result
|
||||
|
||||
### Task Statuses
|
||||
|
||||
- `working`: Task is actively processing
|
||||
- `input_required`: Task needs additional input (demonstrated via elicitation side-channel)
|
||||
- `completed`: Task finished successfully
|
||||
- `failed`: Task encountered an error
|
||||
- `cancelled`: Task was cancelled by client
|
||||
|
||||
### Demo Tool
|
||||
|
||||
Use the `simulate-research-query` tool to exercise the full task lifecycle. Set `ambiguous: true` to trigger the `input_required` flow with elicitation.
|
||||
|
||||
Reference in New Issue
Block a user