Skip to content

Commit 5b00781

Browse files
authored
Fix MCP client documentation inconsistencies (#2357)
1 parent 3b7c18e commit 5b00781

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

docs/mcp/client.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pip/uv-add "pydantic-ai-slim[mcp]"
1313

1414
## Usage
1515

16-
Pydantic AI comes with two ways to connect to MCP servers:
16+
Pydantic AI comes with three ways to connect to MCP servers:
1717

1818
- [`MCPServerStreamableHTTP`][pydantic_ai.mcp.MCPServerStreamableHTTP] which connects to an MCP server using the [Streamable HTTP](https://modelcontextprotocol.io/introduction#streamable-http) transport
1919
- [`MCPServerSSE`][pydantic_ai.mcp.MCPServerSSE] which connects to an MCP server using the [HTTP SSE](https://spec.modelcontextprotocol.io/specification/2024-11-05/basic/transports/#http-with-sse) transport
@@ -72,14 +72,14 @@ _(This example is complete, it can be run "as is" — you'll need to add `asynci
7272

7373
**What's happening here?**
7474

75-
- The model is receiving the prompt "how many days between 2000-01-01 and 2025-03-18?"
76-
- The model decides "Oh, I've got this `run_python_code` tool, that will be a good way to answer this question", and writes some python code to calculate the answer.
75+
- The model receives the prompt "What is 7 plus 5?"
76+
- The model decides "Oh, I've got this `add` tool, that will be a good way to answer this question"
7777
- The model returns a tool call
78-
- Pydantic AI sends the tool call to the MCP server using the SSE transport
79-
- The model is called again with the return value of running the code
78+
- Pydantic AI sends the tool call to the MCP server using the Streamable HTTP transport
79+
- The model is called again with the return value of running the `add` tool (12)
8080
- The model returns the final answer
8181

82-
You can visualise this clearly, and even see the code that's run by adding three lines of code to instrument the example with [logfire](https://logfire.pydantic.dev/docs):
82+
You can visualise this clearly, and even see the tool call, by adding three lines of code to instrument the example with [logfire](https://logfire.pydantic.dev/docs):
8383

8484
```python {title="mcp_sse_client_logfire.py" test="skip"}
8585
import logfire
@@ -88,10 +88,6 @@ logfire.configure()
8888
logfire.instrument_pydantic_ai()
8989
```
9090

91-
Will display as follows:
92-
93-
![Logfire run python code](../img/logfire-run-python-code.png)
94-
9591
### SSE Client
9692

9793
[`MCPServerSSE`][pydantic_ai.mcp.MCPServerSSE] connects over HTTP using the [HTTP + Server Sent Events transport](https://spec.modelcontextprotocol.io/specification/2024-11-05/basic/transports/#http-with-sse) to a server.

0 commit comments

Comments
 (0)