Skip to content

Commit a7bc91a

Browse files
committed
refactor: added mcp doc explanation, review changes
1 parent f6ca999 commit a7bc91a

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

docs/mcp/client.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pip/uv-add "pydantic-ai-slim[mcp]"
1212
```
1313

1414
!!! note
15-
MCP integration requires Python 3.10 or higher.
15+
MCP integration requires Python 3.10 or higher.
1616

1717
## Usage
1818

@@ -34,7 +34,7 @@ You can use the [`async with agent`][pydantic_ai.Agent.__aenter__] context manag
3434
[Streamable HTTP](https://modelcontextprotocol.io/introduction#streamable-http) transport to a server.
3535

3636
!!! note
37-
[`MCPServerStreamableHTTP`][pydantic_ai.mcp.MCPServerStreamableHTTP] requires an MCP server to be running and accepting HTTP connections before running the agent. Running the server is not managed by Pydantic AI.
37+
[`MCPServerStreamableHTTP`][pydantic_ai.mcp.MCPServerStreamableHTTP] requires an MCP server to be running and accepting HTTP connections before running the agent. Running the server is not managed by Pydantic AI.
3838

3939
Before creating the Streamable HTTP client, we need to run a server that supports the Streamable HTTP transport.
4040

@@ -452,6 +452,8 @@ if __name__ == '__main__':
452452
mcp.run(transport='stdio')
453453
```
454454

455+
This server demonstrates elicitation by requesting structured booking details from the client when the `book_table` tool is called. Here's how to create a client that handles these elicitation requests:
456+
455457
```python {title="client_example.py" py="3.10" requires="restaurant_server.py" test="skip"}
456458
import asyncio
457459
from typing import Any

pydantic_ai_slim/pydantic_ai/mcp.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,7 @@
4040
# after mcp imports so any import error maps to this file, not _mcp.py
4141
from . import _mcp, _utils, exceptions, messages, models
4242

43-
__all__ = (
44-
'MCPServer',
45-
'MCPServerStdio',
46-
'MCPServerHTTP',
47-
'MCPServerSSE',
48-
'MCPServerStreamableHTTP',
49-
)
43+
__all__ = 'MCPServer', 'MCPServerStdio', 'MCPServerHTTP', 'MCPServerSSE', 'MCPServerStreamableHTTP'
5044

5145
TOOL_SCHEMA_VALIDATOR = pydantic_core.SchemaValidator(
5246
schema=pydantic_core.core_schema.dict_schema(

0 commit comments

Comments
 (0)