(tools: Tool[])
| 15 | * @param tools Array of tools that may have output schemas |
| 16 | */ |
| 17 | export function cacheToolOutputSchemas(tools: Tool[]): void { |
| 18 | toolOutputValidators.clear(); |
| 19 | for (const tool of tools) { |
| 20 | if (tool.outputSchema) { |
| 21 | try { |
| 22 | const validator = ajv.compile(tool.outputSchema); |
| 23 | toolOutputValidators.set(tool.name, validator); |
| 24 | } catch (error) { |
| 25 | console.warn( |
| 26 | `Failed to compile output schema for tool ${tool.name}:`, |
| 27 | error, |
| 28 | ); |
| 29 | } |
| 30 | } |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | /** |
| 35 | * Gets the cached output schema validator for a tool |
no test coverage detected