Skip to content

Commit 8d4b41f

Browse files
author
Motta Kin
committed
Update example to show dynamic instructions
1 parent ea9a6c3 commit 8d4b41f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

docs/mcp/client.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,11 +349,13 @@ from pydantic_ai.mcp import MCPServerStreamableHTTP
349349
server = MCPServerStreamableHTTP('http://localhost:8000/mcp')
350350
agent = Agent('openai:gpt-5', toolsets=[server])
351351

352+
@agent.instructions
353+
async def mcp_server_instructions():
354+
return server.instructions
355+
352356
async def main():
353-
async with agent:
354-
# Access server instructions after connection is established
355-
if server.instructions:
356-
print(f'Server guidance: {server.instructions}')
357+
result = await agent.run('Use the server tools to help me')
358+
print(result.output)
357359
```
358360

359361
## Tool metadata

0 commit comments

Comments
 (0)