You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 7b808a9
Browse filesBrowse the repository at this point in the historyBrowse files
normalizeObjectSchema returned undefined for any schema whose root was not
z.object(...), so registerTool silently advertised an empty schema in
tools/list when given z.discriminatedUnion(...). Tool calls still
validated correctly via the fallback in validateToolInput, which masked
the bug from end-to-end tests.
Pass discriminated unions and unions through unchanged in
normalizeObjectSchema; let toJsonSchemaCompat handle the actual
conversion (zod-to-json-schema for v3, Mini's z.toJSONSchema for v4).
Both emit oneOf/anyOf branches.
Default a top-level type: "object" on the emitted JSON Schema in mcp.ts
so the wire payload is spec compliant when the converter does not include
one (the discriminated-union and union case).
Adds three regression tests under "Tools with union and intersection
schemas" exercising tools/list, callTool, and outputSchema for v3 and v4.
Fix `registerTool` / `registerPrompt` silently dropping `inputSchema` and `outputSchema` when given a `z.discriminatedUnion(...)` or `z.union(...)` of objects.
6
+
7
+
`normalizeObjectSchema` previously returned `undefined` for any schema whose root was not `z.object(...)`, so the schema never reached `toJsonSchemaCompat` and `tools/list` advertised an empty schema. Tool calls still validated correctly via the fallback in `validateToolInput`,
8
+
which masked the bug.
9
+
10
+
`normalizeObjectSchema` now passes discriminated unions and unions through unchanged. The `tools/list` payload is also given a top-level `type: "object"` when missing so the emitted JSON Schema satisfies the MCP spec for tool input/output schemas (Zod emits `oneOf` / `anyOf`
0 commit comments