Skip to content

Commit 2fdea38

Browse files
committed
Make task IDs exclusively server-generated
1 parent 0ab6785 commit 2fdea38

File tree

4 files changed

+6
-35
lines changed

4 files changed

+6
-35
lines changed

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

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ title: Tasks
66

77
<Info>**Protocol Revision**: draft</Info>
88

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**.
1010

1111
## User Interaction Model
1212

@@ -90,7 +90,7 @@ Task-augmented requests follow a two-phase response pattern that differs from no
9090
- **Normal requests**: The server processes the request and returns the actual operation result directly.
9191
- **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.
9292

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.
9494

9595
**Request:**
9696

@@ -106,7 +106,6 @@ To create a task, requestors send a request with the `modelcontextprotocol.io/ta
106106
},
107107
"_meta": {
108108
"modelcontextprotocol.io/task": {
109-
"taskId": "786512e2-9e0d-44bd-8f29-789f320fe840",
110109
"keepAlive": 60000
111110
}
112111
}
@@ -358,8 +357,8 @@ These requirements apply to all parties that support receiving task-augmented re
358357
### Task ID Requirements
359358

360359
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.
363362

364363
### Task Status Lifecycle
365364

@@ -675,15 +674,13 @@ When augmenting a request with task execution, the `modelcontextprotocol.io/task
675674
```json
676675
{
677676
"modelcontextprotocol.io/task": {
678-
"taskId": "786512e2-9e0d-44bd-8f29-789f320fe840",
679677
"keepAlive": 60000
680678
}
681679
}
682680
```
683681

684682
Fields:
685683

686-
- `taskId` (string, required): Client-generated unique identifier for the task
687684
- `keepAlive` (number, optional): Requested duration in milliseconds to retain results after completion
688685

689686
### Related Task Metadata
@@ -713,7 +710,6 @@ Receivers **MUST** return standard JSON-RPC errors for the following protocol er
713710

714711
- Invalid or nonexistent `taskId` in `tasks/get`, `tasks/list`, `tasks/result`, or `tasks/delete`: `-32602` (Invalid params)
715712
- 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)
717713
- Attempting to retrieve result when task is not in `completed` status: `-32602` (Invalid params)
718714
- Receiver rejects a `tasks/delete` request: `-32600` (Invalid request)
719715
- Internal errors: `-32603` (Internal error)
@@ -765,19 +761,6 @@ Receivers are not obligated to retain task metadata indefinitely. It is complian
765761
}
766762
```
767763

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"
777-
}
778-
}
779-
```
780-
781764
**Example: Task deletion rejected by receiver**
782765

783766
```json

docs/specification/draft/schema.mdx

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

schema/draft/schema.json

Lines changed: 0 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

schema/draft/schema.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,11 +1175,6 @@ export type TaskStatus =
11751175
* @category tasks
11761176
*/
11771177
export interface TaskMetadata {
1178-
/**
1179-
* Client-generated unique identifier for the task.
1180-
*/
1181-
taskId: string;
1182-
11831178
/**
11841179
* Requested duration in milliseconds to retain results after completion.
11851180
*/

0 commit comments

Comments
 (0)