pub struct CustomToolDefinition {
pub name: String,
pub description: String,
pub category: CustomToolCategory,
pub parameters: Value,
pub command: ShellCommand,
}Expand description
Definition of a custom tool from the custom-tools config file.
Custom tools are registered alongside built-in tools and can be called by the LLM. They execute shell commands with parameter substitution.
Fields§
§name: StringTool name (must not collide with built-in tool names).
description: StringDescription shown to the LLM.
category: CustomToolCategory"readonly" or "destructive". Readonly tools are auto-executed;
destructive tools require user confirmation.
parameters: ValueJSON Schema for the tool’s parameters. This is sent to the LLM as-is.
command: ShellCommandShell command template with {param} placeholders.
Implementations§
Source§impl CustomToolDefinition
impl CustomToolDefinition
Sourcepub fn build_tool(&self) -> Result<Tool, String>
pub fn build_tool(&self) -> Result<Tool, String>
Convert this definition into a Tool that can be registered in ToolManager.
Sourcepub fn build_tool_with_sandbox(
&self,
sandbox: Option<Sandbox>,
) -> Result<Tool, String>
pub fn build_tool_with_sandbox( &self, sandbox: Option<Sandbox>, ) -> Result<Tool, String>
CustomToolDefinition::build_tool with an OS-level process sandbox.
The sandbox is captured by the handler because tool handlers are opaque
closures that outlive the ToolManager, so it must be supplied at
registration time — see ToolManager::set_sandbox.