Skip to content

fix: support strict JSON Schema validators and resolve TypeScript compiler errors - #2

Open
creatiVision wants to merge 5 commits into
mcp-z:masterfrom
creatiVision:fix/strict-schema-and-types
Open

fix: support strict JSON Schema validators and resolve TypeScript compiler errors#2
creatiVision wants to merge 5 commits into
mcp-z:masterfrom
creatiVision:fix/strict-schema-and-types

Conversation

@creatiVision

Copy link
Copy Markdown

Summary

This PR improves compatibility with strict JSON Schema validators (such as the Moonshot/Kimi API validator) and resolves a few strict TypeScript compiler errors in the codebase.

Changes

  1. JSON Schema Compatibility:

    • Replaced z.tuple([z.number(), z.number()]) with z.array(z.number()).length(2) in src/mcp/tools/pdf-document.ts and src/mcp/tools/pdf-layout.ts.
    • Why: Standard JSON Schema Draft-07 represents Zod tuples as an array of schemas (items: [{type: number}, {type: number}]). Strict validators (such as Moonshot) reject array-based items schemas and require items to be a single schema object. Using z.array(z.number()).length(2) compiles to items: { type: 'number' }, minItems: 2, maxItems: 2 which is functionally equivalent but universally accepted by all JSON Schema engines.
  2. TypeScript Fixes:

    • Resolved type narrowing errors in src/lib/yoga-resume/measure.ts and src/lib/yoga-resume/render.ts where element.bullets is optional and could be undefined.
    • Resolved pngBuffer possibly undefined error in src/mcp/tools/pdf-image.ts.

@kmalakoff
kmalakoff force-pushed the master branch 14 times, most recently from 28984eb to 4c710ec Compare August 30, 2026 07:52
@kmalakoff
kmalakoff force-pushed the master branch 11 times, most recently from 1f8434e to 19022ec Compare September 5, 2026 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants