@@ -3,6 +3,7 @@ import { toolParams } from '@codebuff/common/tools/list'
33import { generateCompactId } from '@codebuff/common/util/string'
44import { cloneDeep } from 'lodash'
55
6+ import { MCP_TOOL_SEPARATOR } from '../mcp-constants'
67import { getMCPToolData } from '../mcp'
78import { getAgentShortName } from '../templates/prompts'
89import { codebuffToolHandlers } from './handlers/list'
@@ -274,7 +275,7 @@ export function parseRawCustomToolCall(params: {
274275
275276 if (
276277 ! ( customToolDefs && toolName in customToolDefs ) &&
277- ! toolName . includes ( '/' )
278+ ! toolName . includes ( MCP_TOOL_SEPARATOR )
278279 ) {
279280 return {
280281 toolName,
@@ -370,8 +371,8 @@ export async function executeCustomToolCall(
370371 ! ( agentTemplate . toolNames as string [ ] ) . includes ( toolCall . toolName ) &&
371372 ! fromHandleSteps &&
372373 ! (
373- toolCall . toolName . includes ( '/' ) &&
374- toolCall . toolName . split ( '/' ) [ 0 ] in agentTemplate . mcpServers
374+ toolCall . toolName . includes ( MCP_TOOL_SEPARATOR ) &&
375+ toolCall . toolName . split ( MCP_TOOL_SEPARATOR ) [ 0 ] in agentTemplate . mcpServers
375376 )
376377 ) {
377378 // Emit an error event instead of tool call/result pair
@@ -415,15 +416,15 @@ export async function executeCustomToolCall(
415416 return null
416417 }
417418
418- const toolName = toolCall . toolName . includes ( '/' )
419- ? toolCall . toolName . split ( '/' ) . slice ( 1 ) . join ( '/' )
419+ const toolName = toolCall . toolName . includes ( MCP_TOOL_SEPARATOR )
420+ ? toolCall . toolName . split ( MCP_TOOL_SEPARATOR ) . slice ( 1 ) . join ( MCP_TOOL_SEPARATOR )
420421 : toolCall . toolName
421422 const clientToolResult = await requestToolCall ( {
422423 userInputId,
423424 toolName,
424425 input : toolCall . input ,
425- mcpConfig : toolCall . toolName . includes ( '/' )
426- ? agentTemplate . mcpServers [ toolCall . toolName . split ( '/' ) [ 0 ] ]
426+ mcpConfig : toolCall . toolName . includes ( MCP_TOOL_SEPARATOR )
427+ ? agentTemplate . mcpServers [ toolCall . toolName . split ( MCP_TOOL_SEPARATOR ) [ 0 ] ]
427428 : undefined ,
428429 } )
429430 return clientToolResult . output satisfies ToolResultOutput [ ]
0 commit comments