Repository navigation
Conversation
Eigenwise
left a comment
There was a problem hiding this comment.
The additionalProperties: true half fixes real data loss: extra keys the server allows are dropped today. The false half makes generated models reject extra keys that main quietly drops, and zod-based servers commonly send additionalProperties: false at the top level, so that changes behavior for a lot of existing tools with no bug behind it. Please keep the allow and typed-extras branches and drop the forbid branch.
Leaving this open for an update. Please also keep to the limit in What gets reviewed before opening new pull requests.
|
Consolidated into #389, which is rebased onto current main. That patch preserves allowed/typed extensions and removes the new forbid behavior: |
MCP object models currently use Pydantic's default
extra="ignore", even when the server explicitly advertisesadditionalProperties. A named-field object that permits extension keys silently drops those keys from both tool arguments and typed results. A closed object also accepts unadvertised keys by discarding them.Apply the explicit object extension policy when building top-level and referenced object models.
truepreserves arbitrary extra values, a schema validates and serializes extra values through Pydantic's typed extra dictionary, andfalseforbids unknown keys. Existing behavior for schemas that omit this keyword stays unchanged. The generated JSON Schema carries the same explicit policy.This covers named-field objects, closed empty objects, and extra values that reference another structured record. It complements the existing dictionary conversion for objects without named properties.
Validation
git diff --checkpass.The remote commit tree matches the locally tested tree.