MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / primaryType

Function primaryType

src/llm/constrained.ts:76–79  ·  view source on GitHub ↗

Normalize a JSON-Schema `type` (which may be an array like `["string","null"]`).

(node: JsonSchemaNode)

Source from the content-addressed store, hash-verified

74
75/** Normalize a JSON-Schema `type` (which may be an array like `["string","null"]`). */
76function primaryType(node: JsonSchemaNode): string | undefined {
77 if (Array.isArray(node.type)) return node.type.find(t => t !== 'null');
78 return node.type;
79}
80
81/**
82 * Repair `raw` so it conforms to `schema`, fixing ONLY unambiguous type mismatches.

Callers 1

coerceArgsToSchemaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected