MCPcopy Create free account
hub / github.com/Zoo-Code-Org/Zoo-Code / normalizeToolSchema

Function normalizeToolSchema

src/utils/json-schema.ts:294–304  ·  view source on GitHub ↗
(schema: Record<string, unknown>)

Source from the content-addressed store, hash-verified

292 * @returns A normalized schema object that is JSON Schema draft 2020-12 compliant
293 */
294export function normalizeToolSchema(schema: Record<string, unknown>): Record<string, unknown> {
295 if (typeof schema !== "object" || schema === null) {
296 return schema
297 }
298
299 // First, flatten any top-level composition keywords before normalizing
300 const flattenedSchema = flattenTopLevelComposition(schema)
301
302 const result = NormalizedToolSchemaInternal.safeParse(flattenedSchema)
303 return result.success ? result.data : flattenedSchema
304}

Callers 4

getMcpServerToolsFunction · 0.90
convertToVsCodeLmToolsFunction · 0.90

Calls 1

Tested by

no test coverage detected