Skip to content

Commit e25c005

Browse files
docs(core): drop result-type-correlation claim from setNotificationHandler (returns void)
1 parent 8abc9a0 commit e25c005

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

.changeset/export-protocol-spec.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@
33
'@modelcontextprotocol/server': minor
44
---
55

6-
Export the abstract `Protocol` class (was reachable in v1 via deep imports) and add `Protocol<ContextT, SpecT extends ProtocolSpec = McpSpec>` for typed custom-method vocabularies. Subclasses supplying a concrete `ProtocolSpec` get method-name autocomplete and result-type correlation on the typed `setRequestHandler`/`setNotificationHandler` overloads (handler param types come from the `paramsSchema` argument; `ProtocolSpec['params']` is informational).
6+
Export the abstract `Protocol` class (was reachable in v1 via deep imports) and add `Protocol<ContextT, SpecT extends ProtocolSpec = McpSpec>` for typed custom-method vocabularies. Subclasses supplying a concrete `ProtocolSpec` get method-name autocomplete on the typed `setRequestHandler`/`setNotificationHandler` overloads, and result-type correlation on `setRequestHandler` (handler param types come from the `paramsSchema` argument; `ProtocolSpec['params']` is informational).

packages/core/src/shared/protocol.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,9 @@ type TimeoutInfo = {
309309
* Declares the request and notification vocabulary a `Protocol` subclass speaks.
310310
*
311311
* Supplying a concrete `ProtocolSpec` as `Protocol`'s second type argument gives method-name
312-
* autocomplete and result-type correlation on the typed overloads of `setRequestHandler`
313-
* and `setNotificationHandler`. `Protocol` defaults to {@linkcode McpSpec}; using the bare
314-
* `ProtocolSpec` type leaves methods string-keyed and untyped.
312+
* autocomplete on the typed overloads of `setRequestHandler` and `setNotificationHandler`, and
313+
* result-type correlation on `setRequestHandler`. `Protocol` defaults to {@linkcode McpSpec};
314+
* using the bare `ProtocolSpec` type leaves methods string-keyed and untyped.
315315
*
316316
* Only `requests[K].result` is enforced by the type system; `params` shapes are informational
317317
* (handler param types come from the `paramsSchema` you pass at the call site).

0 commit comments

Comments
 (0)