Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion docs/protocol/v2/draft/error.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Receivers **MUST** treat an unrecognized code as a generic failure. Implementati

A receiver that does not implement a method, or receives a capability-gated method it did not advertise, **MUST** respond with `-32601`. This applies to custom and standard methods alike. Notifications can't be answered, so receivers **SHOULD** ignore unknown ones.

`tool_call/cancel` and `terminal/cancel` are not gated by a capability in `initialize`. A tool call or terminal advertises `capabilities.cancel` itself. An Agent that implements the method answers `-32602`, not `-32601`, for an item that does not advertise it. See [Cancelling tool calls](/protocol/v2/draft/tool-calls#cancelling-tool-calls) and [Cancelling terminals](/protocol/v2/draft/tool-calls#cancelling-terminals).

### Invalid parameters

Malformed parameters and unsupported values get `-32602`. For example, an invalid `session/list` cursor, or in `session/set_config_option` an unknown `configId`, an invalid value, or a value `type` that is unsupported or doesn't match the option.
Expand All @@ -53,7 +55,7 @@ A `systemPrompt` the Agent cannot apply gets an error, and `-32602` is recommend

If a session-scoped request names a session that does not exist or is not active on the connection, the Agent **MUST** respond with `-32002` and set `data.sessionId` to the requested ID. A session is active once it is created, resumed, or forked on the connection, until it is closed or the connection ends. See [Session Lifecycle](/protocol/v2/draft/session-setup#session-lifecycle).

This applies to `session/prompt` and `session/set_config_option`, and to `session/resume` of a session that does not exist or was deleted. `session/close` and `session/delete` are exceptions: Agents **SHOULD** still return success when closing a session that does not exist or is not active, or deleting one that does not exist. Clients **SHOULD** treat a `-32002` response to either as success. See [Closing Active Sessions](/protocol/v2/draft/session-setup#closing-active-sessions) and [Deleting Sessions](/protocol/v2/draft/session-delete).
This applies to `session/prompt`, `session/set_config_option`, `tool_call/cancel`, and `terminal/cancel`, and to `session/resume` of a session that does not exist or was deleted. `session/close` and `session/delete` are exceptions: Agents **SHOULD** still return success when closing a session that does not exist or is not active, or deleting one that does not exist. Clients **SHOULD** treat a `-32002` response to either as success. See [Closing Active Sessions](/protocol/v2/draft/session-setup#closing-active-sessions) and [Deleting Sessions](/protocol/v2/draft/session-delete).

A [child session](/protocol/v2/draft/subagents) that the Agent announced with `subagent_update` is not an unknown session, although the Client did not create or resume it. `session/cancel`, `tool_call/cancel`, and `terminal/cancel` can name a child as [Restricted methods](/protocol/v2/draft/subagents#restricted-methods) describes. Agents **SHOULD** reject any other request that names a child with `-32602`.

Expand Down
4 changes: 3 additions & 1 deletion docs/protocol/v2/error.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Receivers **MUST** treat an unrecognized code as a generic failure. Implementati

A receiver that does not implement a method, or receives a capability-gated method it did not advertise, **MUST** respond with `-32601`. This applies to custom and standard methods alike. Notifications can't be answered, so receivers **SHOULD** ignore unknown ones.

`tool_call/cancel` and `terminal/cancel` are not gated by a capability in `initialize`. A tool call or terminal advertises `capabilities.cancel` itself. An Agent that implements the method answers `-32602`, not `-32601`, for an item that does not advertise it. See [Cancelling tool calls](/protocol/v2/tool-calls#cancelling-tool-calls) and [Cancelling terminals](/protocol/v2/tool-calls#cancelling-terminals).

### Invalid parameters

Malformed parameters and unsupported values get `-32602`. For example, an invalid `session/list` cursor, or in `session/set_config_option` an unknown `configId`, an invalid value, or a value `type` that is unsupported or doesn't match the option.
Expand All @@ -53,7 +55,7 @@ A `systemPrompt` the Agent cannot apply gets an error, and `-32602` is recommend

If a session-scoped request names a session that does not exist or is not active on the connection, the Agent **MUST** respond with `-32002` and set `data.sessionId` to the requested ID. A session is active once it is created or resumed on the connection, until it is closed or the connection ends. See [Session Lifecycle](/protocol/v2/session-setup#session-lifecycle).

This applies to `session/prompt` and `session/set_config_option`, and to `session/resume` of a session that does not exist or was deleted. `session/close` and `session/delete` are exceptions: Agents **SHOULD** still return success when closing a session that does not exist or is not active, or deleting one that does not exist. Clients **SHOULD** treat a `-32002` response to either as success. See [Closing Active Sessions](/protocol/v2/session-setup#closing-active-sessions) and [Deleting Sessions](/protocol/v2/session-delete).
This applies to `session/prompt`, `session/set_config_option`, `tool_call/cancel`, and `terminal/cancel`, and to `session/resume` of a session that does not exist or was deleted. `session/close` and `session/delete` are exceptions: Agents **SHOULD** still return success when closing a session that does not exist or is not active, or deleting one that does not exist. Clients **SHOULD** treat a `-32002` response to either as success. See [Closing Active Sessions](/protocol/v2/session-setup#closing-active-sessions) and [Deleting Sessions](/protocol/v2/session-delete).

A [child session](/protocol/v2/subagents) that the Agent announced with `subagent_update` is not an unknown session, although the Client did not create or resume it. `session/cancel`, `tool_call/cancel`, and `terminal/cancel` can name a child as [Restricted methods](/protocol/v2/subagents#restricted-methods) describes. Agents **SHOULD** reject any other request that names a child with `-32602`.

Expand Down
Loading