-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Closed
Description
Initial Checks
- I confirm that I'm using the latest version of MCP Python SDK
- I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue
Description
Description:
When registering toolkit functions that return non-standard Python objects (i.e., types not natively supported by Pydantic), MCP/fastMCP fails with a PydanticSchemaGenerationError
. This error occurs because Pydantic cannot generate a schema for such custom or third-party types by default. The problem arises whenever tool registration parses output annotations involving these unsupported types.
Reason:
MCP/fastMCP automatically wraps toolkit function outputs with Pydantic models. When the output type is a non-standard or third-party object, schema generation is not supported by default, resulting in runtime errors.
Example Code
Python & MCP Python SDK
1.11.0
Metadata
Metadata
Assignees
Labels
No labels