@modelcontextprotocol/server 2.0.0-alpha.2 → 2.0.0-alpha.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/README.md +6 -2
  2. package/dist/{src-IKPjmxu7.mjs → ajvProvider-Birb50r-.mjs} +21 -3421
  3. package/dist/ajvProvider-Birb50r-.mjs.map +1 -0
  4. package/dist/ajvProvider-DZ_siXcF.d.mts +983 -0
  5. package/dist/ajvProvider-DZ_siXcF.d.mts.map +1 -0
  6. package/dist/cfWorkerProvider-BrJKpSFH.mjs +954 -0
  7. package/dist/cfWorkerProvider-BrJKpSFH.mjs.map +1 -0
  8. package/dist/cfWorkerProvider-DUhk5Ewx.d.mts +52 -0
  9. package/dist/cfWorkerProvider-DUhk5Ewx.d.mts.map +1 -0
  10. package/dist/chunk-BRhqBsOc.mjs +42 -0
  11. package/dist/index.d.mts +1526 -334
  12. package/dist/index.d.mts.map +1 -1
  13. package/dist/index.mjs +91 -766
  14. package/dist/index.mjs.map +1 -1
  15. package/dist/shimsNode.d.mts +1 -1
  16. package/dist/shimsNode.mjs +1 -1
  17. package/dist/shimsWorkerd.d.mts +1 -1
  18. package/dist/shimsWorkerd.mjs +1 -1
  19. package/dist/shimsWorkerd.mjs.map +1 -1
  20. package/dist/src-Pa1iAvsj.mjs +3386 -0
  21. package/dist/src-Pa1iAvsj.mjs.map +1 -0
  22. package/dist/stdio.d.mts +49 -0
  23. package/dist/stdio.d.mts.map +1 -0
  24. package/dist/stdio.mjs +106 -0
  25. package/dist/stdio.mjs.map +1 -0
  26. package/dist/{index-Bhfkexnj.d.mts → transport-DMKhEchd.d.mts} +636 -1907
  27. package/dist/transport-DMKhEchd.d.mts.map +1 -0
  28. package/dist/types-R2RTIcjk.d.mts +66 -0
  29. package/dist/types-R2RTIcjk.d.mts.map +1 -0
  30. package/dist/validators/ajv.d.mts +2 -0
  31. package/dist/validators/ajv.mjs +4 -0
  32. package/dist/validators/cfWorker.d.mts +2 -0
  33. package/dist/validators/cfWorker.mjs +3 -0
  34. package/package.json +35 -16
  35. package/dist/index-Bhfkexnj.d.mts.map +0 -1
  36. package/dist/src-IKPjmxu7.mjs.map +0 -1
@@ -1,448 +1,76 @@
1
1
  import * as z from "zod/v4";
2
- import { Ajv } from "ajv";
3
- import { JSONSchema } from "json-schema-typed";
4
2
 
5
- //#region ../core/src/shared/auth.d.ts
6
-
7
- /**
8
- * RFC 9728 OAuth Protected Resource Metadata
9
- */
10
- declare const OAuthProtectedResourceMetadataSchema: z.ZodObject<{
11
- resource: z.ZodString;
12
- authorization_servers: z.ZodOptional<z.ZodArray<z.ZodURL>>;
13
- jwks_uri: z.ZodOptional<z.ZodString>;
14
- scopes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
15
- bearer_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
16
- resource_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
17
- resource_name: z.ZodOptional<z.ZodString>;
18
- resource_documentation: z.ZodOptional<z.ZodString>;
19
- resource_policy_uri: z.ZodOptional<z.ZodString>;
20
- resource_tos_uri: z.ZodOptional<z.ZodString>;
21
- tls_client_certificate_bound_access_tokens: z.ZodOptional<z.ZodBoolean>;
22
- authorization_details_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
23
- dpop_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
24
- dpop_bound_access_tokens_required: z.ZodOptional<z.ZodBoolean>;
25
- }, z.core.$loose>;
26
- /**
27
- * RFC 8414 OAuth 2.0 Authorization Server Metadata
28
- */
29
- declare const OAuthMetadataSchema: z.ZodObject<{
30
- issuer: z.ZodString;
31
- authorization_endpoint: z.ZodURL;
32
- token_endpoint: z.ZodURL;
33
- registration_endpoint: z.ZodOptional<z.ZodURL>;
34
- scopes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
35
- response_types_supported: z.ZodArray<z.ZodString>;
36
- response_modes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
37
- grant_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
38
- token_endpoint_auth_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
39
- token_endpoint_auth_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
40
- service_documentation: z.ZodOptional<z.ZodURL>;
41
- revocation_endpoint: z.ZodOptional<z.ZodURL>;
42
- revocation_endpoint_auth_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
43
- revocation_endpoint_auth_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
44
- introspection_endpoint: z.ZodOptional<z.ZodString>;
45
- introspection_endpoint_auth_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
46
- introspection_endpoint_auth_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
47
- code_challenge_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
48
- client_id_metadata_document_supported: z.ZodOptional<z.ZodBoolean>;
49
- }, z.core.$loose>;
3
+ //#region ../core-internal/src/types/constants.d.ts
4
+ declare const LATEST_PROTOCOL_VERSION = "2025-11-25";
5
+ declare const DEFAULT_NEGOTIATED_PROTOCOL_VERSION = "2025-03-26";
6
+ declare const SUPPORTED_PROTOCOL_VERSIONS: string[];
7
+ declare const RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
50
8
  /**
51
- * OpenID Connect Discovery 1.0 Provider Metadata
9
+ * `_meta` key carrying the MCP protocol version governing a request.
52
10
  *
53
- * @see https://openid.net/specs/openid-connect-discovery-1_0.html#ProviderMetadata
54
- */
55
- declare const OpenIdProviderMetadataSchema: z.ZodObject<{
56
- issuer: z.ZodString;
57
- authorization_endpoint: z.ZodURL;
58
- token_endpoint: z.ZodURL;
59
- userinfo_endpoint: z.ZodOptional<z.ZodURL>;
60
- jwks_uri: z.ZodURL;
61
- registration_endpoint: z.ZodOptional<z.ZodURL>;
62
- scopes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
63
- response_types_supported: z.ZodArray<z.ZodString>;
64
- response_modes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
65
- grant_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
66
- acr_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
67
- subject_types_supported: z.ZodArray<z.ZodString>;
68
- id_token_signing_alg_values_supported: z.ZodArray<z.ZodString>;
69
- id_token_encryption_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
70
- id_token_encryption_enc_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
71
- userinfo_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
72
- userinfo_encryption_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
73
- userinfo_encryption_enc_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
74
- request_object_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
75
- request_object_encryption_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
76
- request_object_encryption_enc_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
77
- token_endpoint_auth_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
78
- token_endpoint_auth_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
79
- display_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
80
- claim_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
81
- claims_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
82
- service_documentation: z.ZodOptional<z.ZodString>;
83
- claims_locales_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
84
- ui_locales_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
85
- claims_parameter_supported: z.ZodOptional<z.ZodBoolean>;
86
- request_parameter_supported: z.ZodOptional<z.ZodBoolean>;
87
- request_uri_parameter_supported: z.ZodOptional<z.ZodBoolean>;
88
- require_request_uri_registration: z.ZodOptional<z.ZodBoolean>;
89
- op_policy_uri: z.ZodOptional<z.ZodURL>;
90
- op_tos_uri: z.ZodOptional<z.ZodURL>;
91
- client_id_metadata_document_supported: z.ZodOptional<z.ZodBoolean>;
92
- }, z.core.$loose>;
93
- /**
94
- * OpenID Connect Discovery metadata that may include OAuth 2.0 fields
95
- * This schema represents the real-world scenario where OIDC providers
96
- * return a mix of OpenID Connect and OAuth 2.0 metadata fields
97
- */
98
- declare const OpenIdProviderDiscoveryMetadataSchema: z.ZodObject<{
99
- code_challenge_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
100
- issuer: z.ZodString;
101
- authorization_endpoint: z.ZodURL;
102
- token_endpoint: z.ZodURL;
103
- userinfo_endpoint: z.ZodOptional<z.ZodURL>;
104
- jwks_uri: z.ZodURL;
105
- registration_endpoint: z.ZodOptional<z.ZodURL>;
106
- scopes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
107
- response_types_supported: z.ZodArray<z.ZodString>;
108
- response_modes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
109
- grant_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
110
- acr_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
111
- subject_types_supported: z.ZodArray<z.ZodString>;
112
- id_token_signing_alg_values_supported: z.ZodArray<z.ZodString>;
113
- id_token_encryption_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
114
- id_token_encryption_enc_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
115
- userinfo_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
116
- userinfo_encryption_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
117
- userinfo_encryption_enc_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
118
- request_object_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
119
- request_object_encryption_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
120
- request_object_encryption_enc_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
121
- token_endpoint_auth_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
122
- token_endpoint_auth_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
123
- display_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
124
- claim_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
125
- claims_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
126
- service_documentation: z.ZodOptional<z.ZodString>;
127
- claims_locales_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
128
- ui_locales_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
129
- claims_parameter_supported: z.ZodOptional<z.ZodBoolean>;
130
- request_parameter_supported: z.ZodOptional<z.ZodBoolean>;
131
- request_uri_parameter_supported: z.ZodOptional<z.ZodBoolean>;
132
- require_request_uri_registration: z.ZodOptional<z.ZodBoolean>;
133
- op_policy_uri: z.ZodOptional<z.ZodURL>;
134
- op_tos_uri: z.ZodOptional<z.ZodURL>;
135
- client_id_metadata_document_supported: z.ZodOptional<z.ZodBoolean>;
136
- }, z.core.$strip>;
137
- /**
138
- * OAuth 2.1 token response
139
- */
140
- declare const OAuthTokensSchema: z.ZodObject<{
141
- access_token: z.ZodString;
142
- id_token: z.ZodOptional<z.ZodString>;
143
- token_type: z.ZodString;
144
- expires_in: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
145
- scope: z.ZodOptional<z.ZodString>;
146
- refresh_token: z.ZodOptional<z.ZodString>;
147
- }, z.core.$strip>;
148
- /**
149
- * OAuth 2.1 error response
11
+ * For the HTTP transport, the value must match the `MCP-Protocol-Version` header.
150
12
  */
151
- declare const OAuthErrorResponseSchema: z.ZodObject<{
152
- error: z.ZodString;
153
- error_description: z.ZodOptional<z.ZodString>;
154
- error_uri: z.ZodOptional<z.ZodString>;
155
- }, z.core.$strip>;
156
- /**
157
- * RFC 7591 OAuth 2.0 Dynamic Client Registration metadata
158
- */
159
- declare const OAuthClientMetadataSchema: z.ZodObject<{
160
- redirect_uris: z.ZodArray<z.ZodURL>;
161
- token_endpoint_auth_method: z.ZodOptional<z.ZodString>;
162
- grant_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
163
- response_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
164
- client_name: z.ZodOptional<z.ZodString>;
165
- client_uri: z.ZodOptional<z.ZodURL>;
166
- logo_uri: z.ZodUnion<[z.ZodOptional<z.ZodURL>, z.ZodPipe<z.ZodLiteral<"">, z.ZodTransform<undefined, "">>]>;
167
- scope: z.ZodOptional<z.ZodString>;
168
- contacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
169
- tos_uri: z.ZodUnion<[z.ZodOptional<z.ZodURL>, z.ZodPipe<z.ZodLiteral<"">, z.ZodTransform<undefined, "">>]>;
170
- policy_uri: z.ZodOptional<z.ZodString>;
171
- jwks_uri: z.ZodOptional<z.ZodURL>;
172
- jwks: z.ZodOptional<z.ZodAny>;
173
- software_id: z.ZodOptional<z.ZodString>;
174
- software_version: z.ZodOptional<z.ZodString>;
175
- software_statement: z.ZodOptional<z.ZodString>;
176
- }, z.core.$strip>;
177
- /**
178
- * RFC 7591 OAuth 2.0 Dynamic Client Registration client information
179
- */
180
- declare const OAuthClientInformationSchema: z.ZodObject<{
181
- client_id: z.ZodString;
182
- client_secret: z.ZodOptional<z.ZodString>;
183
- client_id_issued_at: z.ZodOptional<z.ZodNumber>;
184
- client_secret_expires_at: z.ZodOptional<z.ZodNumber>;
185
- }, z.core.$strip>;
186
- /**
187
- * RFC 7591 OAuth 2.0 Dynamic Client Registration full response (client information plus metadata)
188
- */
189
- declare const OAuthClientInformationFullSchema: z.ZodObject<{
190
- redirect_uris: z.ZodArray<z.ZodURL>;
191
- token_endpoint_auth_method: z.ZodOptional<z.ZodString>;
192
- grant_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
193
- response_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
194
- client_name: z.ZodOptional<z.ZodString>;
195
- client_uri: z.ZodOptional<z.ZodURL>;
196
- logo_uri: z.ZodUnion<[z.ZodOptional<z.ZodURL>, z.ZodPipe<z.ZodLiteral<"">, z.ZodTransform<undefined, "">>]>;
197
- scope: z.ZodOptional<z.ZodString>;
198
- contacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
199
- tos_uri: z.ZodUnion<[z.ZodOptional<z.ZodURL>, z.ZodPipe<z.ZodLiteral<"">, z.ZodTransform<undefined, "">>]>;
200
- policy_uri: z.ZodOptional<z.ZodString>;
201
- jwks_uri: z.ZodOptional<z.ZodURL>;
202
- jwks: z.ZodOptional<z.ZodAny>;
203
- software_id: z.ZodOptional<z.ZodString>;
204
- software_version: z.ZodOptional<z.ZodString>;
205
- software_statement: z.ZodOptional<z.ZodString>;
206
- client_id: z.ZodString;
207
- client_secret: z.ZodOptional<z.ZodString>;
208
- client_id_issued_at: z.ZodOptional<z.ZodNumber>;
209
- client_secret_expires_at: z.ZodOptional<z.ZodNumber>;
210
- }, z.core.$strip>;
13
+ declare const PROTOCOL_VERSION_META_KEY = "io.modelcontextprotocol/protocolVersion";
211
14
  /**
212
- * RFC 7591 OAuth 2.0 Dynamic Client Registration error response
15
+ * `_meta` key identifying the client software making a request.
213
16
  */
214
- declare const OAuthClientRegistrationErrorSchema: z.ZodObject<{
215
- error: z.ZodString;
216
- error_description: z.ZodOptional<z.ZodString>;
217
- }, z.core.$strip>;
218
- /**
219
- * RFC 7009 OAuth 2.0 Token Revocation request
220
- */
221
- declare const OAuthTokenRevocationRequestSchema: z.ZodObject<{
222
- token: z.ZodString;
223
- token_type_hint: z.ZodOptional<z.ZodString>;
224
- }, z.core.$strip>;
225
- type OAuthMetadata = z.infer<typeof OAuthMetadataSchema>;
226
- type OpenIdProviderMetadata = z.infer<typeof OpenIdProviderMetadataSchema>;
227
- type OpenIdProviderDiscoveryMetadata = z.infer<typeof OpenIdProviderDiscoveryMetadataSchema>;
228
- type OAuthTokens = z.infer<typeof OAuthTokensSchema>;
229
- type OAuthErrorResponse = z.infer<typeof OAuthErrorResponseSchema>;
230
- type OAuthClientMetadata = z.infer<typeof OAuthClientMetadataSchema>;
231
- type OAuthClientInformation = z.infer<typeof OAuthClientInformationSchema>;
232
- type OAuthClientInformationFull = z.infer<typeof OAuthClientInformationFullSchema>;
233
- type OAuthClientInformationMixed = OAuthClientInformation | OAuthClientInformationFull;
234
- type OAuthClientRegistrationError = z.infer<typeof OAuthClientRegistrationErrorSchema>;
235
- type OAuthTokenRevocationRequest = z.infer<typeof OAuthTokenRevocationRequestSchema>;
236
- type OAuthProtectedResourceMetadata = z.infer<typeof OAuthProtectedResourceMetadataSchema>;
237
- type AuthorizationServerMetadata = OAuthMetadata | OpenIdProviderDiscoveryMetadata;
238
- //#endregion
239
- //#region ../core/src/auth/errors.d.ts
17
+ declare const CLIENT_INFO_META_KEY = "io.modelcontextprotocol/clientInfo";
240
18
  /**
241
- * OAuth error codes as defined by {@link https://datatracker.ietf.org/doc/html/rfc6749#section-5.2 | RFC 6749}
242
- * and extensions.
19
+ * `_meta` key carrying the client's capabilities for a request.
20
+ *
21
+ * Capabilities are declared per request rather than once at initialization;
22
+ * servers must not infer capabilities from prior requests.
243
23
  */
244
- declare enum OAuthErrorCode {
245
- /**
246
- * The request is missing a required parameter, includes an invalid parameter value,
247
- * includes a parameter more than once, or is otherwise malformed.
248
- */
249
- InvalidRequest = "invalid_request",
250
- /**
251
- * Client authentication failed (e.g., unknown client, no client authentication included,
252
- * or unsupported authentication method).
253
- */
254
- InvalidClient = "invalid_client",
255
- /**
256
- * The provided authorization grant or refresh token is invalid, expired, revoked,
257
- * does not match the redirection URI used in the authorization request, or was issued to another client.
258
- */
259
- InvalidGrant = "invalid_grant",
260
- /**
261
- * The authenticated client is not authorized to use this authorization grant type.
262
- */
263
- UnauthorizedClient = "unauthorized_client",
264
- /**
265
- * The authorization grant type is not supported by the authorization server.
266
- */
267
- UnsupportedGrantType = "unsupported_grant_type",
268
- /**
269
- * The requested scope is invalid, unknown, malformed, or exceeds the scope granted by the resource owner.
270
- */
271
- InvalidScope = "invalid_scope",
272
- /**
273
- * The resource owner or authorization server denied the request.
274
- */
275
- AccessDenied = "access_denied",
276
- /**
277
- * The authorization server encountered an unexpected condition that prevented it from fulfilling the request.
278
- */
279
- ServerError = "server_error",
280
- /**
281
- * The authorization server is currently unable to handle the request due to temporary overloading or maintenance.
282
- */
283
- TemporarilyUnavailable = "temporarily_unavailable",
284
- /**
285
- * The authorization server does not support obtaining an authorization code using this method.
286
- */
287
- UnsupportedResponseType = "unsupported_response_type",
288
- /**
289
- * The authorization server does not support the requested token type.
290
- */
291
- UnsupportedTokenType = "unsupported_token_type",
292
- /**
293
- * The access token provided is expired, revoked, malformed, or invalid for other reasons.
294
- */
295
- InvalidToken = "invalid_token",
296
- /**
297
- * The HTTP method used is not allowed for this endpoint. (Custom, non-standard error)
298
- */
299
- MethodNotAllowed = "method_not_allowed",
300
- /**
301
- * Rate limit exceeded. (Custom, non-standard error based on RFC 6585)
302
- */
303
- TooManyRequests = "too_many_requests",
304
- /**
305
- * The client metadata is invalid. (Custom error for dynamic client registration - RFC 7591)
306
- */
307
- InvalidClientMetadata = "invalid_client_metadata",
308
- /**
309
- * The request requires higher privileges than provided by the access token.
310
- */
311
- InsufficientScope = "insufficient_scope",
312
- /**
313
- * The requested resource is invalid, missing, unknown, or malformed. (Custom error for resource indicators - RFC 8707)
314
- */
315
- InvalidTarget = "invalid_target",
316
- }
24
+ declare const CLIENT_CAPABILITIES_META_KEY = "io.modelcontextprotocol/clientCapabilities";
317
25
  /**
318
- * OAuth error class for all OAuth-related errors.
26
+ * `_meta` key carrying the desired log level for a request.
27
+ *
28
+ * When absent, the server must not send `notifications/message` notifications
29
+ * for the request.
30
+ *
31
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains
32
+ * in the specification for at least twelve months.
319
33
  */
320
- declare class OAuthError extends Error {
321
- readonly code: OAuthErrorCode | string;
322
- readonly errorUri?: string | undefined;
323
- constructor(code: OAuthErrorCode | string, message: string, errorUri?: string | undefined);
324
- /**
325
- * Converts the error to a standard OAuth error response object.
326
- */
327
- toResponseObject(): OAuthErrorResponse;
328
- /**
329
- * Creates an {@linkcode OAuthError} from an OAuth error response.
330
- */
331
- static fromResponse(response: OAuthErrorResponse): OAuthError;
332
- }
333
- //#endregion
334
- //#region ../core/src/errors/sdkErrors.d.ts
34
+ declare const LOG_LEVEL_META_KEY = "io.modelcontextprotocol/logLevel";
335
35
  /**
336
- * Error codes for SDK errors (local errors that never cross the wire).
337
- * Unlike {@linkcode ProtocolErrorCode} which uses numeric JSON-RPC codes, `SdkErrorCode` uses
338
- * descriptive string values for better developer experience.
36
+ * `_meta` key carrying W3C Trace Context for distributed tracing (SEP-414).
339
37
  *
340
- * These errors are thrown locally by the SDK and are never serialized as
341
- * JSON-RPC error responses.
342
- */
343
- declare enum SdkErrorCode {
344
- /** Transport is not connected */
345
- NotConnected = "NOT_CONNECTED",
346
- /** Transport is already connected */
347
- AlreadyConnected = "ALREADY_CONNECTED",
348
- /** Protocol is not initialized */
349
- NotInitialized = "NOT_INITIALIZED",
350
- /** Required capability is not supported by the remote side */
351
- CapabilityNotSupported = "CAPABILITY_NOT_SUPPORTED",
352
- /** Request timed out waiting for response */
353
- RequestTimeout = "REQUEST_TIMEOUT",
354
- /** Connection was closed */
355
- ConnectionClosed = "CONNECTION_CLOSED",
356
- /** Failed to send message */
357
- SendFailed = "SEND_FAILED",
358
- ClientHttpNotImplemented = "CLIENT_HTTP_NOT_IMPLEMENTED",
359
- ClientHttpAuthentication = "CLIENT_HTTP_AUTHENTICATION",
360
- ClientHttpForbidden = "CLIENT_HTTP_FORBIDDEN",
361
- ClientHttpUnexpectedContent = "CLIENT_HTTP_UNEXPECTED_CONTENT",
362
- ClientHttpFailedToOpenStream = "CLIENT_HTTP_FAILED_TO_OPEN_STREAM",
363
- ClientHttpFailedToTerminateSession = "CLIENT_HTTP_FAILED_TO_TERMINATE_SESSION",
364
- }
365
- /**
366
- * SDK errors are local errors that never cross the wire.
367
- * They are distinct from {@linkcode ProtocolError} which represents JSON-RPC protocol errors
368
- * that are serialized and sent as error responses.
38
+ * When present, the value MUST follow the W3C `traceparent` header format,
39
+ * e.g. `00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01`.
369
40
  *
370
- * @example
371
- * ```ts source="./sdkErrors.examples.ts#SdkError_basicUsage"
372
- * try {
373
- * // Throwing an SDK error
374
- * throw new SdkError(SdkErrorCode.NotConnected, 'Transport is not connected');
375
- * } catch (error) {
376
- * // Checking error type by code
377
- * if (error instanceof SdkError && error.code === SdkErrorCode.RequestTimeout) {
378
- * // Handle timeout
379
- * }
380
- * }
381
- * ```
382
- */
383
- declare class SdkError extends Error {
384
- readonly code: SdkErrorCode;
385
- readonly data?: unknown | undefined;
386
- constructor(code: SdkErrorCode, message: string, data?: unknown | undefined);
387
- }
388
- //#endregion
389
- //#region ../core/src/shared/authUtils.d.ts
390
- /**
391
- * Utilities for handling OAuth resource URIs.
41
+ * @see https://www.w3.org/TR/trace-context/#traceparent-header
392
42
  */
