#[non_exhaustive]pub enum ClientNotification {
CancelNotification(CancelNotification),
MessageMcpNotification(MessageMcpNotification),
ExtNotification(ExtNotification),
}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
CancelNotification(CancelNotification)
Cancels ongoing operations for a session.
This is a notification sent by the client to cancel an ongoing prompt turn.
Upon receiving this notification, the Agent SHOULD:
- Stop all language model requests as soon as possible
- Abort all tool call invocations in progress
- Send any pending
session/updatenotifications - Respond to the original
session/promptrequest with thecancelledstop reason
See protocol docs: Cancellation
MessageMcpNotification(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(ExtNotification)
Handles extension notifications from the client.
Extension notifications provide a way to send one-way messages for custom functionality while maintaining protocol compatibility.
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<Self, MethodDispatchError>
pub fn from_method_and_params( method: &str, params: &Value, ) -> Result<Self, 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§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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for ClientNotification
Available on crate feature schemars only.
impl JsonSchema for ClientNotification
schemars only.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