Skip to main content

tool

Macro tool 

Source
macro_rules! tool {
    ($name:expr, $description:expr, $schema:expr, $handler:expr) => { ... };
    ($name:expr, $schema:expr, $handler:expr) => { ... };
}
Expand description

Helper macro for creating tools with schema validation

ยงExamples

use prism_mcp_rs::{tool, core::tool::ToolHandler};
use serde_json::json;

struct MyHandler;
#[async_trait::async_trait]
impl ToolHandler for MyHandler {
async fn call(&self, _args: std::collections::HashMap<String, serde_json::Value>) -> prism_mcp_rs::McpResult<prism_mcp_rs::protocol::types::ToolResult> {
// Implementation here
todo!()
}
}

let tool = tool!(
"my_tool",
"A sample tool",
json!({
"type": "object",
"properties": {
"input": { "type": "string" }
}
}),
MyHandler
);