pub struct NodeTool { /* private fields */ }Expand description
A Tool that runs a graph node, or a whole graph.
Implementations§
Source§impl NodeTool
impl NodeTool
Sourcepub fn for_node(graph: Arc<CompiledGraph>, node: impl Into<String>) -> Self
pub fn for_node(graph: Arc<CompiledGraph>, node: impl Into<String>) -> Self
A tool that executes one node.
The node runs alone: no edges are followed and no checkpoint is written.
Sourcepub fn for_graph(graph: Arc<CompiledGraph>) -> Self
pub fn for_graph(graph: Arc<CompiledGraph>) -> Self
A tool that executes the whole graph.
Sourcepub fn with_description(self, description: impl Into<String>) -> Self
pub fn with_description(self, description: impl Into<String>) -> Self
Set the description the model sees.
The default names the node or graph, which tells a model nothing about when to call it. A real deployment should set this.
Sourcepub fn with_parameters_schema(self, schema: Value) -> Self
pub fn with_parameters_schema(self, schema: Value) -> Self
Set the parameter schema explicitly.
Trait Implementations§
Source§impl Tool for NodeTool
impl Tool for NodeTool
Source§fn is_long_running(&self) -> bool
fn is_long_running(&self) -> bool
A graph may pause for approval, and a pause is not a value.
Reporting the tool as long-running routes that pause through the existing
tool-confirmation path in adk-agent rather than inventing a second
mechanism for it.
Source§fn description(&self) -> &str
fn description(&self) -> &str
Returns a human-readable description of what this tool does.
Source§fn parameters_schema(&self) -> Option<Value>
fn parameters_schema(&self) -> Option<Value>
Returns the JSON Schema for this tool’s parameters, if any.
Source§fn execute<'life0, 'async_trait>(
&'life0 self,
ctx: Arc<dyn ToolContext>,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn execute<'life0, 'async_trait>(
&'life0 self,
ctx: Arc<dyn ToolContext>,
args: Value,
) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Executes the tool with the given context and arguments.
Source§fn declaration(&self) -> Value
fn declaration(&self) -> Value
Returns the tool declaration that should be exposed to model providers. Read more
Source§fn enhanced_description(&self) -> String
fn enhanced_description(&self) -> String
Returns an enhanced description that may include additional notes.
For long-running tools, this includes a warning not to call the tool
again if it has already returned a pending status.
Default implementation returns the base description.
Source§fn is_builtin(&self) -> bool
fn is_builtin(&self) -> bool
Indicates whether this tool is a built-in server-side tool (e.g.,
google_search, url_context). Read moreSource§fn response_schema(&self) -> Option<Value>
fn response_schema(&self) -> Option<Value>
Returns the JSON Schema for this tool’s response, if any.
Source§fn required_scopes(&self) -> &[&str]
fn required_scopes(&self) -> &[&str]
Returns the scopes required to execute this tool. Read more
Source§fn is_read_only(&self) -> bool
fn is_read_only(&self) -> bool
Indicates whether this tool performs no side effects. Read more
Source§fn is_concurrency_safe(&self) -> bool
fn is_concurrency_safe(&self) -> bool
Indicates whether this tool is safe for concurrent execution. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for NodeTool
impl !UnwindSafe for NodeTool
impl Freeze for NodeTool
impl Send for NodeTool
impl Sync for NodeTool
impl Unpin for NodeTool
impl UnsafeUnpin for NodeTool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more