diff --git a/rig-core/src/tool.rs b/rig-core/src/tool.rs index 8c4b8cc..1d9a24d 100644 --- a/rig-core/src/tool.rs +++ b/rig-core/src/tool.rs @@ -204,6 +204,28 @@ where } } +#[cfg(feature = "mcp")] +impl From<&mcp_core::types::Tool> for ToolDefinition { + fn from(val: &mcp_core::types::Tool) -> Self { + Self { + name: val.name.to_owned(), + description: val.description.to_owned().unwrap_or_default(), + parameters: val.input_schema.to_owned(), + } + } +} + +#[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}")]