pub struct ToolDefinition {
pub tool: Tool,
pub handler: Arc<dyn Fn(CallToolRequest) -> Pin<Box<dyn Future<Output = McpResult<CallToolResult>> + Send + 'static>> + Send + Sync + 'static>,
}Expand description
Tool definition from a plugin
Fields§
§tool: Tool§handler: Arc<dyn Fn(CallToolRequest) -> Pin<Box<dyn Future<Output = McpResult<CallToolResult>> + Send + 'static>> + Send + Sync + 'static>Implementations§
Source§impl ToolDefinition
impl ToolDefinition
Sourcepub fn new<F, Fut, T>(tool: Tool, handler: F) -> Selfwhere
F: Fn(T) -> Fut + Send + Sync + Clone + 'static,
Fut: Future<Output = CallToolResult> + Send + 'static,
T: DeserializeOwned + Send + 'static,
pub fn new<F, Fut, T>(tool: Tool, handler: F) -> Selfwhere
F: Fn(T) -> Fut + Send + Sync + Clone + 'static,
Fut: Future<Output = CallToolResult> + Send + 'static,
T: DeserializeOwned + Send + 'static,
Create a tool definition with a typed handler
Sourcepub fn from_handler(
tool: Tool,
handler: Arc<dyn Fn(CallToolRequest) -> Pin<Box<dyn Future<Output = McpResult<CallToolResult>> + Send + 'static>> + Send + Sync + 'static>,
) -> Self
pub fn from_handler( tool: Tool, handler: Arc<dyn Fn(CallToolRequest) -> Pin<Box<dyn Future<Output = McpResult<CallToolResult>> + Send + 'static>> + Send + Sync + 'static>, ) -> Self
Create a tool definition with a raw handler that takes CallToolRequest
Auto Trait Implementations§
impl Freeze for ToolDefinition
impl !RefUnwindSafe for ToolDefinition
impl Send for ToolDefinition
impl Sync for ToolDefinition
impl Unpin for ToolDefinition
impl UnsafeUnpin for ToolDefinition
impl !UnwindSafe for ToolDefinition
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