pub struct T;Expand description
The T namespace — static factory methods for tool composition.
Implementations§
Source§impl T
impl T
Sourcepub fn function(f: Arc<dyn ToolFunction>) -> ToolComposite
pub fn function(f: Arc<dyn ToolFunction>) -> ToolComposite
Register a function tool.
Sourcepub fn google_search() -> ToolComposite
pub fn google_search() -> ToolComposite
Add Google Search built-in tool.
Sourcepub fn url_context() -> ToolComposite
pub fn url_context() -> ToolComposite
Add URL context built-in tool.
Sourcepub fn code_execution() -> ToolComposite
pub fn code_execution() -> ToolComposite
Add code execution built-in tool.
Sourcepub fn simple<F, Fut>(
name: impl Into<String>,
description: impl Into<String>,
f: F,
) -> ToolComposite
pub fn simple<F, Fut>( name: impl Into<String>, description: impl Into<String>, f: F, ) -> ToolComposite
Create a simple tool from a name, description, and async closure.
Sourcepub fn fn_tool<F, Fut>(
name: impl Into<String>,
description: impl Into<String>,
f: F,
) -> ToolComposite
pub fn fn_tool<F, Fut>( name: impl Into<String>, description: impl Into<String>, f: F, ) -> ToolComposite
Alias for simple — matches upstream Python T.fn().
Named fn_tool because fn is a reserved keyword in Rust.
Sourcepub fn confirm(tool: ToolComposite, _message: &str) -> ToolComposite
pub fn confirm(tool: ToolComposite, _message: &str) -> ToolComposite
Wrap a tool with a confirmation requirement (marker for runtime).
Sourcepub fn timeout(tool: ToolComposite, _duration: Duration) -> ToolComposite
pub fn timeout(tool: ToolComposite, _duration: Duration) -> ToolComposite
Wrap a tool with a timeout (marker for runtime).
Sourcepub fn cached(tool: ToolComposite) -> ToolComposite
pub fn cached(tool: ToolComposite) -> ToolComposite
Wrap a tool with caching (marker for runtime).
Sourcepub fn toolset(tools: Vec<Arc<dyn ToolFunction>>) -> ToolComposite
pub fn toolset(tools: Vec<Arc<dyn ToolFunction>>) -> ToolComposite
Combine multiple tool functions into a single composite.
Sourcepub fn agent(
name: impl Into<String>,
description: impl Into<String>,
agent: impl TextAgent + 'static,
) -> ToolComposite
pub fn agent( name: impl Into<String>, description: impl Into<String>, agent: impl TextAgent + 'static, ) -> ToolComposite
Wrap a TextAgent as a tool (shorthand for creating an agent tool entry).
When invoked, the agent runs via BaseLlm::generate() and returns its
text output as the tool result. State is shared with the parent session.
Sourcepub fn mcp(params: impl Into<String>) -> ToolComposite
pub fn mcp(params: impl Into<String>) -> ToolComposite
Create an MCP (Model Context Protocol) toolset entry.
params is the connection string (e.g. a URL or command) used to
establish the MCP session at runtime.
Sourcepub fn a2a(url: impl Into<String>, skill: impl Into<String>) -> ToolComposite
pub fn a2a(url: impl Into<String>, skill: impl Into<String>) -> ToolComposite
Create a remote agent-to-agent tool.
Routes tool calls to a remote agent at url, invoking the given skill.
Sourcepub fn mock(
name: impl Into<String>,
description: impl Into<String>,
response: Value,
) -> ToolComposite
pub fn mock( name: impl Into<String>, description: impl Into<String>, response: Value, ) -> ToolComposite
Create a mock tool that returns a fixed response.
Useful for testing and prototyping without real tool implementations.
Sourcepub fn openapi(
name: impl Into<String>,
spec_url: impl Into<String>,
) -> ToolComposite
pub fn openapi( name: impl Into<String>, spec_url: impl Into<String>, ) -> ToolComposite
Create an OpenAPI spec-driven tool (placeholder/marker).
At runtime, the spec at spec_url is fetched and used to generate
tool declarations and HTTP call routing.
Sourcepub fn search(
name: impl Into<String>,
description: impl Into<String>,
) -> ToolComposite
pub fn search( name: impl Into<String>, description: impl Into<String>, ) -> ToolComposite
Create a BM25 search tool (placeholder/marker).
Declares a search tool that performs BM25 retrieval at runtime.
Sourcepub fn schema(name: impl Into<String>, schema: Value) -> ToolComposite
pub fn schema(name: impl Into<String>, schema: Value) -> ToolComposite
Create a schema-defined tool (placeholder/marker).
The tool’s parameters are defined by the given JSON Schema value.
Sourcepub fn transform<F, Fut>(tool: ToolComposite, f: F) -> ToolComposite
pub fn transform<F, Fut>(tool: ToolComposite, f: F) -> ToolComposite
Wrap each tool entry in a composite with a result transformer.
The transformer function is applied to the tool’s output value before it is returned to the model.