Skip to content

Commit b9216b4

Browse files
committed
Update MCP resources docs example.
1 parent 7346061 commit b9216b4

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed

docs/mcp/client.md

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -346,22 +346,7 @@ Then we can create the client:
346346
```python {title="mcp_resources.py", requires="mcp_resource_server.py"}
347347
import asyncio
348348

349-
from pydantic_ai import Agent
350-
from pydantic_ai._run_context import RunContext
351349
from pydantic_ai.mcp import MCPServerStdio
352-
from pydantic_ai.models.test import TestModel
353-
354-
agent = Agent(
355-
model=TestModel(),
356-
deps_type=str,
357-
instructions="Use the customer's name while replying to them.",
358-
)
359-
360-
361-
@agent.instructions
362-
def add_the_users_name(ctx: RunContext[str]) -> str:
363-
return f"The user's name is {ctx.deps}."
364-
365350

366351
async def main():
367352
server = MCPServerStdio('python', args=['-m', 'mcp_resource_server'])
@@ -378,10 +363,6 @@ async def main():
378363
print(f'Text content: {user_name}')
379364
#> Text content: Alice
380365

381-
# Use resources in dependencies
382-
async with agent:
383-
_ = await agent.run('Can you help me with my product?', deps=user_name)
384-
385366

386367
if __name__ == '__main__':
387368
asyncio.run(main())

0 commit comments

Comments
 (0)