43
+ declare const TRACEPARENT_META_KEY = "traceparent";
393
44
  /**
394
- * Converts a server URL to a resource URL by removing the fragment.
395
- * {@link https://datatracker.ietf.org/doc/html/rfc8707#section-2 | RFC 8707 section 2}
396
- * states that resource URIs "MUST NOT include a fragment component".
397
- * Keeps everything else unchanged (scheme, domain, port, path, query).
45
+ * `_meta` key carrying vendor-specific trace state for distributed tracing (SEP-414).
46
+ *
47
+ * When present, the value MUST follow the W3C `tracestate` header format,
48
+ * e.g. `vendor1=value1,vendor2=value2`.
49
+ *
50
+ * @see https://www.w3.org/TR/trace-context/#tracestate-header
398
51
  */
399
- declare function resourceUrlFromServerUrl(url: URL | string): URL;
52
+ declare const TRACESTATE_META_KEY = "tracestate";
400
53
  /**
401
- * Checks if a requested resource URL matches a configured resource URL.
402
- * A requested resource matches if it has the same scheme, domain, port,
403
- * and its path starts with the configured resource's path.
54
+ * `_meta` key carrying cross-cutting propagation values for distributed tracing (SEP-414).
404
55
  *
405
- * @param options - The options object
406
- * @param options.requestedResource - The resource URL being requested
407
- * @param options.configuredResource - The resource URL that has been configured
408
- * @returns true if the requested resource matches the configured resource, false otherwise
409
- */
410
- declare function checkResourceAllowed({
411
- requestedResource,
412
- configuredResource
413
- }: {
414
- requestedResource: URL | string;
415
- configuredResource: URL | string;
416
- }): boolean;
417
- //#endregion
418
- //#region ../core/src/types/constants.d.ts
419
- declare const LATEST_PROTOCOL_VERSION = "2025-11-25";
420
- declare const DEFAULT_NEGOTIATED_PROTOCOL_VERSION = "2025-03-26";
421
- declare const SUPPORTED_PROTOCOL_VERSIONS: string[];
422
- declare const RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
56
+ * When present, the value MUST follow the W3C Baggage header format,
57
+ * e.g. `userId=alice,serverRegion=us-east-1`.
58
+ *
59
+ * @see https://www.w3.org/TR/baggage/
60
+ */
61
+ declare const BAGGAGE_META_KEY = "baggage";
423
62
  declare const JSONRPC_VERSION = "2.0";
424
63
  declare const PARSE_ERROR = -32700;
425
64
  declare const INVALID_REQUEST = -32600;
426
65
  declare const METHOD_NOT_FOUND = -32601;
427
66
  declare const INVALID_PARAMS = -32602;
428
67
  declare const INTERNAL_ERROR = -32603;
429
- //#endregion
430
- //#region ../core/src/types/enums.d.ts
431
- /**
432
- * Error codes for protocol errors that cross the wire as JSON-RPC error responses.
433
- * These follow the JSON-RPC specification and MCP-specific extensions.
434
- */
435
- declare enum ProtocolErrorCode {
436
- ParseError = -32700,
437
- InvalidRequest = -32600,
438
- MethodNotFound = -32601,
439
- InvalidParams = -32602,
440
- InternalError = -32603,
441
- ResourceNotFound = -32002,
442
- UrlElicitationRequired = -32042,
68
+ declare namespace schemas_d_exports {
69
+ export { AnnotationsSchema, AudioContentSchema, BaseMetadataSchema, BaseRequestParamsSchema, BlobResourceContentsSchema, BooleanSchemaSchema, CallToolRequestParamsSchema, CallToolRequestSchema, CallToolResultSchema, CancelTaskRequestSchema, CancelTaskResultSchema, CancelledNotificationParamsSchema, CancelledNotificationSchema, ClientCapabilitiesSchema, ClientNotificationSchema, ClientRequestSchema, ClientResultSchema, ClientTasksCapabilitySchema, CompatibilityCallToolResultSchema, CompleteRequestParamsSchema, CompleteRequestSchema, CompleteResultSchema, ContentBlockSchema, CreateMessageRequestParamsSchema, CreateMessageRequestSchema, CreateMessageResultSchema, CreateMessageResultWithToolsSchema, CreateTaskResultSchema, CursorSchema, DiscoverRequestSchema, DiscoverResultSchema, ElicitRequestFormParamsSchema, ElicitRequestParamsSchema, ElicitRequestSchema, ElicitRequestURLParamsSchema, ElicitResultSchema, ElicitationCompleteNotificationParamsSchema, ElicitationCompleteNotificationSchema, EmbeddedResourceSchema, EmptyResultSchema, EnumSchemaSchema, GetPromptRequestParamsSchema, GetPromptRequestSchema, GetPromptResultSchema, GetTaskPayloadRequestSchema, GetTaskPayloadResultSchema, GetTaskRequestSchema, GetTaskResultSchema, IconSchema, IconsSchema, ImageContentSchema, ImplementationSchema, InitializeRequestParamsSchema, InitializeRequestSchema, InitializeResultSchema, InitializedNotificationSchema, JSONArraySchema, JSONObjectSchema, JSONRPCErrorResponseSchema, JSONRPCMessageSchema, JSONRPCNotificationSchema, JSONRPCRequestSchema, JSONRPCResponseSchema, JSONRPCResultResponseSchema, JSONValueSchema, LegacyTitledEnumSchemaSchema, ListChangedOptionsBaseSchema, ListPromptsRequestSchema, ListPromptsResultSchema, ListResourceTemplatesRequestSchema, ListResourceTemplatesResultSchema, ListResourcesRequestSchema, ListResourcesResultSchema, ListRootsRequestSchema, ListRootsResultSchema, ListTasksRequestSchema, ListTasksResultSchema, ListToolsRequestSchema, ListToolsResultSchema, LoggingLevelSchema, LoggingMessageNotificationParamsSchema, LoggingMessageNotificationSchema, ModelHintSchema, ModelPreferencesSchema, MultiSelectEnumSchemaSchema, NotificationSchema, NotificationsParamsSchema, NumberSchemaSchema, PaginatedRequestParamsSchema, PaginatedRequestSchema, PaginatedResultSchema, PingRequestSchema, PrimitiveSchemaDefinitionSchema, ProgressNotificationParamsSchema, ProgressNotificationSchema, ProgressSchema, ProgressTokenSchema, PromptArgumentSchema, PromptListChangedNotificationSchema, PromptMessageSchema, PromptReferenceSchema, PromptSchema, ReadResourceRequestParamsSchema, ReadResourceRequestSchema, ReadResourceResultSchema, RelatedTaskMetadataSchema, RequestIdSchema, RequestMetaEnvelopeSchema, RequestMetaSchema, RequestSchema, ResourceContentsSchema, ResourceLinkSchema, ResourceListChangedNotificationSchema, ResourceRequestParamsSchema, ResourceSchema, ResourceTemplateReferenceSchema, ResourceTemplateSchema, ResourceUpdatedNotificationParamsSchema, ResourceUpdatedNotificationSchema, ResultSchema, RoleSchema, RootSchema, RootsListChangedNotificationSchema, SamplingContentSchema, SamplingMessageContentBlockSchema, SamplingMessageSchema, ServerCapabilitiesSchema, ServerNotificationSchema, ServerRequestSchema, ServerResultSchema, ServerTasksCapabilitySchema, SetLevelRequestParamsSchema, SetLevelRequestSchema, SingleSelectEnumSchemaSchema, StringSchemaSchema, SubscribeRequestParamsSchema, SubscribeRequestSchema, TaskAugmentedRequestParamsSchema, TaskCreationParamsSchema, TaskMetadataSchema, TaskSchema, TaskStatusNotificationParamsSchema, TaskStatusNotificationSchema, TaskStatusSchema, TextContentSchema, TextResourceContentsSchema, TitledMultiSelectEnumSchemaSchema, TitledSingleSelectEnumSchemaSchema, ToolAnnotationsSchema, ToolChoiceSchema, ToolExecutionSchema, ToolListChangedNotificationSchema, ToolResultContentSchema, ToolSchema, ToolUseContentSchema, UnsubscribeRequestParamsSchema, UnsubscribeRequestSchema, UntitledMultiSelectEnumSchemaSchema, UntitledSingleSelectEnumSchemaSchema, getNotificationSchema, getRequestSchema, getResultSchema };
443
70
  }
444
- //#endregion
445
- //#region ../core/src/types/schemas.d.ts
71
+ declare const JSONValueSchema: z.ZodType<JSONValue, JSONValue>;
72
+ declare const JSONObjectSchema: z.ZodType<JSONObject, JSONObject>;
73
+ declare const JSONArraySchema: z.ZodType<JSONArray, JSONArray>;
446
74
  /**
447
75
  * A progress token, used to associate progress notifications with the original request.
448
76
  */
@@ -588,6 +216,13 @@ declare const ResultSchema: z.ZodObject<{
588
216
  taskId: z.ZodString;
589
217
  }, z.core.$strip>>;
590
218
  }, z.core.$loose>>;
219
+ /**
220
+ * Indicates the type of the result, allowing the receiver to determine how to
221
+ * parse the result object. Servers implementing protocol revision 2026-07-28 or
222
+ * later always include this field; results from earlier revisions omit it, and
223
+ * an absent value must be treated as `"complete"`.
224
+ */
225
+ resultType: z.ZodOptional<z.ZodString>;
591
226
  }, z.core.$loose>;
592
227
  /**
593
228
  * A uniquely identifying ID for a request in JSON-RPC.
@@ -659,6 +294,13 @@ declare const JSONRPCResultResponseSchema: z.ZodObject<{
659
294
  taskId: z.ZodString;
660
295
  }, z.core.$strip>>;
661
296
  }, z.core.$loose>>;
297
+ /**
298
+ * Indicates the type of the result, allowing the receiver to determine how to
299
+ * parse the result object. Servers implementing protocol revision 2026-07-28 or
300
+ * later always include this field; results from earlier revisions omit it, and
301
+ * an absent value must be treated as `"complete"`.
302
+ */
303
+ resultType: z.ZodOptional<z.ZodString>;
662
304
  }, z.core.$loose>;
663
305
  }, z.core.$strict>;
664
306
  /**
@@ -728,6 +370,13 @@ declare const JSONRPCMessageSchema: z.ZodUnion<readonly [z.ZodObject<{
728
370
  taskId: z.ZodString;
729
371
  }, z.core.$strip>>;
730
372
  }, z.core.$loose>>;
373
+ /**
374
+ * Indicates the type of the result, allowing the receiver to determine how to
375
+ * parse the result object. Servers implementing protocol revision 2026-07-28 or
376
+ * later always include this field; results from earlier revisions omit it, and
377
+ * an absent value must be treated as `"complete"`.
378
+ */
379
+ resultType: z.ZodOptional<z.ZodString>;
731
380
  }, z.core.$loose>;
732
381
  }, z.core.$strict>, z.ZodObject<{
733
382
  jsonrpc: z.ZodLiteral<"2.0">;
@@ -758,6 +407,13 @@ declare const JSONRPCResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
758
407
  taskId: z.ZodString;
759
408
  }, z.core.$strip>>;
760
409
  }, z.core.$loose>>;
410
+ /**
411
+ * Indicates the type of the result, allowing the receiver to determine how to
412
+ * parse the result object. Servers implementing protocol revision 2026-07-28 or
413
+ * later always include this field; results from earlier revisions omit it, and
414
+ * an absent value must be treated as `"complete"`.
415
+ */
416
+ resultType: z.ZodOptional<z.ZodString>;
761
417
  }, z.core.$loose>;
762
418
  }, z.core.$strict>, z.ZodObject<{
763
419
  jsonrpc: z.ZodLiteral<"2.0">;
@@ -788,6 +444,13 @@ declare const EmptyResultSchema: z.ZodObject<{
788
444
  taskId: z.ZodString;
789
445
  }, z.core.$strip>>;
790
446
  }, z.core.$loose>>;
447
+ /**
448
+ * Indicates the type of the result, allowing the receiver to determine how to
449
+ * parse the result object. Servers implementing protocol revision 2026-07-28 or
450
+ * later always include this field; results from earlier revisions omit it, and
451
+ * an absent value must be treated as `"complete"`.
452
+ */
453
+ resultType: z.ZodOptional<z.ZodString>;
791
454
  }, z.core.$strict>;
792
455
  declare const CancelledNotificationParamsSchema: z.ZodObject<{
793
456
  _meta: z.ZodOptional<z.ZodObject<{
@@ -886,21 +549,75 @@ declare const ImplementationSchema: z.ZodObject<{
886
549
  name: z.ZodString;
887
550
  title: z.ZodOptional<z.ZodString>;
888
551
  }, z.core.$strip>;
552
+ /**
553
+ * Task capabilities for clients, indicating which request types support task creation.
554
+ */
555
+ declare const ClientTasksCapabilitySchema: z.ZodObject<{
556
+ /**
557
+ * Present if the client supports listing tasks.
558
+ */
559
+ list: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
560
+ /**
561
+ * Present if the client supports cancelling tasks.
562
+ */
563
+ cancel: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
564
+ /**
565
+ * Capabilities for task creation on specific request types.
566
+ */
567
+ requests: z.ZodOptional<z.ZodObject<{
568
+ /**
569
+ * Task support for sampling requests.
570
+ */
571
+ sampling: z.ZodOptional<z.ZodObject<{
572
+ createMessage: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
573
+ }, z.core.$loose>>;
574
+ /**
575
+ * Task support for elicitation requests.
576
+ */
577
+ elicitation: z.ZodOptional<z.ZodObject<{
578
+ create: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
579
+ }, z.core.$loose>>;
580
+ }, z.core.$loose>>;
581
+ }, z.core.$loose>;
582
+ /**
583
+ * Task capabilities for servers, indicating which request types support task creation.
584
+ */
585
+ declare const ServerTasksCapabilitySchema: z.ZodObject<{
586
+ /**
587
+ * Present if the server supports listing tasks.
588
+ */
589
+ list: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
590
+ /**
591
+ * Present if the server supports cancelling tasks.
592
+ */
593
+ cancel: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
594
+ /**
595
+ * Capabilities for task creation on specific request types.
596
+ */
597
+ requests: z.ZodOptional<z.ZodObject<{
598
+ /**
599
+ * Task support for tool requests.
600
+ */
601
+ tools: z.ZodOptional<z.ZodObject<{
602
+ call: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
603
+ }, z.core.$loose>>;
604
+ }, z.core.$loose>>;
605
+ }, z.core.$loose>;
889
606
  /**
890
607
  * Capabilities a client may support. Known capabilities are defined here, in this schema, but this is not a closed set: any client can define its own, additional capabilities.
891
608
  */
892
609
  declare const ClientCapabilitiesSchema: z.ZodObject<{
893
- experimental: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>>;
610
+ experimental: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>>;
894
611
  sampling: z.ZodOptional<z.ZodObject<{
895
- context: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
896
- tools: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
612
+ context: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
613
+ tools: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
897
614
  }, z.core.$strip>>;
898
615
  elicitation: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodIntersection<z.ZodObject<{
899
616
  form: z.ZodOptional<z.ZodIntersection<z.ZodObject<{
900
617
  applyDefaults: z.ZodOptional<z.ZodBoolean>;
901
- }, z.core.$strip>, z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>>;
902
- url: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
903
- }, z.core.$strip>, z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>>>>;
618
+ }, z.core.$strip>, z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>>;
619
+ url: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
620
+ }, z.core.$strip>, z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>>>>;
904
621
  roots: z.ZodOptional<z.ZodObject<{
905
622
  listChanged: z.ZodOptional<z.ZodBoolean>;
906
623
  }, z.core.$strip>>;
@@ -908,11 +625,11 @@ declare const ClientCapabilitiesSchema: z.ZodObject<{
908
625
  /**
909
626
  * Present if the client supports listing tasks.
910
627
  */
911
- list: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
628
+ list: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
912
629
  /**
913
630
  * Present if the client supports cancelling tasks.
914
631
  */
915
- cancel: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
632
+ cancel: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
916
633
  /**
917
634
  * Capabilities for task creation on specific request types.
918
635
  */
@@ -921,17 +638,17 @@ declare const ClientCapabilitiesSchema: z.ZodObject<{
921
638
  * Task support for sampling requests.
922
639
  */
923
640
  sampling: z.ZodOptional<z.ZodObject<{
924
- createMessage: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
641
+ createMessage: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
925
642
  }, z.core.$loose>>;
926
643
  /**
927
644
  * Task support for elicitation requests.
928
645
  */
929
646
  elicitation: z.ZodOptional<z.ZodObject<{
930
- create: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
647
+ create: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
931
648
  }, z.core.$loose>>;
932
649
  }, z.core.$loose>>;
933
650
  }, z.core.$loose>>;
934
- extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>>;
651
+ extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>>;
935
652
  }, z.core.$strip>;
936
653
  declare const InitializeRequestParamsSchema: z.ZodObject<{
937
654
  _meta: z.ZodOptional<z.ZodObject<{
@@ -948,17 +665,17 @@ declare const InitializeRequestParamsSchema: z.ZodObject<{
948
665
  }, z.core.$loose>>;
949
666
  protocolVersion: z.ZodString;
950
667
  capabilities: z.ZodObject<{
951
- experimental: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>>;
668
+ experimental: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>>;
952
669
  sampling: z.ZodOptional<z.ZodObject<{
953
- context: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
954
- tools: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
670
+ context: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
671
+ tools: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
955
672
  }, z.core.$strip>>;
956
673
  elicitation: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodIntersection<z.ZodObject<{
957
674
  form: z.ZodOptional<z.ZodIntersection<z.ZodObject<{
958
675
  applyDefaults: z.ZodOptional<z.ZodBoolean>;
959
- }, z.core.$strip>, z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>>;
960
- url: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
961
- }, z.core.$strip>, z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>>>>;
676
+ }, z.core.$strip>, z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>>;
677
+ url: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
678
+ }, z.core.$strip>, z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>>>>;
962
679
  roots: z.ZodOptional<z.ZodObject<{
963
680
  listChanged: z.ZodOptional<z.ZodBoolean>;
964
681
  }, z.core.$strip>>;
@@ -966,11 +683,11 @@ declare const InitializeRequestParamsSchema: z.ZodObject<{
966
683
  /**
967
684
  * Present if the client supports listing tasks.
968
685
  */
969
- list: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
686
+ list: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
970
687
  /**
971
688
  * Present if the client supports cancelling tasks.
972
689
  */
973
- cancel: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
690
+ cancel: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
974
691
  /**
975
692
  * Capabilities for task creation on specific request types.
976
693
  */
@@ -979,17 +696,17 @@ declare const InitializeRequestParamsSchema: z.ZodObject<{
979
696
  * Task support for sampling requests.
980
697
  */
981
698
  sampling: z.ZodOptional<z.ZodObject<{
982
- createMessage: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
699
+ createMessage: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
983
700
  }, z.core.$loose>>;
984
701
  /**
985
702
  * Task support for elicitation requests.
986
703
  */
987
704
  elicitation: z.ZodOptional<z.ZodObject<{
988
- create: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
705
+ create: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
989
706
  }, z.core.$loose>>;
990
707
  }, z.core.$loose>>;
991
708
  }, z.core.$loose>>;
992
- extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>>;
709
+ extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>>;
993
710
  }, z.core.$strip>;
994
711
  clientInfo: z.ZodObject<{
995
712
  version: z.ZodString;
@@ -1028,17 +745,17 @@ declare const InitializeRequestSchema: z.ZodObject<{
1028
745
  }, z.core.$loose>>;
1029
746
  protocolVersion: z.ZodString;
1030
747
  capabilities: z.ZodObject<{
1031
- experimental: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>>;
748
+ experimental: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>>;
1032
749
  sampling: z.ZodOptional<z.ZodObject<{
1033
- context: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
1034
- tools: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
750
+ context: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
751
+ tools: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
1035
752
  }, z.core.$strip>>;
1036
753
  elicitation: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodIntersection<z.ZodObject<{
1037
754
  form: z.ZodOptional<z.ZodIntersection<z.ZodObject<{
1038
755
  applyDefaults: z.ZodOptional<z.ZodBoolean>;
1039
- }, z.core.$strip>, z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>>;
1040
- url: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
1041
- }, z.core.$strip>, z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>>>>;
756
+ }, z.core.$strip>, z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>>;
757
+ url: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
758
+ }, z.core.$strip>, z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>>>>;
1042
759
  roots: z.ZodOptional<z.ZodObject<{
1043
760
  listChanged: z.ZodOptional<z.ZodBoolean>;
1044
761
  }, z.core.$strip>>;
@@ -1046,11 +763,11 @@ declare const InitializeRequestSchema: z.ZodObject<{
1046
763
  /**
1047
764
  * Present if the client supports listing tasks.
1048
765
  */
1049
- list: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
766
+ list: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
1050
767
  /**
1051
768
  * Present if the client supports cancelling tasks.
1052
769
  */
1053
- cancel: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
770
+ cancel: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
1054
771
  /**
1055
772
  * Capabilities for task creation on specific request types.
1056
773
  */
@@ -1059,17 +776,17 @@ declare const InitializeRequestSchema: z.ZodObject<{
1059
776
  * Task support for sampling requests.
1060
777
  */
1061
778
  sampling: z.ZodOptional<z.ZodObject<{
1062
- createMessage: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
779
+ createMessage: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
1063
780
  }, z.core.$loose>>;
1064
781
  /**
1065
782
  * Task support for elicitation requests.
1066
783
  */
1067
784
  elicitation: z.ZodOptional<z.ZodObject<{
1068
- create: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
785
+ create: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
1069
786
  }, z.core.$loose>>;
1070
787
  }, z.core.$loose>>;
1071
788
  }, z.core.$loose>>;
1072
- extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>>;
789
+ extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>>;
1073
790
  }, z.core.$strip>;
