pub struct Tool {
pub name: String,
pub description: String,
pub parameters: Value,
}Expand description
Definition of a tool/function that the LLM can call.
Tools allow LLMs to perform actions by generating structured calls that your application executes. The LLM sees the tool’s name, description, and parameter schema to understand when and how to use it.
§Example
use multi_llm::Tool;
let search_tool = Tool {
name: "web_search".to_string(),
description: "Search the web for information".to_string(),
parameters: serde_json::json!({
"type": "object",
"properties": {
"query": {
"type": "string",
"description": "The search query"
},
"max_results": {
"type": "integer",
"description": "Maximum results to return",
"default": 10
}
},
"required": ["query"]
}),
};§Parameter Schema
The parameters field should be a valid JSON Schema object describing the
tool’s input. Use type, properties, required, and description fields
to help the LLM understand how to call your tool correctly.
Fields§
§name: StringTool name - must be unique within a request.
Use descriptive names like “get_weather” or “search_documents”. This is how the LLM identifies which tool to call.
description: StringHuman-readable description of what the tool does.
Be specific about capabilities and limitations. This helps the LLM decide when to use this tool vs. others.
parameters: ValueJSON Schema defining the tool’s input parameters.
Should be a JSON Schema object with type: "object" and properties
describing each parameter. Include description for each property.