File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -707,6 +707,17 @@ function createCachedDescriptorPluginTool(params: {
707707 throw new Error ( `plugin tool runtime unavailable (${ pluginId } ): ${ toolName } ` ) ;
708708 }
709709 const requestedToolName = normalizeToolName ( toolName ) ;
710+ const matchingNamedCandidates : PluginToolRegistration [ ] = [ ] ;
711+ const unnamedCandidates : PluginToolRegistration [ ] = [ ] ;
712+ for ( const candidate of candidates ) {
713+ if ( candidate . names . length === 0 ) {
714+ unnamedCandidates . push ( candidate ) ;
715+ continue ;
716+ }
717+ if ( candidate . names . some ( ( name ) => normalizeToolName ( name ) === requestedToolName ) ) {
718+ matchingNamedCandidates . push ( candidate ) ;
719+ }
720+ }
710721 const resolveCandidateTool = (
711722 candidate : PluginToolRegistration ,
712723 ) : AnyAgentTool | undefined => {
@@ -724,12 +735,6 @@ function createCachedDescriptorPluginTool(params: {
724735 }
725736 return undefined ;
726737 } ;
727- const matchingNamedCandidates = candidates . filter (
728- ( candidate ) =>
729- candidate . names . length > 0 &&
730- candidate . names . some ( ( name ) => normalizeToolName ( name ) === requestedToolName ) ,
731- ) ;
732- const unnamedCandidates = candidates . filter ( ( candidate ) => candidate . names . length === 0 ) ;
733738 for ( const candidate of [ ...matchingNamedCandidates , ...unnamedCandidates ] ) {
734739 let matchedTool : AnyAgentTool | undefined ;
735740 try {
You can’t perform that action at this time.
0 commit comments