diff --git a/docs/protocol/v2/draft/error.mdx b/docs/protocol/v2/draft/error.mdx index 133080369..eb090b1e2 100644 --- a/docs/protocol/v2/draft/error.mdx +++ b/docs/protocol/v2/draft/error.mdx @@ -47,7 +47,7 @@ A receiver that does not implement a method, or receives a capability-gated meth 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. -A `systemPrompt` the Agent cannot apply gets an error, and `-32602` is recommended. See [System prompt](/protocol/v2/draft/session-setup#system-prompt). +A `systemPrompt` with an unadvertised mode, an unsupported content block type, or content that exceeds the Agent's limits gets `-32602`. See [System prompt](/protocol/v2/draft/session-setup#system-prompt). ### Unknown sessions diff --git a/docs/protocol/v2/draft/session-setup.mdx b/docs/protocol/v2/draft/session-setup.mdx index fa5251486..eb995bd3a 100644 --- a/docs/protocol/v2/draft/session-setup.mdx +++ b/docs/protocol/v2/draft/session-setup.mdx @@ -563,7 +563,7 @@ Agent supports it, `session/fork`. - Clients **MUST NOT** send an empty `content` array. Agents **MAY** reject one with `-32602` without creating, resuming, or forking the session - omitting the field or setting it to `null` on `session/new` means the Agent uses its default instructions - on `session/resume` and `session/fork`, Clients **SHOULD** send the same `systemPrompt` they used when the session was created. When it is omitted, the Agent may keep a prompt it stored with the session or use its default. When it differs, the Agent **SHOULD** apply it, and **MAY** defer the change until it next rebuilds its prompt (for example, after compaction) when applying it immediately would discard prompt caches or preserved reasoning -- if the Agent cannot apply a supplied `systemPrompt`, for example because of an unadvertised mode, an unsupported content block type, or content that exceeds its limits, it **MUST** return an error and **MUST NOT** create, resume, or fork the session. JSON-RPC `-32602` (Invalid params) is the **RECOMMENDED** error for malformed or unsupported values +- if the Agent cannot apply a supplied `systemPrompt`, it **MUST** return an error and **MUST NOT** create, resume, or fork the session. When the cause is the value itself, such as an unadvertised mode, an unsupported content block type, or content that exceeds its limits, the error **MUST** be `-32602` (Invalid params) Clients **MUST** only send `systemPrompt` when the Agent advertises `session.systemPrompt`, and **MUST** only use `override` mode when the Agent also advertises `session.systemPrompt.mode.override`: diff --git a/docs/protocol/v2/error.mdx b/docs/protocol/v2/error.mdx index 749219a40..7c7c01f66 100644 --- a/docs/protocol/v2/error.mdx +++ b/docs/protocol/v2/error.mdx @@ -47,7 +47,7 @@ A receiver that does not implement a method, or receives a capability-gated meth 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. -A `systemPrompt` the Agent cannot apply gets an error, and `-32602` is recommended. See [System prompt](/protocol/v2/session-setup#system-prompt). +A `systemPrompt` with an unadvertised mode, an unsupported content block type, or content that exceeds the Agent's limits gets `-32602`. See [System prompt](/protocol/v2/session-setup#system-prompt). ### Unknown sessions diff --git a/docs/protocol/v2/migration.mdx b/docs/protocol/v2/migration.mdx index b8ab9c198..fb9c5a4dd 100644 --- a/docs/protocol/v2/migration.mdx +++ b/docs/protocol/v2/migration.mdx @@ -951,6 +951,7 @@ Several error rules that were SHOULD in v1 are MUST in v2, and v2 adds one. Agen - respond with `-32601` to a method they don't implement, or to a capability-gated method they didn't advertise - respond with `-32002`, with `data.sessionId`, to a session-scoped request for a session that doesn't exist or isn't active on the connection - reject a request other than `initialize` that arrives before initialization completes with `-32600`, and also an `initialize` repeated after another request +- reject a `systemPrompt` with an unadvertised mode, an unsupported content block type, or content that exceeds the Agent's limits with `-32602` See [Errors](/protocol/v2/error). diff --git a/docs/protocol/v2/session-setup.mdx b/docs/protocol/v2/session-setup.mdx index 0d1e9727c..e0581b4ff 100644 --- a/docs/protocol/v2/session-setup.mdx +++ b/docs/protocol/v2/session-setup.mdx @@ -550,7 +550,7 @@ system-level instructions on `session/new` and `session/resume`. - Clients **MUST NOT** send an empty `content` array. Agents **MAY** reject one with `-32602` without creating or resuming the session - omitting the field or setting it to `null` on `session/new` means the Agent uses its default instructions - on `session/resume`, Clients **SHOULD** send the same `systemPrompt` they used when the session was created. When it is omitted, the Agent may keep a prompt it stored with the session or use its default. When it differs, the Agent **SHOULD** apply it, and **MAY** defer the change until it next rebuilds its prompt (for example, after compaction) when applying it immediately would discard prompt caches or preserved reasoning -- if the Agent cannot apply a supplied `systemPrompt`, for example because of an unadvertised mode, an unsupported content block type, or content that exceeds its limits, it **MUST** return an error and **MUST NOT** create or resume the session. JSON-RPC `-32602` (Invalid params) is the **RECOMMENDED** error for malformed or unsupported values +- if the Agent cannot apply a supplied `systemPrompt`, it **MUST** return an error and **MUST NOT** create or resume the session. When the cause is the value itself, such as an unadvertised mode, an unsupported content block type, or content that exceeds its limits, the error **MUST** be `-32602` (Invalid params) Clients **MUST** only send `systemPrompt` when the Agent advertises `session.systemPrompt`, and **MUST** only use `override` mode when the Agent also advertises `session.systemPrompt.mode.override`: