File tree Expand file tree Collapse file tree
packages/server/api/src/app/ai/mcp Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,16 +37,18 @@ export async function getDocsTools(): Promise<MCPTool> {
3737 } ) ;
3838
3939 const tools = await client . tools ( ) ;
40- const toolEntries =
41- tools instanceof Map ? Array . from ( tools . entries ( ) ) : Object . entries ( tools ) ;
40+ const toolsObject = tools instanceof Map ? Object . fromEntries ( tools ) : tools ;
4241
43- const searchTool = toolEntries . find ( ( [ name ] ) =>
42+ const searchToolName = Object . keys ( toolsObject ) . find ( ( name ) =>
4443 name . toLowerCase ( ) . includes ( 'search' ) ,
45- ) ?. [ 1 ] as MCPSearchTool | undefined ;
44+ ) ;
45+ const searchTool = searchToolName
46+ ? ( toolsObject [ searchToolName ] as MCPSearchTool )
47+ : undefined ;
4648
4749 if ( ! searchTool ?. execute ) {
4850 logger . error ( 'Docs MCP search tool not available' , {
49- availableTools : toolEntries . map ( ( [ name ] ) => name ) ,
51+ availableTools : Object . keys ( toolsObject ) ,
5052 } ) ;
5153 }
5254
You can’t perform that action at this time.
0 commit comments