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

Function schemaToRef

packages/kernel/ir/src/serialize.ts:12–27  ·  view source on GitHub ↗
(schema: Schema.Top | undefined)

Source from the content-addressed store, hash-verified

10 const defs: Record<string, JsonSchema> = {};
11
12 function schemaToRef(schema: Schema.Top | undefined): string | undefined {
13 if (!schema) return undefined;
14
15 const identifier = getSchemaIdentifier(schema);
16 const document = Schema.toJsonSchemaDocument(schema);
17 Object.assign(defs, document.definitions);
18
19 if (identifier) {
20 return identifier;
21 }
22
23 // Inline schema without an identifier — store under a generated key
24 const key = `__inline_${Object.keys(defs).length}`;
25 defs[key] = document.schema;
26 return key;
27 }
28
29 const tools = catalog.tools.map((tool) => ({
30 path: tool.path,

Callers 1

serializeFunction · 0.85

Calls 1

getSchemaIdentifierFunction · 0.85

Tested by

no test coverage detected