pub struct Tool {
pub name: String,
pub description: String,
pub params: Vec<ToolParam>,
pub handler: ToolHandler,
}Expand description
A tool definition
This represents a single tool with its metadata and handler function.
Fields§
§name: String§description: String§params: Vec<ToolParam>§handler: ToolHandlerImplementations§
Source§impl Tool
impl Tool
Sourcepub fn builder(name: &str, description: &str) -> ToolBuilder
pub fn builder(name: &str, description: &str) -> ToolBuilder
Sourcepub fn to_json_schema(&self) -> Value
pub fn to_json_schema(&self) -> Value
Convert tool definition to JSON Schema format
Returns a JSON object compatible with MCP protocol:
{
"name": "tool_name",
"description": "Tool description",
"inputSchema": {
"type": "object",
"properties": { ... },
"required": [ ... ]
}
}Auto Trait Implementations§
impl Freeze for Tool
impl RefUnwindSafe for Tool
impl Send for Tool
impl Sync for Tool
impl Unpin for Tool
impl UnwindSafe for Tool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more