1074
791
  clientInfo: z.ZodObject<{
1075
792
  version: z.ZodString;
@@ -1093,9 +810,9 @@ declare const InitializeRequestSchema: z.ZodObject<{
1093
810
  * Capabilities that a server may support. Known capabilities are defined here, in this schema, but this is not a closed set: any server can define its own, additional capabilities.
1094
811
  */
1095
812
  declare const ServerCapabilitiesSchema: z.ZodObject<{
1096
- experimental: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>>;
1097
- logging: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
1098
- completions: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
813
+ experimental: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>>;
814
+ logging: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
815
+ completions: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
1099
816
  prompts: z.ZodOptional<z.ZodObject<{
1100
817
  listChanged: z.ZodOptional<z.ZodBoolean>;
1101
818
  }, z.core.$strip>>;
@@ -1110,11 +827,11 @@ declare const ServerCapabilitiesSchema: z.ZodObject<{
1110
827
  /**
1111
828
  * Present if the server supports listing tasks.
1112
829
  */
1113
- list: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
830
+ list: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
1114
831
  /**
1115
832
  * Present if the server supports cancelling tasks.
1116
833
  */
1117
- cancel: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
834
+ cancel: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
1118
835
  /**
1119
836
  * Capabilities for task creation on specific request types.
1120
837
  */
@@ -1123,11 +840,11 @@ declare const ServerCapabilitiesSchema: z.ZodObject<{
1123
840
  * Task support for tool requests.
1124
841
  */
1125
842
  tools: z.ZodOptional<z.ZodObject<{
1126
- call: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
843
+ call: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
1127
844
  }, z.core.$loose>>;
1128
845
  }, z.core.$loose>>;
1129
846
  }, z.core.$loose>>;
1130
- extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>>;
847
+ extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>>;
1131
848
  }, z.core.$strip>;
1132
849
  /**
1133
850
  * After receiving an initialize request from the client, the server sends this response.
@@ -1145,11 +862,12 @@ declare const InitializeResultSchema: z.ZodObject<{
1145
862
  taskId: z.ZodString;
1146
863
  }, z.core.$strip>>;
1147
864
  }, z.core.$loose>>;
865
+ resultType: z.ZodOptional<z.ZodString>;
1148
866
  protocolVersion: z.ZodString;
1149
867
  capabilities: z.ZodObject<{
1150
- experimental: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>>;
1151
- logging: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
1152
- completions: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
868
+ experimental: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>>;
869
+ logging: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
870
+ completions: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
1153
871
  prompts: z.ZodOptional<z.ZodObject<{
1154
872
  listChanged: z.ZodOptional<z.ZodBoolean>;
1155
873
  }, z.core.$strip>>;
@@ -1164,11 +882,11 @@ declare const InitializeResultSchema: z.ZodObject<{
1164
882
  /**
1165
883
  * Present if the server supports listing tasks.
1166
884
  */
1167
- list: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
885
+ list: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
1168
886
  /**
1169
887
  * Present if the server supports cancelling tasks.
1170
888
  */
1171
- cancel: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
889
+ cancel: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
1172
890
  /**
1173
891
  * Capabilities for task creation on specific request types.
1174
892
  */
@@ -1177,11 +895,11 @@ declare const InitializeResultSchema: z.ZodObject<{
1177
895
  * Task support for tool requests.
1178
896
  */
1179
897
  tools: z.ZodOptional<z.ZodObject<{
1180
- call: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
898
+ call: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
1181
899
  }, z.core.$loose>>;
1182
900
  }, z.core.$loose>>;
1183
901
  }, z.core.$loose>>;
1184
- extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>>;
902
+ extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>>;
1185
903
  }, z.core.$strip>;
1186
904
  serverInfo: z.ZodObject<{
1187
905
  version: z.ZodString;
@@ -1221,6 +939,102 @@ declare const InitializedNotificationSchema: z.ZodObject<{
1221
939
  }, z.core.$loose>>;
1222
940
  }, z.core.$strip>>;
1223
941
  }, z.core.$strip>;
942
+ /**
943
+ * A request from the client asking the server to advertise its supported protocol
944
+ * versions, capabilities, and other metadata (protocol revision 2026-07-28). Servers
945
+ * MUST implement `server/discover`. Clients MAY call it but are not required to —
946
+ * version negotiation can also happen inline via the per-request `_meta` envelope.
947
+ */
948
+ declare const DiscoverRequestSchema: z.ZodObject<{
949
+ method: z.ZodLiteral<"server/discover">;
950
+ params: z.ZodOptional<z.ZodObject<{
951
+ _meta: z.ZodOptional<z.ZodObject<{
952
+ /**
953
+ * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
954
+ */
955
+ progressToken: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
956
+ /**
957
+ * If specified, this request is related to the provided task.
958
+ */
959
+ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{
960
+ taskId: z.ZodString;
961
+ }, z.core.$strip>>;
962
+ }, z.core.$loose>>;
963
+ }, z.core.$strip>>;
964
+ }, z.core.$strip>;
965
+ /**
966
+ * The result returned by the server for a `server/discover` request.
967
+ */
968
+ declare const DiscoverResultSchema: z.ZodObject<{
969
+ _meta: z.ZodOptional<z.ZodObject<{
970
+ /**
971
+ * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
972
+ */
973
+ progressToken: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
974
+ /**
975
+ * If specified, this request is related to the provided task.
976
+ */
977
+ "io.modelcontextprotocol/related-task": z.ZodOptional<z.ZodObject<{
978
+ taskId: z.ZodString;
979
+ }, z.core.$strip>>;
980
+ }, z.core.$loose>>;
981
+ resultType: z.ZodOptional<z.ZodString>;
982
+ supportedVersions: z.ZodArray<z.ZodString>;
983
+ capabilities: z.ZodObject<{
984
+ experimental: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>>;
985
+ logging: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
986
+ completions: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
987
+ prompts: z.ZodOptional<z.ZodObject<{
988
+ listChanged: z.ZodOptional<z.ZodBoolean>;
989
+ }, z.core.$strip>>;
990
+ resources: z.ZodOptional<z.ZodObject<{
991
+ subscribe: z.ZodOptional<z.ZodBoolean>;
992
+ listChanged: z.ZodOptional<z.ZodBoolean>;
993
+ }, z.core.$strip>>;
994
+ tools: z.ZodOptional<z.ZodObject<{
995
+ listChanged: z.ZodOptional<z.ZodBoolean>;
996
+ }, z.core.$strip>>;
997
+ tasks: z.ZodOptional<z.ZodObject<{
998
+ /**
999
+ * Present if the server supports listing tasks.
1000
+ */
1001
+ list: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
1002
+ /**
1003
+ * Present if the server supports cancelling tasks.
1004
+ */
1005
+ cancel: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
1006
+ /**
1007
+ * Capabilities for task creation on specific request types.
1008
+ */
1009
+ requests: z.ZodOptional<z.ZodObject<{
1010
+ /**
1011
+ * Task support for tool requests.
1012
+ */
1013
+ tools: z.ZodOptional<z.ZodObject<{
1014
+ call: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
1015
+ }, z.core.$loose>>;
1016
+ }, z.core.$loose>>;
1017
+ }, z.core.$loose>>;
1018
+ extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>>;
1019
+ }, z.core.$strip>;
1020
+ serverInfo: z.ZodObject<{
1021
+ version: z.ZodString;
1022
+ websiteUrl: z.ZodOptional<z.ZodString>;
1023
+ description: z.ZodOptional<z.ZodString>;
1024
+ icons: z.ZodOptional<z.ZodArray<z.ZodObject<{
1025
+ src: z.ZodString;
1026
+ mimeType: z.ZodOptional<z.ZodString>;
1027
+ sizes: z.ZodOptional<z.ZodArray<z.ZodString>>;
1028
+ theme: z.ZodOptional<z.ZodEnum<{
1029
+ light: "light";
1030
+ dark: "dark";
1031
+ }>>;
1032
+ }, z.core.$strip>>>;
1033
+ name: z.ZodString;
1034
+ title: z.ZodOptional<z.ZodString>;
1035
+ }, z.core.$strip>;
1036
+ instructions: z.ZodOptional<z.ZodString>;
1037
+ }, z.core.$loose>;
1224
1038
  /**
1225
1039
  * A ping, issued by either the server or the client, to check that the other party is still alive. The receiver must promptly respond, or else may be disconnected.
1226
1040
  */
@@ -1336,6 +1150,7 @@ declare const PaginatedResultSchema: z.ZodObject<{
1336
1150
  taskId: z.ZodString;
1337
1151
  }, z.core.$strip>>;
1338
1152
  }, z.core.$loose>>;
1153
+ resultType: z.ZodOptional<z.ZodString>;
1339
1154
  nextCursor: z.ZodOptional<z.ZodString>;
1340
1155
  }, z.core.$loose>;
1341
1156
  /**
@@ -1382,6 +1197,7 @@ declare const CreateTaskResultSchema: z.ZodObject<{
1382
1197
  taskId: z.ZodString;
1383
1198
  }, z.core.$strip>>;
1384
1199
  }, z.core.$loose>>;
1200
+ resultType: z.ZodOptional<z.ZodString>;
1385
1201
  task: z.ZodObject<{
1386
1202
  taskId: z.ZodString;
1387
1203
  status: z.ZodEnum<{
@@ -1498,6 +1314,7 @@ declare const GetTaskResultSchema: z.ZodObject<{
1498
1314
  taskId: z.ZodString;
1499
1315
  }, z.core.$strip>>;
1500
1316
  }, z.core.$loose>>;
1317
+ resultType: z.ZodOptional<z.ZodString>;
1501
1318
  taskId: z.ZodString;
1502
1319
  status: z.ZodEnum<{
1503
1320
  working: "working";
@@ -1556,6 +1373,13 @@ declare const GetTaskPayloadResultSchema: z.ZodObject<{
1556
1373
  taskId: z.ZodString;
1557
1374
  }, z.core.$strip>>;
1558
1375
  }, z.core.$loose>>;
1376
+ /**
1377
+ * Indicates the type of the result, allowing the receiver to determine how to
1378
+ * parse the result object. Servers implementing protocol revision 2026-07-28 or
1379
+ * later always include this field; results from earlier revisions omit it, and
1380
+ * an absent value must be treated as `"complete"`.
1381
+ */
1382
+ resultType: z.ZodOptional<z.ZodString>;
1559
1383
  }, z.core.$loose>;
1560
1384
  /**
1561
1385
  * A request to list tasks.
@@ -1594,6 +1418,7 @@ declare const ListTasksResultSchema: z.ZodObject<{
1594
1418
  taskId: z.ZodString;
1595
1419
  }, z.core.$strip>>;
1596
1420
  }, z.core.$loose>>;
1421
+ resultType: z.ZodOptional<z.ZodString>;
1597
1422
  nextCursor: z.ZodOptional<z.ZodString>;
1598
1423
  tasks: z.ZodArray<z.ZodObject<{
1599
1424
  taskId: z.ZodString;
@@ -1648,6 +1473,7 @@ declare const CancelTaskResultSchema: z.ZodObject<{
1648
1473
  taskId: z.ZodString;
1649
1474
  }, z.core.$strip>>;
1650
1475
  }, z.core.$loose>>;
1476
+ resultType: z.ZodOptional<z.ZodString>;
1651
1477
  taskId: z.ZodString;
1652
1478
  status: z.ZodEnum<{
1653
1479
  working: "working";
@@ -1794,6 +1620,7 @@ declare const ListResourcesResultSchema: z.ZodObject<{
1794
1620
  taskId: z.ZodString;
1795
1621
  }, z.core.$strip>>;
1796
1622
  }, z.core.$loose>>;
1623
+ resultType: z.ZodOptional<z.ZodString>;
1797
1624
  nextCursor: z.ZodOptional<z.ZodString>;
1798
1625
  resources: z.ZodArray<z.ZodObject<{
1799
1626
  uri: z.ZodString;
@@ -1859,6 +1686,7 @@ declare const ListResourceTemplatesResultSchema: z.ZodObject<{
1859
1686
  taskId: z.ZodString;
1860
1687
  }, z.core.$strip>>;
1861
1688
  }, z.core.$loose>>;
1689
+ resultType: z.ZodOptional<z.ZodString>;
1862
1690
  nextCursor: z.ZodOptional<z.ZodString>;
1863
1691
  resourceTemplates: z.ZodArray<z.ZodObject<{
1864
1692
  uriTemplate: z.ZodString;
@@ -1956,6 +1784,7 @@ declare const ReadResourceResultSchema: z.ZodObject<{
1956
1784
  taskId: z.ZodString;
1957
1785
  }, z.core.$strip>>;
1958
1786
  }, z.core.$loose>>;
1787
+ resultType: z.ZodOptional<z.ZodString>;
1959
1788
  contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
1960
1789
  uri: z.ZodString;
1961
1790
  mimeType: z.ZodOptional<z.ZodString>;
@@ -2167,6 +1996,7 @@ declare const ListPromptsResultSchema: z.ZodObject<{
2167
1996
  taskId: z.ZodString;
2168
1997
  }, z.core.$strip>>;
2169
1998
  }, z.core.$loose>>;
1999
+ resultType: z.ZodOptional<z.ZodString>;
2170
2000
  nextCursor: z.ZodOptional<z.ZodString>;
2171
2001
  prompts: z.ZodArray<z.ZodObject<{
2172
2002
  description: z.ZodOptional<z.ZodString>;
@@ -2551,6 +2381,7 @@ declare const GetPromptResultSchema: z.ZodObject<{
2551
2381
  taskId: z.ZodString;
2552
2382
  }, z.core.$strip>>;
2553
2383
  }, z.core.$loose>>;
2384
+ resultType: z.ZodOptional<z.ZodString>;
2554
2385
  description: z.ZodOptional<z.ZodString>;
2555
2386
  messages: z.ZodArray<z.ZodObject<{
2556
2387
  role: z.ZodEnum<{
@@ -2700,12 +2531,12 @@ declare const ToolSchema: z.ZodObject<{
2700
2531
  description: z.ZodOptional<z.ZodString>;
2701
2532
  inputSchema: z.ZodObject<{
2702
2533
  type: z.ZodLiteral<"object">;
2703
- properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>;
2534
+ properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONValue, JSONValue, z.core.$ZodTypeInternals<JSONValue, JSONValue>>>>;
2704
2535
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
2705
2536
  }, z.core.$catchall<z.ZodUnknown>>;
2706
2537
  outputSchema: z.ZodOptional<z.ZodObject<{
2707
2538
  type: z.ZodLiteral<"object">;
2708
- properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>;
2539
+ properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONValue, JSONValue, z.core.$ZodTypeInternals<JSONValue, JSONValue>>>>;
2709
2540
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
2710
2541
  }, z.core.$catchall<z.ZodUnknown>>>;
2711
2542
  annotations: z.ZodOptional<z.ZodObject<{
@@ -2772,17 +2603,18 @@ declare const ListToolsResultSchema: z.ZodObject<{
2772
2603
  taskId: z.ZodString;
2773
2604
  }, z.core.$strip>>;
2774
2605
  }, z.core.$loose>>;
2606
+ resultType: z.ZodOptional<z.ZodString>;
2775
2607
  nextCursor: z.ZodOptional<z.ZodString>;
2776
2608
  tools: z.ZodArray<z.ZodObject<{
2777
2609
  description: z.ZodOptional<z.ZodString>;
2778
2610
  inputSchema: z.ZodObject<{
2779
2611
  type: z.ZodLiteral<"object">;
2780
- properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>;
2612
+ properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONValue, JSONValue, z.core.$ZodTypeInternals<JSONValue, JSONValue>>>>;
2781
2613
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
2782
2614
  }, z.core.$catchall<z.ZodUnknown>>;
2783
2615
  outputSchema: z.ZodOptional<z.ZodObject<{
2784
2616
  type: z.ZodLiteral<"object">;
2785
- properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>;
2617
+ properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONValue, JSONValue, z.core.$ZodTypeInternals<JSONValue, JSONValue>>>>;
2786
2618
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
2787
2619
  }, z.core.$catchall<z.ZodUnknown>>>;
2788
2620
  annotations: z.ZodOptional<z.ZodObject<{
@@ -2829,6 +2661,7 @@ declare const CallToolResultSchema: z.ZodObject<{
2829
2661
  taskId: z.ZodString;
2830
2662
  }, z.core.$strip>>;
2831
2663
  }, z.core.$loose>>;
2664
+ resultType: z.ZodOptional<z.ZodString>;
2832
2665
  content: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
2833
2666
  type: z.ZodLiteral<"text">;
2834
2667
  text: z.ZodString;
@@ -2935,6 +2768,7 @@ declare const CompatibilityCallToolResultSchema: z.ZodUnion<[z.ZodObject<{
2935
2768
  taskId: z.ZodString;
2936
2769
  }, z.core.$strip>>;
2937
2770
  }, z.core.$loose>>;
2771
+ resultType: z.ZodOptional<z.ZodString>;
2938
2772
  content: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
2939
2773
  type: z.ZodLiteral<"text">;
2940
2774
  text: z.ZodString;
@@ -3037,6 +2871,7 @@ declare const CompatibilityCallToolResultSchema: z.ZodUnion<[z.ZodObject<{
3037
2871
  taskId: z.ZodString;
3038
2872
  }, z.core.$strip>>;
3039
2873
  }, z.core.$loose>>;
2874
+ resultType: z.ZodOptional<z.ZodString>;
3040
2875
  toolResult: z.ZodUnknown;
3041
2876
  }, z.core.$loose>]>;
3042
2877
  /**
@@ -3106,6 +2941,14 @@ declare const ToolListChangedNotificationSchema: z.ZodObject<{
3106
2941
  }, z.core.$loose>>;
3107
2942
  }, z.core.$strip>>;
3108
2943
  }, z.core.$strip>;
2944
+ /**
2945
+ * Base schema for list changed subscription options (without callback).
2946
+ * Used internally for Zod validation of `autoRefresh` and `debounceMs`.
2947
+ */
2948
+ declare const ListChangedOptionsBaseSchema: z.ZodObject<{
2949
+ autoRefresh: z.ZodDefault<z.ZodBoolean>;
2950
+ debounceMs: z.ZodDefault<z.ZodNumber>;
2951
+ }, z.core.$strip>;
3109
2952
  /**
3110
2953
  * The severity of a log message.
3111
2954
  */
@@ -3238,48 +3081,155 @@ declare const LoggingMessageNotificationSchema: z.ZodObject<{
3238
3081
  }, z.core.$strip>;
3239
3082
  }, z.core.$strip>;
3240
3083
  /**
3241
- * Hints to use for model selection.
3242
- */
3243
- declare const ModelHintSchema: z.ZodObject<{
3244
- name: z.ZodOptional<z.ZodString>;
3245
- }, z.core.$strip>;
3246
- /**
3247
- * The server's preferences for model selection, requested of the client during sampling.
3248
- */
3249
- declare const ModelPreferencesSchema: z.ZodObject<{
3250
- hints: z.ZodOptional<z.ZodArray<z.ZodObject<{
3251
- name: z.ZodOptional<z.ZodString>;
3252
- }, z.core.$strip>>>;
3253
- costPriority: z.ZodOptional<z.ZodNumber>;
3254
- speedPriority: z.ZodOptional<z.ZodNumber>;
3255
- intelligencePriority: z.ZodOptional<z.ZodNumber>;
3256
- }, z.core.$strip>;
3257
- /**
3258
- * Controls tool usage behavior in sampling requests.
3259
- */
3260
- declare const ToolChoiceSchema: z.ZodObject<{
3261
- mode: z.ZodOptional<z.ZodEnum<{
3262
- required: "required";
3263
- auto: "auto";
3264
- none: "none";
3265
- }>>;
3266
- }, z.core.$strip>;
3267
- /**
3268
- * The result of a tool execution, provided by the user (server).
3269
- * Represents the outcome of invoking a tool requested via `ToolUseContent`.
3084
+ * The per-request `_meta` envelope carried by every request under protocol revision
3085
+ * 2026-07-28: the protocol version governing the request, the client implementation
3086
+ * info, and the client's capabilities — declared per request rather than once at
3087
+ * initialization — plus the optional log-level opt-in.
3088
+ *
3089
+ * This schema models the complete envelope on its own. The base request schemas
3090
+ * ({@linkcode RequestMetaSchema}) deliberately stay lenient so the same wire schemas
3091
+ * parse requests from earlier protocol revisions (no envelope) as well; envelope
3092
+ * requiredness is enforced per request at dispatch time, not here.
3270
3093
  */
