-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Added mcp 'instructions' attribute to the server #706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added mcp 'instructions' attribute to the server #706
Conversation
src/agents/mcp/server.py
Outdated
@@ -122,7 +123,8 @@ async def connect(self): | |||
else None, | |||
) | |||
) | |||
await session.initialize() | |||
server_result = await session.initialize() | |||
self.instructions = getattr(server_result, "instructions", None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why use getattr? I see initialize()
returns types.InitializeResult
, which has instructions: str | None = None
In fact, we should probably just set self.server_initialize_result
. That way devs can read other info too, e.g. protocol version or capabilities
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you prefer, the issue was about instructions
so I read that value, but now I set the variable as you suggested.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
awesome thank you
is this in the released version? uv pip freeze | grep openai
|
@cruzanstx i just released a new version v0.0.17 |
@rm-openai thanks much for your hard work sir! |
Added the
instructions
attribute to the MCP servers to solve #704 .Let me know if you want to add an example to the documentation.