MCPcopy
hub / github.com/codeaashu/claude-code / buildAllTools

Function buildAllTools

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

Source from the content-addressed store, hash-verified

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