File tree Expand file tree Collapse file tree 1 file changed +0
-19
lines changed
Expand file tree Collapse file tree 1 file changed +0
-19
lines changed Original file line number Diff line number Diff line change @@ -346,22 +346,7 @@ Then we can create the client:
346346``` python {title="mcp_resources.py", requires="mcp_resource_server.py"}
347347import asyncio
348348
349- from pydantic_ai import Agent
350- from pydantic_ai._run_context import RunContext
351349from 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
366351async 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
386367if __name__ == ' __main__' :
387368 asyncio.run(main())
You can’t perform that action at this time.
0 commit comments