(appState: AppState)
| 1485 | // Closes over the mutable sdkTools/dynamicMcpState bindings so both call |
| 1486 | // sites see late-connecting servers. |
| 1487 | const buildAllTools = (appState: AppState): Tools => { |
| 1488 | const assembledTools = assembleToolPool( |
| 1489 | appState.toolPermissionContext, |
| 1490 | appState.mcp.tools, |
| 1491 | ) |
| 1492 | const initialTools = filterToolsByDenyRules( |
| 1493 | [...tools, ...sdkTools, ...dynamicMcpState.tools], |
| 1494 | appState.toolPermissionContext, |
| 1495 | ) |
| 1496 | let allTools = uniqBy( |
| 1497 | mergeAndFilterTools( |
| 1498 | initialTools, |
| 1499 | assembledTools, |
| 1500 | appState.toolPermissionContext.mode, |
| 1501 | ), |
| 1502 | 'name', |
| 1503 | ) |
| 1504 | if (options.permissionPromptToolName) { |
| 1505 | allTools = allTools.filter( |
| 1506 | tool => !toolMatchesName(tool, options.permissionPromptToolName!), |
| 1507 | ) |
| 1508 | } |
| 1509 | const initJsonSchema = getInitJsonSchema() |
| 1510 | if (initJsonSchema && !options.jsonSchema) { |
| 1511 | const syntheticOutputResult = createSyntheticOutputTool(initJsonSchema) |
| 1512 | if ('tool' in syntheticOutputResult) { |
| 1513 | allTools = [...allTools, syntheticOutputResult.tool] |
| 1514 | } |
| 1515 | } |
| 1516 | return allTools |
| 1517 | } |
| 1518 | |
| 1519 | // Bridge handle for remote-control (SDK control message). |
| 1520 | // Mirrors the REPL's useReplBridge hook: the handle is created when |
no test coverage detected