#[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 presents the options to the user and returns 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.
If the selected option has kind reject_once or reject_always, the Agent MUST NOT
perform the requested operation.
An error response is not approval, and neither is a connection that ends before the Client answers. The Agent MUST NOT treat either as approval.
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 are custom methods that are not part of the ACP spec.
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<AgentRequest, MethodDispatchError>
pub fn from_method_and_params( method: &str, params: &Value, ) -> Result<AgentRequest, 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§fn clone(&self) -> AgentRequest
fn clone(&self) -> AgentRequest
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 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<AgentRequest, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<AgentRequest, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl JsonRpcMessage for AgentRequest
impl JsonRpcMessage for AgentRequest
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>
Source§impl JsonRpcRequest for AgentRequest
impl JsonRpcRequest for AgentRequest
Source§impl JsonSchema for AgentRequest
impl JsonSchema for AgentRequest
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