(appState: AppState)
| 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 |
no test coverage detected