Skip to content

fix(fastmcp): support PEP 604 union return types#2599

Open
MukundaKatta wants to merge 1 commit into
modelcontextprotocol:mainfrom
MukundaKatta:codex/py310-union-tool-return
Open

fix(fastmcp): support PEP 604 union return types#2599
MukundaKatta wants to merge 1 commit into
modelcontextprotocol:mainfrom
MukundaKatta:codex/py310-union-tool-return

Conversation

@MukundaKatta
Copy link
Copy Markdown

Summary

  • define wrapped structured-output fields using Pydantic's explicit required field tuple
  • add regression coverage for FastMCP tools returning container/primitive PEP 604 unions like dict | list | str

Fixes #2591

Test plan

  • uv run pytest tests/server/mcpserver/test_func_metadata.py -k "structured_output"
  • uv run pytest tests/server/mcpserver/test_func_metadata.py

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.

FastMCP crashes when tool return type uses Python 3.10+ A | B | C union syntax

1 participant