Repository navigation
add zDateRangeInclude and zFlexibleDate as factory functions - #48
Merged
Merged
Conversation
gregsaab
previously approved these changes
Jul 24, 2026
gregsaab
self-requested a review
July 24, 2026 16:31
LeeHampton
force-pushed
the
lee/no-pointers
branch
from
July 24, 2026 17:36
c2a7a8c to
1710680
Compare
zod-to-json-schema emits $ref pointers when a Zod schema instance is reused across multiple fields. Several LLM providers (e.g. Moonshot/Kimi K3) reject $ref values that don't start with "#/$defs/", breaking tool use for any MCP server that shares a Zod singleton across parameters. These factory functions return a fresh instance on every call so the generated JSON Schema is always inlined — zero $ref references. Downstream MCP servers can import them instead of defining their own, avoiding a class of compatibility bugs that are hard to diagnose. See: modelcontextprotocol/typescript-sdk#1563 modelcontextprotocol/typescript-sdk#2100
LeeHampton
force-pushed
the
lee/no-pointers
branch
from
July 24, 2026 17:45
1710680 to
d0c0171
Compare
The SDK's wildcard export map does not append extensions, so '@modelcontextprotocol/sdk/server/zod-json-schema-compat' only resolves with the explicit .js suffix. Co-Authored-By: Claude Fable 5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
zod-to-json-schema emits pointers when a Zod schema instance is reused across multiple fields. Several LLM providers (e.g. Moonshot/Kimi K3) reject values that don't start with "#//", breaking tool use for any MCP server that shares a Zod singleton across parameters.
These factory functions return a fresh instance on every call so the generated JSON Schema is always inlined — zero references. Downstream MCP servers can import them instead of defining their own, avoiding a class of compatibility bugs that are hard to diagnose.
See: modelcontextprotocol/typescript-sdk#1563
modelcontextprotocol/typescript-sdk#2100
We initially took at a stab at fixing a very specific issue we saw around the billing MCP in this PR
https://github.com/timescale/tiger-billing-mcp-server/pull/7
But changing it here will get ahead of any other MCPs that end up implementing a similar pattern. This does not however change any future schema changes that result in references. If it becomes an issue we might have to think of a broader fix.