#[non_exhaustive]pub enum ClientNotification {
CancelSessionNotification(Box<CancelSessionNotification>),
MessageMcpNotification(Box<MessageMcpNotification>),
ExtNotification(Box<ExtNotification>),
}unstable_protocol_v2 only.Expand description
All possible notifications that a Client can send to an Agent.
This enum is used internally for routing RPC notifications. You typically won’t need to use this directly.
Notifications do not expect a response.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
CancelSessionNotification(Box<CancelSessionNotification>)
Cancels the named session’s active foreground work and earlier prompts not yet inserted.
The Agent MUST answer those uninserted prompts with -32800. Inserted prompts still
succeed with their messageId. This cancellation does not cover later submissions.
Work in the latest background list is not covered and keeps running. The
Agent MAY stop background activity it does not list.
Upon receiving this notification, the Agent SHOULD stop all language model requests and all tool call invocations of the cancelled foreground work as soon as possible.
The Agent MUST stop waiting for pending session/request_permission requests of
the cancelled work and treat them as not approved. It MUST cancel each of them
with $/cancel_request.
When cancellation stops active foreground work, the Agent MUST send that work’s
pending updates, then an idle state_update with stopReason: "cancelled",
before starting new foreground work in the same session. A later prompt can be
inserted and acknowledged before that idle update, or held with its response
pending. Listed background work can report updates before or after it.
No additional idle update is required if no foreground work was active.
After cancellation completes, the Agent SHOULD ignore late answers rather than use them to resume the cancelled work.
Agents MUST catch errors caused by aborting cancelled work and report the
cancelled stop reason, not error.
See protocol docs: Cancellation
MessageMcpNotification(Box<MessageMcpNotification>)
unstable_mcp_over_acp only.UNSTABLE
This capability is not part of the spec yet, and may be removed or changed at any point.
Sends an MCP-over-ACP notification.
ExtNotification(Box<ExtNotification>)
Handles extension notifications from the Client.
Extension notifications are custom one-way messages that are not part of the ACP spec.
See protocol docs: Extensibility
Implementations§
Source§impl ClientNotification
impl ClientNotification
Sourcepub fn supports_method(method: &str) -> bool
pub fn supports_method(method: &str) -> bool
Whether this enum recognizes the method with the enabled Cargo features, including extensions when it has an extension variant.
This does not check the peer’s advertised capabilities.
Sourcepub fn from_method_and_params(
method: &str,
params: &Value,
) -> Result<ClientNotification, MethodDispatchError>
pub fn from_method_and_params( method: &str, params: &Value, ) -> Result<ClientNotification, MethodDispatchError>
Parses parameters selected by the JSON-RPC method name.
Use this instead of the enum’s untagged Deserialize
implementation. Untagged deserialization selects by payload
shape, which can silently select an unrelated variant.
The payload is passed unchanged to the selected type’s
deserializer. In particular, null is not converted to {}.
Extension payloads retain their JSON value and method name.
§Errors
Returns crate::MethodDispatchError::UnknownMethod for an
unsupported method, or crate::MethodDispatchError::InvalidPayload
for a malformed payload.
Trait Implementations§
Source§impl Clone for ClientNotification
impl Clone for ClientNotification
Source§fn clone(&self) -> ClientNotification
fn clone(&self) -> ClientNotification
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ClientNotification
impl Debug for ClientNotification
Source§impl<'de> Deserialize<'de> for ClientNotification
impl<'de> Deserialize<'de> for ClientNotification
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ClientNotification, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ClientNotification, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl JsonRpcMessage for ClientNotification
impl JsonRpcMessage for ClientNotification
Source§fn matches_method(method: &str) -> bool
fn matches_method(method: &str) -> bool
Source§fn to_untyped_message(&self) -> Result<UntypedMessage, Error>
fn to_untyped_message(&self) -> Result<UntypedMessage, Error>
impl JsonRpcNotification for ClientNotification
Source§impl JsonSchema for ClientNotification
impl JsonSchema for ClientNotification
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more