@@ -83,7 +83,6 @@ impl PluginService {
83
83
} else {
84
84
tokio:: fs:: read ( & plugin_cfg. path ) . await ?
85
85
} ;
86
-
87
86
let mut manifest = Manifest :: new ( [ Wasm :: data ( wasm_content) ] ) ;
88
87
if let Some ( runtime_cfg) = & plugin_cfg. runtime_config {
89
88
log:: info!( "runtime_cfg: {:?}" , runtime_cfg) ;
@@ -129,7 +128,16 @@ impl PluginService {
129
128
if let Ok ( result) = plugin. call :: < & str , & str > ( "describe" , "" ) {
130
129
if let Ok ( parsed) = serde_json:: from_str :: < ListToolsResult > ( result) {
131
130
let mut cache = self . tool_plugin_map . write ( ) . await ;
131
+ let skip_tools = plugin_cfg
132
+ . runtime_config
133
+ . as_ref ( )
134
+ . and_then ( |rc| rc. skip_tools . clone ( ) )
135
+ . unwrap_or_default ( ) ;
132
136
for tool in parsed. tools {
137
+ if skip_tools. iter ( ) . any ( |s| s == tool. name . as_ref ( ) as & str ) {
138
+ log:: info!( "Skipping tool {} as requested in skip_tools" , tool. name) ;
139
+ continue ;
140
+ }
133
141
log:: info!( "Saving tool {}/{} to cache" , plugin_cfg. name, tool. name) ;
134
142
// Check if the tool name already exists in another plugin
135
143
if let Some ( existing_plugin) = cache. get ( & tool. name . to_string ( ) ) {
@@ -231,20 +239,32 @@ impl ServerHandler for PluginService {
231
239
// Clear the existing cache when listing tools
232
240
tool_cache. clear ( ) ;
233
241
234
- for ( plugin_name, plugin) in plugins. iter_mut ( ) {
235
- match plugin. call :: < & str , & str > ( "describe" , "" ) {
236
- Ok ( result) => {
237
- let parsed: ListToolsResult = serde_json:: from_str ( result) . unwrap ( ) ;
238
-
239
- // Update the tool-to-plugin cache
240
- for tool in & parsed. tools {
241
- tool_cache. insert ( tool. name . to_string ( ) , plugin_name. clone ( ) ) ;
242
+ for plugin_cfg in & self . config . plugins {
243
+ if let Some ( plugin) = plugins. get_mut ( & plugin_cfg. name ) {
244
+ match plugin. call :: < & str , & str > ( "describe" , "" ) {
245
+ Ok ( result) => {
246
+ if let Ok ( parsed) = serde_json:: from_str :: < ListToolsResult > ( result) {
247
+ let skip_tools = plugin_cfg
248
+ . runtime_config
249
+ . as_ref ( )
250
+ . and_then ( |rc| rc. skip_tools . clone ( ) )
251
+ . unwrap_or_default ( ) ;
252
+ for tool in parsed. tools {
253
+ if skip_tools. iter ( ) . any ( |s| s == tool. name . as_ref ( ) as & str ) {
254
+ log:: info!(
255
+ "Skipping tool {} as requested in skip_tools" ,
256
+ tool. name
257
+ ) ;
258
+ continue ;
259
+ }
260
+ tool_cache. insert ( tool. name . to_string ( ) , plugin_cfg. name . clone ( ) ) ;
261
+ payload. tools . push ( tool) ;
262
+ }
263
+ }
264
+ }
265
+ Err ( e) => {
266
+ log:: error!( "tool {} describe() error: {}" , plugin_cfg. name, e) ;
242
267
}
243
-
244
- payload. tools . extend ( parsed. tools ) ;
245
- }
246
- Err ( e) => {
247
- log:: error!( "tool {} describe() error: {}" , plugin_name, e) ;
248
268
}
249
269
}
250
270
}
0 commit comments