11use std:: collections:: HashMap ;
22
3- use rig:: tool:: { ToolDyn as RigTool , ToolEmbeddingDyn , ToolSet } ;
3+ use rig:: tool:: { ToolDyn as RigTool , ToolSet } ;
44use rmcp:: {
55 RoleClient ,
66 model:: { CallToolRequestParam , CallToolResult , Tool as McpTool } ,
@@ -24,7 +24,12 @@ impl RigTool for McpToolAdaptor {
2424 {
2525 Box :: pin ( std:: future:: ready ( rig:: completion:: ToolDefinition {
2626 name : self . name ( ) ,
27- description : self . tool . description . to_string ( ) ,
27+ description : self
28+ . tool
29+ . description
30+ . as_deref ( )
31+ . unwrap_or_default ( )
32+ . to_string ( ) ,
2833 parameters : self . tool . schema_as_json_value ( ) ,
2934 } ) )
3035 }
@@ -51,22 +56,6 @@ impl RigTool for McpToolAdaptor {
5156 }
5257}
5358
54- impl ToolEmbeddingDyn for McpToolAdaptor {
55- fn embedding_docs ( & self ) -> Vec < String > {
56- vec ! [
57- self . tool. description. clone( ) . to_string( ) ,
58- format!( "Tool name: {}" , self . tool. name) ,
59- format!( "Tool capability: {}" , self . tool. description) ,
60- ]
61- }
62-
63- fn context ( & self ) -> serde_json:: Result < serde_json:: Value > {
64- Ok ( serde_json:: json!( {
65- "tool_name" : self . tool. name,
66- } ) )
67- }
68- }
69-
7059pub struct McpManager {
7160 pub clients : HashMap < String , RunningService < RoleClient , ( ) > > ,
7261}
0 commit comments