( toolId: string | undefined, blockType: string, blockName?: string )
| 297 | * Returns null if valid, error message if invalid |
| 298 | */ |
| 299 | export function validateToolReference( |
| 300 | toolId: string | undefined, |
| 301 | blockType: string, |
| 302 | blockName?: string |
| 303 | ): string | null { |
| 304 | if (!toolId) return null |
| 305 | |
| 306 | if (!isCustomTool(toolId) && !isMcpTool(toolId)) { |
| 307 | // For built-in tools, verify they exist |
| 308 | const tool = getTool(toolId) |
| 309 | if (!tool) { |
| 310 | return `Block ${blockName || 'unknown'} (${blockType}): references non-existent tool '${toolId}'` |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | return null |
| 315 | } |
no test coverage detected