You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/migration.md
+24Lines changed: 24 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -169,6 +169,30 @@ result = await session.list_resources(params=PaginatedRequestParams(cursor="next
169
169
result =await session.list_tools(params=PaginatedRequestParams(cursor="next_page_token"))
170
170
```
171
171
172
+
### `ClientSession.get_server_capabilities()` replaced by `initialize_result` property
173
+
174
+
`ClientSession` now stores the full `InitializeResult` via an `initialize_result` property. This provides access to `server_info`, `capabilities`, `instructions`, and the negotiated `protocol_version` through a single property. The `get_server_capabilities()` method has been removed.
175
+
176
+
**Before (v1):**
177
+
178
+
```python
179
+
capabilities = session.get_server_capabilities()
180
+
# server_info, instructions, protocol_version were not stored — had to capture initialize() return value
181
+
```
182
+
183
+
**After (v2):**
184
+
185
+
```python
186
+
result = session.initialize_result
187
+
if result isnotNone:
188
+
capabilities = result.capabilities
189
+
server_info = result.server_info
190
+
instructions = result.instructions
191
+
version = result.protocol_version
192
+
```
193
+
194
+
The high-level `Client.initialize_result` returns the same `InitializeResult` but is non-nullable — initialization is guaranteed inside the context manager, so no `None` check is needed. This replaces v1's `Client.server_capabilities`; use `client.initialize_result.capabilities` instead.
195
+
172
196
### `McpError` renamed to `MCPError`
173
197
174
198
The `McpError` exception class has been renamed to `MCPError` for consistent naming with the MCP acronym style used throughout the SDK.
0 commit comments