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

Function buildAllTools

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

Source from the content-addressed store, hash-verified

1500 // Closes over the mutable sdkTools/dynamicMcpState bindings so both call
1501 // sites see late-connecting servers.
1502 const buildAllTools = (appState: AppState): Tools => {
1503 const assembledTools = assembleToolPool(
1504 appState.toolPermissionContext,
1505 appState.mcp.tools,
1506 )
1507 let allTools = uniqBy(
1508 mergeAndFilterTools(
1509 [...tools, ...sdkTools, ...dynamicMcpState.tools],
1510 assembledTools,
1511 appState.toolPermissionContext.mode,
1512 ),
1513 'name',
1514 )
1515 if (options.permissionPromptToolName) {
1516 allTools = allTools.filter(
1517 tool => !toolMatchesName(tool, options.permissionPromptToolName!),
1518 )
1519 }
1520 const initJsonSchema = getInitJsonSchema()
1521 if (initJsonSchema && !options.jsonSchema) {
1522 const syntheticOutputResult = createSyntheticOutputTool(initJsonSchema)
1523 if ('tool' in syntheticOutputResult) {
1524 allTools = [...allTools, syntheticOutputResult.tool]
1525 }
1526 }
1527 return allTools
1528 }
1529
1530 // Bridge handle for remote-control (SDK control message).
1531 // 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
getInitJsonSchemaFunction · 0.85
toolMatchesNameFunction · 0.50

Tested by

no test coverage detected