pub struct Tool {
pub name: String,
pub description: String,
pub input_schema: Option<Value>,
pub output_schema: Option<Value>,
}
Expand description
Represents an MCP tool with its metadata.
Tools are the primary way to interact with MCP servers. Each tool has a name, description, and optional schema information for its inputs and outputs.
§Examples
use mcp_runner::client::Tool;
let tool = Tool {
name: "fetch".to_string(),
description: "Fetch data from a URL".to_string(),
input_schema: Some(json!({
"type": "object",
"properties": {
"url": {
"type": "string",
"description": "The URL to fetch data from"
}
},
"required": ["url"]
})),
output_schema: Some(json!({
"type": "object",
"properties": {
"content": {
"type": "string"
}
}
})),
};
Fields§
§name: String
Tool name used when calling the tool.
description: String
Human-readable description of the tool’s purpose and functionality.
input_schema: Option<Value>
JSON Schema defining the expected format of tool inputs.
output_schema: Option<Value>
JSON Schema defining the expected format of tool outputs.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Tool
impl<'de> Deserialize<'de> for Tool
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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