#[non_exhaustive]pub enum AgentRequest {
RequestPermissionRequest(Box<RequestPermissionRequest>),
CreateElicitationRequest(Box<CreateElicitationRequest>),
MessageMcpRequest(Box<MessageMcpRequest>),
ExtMethodRequest(Box<ExtRequest>),
}unstable_protocol_v2 only.Expand description
All possible requests that an agent can send to a client.
This enum is used internally for routing RPC requests. You typically won’t need to use this directly.
This enum encompasses all method calls from agent to client.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
RequestPermissionRequest(Box<RequestPermissionRequest>)
Requests permission from the user for an operation.
Called by the agent when it needs user authorization before executing a potentially sensitive operation. The client should present the options to the user and return their decision.
After session/cancel, the agent stops waiting for requests of the cancelled
foreground work and MUST cancel them with $/cancel_request. The client
answers a cancelled request with the cancelled outcome.
See protocol docs: Requesting Permission
CreateElicitationRequest(Box<CreateElicitationRequest>)
Requests structured user input via a form or URL.
See protocol docs: Elicitation
MessageMcpRequest(Box<MessageMcpRequest>)
unstable_mcp_over_acp only.UNSTABLE
This capability is not part of the spec yet, and may be removed or changed at any point.
Exchanges an MCP-over-ACP message.
ExtMethodRequest(Box<ExtRequest>)
Handles extension method requests from the agent.
Allows the Agent to send an arbitrary request that is not part of the ACP spec. Extension methods provide a way to add custom functionality while maintaining protocol compatibility.
See protocol docs: Extensibility
Implementations§
Source§impl AgentRequest
impl AgentRequest
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 AgentRequest
impl Clone for AgentRequest
Source§impl Debug for AgentRequest
impl Debug for AgentRequest
Source§impl<'de> Deserialize<'de> for AgentRequest
impl<'de> Deserialize<'de> for AgentRequest
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 AgentRequest
Available on crate feature schemars only.
impl JsonSchema for AgentRequest
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