From 64d20a88d048da724b46e9d9ab24382ccc5a4d64 Mon Sep 17 00:00:00 2001 From: Joshua Mo Date: Wed, 9 Apr 2025 17:20:23 +0100 Subject: [PATCH] feat: impl From for ToolDefinition --- rig-core/src/tool.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/rig-core/src/tool.rs b/rig-core/src/tool.rs index 8c4b8cc..953bae4 100644 --- a/rig-core/src/tool.rs +++ b/rig-core/src/tool.rs @@ -204,6 +204,17 @@ where } } +#[cfg(feature = "mcp")] +impl From for ToolDefinition { + fn from(val: mcp_core::types::Tool) -> Self { + Self { + name: val.name, + description: val.description.unwrap_or_default(), + parameters: val.input_schema, + } + } +} + #[cfg(feature = "mcp")] #[derive(Debug, thiserror::Error)] #[error("MCP tool error: {0}")]