pub struct ToolCall { /* private fields */ }Expand description
One tool call as a hook sees it: the request as the client sent it, with the injected
arguments (session_id, agent_id, context) still in it, and what the SDK knows about the
client and the transport. Clones are independent copies.
Its Debug output hides credentials: the values of the authorization,
proxy-authorization, cookie and set-cookie headers print as "<redacted>", and the
request context prints as its request ID and whether it holds HTTP request parts.
let options = Options::default().event_tags(|call: ToolCall| async move {
let mut tags = serde_json::Map::new();
tags.insert("tool".into(), call.tool_name().into());
Ok(Some(tags))
});Implementations§
Source§impl ToolCall
impl ToolCall
Sourcepub fn arguments(&self) -> Option<&JsonObject>
pub fn arguments(&self) -> Option<&JsonObject>
The arguments as the client sent them, the session_id, agent_id and context that the
SDK added to the tool’s listing included.
Sourcepub fn meta(&self) -> &JsonObject
pub fn meta(&self) -> &JsonObject
The _meta of the request; empty when the client sent none.
Sourcepub fn headers(&self) -> Option<&Map<String, Value>>
pub fn headers(&self) -> Option<&Map<String, Value>>
The HTTP headers of the request, every header included, authorization and cookie too:
names in lower case, in byte order, after the
names that are array indexes in numeric order; values trimmed of leading and trailing HTTP
whitespace; the values of a repeated name joined in arrival order with ", " ("; " for
cookie), except set-cookie, which keeps only its last value; a value that is not UTF-8
read lossily. None on a transport without HTTP, such as stdio.
Sourcepub fn client_name(&self) -> Option<&str>
pub fn client_name(&self) -> Option<&str>
The name the client gave itself, when it did.
Sourcepub fn client_version(&self) -> Option<&str>
pub fn client_version(&self) -> Option<&str>
The version the client gave itself, when it did.
Sourcepub fn protocol_version(&self) -> Option<&str>
pub fn protocol_version(&self) -> Option<&str>
The protocol version the request names in its _meta, when it does.
Sourcepub fn transport_session_id(&self) -> Option<&str>
pub fn transport_session_id(&self) -> Option<&str>
The mcp-session-id of the streamable HTTP session; None on stdio and on a stateless
HTTP server.
Sourcepub fn request_context(&self) -> &RequestContext<RoleServer>
pub fn request_context(&self) -> &RequestContext<RoleServer>
The rmcp request context of the call, for anything the other getters do not give. The
SDK has not yet added its CallContext to it.