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
`Client.listPrompts()`, `listResources()`, `listResourceTemplates()`, `listTools()` now return empty results when the server lacks the corresponding capability (instead of sending the request). Set `enforceStrictCapabilities: true` in `ClientOptions` to throw an error instead.
254
254
255
-
<<<<<<< HEAD
256
255
257
-
## 10. Context API (replaces `RequestHandlerExtra`)
256
+
## 11. Context API (replaces `RequestHandlerExtra`)
258
257
259
258
Tool, prompt, and resource callbacks now receive a structured context object (`ctx`) instead of the flat `extra` parameter.
260
259
@@ -269,7 +268,7 @@ Tool, prompt, and resource callbacks now receive a structured context object (`c
1. Update `package.json`: `npmuninstall @modelcontextprotocol/sdk`, install the appropriate v2 packages
347
340
2. Replace all imports from `@modelcontextprotocol/sdk/...` using the import mapping tables (sections 3-4), including `StreamableHTTPServerTransport` → `NodeStreamableHTTPServerTransport`
348
341
3. Replace removed type aliases (`JSONRPCError` → `JSONRPCErrorResponse`, etc.) per section 5
Note: the v2 signature takes a plain `string[]` instead of an options object.
242
242
243
-
<<<<<<< HEAD
244
-
245
243
### Context API replaces `RequestHandlerExtra`
246
244
247
-
# The `extra` parameter in tool, prompt, and resource callbacks has been replaced with a structured context object (`ctx`). The old flat `RequestHandlerExtra` interface is replaced by `ServerContextInterface` (for server callbacks) and `ClientContextInterface` (for client callbacks).
248
-
249
-
### `setRequestHandler` and `setNotificationHandler` use method strings
250
-
251
-
The low-level `setRequestHandler` and `setNotificationHandler` methods on `Client`, `Server`, and `Protocol` now take a method string instead of a Zod schema.
The `extra` parameter in tool, prompt, and resource callbacks has been replaced with a structured context object (`ctx`). The old flat `RequestHandlerExtra` interface is replaced by `ServerContextInterface` (for server callbacks) and `ClientContextInterface` (for client callbacks).
|`ctx.mcpReq.requestSampling(params, opts?)`| Request LLM sampling from client |
362
338
|`ctx.http?.req`| Raw fetch `Request` object (access URL, headers, etc.) |
363
339
364
-
======= import { Server } from '@modelcontextprotocol/server';
340
+
### `setRequestHandler` and `setNotificationHandler` use method strings
341
+
342
+
The low-level `setRequestHandler` and `setNotificationHandler` methods on `Client`, `Server`, and `Protocol` now take a method string instead of a Zod schema.
The request and notification parameters remain fully typed via `RequestTypeMap` and `NotificationTypeMap`. You no longer need to import the individual `*RequestSchema` or `*NotificationSchema` constants for handler registration.
375
381
@@ -390,7 +396,6 @@ Common method string replacements:
0 commit comments