3271
- declare const ToolResultContentSchema: z.ZodObject<{
3272
- type: z.ZodLiteral<"tool_result">;
3273
- toolUseId: z.ZodString;
3274
- content: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
3275
- type: z.ZodLiteral<"text">;
3276
- text: z.ZodString;
3277
- annotations: z.ZodOptional<z.ZodObject<{
3278
- audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
3279
- user: "user";
3280
- assistant: "assistant";
3281
- }>>>;
3282
- priority: z.ZodOptional<z.ZodNumber>;
3094
+ declare const RequestMetaEnvelopeSchema: z.ZodObject<{
3095
+ /**
3096
+ * If specified, the caller is requesting out-of-band progress notifications for this request (as represented by notifications/progress). The value of this parameter is an opaque token that will be attached to any subsequent notifications. The receiver is not obligated to provide these notifications.
3097
+ */
3098
+ progressToken: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
3099
+ /**
3100
+ * The MCP protocol version being used for this request. For the HTTP transport,
3101
+ * the value must match the `MCP-Protocol-Version` header.
3102
+ */
3103
+ "io.modelcontextprotocol/protocolVersion": z.ZodString;
3104
+ /**
3105
+ * Identifies the client software making the request.
3106
+ */
3107
+ "io.modelcontextprotocol/clientInfo": z.ZodObject<{
3108
+ version: z.ZodString;
3109
+ websiteUrl: z.ZodOptional<z.ZodString>;
3110
+ description: z.ZodOptional<z.ZodString>;
3111
+ icons: z.ZodOptional<z.ZodArray<z.ZodObject<{
3112
+ src: z.ZodString;
3113
+ mimeType: z.ZodOptional<z.ZodString>;
3114
+ sizes: z.ZodOptional<z.ZodArray<z.ZodString>>;
3115
+ theme: z.ZodOptional<z.ZodEnum<{
3116
+ light: "light";
3117
+ dark: "dark";
3118
+ }>>;
3119
+ }, z.core.$strip>>>;
3120
+ name: z.ZodString;
3121
+ title: z.ZodOptional<z.ZodString>;
3122
+ }, z.core.$strip>;
3123
+ /**
3124
+ * The client's capabilities for this specific request. An empty object means the
3125
+ * client supports no optional capabilities. Servers must not infer capabilities
3126
+ * from prior requests.
3127
+ */
3128
+ "io.modelcontextprotocol/clientCapabilities": z.ZodObject<{
3129
+ experimental: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>>;
3130
+ sampling: z.ZodOptional<z.ZodObject<{
3131
+ context: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
3132
+ tools: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
3133
+ }, z.core.$strip>>;
3134
+ elicitation: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodIntersection<z.ZodObject<{
3135
+ form: z.ZodOptional<z.ZodIntersection<z.ZodObject<{
3136
+ applyDefaults: z.ZodOptional<z.ZodBoolean>;
3137
+ }, z.core.$strip>, z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>>;
3138
+ url: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
3139
+ }, z.core.$strip>, z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>>>>;
3140
+ roots: z.ZodOptional<z.ZodObject<{
3141
+ listChanged: z.ZodOptional<z.ZodBoolean>;
3142
+ }, z.core.$strip>>;
3143
+ tasks: z.ZodOptional<z.ZodObject<{
3144
+ /**
3145
+ * Present if the client supports listing tasks.
3146
+ */
3147
+ list: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
3148
+ /**
3149
+ * Present if the client supports cancelling tasks.
3150
+ */
3151
+ cancel: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
3152
+ /**
3153
+ * Capabilities for task creation on specific request types.
3154
+ */
3155
+ requests: z.ZodOptional<z.ZodObject<{
3156
+ /**
3157
+ * Task support for sampling requests.
3158
+ */
3159
+ sampling: z.ZodOptional<z.ZodObject<{
3160
+ createMessage: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
3161
+ }, z.core.$loose>>;
3162
+ /**
3163
+ * Task support for elicitation requests.
3164
+ */
3165
+ elicitation: z.ZodOptional<z.ZodObject<{
3166
+ create: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
3167
+ }, z.core.$loose>>;
3168
+ }, z.core.$loose>>;
3169
+ }, z.core.$loose>>;
3170
+ extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>>;
3171
+ }, z.core.$strip>;
3172
+ /**
3173
+ * The desired log level for this request. When absent, the server must not send
3174
+ * `notifications/message` notifications for the request.
3175
+ *
3176
+ * @deprecated Deprecated as of protocol version 2026-07-28 (SEP-2577); remains
3177
+ * in the specification for at least twelve months.
3178
+ */
3179
+ "io.modelcontextprotocol/logLevel": z.ZodOptional<z.ZodEnum<{
3180
+ error: "error";
3181
+ debug: "debug";
3182
+ info: "info";
3183
+ notice: "notice";
3184
+ warning: "warning";
3185
+ critical: "critical";
3186
+ alert: "alert";
3187
+ emergency: "emergency";
3188
+ }>>;
3189
+ }, z.core.$loose>;
3190
+ /**
3191
+ * Hints to use for model selection.
3192
+ */
3193
+ declare const ModelHintSchema: z.ZodObject<{
3194
+ name: z.ZodOptional<z.ZodString>;
3195
+ }, z.core.$strip>;
3196
+ /**
3197
+ * The server's preferences for model selection, requested of the client during sampling.
3198
+ */
3199
+ declare const ModelPreferencesSchema: z.ZodObject<{
3200
+ hints: z.ZodOptional<z.ZodArray<z.ZodObject<{
3201
+ name: z.ZodOptional<z.ZodString>;
3202
+ }, z.core.$strip>>>;
3203
+ costPriority: z.ZodOptional<z.ZodNumber>;
3204
+ speedPriority: z.ZodOptional<z.ZodNumber>;
3205
+ intelligencePriority: z.ZodOptional<z.ZodNumber>;
3206
+ }, z.core.$strip>;
3207
+ /**
3208
+ * Controls tool usage behavior in sampling requests.
3209
+ */
3210
+ declare const ToolChoiceSchema: z.ZodObject<{
3211
+ mode: z.ZodOptional<z.ZodEnum<{
3212
+ required: "required";
3213
+ auto: "auto";
3214
+ none: "none";
3215
+ }>>;
3216
+ }, z.core.$strip>;
3217
+ /**
3218
+ * The result of a tool execution, provided by the user (server).
3219
+ * Represents the outcome of invoking a tool requested via `ToolUseContent`.
3220
+ */
3221
+ declare const ToolResultContentSchema: z.ZodObject<{
3222
+ type: z.ZodLiteral<"tool_result">;
3223
+ toolUseId: z.ZodString;
3224
+ content: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
3225
+ type: z.ZodLiteral<"text">;
3226
+ text: z.ZodString;
3227
+ annotations: z.ZodOptional<z.ZodObject<{
3228
+ audience: z.ZodOptional<z.ZodArray<z.ZodEnum<{
3229
+ user: "user";
3230
+ assistant: "assistant";
3231
+ }>>>;
3232
+ priority: z.ZodOptional<z.ZodNumber>;
3283
3233
  lastModified: z.ZodOptional<z.ZodISODateTime>;
3284
3234
  }, z.core.$strip>>;
3285
3235
  _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
@@ -4150,17 +4100,17 @@ declare const CreateMessageRequestParamsSchema: z.ZodObject<{
4150
4100
  temperature: z.ZodOptional<z.ZodNumber>;
4151
4101
  maxTokens: z.ZodNumber;
4152
4102
  stopSequences: z.ZodOptional<z.ZodArray<z.ZodString>>;
4153
- metadata: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
4103
+ metadata: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
4154
4104
  tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
4155
4105
  description: z.ZodOptional<z.ZodString>;
4156
4106
  inputSchema: z.ZodObject<{
4157
4107
  type: z.ZodLiteral<"object">;
4158
- properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>;
4108
+ properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONValue, JSONValue, z.core.$ZodTypeInternals<JSONValue, JSONValue>>>>;
4159
4109
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
4160
4110
  }, z.core.$catchall<z.ZodUnknown>>;
4161
4111
  outputSchema: z.ZodOptional<z.ZodObject<{
4162
4112
  type: z.ZodLiteral<"object">;
4163
- properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>;
4113
+ properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONValue, JSONValue, z.core.$ZodTypeInternals<JSONValue, JSONValue>>>>;
4164
4114
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
4165
4115
  }, z.core.$catchall<z.ZodUnknown>>>;
4166
4116
  annotations: z.ZodOptional<z.ZodObject<{
@@ -4518,17 +4468,17 @@ declare const CreateMessageRequestSchema: z.ZodObject<{
4518
4468
  temperature: z.ZodOptional<z.ZodNumber>;
4519
4469
  maxTokens: z.ZodNumber;
4520
4470
  stopSequences: z.ZodOptional<z.ZodArray<z.ZodString>>;
4521
- metadata: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
4471
+ metadata: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
4522
4472
  tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
4523
4473
  description: z.ZodOptional<z.ZodString>;
4524
4474
  inputSchema: z.ZodObject<{
4525
4475
  type: z.ZodLiteral<"object">;
4526
- properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>;
4476
+ properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONValue, JSONValue, z.core.$ZodTypeInternals<JSONValue, JSONValue>>>>;
4527
4477
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
4528
4478
  }, z.core.$catchall<z.ZodUnknown>>;
4529
4479
  outputSchema: z.ZodOptional<z.ZodObject<{
4530
4480
  type: z.ZodLiteral<"object">;
4531
- properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>;
4481
+ properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONValue, JSONValue, z.core.$ZodTypeInternals<JSONValue, JSONValue>>>>;
4532
4482
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
4533
4483
  }, z.core.$catchall<z.ZodUnknown>>>;
4534
4484
  annotations: z.ZodOptional<z.ZodObject<{
@@ -4585,6 +4535,7 @@ declare const CreateMessageResultSchema: z.ZodObject<{
4585
4535
  taskId: z.ZodString;
4586
4536
  }, z.core.$strip>>;
4587
4537
  }, z.core.$loose>>;
4538
+ resultType: z.ZodOptional<z.ZodString>;
4588
4539
  model: z.ZodString;
4589
4540
  stopReason: z.ZodOptional<z.ZodUnion<[z.ZodEnum<{
4590
4541
  maxTokens: "maxTokens";
@@ -4652,6 +4603,7 @@ declare const CreateMessageResultWithToolsSchema: z.ZodObject<{
4652
4603
  taskId: z.ZodString;
4653
4604
  }, z.core.$strip>>;
4654
4605
  }, z.core.$loose>>;
4606
+ resultType: z.ZodOptional<z.ZodString>;
4655
4607
  model: z.ZodString;
4656
4608
  stopReason: z.ZodOptional<z.ZodUnion<[z.ZodEnum<{
4657
4609
  maxTokens: "maxTokens";
@@ -4958,9 +4910,9 @@ declare const StringSchemaSchema: z.ZodObject<{
4958
4910
  minLength: z.ZodOptional<z.ZodNumber>;
4959
4911
  maxLength: z.ZodOptional<z.ZodNumber>;
4960
4912
  format: z.ZodOptional<z.ZodEnum<{
4961
- email: "email";
4962
4913
  date: "date";
4963
4914
  uri: "uri";
4915
+ email: "email";
4964
4916
  "date-time": "date-time";
4965
4917
  }>>;
4966
4918
  default: z.ZodOptional<z.ZodString>;
@@ -5201,9 +5153,9 @@ declare const PrimitiveSchemaDefinitionSchema: z.ZodUnion<readonly [z.ZodUnion<r
5201
5153
  minLength: z.ZodOptional<z.ZodNumber>;
5202
5154
  maxLength: z.ZodOptional<z.ZodNumber>;
5203
5155
  format: z.ZodOptional<z.ZodEnum<{
5204
- email: "email";
5205
5156
  date: "date";
5206
5157
  uri: "uri";
5158
+ email: "email";
5207
5159
  "date-time": "date-time";
5208
5160
  }>>;
5209
5161
  default: z.ZodOptional<z.ZodString>;
@@ -5299,9 +5251,9 @@ declare const ElicitRequestFormParamsSchema: z.ZodObject<{
5299
5251
  minLength: z.ZodOptional<z.ZodNumber>;
5300
5252
  maxLength: z.ZodOptional<z.ZodNumber>;
5301
5253
  format: z.ZodOptional<z.ZodEnum<{
5302
- email: "email";
5303
5254
  date: "date";
5304
5255
  uri: "uri";
5256
+ email: "email";
5305
5257
  "date-time": "date-time";
5306
5258
  }>>;
5307
5259
  default: z.ZodOptional<z.ZodString>;
@@ -5317,7 +5269,7 @@ declare const ElicitRequestFormParamsSchema: z.ZodObject<{
5317
5269
  default: z.ZodOptional<z.ZodNumber>;
5318
5270
  }, z.core.$strip>]>>;
5319
5271
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
5320
- }, z.core.$strip>;
5272
+ }, z.core.$catchall<z.ZodUnknown>>;
5321
5273
  }, z.core.$strip>;
5322
5274
  /**
5323
5275
  * Parameters for an {@linkcode ElicitRequest | elicitation/create} request for URL-based elicitation.
@@ -5424,9 +5376,9 @@ declare const ElicitRequestParamsSchema: z.ZodUnion<readonly [z.ZodObject<{
5424
5376
  minLength: z.ZodOptional<z.ZodNumber>;
5425
5377
  maxLength: z.ZodOptional<z.ZodNumber>;
5426
5378
  format: z.ZodOptional<z.ZodEnum<{
5427
- email: "email";
5428
5379
  date: "date";
5429
5380
  uri: "uri";
5381
+ email: "email";
5430
5382
  "date-time": "date-time";
5431
5383
  }>>;
5432
5384
  default: z.ZodOptional<z.ZodString>;
@@ -5442,7 +5394,7 @@ declare const ElicitRequestParamsSchema: z.ZodUnion<readonly [z.ZodObject<{
5442
5394
  default: z.ZodOptional<z.ZodNumber>;
5443
5395
  }, z.core.$strip>]>>;
5444
5396
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
5445
- }, z.core.$strip>;
5397
+ }, z.core.$catchall<z.ZodUnknown>>;
5446
5398
  }, z.core.$strip>, z.ZodObject<{
5447
5399
  _meta: z.ZodOptional<z.ZodObject<{
5448
5400
  /**
@@ -5549,9 +5501,9 @@ declare const ElicitRequestSchema: z.ZodObject<{
5549
5501
  minLength: z.ZodOptional<z.ZodNumber>;
5550
5502
  maxLength: z.ZodOptional<z.ZodNumber>;
5551
5503
  format: z.ZodOptional<z.ZodEnum<{
5552
- email: "email";
5553
5504
  date: "date";
5554
5505
  uri: "uri";
5506
+ email: "email";
5555
5507
  "date-time": "date-time";
5556
5508
  }>>;
5557
5509
  default: z.ZodOptional<z.ZodString>;
@@ -5567,7 +5519,7 @@ declare const ElicitRequestSchema: z.ZodObject<{
5567
5519
  default: z.ZodOptional<z.ZodNumber>;
5568
5520
  }, z.core.$strip>]>>;
5569
5521
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
5570
- }, z.core.$strip>;
5522
+ }, z.core.$catchall<z.ZodUnknown>>;
5571
5523
  }, z.core.$strip>, z.ZodObject<{
5572
5524
  _meta: z.ZodOptional<z.ZodObject<{
5573
5525
  /**
@@ -5649,6 +5601,7 @@ declare const ElicitResultSchema: z.ZodObject<{
5649
5601
  taskId: z.ZodString;
5650
5602
  }, z.core.$strip>>;
5651
5603
  }, z.core.$loose>>;
5604
+ resultType: z.ZodOptional<z.ZodString>;
5652
5605
  action: z.ZodEnum<{
5653
5606
  cancel: "cancel";
5654
5607
  accept: "accept";
@@ -5751,6 +5704,7 @@ declare const CompleteResultSchema: z.ZodObject<{
5751
5704
  taskId: z.ZodString;
5752
5705
  }, z.core.$strip>>;
5753
5706
  }, z.core.$loose>>;
5707
+ resultType: z.ZodOptional<z.ZodString>;
5754
5708
  completion: z.ZodObject<{
5755
5709
  /**
5756
5710
  * An array of completion values. Must not exceed 100 items.
@@ -5810,6 +5764,7 @@ declare const ListRootsResultSchema: z.ZodObject<{
5810
5764
  taskId: z.ZodString;
5811
5765
  }, z.core.$strip>>;
5812
5766
  }, z.core.$loose>>;
5767
+ resultType: z.ZodOptional<z.ZodString>;
5813
5768
  roots: z.ZodArray<z.ZodObject<{
5814
5769
  uri: z.ZodString;
5815
5770
  name: z.ZodOptional<z.ZodString>;
@@ -5869,17 +5824,17 @@ declare const ClientRequestSchema: z.ZodUnion<readonly [z.ZodObject<{
5869
5824
  }, z.core.$loose>>;
5870
5825
  protocolVersion: z.ZodString;
5871
5826
  capabilities: z.ZodObject<{
5872
- experimental: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>>;
5827
+ experimental: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>>;
5873
5828
  sampling: z.ZodOptional<z.ZodObject<{
5874
- context: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
5875
- tools: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
5829
+ context: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
5830
+ tools: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
5876
5831
  }, z.core.$strip>>;
5877
5832
  elicitation: z.ZodOptional<z.ZodPipe<z.ZodTransform<unknown, unknown>, z.ZodIntersection<z.ZodObject<{
5878
5833
  form: z.ZodOptional<z.ZodIntersection<z.ZodObject<{
5879
5834
  applyDefaults: z.ZodOptional<z.ZodBoolean>;
5880
- }, z.core.$strip>, z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>>;
5881
- url: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
5882
- }, z.core.$strip>, z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>>>>;
5835
+ }, z.core.$strip>, z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>>;
5836
+ url: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
5837
+ }, z.core.$strip>, z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>>>>;
5883
5838
  roots: z.ZodOptional<z.ZodObject<{
5884
5839
  listChanged: z.ZodOptional<z.ZodBoolean>;
5885
5840
  }, z.core.$strip>>;
@@ -5887,11 +5842,11 @@ declare const ClientRequestSchema: z.ZodUnion<readonly [z.ZodObject<{
5887
5842
  /**
5888
5843
  * Present if the client supports listing tasks.
5889
5844
  */
5890
- list: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
5845
+ list: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
5891
5846
  /**
5892
5847
  * Present if the client supports cancelling tasks.
5893
5848
  */
5894
- cancel: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
5849
+ cancel: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
5895
5850
  /**
5896
5851
  * Capabilities for task creation on specific request types.
5897
5852
  */
@@ -5900,17 +5855,17 @@ declare const ClientRequestSchema: z.ZodUnion<readonly [z.ZodObject<{
5900
5855
  * Task support for sampling requests.
5901
5856
  */
5902
5857
  sampling: z.ZodOptional<z.ZodObject<{
5903
- createMessage: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
5858
+ createMessage: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
5904
5859
  }, z.core.$loose>>;
5905
5860
  /**
5906
5861
  * Task support for elicitation requests.
5907
5862
  */
5908
5863
  elicitation: z.ZodOptional<z.ZodObject<{
5909
- create: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
5864
+ create: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
5910
5865
  }, z.core.$loose>>;
5911
5866
  }, z.core.$loose>>;
5912
5867
  }, z.core.$loose>>;
5913
- extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>>;
5868
+ extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>>;
5914
5869
  }, z.core.$strip>;
5915
5870
  clientInfo: z.ZodObject<{
5916
5871
  version: z.ZodString;
@@ -6329,6 +6284,13 @@ declare const ClientResultSchema: z.ZodUnion<readonly [z.ZodObject<{
6329
6284
  taskId: z.ZodString;
6330
6285
  }, z.core.$strip>>;
6331
6286
  }, z.core.$loose>>;
6287
+ /**
6288
+ * Indicates the type of the result, allowing the receiver to determine how to
6289
+ * parse the result object. Servers implementing protocol revision 2026-07-28 or
6290
+ * later always include this field; results from earlier revisions omit it, and
6291
+ * an absent value must be treated as `"complete"`.
6292
+ */
6293
+ resultType: z.ZodOptional<z.ZodString>;
6332
6294
  }, z.core.$strict>, z.ZodObject<{
6333
6295
  _meta: z.ZodOptional<z.ZodObject<{
6334
6296
  /**
@@ -6342,6 +6304,7 @@ declare const ClientResultSchema: z.ZodUnion<readonly [z.ZodObject<{
6342
6304
  taskId: z.ZodString;
6343
6305
  }, z.core.$strip>>;
6344
6306
  }, z.core.$loose>>;
6307
+ resultType: z.ZodOptional<z.ZodString>;
6345
6308
  model: z.ZodString;
6346
6309
  stopReason: z.ZodOptional<z.ZodUnion<[z.ZodEnum<{
6347
6310
  maxTokens: "maxTokens";
@@ -6404,6 +6367,7 @@ declare const ClientResultSchema: z.ZodUnion<readonly [z.ZodObject<{
6404
6367
  taskId: z.ZodString;
6405
6368
  }, z.core.$strip>>;
6406
6369
  }, z.core.$loose>>;
6370
+ resultType: z.ZodOptional<z.ZodString>;
6407
6371
  model: z.ZodString;
6408
6372
  stopReason: z.ZodOptional<z.ZodUnion<[z.ZodEnum<{
6409
6373
  maxTokens: "maxTokens";
@@ -6703,6 +6667,7 @@ declare const ClientResultSchema: z.ZodUnion<readonly [z.ZodObject<{
6703
6667
  taskId: z.ZodString;
6704
6668
  }, z.core.$strip>>;
6705
6669
  }, z.core.$loose>>;
6670
+ resultType: z.ZodOptional<z.ZodString>;
6706
6671
  action: z.ZodEnum<{
6707
6672
  cancel: "cancel";
6708
6673
  accept: "accept";
@@ -6722,6 +6687,7 @@ declare const ClientResultSchema: z.ZodUnion<readonly [z.ZodObject<{
6722
6687
  taskId: z.ZodString;
6723
6688
  }, z.core.$strip>>;
6724
6689
  }, z.core.$loose>>;
6690
+ resultType: z.ZodOptional<z.ZodString>;
6725
6691
  roots: z.ZodArray<z.ZodObject<{
6726
6692
  uri: z.ZodString;
6727
6693
  name: z.ZodOptional<z.ZodString>;
@@ -6740,6 +6706,7 @@ declare const ClientResultSchema: z.ZodUnion<readonly [z.ZodObject<{
6740
6706
  taskId: z.ZodString;
6741
6707
  }, z.core.$strip>>;
6742
6708
  }, z.core.$loose>>;
6709
+ resultType: z.ZodOptional<z.ZodString>;
6743
6710
  taskId: z.ZodString;
6744
6711
  status: z.ZodEnum<{
6745
6712
  working: "working";
@@ -6766,6 +6733,7 @@ declare const ClientResultSchema: z.ZodUnion<readonly [z.ZodObject<{
6766
6733
  taskId: z.ZodString;
6767
6734
  }, z.core.$strip>>;
6768
6735
  }, z.core.$loose>>;
6736
+ resultType: z.ZodOptional<z.ZodString>;
6769
6737
  nextCursor: z.ZodOptional<z.ZodString>;
6770
6738
  tasks: z.ZodArray<z.ZodObject<{
6771
6739
  taskId: z.ZodString;
@@ -6795,6 +6763,7 @@ declare const ClientResultSchema: z.ZodUnion<readonly [z.ZodObject<{
6795
6763
  taskId: z.ZodString;
6796
6764
  }, z.core.$strip>>;
6797
6765
  }, z.core.$loose>>;
6766
+ resultType: z.ZodOptional<z.ZodString>;
6798
6767
  task: z.ZodObject<{
6799
6768
  taskId: z.ZodString;
6800
6769
  status: z.ZodEnum<{
@@ -7144,17 +7113,17 @@ declare const ServerRequestSchema: z.ZodUnion<readonly [z.ZodObject<{
7144
7113
  temperature: z.ZodOptional<z.ZodNumber>;
7145
7114
  maxTokens: z.ZodNumber;
7146
7115
  stopSequences: z.ZodOptional<z.ZodArray<z.ZodString>>;
7147
- metadata: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
7116
+ metadata: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
7148
7117
  tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
7149
7118
  description: z.ZodOptional<z.ZodString>;
7150
7119
  inputSchema: z.ZodObject<{
7151
7120
  type: z.ZodLiteral<"object">;
7152
- properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>;
7121
+ properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONValue, JSONValue, z.core.$ZodTypeInternals<JSONValue, JSONValue>>>>;
7153
7122
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
7154
7123
  }, z.core.$catchall<z.ZodUnknown>>;
7155
7124
  outputSchema: z.ZodOptional<z.ZodObject<{
7156
7125
  type: z.ZodLiteral<"object">;
7157
- properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>;
7126
+ properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONValue, JSONValue, z.core.$ZodTypeInternals<JSONValue, JSONValue>>>>;
7158
7127
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
7159
7128
  }, z.core.$catchall<z.ZodUnknown>>>;
7160
7129
  annotations: z.ZodOptional<z.ZodObject<{
@@ -7272,9 +7241,9 @@ declare const ServerRequestSchema: z.ZodUnion<readonly [z.ZodObject<{
7272
7241
  minLength: z.ZodOptional<z.ZodNumber>;
7273
7242
  maxLength: z.ZodOptional<z.ZodNumber>;
7274
7243
  format: z.ZodOptional<z.ZodEnum<{
7275
- email: "email";
7276
7244
  date: "date";
7277
7245
  uri: "uri";
7246
+ email: "email";
7278
7247
  "date-time": "date-time";
7279
7248
  }>>;
7280
7249
  default: z.ZodOptional<z.ZodString>;
@@ -7290,7 +7259,7 @@ declare const ServerRequestSchema: z.ZodUnion<readonly [z.ZodObject<{
7290
7259
  default: z.ZodOptional<z.ZodNumber>;
7291
7260
  }, z.core.$strip>]>>;
7292
7261
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
7293
- }, z.core.$strip>;
7262
+ }, z.core.$catchall<z.ZodUnknown>>;
7294
7263
  }, z.core.$strip>, z.ZodObject<{
7295
7264
  _meta: z.ZodOptional<z.ZodObject<{
7296
7265
  /**
@@ -7592,6 +7561,13 @@ declare const ServerResultSchema: z.ZodUnion<readonly [z.ZodObject<{
7592
7561
  taskId: z.ZodString;
7593
7562
  }, z.core.$strip>>;
7594
7563
  }, z.core.$loose>>;
7564
+ /**
7565
+ * Indicates the type of the result, allowing the receiver to determine how to
7566
+ * parse the result object. Servers implementing protocol revision 2026-07-28 or
7567
+ * later always include this field; results from earlier revisions omit it, and
7568
+ * an absent value must be treated as `"complete"`.
7569
+ */
7570
+ resultType: z.ZodOptional<z.ZodString>;
7595
7571
  }, z.core.$strict>, z.ZodObject<{
7596
7572
  _meta: z.ZodOptional<z.ZodObject<{
7597
7573
  /**
@@ -7605,11 +7581,12 @@ declare const ServerResultSchema: z.ZodUnion<readonly [z.ZodObject<{
7605
7581
  taskId: z.ZodString;
7606
7582
  }, z.core.$strip>>;
7607
7583
  }, z.core.$loose>>;
7584
+ resultType: z.ZodOptional<z.ZodString>;
7608
7585
  protocolVersion: z.ZodString;
7609
7586
  capabilities: z.ZodObject<{
7610
- experimental: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>>;
7611
- logging: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
7612
- completions: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
7587
+ experimental: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>>;
7588
+ logging: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
7589
+ completions: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
7613
7590
  prompts: z.ZodOptional<z.ZodObject<{
7614
7591
  listChanged: z.ZodOptional<z.ZodBoolean>;
7615
7592
  }, z.core.$strip>>;
@@ -7624,11 +7601,11 @@ declare const ServerResultSchema: z.ZodUnion<readonly [z.ZodObject<{
7624
7601
  /**
7625
7602
  * Present if the server supports listing tasks.
7626
7603
  */
7627
- list: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
7604
+ list: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
7628
7605
  /**
7629
7606
  * Present if the server supports cancelling tasks.
7630
7607
  */
7631
- cancel: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
7608
+ cancel: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
7632
7609
  /**
7633
7610
  * Capabilities for task creation on specific request types.
7634
7611
  */
@@ -7637,11 +7614,11 @@ declare const ServerResultSchema: z.ZodUnion<readonly [z.ZodObject<{
7637
7614
  * Task support for tool requests.
7638
7615
  */
7639
7616
  tools: z.ZodOptional<z.ZodObject<{
7640
- call: z.ZodOptional<z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>;
7617
+ call: z.ZodOptional<z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>;
7641
7618
  }, z.core.$loose>>;
7642
7619
  }, z.core.$loose>>;
7643
7620
  }, z.core.$loose>>;
7644
- extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, unknown, z.core.$ZodTypeInternals<JSONObject, unknown>>>>;
7621
+ extensions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONObject, JSONObject, z.core.$ZodTypeInternals<JSONObject, JSONObject>>>>;
7645
7622
  }, z.core.$strip>;
7646
7623
  serverInfo: z.ZodObject<{
7647
7624
  version: z.ZodString;
@@ -7673,6 +7650,7 @@ declare const ServerResultSchema: z.ZodUnion<readonly [z.ZodObject<{
7673
7650
  taskId: z.ZodString;
7674
7651
  }, z.core.$strip>>;
7675
7652
  }, z.core.$loose>>;
7653
+ resultType: z.ZodOptional<z.ZodString>;
7676
7654
  completion: z.ZodObject<{
7677
7655
  /**
7678
7656
  * An array of completion values. Must not exceed 100 items.
@@ -7700,6 +7678,7 @@ declare const ServerResultSchema: z.ZodUnion<readonly [z.ZodObject<{
7700
7678
  taskId: z.ZodString;
7701
7679
  }, z.core.$strip>>;
7702
7680
  }, z.core.$loose>>;
7681
+ resultType: z.ZodOptional<z.ZodString>;
7703
7682
  description: z.ZodOptional<z.ZodString>;
7704
7683
  messages: z.ZodArray<z.ZodObject<{
7705
7684
  role: z.ZodEnum<{
@@ -7807,6 +7786,7 @@ declare const ServerResultSchema: z.ZodUnion<readonly [z.ZodObject<{
7807
7786
  taskId: z.ZodString;
7808
7787
  }, z.core.$strip>>;
7809
7788
  }, z.core.$loose>>;
7789
+ resultType: z.ZodOptional<z.ZodString>;
7810
7790
  nextCursor: z.ZodOptional<z.ZodString>;
7811
7791
  prompts: z.ZodArray<z.ZodObject<{
7812
7792
  description: z.ZodOptional<z.ZodString>;
@@ -7841,6 +7821,7 @@ declare const ServerResultSchema: z.ZodUnion<readonly [z.ZodObject<{
7841
7821
  taskId: z.ZodString;
7842
7822
  }, z.core.$strip>>;
7843
7823
  }, z.core.$loose>>;
7824
+ resultType: z.ZodOptional<z.ZodString>;
7844
7825
  nextCursor: z.ZodOptional<z.ZodString>;
7845
7826
  resources: z.ZodArray<z.ZodObject<{
7846
7827
  uri: z.ZodString;
@@ -7881,6 +7862,7 @@ declare const ServerResultSchema: z.ZodUnion<readonly [z.ZodObject<{
7881
7862
  taskId: z.ZodString;
7882
7863
  }, z.core.$strip>>;
7883
7864
  }, z.core.$loose>>;
7865
+ resultType: z.ZodOptional<z.ZodString>;
7884
7866
  nextCursor: z.ZodOptional<z.ZodString>;
7885
7867
  resourceTemplates: z.ZodArray<z.ZodObject<{
7886
7868
  uriTemplate: z.ZodString;
@@ -7920,6 +7902,7 @@ declare const ServerResultSchema: z.ZodUnion<readonly [z.ZodObject<{
7920
7902
  taskId: z.ZodString;
7921
7903
  }, z.core.$strip>>;
7922
7904
  }, z.core.$loose>>;
7905
+ resultType: z.ZodOptional<z.ZodString>;
7923
7906
  contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
7924
7907
  uri: z.ZodString;
7925
7908
  mimeType: z.ZodOptional<z.ZodString>;
@@ -7944,6 +7927,7 @@ declare const ServerResultSchema: z.ZodUnion<readonly [z.ZodObject<{
7944
7927
  taskId: z.ZodString;
7945
7928
  }, z.core.$strip>>;
7946
7929
  }, z.core.$loose>>;
7930
+ resultType: z.ZodOptional<z.ZodString>;
7947
7931
  content: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
7948
7932
  type: z.ZodLiteral<"text">;
7949
7933
  text: z.ZodString;
@@ -8046,17 +8030,18 @@ declare const ServerResultSchema: z.ZodUnion<readonly [z.ZodObject<{
8046
8030
  taskId: z.ZodString;
8047
8031
  }, z.core.$strip>>;
8048
8032
  }, z.core.$loose>>;
8033
+ resultType: z.ZodOptional<z.ZodString>;
8049
8034
  nextCursor: z.ZodOptional<z.ZodString>;
8050
8035
  tools: z.ZodArray<z.ZodObject<{
8051
8036
  description: z.ZodOptional<z.ZodString>;
8052
8037
  inputSchema: z.ZodObject<{
8053
8038
  type: z.ZodLiteral<"object">;
8054
- properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>;
8039
+ properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONValue, JSONValue, z.core.$ZodTypeInternals<JSONValue, JSONValue>>>>;
8055
8040
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
8056
8041
  }, z.core.$catchall<z.ZodUnknown>>;
8057
8042
  outputSchema: z.ZodOptional<z.ZodObject<{
8058
8043
  type: z.ZodLiteral<"object">;
8059
- properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONValue, unknown, z.core.$ZodTypeInternals<JSONValue, unknown>>>>;
8044
+ properties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<JSONValue, JSONValue, z.core.$ZodTypeInternals<JSONValue, JSONValue>>>>;
8060
8045
  required: z.ZodOptional<z.ZodArray<z.ZodString>>;
8061
8046
  }, z.core.$catchall<z.ZodUnknown>>>;
8062
8047
  annotations: z.ZodOptional<z.ZodObject<{
@@ -8099,6 +8084,7 @@ declare const ServerResultSchema: z.ZodUnion<readonly [z.ZodObject<{
8099
8084
  taskId: z.ZodString;
8100
8085
  }, z.core.$strip>>;
8101
8086
  }, z.core.$loose>>;
8087
+ resultType: z.ZodOptional<z.ZodString>;
8102
8088
  taskId: z.ZodString;
8103
8089
  status: z.ZodEnum<{
8104
8090
  working: "working";
@@ -8125,6 +8111,7 @@ declare const ServerResultSchema: z.ZodUnion<readonly [z.ZodObject<{
8125
8111
  taskId: z.ZodString;
8126
8112
  }, z.core.$strip>>;
8127
8113
  }, z.core.$loose>>;
8114
+ resultType: z.ZodOptional<z.ZodString>;
8128
8115
  nextCursor: z.ZodOptional<z.ZodString>;
8129
8116
  tasks: z.ZodArray<z.ZodObject<{
8130
8117
  taskId: z.ZodString;
@@ -8154,6 +8141,7 @@ declare const ServerResultSchema: z.ZodUnion<readonly [z.ZodObject<{
8154
8141
  taskId: z.ZodString;
8155
8142
  }, z.core.$strip>>;
8156
8143
  }, z.core.$loose>>;
8144
+ resultType: z.ZodOptional<z.ZodString>;
8157
8145
  task: z.ZodObject<{
8158
8146
  taskId: z.ZodString;
8159
8147
  status: z.ZodEnum<{
@@ -8170,8 +8158,35 @@ declare const ServerResultSchema: z.ZodUnion<readonly [z.ZodObject<{
8170
8158
  statusMessage: z.ZodOptional<z.ZodString>;
8171
8159
  }, z.core.$strip>;
8172
8160
  }, z.core.$loose>]>;
8161
+ /**
8162
+ * Gets the Zod schema for validating results of a given request method.
8163
+ * Returns `undefined` for non-spec methods.
8164
+ * @see getRequestSchema for explanation of the internal type assertion.
8165
+ */
8166
+ declare function getResultSchema<M extends RequestMethod>(method: M): z.ZodType<ResultTypeMap[M]>;
8167
+ declare function getResultSchema(method: string): z.ZodType | undefined;
8168
+ /**
8169
+ * Gets the Zod schema for a given request method.
8170
+ * Returns `undefined` for non-spec methods.
8171
+ * The return type is a ZodType that parses to RequestTypeMap[M], allowing callers
8172
+ * to use schema.parse() without needing additional type assertions.
8173
+ *
8174
+ * Note: The internal cast is necessary because TypeScript can't correlate the
8175
+ * Record-based schema lookup with the MethodToTypeMap-based RequestTypeMap
8176
+ * when M is a generic type parameter. Both compute to the same type at
8177
+ * instantiation, but TypeScript can't prove this statically.
8178
+ */
8179
+ declare function getRequestSchema<M extends RequestMethod>(method: M): z.ZodType<RequestTypeMap[M]>;
8180
+ declare function getRequestSchema(method: string): z.ZodType | undefined;
8181
+ /**
8182
+ * Gets the Zod schema for a given notification method.
8183
+ * Returns `undefined` for non-spec methods.
8184
+ * @see getRequestSchema for explanation of the internal type assertion.
8185
+ */
8186
+ declare function getNotificationSchema<M extends NotificationMethod>(method: M): z.ZodType<NotificationTypeMap[M]>;
8187
+ declare function getNotificationSchema(method: string): z.ZodType | undefined;
8173
8188
  //#endregion
8174
- //#region ../core/src/types/types.d.ts
8189
+ //#region ../core-internal/src/types/types.d.ts
8175
8190
  type JSONValue = string | number | boolean | null | JSONObject | JSONArray;
8176
8191
  type JSONObject = {
8177
8192
  [key: string]: JSONValue;
@@ -8190,7 +8205,7 @@ type Request = Infer<typeof RequestSchema>;
8190
8205
  type TaskAugmentedRequestParams = Infer<typeof TaskAugmentedRequestParamsSchema>;
8191
8206
  type RequestMeta = Infer<typeof RequestMetaSchema>;
8192
8207
  type Notification = Infer<typeof NotificationSchema>;
8193
- type Result$1 = Infer<typeof ResultSchema>;
8208
+ type Result = Infer<typeof ResultSchema>;
8194
8209
  type RequestId = Infer<typeof RequestIdSchema>;
8195
8210
  type JSONRPCRequest = Infer<typeof JSONRPCRequestSchema>;
8196
8211
  type JSONRPCNotification = Infer<typeof JSONRPCNotificationSchema>;
@@ -8200,6 +8215,11 @@ type JSONRPCResultResponse = Infer<typeof JSONRPCResultResponseSchema>;
8200
8215
  type JSONRPCMessage = Infer<typeof JSONRPCMessageSchema>;
8201
8216
  type RequestParams = Infer<typeof BaseRequestParamsSchema>;
8202
8217
  type NotificationParams = Infer<typeof NotificationsParamsSchema>;
8218
+ /**
8219
+ * The per-request `_meta` envelope carried by every request under protocol revision
8220
+ * 2026-07-28 (protocol version, client info, client capabilities, optional log level).
8221
+ */
8222
+ type RequestMetaEnvelope = Infer<typeof RequestMetaEnvelopeSchema>;
8203
8223
  type EmptyResult = Infer<typeof EmptyResultSchema>;
8204
8224
  type CancelledNotificationParams = Infer<typeof CancelledNotificationParamsSchema>;
8205
8225
  type CancelledNotification = Infer<typeof CancelledNotificationSchema>;
@@ -8209,12 +8229,28 @@ type BaseMetadata = Infer<typeof BaseMetadataSchema>;
8209
8229
  type Annotations = Infer<typeof AnnotationsSchema>;
8210
8230
  type Role = Infer<typeof RoleSchema>;
8211
8231
  type Implementation = Infer<typeof ImplementationSchema>;
8232
+ /**
8233
+ * Capabilities a client may support.
8234
+ *
8235
+ * Note: the `roots` and `sampling` capabilities are deprecated as of protocol
8236
+ * version 2026-07-28 (SEP-2577); they remain in the specification for at least
8237
+ * twelve months. See `ClientCapabilitiesSchema`.
8238
+ */
8212
8239
  type ClientCapabilities = Infer<typeof ClientCapabilitiesSchema>;
8213
8240
  type InitializeRequestParams = Infer<typeof InitializeRequestParamsSchema>;
8214
8241
  type InitializeRequest = Infer<typeof InitializeRequestSchema>;
8242
+ /**
8243
+ * Capabilities a server may support.
8244
+ *
8245
+ * Note: the `logging` capability is deprecated as of protocol version
8246
+ * 2026-07-28 (SEP-2577); it remains in the specification for at least twelve
8247
+ * months. See `ServerCapabilitiesSchema`.
8248
+ */
8215
8249
  type ServerCapabilities = Infer<typeof ServerCapabilitiesSchema>;
8216
8250
  type InitializeResult = Infer<typeof InitializeResultSchema>;
8217
8251
  type InitializedNotification = Infer<typeof InitializedNotificationSchema>;
8252
+ type DiscoverRequest = Infer<typeof DiscoverRequestSchema>;
8253
+ type DiscoverResult = Infer<typeof DiscoverResultSchema>;
8218
8254
  type PingRequest = Infer<typeof PingRequestSchema>;
8219
8255
  type Progress = Infer<typeof ProgressSchema>;
8220
8256
  type ProgressNotificationParams = Infer<typeof ProgressNotificationParamsSchema>;
@@ -8359,7 +8395,7 @@ type ResultTypeMap = {
8359
8395
  'elicitation/create': ElicitResult | CreateTaskResult;
8360
8396
  'roots/list': ListRootsResult;
8361
8397
  'tasks/get': GetTaskResult;
8362
- 'tasks/result': Result$1;
8398
+ 'tasks/result': Result;
8363
8399
  'tasks/list': ListTasksResult;
8364
8400
  'tasks/cancel': CancelTaskResult;
8365
8401
  };
@@ -8414,6 +8450,21 @@ interface InvalidParamsError extends JSONRPCErrorObject {
8414
8450
  interface InternalError extends JSONRPCErrorObject {
8415
8451
  code: typeof INTERNAL_ERROR;
8416
8452
  }
8453
+ /**
8454
+ * Data carried by a `-32004` UnsupportedProtocolVersion protocol error
8455
+ * (protocol revision 2026-07-28).
8456
+ */
8457
+ interface UnsupportedProtocolVersionErrorData {
8458
+ /**
8459
+ * Protocol versions the receiver supports. The sender should choose a
8460
+ * mutually supported version from this list and retry.
8461
+ */
8462
+ supported: string[];
8463
+ /**
8464
+ * The protocol version that was requested.
8465
+ */
8466
+ requested: string;
8467
+ }
8417
8468
  /**
8418
8469
  * Callback type for list changed notifications.
8419
8470
  */
@@ -8513,619 +8564,56 @@ type CompleteRequestPrompt = ExpandRecursively<CompleteRequest & {
8513
8564
  };
8514
8565
  }>;
8515
8566
  //#endregion
8516
- //#region ../core/src/types/errors.d.ts
8517
- /**
8518
- * Protocol errors are JSON-RPC errors that cross the wire as error responses.
8519
- * They use numeric error codes from the {@linkcode ProtocolErrorCode} enum.
8520
- */
8521
- declare class ProtocolError extends Error {
8522
- readonly code: number;
8523
- readonly data?: unknown | undefined;
8524
- constructor(code: number, message: string, data?: unknown | undefined);
8525
- /**
8526
- * Factory method to create the appropriate error type based on the error code and data
8527
- */
8528
- static fromError(code: number, message: string, data?: unknown): ProtocolError;
8529
- }
8530
- /**
8531
- * Specialized error type when a tool requires a URL mode elicitation.
8532
- * This makes it nicer for the client to handle since there is specific data to work with instead of just a code to check against.
8533
- */
8534
- declare class UrlElicitationRequiredError extends ProtocolError {
8535
- constructor(elicitations: ElicitRequestURLParams[], message?: string);
8536
- get elicitations(): ElicitRequestURLParams[];
8537
- }
8538
- //#endregion
8539
- //#region ../core/src/types/guards.d.ts
8540
- /**
8541
- * Validates and parses an unknown value as a JSON-RPC message.
8542
- *
8543
- * Use this to validate incoming messages in custom transport implementations.
8544
- * Throws if the value does not conform to the JSON-RPC message schema.
8545
- *
8546
- * @param value - The value to validate (typically a parsed JSON object).
8547
- * @returns The validated {@linkcode JSONRPCMessage}.
8548
- * @throws If validation fails.
8549
- */
8550
- declare function parseJSONRPCMessage(value: unknown): JSONRPCMessage;
8551
- declare const isJSONRPCRequest: (value: unknown) => value is JSONRPCRequest;
8552
- declare const isJSONRPCNotification: (value: unknown) => value is JSONRPCNotification;
8553
- /**
8554
- * Checks if a value is a valid {@linkcode JSONRPCResultResponse}.
8555
- * @param value - The value to check.
8556
- *
8557
- * @returns True if the value is a valid {@linkcode JSONRPCResultResponse}, false otherwise.
8558
- */
8559
- declare const isJSONRPCResultResponse: (value: unknown) => value is JSONRPCResultResponse;
8560
- /**
8561
- * Checks if a value is a valid {@linkcode JSONRPCErrorResponse}.
8562
- * @param value - The value to check.
8563
- *
8564
- * @returns True if the value is a valid {@linkcode JSONRPCErrorResponse}, false otherwise.
8565
- */
8566
- declare const isJSONRPCErrorResponse: (value: unknown) => value is JSONRPCErrorResponse;
8567
- /**
8568
- * Checks if a value is a valid {@linkcode TaskAugmentedRequestParams}.
8569
- * @param value - The value to check.
8570
- *
8571
- * @returns True if the value is a valid {@linkcode TaskAugmentedRequestParams}, false otherwise.
8572
- */
8573
- declare const isTaskAugmentedRequestParams: (value: unknown) => value is TaskAugmentedRequestParams;
8574
- declare const isInitializeRequest: (value: unknown) => value is InitializeRequest;
8575
- declare const isInitializedNotification: (value: unknown) => value is InitializedNotification;
8576
- declare function assertCompleteRequestPrompt(request: CompleteRequest): asserts request is CompleteRequestPrompt;
8577
- declare function assertCompleteRequestResourceTemplate(request: CompleteRequest): asserts request is CompleteRequestResourceTemplate;
8578
- //#endregion
8579
- //#region ../core/src/shared/metadataUtils.d.ts
8580
- /**
8581
- * Utilities for working with {@linkcode BaseMetadata} objects.
8582
- */
8583
- /**
8584
- * Gets the display name for an object with {@linkcode BaseMetadata}.
8585
- * For tools, the precedence is: `title` → {@linkcode index.ToolAnnotations | annotations}.`title` → `name`
8586
- * For other objects: `title` → `name`
8587
- * This implements the spec requirement: "if no title is provided, name should be used for display purposes"
8588
- */
8589
- declare function getDisplayName(metadata: BaseMetadata | (BaseMetadata & {
8590
- annotations?: {
8591
- title?: string;
8592
- };
8593
- })): string;
8594
- //#endregion
8595
- //#region ../core/src/util/schema.d.ts
8596
- /**
8597
- * Base type for any Zod schema.
8598
- */
8599
- type AnySchema = z.core.$ZodType;
8600
- /**
8601
- * A Zod schema for objects specifically.
8602
- */
8603
- type AnyObjectSchema = z.core.$ZodObject;
8604
- /**
8605
- * Extracts the output type from a Zod schema.
8606
- */
8607
- type SchemaOutput<T$1 extends AnySchema> = z.output<T$1>;
8608
- //#endregion
8609
- //#region ../core/src/experimental/tasks/interfaces.d.ts
8610
- /**
8611
- * Server context with guaranteed task store for task creation.
8612
- * @experimental
8613
- */
8614
- type CreateTaskServerContext = ServerContext & {
8615
- task: {
8616
- store: RequestTaskStore;
8617
- requestedTtl?: number;
8618
- };
8619
- };
8620
- /**
8621
- * Server context with guaranteed task ID and store for task operations.
8622
- * @experimental
8623
- */
8624
- type TaskServerContext = ServerContext & {
8625
- task: {
8626
- id: string;
8627
- store: RequestTaskStore;
8628
- requestedTtl?: number;
8629
- };
8630
- };
8631
- /**
8632
- * Task-specific execution configuration.
8633
- * `taskSupport` cannot be `'forbidden'` for task-based tools.
8634
- * @experimental
8635
- */
8636
- type TaskToolExecution<TaskSupport = ToolExecution['taskSupport']> = Omit<ToolExecution, 'taskSupport'> & {
8637
- taskSupport: TaskSupport extends 'forbidden' | undefined ? never : TaskSupport;
8638
- };
8639
- /**
8640
- * Represents a message queued for side-channel delivery via tasks/result.
8641
- *
8642
- * This is a serializable data structure that can be stored in external systems.
8643
- * All fields are JSON-serializable.
8644
- */
8645
- type QueuedMessage = QueuedRequest | QueuedNotification | QueuedResponse | QueuedError;
8646
- interface BaseQueuedMessage {
8647
- /** Type of message */
8648
- type: string;
8649
- /** When the message was queued (milliseconds since epoch) */
8650
- timestamp: number;
8651
- }
8652
- interface QueuedRequest extends BaseQueuedMessage {
8653
- type: 'request';
8654
- /** The actual JSONRPC request */
8655
- message: JSONRPCRequest;
8656
- }
8657
- interface QueuedNotification extends BaseQueuedMessage {
8658
- type: 'notification';
8659
- /** The actual JSONRPC notification */
8660
- message: JSONRPCNotification;
8661
- }
8662
- interface QueuedResponse extends BaseQueuedMessage {
8663
- type: 'response';
8664
- /** The actual JSONRPC response */
8665
- message: JSONRPCResultResponse;
8666
- }
8667
- interface QueuedError extends BaseQueuedMessage {
8668
- type: 'error';
8669
- /** The actual JSONRPC error */
8670
- message: JSONRPCErrorResponse;
8671
- }
8567
+ //#region ../core-internal/src/shared/transport.d.ts
8568
+ type FetchLike = (url: string | URL, init?: RequestInit) => Promise<Response>;
8672
8569
  /**
8673
- * Interface for managing per-task FIFO message queues.
8674
- *
8675
- * Similar to {@linkcode TaskStore}, this allows pluggable queue implementations
8676
- * (in-memory, Redis, other distributed queues, etc.).
8677
- *
8678
- * Each method accepts taskId and optional sessionId parameters to enable
8679
- * a single queue instance to manage messages for multiple tasks, with
8680
- * isolation based on task ID and session ID.
8681
- *
8682
- * All methods are async to support external storage implementations.
8683
- * All data in {@linkcode QueuedMessage} must be JSON-serializable.
8570
+ * Creates a fetch function that includes base `RequestInit` options.
8571
+ * This ensures requests inherit settings like credentials, mode, headers, etc. from the base init.
8684
8572
  *
8685
- * @see {@linkcode InMemoryTaskMessageQueue} for a reference implementation
8686
- * @experimental
8573
+ * @param baseFetch - The base fetch function to wrap (defaults to global `fetch`)
8574
+ * @param baseInit - The base `RequestInit` to merge with each request
8575
+ * @returns A wrapped fetch function that merges base options with call-specific options
8687
8576
  */
8688
- interface TaskMessageQueue {
8689
- /**
8690
- * Adds a message to the end of the queue for a specific task.
8691
- * Atomically checks queue size and throws if maxSize would be exceeded.
8692
- * @param taskId The task identifier
8693
- * @param message The message to enqueue
8694
- * @param sessionId Optional session ID for binding the operation to a specific session
8695
- * @param maxSize Optional maximum queue size - if specified and queue is full, throws an error
8696
- * @throws Error if maxSize is specified and would be exceeded
8697
- */
8698
- enqueue(taskId: string, message: QueuedMessage, sessionId?: string, maxSize?: number): Promise<void>;
8699
- /**
8700
- * Removes and returns the first message from the queue for a specific task.
8701
- * @param taskId The task identifier
8702
- * @param sessionId Optional session ID for binding the query to a specific session
8703
- * @returns The first message, or `undefined` if the queue is empty
8704
- */
8705
- dequeue(taskId: string, sessionId?: string): Promise<QueuedMessage | undefined>;
8706
- /**
8707
- * Removes and returns all messages from the queue for a specific task.
8708
- * Used when tasks are cancelled or failed to clean up pending messages.
8709
- * @param taskId The task identifier
8710
- * @param sessionId Optional session ID for binding the query to a specific session
8711
- * @returns Array of all messages that were in the queue
8712
- */
8713
- dequeueAll(taskId: string, sessionId?: string): Promise<QueuedMessage[]>;
8714
- }
8577
+ declare function createFetchWithInit(baseFetch?: FetchLike, baseInit?: RequestInit): FetchLike;
8715
8578
  /**
8716
- * Task creation options.
8717
- * @experimental
8579
+ * Options for sending a JSON-RPC message.
8718
8580
  */
8719
- interface CreateTaskOptions {
8581
+ type TransportSendOptions = {
8720
8582
  /**
8721
- * Duration in milliseconds to retain task from creation.
8722
- * If `null`, the task has unlimited lifetime until manually cleaned up.
8583
+ * If present, `relatedRequestId` is used to indicate to the transport which incoming request to associate this outgoing message with.
8723
8584
  */
8724
- ttl?: number | null;
8585
+ relatedRequestId?: RequestId | undefined;
8725
8586
  /**
8726
- * Time in milliseconds to wait between task status requests.
8587
+ * The resumption token used to continue long-running requests that were interrupted.
8588
+ *
8589
+ * This allows clients to reconnect and continue from where they left off, if supported by the transport.
8727
8590
  */
8728
- pollInterval?: number;
8591
+ resumptionToken?: string | undefined;
8729
8592
  /**
8730
- * Additional context to pass to the task store.
8593
+ * A callback that is invoked when the resumption token changes, if supported by the transport.
8594
+ *
8595
+ * This allows clients to persist the latest token for potential reconnection.
8731
8596
  */
8732
- context?: Record<string, unknown>;
8733
- }
8597
+ onresumptiontoken?: ((token: string) => void) | undefined;
8598
+ };
8734
8599
  /**
8735
- * Interface for storing and retrieving task state and results.
8736
- *
8737
- * Similar to {@linkcode Transport}, this allows pluggable task storage implementations
8738
- * (in-memory, database, distributed cache, etc.).
8739
- *
8740
- * @see {@linkcode InMemoryTaskStore} for a reference implementation
8741
- * @experimental
8600
+ * Describes the minimal contract for an MCP transport that a client or server can communicate over.
8742
8601
  */
8743
- interface TaskStore {
8602
+ interface Transport {
8744
8603
  /**
8745
- * Creates a new task with the given creation parameters and original request.
8746
- * The implementation must generate a unique taskId and createdAt timestamp.
8604
+ * Starts processing messages on the transport, including any connection steps that might need to be taken.
8747
8605
  *
8748
- * TTL Management:
8749
- * - The implementation receives the TTL suggested by the requestor via `taskParams.ttl`
8750
- * - The implementation MAY override the requested TTL (e.g., to enforce limits)
8751
- * - The actual TTL used MUST be returned in the {@linkcode Task} object
8752
- * - `null` TTL indicates unlimited task lifetime (no automatic cleanup)
8753
- * - Cleanup SHOULD occur automatically after TTL expires, regardless of task status
8606
+ * This method should only be called after callbacks are installed, or else messages may be lost.
8754
8607
  *
8755
- * @param taskParams - The task creation parameters from the request (ttl, pollInterval)
8756
- * @param requestId - The JSON-RPC request ID
8757
- * @param request - The original request that triggered task creation
8758
- * @param sessionId - Optional session ID for binding the task to a specific session
8759
- * @returns The created {@linkcode Task} object
8608
+ * NOTE: This method should not be called explicitly when using {@linkcode @modelcontextprotocol/client!client/client.Client | Client} or {@linkcode @modelcontextprotocol/server!server/server.Server | Server} classes, as they will implicitly call {@linkcode Transport.start | start()}.
8760
8609
  */
8761
- createTask(taskParams: CreateTaskOptions, requestId: RequestId, request: Request, sessionId?: string): Promise<Task>;
8610
+ start(): Promise<void>;
8762
8611
  /**
8763
- * Gets the current status of a task.
8612
+ * Sends a JSON-RPC message (request or response).
8764
8613
  *
8765
- * @param taskId - The task identifier
8766
- * @param sessionId - Optional session ID for binding the query to a specific session
8767
- * @returns The {@linkcode Task} object, or `null` if it does not exist
8614
+ * If present, `relatedRequestId` is used to indicate to the transport which incoming request to associate this outgoing message with.
8768
8615
  */
8769
- getTask(taskId: string, sessionId?: string): Promise<Task | null>;
8770
- /**
8771
- * Stores the result of a task and sets its final status.
8772
- *
8773
- * @param taskId - The task identifier
8774
- * @param status - The final status: `'completed'` for success, `'failed'` for errors
8775
- * @param result - The result to store
8776
- * @param sessionId - Optional session ID for binding the operation to a specific session
8777
- */
8778
- storeTaskResult(taskId: string, status: 'completed' | 'failed', result: Result$1, sessionId?: string): Promise<void>;
8779
- /**
8780
- * Retrieves the stored result of a task.
8781
- *
8782
- * @param taskId - The task identifier
8783
- * @param sessionId - Optional session ID for binding the query to a specific session
8784
- * @returns The stored result
8785
- */
8786
- getTaskResult(taskId: string, sessionId?: string): Promise<Result$1>;
8787
- /**
8788
- * Updates a task's status (e.g., to `'cancelled'`, `'failed'`, `'completed'`).
8789
- *
8790
- * @param taskId - The task identifier
8791
- * @param status - The new status
8792
- * @param statusMessage - Optional diagnostic message for failed tasks or other status information
8793
- * @param sessionId - Optional session ID for binding the operation to a specific session
8794
- */
8795
- updateTaskStatus(taskId: string, status: Task['status'], statusMessage?: string, sessionId?: string): Promise<void>;
8796
- /**
8797
- * Lists tasks, optionally starting from a pagination cursor.
8798
- *
8799
- * @param cursor - Optional cursor for pagination
8800
- * @param sessionId - Optional session ID for binding the query to a specific session
8801
- * @returns An object containing the tasks array and an optional nextCursor
8802
- */
8803
- listTasks(cursor?: string, sessionId?: string): Promise<{
8804
- tasks: Task[];
8805
- nextCursor?: string;
8806
- }>;
8807
- }
8808
- /**
8809
- * Checks if a task status represents a terminal state.
8810
- * Terminal states are those where the task has finished and will not change.
8811
- *
8812
- * @param status - The task status to check
8813
- * @returns `true` if the status is terminal (`completed`, `failed`, or `cancelled`)
8814
- * @experimental
8815
- */
8816
- declare function isTerminal(status: Task['status']): boolean;
8817
- //#endregion
8818
- //#region ../core/src/shared/responseMessage.d.ts
8819
- /**
8820
- * Base message type for the response stream.
8821
- */
8822
- interface BaseResponseMessage {
8823
- type: string;
8824
- }
8825
- /**
8826
- * Task status update message.
8827
- *
8828
- * Yielded on each poll iteration while the task is active (e.g. while
8829
- * `working`). May be emitted multiple times with the same status.
8830
- */
8831
- interface TaskStatusMessage extends BaseResponseMessage {
8832
- type: 'taskStatus';
8833
- task: Task;
8834
- }
8835
- /**
8836
- * Task created message.
8837
- *
8838
- * Yielded once when the server creates a new task for a long-running operation.
8839
- * This is always the first message for task-augmented requests.
8840
- */
8841
- interface TaskCreatedMessage extends BaseResponseMessage {
8842
- type: 'taskCreated';
8843
- task: Task;
8844
- }
8845
- /**
8846
- * Final result message.
8847
- *
8848
- * Yielded once when the operation completes successfully. Terminal — no further
8849
- * messages will follow.
8850
- */
8851
- interface ResultMessage<T$1 extends Result$1> extends BaseResponseMessage {
8852
- type: 'result';
8853
- result: T$1;
8854
- }
8855
- /**
8856
- * Error message.
8857
- *
8858
- * Yielded once if the operation fails. Terminal — no further messages will follow.
8859
- */
8860
- interface ErrorMessage extends BaseResponseMessage {
8861
- type: 'error';
8862
- error: Error;
8863
- }
8864
- /**
8865
- * Union of all message types yielded by task-aware streaming APIs such as
8866
- * {@linkcode @modelcontextprotocol/client!experimental/tasks/client.ExperimentalClientTasks#callToolStream | callToolStream()},
8867
- * {@linkcode @modelcontextprotocol/client!experimental/tasks/client.ExperimentalClientTasks#requestStream | ExperimentalClientTasks.requestStream()}, and
8868
- * {@linkcode @modelcontextprotocol/server!experimental/tasks/server.ExperimentalServerTasks#requestStream | ExperimentalServerTasks.requestStream()}.
8869
- *
8870
- * A typical sequence is:
8871
- * 1. `taskCreated` — task is registered (once)
8872
- * 2. `taskStatus` — zero or more progress updates
8873
- * 3. `result` **or** `error` — terminal message (once)
8874
- *
8875
- * Progress notifications are handled through the existing {@linkcode index.RequestOptions | onprogress} callback.
8876
- * Side-channeled messages (server requests/notifications) are handled through registered handlers.
8877
- */
8878
- type ResponseMessage<T$1 extends Result$1> = TaskStatusMessage | TaskCreatedMessage | ResultMessage<T$1> | ErrorMessage;
8879
- type AsyncGeneratorValue<T$1> = T$1 extends AsyncGenerator<infer U> ? U : never;
8880
- /**
8881
- * Collects all values from an async generator into an array.
8882
- */
8883
- declare function toArrayAsync<T$1 extends AsyncGenerator<unknown>>(it: T$1): Promise<AsyncGeneratorValue<T$1>[]>;
8884
- /**
8885
- * Consumes a {@linkcode ResponseMessage} stream and returns the final result,
8886
- * discarding intermediate `taskCreated` and `taskStatus` messages. Throws
8887
- * if an `error` message is received or the stream ends without a result.
8888
- */
8889
- declare function takeResult<T$1 extends Result$1, U$1 extends AsyncGenerator<ResponseMessage<T$1>>>(it: U$1): Promise<T$1>;
8890
- //#endregion
8891
- //#region ../core/src/shared/taskManager.d.ts
8892
- /**
8893
- * Host interface for TaskManager to call back into Protocol. @internal
8894
- */
8895
- interface TaskManagerHost {
8896
- request<T$1 extends AnySchema>(request: Request, resultSchema: T$1, options?: RequestOptions): Promise<SchemaOutput<T$1>>;
8897
- notification(notification: Notification, options?: NotificationOptions): Promise<void>;
8898
- reportError(error: Error): void;
8899
- removeProgressHandler(token: number): void;
8900
- registerHandler(method: string, handler: (request: JSONRPCRequest, ctx: BaseContext) => Promise<Result$1>): void;
8901
- sendOnResponseStream(message: JSONRPCNotification | JSONRPCRequest, relatedRequestId: RequestId): Promise<void>;
8902
- enforceStrictCapabilities: boolean;
8903
- assertTaskCapability(method: string): void;
8904
- assertTaskHandlerCapability(method: string): void;
8905
- }
8906
- /**
8907
- * Context provided to TaskManager when processing an inbound request.
8908
- * @internal
8909
- */
8910
- interface InboundContext {
8911
- sessionId?: string;
8912
- sendNotification: (notification: Notification, options?: NotificationOptions) => Promise<void>;
8913
- sendRequest: <U$1 extends AnySchema>(request: Request, resultSchema: U$1, options?: RequestOptions) => Promise<SchemaOutput<U$1>>;
8914
- }
8915
- /**
8916
- * Result returned by TaskManager after processing an inbound request.
8917
- * @internal
8918
- */
8919
- interface InboundResult {
8920
- taskContext?: BaseContext['task'];
8921
- sendNotification: (notification: Notification) => Promise<void>;
8922
- sendRequest: <U$1 extends AnySchema>(request: Request, resultSchema: U$1, options?: Omit<RequestOptions, 'relatedTask'>) => Promise<SchemaOutput<U$1>>;
8923
- routeResponse: (message: JSONRPCResponse | JSONRPCErrorResponse) => Promise<boolean>;
8924
- hasTaskCreationParams: boolean;
8925
- /**
8926
- * Optional validation to run inside the async handler chain (before the request handler).
8927
- * Throwing here produces a proper JSON-RPC error response, matching the behavior of
8928
- * capability checks on main.
8929
- */
8930
- validateInbound?: () => void;
8931
- }
8932
- /**
8933
- * Options that can be given per request.
8934
- */
8935
- type TaskRequestOptions = Omit<RequestOptions, 'relatedTask'>;
8936
- /**
8937
- * Request-scoped TaskStore interface.
8938
- */
8939
- interface RequestTaskStore {
8940
- /**
8941
- * Creates a new task with the given creation parameters.
8942
- * The implementation generates a unique taskId and createdAt timestamp.
8943
- *
8944
- * @param taskParams - The task creation parameters from the request
8945
- * @returns The created task object
8946
- */
8947
- createTask(taskParams: CreateTaskOptions): Promise<Task>;
8948
- /**
8949
- * Gets the current status of a task.
8950
- *
8951
- * @param taskId - The task identifier
8952
- * @returns The task object
8953
- * @throws If the task does not exist
8954
- */
8955
- getTask(taskId: string): Promise<Task>;
8956
- /**
8957
- * Stores the result of a task and sets its final status.
8958
- *
8959
- * @param taskId - The task identifier
8960
- * @param status - The final status: 'completed' for success, 'failed' for errors
8961
- * @param result - The result to store
8962
- */
8963
- storeTaskResult(taskId: string, status: 'completed' | 'failed', result: Result$1): Promise<void>;
8964
- /**
8965
- * Retrieves the stored result of a task.
8966
- *
8967
- * @param taskId - The task identifier
8968
- * @returns The stored result
8969
- */
8970
- getTaskResult(taskId: string): Promise<Result$1>;
8971
- /**
8972
- * Updates a task's status (e.g., to 'cancelled', 'failed', 'completed').
8973
- *
8974
- * @param taskId - The task identifier
8975
- * @param status - The new status
8976
- * @param statusMessage - Optional diagnostic message for failed tasks or other status information
8977
- */
8978
- updateTaskStatus(taskId: string, status: Task['status'], statusMessage?: string): Promise<void>;
8979
- /**
8980
- * Lists tasks, optionally starting from a pagination cursor.
8981
- *
8982
- * @param cursor - Optional cursor for pagination
8983
- * @returns An object containing the tasks array and an optional nextCursor
8984
- */
8985
- listTasks(cursor?: string): Promise<{
8986
- tasks: Task[];
8987
- nextCursor?: string;
8988
- }>;
8989
- }
8990
- /**
8991
- * Task context provided to request handlers when task storage is configured.
8992
- */
8993
- type TaskContext = {
8994
- id?: string;
8995
- store: RequestTaskStore;
8996
- requestedTtl?: number;
8997
- };
8998
- type TaskManagerOptions = {
8999
- /**
9000
- * Task storage implementation. Required for handling incoming task requests (server-side).
9001
- * Not required for sending task requests (client-side outbound API).
9002
- */
9003
- taskStore?: TaskStore;
9004
- /**
9005
- * Optional task message queue implementation for managing server-initiated messages
9006
- * that will be delivered through the tasks/result response stream.
9007
- */
9008
- taskMessageQueue?: TaskMessageQueue;
9009
- /**
9010
- * Default polling interval (in milliseconds) for task status checks when no pollInterval
9011
- * is provided by the server. Defaults to 1000ms if not specified.
9012
- */
9013
- defaultTaskPollInterval?: number;
9014
- /**
9015
- * Maximum number of messages that can be queued per task for side-channel delivery.
9016
- * If undefined, the queue size is unbounded.
9017
- */
9018
- maxTaskQueueSize?: number;
9019
- };
9020
- /**
9021
- * Manages task orchestration: state, message queuing, and polling.
9022
- * Capability checking is delegated to the Protocol host.
9023
- * @internal
9024
- */
9025
- declare class TaskManager {
9026
- private _taskStore?;
9027
- private _taskMessageQueue?;
9028
- private _taskProgressTokens;
9029
- private _requestResolvers;
9030
- private _options;
9031
- private _host?;
9032
- constructor(options: TaskManagerOptions);
9033
- bind(host: TaskManagerHost): void;
9034
- protected get _requireHost(): TaskManagerHost;
9035
- get taskStore(): TaskStore | undefined;
9036
- private get _requireTaskStore();
9037
- get taskMessageQueue(): TaskMessageQueue | undefined;
9038
- requestStream<T$1 extends AnyObjectSchema>(request: Request, resultSchema: T$1, options?: RequestOptions): AsyncGenerator<ResponseMessage<SchemaOutput<T$1>>, void, void>;
9039
- getTask(params: GetTaskRequest['params'], options?: RequestOptions): Promise<GetTaskResult>;
9040
- getTaskResult<T$1 extends AnySchema>(params: GetTaskPayloadRequest['params'], resultSchema: T$1, options?: RequestOptions): Promise<SchemaOutput<T$1>>;
9041
- listTasks(params?: {
9042
- cursor?: string;
9043
- }, options?: RequestOptions): Promise<SchemaOutput<typeof ListTasksResultSchema>>;
9044
- cancelTask(params: {
9045
- taskId: string;
9046
- }, options?: RequestOptions): Promise<SchemaOutput<typeof CancelTaskResultSchema>>;
9047
- private handleGetTask;
9048
- private handleGetTaskPayload;
9049
- private handleListTasks;
9050
- private handleCancelTask;
9051
- private prepareOutboundRequest;
9052
- private extractInboundTaskContext;
9053
- private wrapSendNotification;
9054
- private wrapSendRequest;
9055
- private handleResponse;
9056
- private shouldPreserveProgressHandler;
9057
- private routeNotification;
9058
- private routeResponse;
9059
- private createRequestTaskStore;
9060
- processInboundRequest(request: JSONRPCRequest, ctx: InboundContext): InboundResult;
9061
- processOutboundRequest(jsonrpcRequest: JSONRPCRequest, options: RequestOptions | undefined, messageId: number, responseHandler: (response: JSONRPCResultResponse | Error) => void, onError: (error: unknown) => void): {
9062
- queued: boolean;
9063
- };
9064
- processInboundResponse(response: JSONRPCResponse | JSONRPCErrorResponse, messageId: number): {
9065
- consumed: boolean;
9066
- preserveProgress: boolean;
9067
- };
9068
- processOutboundNotification(notification: Notification, options?: NotificationOptions): Promise<{
9069
- queued: boolean;
9070
- jsonrpcNotification?: JSONRPCNotification;
9071
- }>;
9072
- onClose(): void;
9073
- private _enqueueTaskMessage;
9074
- private _clearTaskQueue;
9075
- private _waitForTaskUpdate;
9076
- private _cleanupTaskProgressHandler;
9077
- }
9078
- //#endregion
9079
- //#region ../core/src/shared/transport.d.ts
9080
- type FetchLike = (url: string | URL, init?: RequestInit) => Promise<Response>;
9081
- /**
9082
- * Creates a fetch function that includes base `RequestInit` options.
9083
- * This ensures requests inherit settings like credentials, mode, headers, etc. from the base init.
9084
- *
9085
- * @param baseFetch - The base fetch function to wrap (defaults to global `fetch`)
9086
- * @param baseInit - The base `RequestInit` to merge with each request
9087
- * @returns A wrapped fetch function that merges base options with call-specific options
9088
- */
9089
- declare function createFetchWithInit(baseFetch?: FetchLike, baseInit?: RequestInit): FetchLike;
9090
- /**
9091
- * Options for sending a JSON-RPC message.
9092
- */
9093
- type TransportSendOptions = {
9094
- /**
9095
- * If present, `relatedRequestId` is used to indicate to the transport which incoming request to associate this outgoing message with.
9096
- */
9097
- relatedRequestId?: RequestId | undefined;
9098
- /**
9099
- * The resumption token used to continue long-running requests that were interrupted.
9100
- *
9101
- * This allows clients to reconnect and continue from where they left off, if supported by the transport.
9102
- */
9103
- resumptionToken?: string | undefined;
9104
- /**
9105
- * A callback that is invoked when the resumption token changes, if supported by the transport.
9106
- *
9107
- * This allows clients to persist the latest token for potential reconnection.
9108
- */
9109
- onresumptiontoken?: ((token: string) => void) | undefined;
9110
- };
9111
- /**
9112
- * Describes the minimal contract for an MCP transport that a client or server can communicate over.
9113
- */
9114
- interface Transport {
9115
- /**
9116
- * Starts processing messages on the transport, including any connection steps that might need to be taken.
9117
- *
9118
- * This method should only be called after callbacks are installed, or else messages may be lost.
9119
- *
9120
- * NOTE: This method should not be called explicitly when using {@linkcode @modelcontextprotocol/client!client/client.Client | Client} or {@linkcode @modelcontextprotocol/server!server/server.Server | Server} classes, as they will implicitly call {@linkcode Transport.start | start()}.
9121
- */
9122
- start(): Promise<void>;
9123
- /**
9124
- * Sends a JSON-RPC message (request or response).
9125
- *
9126
- * If present, `relatedRequestId` is used to indicate to the transport which incoming request to associate this outgoing message with.
9127
- */
9128
- send(message: JSONRPCMessage, options?: TransportSendOptions): Promise<void>;
8616
+ send(message: JSONRPCMessage, options?: TransportSendOptions): Promise<void>;
9129
8617
  /**
9130
8618
  * Closes the connection.
9131
8619
  */
@@ -9165,764 +8653,5 @@ interface Transport {
9165
8653
  setSupportedProtocolVersions?: ((versions: string[]) => void) | undefined;
9166
8654
  }
9167
8655
  //#endregion
9168
- //#region ../core/src/shared/protocol.d.ts
9169
- /**
9170
- * Callback for progress notifications.
9171
- */
9172
- type ProgressCallback = (progress: Progress) => void;
9173
- /**
9174
- * Additional initialization options.
9175
- */
9176
- type ProtocolOptions = {
9177
- /**
9178
- * Protocol versions supported. First version is preferred (sent by client,
9179
- * used as fallback by server). Passed to transport during {@linkcode Protocol.connect | connect()}.
9180
- *
9181
- * @default {@linkcode SUPPORTED_PROTOCOL_VERSIONS}
9182
- */
9183
- supportedProtocolVersions?: string[];
9184
- /**
9185
- * Whether to restrict emitted requests to only those that the remote side has indicated that they can handle, through their advertised capabilities.
9186
- *
9187
- * Note that this DOES NOT affect checking of _local_ side capabilities, as it is considered a logic error to mis-specify those.
9188
- *
9189
- * Currently this defaults to `false`, for backwards compatibility with SDK versions that did not advertise capabilities correctly. In future, this will default to `true`.
9190
- */
9191
- enforceStrictCapabilities?: boolean;
9192
- /**
9193
- * An array of notification method names that should be automatically debounced.
9194
- * Any notifications with a method in this list will be coalesced if they
9195
- * occur in the same tick of the event loop.
9196
- * e.g., `['notifications/tools/list_changed']`
9197
- */
9198
- debouncedNotificationMethods?: string[];
9199
- /**
9200
- * Runtime configuration for task management.
9201
- * If provided, creates a TaskManager with the given options; otherwise a NullTaskManager is used.
9202
- *
9203
- * Capability assertions are wired automatically from the protocol's
9204
- * `assertTaskCapability()` and `assertTaskHandlerCapability()` methods,
9205
- * so they should NOT be included here.
9206
- */
9207
- tasks?: TaskManagerOptions;
9208
- };
9209
- /**
9210
- * The default request timeout, in milliseconds.
9211
- */
9212
- declare const DEFAULT_REQUEST_TIMEOUT_MSEC = 60000;
9213
- /**
9214
- * Options that can be given per request.
9215
- */
9216
- type RequestOptions = {
9217
- /**
9218
- * If set, requests progress notifications from the remote end (if supported). When progress notifications are received, this callback will be invoked.
9219
- *
9220
- * For task-augmented requests: progress notifications continue after {@linkcode CreateTaskResult} is returned and stop automatically when the task reaches a terminal status.
9221
- */
9222
- onprogress?: ProgressCallback;
9223
- /**
9224
- * Can be used to cancel an in-flight request. This will cause an `AbortError` to be raised from {@linkcode Protocol.request | request()}.
9225
- */
9226
- signal?: AbortSignal;
9227
- /**
9228
- * A timeout (in milliseconds) for this request. If exceeded, an {@linkcode SdkError} with code {@linkcode SdkErrorCode.RequestTimeout} will be raised from {@linkcode Protocol.request | request()}.
9229
- *
9230
- * If not specified, {@linkcode DEFAULT_REQUEST_TIMEOUT_MSEC} will be used as the timeout.
9231
- */
9232
- timeout?: number;
9233
- /**
9234
- * If `true`, receiving a progress notification will reset the request timeout.
9235
- * This is useful for long-running operations that send periodic progress updates.
9236
- * Default: `false`
9237
- */
9238
- resetTimeoutOnProgress?: boolean;
9239
- /**
9240
- * Maximum total time (in milliseconds) to wait for a response.
9241
- * If exceeded, an {@linkcode SdkError} with code {@linkcode SdkErrorCode.RequestTimeout} will be raised, regardless of progress notifications.
9242
- * If not specified, there is no maximum total timeout.
9243
- */
9244
- maxTotalTimeout?: number;
9245
- /**
9246
- * If provided, augments the request with task creation parameters to enable call-now, fetch-later execution patterns.
9247
- */
9248
- task?: TaskCreationParams;
9249
- /**
9250
- * If provided, associates this request with a related task.
9251
- */
9252
- relatedTask?: RelatedTaskMetadata;
9253
- } & TransportSendOptions;
9254
- /**
9255
- * Options that can be given per notification.
9256
- */
9257
- type NotificationOptions = {
9258
- /**
9259
- * May be used to indicate to the transport which incoming request to associate this outgoing notification with.
9260
- */
9261
- relatedRequestId?: RequestId;
9262
- /**
9263
- * If provided, associates this notification with a related task.
9264
- */
9265
- relatedTask?: RelatedTaskMetadata;
9266
- };
9267
- /**
9268
- * Base context provided to all request handlers.
9269
- */
9270
- type BaseContext = {
9271
- /**
9272
- * The session ID from the transport, if available.
9273
- */
9274
- sessionId?: string;
9275
- /**
9276
- * Information about the MCP request being handled.
9277
- */
9278
- mcpReq: {
9279
- /**
9280
- * The JSON-RPC ID of the request being handled.
9281
- */
9282
- id: RequestId;
9283
- /**
9284
- * The method name of the request (e.g., 'tools/call', 'ping').
9285
- */
9286
- method: string;
9287
- /**
9288
- * Metadata from the original request.
9289
- */
9290
- _meta?: RequestMeta;
9291
- /**
9292
- * An abort signal used to communicate if the request was cancelled from the sender's side.
9293
- */
9294
- signal: AbortSignal;
9295
- /**
9296
- * Sends a request that relates to the current request being handled.
9297
- *
9298
- * This is used by certain transports to correctly associate related messages.
9299
- */
9300
- send: <M extends RequestMethod>(request: {
9301
- method: M;
9302
- params?: Record<string, unknown>;
9303
- }, options?: TaskRequestOptions) => Promise<ResultTypeMap[M]>;
9304
- /**
9305
- * Sends a notification that relates to the current request being handled.
9306
- *
9307
- * This is used by certain transports to correctly associate related messages.
9308
- */
9309
- notify: (notification: Notification) => Promise<void>;
9310
- };
9311
- /**
9312
- * HTTP transport information, only available when using an HTTP-based transport.
9313
- */
9314
- http?: {
9315
- /**
9316
- * Information about a validated access token, provided to request handlers.
9317
- */
9318
- authInfo?: AuthInfo;
9319
- };
9320
- /**
9321
- * Task context, available when task storage is configured.
9322
- */
9323
- task?: TaskContext;
9324
- };
9325
- /**
9326
- * Context provided to server-side request handlers, extending {@linkcode BaseContext} with server-specific fields.
9327
- */
9328
- type ServerContext = BaseContext & {
9329
- mcpReq: {
9330
- /**
9331
- * Send a log message notification to the client.
9332
- * Respects the client's log level filter set via logging/setLevel.
9333
- */
9334
- log: (level: LoggingLevel, data: unknown, logger?: string) => Promise<void>;
9335
- /**
9336
- * Send an elicitation request to the client, requesting user input.
9337
- */
9338
- elicitInput: (params: ElicitRequestFormParams | ElicitRequestURLParams, options?: RequestOptions) => Promise<ElicitResult>;
9339
- /**
9340
- * Request LLM sampling from the client.
9341
- */
9342
- requestSampling: (params: CreateMessageRequest['params'], options?: RequestOptions) => Promise<CreateMessageResult | CreateMessageResultWithTools>;
9343
- };
9344
- http?: {
9345
- /**
9346
- * The original HTTP request.
9347
- */
9348
- req?: globalThis.Request;
9349
- /**
9350
- * Closes the SSE stream for this request, triggering client reconnection.
9351
- * Only available when using a StreamableHTTPServerTransport with eventStore configured.
9352
- */
9353
- closeSSE?: () => void;
9354
- /**
9355
- * Closes the standalone GET SSE stream, triggering client reconnection.
9356
- * Only available when using a StreamableHTTPServerTransport with eventStore configured.
9357
- */
9358
- closeStandaloneSSE?: () => void;
9359
- };
9360
- };
9361
- /**
9362
- * Context provided to client-side request handlers.
9363
- */
9364
- type ClientContext = BaseContext;
9365
- /**
9366
- * Implements MCP protocol framing on top of a pluggable transport, including
9367
- * features like request/response linking, notifications, and progress.
9368
- */
9369
- declare abstract class Protocol<ContextT extends BaseContext> {
9370
- private _options?;
9371
- private _transport?;
9372
- private _requestMessageId;
9373
- private _requestHandlers;
9374
- private _requestHandlerAbortControllers;
9375
- private _notificationHandlers;
9376
- private _responseHandlers;
9377
- private _progressHandlers;
9378
- private _timeoutInfo;
9379
- private _pendingDebouncedNotifications;
9380
- private _taskManager;
9381
- protected _supportedProtocolVersions: string[];
9382
- /**
9383
- * Callback for when the connection is closed for any reason.
9384
- *
9385
- * This is invoked when {@linkcode Protocol.close | close()} is called as well.
9386
- */
9387
- onclose?: () => void;
9388
- /**
9389
- * Callback for when an error occurs.
9390
- *
9391
- * Note that errors are not necessarily fatal; they are used for reporting any kind of exceptional condition out of band.
9392
- */
9393
- onerror?: (error: Error) => void;
9394
- /**
9395
- * A handler to invoke for any request types that do not have their own handler installed.
9396
- */
9397
- fallbackRequestHandler?: (request: JSONRPCRequest, ctx: ContextT) => Promise<Result$1>;
9398
- /**
9399
- * A handler to invoke for any notification types that do not have their own handler installed.
9400
- */
9401
- fallbackNotificationHandler?: (notification: Notification) => Promise<void>;
9402
- constructor(_options?: ProtocolOptions | undefined);
9403
- /**
9404
- * Access the TaskManager for task orchestration.
9405
- * Always available; returns a NullTaskManager when no task store is configured.
9406
- */
9407
- get taskManager(): TaskManager;
9408
- private _bindTaskManager;
9409
- /**
9410
- * Builds the context object for request handlers. Subclasses must override
9411
- * to return the appropriate context type (e.g., ServerContext adds HTTP request info).
9412
- */
9413
- protected abstract buildContext(ctx: BaseContext, transportInfo?: MessageExtraInfo): ContextT;
9414
- private _oncancel;
9415
- private _setupTimeout;
9416
- private _resetTimeout;
9417
- private _cleanupTimeout;
9418
- /**
9419
- * Attaches to the given transport, starts it, and starts listening for messages.
9420
- *
9421
- * The caller assumes ownership of the {@linkcode Transport}, replacing any callbacks that have already been set, and expects that it is the only user of the {@linkcode Transport} instance going forward.
9422
- */
9423
- connect(transport: Transport): Promise<void>;
9424
- private _onclose;
9425
- private _onerror;
9426
- private _onnotification;
9427
- private _onrequest;
9428
- private _onprogress;
9429
- private _onresponse;
9430
- get transport(): Transport | undefined;
9431
- /**
9432
- * Closes the connection.
9433
- */
9434
- close(): Promise<void>;
9435
- /**
9436
- * A method to check if a capability is supported by the remote side, for the given method to be called.
9437
- *
9438
- * This should be implemented by subclasses.
9439
- */
9440
- protected abstract assertCapabilityForMethod(method: RequestMethod): void;
9441
- /**
9442
- * A method to check if a notification is supported by the local side, for the given method to be sent.
9443
- *
9444
- * This should be implemented by subclasses.
9445
- */
9446
- protected abstract assertNotificationCapability(method: NotificationMethod): void;
9447
- /**
9448
- * A method to check if a request handler is supported by the local side, for the given method to be handled.
9449
- *
9450
- * This should be implemented by subclasses.
9451
- */
9452
- protected abstract assertRequestHandlerCapability(method: string): void;
9453
- /**
9454
- * A method to check if the remote side supports task creation for the given method.
9455
- *
9456
- * Called when sending a task-augmented outbound request (only when enforceStrictCapabilities is true).
9457
- * This should be implemented by subclasses.
9458
- */
9459
- protected abstract assertTaskCapability(method: string): void;
9460
- /**
9461
- * A method to check if this side supports handling task creation for the given method.
9462
- *
9463
- * Called when receiving a task-augmented inbound request.
9464
- * This should be implemented by subclasses.
9465
- */
9466
- protected abstract assertTaskHandlerCapability(method: string): void;
9467
- /**
9468
- * Sends a request and waits for a response, resolving the result schema
9469
- * automatically from the method name.
9470
- *
9471
- * Do not use this method to emit notifications! Use {@linkcode Protocol.notification | notification()} instead.
9472
- */
9473
- request<M extends RequestMethod>(request: {
9474
- method: M;
9475
- params?: Record<string, unknown>;
9476
- }, options?: RequestOptions): Promise<ResultTypeMap[M]>;
9477
- /**
9478
- * Sends a request and waits for a response, using the provided schema for validation.
9479
- *
9480
- * This is the internal implementation used by SDK methods that need to specify
9481
- * a particular result schema (e.g., for compatibility or task-specific schemas).
9482
- */
9483
- protected _requestWithSchema<T$1 extends AnySchema>(request: Request, resultSchema: T$1, options?: RequestOptions): Promise<SchemaOutput<T$1>>;
9484
- /**
9485
- * Emits a notification, which is a one-way message that does not expect a response.
9486
- */
9487
- notification(notification: Notification, options?: NotificationOptions): Promise<void>;
9488
- /**
9489
- * Registers a handler to invoke when this protocol object receives a request with the given method.
9490
- *
9491
- * Note that this will replace any previous request handler for the same method.
9492
- */
9493
- setRequestHandler<M extends RequestMethod>(method: M, handler: (request: RequestTypeMap[M], ctx: ContextT) => Result$1 | Promise<Result$1>): void;
9494
- /**
9495
- * Removes the request handler for the given method.
9496
- */
9497
- removeRequestHandler(method: RequestMethod): void;
9498
- /**
9499
- * Asserts that a request handler has not already been set for the given method, in preparation for a new one being automatically installed.
9500
- */
9501
- assertCanSetRequestHandler(method: RequestMethod): void;
9502
- /**
9503
- * Registers a handler to invoke when this protocol object receives a notification with the given method.
9504
- *
9505
- * Note that this will replace any previous notification handler for the same method.
9506
- */
9507
- setNotificationHandler<M extends NotificationMethod>(method: M, handler: (notification: NotificationTypeMap[M]) => void | Promise<void>): void;
9508
- /**
9509
- * Removes the notification handler for the given method.
9510
- */
9511
- removeNotificationHandler(method: NotificationMethod): void;
9512
- }
9513
- //#endregion
9514
- //#region ../core/src/shared/stdio.d.ts
9515
- /**
9516
- * Buffers a continuous stdio stream into discrete JSON-RPC messages.
9517
- */
9518
- declare class ReadBuffer {
9519
- private _buffer?;
9520
- append(chunk: Buffer): void;
9521
- readMessage(): JSONRPCMessage | null;
9522
- clear(): void;
9523
- }
9524
- declare function deserializeMessage(line: string): JSONRPCMessage;
9525
- declare function serializeMessage(message: JSONRPCMessage): string;
9526
- //#endregion
9527
- //#region ../core/src/shared/uriTemplate.d.ts
9528
- type Variables = Record<string, string | string[]>;
9529
- declare class UriTemplate {
9530
- /**
9531
- * Returns true if the given string contains any URI template expressions.
9532
- * A template expression is a sequence of characters enclosed in curly braces,
9533
- * like `{foo}` or `{?bar}`.
9534
- */
9535
- static isTemplate(str: string): boolean;
9536
- private static validateLength;
9537
- private readonly template;
9538
- private readonly parts;
9539
- get variableNames(): string[];
9540
- constructor(template: string);
9541
- toString(): string;
9542
- private parse;
9543
- private getOperator;
9544
- private getNames;
9545
- private encodeValue;
9546
- private expandPart;
9547
- expand(variables: Variables): string;
9548
- private escapeRegExp;
9549
- private partToRegExp;
9550
- match(uri: string): Variables | null;
9551
- }
9552
- //#endregion
9553
- //#region ../core/src/util/standardSchema.d.ts
9554
- /**
9555
- * Standard Schema utilities for user-provided schemas.
9556
- * Supports Zod v4, Valibot, ArkType, and other Standard Schema implementations.
9557
- * @see https://standardschema.dev
9558
- */
9559
- interface StandardTypedV1<Input = unknown, Output = Input> {
9560
- readonly '~standard': StandardTypedV1.Props<Input, Output>;
9561
- }
9562
- declare namespace StandardTypedV1 {
9563
- interface Props<Input = unknown, Output = Input> {
9564
- readonly version: 1;
9565
- readonly vendor: string;
9566
- readonly types?: Types<Input, Output> | undefined;
9567
- }
9568
- interface Types<Input = unknown, Output = Input> {
9569
- readonly input: Input;
9570
- readonly output: Output;
9571
- }
9572
- type InferInput<Schema extends StandardTypedV1> = NonNullable<Schema['~standard']['types']>['input'];
9573
- type InferOutput<Schema extends StandardTypedV1> = NonNullable<Schema['~standard']['types']>['output'];
9574
- }
9575
- interface StandardSchemaV1<Input = unknown, Output = Input> {
9576
- readonly '~standard': StandardSchemaV1.Props<Input, Output>;
9577
- }
9578
- declare namespace StandardSchemaV1 {
9579
- interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
9580
- readonly validate: (value: unknown, options?: Options | undefined) => Result<Output> | Promise<Result<Output>>;
9581
- }
9582
- interface Options {
9583
- readonly libraryOptions?: Record<string, unknown> | undefined;
9584
- }
9585
- type Result<Output> = SuccessResult<Output> | FailureResult;
9586
- interface SuccessResult<Output> {
9587
- readonly value: Output;
9588
- readonly issues?: undefined;
9589
- }
9590
- interface FailureResult {
9591
- readonly issues: ReadonlyArray<Issue>;
9592
- }
9593
- interface Issue {
9594
- readonly message: string;
9595
- readonly path?: ReadonlyArray<PropertyKey | PathSegment> | undefined;
9596
- }
9597
- interface PathSegment {
9598
- readonly key: PropertyKey;
9599
- }
9600
- type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
9601
- type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
9602
- }
9603
- interface StandardJSONSchemaV1<Input = unknown, Output = Input> {
9604
- readonly '~standard': StandardJSONSchemaV1.Props<Input, Output>;
9605
- }
9606
- declare namespace StandardJSONSchemaV1 {
9607
- interface Props<Input = unknown, Output = Input> extends StandardTypedV1.Props<Input, Output> {
9608
- readonly jsonSchema: Converter;
9609
- }
9610
- interface Converter {
9611
- readonly input: (options: Options) => Record<string, unknown>;
9612
- readonly output: (options: Options) => Record<string, unknown>;
9613
- }
9614
- type Target = 'draft-2020-12' | 'draft-07' | 'openapi-3.0' | (object & string);
9615
- interface Options {
9616
- readonly target: Target;
9617
- readonly libraryOptions?: Record<string, unknown> | undefined;
9618
- }
9619
- type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
9620
- type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
9621
- }
9622
- /**
9623
- * Combined interface for schemas with both validation and JSON Schema conversion —
9624
- * the intersection of {@linkcode StandardSchemaV1} and {@linkcode StandardJSONSchemaV1}.
9625
- *
9626
- * This is the type accepted by `registerTool` / `registerPrompt`. The SDK needs
9627
- * `~standard.jsonSchema` to advertise the tool's argument shape in `tools/list`, and
9628
- * `~standard.validate` to check incoming arguments when a `tools/call` arrives.
9629
- *
9630
- * Zod v4, ArkType, and Valibot (via `@valibot/to-json-schema`'s `toStandardJsonSchema`)
9631
- * all implement both interfaces.
9632
- *
9633
- * @see https://standardschema.dev/ for the Standard Schema specification
9634
- */
9635
- interface StandardSchemaWithJSON<Input = unknown, Output = Input> {
9636
- readonly '~standard': StandardSchemaV1.Props<Input, Output> & StandardJSONSchemaV1.Props<Input, Output>;
9637
- }
9638
- declare namespace StandardSchemaWithJSON {
9639
- type InferInput<Schema extends StandardTypedV1> = StandardTypedV1.InferInput<Schema>;
9640
- type InferOutput<Schema extends StandardTypedV1> = StandardTypedV1.InferOutput<Schema>;
9641
- }
9642
- //#endregion
9643
- //#region ../core/src/experimental/tasks/helpers.d.ts
9644
- /**
9645
- * Experimental task capability assertion helpers.
9646
- * WARNING: These APIs are experimental and may change without notice.
9647
- *
9648
- * @experimental
9649
- */
9650
- /**
9651
- * Type representing the task requests capability structure.
9652
- * This is derived from `ClientTasksCapability.requests` and `ServerTasksCapability.requests`.
9653
- */
9654
- interface TaskRequestsCapability {
9655
- tools?: {
9656
- call?: object;
9657
- };
9658
- sampling?: {
9659
- createMessage?: object;
9660
- };
9661
- elicitation?: {
9662
- create?: object;
9663
- };
9664
- }
9665
- /**
9666
- * Asserts that task creation is supported for `tools/call`.
9667
- * Used to implement the `assertTaskCapability` or `assertTaskHandlerCapability` abstract methods on Protocol.
9668
- *
9669
- * @param requests - The task requests capability object
9670
- * @param method - The method being checked
9671
- * @param entityName - `'Server'` or `'Client'` for error messages
9672
- * @throws {@linkcode SdkError} with {@linkcode SdkErrorCode.CapabilityNotSupported} if the capability is not supported
9673
- *
9674
- * @experimental
9675
- */
9676
- declare function assertToolsCallTaskCapability(requests: TaskRequestsCapability | undefined, method: string, entityName: 'Server' | 'Client'): void;
9677
- /**
9678
- * Asserts that task creation is supported for `sampling/createMessage` or `elicitation/create`.
9679
- * Used to implement the `assertTaskCapability` or `assertTaskHandlerCapability` abstract methods on Protocol.
9680
- *
9681
- * @param requests - The task requests capability object
9682
- * @param method - The method being checked
9683
- * @param entityName - `'Server'` or `'Client'` for error messages
9684
- * @throws {@linkcode SdkError} with {@linkcode SdkErrorCode.CapabilityNotSupported} if the capability is not supported
9685
- *
9686
- * @experimental
9687
- */
9688
- declare function assertClientRequestTaskCapability(requests: TaskRequestsCapability | undefined, method: string, entityName: 'Server' | 'Client'): void;
9689
- //#endregion
9690
- //#region ../core/src/experimental/tasks/stores/inMemory.d.ts
9691
- /**
9692
- * In-memory {@linkcode TaskStore} implementation for development and testing.
9693
- * For production, use a database or distributed cache.
9694
- * @experimental
9695
- */
9696
- declare class InMemoryTaskStore implements TaskStore {
9697
- private tasks;
9698
- private cleanupTimers;
9699
- /**
9700
- * Generates a unique task ID using Web Crypto API.
9701
- */
9702
- private generateTaskId;
9703
- /** {@inheritDoc TaskStore.createTask} */
9704
- createTask(taskParams: CreateTaskOptions, requestId: RequestId, request: Request, sessionId?: string): Promise<Task>;
9705
- /**
9706
- * Retrieves a stored task, enforcing session ownership when a sessionId is provided.
9707
- * Returns undefined if the task does not exist or belongs to a different session.
9708
- */
9709
- private getStoredTask;
9710
- getTask(taskId: string, sessionId?: string): Promise<Task | null>;
9711
- /** {@inheritDoc TaskStore.storeTaskResult} */
9712
- storeTaskResult(taskId: string, status: 'completed' | 'failed', result: Result$1, sessionId?: string): Promise<void>;
9713
- /** {@inheritDoc TaskStore.getTaskResult} */
9714
- getTaskResult(taskId: string, sessionId?: string): Promise<Result$1>;
9715
- /** {@inheritDoc TaskStore.updateTaskStatus} */
9716
- updateTaskStatus(taskId: string, status: Task['status'], statusMessage?: string, sessionId?: string): Promise<void>;
9717
- /** {@inheritDoc TaskStore.listTasks} */
9718
- listTasks(cursor?: string, sessionId?: string): Promise<{
9719
- tasks: Task[];
9720
- nextCursor?: string;
9721
- }>;
9722
- /**
9723
- * Cleanup all timers (useful for testing or graceful shutdown)
9724
- */
9725
- cleanup(): void;
9726
- /**
9727
- * Get all tasks (useful for debugging)
9728
- */
9729
- getAllTasks(): Task[];
9730
- }
9731
- /**
9732
- * In-memory {@linkcode TaskMessageQueue} implementation for development and testing.
9733
- * For production, use Redis or another distributed queue.
9734
- * @experimental
9735
- */
9736
- declare class InMemoryTaskMessageQueue implements TaskMessageQueue {
9737
- private queues;
9738
- /**
9739
- * Generates a queue key from taskId.
9740
- * SessionId is intentionally ignored because taskIds are globally unique
9741
- * and tasks need to be accessible across HTTP requests/sessions.
9742
- */
9743
- private getQueueKey;
9744
- /**
9745
- * Gets or creates a queue for the given task and session.
9746
- */
9747
- private getQueue;
9748
- /**
9749
- * Adds a message to the end of the queue for a specific task.
9750
- * Atomically checks queue size and throws if maxSize would be exceeded.
9751
- * @param taskId The task identifier
9752
- * @param message The message to enqueue
9753
- * @param sessionId Optional session ID for binding the operation to a specific session
9754
- * @param maxSize Optional maximum queue size - if specified and queue is full, throws an error
9755
- * @throws Error if maxSize is specified and would be exceeded
9756
- */
9757
- enqueue(taskId: string, message: QueuedMessage, sessionId?: string, maxSize?: number): Promise<void>;
9758
- /**
9759
- * Removes and returns the first message from the queue for a specific task.
9760
- * @param taskId The task identifier
9761
- * @param sessionId Optional session ID for binding the query to a specific session
9762
- * @returns The first message, or `undefined` if the queue is empty
9763
- */
9764
- dequeue(taskId: string, sessionId?: string): Promise<QueuedMessage | undefined>;
9765
- /**
9766
- * Removes and returns all messages from the queue for a specific task.
9767
- * @param taskId The task identifier
9768
- * @param sessionId Optional session ID for binding the query to a specific session
9769
- * @returns Array of all messages that were in the queue
9770
- */
9771
- dequeueAll(taskId: string, sessionId?: string): Promise<QueuedMessage[]>;
9772
- }
9773
- //#endregion
9774
- //#region ../core/src/validators/types.d.ts
9775
- /**
9776
- * JSON Schema type definition (JSON Schema Draft 2020-12)
9777
- *
9778
- * This uses the object form of JSON Schema (excluding boolean schemas).
9779
- * While `true` and `false` are valid JSON Schemas, this SDK uses the
9780
- * object form for practical type safety.
9781
- *
9782
- * Re-exported from json-schema-typed for convenience.
9783
- * @see https://json-schema.org/draft/2020-12/json-schema-core.html
9784
- */
9785
- type JsonSchemaType = JSONSchema.Interface;
9786
- /**
9787
- * Result of a JSON Schema validation operation
9788
- */
9789
- type JsonSchemaValidatorResult<T$1> = {
9790
- valid: true;
9791
- data: T$1;
9792
- errorMessage: undefined;
9793
- } | {
9794
- valid: false;
9795
- data: undefined;
9796
- errorMessage: string;
9797
- };
9798
- /**
9799
- * A validator function that validates data against a JSON Schema
9800
- */
9801
- type JsonSchemaValidator<T$1> = (input: unknown) => JsonSchemaValidatorResult<T$1>;
9802
- /**
9803
- * Provider interface for creating validators from JSON Schemas
9804
- *
9805
- * This is the main extension point for custom validator implementations.
9806
- * Implementations should:
9807
- * - Support JSON Schema Draft 2020-12 (or be compatible with it)
9808
- * - Return validator functions that can be called multiple times
9809
- * - Handle schema compilation/caching internally
9810
- * - Provide clear error messages on validation failure
9811
- *
9812
- * @example
9813
- * ```ts source="./types.examples.ts#jsonSchemaValidator_implementation"
9814
- * class MyValidatorProvider implements jsonSchemaValidator {
9815
- * getValidator<T>(schema: JsonSchemaType): JsonSchemaValidator<T> {
9816
- * // Compile/cache validator from schema
9817
- * return (input: unknown) =>
9818
- * isValid(schema, input)
9819
- * ? { valid: true, data: input as T, errorMessage: undefined }
9820
- * : { valid: false, data: undefined, errorMessage: 'Error details' };
9821
- * }
9822
- * }
9823
- * ```
9824
- */
9825
- interface jsonSchemaValidator {
9826
- /**
9827
- * Create a validator for the given JSON Schema
9828
- *
9829
- * @param schema - Standard JSON Schema object
9830
- * @returns A validator function that can be called multiple times
9831
- */
9832
- getValidator<T$1>(schema: JsonSchemaType): JsonSchemaValidator<T$1>;
9833
- }
9834
- //#endregion
9835
- //#region ../core/src/validators/ajvProvider.d.ts
9836
- /**
9837
- * @example Use with default AJV instance (recommended)
9838
- * ```ts source="./ajvProvider.examples.ts#AjvJsonSchemaValidator_default"
9839
- * const validator = new AjvJsonSchemaValidator();
9840
- * ```
9841
- *
9842
- * @example Use with custom AJV instance
9843
- * ```ts source="./ajvProvider.examples.ts#AjvJsonSchemaValidator_customInstance"
9844
- * const ajv = new Ajv({ strict: true, allErrors: true });
9845
- * const validator = new AjvJsonSchemaValidator(ajv);
9846
- * ```
9847
- *
9848
- * @see {@linkcode CfWorkerJsonSchemaValidator} for an edge-runtime-compatible alternative
9849
- */
9850
- declare class AjvJsonSchemaValidator implements jsonSchemaValidator {
9851
- private _ajv;
9852
- /**
9853
- * Create an AJV validator
9854
- *
9855
- * @param ajv - Optional pre-configured AJV instance. If not provided, a default instance will be created.
9856
- *
9857
- * @example Use default configuration (recommended for most cases)
9858
- * ```ts source="./ajvProvider.examples.ts#AjvJsonSchemaValidator_default"
9859
- * const validator = new AjvJsonSchemaValidator();
9860
- * ```
9861
- *
9862
- * @example Provide custom AJV instance for advanced configuration
9863
- * ```ts source="./ajvProvider.examples.ts#AjvJsonSchemaValidator_constructor_withFormats"
9864
- * const ajv = new Ajv({ validateFormats: true });
9865
- * addFormats(ajv);
9866
- * const validator = new AjvJsonSchemaValidator(ajv);
9867
- * ```
9868
- */
9869
- constructor(ajv?: Ajv);
9870
- /**
9871
- * Create a validator for the given JSON Schema
9872
- *
9873
- * The validator is compiled once and can be reused multiple times.
9874
- * If the schema has an `$id`, it will be cached by AJV automatically.
9875
- *
9876
- * @param schema - Standard JSON Schema object
9877
- * @returns A validator function that validates input data
9878
- */
9879
- getValidator<T$1>(schema: JsonSchemaType): JsonSchemaValidator<T$1>;
9880
- }
9881
- //#endregion
9882
- //#region ../core/src/validators/cfWorkerProvider.d.ts
9883
- /**
9884
- * JSON Schema draft version supported by @cfworker/json-schema
9885
- */
9886
- type CfWorkerSchemaDraft = '4' | '7' | '2019-09' | '2020-12';
9887
- /**
9888
- *
9889
- * @example Use with default configuration (2020-12, shortcircuit)
9890
- * ```ts source="./cfWorkerProvider.examples.ts#CfWorkerJsonSchemaValidator_default"
9891
- * const validator = new CfWorkerJsonSchemaValidator();
9892
- * ```
9893
- *
9894
- * @example Use with custom configuration
9895
- * ```ts source="./cfWorkerProvider.examples.ts#CfWorkerJsonSchemaValidator_customConfig"
9896
- * const validator = new CfWorkerJsonSchemaValidator({
9897
- * draft: '2020-12',
9898
- * shortcircuit: false // Report all errors
9899
- * });
9900
- * ```
9901
- */
9902
- declare class CfWorkerJsonSchemaValidator implements jsonSchemaValidator {
9903
- private shortcircuit;
9904
- private draft;
9905
- /**
9906
- * Create a validator
9907
- *
9908
- * @param options - Configuration options
9909
- * @param options.shortcircuit - If `true`, stop validation after first error (default: `true`)
9910
- * @param options.draft - JSON Schema draft version to use (default: `'2020-12'`)
9911
- */
9912
- constructor(options?: {
9913
- shortcircuit?: boolean;
9914
- draft?: CfWorkerSchemaDraft;
9915
- });
9916
- /**
9917
- * Create a validator for the given JSON Schema
9918
- *
9919
- * Unlike AJV, this validator is not cached internally
9920
- *
9921
- * @param schema - Standard JSON Schema object
9922
- * @returns A validator function that validates input data
9923
- */
9924
- getValidator<T$1>(schema: JsonSchemaType): JsonSchemaValidator<T$1>;
9925
- }
9926
- //#endregion
9927
- export { TaskStore as $, OAuthTokenRevocationRequest as $i, ModelPreferences as $n, SetLevelRequest as $r, ElicitationCompleteNotificationParams as $t, createFetchWithInit as A, INVALID_PARAMS as Ai, LegacyTitledEnumSchema as An, RequestParams as Ar, ClientRequest as At, TaskStatusMessage as B, SdkError as Bi, ListRootsRequest as Bn, ResourceUpdatedNotificationParams as Br, CreateMessageRequestParams as Bt, Protocol as C, UnsubscribeRequest as Ci, JSONRPCErrorResponse as Cn, ReadResourceResult as Cr, CallToolResult as Ct, FetchLike as D, ProtocolErrorCode as Di, JSONRPCResponse as Dn, RequestMeta as Dr, CancelledNotificationParams as Dt, ServerContext as E, UntitledSingleSelectEnumSchema as Ei, JSONRPCRequest as En, RequestId as Er, CancelledNotification as Et, BaseResponseMessage as F, PARSE_ERROR as Fi, ListPromptsResult as Fn, ResourceListChangedNotification as Fr, CompleteRequestPrompt as Ft, CreateTaskServerContext as G, OAuthClientInformation as Gi, ListToolsResult as Gn, RootsListChangedNotification as Gr, CreateTaskResult as Gt, toArrayAsync as H, OAuthError as Hi, ListTasksRequest as Hn, ResultTypeMap as Hr, CreateMessageRequestParamsWithTools as Ht, ErrorMessage as I, RELATED_TASK_META_KEY as Ii, ListResourceTemplatesRequest as In, ResourceRequestParams as Ir, CompleteRequestResourceTemplate as It, QueuedNotification as J, OAuthClientMetadata as Ji, LoggingMessageNotificationParams as Jn, SamplingMessageContentBlock as Jr, ElicitRequestFormParams as Jt, QueuedError as K, OAuthClientInformationFull as Ki, LoggingLevel as Kn, SamplingContent as Kr, Cursor as Kt, ResponseMessage as L, SUPPORTED_PROTOCOL_VERSIONS as Li, ListResourceTemplatesResult as Ln, ResourceTemplateReference as Lr, CompleteResult as Lt, TaskContext as M, JSONRPC_VERSION as Mi, ListChangedHandlers as Mn, Resource as Mr, CompatibilityCallToolResult as Mt, TaskManagerOptions as N, LATEST_PROTOCOL_VERSION as Ni, ListChangedOptions as Nn, ResourceContents as Nr, CompleteRequest as Nt, Transport as O, DEFAULT_NEGOTIATED_PROTOCOL_VERSION as Oi, JSONRPCResultResponse as On, RequestMetaObject as Or, ClientCapabilities as Ot, TaskRequestOptions as P, METHOD_NOT_FOUND as Pi, ListPromptsRequest as Pn, ResourceLink as Pr, CompleteRequestParams as Pt, TaskServerContext as Q, OAuthProtectedResourceMetadata as Qi, ModelHint as Qn, ServerResult as Qr, ElicitationCompleteNotification as Qt, ResultMessage as R, checkResourceAllowed as Ri, ListResourcesRequest as Rn, ResourceTemplateType as Rr, ContentBlock as Rt, ProgressCallback as S, ToolUseContent as Si, JSONObject as Sn, ReadResourceRequestParams as Sr, CallToolRequestParams as St, RequestOptions as T, UntitledMultiSelectEnumSchema as Ti, JSONRPCNotification as Tn, Request as Tr, CancelTaskResult as Tt, BaseQueuedMessage as U, OAuthErrorCode as Ui, ListTasksResult as Un, Role as Ur, CreateMessageResult as Ut, takeResult as V, SdkErrorCode as Vi, ListRootsResult as Vn, Result$1 as Vr, CreateMessageRequestParamsBase as Vt, CreateTaskOptions as W, AuthorizationServerMetadata as Wi, ListToolsRequest as Wn, Root as Wr, CreateMessageResultWithTools as Wt, QueuedResponse as X, OAuthErrorResponse as Xi, MetaObject as Xn, ServerNotification as Xr, ElicitRequestURLParams as Xt, QueuedRequest as Y, OAuthClientRegistrationError as Yi, MessageExtraInfo as Yn, ServerCapabilities as Yr, ElicitRequestParams as Yt, TaskMessageQueue as Z, OAuthMetadata as Zi, MethodNotFoundError as Zn, ServerRequest as Zr, ElicitResult as Zt, serializeMessage as _, ToolAnnotations as _i, InitializedNotification as _n, PromptArgument as _r, AuthInfo as _t, JsonSchemaValidator as a, Task as ai, GetPromptResult as an, NumberSchema as ar, isInitializeRequest as at, DEFAULT_REQUEST_TIMEOUT_MSEC as b, ToolListChangedNotification as bi, InvalidRequestError as bn, PromptReference as br, BooleanSchema as bt, InMemoryTaskMessageQueue as c, TaskMetadata as ci, GetTaskRequest as cn, PaginatedResult as cr, isJSONRPCNotification as ct, assertToolsCallTaskCapability as d, TaskStatusNotificationParams as di, Icons as dn, PrimitiveSchemaDefinition as dr, isTaskAugmentedRequestParams as dt, OAuthTokens as ea, SetLevelRequestParams as ei, EmbeddedResource as en, MultiSelectEnumSchema as er, TaskToolExecution as et, StandardSchemaWithJSON as f, TextContent as fi, ImageContent as fn, Progress as fr, parseJSONRPCMessage as ft, deserializeMessage as g, Tool as gi, InitializeResult as gn, Prompt as gr, AudioContent as gt, ReadBuffer as h, TitledSingleSelectEnumSchema as hi, InitializeRequestParams as hn, ProgressToken as hr, Annotations as ht, JsonSchemaType as i, SubscribeRequestParams as ii, GetPromptRequestParams as in, NotificationTypeMap as ir, assertCompleteRequestResourceTemplate as it, RequestTaskStore as j, INVALID_REQUEST as ji, ListChangedCallback as jn, RequestTypeMap as jr, ClientResult as jt, TransportSendOptions as k, INTERNAL_ERROR as ki, JSONValue as kn, RequestMethod as kr, ClientNotification as kt, InMemoryTaskStore as l, TaskStatus as li, GetTaskResult as ln, ParseError as lr, isJSONRPCRequest as lt, Variables as m, TitledMultiSelectEnumSchema as mi, InitializeRequest as mn, ProgressNotificationParams as mr, UrlElicitationRequiredError as mt, CfWorkerSchemaDraft as n, OpenIdProviderMetadata as na, StringSchema as ni, EnumSchema as nn, NotificationMethod as nr, getDisplayName as nt, JsonSchemaValidatorResult as o, TaskAugmentedRequestParams as oi, GetTaskPayloadRequest as on, PaginatedRequest as or, isInitializedNotification as ot, UriTemplate as p, TextResourceContents as pi, Implementation as pn, ProgressNotification as pr, ProtocolError as pt, QueuedMessage as q, OAuthClientInformationMixed as qi, LoggingMessageNotification as qn, SamplingMessage as qr, ElicitRequest as qt, AjvJsonSchemaValidator as r, SubscribeRequest as ri, GetPromptRequest as rn, NotificationParams as rr, assertCompleteRequestPrompt as rt, jsonSchemaValidator as s, TaskCreationParams as si, GetTaskPayloadResult as sn, PaginatedRequestParams as sr, isJSONRPCErrorResponse as st, CfWorkerJsonSchemaValidator as t, OpenIdProviderDiscoveryMetadata as ta, SingleSelectEnumSchema as ti, EmptyResult as tn, Notification as tr, isTerminal as tt, assertClientRequestTaskCapability as u, TaskStatusNotification as ui, Icon as un, PingRequest as ur, isJSONRPCResultResponse as ut, BaseContext as v, ToolChoice as vi, InternalError as vn, PromptListChangedNotification as vr, BaseMetadata as vt, ProtocolOptions as w, UnsubscribeRequestParams as wi, JSONRPCMessage as wn, RelatedTaskMetadata as wr, CancelTaskRequest as wt, NotificationOptions as x, ToolResultContent as xi, JSONArray as xn, ReadResourceRequest as xr, CallToolRequest as xt, ClientContext as y, ToolExecution as yi, InvalidParamsError as yn, PromptMessage as yr, BlobResourceContents as yt, TaskCreatedMessage as z, resourceUrlFromServerUrl as zi, ListResourcesResult as zn, ResourceUpdatedNotification as zr, CreateMessageRequest as zt };
9928
- //# sourceMappingURL=index-Bhfkexnj.d.mts.map
8656
+ export { GetTaskPayloadResult as $, TaskAugmentedRequestParams as $n, PaginatedRequestParams as $t, CreateMessageRequestParams as A, ResourceTemplateReference as An, LATEST_PROTOCOL_VERSION as Ar, ListResourcesRequest as At, ElicitRequestFormParams as B, SamplingMessage as Bn, LoggingMessageNotificationParams as Bt, CompleteRequest as C, RequestParams as Cn, CLIENT_CAPABILITIES_META_KEY as Cr, ListChangedCallback as Ct, CompleteResult as D, ResourceLink as Dn, INVALID_PARAMS as Dr, ListPromptsResult as Dt, CompleteRequestResourceTemplate as E, ResourceContents as En, INTERNAL_ERROR as Er, ListPromptsRequest as Et, CreateTaskResult as F, ResultTypeMap as Fn, RELATED_TASK_META_KEY as Fr, ListTasksResult as Ft, ElicitationCompleteNotificationParams as G, ServerResult as Gn, ModelPreferences as Gt, ElicitRequestURLParams as H, ServerCapabilities as Hn, MetaObject as Ht, Cursor as I, Role as In, SUPPORTED_PROTOCOL_VERSIONS as Ir, ListToolsRequest as It, EnumSchema as J, SingleSelectEnumSchema as Jn, NotificationMethod as Jt, EmbeddedResource as K, SetLevelRequest as Kn, MultiSelectEnumSchema as Kt, DiscoverRequest as L, Root as Ln, TRACEPARENT_META_KEY as Lr, ListToolsResult as Lt, CreateMessageRequestParamsWithTools as M, ResourceUpdatedNotification as Mn, METHOD_NOT_FOUND as Mr, ListRootsRequest as Mt, CreateMessageResult as N, ResourceUpdatedNotificationParams as Nn, PARSE_ERROR as Nr, ListRootsResult as Nt, ContentBlock as O, ResourceListChangedNotification as On, INVALID_REQUEST as Or, ListResourceTemplatesRequest as Ot, CreateMessageResultWithTools as P, Result as Pn, PROTOCOL_VERSION_META_KEY as Pr, ListTasksRequest as Pt, GetTaskPayloadRequest as Q, Task as Qn, PaginatedRequest as Qt, DiscoverResult as R, RootsListChangedNotification as Rn, TRACESTATE_META_KEY as Rr, LoggingLevel as Rt, CompatibilityCallToolResult as S, RequestMethod as Sn, BAGGAGE_META_KEY as Sr, LegacyTitledEnumSchema as St, CompleteRequestPrompt as T, Resource as Tn, DEFAULT_NEGOTIATED_PROTOCOL_VERSION as Tr, ListChangedOptions as Tt, ElicitResult as U, ServerNotification as Un, MethodNotFoundError as Ut, ElicitRequestParams as V, SamplingMessageContentBlock as Vn, MessageExtraInfo as Vt, ElicitationCompleteNotification as W, ServerRequest as Wn, ModelHint as Wt, GetPromptRequestParams as X, SubscribeRequest as Xn, NotificationTypeMap as Xt, GetPromptRequest as Y, StringSchema as Yn, NotificationParams as Yt, GetPromptResult as Z, SubscribeRequestParams as Zn, NumberSchema as Zt, CancelledNotificationParams as _, Request as _n, UnsubscribeRequestParams as _r, JSONRPCNotification as _t, Annotations as a, ProgressNotification as an, TextContent as ar, Implementation as at, ClientRequest as b, RequestMetaEnvelope as bn, UntitledSingleSelectEnumSchema as br, JSONRPCResultResponse as bt, BaseMetadata as c, Prompt as cn, TitledSingleSelectEnumSchema as cr, InitializeResult as ct, CallToolRequest as d, PromptMessage as dn, ToolChoice as dr, InvalidParamsError as dt, PaginatedResult as en, TaskCreationParams as er, GetTaskRequest as et, CallToolRequestParams as f, PromptReference as fn, ToolExecution as fr, InvalidRequestError as ft, CancelledNotification as g, RelatedTaskMetadata as gn, UnsubscribeRequest as gr, JSONRPCMessage as gt, CancelTaskResult as h, ReadResourceResult as hn, ToolUseContent as hr, JSONRPCErrorResponse as ht, createFetchWithInit as i, Progress as in, TaskStatusNotificationParams as ir, ImageContent as it, CreateMessageRequestParamsBase as j, ResourceTemplateType as jn, LOG_LEVEL_META_KEY as jr, ListResourcesResult as jt, CreateMessageRequest as k, ResourceRequestParams as kn, JSONRPC_VERSION as kr, ListResourceTemplatesResult as kt, BlobResourceContents as l, PromptArgument as ln, Tool as lr, InitializedNotification as lt, CancelTaskRequest as m, ReadResourceRequestParams as mn, ToolResultContent as mr, JSONObject as mt, Transport as n, PingRequest as nn, TaskStatus as nr, Icon as nt, AudioContent as o, ProgressNotificationParams as on, TextResourceContents as or, InitializeRequest as ot, CallToolResult as p, ReadResourceRequest as pn, ToolListChangedNotification as pr, JSONArray as pt, EmptyResult as q, SetLevelRequestParams as qn, Notification as qt, TransportSendOptions as r, PrimitiveSchemaDefinition as rn, TaskStatusNotification as rr, Icons as rt, AuthInfo as s, ProgressToken as sn, TitledMultiSelectEnumSchema as sr, InitializeRequestParams as st, FetchLike as t, ParseError as tn, TaskMetadata as tr, GetTaskResult as tt, BooleanSchema as u, PromptListChangedNotification as un, ToolAnnotations as ur, InternalError as ut, ClientCapabilities as v, RequestId as vn, UnsupportedProtocolVersionErrorData as vr, JSONRPCRequest as vt, CompleteRequestParams as w, RequestTypeMap as wn, CLIENT_INFO_META_KEY as wr, ListChangedHandlers as wt, ClientResult as x, RequestMetaObject as xn, schemas_d_exports as xr, JSONValue as xt, ClientNotification as y, RequestMeta as yn, UntitledMultiSelectEnumSchema as yr, JSONRPCResponse as yt, ElicitRequest as z, SamplingContent as zn, LoggingMessageNotification as zt };
8657
+ //# sourceMappingURL=transport-DMKhEchd.d.mts.map