-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Initial Checks
- I confirm that I'm using the latest version of Pydantic AI
- I confirm that I searched for my issue in https://github.com/pydantic/pydantic-ai/issues before opening this issue
Description
I'm using the following code to create an MCP server:
file_system_mcp = MCPServerStdio(
'docker',
args=[
'run',
'-i',
'--rm',
"--mount",
"type=bind,src=...",
"-w", "/src",
'mcp/filesystem',
"...",
],
)
However I forgot to start Docker deamon.
Later when I use async with file_system_mcp:
I get the exception:
unhandled errors in a TaskGroup (1 sub-exception)
instead of a helpful exception such as:
docker: Cannot connect to the Docker daemon at unix:///Users/jmonsonego.ctr/.docker/run/docker.sock. Is the docker daemon running?
I can see the mentioned sub exception as McpError('Connection closed')
when I view the local variables during debugging, but that's not specific enough.
Why doesn't Pydantic propagate the exceptions that happen during the __aenter__
of the MCP context manager outside?
Example Code
Python, Pydantic AI & LLM client version
Python 3.13
Pydantic AI 0.7.3
hromanoc
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working