Skip to content

Commit e5f064e

Browse files
authored
Merge pull request modelcontextprotocol#1732 from LucaButBoring/feat/tasks
SEP-1686: Tasks
2 parents 7ed65b0 + cbf3dca commit e5f064e

File tree

11 files changed

+1883
-50
lines changed

11 files changed

+1883
-50
lines changed

docs/docs.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,8 @@
231231
"pages": [
232232
"specification/draft/basic/utilities/cancellation",
233233
"specification/draft/basic/utilities/ping",
234-
"specification/draft/basic/utilities/progress"
234+
"specification/draft/basic/utilities/progress",
235+
"specification/draft/basic/utilities/tasks"
235236
]
236237
}
237238
]

docs/docs/learn/architecture.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ MCP also defines primitives that _clients_ can expose. These primitives allow MC
132132

133133
For more details about client primitives see [client concepts](./client-concepts).
134134

135+
Besides server and client primitives, the protocol offers cross-cutting utility primitives that augment how requests are executed:
136+
137+
- **Tasks (Experimental)**: Durable execution wrappers that enable deferred result retrieval and status tracking for MCP requests (e.g., expensive computations, workflow automation, batch processing, multi-step operations)
138+
135139
#### Notifications
136140

137141
The protocol supports real-time notifications to enable dynamic updates between servers and clients. For example, when a server's available tools change—such as when new functionality becomes available or existing tools are modified—the server can send tool update notifications to inform connected clients about these changes. Notifications are sent as JSON-RPC 2.0 notification messages (without expecting a response) and enable MCP servers to provide real-time updates to connected clients.

docs/specification/draft/basic/lifecycle.mdx

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,16 @@ The client **MUST** initiate this phase by sending an `initialize` request conta
6767
"elicitation": {
6868
"form": {},
6969
"url": {}
70+
},
71+
"tasks": {
72+
"requests": {
73+
"elicitation": {
74+
"create": {}
75+
},
76+
"sampling": {
77+
"createMessage": {}
78+
}
79+
}
7080
}
7181
},
7282
"clientInfo": {
@@ -105,6 +115,15 @@ The server **MUST** respond with its own capabilities and information:
105115
},
106116
"tools": {
107117
"listChanged": true
118+
},
119+
"tasks": {
120+
"list": {},
121+
"cancel": {},
122+
"requests": {
123+
"tools": {
124+
"call": {}
125+
}
126+
}
108127
}
109128
},
110129
"serverInfo": {
@@ -169,18 +188,20 @@ available during the session.
169188

170189
Key capabilities include:
171190

172-
| Category | Capability | Description |
173-
| -------- | -------------- | ------------------------------------------------------------------------------------ |
174-
| Client | `roots` | Ability to provide filesystem [roots](/specification/draft/client/roots) |
175-
| Client | `sampling` | Support for LLM [sampling](/specification/draft/client/sampling) requests |
176-
| Client | `elicitation` | Support for server [elicitation](/specification/draft/client/elicitation) requests |
177-
| Client | `experimental` | Describes support for non-standard experimental features |
178-
| Server | `prompts` | Offers [prompt templates](/specification/draft/server/prompts) |
179-
| Server | `resources` | Provides readable [resources](/specification/draft/server/resources) |
180-
| Server | `tools` | Exposes callable [tools](/specification/draft/server/tools) |
181-
| Server | `logging` | Emits structured [log messages](/specification/draft/server/utilities/logging) |
182-
| Server | `completions` | Supports argument [autocompletion](/specification/draft/server/utilities/completion) |
183-
| Server | `experimental` | Describes support for non-standard experimental features |
191+
| Category | Capability | Description |
192+
| -------- | -------------- | ---------------------------------------------------------------------------------------- |
193+
| Client | `roots` | Ability to provide filesystem [roots](/specification/draft/client/roots) |
194+
| Client | `sampling` | Support for LLM [sampling](/specification/draft/client/sampling) requests |
195+
| Client | `elicitation` | Support for server [elicitation](/specification/draft/client/elicitation) requests |
196+
| Client | `tasks` | Support for [task-augmented](/specification/draft/basic/utilities/tasks) client requests |
197+
| Client | `experimental` | Describes support for non-standard experimental features |
198+
| Server | `prompts` | Offers [prompt templates](/specification/draft/server/prompts) |
199+
| Server | `resources` | Provides readable [resources](/specification/draft/server/resources) |
200+
| Server | `tools` | Exposes callable [tools](/specification/draft/server/tools) |
201+
| Server | `logging` | Emits structured [log messages](/specification/draft/server/utilities/logging) |
202+
| Server | `completions` | Supports argument [autocompletion](/specification/draft/server/utilities/completion) |
203+
| Server | `tasks` | Support for [task-augmented](/specification/draft/basic/utilities/tasks) server requests |
204+
| Server | `experimental` | Describes support for non-standard experimental features |
184205

185206
Capability objects can describe sub-capabilities like:
186207

docs/specification/draft/basic/utilities/cancellation.mdx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,17 @@ notification containing:
3434
1. Cancellation notifications **MUST** only reference requests that:
3535
- Were previously issued in the same direction
3636
- Are believed to still be in-progress
37-
2. The `initialize` request **MUST NOT** be cancelled by clients
38-
3. Receivers of cancellation notifications **SHOULD**:
37+
1. The `initialize` request **MUST NOT** be cancelled by clients
38+
1. For [task-augmented requests](./tasks), the `tasks/cancel` request **MUST** be used instead of the `notifications/cancelled` notification. Tasks have their own dedicated cancellation mechanism that returns the final task state.
39+
1. Receivers of cancellation notifications **SHOULD**:
3940
- Stop processing the cancelled request
4041
- Free associated resources
4142
- Not send a response for the cancelled request
42-
4. Receivers **MAY** ignore cancellation notifications if:
43+
1. Receivers **MAY** ignore cancellation notifications if:
4344
- The referenced request is unknown
4445
- Processing has already completed
4546
- The request cannot be cancelled
46-
5. The sender of the cancellation notification **SHOULD** ignore any response to the
47+
1. The sender of the cancellation notification **SHOULD** ignore any response to the
4748
request that arrives afterward
4849

4950
## Timing Considerations

docs/specification/draft/basic/utilities/progress.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ The receiver **MAY** then send progress notifications containing:
6868
- Send notifications at whatever frequency they deem appropriate
6969
- Omit the total value if unknown
7070

71+
3. For [task-augmented requests](./tasks), the `progressToken` provided in the original request **MUST** continue to be used for progress notifications throughout the task's lifetime, even after the `CreateTaskResult` has been returned. The progress token remains valid and associated with the task until the task reaches a terminal status.
72+
- Progress notifications for tasks **MUST** use the same `progressToken` that was provided in the initial task-augmented request
73+
- Progress notifications for tasks **MUST** stop after the task reaches a terminal status (`completed`, `failed`, or `cancelled`)
74+
7175
```mermaid
7276
sequenceDiagram
7377
participant Sender

0 commit comments

Comments
 (0)