Skip to content

Commit 9f099db

Browse files
clean2
1 parent f10f974 commit 9f099db

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

packages/server/api/src/app/ai/mcp/docs-tools.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)