MCPcopy Create free account
hub / github.com/modelcontextprotocol/inspector / cacheToolOutputSchemas

Function cacheToolOutputSchemas

client/src/utils/schemaUtils.ts:17–32  ·  view source on GitHub ↗
(tools: Tool[])

Source from the content-addressed store, hash-verified

15 * @param tools Array of tools that may have output schemas
16 */
17export 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

Callers 4

listToolsFunction · 0.90
AppFunction · 0.90
ToolsTab.test.tsxFile · 0.90

Calls 1

clearMethod · 0.45

Tested by

no test coverage detected