MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / deserializeToJsonSchema

Function deserializeToJsonSchema

packages/kernel/ir/src/serialize.ts:45–80  ·  view source on GitHub ↗
(serialized: typeof SerializedCatalog.Type)

Source from the content-addressed store, hash-verified

43}
44
45export function deserializeToJsonSchema(serialized: typeof SerializedCatalog.Type): {
46 tools: ReadonlyArray<{
47 path: string;
48 description?: string;
49 tags?: ReadonlyArray<string>;
50 namespace?: string;
51 input?: JsonSchema;
52 output?: JsonSchema;
53 error?: JsonSchema;
54 }>;
55 types: Record<string, unknown>;
56} {
57 const types = serialized.types;
58
59 function resolveRef(ref: string | undefined): JsonSchema | undefined {
60 if (!ref) return undefined;
61 const schema = types[ref];
62 if (!schema) return undefined;
63 return {
64 ...(schema as JsonSchema),
65 $defs: types as Record<string, JsonSchema>,
66 };
67 }
68
69 return {
70 tools: serialized.tools.map((tool) => ({
71 path: tool.path,
72 description: tool.description,
73 integrationId: tool.integrationId,
74 input: resolveRef(tool.input),
75 output: resolveRef(tool.output),
76 error: resolveRef(tool.error),
77 })),
78 types,
79 };
80}

Callers

nothing calls this directly

Calls 1

resolveRefFunction · 0.70

Tested by

no test coverage detected