Skip to content

Commit b9e04ad

Browse files
committed
Make CancelTaskResult include full task; loosen deletion reqs
1 parent 7421af3 commit b9e04ad

File tree

4 files changed

+25
-135
lines changed

4 files changed

+25
-135
lines changed

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

Lines changed: 10 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -320,9 +320,9 @@ To retrieve a list of tasks, requestors send a `tasks/list` request. This operat
320320

321321
### Cancelling Tasks
322322

323-
To explicitly cancel a task, requestors send a `tasks/cancel` request. The request can optionally include a `delete` parameter to immediately delete the task and its results after cancellation.
323+
To explicitly cancel a task, requestors send a `tasks/cancel` request.
324324

325-
**Request (basic cancellation):**
325+
**Request:**
326326

327327
```json
328328
{
@@ -342,41 +342,12 @@ To explicitly cancel a task, requestors send a `tasks/cancel` request. The reque
342342
"jsonrpc": "2.0",
343343
"id": 6,
344344
"result": {
345-
"status": "cancelled",
346-
"executionStopped": true,
347-
"_meta": {
348-
"modelcontextprotocol.io/related-task": {
349-
"taskId": "786512e2-9e0d-44bd-8f29-789f320fe840"
350-
}
351-
}
352-
}
353-
}
354-
```
355-
356-
**Request (cancellation with deletion):**
357-
358-
```json
359-
{
360-
"jsonrpc": "2.0",
361-
"id": 7,
362-
"method": "tasks/cancel",
363-
"params": {
364345
"taskId": "786512e2-9e0d-44bd-8f29-789f320fe840",
365-
"delete": true
366-
}
367-
}
368-
```
369-
370-
**Response:**
371-
372-
```json
373-
{
374-
"jsonrpc": "2.0",
375-
"id": 7,
376-
"result": {
377346
"status": "cancelled",
378-
"executionStopped": true,
379-
"deleted": true,
347+
"statusMessage": "The task was cancelled by request.",
348+
"createdAt": "2025-11-25T10:30:00Z",
349+
"ttl": 30000,
350+
"pollInterval": 5000,
380351
"_meta": {
381352
"modelcontextprotocol.io/related-task": {
382353
"taskId": "786512e2-9e0d-44bd-8f29-789f320fe840"
@@ -475,9 +446,8 @@ Task-augmented requests support progress notifications as defined in the progres
475446
1. Receivers **MUST** reject cancellation requests for tasks already in a terminal status (`completed`, `failed`, or `cancelled`) with error code `-32602` (Invalid params).
476447
1. Upon receiving a valid cancellation request, receivers **SHOULD** attempt to stop the task's execution (best effort) and **MUST** transition the task to `cancelled` status before sending the response.
477448
1. Once a task is cancelled, it **MUST** remain in `cancelled` status even if execution continues to completion or fails.
478-
1. If the `delete` parameter is `true`, receivers **SHOULD** delete the task and all associated results and metadata after transitioning to `cancelled` status. Receivers **MAY** choose not to support deletion and ignore this parameter.
479-
1. If the `delete` parameter is `false` or omitted, receivers **MUST** retain the task in `cancelled` status subject to the `ttl` duration.
480-
1. Requestors **SHOULD** use the `delete` parameter to clean up tasks containing sensitive data promptly rather than relying solely on `ttl` expiration.
449+
1. The `tasks/cancel` operation does not define deletion behavior. However, receivers **MAY** delete cancelled tasks at their discretion at any time, including immediately after cancellation or after the task's `ttl` expires.
450+
1. Requestors **SHOULD NOT** rely on cancelled tasks being retained for any specific duration and should retrieve any needed information before cancelling.
481451

482452
## Message Flow
483453

@@ -635,44 +605,11 @@ sequenceDiagram
635605
Note over S: Server stops execution (best effort)
636606
Note over S: Task moves to cancelled status
637607
638-
S->>C: Result (status: cancelled, executionStopped: true)
608+
S->>C: Task (status: cancelled)
639609
640610
Note over C: Client receives confirmation
641611
642-
Note over S: After ttl period from creation, task cleaned up
643-
```
644-
645-
### Task Cancellation with Deletion Flow
646-
647-
```mermaid
648-
sequenceDiagram
649-
participant C as Client (Requestor)
650-
participant S as Server (Receiver)
651-
652-
Note over C,S: 1. Task Creation and Completion
653-
C->>S: tools/call (task-123)
654-
S->>C: CreateTaskResult (task-123, status: working)
655-
S--)C: notifications/tasks/created
656-
Note over S: Task processing...
657-
C->>S: tasks/get (task-123)
658-
S->>C: completed
659-
660-
Note over C,S: 2. Result Retrieval
661-
C->>S: tasks/result (task-123)
662-
S->>C: Result content
663-
664-
Note over C,S: 3. Cancellation with Deletion
665-
Note over C: Client decides to clean up task
666-
C->>S: tasks/cancel (task-123, delete: true)
667-
668-
Note over S: Task moves to cancelled status
669-
Note over S: Task and results immediately deleted
670-
671-
S->>C: Result (status: cancelled, deleted: true)
672-
673-
Note over C,S: 4. Verification (optional)
674-
C->>S: tasks/get (task-123)
675-
S->>C: Error: Task not found
612+
Note over S: Server may delete task at its discretion
676613
```
677614

678615
## Data Types
@@ -852,12 +789,6 @@ The `tasks/result` endpoint returns exactly what the underlying request would ha
852789

853790
### Resource Management
854791

855-
<Warning>
856-
857-
Task results may persist for the duration specified by the TTL. For sensitive operations, requestors should carefully consider the security implications of extended task retention and may want to retrieve results promptly and request shorter `ttl` durations. Requestors are encouraged to use `tasks/cancel` with the `delete` parameter set to `true` to explicitly clean up tasks containing sensitive data rather than relying solely on `ttl` expiration.
858-
859-
</Warning>
860-
861792
1. Receivers **SHOULD**:
862793
1. Enforce limits on concurrent tasks per requestor
863794
1. Enforce maximum `ttl` durations to prevent indefinite resource retention

docs/specification/draft/schema.mdx

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

0 commit comments

Comments
 (0)