Skip to main content

Module tool

Module tool 

Source
Expand description

Tool trait, registry, context, and result types for agent function calling.

§Key types

TypeRole
ToolTrait for tools callable by the agent (name, description, params, execute)
ToolRegistryRegistry of available tools with aliases
ToolContextPer-invocation context passed to execute()
ToolResultResult of a tool execution returned to the LLM
FileDiffA file diff produced by a tool
ForbiddenCmdCommand restriction pattern (regex-based)

Structs§

BackgroundRequest
A request to move a running tool call into the background.
FileDiff
A file diff produced by a tool.
ForbiddenCmd
A forbidden command configuration.
ToolContext
Per-invocation context passed to Tool::execute methods.
ToolRegistry
Registry of tools available to an agent.

Enums§

DiffLine
A single line in a unified diff output.
ToolResult
Result of a tool execution, returned by Tool::execute and fed back to the LLM as a "role": "tool" message.

Traits§

CommandAllowList
Trait for checking whether a command is allowed to execute.
InterruptPayload
Typed payload for ToolResult::Interrupt.
Tool
Trait for tools that can be invoked by the agent.

Functions§

parse_args
Deserialize tool arguments from a serde_json::Value into a typed struct. Returns a typed error mentioning which tool failed to parse.