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/specification/draft/basic/utilities/tasks.mdx
+30-20Lines changed: 30 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -220,7 +220,7 @@ To retrieve the result of a completed task, requestors send a `tasks/result` req
220
220
221
221
### Task Creation Notification
222
222
223
-
When a receiver creates a task, it **MUST** send a `notifications/tasks/created` notification to inform the requestor that the task has been created and polling can begin.
223
+
When a receiver creates a task, it **MAY** send a `notifications/tasks/created` notification to inform the requestor that the task has been created and polling can begin. This notification includes the full task state.
224
224
225
225
**Notification:**
226
226
@@ -229,6 +229,12 @@ When a receiver creates a task, it **MUST** send a `notifications/tasks/created`
229
229
"jsonrpc": "2.0",
230
230
"method": "notifications/tasks/created",
231
231
"params": {
232
+
"taskId": "786512e2-9e0d-44bd-8f29-789f320fe840",
233
+
"status": "working",
234
+
"statusMessage": "The operation is now in progress.",
235
+
"createdAt": "2025-11-25T10:30:00Z",
236
+
"ttl": 60000,
237
+
"pollInterval": 5000,
232
238
"_meta": {
233
239
"modelcontextprotocol.io/related-task": {
234
240
"taskId": "786512e2-9e0d-44bd-8f29-789f320fe840"
@@ -238,15 +244,13 @@ When a receiver creates a task, it **MUST** send a `notifications/tasks/created`
238
244
}
239
245
```
240
246
241
-
The task ID is conveyed through the `modelcontextprotocol.io/related-task` metadata key. The notification parameters are otherwise empty.
247
+
The notification includes the full `Task` object with all task metadata fields, allowing requestors to immediately access the task state without making an additional `tasks/get` request.
242
248
243
-
This notification resolves the race condition where a requestor might attempt to poll for a task before the receiver has finished creating it. By sending this notification immediately after task creation, the receiver signals that the task is ready to be queried via `tasks/get`.
244
-
245
-
Receivers that do not support tasks (and thus ignore task metadata in requests) will not send this notification, allowing requestors to fall back to waiting for the original request response.
249
+
Requestors **MUST NOT** rely on receiving this notification. Requestors **SHOULD** be prepared to begin polling via `tasks/get` immediately after receiving the `CreateTaskResult` response, regardless of whether this notification is received.
246
250
247
251
### Task Status Notification
248
252
249
-
When a task's status changes, receivers **MAY** send a `notifications/tasks/status` notification to inform the requestor of the change.
253
+
When a task's status changes, receivers **MAY** send a `notifications/tasks/status` notification to inform the requestor of the change. This notification includes the full task state.
250
254
251
255
**Notification:**
252
256
@@ -255,7 +259,11 @@ When a task's status changes, receivers **MAY** send a `notifications/tasks/stat
255
259
"jsonrpc": "2.0",
256
260
"method": "notifications/tasks/status",
257
261
"params": {
262
+
"taskId": "786512e2-9e0d-44bd-8f29-789f320fe840",
258
263
"status": "completed",
264
+
"createdAt": "2025-11-25T10:30:00Z",
265
+
"ttl": 60000,
266
+
"pollInterval": 5000,
259
267
"_meta": {
260
268
"modelcontextprotocol.io/related-task": {
261
269
"taskId": "786512e2-9e0d-44bd-8f29-789f320fe840"
@@ -265,12 +273,7 @@ When a task's status changes, receivers **MAY** send a `notifications/tasks/stat
265
273
}
266
274
```
267
275
268
-
The notification includes:
269
-
270
-
-`status`: The new task status
271
-
-`error` (optional): Error message if the status is `failed`
272
-
273
-
The task ID is conveyed through the `modelcontextprotocol.io/related-task` metadata key.
276
+
The notification includes the full `Task` object with all task metadata fields, including the updated `status`, `statusMessage` (if present), and `error` (if the status is `failed`). This allows requestors to access the complete task state without making an additional `tasks/get` request.
274
277
275
278
Requestors **MUST NOT** rely on receiving these notifications, as they are optional. Receivers are not required to send status notifications and may choose to only send them for certain status transitions. Requestors **SHOULD** continue to poll via `tasks/get` to ensure they receive status updates.
276
279
@@ -430,6 +433,13 @@ stateDiagram-v2
430
433
1. For example, an elicitation that a task-augmented tool call depends on **MUST** share the same related task ID with that tool call's task.
431
434
1. For the `tasks/get`, `tasks/list`, `tasks/result`, and `tasks/cancel` operations, the `taskId` parameter in the request **MUST** be used as the source of truth for identifying the target task. Requestors **SHOULD NOT** include `modelcontextprotocol.io/related-task` metadata in these requests, and receivers **MUST** ignore such metadata if present in favor of the RPC method parameter.
432
435
436
+
### Task Notifications
437
+
438
+
1. Receivers **MAY** send a `notifications/tasks/created` notification after creating a task to inform the requestor that the task is ready for polling.
439
+
1. Receivers **MAY** send `notifications/tasks/status` notifications when a task's status changes.
440
+
1. Requestors **MUST NOT** rely on receiving either notification type, as they are both optional.
441
+
1. When sent, these notifications **MUST** include the `modelcontextprotocol.io/related-task` metadata as described in "Associating Task-Related Messages".
442
+
433
443
### Task Progress Notifications
434
444
435
445
Task-augmented requests support progress notifications as defined in the progress notification specification. The `progressToken` provided in the initial request remains valid throughout the task's lifetime.
0 commit comments