Skip to content

Commit 7006c1f

Browse files
authored
Merge pull request #164 from dvanp/fix_toolnames_too_long
Modify uniqueToolName for compatibility with MistralAI API
2 parents 53c71ff + af7450c commit 7006c1f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main/mcp.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ export default class {
404404
throw new Error(`Tool ${name} not found`)
405405
}
406406

407-
const tool = name.replace(`___${client.server.uuid}`, '')
407+
const tool = name.replace(`___${client.server.uuid.slice(-4)}`, '')
408408
console.log('Calling MCP tool', tool, args)
409409

410410
return await client.client.callTool({
@@ -415,8 +415,9 @@ export default class {
415415
}
416416

417417
protected uniqueToolName(server: McpServer, name: string): string {
418-
return `${name}___${server.uuid}`
419-
}
418+
const suffix = server.uuid.slice(-4) // use only last 4 characters of UUID to generate uniqueToolName
419+
return `${name}___${suffix}`
420+
}
420421

421422
protected mcpToOpenAI = (server: McpServer, tool: any): LlmTool => {
422423
return {

0 commit comments

Comments
 (0)