Skip to content

pydantic.errors.PydanticSchemaGenerationError: Unable to generate pydantic-core schema for <class 'mcp.client.session.ClientSession'>. #3925

@kpacabes12

Description

@kpacabes12

pydantic.errors.PydanticSchemaGenerationError: Unable to generate pydantic-core schema for <class 'mcp.client.session.ClientSession'>. Set arbitrary_types_allowed=True in the model_config to ignore this error or implement __get_pydantic_core_schema__ on your type to fully support it.

If you got this error by calling handler() within __get_pydantic_core_schema__ then you likely need to call handler.generate_schema(<some type>) since we do not call __get_pydantic_core_schema__ on <some type> otherwise to avoid infinite recursion.

For further information visit https://errors.pydantic.dev/2.12/u/schema-for-unknown-type

i am facing this issue when i am loading the swagger url

url : http://localhost:8000/docs

lib:
google-adk == 1.21.0
fastapi ==0.124.0
pydantic==2.12.5

pythonversion:
python 3.13.2

Can anyone help me to resolve this issue ?

Metadata

Metadata

Labels

mcp[Component] Issues about MCP supportneeds-review[Status] The PR is awaiting review from the maintainertools[Component] This issue is related to tools

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions