Skip to content

MCP Server instructions are currently ignored #704

Closed
@bocytko

Description

@bocytko

Please read this first

  • Have you read the docs?Agents SDK docs
    Have you searched for related issues? Others may have had similar requests

Question

MCP Servers define instructions, for example the aws-documentation-mcp-server.

Instructions are currently ignored in the Agent execution flow. It only reads mcp tools and converts these to LLM tool descriptions. Is this an explicit design decision?

Activity

rm-openai

rm-openai commented on May 15, 2025

@rm-openai
Collaborator

Not explicit, I didn't realize this existed. From the docs, looks like instructions is optional and it says

For example, this information MAY be added to the system prompt.

We could add a way for you to fetch the instructions, and then you can choose to append that to the system prompt. Open to other ideas too.

bocytko

bocytko commented on May 15, 2025

@bocytko
Author

We could add a way for you to fetch the instructions, and then you can choose to append that to the system prompt.

This sounds intuitive enough to me. Shall I file a separate feature request?

rm-openai

rm-openai commented on May 15, 2025

@rm-openai
Collaborator

Nope, we can use this issue. PR also welcome!

DanieleMorotti

DanieleMorotti commented on May 16, 2025

@DanieleMorotti
Contributor

Hi @bocytko, if you haven’t started on this yet I’d be happy to implement this feature.
I found that the instructions are included in the instructions field of the session‐initialization response. We could store it on the server and inject them into the prompt where needed.

bocytko

bocytko commented on May 16, 2025

@bocytko
Author

@DanieleMorotti please go ahead. Thank you in advance!

DanieleMorotti

DanieleMorotti commented on May 16, 2025

@DanieleMorotti
Contributor

@rm-openai I can do something like this:

server_result = await session.initialize()
self.mcp_instructions = server_result.instructions or None

in src/agents/mcp/server.py at line 125. But how / where to pass this variable only for the tools related to a specific server? In the FunctionTool object?

rm-openai

rm-openai commented on May 16, 2025

@rm-openai
Collaborator

@DanieleMorotti wdym? I don't think you need to do anything else. Once you do that, users will be able to do this:

async with MCPServerStreamableHttp(...) as server:
  agent = Agent(..., mcp_servers=[server], instructions=f"...MCP instructions: {server.instructions}")
DanieleMorotti

DanieleMorotti commented on May 16, 2025

@DanieleMorotti
Contributor

Ok sorry, I thought it should be injected to the prompt somehow but instead users will directly choose how to adopt instructions.

rm-openai

rm-openai commented on May 16, 2025

@rm-openai
Collaborator

Ah yup, prefer to leave it to users - less magic that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQuestion about using the SDK

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @bocytko@DanieleMorotti@rm-openai

        Issue actions

          MCP Server instructions are currently ignored · Issue #704 · openai/openai-agents-python