Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 003cbfe

Browse filesBrowse files
Added mcp 'instructions' attribute to the server (#706)
Added the `instructions` attribute to the MCP servers to solve #704 . Let me know if you want to add an example to the documentation.
1 parent c282324 commit 003cbfe
Copy full SHA for 003cbfe

File tree

1 file changed

+4
-2
lines changed
Filter options

1 file changed

+4
-2
lines changed

‎src/agents/mcp/server.py

Copy file name to clipboardExpand all lines: src/agents/mcp/server.py
+4-2Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from mcp.client.sse import sse_client
1313
from mcp.client.streamable_http import GetSessionIdCallback, streamablehttp_client
1414
from mcp.shared.message import SessionMessage
15-
from mcp.types import CallToolResult
15+
from mcp.types import CallToolResult, InitializeResult
1616
from typing_extensions import NotRequired, TypedDict
1717

1818
from ..exceptions import UserError
@@ -73,6 +73,7 @@ def __init__(self, cache_tools_list: bool, client_session_timeout_seconds: float
7373
self.exit_stack: AsyncExitStack = AsyncExitStack()
7474
self._cleanup_lock: asyncio.Lock = asyncio.Lock()
7575
self.cache_tools_list = cache_tools_list
76+
self.server_initialize_result: InitializeResult | None = None
7677

7778
self.client_session_timeout_seconds = client_session_timeout_seconds
7879

@@ -122,7 +123,8 @@ async def connect(self):
122123
else None,
123124
)
124125
)
125-
await session.initialize()
126+
server_result = await session.initialize()
127+
self.server_initialize_result = server_result
126128
self.session = session
127129
except Exception as e:
128130
logger.error(f"Error initializing MCP server: {e}")

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.