Skip to content

Stop pydantic 2.13 from leaking _WrappedResult docstring into tool output schemas#3918

Merged
jlowin merged 1 commit intomainfrom
fix/wrap-result-docstring
Apr 14, 2026
Merged

Stop pydantic 2.13 from leaking _WrappedResult docstring into tool output schemas#3918
jlowin merged 1 commit intomainfrom
fix/wrap-result-docstring

Conversation

@jlowin
Copy link
Copy Markdown
Member

@jlowin jlowin commented Apr 14, 2026

Pydantic 2.13 started emitting dataclass docstrings as JSON-schema description. Our private _WrappedResult dataclass, which wraps non-object return types into the object shape MCP requires, had a docstring — so every tool returning e.g. int, str, or list[...] began advertising "Generic wrapper for non-object return types." as the description of its output schema. That's a fastmcp implementation detail leaking into the user-visible tool manifest.

Bumping the lockfile + snapping tests would only invert the problem (the lowest-direct CI job on pydantic 2.11.7 wouldn't emit the description and would go red). Dropping the docstring makes the schema version-insensitive across 2.11.7 → 2.13.0.

Before (pydantic 2.13):

{"description": "Generic wrapper for non-object return types.", "properties": {"result": {"type": "integer"}}, "required": ["result"], "type": "object", "x-fastmcp-wrap-result": True}

After:

{"properties": {"result": {"type": "integer"}}, "required": ["result"], "type": "object", "x-fastmcp-wrap-result": True}

Also capitalizes "MCP SDK" in the upgrade-check issue template while we're here.

Closes #3902

…nto output schemas

Pydantic 2.13 started emitting dataclass docstrings as schema `description`.
The private wrapper was advertising "Generic wrapper for non-object return
types." on every tool with a non-object return type. Also capitalizes MCP SDK
in the upgrade-check issue template.
@marvin-context-protocol marvin-context-protocol Bot added bug Something isn't working. Reports of errors, unexpected behavior, or broken functionality. server Related to FastMCP server implementation or server-side functionality. labels Apr 14, 2026
@jlowin jlowin merged commit 7d76074 into main Apr 14, 2026
9 checks passed
@jlowin jlowin deleted the fix/wrap-result-docstring branch April 14, 2026 01:38
strawgate pushed a commit that referenced this pull request Apr 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working. Reports of errors, unexpected behavior, or broken functionality. server Related to FastMCP server implementation or server-side functionality.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Upgrade checks failing on main branch

1 participant