Skip to content

Commit d05cfbb

Browse files
committed
Alter input_required to note tasks/result relation
1 parent 7d008e0 commit d05cfbb

File tree

1 file changed

+13
-12
lines changed
  • docs/specification/draft/basic/utilities

1 file changed

+13
-12
lines changed

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

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -399,10 +399,10 @@ stateDiagram-v2
399399

400400
### Input Required Status
401401

402-
1. When a receiver sends a request associated with a task (e.g., elicitation, sampling), the receiver **SHOULD** move the task to the `input_required` status.
402+
1. When the task receiver has messages for the requestor that are necessary to complete the task, the receiver **SHOULD** move the task to the `input_required` status.
403403
1. The receiver **MUST** include the `modelcontextprotocol.io/related-task` metadata in the request to associate it with the task.
404-
1. When the receiver receives all required responses, the task **MAY** transition out of `input_required` status (typically back to `working`).
405-
1. If multiple related requests are pending, the task **SHOULD** remain in `input_required` status until all are resolved.
404+
1. When the requestor encounters the `input_required` status, it **SHOULD** call `tasks/result` prematurely.
405+
1. When the receiver receives all required input, the task **SHOULD** transition out of `input_required` status (typically back to `working`).
406406

407407
### Keep-Alive and Resource Management
408408

@@ -414,8 +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. 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. Receivers **MUST** return from `tasks/result` exactly what the underlying request would have returned, whether that is a successful result or a JSON-RPC error.
417+
1. When a receiver receives a `tasks/result` request for a task in a terminal status (`completed`, `failed`, `cancelled`, or `unknown`), it **MUST** return the final result of the underlying request, whether that is a successful result or a JSON-RPC error.
418+
1. When a receiver receives a `tasks/result` request for a task in any other non-terminal status (`submitted`, `working`, `input_required`), it **MUST** block the response until the task reaches a terminal status.
419+
1. For tasks in a terminal status, receivers **MUST** return from `tasks/result` exactly what the underlying request would have returned, whether that is a successful result or a JSON-RPC error.
419420

420421
### Associating Task-Related Messages
421422

@@ -425,11 +426,11 @@ stateDiagram-v2
425426

426427
### Task Cancellation
427428

429+
1. Requestors **MAY** send `notifications/cancelled` at any time during task execution.
428430
1. When a receiver receives a `notifications/cancelled` notification for the JSON-RPC request ID of a task-augmented request, the receiver **SHOULD** immediately move the task to the `cancelled` status and cease all processing associated with that task.
429431
1. Due to the asynchronous nature of notifications, receivers **MAY** not cancel task processing instantaneously. Receivers **SHOULD** make a best-effort attempt to halt execution as quickly as possible.
430432
1. If a `notifications/cancelled` notification arrives after a task has already reached a terminal status (`completed`, `failed`, `cancelled`, or `unknown`), receivers **SHOULD** ignore the notification.
431433
1. After a task reaches `cancelled` status and its `keepAlive` duration has elapsed, receivers **MAY** delete the task and its metadata.
432-
1. Requestors **MAY** send `notifications/cancelled` at any time during task execution, including when the task is in `input_required` status. If a task is cancelled while in `input_required` status, receivers **SHOULD** also disregard any pending responses to associated requests.
433434
1. Because notifications do not provide confirmation of receipt, requestors **SHOULD** continue to poll with `tasks/get` after sending a cancellation notification to confirm the task has transitioned to `cancelled` status. If the task does not transition to `cancelled` within a reasonable timeframe, requestors **MAY** assume the cancellation was not processed.
434435

435436
### Task Listing
@@ -501,15 +502,15 @@ sequenceDiagram
501502
C->>S: tasks/get (task-123)
502503
S->>C: working
503504
504-
Note over S: Server requires additional information<br/>Task moves to input_required
505+
Note over S: Server needs information from client<br/>Task moves to input_required
505506
506-
Note over S,C: Server sends elicitation request
507-
S->>C: elicitation/create (task-123)
508-
509-
Note over C,S: Client polls and sees task waiting for input
507+
Note over C,S: Client polls and discovers input_required
510508
C->>S: tasks/get (task-123)
511509
S->>C: input_required
512510
511+
Note over C,S: Client receives input requests
512+
C->>S: tasks/result (task-123)
513+
S->>C: elicitation/create (task-123)
513514
C->>U: Prompt user for input
514515
U->>C: Provide information
515516
C->>S: elicitation response (task-123)
@@ -660,7 +661,7 @@ Tasks can be in one of the following states:
660661

661662
- `submitted`: The request has been received and queued for execution
662663
- `working`: The request is currently being processed
663-
- `input_required`: The request is waiting on additional input from the requestor
664+
- `input_required`: The receiver needs input from the requestor. The requestor should call `tasks/result` to receive input requests, even though the task has not reached a terminal state.
664665
- `completed`: The request completed successfully and results are available
665666
- `failed`: The associated request did not complete successfully. For tool calls specifically, this includes cases where the tool call result has `isError` set to true.
666667
- `cancelled`: The request was cancelled before completion

0 commit comments

Comments
 (0)