Skip to main content

Module tools

Module tools 

Source
Expand description

Tools: executable functions and hosted-tool markers.

Rust equivalent of agent_framework._tools. An FunctionTool is a locally executable tool; hosted ToolKind variants are markers handed to the service. Both are represented uniformly to a chat client as a ToolDefinition.

Prefer FunctionTool::typed over FunctionTool::new when the arguments can be expressed as a #[derive(Deserialize, JsonSchema)] struct: it derives the parameters JSON Schema via schemars instead of requiring a hand-written serde_json::Value.

Structs§

FunctionInvocationConfig
Configuration for the automatic function-invocation loop.
FunctionTool
A concrete, locally executable tool built from a closure.
ToolDefinition
A uniform, cloneable descriptor of a tool passed via ChatOptions::tools.

Enums§

ApprovalMode
Whether a call to a tool must be approved by a human before it runs.
McpApprovalMode
The approval gate configured on a hosted MCP connector – i.e. how the service itself decides whether a call to one of its MCP tools needs human sign-off before it runs. Set via ToolDefinition::mcp_approval_mode.
ToolKind
The category of a tool as advertised to the service.

Traits§

Tool
An executable tool the framework can invoke locally.
ToolSource
A dynamic source of tools, resolved fresh on every agent run instead of being frozen into the agent’s tool list at build time.

Functions§

empty_schema
An empty JSON-Schema object (no parameters).
hosted_code_interpreter
Construct a hosted code-interpreter tool marker.
hosted_file_search
Construct a hosted file-search tool marker.
hosted_image_generation
Construct a hosted image-generation tool marker.
hosted_mcp
Construct a hosted MCP tool marker.
hosted_web_search
Construct a hosted web-search tool marker.

Type Aliases§

BoxFuture
A boxed, owned future returned by a tool invocation.