Skip to content

Expose MCP Server Instructions in Pydantic AI’s MCP Client #3353

@meruzhanhovhannisyan

Description

@meruzhanhovhannisyan

Description

🧩 Feature Request: Expose MCP Server Instructions in Pydantic AI’s MCP Client

MCP servers can send server instructions along with serverInfo during initialization.
These instructions are useful for LLMs to better understand:
How to interact with the server’s tools
Known limitations or special behaviors
Other contextual guidance

Example:

{
  "capabilities": {
    "logging": {},
    "resources": { "listChanged": true },
    "tools": { "listChanged": true }
  },
  "serverInfo": {
    "name": "example.mcp.server",
    "version": "1.0.0.0"
  },
  "instructions": "Some instructions sent by server"
}

Problem
The current pydantic-ai MCP client only stores serverInfo and doesn’t expose the instructions field.
Right now, the only way to access it is by initializing the client twice, capturing the InitializeResult, and manually extracting instructions.
This is inefficient and makes it harder to incorporate valuable server context into prompts or tool logic.

Proposed Solution
Expose the instructions field in the client API, for example:
client.instructions
or include it as part of the existing server info data structure.

Why It Matters
Enables developers to easily use trusted MCP server instructions in their system prompts
Helps LLMs adapt to server-specific behaviors dynamically
Avoids redundant initialization calls

References

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions