Skip to content

Commit b7e43a7

Browse files
Merge pull request modelcontextprotocol#1855 from LucaButBoring/fix/task-poll-after-disconnect
Clarify that requestors may continue polling after calling tasks/result
2 parents c968f98 + f59a5d2 commit b7e43a7

File tree

1 file changed

+19
-1
lines changed
  • docs/specification/draft/basic/utilities

1 file changed

+19
-1
lines changed

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

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,10 +182,18 @@ This guidance is non-binding and is provisional logic intended to account for th
182182

183183
### Getting Tasks
184184

185+
<Note>
186+
187+
In the Streamable HTTP (SSE) transport, clients **MAY** disconnect from an SSE stream opened by the server in response to a `tasks/get` request at any time.
188+
189+
While this note is not prescriptive regarding the specific usage of SSE streams, all implementations **MUST** continue to comply with the existing [Streamable HTTP transport specification](../transports#sending-messages-to-the-server).
190+
191+
</Note>
192+
185193
Requestors poll for task completion by sending [`tasks/get`](/specification/draft/schema#tasks%2Fget) requests.
186194
Requestors **SHOULD** respect the `pollInterval` provided in responses when determining polling frequency.
187195

188-
Requestors **SHOULD** continue polling until the task reaches a terminal status (`completed`, `failed`, or `cancelled`), or until encountering the [`input_required`](#input-required-status) status.
196+
Requestors **SHOULD** continue polling until the task reaches a terminal status (`completed`, `failed`, or `cancelled`), or until encountering the [`input_required`](#input-required-status) status. Note that invoking `tasks/result` does not imply that the requestor needs to stop polling - requestors **SHOULD** continue polling the task status via `tasks/get` if they are not actively waiting for `tasks/result` to complete.
189197

190198
**Request:**
191199

@@ -219,10 +227,20 @@ Requestors **SHOULD** continue polling until the task reaches a terminal status
219227

220228
### Retrieving Task Results
221229

230+
<Note>
231+
232+
In the Streamable HTTP (SSE) transport, clients **MAY** disconnect from an SSE stream opened by the server in response to a `tasks/result` request at any time.
233+
234+
While this note is not prescriptive regarding the specific usage of SSE streams, all implementations **MUST** continue to comply with the existing [Streamable HTTP transport specification](../transports#sending-messages-to-the-server).
235+
236+
</Note>
237+
222238
After a task completes the operation result is retrieved via [`tasks/result`](/specification/draft/schema#tasks%2Fresult). This is distinct from the initial `CreateTaskResult` response, which contains only task data. The result structure matches the original request type (e.g., `CallToolResult` for `tools/call`).
223239

224240
To retrieve the result of a completed task, requestors can send a `tasks/result` request:
225241

242+
While `tasks/result` blocks until the task reaches a terminal status, requestors can continue polling via `tasks/get` in parallel if they are not actively blocked waiting for the result, such as if their previous `tasks/result` request failed or was cancelled. This allows requestors to monitor status changes or display progress updates while the task executes, even after invoking `tasks/result`.
243+
226244
**Request:**
227245

228246
```json

0 commit comments

Comments
 (0)