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
+4-21Lines changed: 4 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ title: Tasks
6
6
7
7
<Info>**Protocol Revision**: draft</Info>
8
8
9
-
The Model Context Protcol (MCP) allows requestors (which can be either clients or servers, depending on the direction of communication) to augment their requests with **tasks**. Tasks are durable state machines that carry information about the underlying execution state of the request they wrap, and are intended for requestor polling and deferred result retrieval. Each task is uniquely identifiable by a requestor-generated **task ID**.
9
+
The Model Context Protcol (MCP) allows requestors (which can be either clients or servers, depending on the direction of communication) to augment their requests with **tasks**. Tasks are durable state machines that carry information about the underlying execution state of the request they wrap, and are intended for requestor polling and deferred result retrieval. Each task is uniquely identifiable by a receiver-generated **task ID**.
10
10
11
11
## User Interaction Model
12
12
@@ -90,7 +90,7 @@ Task-augmented requests follow a two-phase response pattern that differs from no
90
90
-**Normal requests**: The server processes the request and returns the actual operation result directly.
91
91
-**Task-augmented requests**: The server accepts the request and immediately returns a `CreateTaskResult` containing task metadata. The actual operation result becomes available later through `tasks/result` after the task completes.
92
92
93
-
To create a task, requestors send a request with the `modelcontextprotocol.io/task` key included in `_meta`, with a `taskId` value representing the task ID. Requestors **MAY** include a `keepAlive`, with a value representing how long after completion the requestor would like the task results to be kept for.
93
+
To create a task, requestors send a request with the `modelcontextprotocol.io/task` key included in `_meta`. Requestors **MAY** include a `keepAlive` value representing how long after completion the requestor would like the task results to be kept for.
94
94
95
95
**Request:**
96
96
@@ -106,7 +106,6 @@ To create a task, requestors send a request with the `modelcontextprotocol.io/ta
106
106
},
107
107
"_meta": {
108
108
"modelcontextprotocol.io/task": {
109
-
"taskId": "786512e2-9e0d-44bd-8f29-789f320fe840",
110
109
"keepAlive": 60000
111
110
}
112
111
}
@@ -358,8 +357,8 @@ These requirements apply to all parties that support receiving task-augmented re
358
357
### Task ID Requirements
359
358
360
359
1. Task IDs **MUST** be a string value.
361
-
1. Task IDs **SHOULD** be unique across all tasks controlled by the receiver.
362
-
1.The receiver of a request with a task ID in its `_meta`**MAY**validate that the provided task ID has not already been associated with a task controlled by that receiver.
360
+
1. Task IDs **MUST** be generated by the receiver when creating a task.
361
+
1.Task IDs **MUST**be unique across all tasks controlled by the receiver.
363
362
364
363
### Task Status Lifecycle
365
364
@@ -675,15 +674,13 @@ When augmenting a request with task execution, the `modelcontextprotocol.io/task
675
674
```json
676
675
{
677
676
"modelcontextprotocol.io/task": {
678
-
"taskId": "786512e2-9e0d-44bd-8f29-789f320fe840",
679
677
"keepAlive": 60000
680
678
}
681
679
}
682
680
```
683
681
684
682
Fields:
685
683
686
-
-`taskId` (string, required): Client-generated unique identifier for the task
687
684
-`keepAlive` (number, optional): Requested duration in milliseconds to retain results after completion
688
685
689
686
### Related Task Metadata
@@ -713,7 +710,6 @@ Receivers **MUST** return standard JSON-RPC errors for the following protocol er
713
710
714
711
- Invalid or nonexistent `taskId` in `tasks/get`, `tasks/list`, `tasks/result`, or `tasks/delete`: `-32602` (Invalid params)
715
712
- Invalid or nonexistent cursor in `tasks/list`: `-32602` (Invalid params)
716
-
- Request with a `taskId` that was already used for a different task (if the receiver validates task ID uniqueness): `-32602` (Invalid params)
717
713
- Attempting to retrieve result when task is not in `completed` status: `-32602` (Invalid params)
718
714
- Receiver rejects a `tasks/delete` request: `-32600` (Invalid request)
719
715
- Internal errors: `-32603` (Internal error)
@@ -765,19 +761,6 @@ Receivers are not obligated to retain task metadata indefinitely. It is complian
765
761
}
766
762
```
767
763
768
-
**Example: Duplicate task ID (if receiver validates uniqueness)**
769
-
770
-
```json
771
-
{
772
-
"jsonrpc": "2.0",
773
-
"id": 73,
774
-
"error": {
775
-
"code": -32602,
776
-
"message": "Task ID already exists: 786512e2-9e0d-44bd-8f29-789f320fe840"
0 commit comments