* Resolves the tool ID for a given operation using the block's tool config. * Falls back to checking tools.access if no config.tool function exists.
(block: BlockConfig, operationId: string)
| 92 | * Falls back to checking tools.access if no config.tool function exists. |
| 93 | */ |
| 94 | function resolveToolId(block: BlockConfig, operationId: string): string | null { |
| 95 | if (!block.tools) return null |
| 96 | |
| 97 | if (block.tools.config?.tool) { |
| 98 | try { |
| 99 | return block.tools.config.tool({ operation: operationId }) |
| 100 | } catch { |
| 101 | return null |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | if (block.tools.access?.length === 1) { |
| 106 | return block.tools.access[0] |
| 107 | } |
| 108 | |
| 109 | return null |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * Builds an index of all tool operations from the block registry. |
no outgoing calls
no test coverage detected