Skip to content

Commit 642c3c7

Browse files
committed
Update tasks/result to block until completion
1 parent e96ce21 commit 642c3c7

File tree

1 file changed

+4
-18
lines changed
  • docs/specification/draft/basic/utilities

1 file changed

+4
-18
lines changed

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

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,9 @@ stateDiagram-v2
414414
### Result Retrieval
415415

416416
1. Receivers that accept a task-augmented request **MUST** return a `CreateTaskResult` as the response. This result **SHOULD** be returned as soon as possible after accepting the task.
417-
1. Receivers **MUST** only return the actual operation results via `tasks/result` when the task status is `completed`.
418-
1. Receivers **MUST** return an error if `tasks/result` is called for a task in any other status.
419-
1. Requestors **MAY** call `tasks/result` multiple times for the same task while it remains available.
417+
1. When a receiver receives a `tasks/result` request, it **MUST** block the response until the task reaches a terminal status (`completed`, `failed`, `cancelled`, or `unknown`).
418+
1. For tasks in `completed` status, receivers **MUST** return the actual operation results as specified by the original request type.
419+
1. For tasks in `failed`, `cancelled`, or `unknown` status, receivers **MUST** return a successful JSON-RPC response containing error or status details in the result structure.
420420

421421
### Associating Task-Related Messages
422422

@@ -710,7 +710,6 @@ Receivers **MUST** return standard JSON-RPC errors for the following protocol er
710710

711711
- Invalid or nonexistent `taskId` in `tasks/get`, `tasks/list`, `tasks/result`, or `tasks/delete`: `-32602` (Invalid params)
712712
- Invalid or nonexistent cursor in `tasks/list`: `-32602` (Invalid params)
713-
- Attempting to retrieve result when task is not in `completed` status: `-32602` (Invalid params)
714713
- Receiver rejects a `tasks/delete` request: `-32600` (Invalid request)
715714
- Internal errors: `-32603` (Internal error)
716715

@@ -765,19 +764,6 @@ Receivers are not obligated to retain task metadata indefinitely. It is complian
765764

766765
</Note>
767766

768-
**Example: Result requested for incomplete task**
769-
770-
```json
771-
{
772-
"jsonrpc": "2.0",
773-
"id": 72,
774-
"error": {
775-
"code": -32602,
776-
"message": "Cannot retrieve result: Task status is 'working', not 'completed'"
777-
}
778-
}
779-
```
780-
781767
**Example: Task deletion rejected by receiver**
782768

783769
```json
@@ -810,7 +796,7 @@ When the underlying request does not complete successfully, the task moves to th
810796
}
811797
```
812798

813-
For tasks that wrap tool call requests, when the tool result has `isError` set to true, the task should reach `failed` status. The error information is conveyed both through the task's `failed` status and through the result structure when retrieved via `tasks/result`.
799+
For tasks that wrap tool call requests, when the tool result has `isError` set to true, the task should reach `failed` status.
814800

815801
## Security Considerations
816802

0 commit comments

Comments
 (0)