pub enum Tools {
Function {
function: Function,
},
Retrieval {
retrieval: Retrieval,
},
WebSearch {
web_search: WebSearch,
},
MCP {
mcp: MCP,
},
}Expand description
Available tools that AI assistants can invoke during conversations.
This enum defines the different categories of external tools and capabilities that can be made available to AI models. Each tool type serves specific purposes and has its own configuration requirements.
§Tool Categories
§Function Tools
Custom user-defined functions that the AI can call with structured parameters. Useful for integrating external APIs, databases, or business logic.
§Retrieval Tools
Access to knowledge bases, document collections, or information retrieval systems. Enables the AI to query structured knowledge sources.
§Web Search Tools
Internet search capabilities for accessing current information. Allows the AI to perform web searches and retrieve up-to-date information.
§MCP Tools
Model Context Protocol tools for standardized tool integration. Provides a standardized interface for tool communication.
§Usage
// Function tool
let function_tool = Tools::Function {
function: Function::new("get_weather", "Get weather data", parameters)
};
// Web search tool
let search_tool = Tools::WebSearch {
web_search: WebSearch::new(SearchEngine::SearchPro)
.with_enable(true)
.with_count(10)
};Variants§
Function
Custom function calling tool with parameters.
Allows the AI to invoke user-defined functions with structured arguments. Functions must be pre-defined with JSON schemas for parameter validation.
Retrieval
Knowledge retrieval system access tools.
Provides access to knowledge bases, document collections, or other structured information sources that the AI can query.
WebSearch
Web search capabilities for internet access.
Enables the AI to perform web searches and access current information from the internet. Supports various search engines and configurations.
MCP
Model Context Protocol (MCP) tools.
Standardized tools that follow the Model Context Protocol specification, providing a consistent interface for tool integration and communication.