fix(mcp-tools): enhance tool lookup to match by name in addition to ID (#4323)
This commit is contained in:
parent
a42283e789
commit
b53dbcbb30
@ -1,16 +1,19 @@
|
|||||||
import { Tool, ToolUnion, ToolUseBlock } from '@anthropic-ai/sdk/resources'
|
import { Tool, ToolUnion, ToolUseBlock } from '@anthropic-ai/sdk/resources'
|
||||||
import { FunctionCall, FunctionDeclaration, SchemaType, Tool as geminiTool } from '@google/generative-ai'
|
|
||||||
import {
|
import {
|
||||||
ArraySchema,
|
ArraySchema,
|
||||||
BaseSchema,
|
BaseSchema,
|
||||||
BooleanSchema,
|
BooleanSchema,
|
||||||
EnumStringSchema,
|
EnumStringSchema,
|
||||||
|
FunctionCall,
|
||||||
|
FunctionDeclaration,
|
||||||
FunctionDeclarationSchema,
|
FunctionDeclarationSchema,
|
||||||
FunctionDeclarationSchemaProperty,
|
FunctionDeclarationSchemaProperty,
|
||||||
IntegerSchema,
|
IntegerSchema,
|
||||||
NumberSchema,
|
NumberSchema,
|
||||||
ObjectSchema,
|
ObjectSchema,
|
||||||
SimpleStringSchema
|
SchemaType,
|
||||||
|
SimpleStringSchema,
|
||||||
|
Tool as geminiTool
|
||||||
} from '@google/generative-ai'
|
} from '@google/generative-ai'
|
||||||
import { nanoid } from '@reduxjs/toolkit'
|
import { nanoid } from '@reduxjs/toolkit'
|
||||||
import store from '@renderer/store'
|
import store from '@renderer/store'
|
||||||
@ -182,7 +185,9 @@ export function openAIToolsToMcpTool(
|
|||||||
return undefined
|
return undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
const tool = mcpTools.find((mcptool) => mcptool.id === llmTool.function.name)
|
const tool = mcpTools.find(
|
||||||
|
(mcptool) => mcptool.id === llmTool.function.name || mcptool.name === llmTool.function.name
|
||||||
|
)
|
||||||
|
|
||||||
if (!tool) {
|
if (!tool) {
|
||||||
console.warn('No MCP Tool found for tool call:', llmTool)
|
console.warn('No MCP Tool found for tool call:', llmTool)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user