mirror of https://github.com/0xplaygrounds/rig
feat: impl From<mcp_core::types::Tool> for ToolDefinition (#385)
* feat: impl From<mcp_core::types::Tool> for ToolDefinition * feat(core): impl &mcp_core::types::Tool for ToolDefinition
This commit is contained in:
parent
b7ba9bbd93
commit
bc11decc0b
|
@ -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<mcp_core::types::Tool> 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")]
|
#[cfg(feature = "mcp")]
|
||||||
#[derive(Debug, thiserror::Error)]
|
#[derive(Debug, thiserror::Error)]
|
||||||
#[error("MCP tool error: {0}")]
|
#[error("MCP tool error: {0}")]
|
||||||
|
|
Loading…
Reference in New Issue