pub struct SimpleToolContext { /* private fields */ }Expand description
A lightweight ToolContext with sensible defaults for non-agent callers.
Implements ReadonlyContext, CallbackContext, and ToolContext
with minimal configuration. Construct via SimpleToolContext::new with
a caller name; all other fields use safe defaults.
Implementations§
Source§impl SimpleToolContext
impl SimpleToolContext
Sourcepub fn new(caller_name: impl Into<String>) -> Self
pub fn new(caller_name: impl Into<String>) -> Self
Create a new context with the given caller name.
Generates unique UUIDs for invocation_id and function_call_id.
The caller name is returned by both agent_name()
and app_name().
Sourcepub fn with_function_call_id(self, id: impl Into<String>) -> Self
pub fn with_function_call_id(self, id: impl Into<String>) -> Self
Override the default function call ID.
By default a UUID is generated at construction. Use this builder method to provide a specific ID instead.
Sourcepub fn with_session_id(self, id: impl Into<String>) -> Self
pub fn with_session_id(self, id: impl Into<String>) -> Self
Attach the session that owns this tool call.
This is useful for desktop shells, test harnesses, and other callers that execute tools outside the full agent loop but still need session-aware callbacks such as MCP elicitation.
Trait Implementations§
Source§impl CallbackContext for SimpleToolContext
impl CallbackContext for SimpleToolContext
Source§fn artifacts(&self) -> Option<Arc<dyn Artifacts>>
fn artifacts(&self) -> Option<Arc<dyn Artifacts>>
Source§fn tool_outcome(&self) -> Option<ToolOutcome>
fn tool_outcome(&self) -> Option<ToolOutcome>
None when not in a tool execution context.Source§fn tool_name(&self) -> Option<&str>
fn tool_name(&self) -> Option<&str>
Source§fn tool_input(&self) -> Option<&Value>
fn tool_input(&self) -> Option<&Value>
None when not running inside a ParallelAgent with shared state enabled.Source§impl ReadonlyContext for SimpleToolContext
impl ReadonlyContext for SimpleToolContext
Source§fn invocation_id(&self) -> &str
fn invocation_id(&self) -> &str
Source§fn agent_name(&self) -> &str
fn agent_name(&self) -> &str
Source§fn session_id(&self) -> &str
fn session_id(&self) -> &str
Source§fn user_content(&self) -> &Content
fn user_content(&self) -> &Content
Source§fn try_invocation_id(&self) -> Result<InvocationId, AdkError>
fn try_invocation_id(&self) -> Result<InvocationId, AdkError>
InvocationId. Read moreSource§fn try_identity(&self) -> Result<AdkIdentity, AdkError>
fn try_identity(&self) -> Result<AdkIdentity, AdkError>
AdkIdentity triple. Read moreSource§fn try_execution_identity(&self) -> Result<ExecutionIdentity, AdkError>
fn try_execution_identity(&self) -> Result<ExecutionIdentity, AdkError>
ExecutionIdentity. Read more