(blockType: string, operation?: string)
| 184 | * Gets the correct tool ID for a block operation. |
| 185 | */ |
| 186 | export function getToolIdForOperation(blockType: string, operation?: string): string | undefined { |
| 187 | const block = getBlockConfigurations()[blockType] |
| 188 | if (!block?.tools?.access) return undefined |
| 189 | |
| 190 | if (block.tools.access.length === 1) { |
| 191 | return block.tools.access[0] |
| 192 | } |
| 193 | |
| 194 | if (operation && block.tools.config?.tool) { |
| 195 | try { |
| 196 | return block.tools.config.tool({ operation }) |
| 197 | } catch (error) { |
| 198 | logger.error('Error selecting tool for operation:', error) |
| 199 | } |
| 200 | } |
| 201 | |
| 202 | if (operation && block.tools.access.includes(operation)) { |
| 203 | return operation |
| 204 | } |
| 205 | |
| 206 | return block.tools.access[0] |
| 207 | } |
| 208 | |
| 209 | function resolveSubBlockForParam( |
| 210 | paramId: string, |
no test coverage detected