MCPcopy Create free account
hub / github.com/WJX20/claude-code / buildAllTools

Function buildAllTools

src/cli/print.ts:1476–1502  ·  view source on GitHub ↗
(appState: AppState)

Source from the content-addressed store, hash-verified

1474 // Closes over the mutable sdkTools/dynamicMcpState bindings so both call
1475 // sites see late-connecting servers.
1476 const buildAllTools = (appState: AppState): Tools => {
1477 const assembledTools = assembleToolPool(
1478 appState.toolPermissionContext,
1479 appState.mcp.tools,
1480 )
1481 let allTools = uniqBy(
1482 mergeAndFilterTools(
1483 [...tools, ...sdkTools, ...dynamicMcpState.tools],
1484 assembledTools,
1485 appState.toolPermissionContext.mode,
1486 ),
1487 'name',
1488 )
1489 if (options.permissionPromptToolName) {
1490 allTools = allTools.filter(
1491 tool => !toolMatchesName(tool, options.permissionPromptToolName!),
1492 )
1493 }
1494 const initJsonSchema = getInitJsonSchema()
1495 if (initJsonSchema && !options.jsonSchema) {
1496 const syntheticOutputResult = createSyntheticOutputTool(initJsonSchema)
1497 if ('tool' in syntheticOutputResult) {
1498 allTools = [...allTools, syntheticOutputResult.tool]
1499 }
1500 }
1501 return allTools
1502 }
1503
1504 // Bridge handle for remote-control (SDK control message).
1505 // Mirrors the REPL's useReplBridge hook: the handle is created when

Callers 2

drainCommandQueueFunction · 0.85
runHeadlessStreamingFunction · 0.85

Calls 5

assembleToolPoolFunction · 0.85
mergeAndFilterToolsFunction · 0.85
toolMatchesNameFunction · 0.85
getInitJsonSchemaFunction · 0.85

Tested by

no test coverage detected