@ai-sdk/mcp 2.0.61 → 2.0.63

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.
package/dist/index.d.ts CHANGED
@@ -1,102 +1,103 @@
1
- import { z } from 'zod/v4';
2
- import { FetchFunction, FlexibleSchema, Tool } from '@ai-sdk/provider-utils';
3
- import { JSONObject } from '@ai-sdk/provider';
4
-
1
+ import { FetchFunction, FlexibleSchema, Tool } from "@ai-sdk/provider-utils";
2
+ import { z } from "zod/v4";
3
+ import { AISDKError, JSONObject } from "@ai-sdk/provider";
4
+ //#region src/tool/json-rpc-message.d.ts
5
5
  declare const JSONRPCRequestSchema: z.ZodObject<{
6
- jsonrpc: z.ZodLiteral<"2.0">;
7
- id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
8
- method: z.ZodString;
9
- params: z.ZodOptional<z.ZodObject<{
10
- _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
11
- }, z.core.$loose>>;
6
+ jsonrpc: z.ZodLiteral<"2.0">;
7
+ id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
8
+ method: z.ZodString;
9
+ params: z.ZodOptional<z.ZodObject<{
10
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
11
+ }, z.core.$loose>>;
12
12
  }, z.core.$strict>;
13
13
  type JSONRPCRequest = z.infer<typeof JSONRPCRequestSchema>;
14
14
  declare const JSONRPCResponseSchema: z.ZodObject<{
15
- jsonrpc: z.ZodLiteral<"2.0">;
16
- id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
17
- result: z.ZodObject<{
18
- _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
19
- resultType: z.ZodOptional<z.ZodString>;
20
- }, z.core.$loose>;
15
+ jsonrpc: z.ZodLiteral<"2.0">;
16
+ id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
17
+ result: z.ZodObject<{
18
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
19
+ resultType: z.ZodOptional<z.ZodString>;
20
+ }, z.core.$loose>;
21
21
  }, z.core.$strict>;
22
22
  type JSONRPCResponse = z.infer<typeof JSONRPCResponseSchema>;
23
23
  declare const JSONRPCErrorSchema: z.ZodObject<{
24
- jsonrpc: z.ZodLiteral<"2.0">;
25
- id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
26
- error: z.ZodObject<{
27
- code: z.ZodNumber;
28
- message: z.ZodString;
29
- data: z.ZodOptional<z.ZodUnknown>;
30
- }, z.core.$strip>;
24
+ jsonrpc: z.ZodLiteral<"2.0">;
25
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
26
+ error: z.ZodObject<{
27
+ code: z.ZodNumber;
28
+ message: z.ZodString;
29
+ data: z.ZodOptional<z.ZodUnknown>;
30
+ }, z.core.$strip>;
31
31
  }, z.core.$strict>;
32
32
  type JSONRPCError = z.infer<typeof JSONRPCErrorSchema>;
33
33
  declare const JSONRPCNotificationSchema: z.ZodObject<{
34
- jsonrpc: z.ZodLiteral<"2.0">;
35
- method: z.ZodString;
36
- params: z.ZodOptional<z.ZodObject<{
37
- _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
38
- }, z.core.$loose>>;
34
+ jsonrpc: z.ZodLiteral<"2.0">;
35
+ method: z.ZodString;
36
+ params: z.ZodOptional<z.ZodObject<{
37
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
38
+ }, z.core.$loose>>;
39
39
  }, z.core.$strict>;
40
40
  type JSONRPCNotification = z.infer<typeof JSONRPCNotificationSchema>;
41
41
  declare const JSONRPCMessageSchema: z.ZodUnion<readonly [z.ZodObject<{
42
- jsonrpc: z.ZodLiteral<"2.0">;
43
- id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
44
- method: z.ZodString;
45
- params: z.ZodOptional<z.ZodObject<{
46
- _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
47
- }, z.core.$loose>>;
42
+ jsonrpc: z.ZodLiteral<"2.0">;
43
+ id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
44
+ method: z.ZodString;
45
+ params: z.ZodOptional<z.ZodObject<{
46
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
47
+ }, z.core.$loose>>;
48
48
  }, z.core.$strict>, z.ZodObject<{
49
- jsonrpc: z.ZodLiteral<"2.0">;
50
- method: z.ZodString;
51
- params: z.ZodOptional<z.ZodObject<{
52
- _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
53
- }, z.core.$loose>>;
49
+ jsonrpc: z.ZodLiteral<"2.0">;
50
+ method: z.ZodString;
51
+ params: z.ZodOptional<z.ZodObject<{
52
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
53
+ }, z.core.$loose>>;
54
54
  }, z.core.$strict>, z.ZodObject<{
55
- jsonrpc: z.ZodLiteral<"2.0">;
56
- id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
57
- result: z.ZodObject<{
58
- _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
59
- resultType: z.ZodOptional<z.ZodString>;
60
- }, z.core.$loose>;
55
+ jsonrpc: z.ZodLiteral<"2.0">;
56
+ id: z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>;
57
+ result: z.ZodObject<{
58
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
59
+ resultType: z.ZodOptional<z.ZodString>;
60
+ }, z.core.$loose>;
61
61
  }, z.core.$strict>, z.ZodObject<{
62
- jsonrpc: z.ZodLiteral<"2.0">;
63
- id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
64
- error: z.ZodObject<{
65
- code: z.ZodNumber;
66
- message: z.ZodString;
67
- data: z.ZodOptional<z.ZodUnknown>;
68
- }, z.core.$strip>;
62
+ jsonrpc: z.ZodLiteral<"2.0">;
63
+ id: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodNumber]>>;
64
+ error: z.ZodObject<{
65
+ code: z.ZodNumber;
66
+ message: z.ZodString;
67
+ data: z.ZodOptional<z.ZodUnknown>;
68
+ }, z.core.$strip>;
69
69
  }, z.core.$strict>]>;
70
70
  type JSONRPCMessage = z.infer<typeof JSONRPCMessageSchema>;
71
- declare function validateJSONRPCMessage(message: unknown): JSONRPCMessage;
72
-
71
+ export declare function validateJSONRPCMessage(message: unknown): JSONRPCMessage;
72
+ //#endregion
73
+ //#region src/tool/oauth-types.d.ts
73
74
  /**
74
75
  * OAuth 2.1 token response
75
76
  */
76
77
  declare const OAuthTokensSchema: z.ZodObject<{
77
- access_token: z.ZodString;
78
- id_token: z.ZodOptional<z.ZodString>;
79
- token_type: z.ZodString;
80
- expires_in: z.ZodOptional<z.ZodNumber>;
81
- scope: z.ZodOptional<z.ZodString>;
82
- refresh_token: z.ZodOptional<z.ZodString>;
83
- issuer: z.ZodOptional<z.ZodString>;
84
- authorization_server: z.ZodOptional<z.ZodString>;
85
- token_endpoint: z.ZodOptional<z.ZodString>;
78
+ access_token: z.ZodString;
79
+ id_token: z.ZodOptional<z.ZodString>;
80
+ token_type: z.ZodString;
81
+ expires_in: z.ZodOptional<z.ZodNumber>;
82
+ scope: z.ZodOptional<z.ZodString>;
83
+ refresh_token: z.ZodOptional<z.ZodString>;
84
+ issuer: z.ZodOptional<z.ZodString>;
85
+ authorization_server: z.ZodOptional<z.ZodString>;
86
+ token_endpoint: z.ZodOptional<z.ZodString>;
86
87
  }, z.core.$strip>;
87
88
  declare const OAuthMetadataSchema: z.ZodObject<{
88
- issuer: z.ZodString;
89
- authorization_endpoint: z.ZodString;
90
- token_endpoint: z.ZodString;
91
- registration_endpoint: z.ZodOptional<z.ZodString>;
92
- authorization_response_iss_parameter_supported: z.ZodOptional<z.ZodBoolean>;
93
- client_id_metadata_document_supported: z.ZodOptional<z.ZodBoolean>;
94
- scopes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
95
- response_types_supported: z.ZodArray<z.ZodString>;
96
- grant_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
97
- code_challenge_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
98
- token_endpoint_auth_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
99
- token_endpoint_auth_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
89
+ issuer: z.ZodString;
90
+ authorization_endpoint: z.ZodString;
91
+ token_endpoint: z.ZodString;
92
+ registration_endpoint: z.ZodOptional<z.ZodString>;
93
+ authorization_response_iss_parameter_supported: z.ZodOptional<z.ZodBoolean>;
94
+ client_id_metadata_document_supported: z.ZodOptional<z.ZodBoolean>;
95
+ scopes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
96
+ response_types_supported: z.ZodArray<z.ZodString>;
97
+ grant_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
98
+ code_challenge_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
99
+ token_endpoint_auth_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
100
+ token_endpoint_auth_signing_alg_values_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
100
101
  }, z.core.$loose>;
101
102
  /**
102
103
  * OpenID Connect Discovery metadata that may include OAuth 2.0 fields
@@ -104,50 +105,50 @@ declare const OAuthMetadataSchema: z.ZodObject<{
104
105
  * return a mix of OpenID Connect and OAuth 2.0 metadata fields
105
106
  */
106
107
  declare const OpenIdProviderDiscoveryMetadataSchema: z.ZodObject<{
107
- issuer: z.ZodString;
108
- authorization_endpoint: z.ZodString;
109
- token_endpoint: z.ZodString;
110
- userinfo_endpoint: z.ZodOptional<z.ZodString>;
111
- jwks_uri: z.ZodString;
112
- registration_endpoint: z.ZodOptional<z.ZodString>;
113
- authorization_response_iss_parameter_supported: z.ZodOptional<z.ZodBoolean>;
114
- client_id_metadata_document_supported: z.ZodOptional<z.ZodBoolean>;
115
- scopes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
116
- response_types_supported: z.ZodArray<z.ZodString>;
117
- grant_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
118
- subject_types_supported: z.ZodArray<z.ZodString>;
119
- id_token_signing_alg_values_supported: z.ZodArray<z.ZodString>;
120
- claims_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
121
- token_endpoint_auth_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
122
- code_challenge_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
108
+ issuer: z.ZodString;
109
+ authorization_endpoint: z.ZodString;
110
+ token_endpoint: z.ZodString;
111
+ userinfo_endpoint: z.ZodOptional<z.ZodString>;
112
+ jwks_uri: z.ZodString;
113
+ registration_endpoint: z.ZodOptional<z.ZodString>;
114
+ authorization_response_iss_parameter_supported: z.ZodOptional<z.ZodBoolean>;
115
+ client_id_metadata_document_supported: z.ZodOptional<z.ZodBoolean>;
116
+ scopes_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
117
+ response_types_supported: z.ZodArray<z.ZodString>;
118
+ grant_types_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
119
+ subject_types_supported: z.ZodArray<z.ZodString>;
120
+ id_token_signing_alg_values_supported: z.ZodArray<z.ZodString>;
121
+ claims_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
122
+ token_endpoint_auth_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
123
+ code_challenge_methods_supported: z.ZodOptional<z.ZodArray<z.ZodString>>;
123
124
  }, z.core.$loose>;
124
125
  declare const OAuthClientInformationSchema: z.ZodObject<{
125
- client_id: z.ZodString;
126
- client_secret: z.ZodOptional<z.ZodString>;
127
- client_id_issued_at: z.ZodOptional<z.ZodNumber>;
128
- client_secret_expires_at: z.ZodOptional<z.ZodNumber>;
129
- issuer: z.ZodOptional<z.ZodString>;
130
- authorization_server: z.ZodOptional<z.ZodString>;
131
- token_endpoint: z.ZodOptional<z.ZodString>;
126
+ client_id: z.ZodString;
127
+ client_secret: z.ZodOptional<z.ZodString>;
128
+ client_id_issued_at: z.ZodOptional<z.ZodNumber>;
129
+ client_secret_expires_at: z.ZodOptional<z.ZodNumber>;
130
+ issuer: z.ZodOptional<z.ZodString>;
131
+ authorization_server: z.ZodOptional<z.ZodString>;
132
+ token_endpoint: z.ZodOptional<z.ZodString>;
132
133
  }, z.core.$strip>;
133
134
  declare const OAuthClientMetadataSchema: z.ZodObject<{
134
- redirect_uris: z.ZodArray<z.ZodString>;
135
- application_type: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"native">, z.ZodLiteral<"web">]>>;
136
- token_endpoint_auth_method: z.ZodOptional<z.ZodString>;
137
- grant_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
138
- response_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
139
- client_name: z.ZodOptional<z.ZodString>;
140
- client_uri: z.ZodOptional<z.ZodString>;
141
- logo_uri: z.ZodOptional<z.ZodString>;
142
- scope: z.ZodOptional<z.ZodString>;
143
- contacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
144
- tos_uri: z.ZodOptional<z.ZodString>;
145
- policy_uri: z.ZodOptional<z.ZodString>;
146
- jwks_uri: z.ZodOptional<z.ZodString>;
147
- jwks: z.ZodOptional<z.ZodAny>;
148
- software_id: z.ZodOptional<z.ZodString>;
149
- software_version: z.ZodOptional<z.ZodString>;
150
- software_statement: z.ZodOptional<z.ZodString>;
135
+ redirect_uris: z.ZodArray<z.ZodString>;
136
+ application_type: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<"native">, z.ZodLiteral<"web">]>>;
137
+ token_endpoint_auth_method: z.ZodOptional<z.ZodString>;
138
+ grant_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
139
+ response_types: z.ZodOptional<z.ZodArray<z.ZodString>>;
140
+ client_name: z.ZodOptional<z.ZodString>;
141
+ client_uri: z.ZodOptional<z.ZodString>;
142
+ logo_uri: z.ZodOptional<z.ZodString>;
143
+ scope: z.ZodOptional<z.ZodString>;
144
+ contacts: z.ZodOptional<z.ZodArray<z.ZodString>>;
145
+ tos_uri: z.ZodOptional<z.ZodString>;
146
+ policy_uri: z.ZodOptional<z.ZodString>;
147
+ jwks_uri: z.ZodOptional<z.ZodString>;
148
+ jwks: z.ZodOptional<z.ZodAny>;
149
+ software_id: z.ZodOptional<z.ZodString>;
150
+ software_version: z.ZodOptional<z.ZodString>;
151
+ software_statement: z.ZodOptional<z.ZodString>;
151
152
  }, z.core.$strip>;
152
153
  type OAuthMetadata = z.infer<typeof OAuthMetadataSchema>;
153
154
  type OpenIdProviderDiscoveryMetadata = z.infer<typeof OpenIdProviderDiscoveryMetadataSchema>;
@@ -155,236 +156,239 @@ type OAuthTokens = z.infer<typeof OAuthTokensSchema>;
155
156
  type OAuthClientInformation = z.infer<typeof OAuthClientInformationSchema>;
156
157
  type AuthorizationServerMetadata = OAuthMetadata | OpenIdProviderDiscoveryMetadata;
157
158
  type OAuthClientMetadata = z.infer<typeof OAuthClientMetadataSchema>;
158
-
159
+ //#endregion
160
+ //#region src/tool/oauth.d.ts
159
161
  type AuthResult = 'AUTHORIZED' | 'REDIRECT';
160
162
  interface OAuthAuthorizationServerInformation {
161
- issuer?: string;
162
- authorizationServerUrl: string;
163
- tokenEndpoint: string;
163
+ issuer?: string;
164
+ authorizationServerUrl: string;
165
+ tokenEndpoint: string;
164
166
  }
165
167
  interface OAuthClientProvider {
166
- /**
167
- * Returns current access token if present; undefined otherwise.
168
- */
169
- tokens(): OAuthTokens | undefined | Promise<OAuthTokens | undefined>;
170
- saveTokens(tokens: OAuthTokens): void | Promise<void>;
171
- redirectToAuthorization(authorizationUrl: URL): void | Promise<void>;
172
- saveCodeVerifier(codeVerifier: string): void | Promise<void>;
173
- codeVerifier(): string | Promise<string>;
174
- /**
175
- * Adds custom client authentication to OAuth token requests.
176
- *
177
- * This optional method allows implementations to customize how client credentials
178
- * are included in token exchange and refresh requests. When provided, this method
179
- * is called instead of the default authentication logic, giving full control over
180
- * the authentication mechanism.
181
- *
182
- * Common use cases include:
183
- * - Supporting authentication methods beyond the standard OAuth 2.0 methods
184
- * - Adding custom headers for proprietary authentication schemes
185
- * - Implementing client assertion-based authentication (e.g., JWT bearer tokens)
186
- *
187
- * @param headers - The request headers (can be modified to add authentication)
188
- * @param params - The request body parameters (can be modified to add credentials)
189
- * @param url - The token endpoint URL being called
190
- * @param metadata - Optional OAuth metadata for the server, which may include supported authentication methods
191
- */
192
- addClientAuthentication?(headers: Headers, params: URLSearchParams, url: string | URL, metadata?: AuthorizationServerMetadata): void | Promise<void>;
193
- /**
194
- * If implemented, provides a way for the client to invalidate (e.g. delete) the specified
195
- * credentials, in the case where the server has indicated that they are no longer valid.
196
- * This avoids requiring the user to intervene manually.
197
- */
198
- invalidateCredentials?(scope: 'all' | 'client' | 'tokens' | 'verifier'): void | Promise<void>;
199
- get redirectUrl(): string | URL;
200
- get clientMetadata(): OAuthClientMetadata;
201
- clientInformation(): OAuthClientInformation | undefined | Promise<OAuthClientInformation | undefined>;
202
- /**
203
- * Returns whether the current client information was obtained through
204
- * dynamic client registration.
205
- *
206
- * Return `true` only when the current client information was saved after a
207
- * dynamic registration response. When this method is omitted or returns
208
- * `false`, the client information is treated as pre-registered and is not
209
- * automatically invalidated after client authentication errors.
210
- */
211
- isClientInformationDynamicallyRegistered?(): boolean | Promise<boolean>;
212
- saveClientInformation?(clientInformation: OAuthClientInformation): void | Promise<void>;
213
- authorizationServerInformation?(): OAuthAuthorizationServerInformation | undefined | Promise<OAuthAuthorizationServerInformation | undefined>;
214
- saveAuthorizationServerInformation?(authorizationServerInformation: OAuthAuthorizationServerInformation): void | Promise<void>;
215
- /**
216
- * Validates an authorization server URL discovered from MCP protected resource
217
- * metadata before the client fetches its OAuth metadata.
218
- */
219
- validateAuthorizationServerURL?(serverUrl: string | URL, authorizationServerUrl: string | URL): void | Promise<void>;
220
- state?(): string | Promise<string>;
221
- saveState?(state: string): void | Promise<void>;
222
- storedState?(): string | undefined | Promise<string | undefined>;
223
- validateResourceURL?(serverUrl: string | URL, resource?: string): Promise<URL | undefined>;
168
+ /**
169
+ * Returns current access token if present; undefined otherwise.
170
+ */
171
+ tokens(): OAuthTokens | undefined | Promise<OAuthTokens | undefined>;
172
+ saveTokens(tokens: OAuthTokens): void | Promise<void>;
173
+ redirectToAuthorization(authorizationUrl: URL): void | Promise<void>;
174
+ saveCodeVerifier(codeVerifier: string): void | Promise<void>;
175
+ codeVerifier(): string | Promise<string>;
176
+ /**
177
+ * Adds custom client authentication to OAuth token requests.
178
+ *
179
+ * This optional method allows implementations to customize how client credentials
180
+ * are included in token exchange and refresh requests. When provided, this method
181
+ * is called instead of the default authentication logic, giving full control over
182
+ * the authentication mechanism.
183
+ *
184
+ * Common use cases include:
185
+ * - Supporting authentication methods beyond the standard OAuth 2.0 methods
186
+ * - Adding custom headers for proprietary authentication schemes
187
+ * - Implementing client assertion-based authentication (e.g., JWT bearer tokens)
188
+ *
189
+ * @param headers - The request headers (can be modified to add authentication)
190
+ * @param params - The request body parameters (can be modified to add credentials)
191
+ * @param url - The token endpoint URL being called
192
+ * @param metadata - Optional OAuth metadata for the server, which may include supported authentication methods
193
+ */
194
+ addClientAuthentication?(headers: Headers, params: URLSearchParams, url: string | URL, metadata?: AuthorizationServerMetadata): void | Promise<void>;
195
+ /**
196
+ * If implemented, provides a way for the client to invalidate (e.g. delete) the specified
197
+ * credentials, in the case where the server has indicated that they are no longer valid.
198
+ * This avoids requiring the user to intervene manually.
199
+ */
200
+ invalidateCredentials?(scope: 'all' | 'client' | 'tokens' | 'verifier'): void | Promise<void>;
201
+ get redirectUrl(): string | URL;
202
+ get clientMetadata(): OAuthClientMetadata;
203
+ clientInformation(): OAuthClientInformation | undefined | Promise<OAuthClientInformation | undefined>;
204
+ /**
205
+ * Returns whether the current client information was obtained through
206
+ * dynamic client registration.
207
+ *
208
+ * Return `true` only when the current client information was saved after a
209
+ * dynamic registration response. When this method is omitted or returns
210
+ * `false`, the client information is treated as pre-registered and is not
211
+ * automatically invalidated after client authentication errors.
212
+ */
213
+ isClientInformationDynamicallyRegistered?(): boolean | Promise<boolean>;
214
+ saveClientInformation?(clientInformation: OAuthClientInformation): void | Promise<void>;
215
+ authorizationServerInformation?(): OAuthAuthorizationServerInformation | undefined | Promise<OAuthAuthorizationServerInformation | undefined>;
216
+ saveAuthorizationServerInformation?(authorizationServerInformation: OAuthAuthorizationServerInformation): void | Promise<void>;
217
+ /**
218
+ * Validates an authorization server URL discovered from MCP protected resource
219
+ * metadata before the client fetches its OAuth metadata.
220
+ */
221
+ validateAuthorizationServerURL?(serverUrl: string | URL, authorizationServerUrl: string | URL): void | Promise<void>;
222
+ state?(): string | Promise<string>;
223
+ saveState?(state: string): void | Promise<void>;
224
+ storedState?(): string | undefined | Promise<string | undefined>;
225
+ validateResourceURL?(serverUrl: string | URL, resource?: string): Promise<URL | undefined>;
224
226
  }
225
- declare class UnauthorizedError extends Error {
226
- constructor(message?: string);
227
+ export declare class UnauthorizedError extends Error {
228
+ constructor(message?: string);
227
229
  }
228
- declare function auth(provider: OAuthClientProvider, options: {
229
- serverUrl: string | URL;
230
- authorizationCode?: string;
231
- callbackState?: string;
232
- /**
233
- * Value of the `iss` parameter from the authorization response.
234
- */
235
- callbackIssuer?: string;
236
- scope?: string;
237
- resourceMetadataUrl?: URL;
238
- fetchFn?: FetchFunction;
230
+ export declare function auth(provider: OAuthClientProvider, options: {
231
+ serverUrl: string | URL;
232
+ authorizationCode?: string;
233
+ callbackState?: string;
234
+ /**
235
+ * Value of the `iss` parameter from the authorization response.
236
+ */
237
+ callbackIssuer?: string;
238
+ scope?: string;
239
+ resourceMetadataUrl?: URL;
240
+ fetchFn?: FetchFunction;
239
241
  }): Promise<AuthResult>;
240
-
242
+ //#endregion
243
+ //#region src/tool/mcp-transport.d.ts
241
244
  /**
242
245
  * Transport interface for MCP (Model Context Protocol) communication.
243
246
  * Maps to the `Transport` interface in the MCP spec.
244
247
  */
245
248
  type MCPTransportSendOptions = {
246
- /**
247
- * Cancels the transport operation for this message.
248
- */
249
- signal?: AbortSignal;
250
- /**
251
- * Request-specific HTTP headers produced from MCP tool parameters.
252
- */
253
- headers?: Record<string, string>;
254
- /**
255
- * Associates an outgoing message with an incoming request.
256
- */
257
- relatedRequestId?: string | number;
258
- /**
259
- * Resumes a previously interrupted request.
260
- */
261
- resumptionToken?: string;
262
- /**
263
- * Receives updated resumption tokens from transports that support them.
264
- */
265
- onresumptiontoken?: (token: string) => void;
249
+ /**
250
+ * Cancels the transport operation for this message.
251
+ */
252
+ signal?: AbortSignal;
253
+ /**
254
+ * Request-specific HTTP headers produced from MCP tool parameters.
255
+ */
256
+ headers?: Record<string, string>;
257
+ /**
258
+ * Associates an outgoing message with an incoming request.
259
+ */
260
+ relatedRequestId?: string | number;
261
+ /**
262
+ * Resumes a previously interrupted request.
263
+ */
264
+ resumptionToken?: string;
265
+ /**
266
+ * Receives updated resumption tokens from transports that support them.
267
+ */
268
+ onresumptiontoken?: (token: string) => void;
266
269
  };
267
270
  type MCPTransportCloseOptions = {
268
- /**
269
- * Cancels transport cleanup.
270
- */
271
- signal?: AbortSignal;
271
+ /**
272
+ * Cancels transport cleanup.
273
+ */
274
+ signal?: AbortSignal;
272
275
  };
273
276
  interface MCPTransport {
274
- /**
275
- * Whether this transport can probe for stateless MCP protocol versions.
276
- *
277
- * Custom transports default to the legacy initialization flow unless they
278
- * explicitly opt in.
279
- */
280
- supportsProtocolVersionDiscovery?: boolean;
281
- /**
282
- * Whether this transport mirrors x-mcp-header tool parameters into request
283
- * headers.
284
- */
285
- supportsMcpToolParameterHeaders?: boolean;
286
- /**
287
- * Initialize and start the transport
288
- */
289
- start(): Promise<void>;
290
- /**
291
- * Send a JSON-RPC message through the transport
292
- * @param message The JSON-RPC message to send
293
- * @param options Optional request-scoped cancellation options
294
- */
295
- send(message: JSONRPCMessage, options?: MCPTransportSendOptions): Promise<void>;
296
- /**
297
- * Clean up and close the transport
298
- * @param options Optional cancellation options for transport cleanup
299
- */
300
- close(options?: MCPTransportCloseOptions): Promise<void>;
301
- /**
302
- * Event handler for transport closure
303
- */
304
- onclose?: () => void;
305
- /**
306
- * Event handler for transport errors
307
- */
308
- onerror?: (error: Error) => void;
309
- /**
310
- * Event handler for received messages
311
- */
312
- onmessage?: (message: JSONRPCMessage) => void;
313
- /**
314
- * The protocol version negotiated during initialization.
315
- */
316
- protocolVersion?: string;
317
- /**
318
- * Set the protocol version negotiated during initialization.
319
- */
320
- setProtocolVersion?(version: string): void;
277
+ /**
278
+ * Whether this transport can probe for stateless MCP protocol versions.
279
+ *
280
+ * Custom transports default to the legacy initialization flow unless they
281
+ * explicitly opt in.
282
+ */
283
+ supportsProtocolVersionDiscovery?: boolean;
284
+ /**
285
+ * Whether this transport mirrors x-mcp-header tool parameters into request
286
+ * headers.
287
+ */
288
+ supportsMcpToolParameterHeaders?: boolean;
289
+ /**
290
+ * Initialize and start the transport
291
+ */
292
+ start(): Promise<void>;
293
+ /**
294
+ * Send a JSON-RPC message through the transport
295
+ * @param message The JSON-RPC message to send
296
+ * @param options Optional request-scoped cancellation options
297
+ */
298
+ send(message: JSONRPCMessage, options?: MCPTransportSendOptions): Promise<void>;
299
+ /**
300
+ * Clean up and close the transport
301
+ * @param options Optional cancellation options for transport cleanup
302
+ */
303
+ close(options?: MCPTransportCloseOptions): Promise<void>;
304
+ /**
305
+ * Event handler for transport closure
306
+ */
307
+ onclose?: () => void;
308
+ /**
309
+ * Event handler for transport errors
310
+ */
311
+ onerror?: (error: Error) => void;
312
+ /**
313
+ * Event handler for received messages
314
+ */
315
+ onmessage?: (message: JSONRPCMessage) => void;
316
+ /**
317
+ * The protocol version negotiated during initialization.
318
+ */
319
+ protocolVersion?: string;
320
+ /**
321
+ * Set the protocol version negotiated during initialization.
322
+ */
323
+ setProtocolVersion?(version: string): void;
321
324
  }
322
325
  type MCPTransportConfig = {
323
- type: 'sse' | 'http';
324
- /**
325
- * The URL of the MCP server.
326
- */
327
- url: string;
328
- /**
329
- * Additional HTTP headers to be sent with requests.
330
- */
331
- headers?: Record<string, string>;
332
- /**
333
- * An optional OAuth client provider to use for authentication for MCP servers.
334
- */
335
- authProvider?: OAuthClientProvider;
336
- /**
337
- * Controls how HTTP redirects are handled for transport requests.
338
- * - `'follow'`: Follow redirects automatically (standard fetch behavior).
339
- * - `'error'`: Reject any redirect response with an error.
340
- * @default 'error'
341
- */
342
- redirect?: 'follow' | 'error';
343
- /**
344
- * Initial MCP session id to send with resumed Streamable HTTP requests after
345
- * initialization.
346
- * Only used by the HTTP transport.
347
- */
348
- initialSessionId?: string;
349
- /**
350
- * Initial MCP protocol version to send before initialize negotiates one.
351
- * Only used by the HTTP transport.
352
- */
353
- initialProtocolVersion?: string;
354
- /**
355
- * Called when the Streamable HTTP server creates, changes, or clears the MCP
356
- * session id.
357
- * Only used by the HTTP transport.
358
- */
359
- onSessionIdChange?: (sessionId: string | undefined) => void;
360
- /**
361
- * Called when a Streamable HTTP request returns 404 for an existing MCP
362
- * session id. The transport clears the session id before reporting the
363
- * underlying HTTP error.
364
- * Only used by the HTTP transport.
365
- */
366
- onSessionExpired?: (sessionId: string) => void;
367
- /**
368
- * Whether close() should send DELETE for the current MCP session id.
369
- * Set to false when the application intends to reattach to the session later.
370
- * Only used by the HTTP transport.
371
- * @default true
372
- */
373
- terminateSessionOnClose?: boolean;
374
- /**
375
- * Optional custom fetch implementation to use for HTTP requests.
376
- * Useful for runtimes that need a request-local fetch.
377
- * @default globalThis.fetch
378
- */
379
- fetch?: FetchFunction;
326
+ type: 'sse' | 'http';
327
+ /**
328
+ * The URL of the MCP server.
329
+ */
330
+ url: string;
331
+ /**
332
+ * Additional HTTP headers to be sent with requests.
333
+ */
334
+ headers?: Record<string, string>;
335
+ /**
336
+ * An optional OAuth client provider to use for authentication for MCP servers.
337
+ */
338
+ authProvider?: OAuthClientProvider;
339
+ /**
340
+ * Controls how HTTP redirects are handled for transport requests.
341
+ * - `'follow'`: Follow redirects automatically (standard fetch behavior).
342
+ * - `'error'`: Reject any redirect response with an error.
343
+ * @default 'error'
344
+ */
345
+ redirect?: 'follow' | 'error';
346
+ /**
347
+ * Initial MCP session id to send with resumed Streamable HTTP requests after
348
+ * initialization.
349
+ * Only used by the HTTP transport.
350
+ */
351
+ initialSessionId?: string;
352
+ /**
353
+ * Initial MCP protocol version to send before initialize negotiates one.
354
+ * Only used by the HTTP transport.
355
+ */
356
+ initialProtocolVersion?: string;
357
+ /**
358
+ * Called when the Streamable HTTP server creates, changes, or clears the MCP
359
+ * session id.
360
+ * Only used by the HTTP transport.
361
+ */
362
+ onSessionIdChange?: (sessionId: string | undefined) => void;
363
+ /**
364
+ * Called when a Streamable HTTP request returns 404 for an existing MCP
365
+ * session id. The transport clears the session id before reporting the
366
+ * underlying HTTP error.
367
+ * Only used by the HTTP transport.
368
+ */
369
+ onSessionExpired?: (sessionId: string) => void;
370
+ /**
371
+ * Whether close() should send DELETE for the current MCP session id.
372
+ * Set to false when the application intends to reattach to the session later.
373
+ * Only used by the HTTP transport.
374
+ * @default true
375
+ */
376
+ terminateSessionOnClose?: boolean;
377
+ /**
378
+ * Optional custom fetch implementation to use for HTTP requests.
379
+ * Useful for runtimes that need a request-local fetch.
380
+ * @default globalThis.fetch
381
+ */
382
+ fetch?: FetchFunction;
380
383
  };
381
-
384
+ //#endregion
385
+ //#region src/tool/types.d.ts
382
386
  type McpProviderMetadata = {
383
- clientName?: string;
384
- title?: string;
385
- toolName?: string;
386
- annotations?: McpToolAnnotations;
387
- app?: JSONObject;
387
+ clientName?: string;
388
+ title?: string;
389
+ toolName?: string;
390
+ annotations?: McpToolAnnotations;
391
+ app?: JSONObject;
388
392
  };
389
393
  /**
390
394
  * Behavioral hints reported by an MCP server for a tool.
@@ -394,583 +398,584 @@ type McpProviderMetadata = {
394
398
  * @see https://modelcontextprotocol.io/specification/2026-07-28/schema#toolannotations
395
399
  */
396
400
  type McpToolAnnotations = {
397
- title?: string;
398
- readOnlyHint?: boolean;
399
- destructiveHint?: boolean;
400
- idempotentHint?: boolean;
401
- openWorldHint?: boolean;
401
+ title?: string;
402
+ readOnlyHint?: boolean;
403
+ destructiveHint?: boolean;
404
+ idempotentHint?: boolean;
405
+ openWorldHint?: boolean;
402
406
  };
403
407
  /** MCP tool metadata - keys should follow MCP _meta key format specification */
404
408
  declare const ToolMetaSchema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
405
409
  type ToolMeta = z.infer<typeof ToolMetaSchema>;
406
410
  type ToolSchemas = Record<string, {
407
- inputSchema: FlexibleSchema<JSONObject | unknown>;
408
- outputSchema?: FlexibleSchema<JSONObject | unknown>;
411
+ inputSchema: FlexibleSchema<JSONObject | unknown>;
412
+ outputSchema?: FlexibleSchema<JSONObject | unknown>;
409
413
  }> | 'automatic' | undefined;
410
414
  /** Base MCP tool type with execute and _meta */
411
415
  type McpToolBase<INPUT = unknown, OUTPUT = CallToolResult> = Tool<INPUT, OUTPUT> & Required<Pick<Tool<INPUT, OUTPUT>, 'execute'>> & {
412
- _meta?: ToolMeta;
416
+ _meta?: ToolMeta;
413
417
  };
414
418
  type McpToolSet<TOOL_SCHEMAS extends ToolSchemas = 'automatic'> = TOOL_SCHEMAS extends Record<string, {
415
- inputSchema: FlexibleSchema<any>;
416
- outputSchema?: FlexibleSchema<any>;
417
- }> ? {
418
- [K in keyof TOOL_SCHEMAS]: TOOL_SCHEMAS[K] extends {
419
- inputSchema: FlexibleSchema<infer INPUT>;
420
- outputSchema: FlexibleSchema<infer OUTPUT>;
421
- } ? McpToolBase<INPUT, OUTPUT> : TOOL_SCHEMAS[K] extends {
422
- inputSchema: FlexibleSchema<infer INPUT>;
423
- } ? McpToolBase<INPUT, CallToolResult> : never;
424
- } : Record<string, McpToolBase<unknown, CallToolResult>>;
419
+ inputSchema: FlexibleSchema<any>;
420
+ outputSchema?: FlexibleSchema<any>;
421
+ }> ? { [K in keyof TOOL_SCHEMAS]: TOOL_SCHEMAS[K] extends {
422
+ inputSchema: FlexibleSchema<infer INPUT>;
423
+ outputSchema: FlexibleSchema<infer OUTPUT>;
424
+ } ? McpToolBase<INPUT, OUTPUT> : TOOL_SCHEMAS[K] extends {
425
+ inputSchema: FlexibleSchema<infer INPUT>;
426
+ } ? McpToolBase<INPUT, CallToolResult> : never; } : Record<string, McpToolBase<unknown, CallToolResult>>;
425
427
  declare const ClientOrServerImplementationSchema: z.ZodObject<{
426
- name: z.ZodString;
427
- version: z.ZodString;
428
- title: z.ZodOptional<z.ZodString>;
428
+ name: z.ZodString;
429
+ version: z.ZodString;
430
+ title: z.ZodOptional<z.ZodString>;
429
431
  }, z.core.$loose>;
430
432
  type Configuration = z.infer<typeof ClientOrServerImplementationSchema>;
431
433
  declare const BaseParamsSchema: z.ZodObject<{
432
- _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
434
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
433
435
  }, z.core.$loose>;
434
436
  type BaseParams = z.infer<typeof BaseParamsSchema>;
435
437
  declare const RequestSchema: z.ZodObject<{
436
- method: z.ZodString;
437
- params: z.ZodOptional<z.ZodObject<{
438
- _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
439
- }, z.core.$loose>>;
438
+ method: z.ZodString;
439
+ params: z.ZodOptional<z.ZodObject<{
440
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
441
+ }, z.core.$loose>>;
440
442
  }, z.core.$strip>;
441
443
  type Request = z.infer<typeof RequestSchema>;
442
444
  type RequestOptions = {
443
- signal?: AbortSignal;
444
- timeout?: number;
445
- maxTotalTimeout?: number;
445
+ signal?: AbortSignal;
446
+ timeout?: number;
447
+ maxTotalTimeout?: number;
446
448
  };
447
449
  declare const ClientCapabilitiesSchema: z.ZodObject<{
448
- elicitation: z.ZodOptional<z.ZodObject<{
449
- applyDefaults: z.ZodOptional<z.ZodBoolean>;
450
- }, z.core.$loose>>;
450
+ elicitation: z.ZodOptional<z.ZodObject<{
451
+ applyDefaults: z.ZodOptional<z.ZodBoolean>;
452
+ }, z.core.$loose>>;
451
453
  }, z.core.$loose>;
452
454
  type ClientCapabilities = z.infer<typeof ClientCapabilitiesSchema>;
453
455
  declare const InitializeResultSchema: z.ZodObject<{
454
- _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
455
- resultType: z.ZodOptional<z.ZodString>;
456
- protocolVersion: z.ZodString;
457
- capabilities: z.ZodObject<{
458
- experimental: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
459
- logging: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
460
- completions: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
461
- prompts: z.ZodOptional<z.ZodObject<{
462
- listChanged: z.ZodOptional<z.ZodBoolean>;
463
- }, z.core.$loose>>;
464
- resources: z.ZodOptional<z.ZodObject<{
465
- subscribe: z.ZodOptional<z.ZodBoolean>;
466
- listChanged: z.ZodOptional<z.ZodBoolean>;
467
- }, z.core.$loose>>;
468
- tools: z.ZodOptional<z.ZodObject<{
469
- listChanged: z.ZodOptional<z.ZodBoolean>;
470
- }, z.core.$loose>>;
471
- elicitation: z.ZodOptional<z.ZodObject<{
472
- applyDefaults: z.ZodOptional<z.ZodBoolean>;
473
- }, z.core.$loose>>;
474
- }, z.core.$loose>;
475
- serverInfo: z.ZodObject<{
476
- name: z.ZodString;
477
- version: z.ZodString;
478
- title: z.ZodOptional<z.ZodString>;
479
- }, z.core.$loose>;
480
- instructions: z.ZodOptional<z.ZodString>;
456
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
457
+ resultType: z.ZodOptional<z.ZodString>;
458
+ protocolVersion: z.ZodString;
459
+ capabilities: z.ZodObject<{
460
+ experimental: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
461
+ logging: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
462
+ completions: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
463
+ prompts: z.ZodOptional<z.ZodObject<{
464
+ listChanged: z.ZodOptional<z.ZodBoolean>;
465
+ }, z.core.$loose>>;
466
+ resources: z.ZodOptional<z.ZodObject<{
467
+ subscribe: z.ZodOptional<z.ZodBoolean>;
468
+ listChanged: z.ZodOptional<z.ZodBoolean>;
469
+ }, z.core.$loose>>;
470
+ tools: z.ZodOptional<z.ZodObject<{
471
+ listChanged: z.ZodOptional<z.ZodBoolean>;
472
+ }, z.core.$loose>>;
473
+ elicitation: z.ZodOptional<z.ZodObject<{
474
+ applyDefaults: z.ZodOptional<z.ZodBoolean>;
475
+ }, z.core.$loose>>;
476
+ }, z.core.$loose>;
477
+ serverInfo: z.ZodObject<{
478
+ name: z.ZodString;
479
+ version: z.ZodString;
480
+ title: z.ZodOptional<z.ZodString>;
481
+ }, z.core.$loose>;
482
+ instructions: z.ZodOptional<z.ZodString>;
481
483
  }, z.core.$loose>;
482
484
  type InitializeResult = z.infer<typeof InitializeResultSchema>;
483
485
  type PaginatedRequest = Request & {
484
- params?: BaseParams & {
485
- cursor?: string;
486
- };
486
+ params?: BaseParams & {
487
+ cursor?: string;
488
+ };
487
489
  };
488
490
  declare const ListToolsResultSchema: z.ZodObject<{
489
- _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
490
- resultType: z.ZodOptional<z.ZodString>;
491
- nextCursor: z.ZodOptional<z.ZodString>;
492
- tools: z.ZodArray<z.ZodObject<{
493
- name: z.ZodString;
494
- title: z.ZodOptional<z.ZodString>;
495
- description: z.ZodOptional<z.ZodString>;
496
- inputSchema: z.ZodObject<{
497
- type: z.ZodOptional<z.ZodUnknown>;
498
- properties: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
499
- }, z.core.$loose>;
500
- outputSchema: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
501
- annotations: z.ZodOptional<z.ZodObject<{
502
- title: z.ZodOptional<z.ZodString>;
503
- readOnlyHint: z.ZodOptional<z.ZodBoolean>;
504
- destructiveHint: z.ZodOptional<z.ZodBoolean>;
505
- idempotentHint: z.ZodOptional<z.ZodBoolean>;
506
- openWorldHint: z.ZodOptional<z.ZodBoolean>;
507
- }, z.core.$loose>>;
508
- _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
491
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
492
+ resultType: z.ZodOptional<z.ZodString>;
493
+ nextCursor: z.ZodOptional<z.ZodString>;
494
+ tools: z.ZodArray<z.ZodObject<{
495
+ name: z.ZodString;
496
+ title: z.ZodOptional<z.ZodString>;
497
+ description: z.ZodOptional<z.ZodString>;
498
+ inputSchema: z.ZodObject<{
499
+ type: z.ZodOptional<z.ZodUnknown>;
500
+ properties: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
501
+ }, z.core.$loose>;
502
+ outputSchema: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
503
+ annotations: z.ZodOptional<z.ZodObject<{
504
+ title: z.ZodOptional<z.ZodString>;
505
+ readOnlyHint: z.ZodOptional<z.ZodBoolean>;
506
+ destructiveHint: z.ZodOptional<z.ZodBoolean>;
507
+ idempotentHint: z.ZodOptional<z.ZodBoolean>;
508
+ openWorldHint: z.ZodOptional<z.ZodBoolean>;
509
509
  }, z.core.$loose>>;
510
+ _meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
511
+ }, z.core.$loose>>;
510
512
  }, z.core.$loose>;
511
513
  type ListToolsResult = z.infer<typeof ListToolsResultSchema>;
512
514
  declare const ListResourcesResultSchema: z.ZodObject<{
513
- _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
514
- resultType: z.ZodOptional<z.ZodString>;
515
- nextCursor: z.ZodOptional<z.ZodString>;
516
- resources: z.ZodArray<z.ZodObject<{
517
- uri: z.ZodString;
518
- name: z.ZodString;
519
- title: z.ZodOptional<z.ZodString>;
520
- description: z.ZodOptional<z.ZodString>;
521
- mimeType: z.ZodOptional<z.ZodString>;
522
- size: z.ZodOptional<z.ZodNumber>;
523
- }, z.core.$loose>>;
515
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
516
+ resultType: z.ZodOptional<z.ZodString>;
517
+ nextCursor: z.ZodOptional<z.ZodString>;
518
+ resources: z.ZodArray<z.ZodObject<{
519
+ uri: z.ZodString;
520
+ name: z.ZodString;
521
+ title: z.ZodOptional<z.ZodString>;
522
+ description: z.ZodOptional<z.ZodString>;
523
+ mimeType: z.ZodOptional<z.ZodString>;
524
+ size: z.ZodOptional<z.ZodNumber>;
525
+ }, z.core.$loose>>;
524
526
  }, z.core.$loose>;
525
527
  type ListResourcesResult = z.infer<typeof ListResourcesResultSchema>;
526
528
  declare const CallToolResultSchema: z.ZodUnion<[z.ZodUnion<[z.ZodObject<{
527
- _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
528
- resultType: z.ZodOptional<z.ZodString>;
529
- content: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
530
- type: z.ZodLiteral<"text">;
531
- text: z.ZodString;
532
- }, z.core.$loose>, z.ZodObject<{
533
- type: z.ZodLiteral<"image">;
534
- data: z.ZodBase64;
535
- mimeType: z.ZodString;
536
- }, z.core.$loose>, z.ZodObject<{
537
- type: z.ZodLiteral<"resource">;
538
- resource: z.ZodUnion<readonly [z.ZodObject<{
539
- uri: z.ZodString;
540
- name: z.ZodOptional<z.ZodString>;
541
- title: z.ZodOptional<z.ZodString>;
542
- mimeType: z.ZodOptional<z.ZodString>;
543
- text: z.ZodString;
544
- }, z.core.$loose>, z.ZodObject<{
545
- uri: z.ZodString;
546
- name: z.ZodOptional<z.ZodString>;
547
- title: z.ZodOptional<z.ZodString>;
548
- mimeType: z.ZodOptional<z.ZodString>;
549
- blob: z.ZodBase64;
550
- }, z.core.$loose>]>;
529
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
530
+ resultType: z.ZodOptional<z.ZodString>;
531
+ content: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
532
+ type: z.ZodLiteral<"text">;
533
+ text: z.ZodString;
534
+ }, z.core.$loose>, z.ZodObject<{
535
+ type: z.ZodLiteral<"image">;
536
+ data: z.ZodBase64;
537
+ mimeType: z.ZodString;
538
+ }, z.core.$loose>, z.ZodObject<{
539
+ type: z.ZodLiteral<"resource">;
540
+ resource: z.ZodUnion<readonly [z.ZodObject<{
541
+ uri: z.ZodString;
542
+ name: z.ZodOptional<z.ZodString>;
543
+ title: z.ZodOptional<z.ZodString>;
544
+ mimeType: z.ZodOptional<z.ZodString>;
545
+ text: z.ZodString;
551
546
  }, z.core.$loose>, z.ZodObject<{
552
- type: z.ZodLiteral<"resource_link">;
553
- uri: z.ZodString;
554
- name: z.ZodString;
555
- description: z.ZodOptional<z.ZodString>;
556
- mimeType: z.ZodOptional<z.ZodString>;
557
- }, z.core.$loose>, z.ZodObject<{
558
- type: z.ZodString;
559
- }, z.core.$loose>]>>;
560
- structuredContent: z.ZodOptional<z.ZodUnknown>;
561
- isError: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
547
+ uri: z.ZodString;
548
+ name: z.ZodOptional<z.ZodString>;
549
+ title: z.ZodOptional<z.ZodString>;
550
+ mimeType: z.ZodOptional<z.ZodString>;
551
+ blob: z.ZodBase64;
552
+ }, z.core.$loose>]>;
553
+ }, z.core.$loose>, z.ZodObject<{
554
+ type: z.ZodLiteral<"resource_link">;
555
+ uri: z.ZodString;
556
+ name: z.ZodString;
557
+ description: z.ZodOptional<z.ZodString>;
558
+ mimeType: z.ZodOptional<z.ZodString>;
559
+ }, z.core.$loose>, z.ZodObject<{
560
+ type: z.ZodString;
561
+ }, z.core.$loose>]>>;
562
+ structuredContent: z.ZodOptional<z.ZodUnknown>;
563
+ isError: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
562
564
  }, z.core.$loose>, z.ZodPipe<z.ZodPipe<z.ZodObject<{
563
- _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
564
- resultType: z.ZodOptional<z.ZodString>;
565
- content: z.ZodOptional<z.ZodNever>;
566
- structuredContent: z.ZodJSONSchema;
567
- isError: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
565
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
566
+ resultType: z.ZodOptional<z.ZodString>;
567
+ content: z.ZodOptional<z.ZodNever>;
568
+ structuredContent: z.ZodJSONSchema;
569
+ isError: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
568
570
  }, z.core.$loose>, z.ZodTransform<{
571
+ [x: string]: unknown;
572
+ content: ({
569
573
  [x: string]: unknown;
570
- content: ({
571
- [x: string]: unknown;
572
- type: "text";
573
- text: string;
574
- } | {
575
- [x: string]: unknown;
576
- type: "image";
577
- data: string;
578
- mimeType: string;
579
- } | {
580
- [x: string]: unknown;
581
- type: "resource";
582
- resource: {
583
- [x: string]: unknown;
584
- uri: string;
585
- text: string;
586
- name?: string | undefined;
587
- title?: string | undefined;
588
- mimeType?: string | undefined;
589
- } | {
590
- [x: string]: unknown;
591
- uri: string;
592
- blob: string;
593
- name?: string | undefined;
594
- title?: string | undefined;
595
- mimeType?: string | undefined;
596
- };
597
- } | {
598
- [x: string]: unknown;
599
- type: "resource_link";
600
- uri: string;
601
- name: string;
602
- description?: string | undefined;
603
- mimeType?: string | undefined;
574
+ type: "text";
575
+ text: string;
576
+ } | {
577
+ [x: string]: unknown;
578
+ type: "image";
579
+ data: string;
580
+ mimeType: string;
581
+ } | {
582
+ [x: string]: unknown;
583
+ type: "resource";
584
+ resource: {
585
+ [x: string]: unknown;
586
+ uri: string;
587
+ text: string;
588
+ name?: string | undefined;
589
+ title?: string | undefined;
590
+ mimeType?: string | undefined;
604
591
  } | {
605
- [x: string]: unknown;
606
- type: string;
607
- })[];
608
- _meta?: {
609
- [x: string]: unknown;
610
- } | undefined;
611
- resultType?: string | undefined;
612
- structuredContent?: unknown;
613
- isError?: boolean | undefined;
592
+ [x: string]: unknown;
593
+ uri: string;
594
+ blob: string;
595
+ name?: string | undefined;
596
+ title?: string | undefined;
597
+ mimeType?: string | undefined;
598
+ };
599
+ } | {
600
+ [x: string]: unknown;
601
+ type: "resource_link";
602
+ uri: string;
603
+ name: string;
604
+ description?: string | undefined;
605
+ mimeType?: string | undefined;
606
+ } | {
607
+ [x: string]: unknown;
608
+ type: string;
609
+ })[];
610
+ _meta?: {
611
+ [x: string]: unknown;
612
+ } | undefined;
613
+ resultType?: string | undefined;
614
+ structuredContent?: unknown;
615
+ isError?: boolean | undefined;
614
616
  }, {
617
+ [x: string]: unknown;
618
+ structuredContent: z.core.util.JSONType;
619
+ _meta?: {
615
620
  [x: string]: unknown;
616
- structuredContent: z.core.util.JSONType;
617
- _meta?: {
618
- [x: string]: unknown;
619
- } | undefined;
620
- resultType?: string | undefined;
621
- content?: undefined;
622
- isError?: boolean | undefined;
621
+ } | undefined;
622
+ resultType?: string | undefined;
623
+ content?: undefined;
624
+ isError?: boolean | undefined;
623
625
  }>>, z.ZodObject<{
624
- _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
625
- resultType: z.ZodOptional<z.ZodString>;
626
- content: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
627
- type: z.ZodLiteral<"text">;
628
- text: z.ZodString;
629
- }, z.core.$loose>, z.ZodObject<{
630
- type: z.ZodLiteral<"image">;
631
- data: z.ZodBase64;
632
- mimeType: z.ZodString;
633
- }, z.core.$loose>, z.ZodObject<{
634
- type: z.ZodLiteral<"resource">;
635
- resource: z.ZodUnion<readonly [z.ZodObject<{
636
- uri: z.ZodString;
637
- name: z.ZodOptional<z.ZodString>;
638
- title: z.ZodOptional<z.ZodString>;
639
- mimeType: z.ZodOptional<z.ZodString>;
640
- text: z.ZodString;
641
- }, z.core.$loose>, z.ZodObject<{
642
- uri: z.ZodString;
643
- name: z.ZodOptional<z.ZodString>;
644
- title: z.ZodOptional<z.ZodString>;
645
- mimeType: z.ZodOptional<z.ZodString>;
646
- blob: z.ZodBase64;
647
- }, z.core.$loose>]>;
626
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
627
+ resultType: z.ZodOptional<z.ZodString>;
628
+ content: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
629
+ type: z.ZodLiteral<"text">;
630
+ text: z.ZodString;
631
+ }, z.core.$loose>, z.ZodObject<{
632
+ type: z.ZodLiteral<"image">;
633
+ data: z.ZodBase64;
634
+ mimeType: z.ZodString;
635
+ }, z.core.$loose>, z.ZodObject<{
636
+ type: z.ZodLiteral<"resource">;
637
+ resource: z.ZodUnion<readonly [z.ZodObject<{
638
+ uri: z.ZodString;
639
+ name: z.ZodOptional<z.ZodString>;
640
+ title: z.ZodOptional<z.ZodString>;
641
+ mimeType: z.ZodOptional<z.ZodString>;
642
+ text: z.ZodString;
648
643
  }, z.core.$loose>, z.ZodObject<{
649
- type: z.ZodLiteral<"resource_link">;
650
- uri: z.ZodString;
651
- name: z.ZodString;
652
- description: z.ZodOptional<z.ZodString>;
653
- mimeType: z.ZodOptional<z.ZodString>;
654
- }, z.core.$loose>, z.ZodObject<{
655
- type: z.ZodString;
656
- }, z.core.$loose>]>>;
657
- structuredContent: z.ZodOptional<z.ZodUnknown>;
658
- isError: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
644
+ uri: z.ZodString;
645
+ name: z.ZodOptional<z.ZodString>;
646
+ title: z.ZodOptional<z.ZodString>;
647
+ mimeType: z.ZodOptional<z.ZodString>;
648
+ blob: z.ZodBase64;
649
+ }, z.core.$loose>]>;
650
+ }, z.core.$loose>, z.ZodObject<{
651
+ type: z.ZodLiteral<"resource_link">;
652
+ uri: z.ZodString;
653
+ name: z.ZodString;
654
+ description: z.ZodOptional<z.ZodString>;
655
+ mimeType: z.ZodOptional<z.ZodString>;
656
+ }, z.core.$loose>, z.ZodObject<{
657
+ type: z.ZodString;
658
+ }, z.core.$loose>]>>;
659
+ structuredContent: z.ZodOptional<z.ZodUnknown>;
660
+ isError: z.ZodOptional<z.ZodDefault<z.ZodBoolean>>;
659
661
  }, z.core.$loose>>]>, z.ZodObject<{
660
- _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
661
- resultType: z.ZodOptional<z.ZodString>;
662
- toolResult: z.ZodNonOptional<z.ZodUnknown>;
662
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
663
+ resultType: z.ZodOptional<z.ZodString>;
664
+ toolResult: z.ZodNonOptional<z.ZodUnknown>;
663
665
  }, z.core.$loose>]>;
664
666
  type CallToolResult = z.infer<typeof CallToolResultSchema>;
665
667
  declare const ListResourceTemplatesResultSchema: z.ZodObject<{
666
- _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
667
- resultType: z.ZodOptional<z.ZodString>;
668
- resourceTemplates: z.ZodArray<z.ZodObject<{
669
- uriTemplate: z.ZodString;
670
- name: z.ZodString;
671
- title: z.ZodOptional<z.ZodString>;
672
- description: z.ZodOptional<z.ZodString>;
673
- mimeType: z.ZodOptional<z.ZodString>;
674
- }, z.core.$loose>>;
668
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
669
+ resultType: z.ZodOptional<z.ZodString>;
670
+ resourceTemplates: z.ZodArray<z.ZodObject<{
671
+ uriTemplate: z.ZodString;
672
+ name: z.ZodString;
673
+ title: z.ZodOptional<z.ZodString>;
674
+ description: z.ZodOptional<z.ZodString>;
675
+ mimeType: z.ZodOptional<z.ZodString>;
676
+ }, z.core.$loose>>;
675
677
  }, z.core.$loose>;
676
678
  type ListResourceTemplatesResult = z.infer<typeof ListResourceTemplatesResultSchema>;
677
679
  declare const ReadResourceResultSchema: z.ZodObject<{
678
- _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
679
- resultType: z.ZodOptional<z.ZodString>;
680
- contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
681
- uri: z.ZodString;
682
- name: z.ZodOptional<z.ZodString>;
683
- title: z.ZodOptional<z.ZodString>;
684
- mimeType: z.ZodOptional<z.ZodString>;
685
- text: z.ZodString;
686
- }, z.core.$loose>, z.ZodObject<{
687
- uri: z.ZodString;
688
- name: z.ZodOptional<z.ZodString>;
689
- title: z.ZodOptional<z.ZodString>;
690
- mimeType: z.ZodOptional<z.ZodString>;
691
- blob: z.ZodBase64;
692
- }, z.core.$loose>]>>;
680
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
681
+ resultType: z.ZodOptional<z.ZodString>;
682
+ contents: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
683
+ uri: z.ZodString;
684
+ name: z.ZodOptional<z.ZodString>;
685
+ title: z.ZodOptional<z.ZodString>;
686
+ mimeType: z.ZodOptional<z.ZodString>;
687
+ text: z.ZodString;
688
+ }, z.core.$loose>, z.ZodObject<{
689
+ uri: z.ZodString;
690
+ name: z.ZodOptional<z.ZodString>;
691
+ title: z.ZodOptional<z.ZodString>;
692
+ mimeType: z.ZodOptional<z.ZodString>;
693
+ blob: z.ZodBase64;
694
+ }, z.core.$loose>]>>;
693
695
  }, z.core.$loose>;
694
696
  type ReadResourceResult = z.infer<typeof ReadResourceResultSchema>;
695
697
  declare const CompleteRequestParamsSchema: z.ZodObject<{
696
- _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
697
- ref: z.ZodUnion<readonly [z.ZodObject<{
698
- type: z.ZodLiteral<"ref/prompt">;
699
- name: z.ZodString;
700
- }, z.core.$loose>, z.ZodObject<{
701
- type: z.ZodLiteral<"ref/resource">;
702
- uri: z.ZodString;
703
- }, z.core.$loose>]>;
704
- argument: z.ZodObject<{
705
- name: z.ZodString;
706
- value: z.ZodString;
707
- }, z.core.$loose>;
708
- context: z.ZodOptional<z.ZodObject<{
709
- arguments: z.ZodRecord<z.ZodString, z.ZodString>;
710
- }, z.core.$loose>>;
698
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
699
+ ref: z.ZodUnion<readonly [z.ZodObject<{
700
+ type: z.ZodLiteral<"ref/prompt">;
701
+ name: z.ZodString;
702
+ }, z.core.$loose>, z.ZodObject<{
703
+ type: z.ZodLiteral<"ref/resource">;
704
+ uri: z.ZodString;
705
+ }, z.core.$loose>]>;
706
+ argument: z.ZodObject<{
707
+ name: z.ZodString;
708
+ value: z.ZodString;
709
+ }, z.core.$loose>;
710
+ context: z.ZodOptional<z.ZodObject<{
711
+ arguments: z.ZodRecord<z.ZodString, z.ZodString>;
712
+ }, z.core.$loose>>;
711
713
  }, z.core.$loose>;
712
714
  type CompleteRequestParams = z.infer<typeof CompleteRequestParamsSchema>;
713
715
  declare const CompleteResultSchema: z.ZodObject<{
714
- _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
715
- resultType: z.ZodOptional<z.ZodString>;
716
- completion: z.ZodObject<{
717
- values: z.ZodArray<z.ZodString>;
718
- total: z.ZodOptional<z.ZodNumber>;
719
- hasMore: z.ZodOptional<z.ZodBoolean>;
720
- }, z.core.$loose>;
716
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
717
+ resultType: z.ZodOptional<z.ZodString>;
718
+ completion: z.ZodObject<{
719
+ values: z.ZodArray<z.ZodString>;
720
+ total: z.ZodOptional<z.ZodNumber>;
721
+ hasMore: z.ZodOptional<z.ZodBoolean>;
722
+ }, z.core.$loose>;
721
723
  }, z.core.$loose>;
722
724
  type CompleteResult = z.infer<typeof CompleteResultSchema>;
723
725
  declare const ListPromptsResultSchema: z.ZodObject<{
724
- _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
725
- resultType: z.ZodOptional<z.ZodString>;
726
- nextCursor: z.ZodOptional<z.ZodString>;
727
- prompts: z.ZodArray<z.ZodObject<{
728
- name: z.ZodString;
729
- title: z.ZodOptional<z.ZodString>;
730
- description: z.ZodOptional<z.ZodString>;
731
- arguments: z.ZodOptional<z.ZodArray<z.ZodObject<{
732
- name: z.ZodString;
733
- description: z.ZodOptional<z.ZodString>;
734
- required: z.ZodOptional<z.ZodBoolean>;
735
- }, z.core.$loose>>>;
736
- }, z.core.$loose>>;
726
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
727
+ resultType: z.ZodOptional<z.ZodString>;
728
+ nextCursor: z.ZodOptional<z.ZodString>;
729
+ prompts: z.ZodArray<z.ZodObject<{
730
+ name: z.ZodString;
731
+ title: z.ZodOptional<z.ZodString>;
732
+ description: z.ZodOptional<z.ZodString>;
733
+ arguments: z.ZodOptional<z.ZodArray<z.ZodObject<{
734
+ name: z.ZodString;
735
+ description: z.ZodOptional<z.ZodString>;
736
+ required: z.ZodOptional<z.ZodBoolean>;
737
+ }, z.core.$loose>>>;
738
+ }, z.core.$loose>>;
737
739
  }, z.core.$loose>;
738
740
  type ListPromptsResult = z.infer<typeof ListPromptsResultSchema>;
739
741
  declare const GetPromptResultSchema: z.ZodObject<{
740
- _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
741
- resultType: z.ZodOptional<z.ZodString>;
742
- description: z.ZodOptional<z.ZodString>;
743
- messages: z.ZodArray<z.ZodObject<{
744
- role: z.ZodUnion<readonly [z.ZodLiteral<"user">, z.ZodLiteral<"assistant">]>;
745
- content: z.ZodUnion<readonly [z.ZodObject<{
746
- type: z.ZodLiteral<"text">;
747
- text: z.ZodString;
748
- }, z.core.$loose>, z.ZodObject<{
749
- type: z.ZodLiteral<"image">;
750
- data: z.ZodBase64;
751
- mimeType: z.ZodString;
752
- }, z.core.$loose>, z.ZodObject<{
753
- type: z.ZodLiteral<"resource">;
754
- resource: z.ZodUnion<readonly [z.ZodObject<{
755
- uri: z.ZodString;
756
- name: z.ZodOptional<z.ZodString>;
757
- title: z.ZodOptional<z.ZodString>;
758
- mimeType: z.ZodOptional<z.ZodString>;
759
- text: z.ZodString;
760
- }, z.core.$loose>, z.ZodObject<{
761
- uri: z.ZodString;
762
- name: z.ZodOptional<z.ZodString>;
763
- title: z.ZodOptional<z.ZodString>;
764
- mimeType: z.ZodOptional<z.ZodString>;
765
- blob: z.ZodBase64;
766
- }, z.core.$loose>]>;
767
- }, z.core.$loose>, z.ZodObject<{
768
- type: z.ZodLiteral<"resource_link">;
769
- uri: z.ZodString;
770
- name: z.ZodString;
771
- description: z.ZodOptional<z.ZodString>;
772
- mimeType: z.ZodOptional<z.ZodString>;
773
- }, z.core.$loose>]>;
774
- }, z.core.$loose>>;
742
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
743
+ resultType: z.ZodOptional<z.ZodString>;
744
+ description: z.ZodOptional<z.ZodString>;
745
+ messages: z.ZodArray<z.ZodObject<{
746
+ role: z.ZodUnion<readonly [z.ZodLiteral<"user">, z.ZodLiteral<"assistant">]>;
747
+ content: z.ZodUnion<readonly [z.ZodObject<{
748
+ type: z.ZodLiteral<"text">;
749
+ text: z.ZodString;
750
+ }, z.core.$loose>, z.ZodObject<{
751
+ type: z.ZodLiteral<"image">;
752
+ data: z.ZodBase64;
753
+ mimeType: z.ZodString;
754
+ }, z.core.$loose>, z.ZodObject<{
755
+ type: z.ZodLiteral<"resource">;
756
+ resource: z.ZodUnion<readonly [z.ZodObject<{
757
+ uri: z.ZodString;
758
+ name: z.ZodOptional<z.ZodString>;
759
+ title: z.ZodOptional<z.ZodString>;
760
+ mimeType: z.ZodOptional<z.ZodString>;
761
+ text: z.ZodString;
762
+ }, z.core.$loose>, z.ZodObject<{
763
+ uri: z.ZodString;
764
+ name: z.ZodOptional<z.ZodString>;
765
+ title: z.ZodOptional<z.ZodString>;
766
+ mimeType: z.ZodOptional<z.ZodString>;
767
+ blob: z.ZodBase64;
768
+ }, z.core.$loose>]>;
769
+ }, z.core.$loose>, z.ZodObject<{
770
+ type: z.ZodLiteral<"resource_link">;
771
+ uri: z.ZodString;
772
+ name: z.ZodString;
773
+ description: z.ZodOptional<z.ZodString>;
774
+ mimeType: z.ZodOptional<z.ZodString>;
775
+ }, z.core.$loose>]>;
776
+ }, z.core.$loose>>;
775
777
  }, z.core.$loose>;
776
778
  type GetPromptResult = z.infer<typeof GetPromptResultSchema>;
777
- declare const ElicitationRequestSchema: z.ZodObject<{
778
- method: z.ZodLiteral<"elicitation/create">;
779
- params: z.ZodObject<{
780
- _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
781
- message: z.ZodString;
782
- requestedSchema: z.ZodUnknown;
783
- }, z.core.$loose>;
779
+ export declare const ElicitationRequestSchema: z.ZodObject<{
780
+ method: z.ZodLiteral<"elicitation/create">;
781
+ params: z.ZodObject<{
782
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
783
+ message: z.ZodString;
784
+ requestedSchema: z.ZodUnknown;
785
+ }, z.core.$loose>;
784
786
  }, z.core.$strip>;
785
787
  type ElicitationRequest = z.infer<typeof ElicitationRequestSchema>;
786
- declare const ElicitResultSchema: z.ZodObject<{
787
- _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
788
- resultType: z.ZodOptional<z.ZodString>;
789
- action: z.ZodUnion<readonly [z.ZodLiteral<"accept">, z.ZodLiteral<"decline">, z.ZodLiteral<"cancel">]>;
790
- content: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
788
+ export declare const ElicitResultSchema: z.ZodObject<{
789
+ _meta: z.ZodOptional<z.ZodObject<{}, z.core.$loose>>;
790
+ resultType: z.ZodOptional<z.ZodString>;
791
+ action: z.ZodUnion<readonly [z.ZodLiteral<"accept">, z.ZodLiteral<"decline">, z.ZodLiteral<"cancel">]>;
792
+ content: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
791
793
  }, z.core.$loose>;
792
794
  type ElicitResult = z.infer<typeof ElicitResultSchema>;
793
-
795
+ //#endregion
796
+ //#region src/tool/mcp-client.d.ts
794
797
  interface MCPClientConfig {
795
- /** Transport configuration for connecting to the MCP server */
796
- transport: MCPTransportConfig | MCPTransport;
797
- /**
798
- * Whether transports that support stateless protocol discovery should probe
799
- * with `server/discover` before falling back to legacy initialization.
800
- *
801
- * Disable this for legacy servers that require `initialize` to be the first
802
- * request.
803
- *
804
- * @default true
805
- */
806
- protocolVersionDiscovery?: boolean;
807
- /**
808
- * Options that bound or cancel transport startup and the initialize request.
809
- */
810
- initializationOptions?: RequestOptions;
811
- /** Optional callback for uncaught errors */
812
- onUncaughtError?: (error: unknown) => void;
813
- /**
814
- * Maximum number of retries for transient MCP tool call failures.
815
- *
816
- * Set to 0 to disable retries. Retries only apply to tools/call requests.
817
- * JSON-RPC application errors, such as invalid params, are not retried.
818
- *
819
- * @default 0
820
- */
821
- maxRetries?: number;
822
- /**
823
- * Initialize result from a previous MCP session. When provided, the client
824
- * starts the transport and reuses this metadata without sending a new
825
- * initialize request.
826
- */
827
- initialInitializeResult?: InitializeResult;
828
- /** Optional client name, defaults to 'ai-sdk-mcp-client' */
829
- clientName?: string;
830
- /**
831
- * Optional client name, defaults to 'ai-sdk-mcp-client'
832
- *
833
- * @deprecated Use `clientName` instead.
834
- */
835
- name?: string;
836
- /** Optional client version, defaults to '1.0.0' */
837
- version?: string;
838
- /**
839
- * Optional client capabilities to advertise during initialization
840
- *
841
- * NOTE: It is up to the client application to handle the requests properly. This parameter just helps surface the request from the server
842
- */
843
- capabilities?: ClientCapabilities;
798
+ /** Transport configuration for connecting to the MCP server */
799
+ transport: MCPTransportConfig | MCPTransport;
800
+ /**
801
+ * Whether transports that support stateless protocol discovery should probe
802
+ * with `server/discover` before falling back to legacy initialization.
803
+ *
804
+ * Disable this for legacy servers that require `initialize` to be the first
805
+ * request.
806
+ *
807
+ * @default true
808
+ */
809
+ protocolVersionDiscovery?: boolean;
810
+ /**
811
+ * Options that bound or cancel transport startup and the initialize request.
812
+ */
813
+ initializationOptions?: RequestOptions;
814
+ /** Optional callback for uncaught errors */
815
+ onUncaughtError?: (error: unknown) => void;
816
+ /**
817
+ * Maximum number of retries for transient MCP tool call failures.
818
+ *
819
+ * Set to 0 to disable retries. Retries only apply to tools/call requests.
820
+ * JSON-RPC application errors, such as invalid params, are not retried.
821
+ *
822
+ * @default 0
823
+ */
824
+ maxRetries?: number;
825
+ /**
826
+ * Initialize result from a previous MCP session. When provided, the client
827
+ * starts the transport and reuses this metadata without sending a new
828
+ * initialize request.
829
+ */
830
+ initialInitializeResult?: InitializeResult;
831
+ /** Optional client name, defaults to 'ai-sdk-mcp-client' */
832
+ clientName?: string;
833
+ /**
834
+ * Optional client name, defaults to 'ai-sdk-mcp-client'
835
+ *
836
+ * @deprecated Use `clientName` instead.
837
+ */
838
+ name?: string;
839
+ /** Optional client version, defaults to '1.0.0' */
840
+ version?: string;
841
+ /**
842
+ * Optional client capabilities to advertise during initialization
843
+ *
844
+ * NOTE: It is up to the client application to handle the requests properly. This parameter just helps surface the request from the server
845
+ */
846
+ capabilities?: ClientCapabilities;
844
847
  }
845
- declare function createMCPClient(config: MCPClientConfig): Promise<MCPClient>;
848
+ export declare function createMCPClient(config: MCPClientConfig): Promise<MCPClient>;
846
849
  interface MCPClient {
847
- /**
848
- * Information about the connected MCP server, as reported during initialization.
849
- * @see https://modelcontextprotocol.io/specification/2025-11-25/schema#implementation
850
- */
851
- readonly serverInfo: Configuration;
852
- /**
853
- * The full initialize result used by this client, either from the server
854
- * during initialization or from `initialInitializeResult`.
855
- */
856
- readonly initializeResult: InitializeResult;
857
- /**
858
- * Optional instructions provided by the server during the initialize handshake.
859
- *
860
- * These describe how to use the server and its features, and can be used by clients
861
- * to improve LLM interactions (e.g. by including them in the system prompt).
862
- *
863
- * @see https://modelcontextprotocol.io/specification/2025-11-25/schema#initializeresult
864
- */
865
- readonly instructions?: string;
866
- tools<TOOL_SCHEMAS extends ToolSchemas = 'automatic'>(options?: {
867
- schemas?: TOOL_SCHEMAS;
868
- }): Promise<McpToolSet<TOOL_SCHEMAS>>;
869
- /**
870
- * Lists available tools from the MCP server.
871
- */
872
- listTools(options?: {
873
- params?: PaginatedRequest['params'];
874
- options?: RequestOptions;
875
- }): Promise<ListToolsResult>;
876
- /**
877
- * Calls a tool on the MCP server.
878
- */
879
- callTool(args: {
880
- name: string;
881
- arguments?: Record<string, unknown>;
882
- options?: RequestOptions;
883
- }): Promise<CallToolResult>;
884
- /**
885
- * Creates AI SDK tools from tool definitions.
886
- */
887
- toolsFromDefinitions<TOOL_SCHEMAS extends ToolSchemas = 'automatic'>(definitions: ListToolsResult, options?: {
888
- schemas?: TOOL_SCHEMAS;
889
- }): McpToolSet<TOOL_SCHEMAS>;
890
- listResources(options?: {
891
- params?: PaginatedRequest['params'];
892
- options?: RequestOptions;
893
- }): Promise<ListResourcesResult>;
894
- readResource(args: {
895
- uri: string;
896
- options?: RequestOptions;
897
- }): Promise<ReadResourceResult>;
898
- listResourceTemplates(options?: {
899
- options?: RequestOptions;
900
- }): Promise<ListResourceTemplatesResult>;
901
- experimental_listPrompts(options?: {
902
- params?: PaginatedRequest['params'];
903
- options?: RequestOptions;
904
- }): Promise<ListPromptsResult>;
905
- experimental_getPrompt(args: {
906
- name: string;
907
- arguments?: Record<string, unknown>;
908
- options?: RequestOptions;
909
- }): Promise<GetPromptResult>;
910
- complete(args: CompleteRequestParams & {
911
- options?: RequestOptions;
912
- }): Promise<CompleteResult>;
913
- onElicitationRequest(schema: typeof ElicitationRequestSchema, handler: (request: ElicitationRequest) => Promise<ElicitResult> | ElicitResult): void;
914
- close: () => Promise<void>;
850
+ /**
851
+ * Information about the connected MCP server, as reported during initialization.
852
+ * @see https://modelcontextprotocol.io/specification/2025-11-25/schema#implementation
853
+ */
854
+ readonly serverInfo: Configuration;
855
+ /**
856
+ * The full initialize result used by this client, either from the server
857
+ * during initialization or from `initialInitializeResult`.
858
+ */
859
+ readonly initializeResult: InitializeResult;
860
+ /**
861
+ * Optional instructions provided by the server during the initialize handshake.
862
+ *
863
+ * These describe how to use the server and its features, and can be used by clients
864
+ * to improve LLM interactions (e.g. by including them in the system prompt).
865
+ *
866
+ * @see https://modelcontextprotocol.io/specification/2025-11-25/schema#initializeresult
867
+ */
868
+ readonly instructions?: string;
869
+ tools<TOOL_SCHEMAS extends ToolSchemas = 'automatic'>(options?: {
870
+ schemas?: TOOL_SCHEMAS;
871
+ }): Promise<McpToolSet<TOOL_SCHEMAS>>;
872
+ /**
873
+ * Lists available tools from the MCP server.
874
+ */
875
+ listTools(options?: {
876
+ params?: PaginatedRequest['params'];
877
+ options?: RequestOptions;
878
+ }): Promise<ListToolsResult>;
879
+ /**
880
+ * Calls a tool on the MCP server.
881
+ */
882
+ callTool(args: {
883
+ name: string;
884
+ arguments?: Record<string, unknown>;
885
+ options?: RequestOptions;
886
+ }): Promise<CallToolResult>;
887
+ /**
888
+ * Creates AI SDK tools from tool definitions.
889
+ */
890
+ toolsFromDefinitions<TOOL_SCHEMAS extends ToolSchemas = 'automatic'>(definitions: ListToolsResult, options?: {
891
+ schemas?: TOOL_SCHEMAS;
892
+ }): McpToolSet<TOOL_SCHEMAS>;
893
+ listResources(options?: {
894
+ params?: PaginatedRequest['params'];
895
+ options?: RequestOptions;
896
+ }): Promise<ListResourcesResult>;
897
+ readResource(args: {
898
+ uri: string;
899
+ options?: RequestOptions;
900
+ }): Promise<ReadResourceResult>;
901
+ listResourceTemplates(options?: {
902
+ options?: RequestOptions;
903
+ }): Promise<ListResourceTemplatesResult>;
904
+ experimental_listPrompts(options?: {
905
+ params?: PaginatedRequest['params'];
906
+ options?: RequestOptions;
907
+ }): Promise<ListPromptsResult>;
908
+ experimental_getPrompt(args: {
909
+ name: string;
910
+ arguments?: Record<string, unknown>;
911
+ options?: RequestOptions;
912
+ }): Promise<GetPromptResult>;
913
+ complete(args: CompleteRequestParams & {
914
+ options?: RequestOptions;
915
+ }): Promise<CompleteResult>;
916
+ onElicitationRequest(schema: typeof ElicitationRequestSchema, handler: (request: ElicitationRequest) => Promise<ElicitResult> | ElicitResult): void;
917
+ close: () => Promise<void>;
915
918
  }
916
-
919
+ //#endregion
920
+ //#region src/tool/mcp-apps.d.ts
917
921
  /**
918
922
  * MIME type for HTML resources that are meant to be rendered as MCP Apps.
919
923
  */
920
- declare const MCP_APP_MIME_TYPE: "text/html;profile=mcp-app";
924
+ export declare const MCP_APP_MIME_TYPE: "text/html;profile=mcp-app";
921
925
  /**
922
926
  * Client capabilities to pass to `createMCPClient` when the host supports MCP Apps.
923
927
  */
924
- declare const mcpAppClientCapabilities: {
925
- readonly extensions: {
926
- readonly "io.modelcontextprotocol/ui": {
927
- readonly mimeTypes: readonly ["text/html;profile=mcp-app"];
928
- };
928
+ export declare const mcpAppClientCapabilities: {
929
+ readonly extensions: {
930
+ readonly "io.modelcontextprotocol/ui": {
931
+ readonly mimeTypes: readonly ["text/html;profile=mcp-app"];
929
932
  };
933
+ };
930
934
  };
931
935
  /**
932
936
  * Content security policy metadata requested by an MCP App resource.
933
937
  */
934
938
  type MCPAppResourceCSP = {
935
- connectDomains?: string[];
936
- resourceDomains?: string[];
937
- frameDomains?: string[];
938
- [key: string]: unknown;
939
+ connectDomains?: string[];
940
+ resourceDomains?: string[];
941
+ frameDomains?: string[];
942
+ [key: string]: unknown;
939
943
  };
940
944
  /**
941
945
  * Host rendering metadata from an MCP App resource.
942
946
  */
943
947
  type MCPAppResourceMeta = {
944
- prefersBorder?: boolean;
945
- csp?: MCPAppResourceCSP;
946
- permissions?: Record<string, unknown>;
947
- [key: string]: unknown;
948
+ prefersBorder?: boolean;
949
+ csp?: MCPAppResourceCSP;
950
+ permissions?: Record<string, unknown>;
951
+ [key: string]: unknown;
948
952
  };
949
953
  /**
950
954
  * HTML and metadata needed by a host to render an MCP App.
951
955
  */
952
956
  type MCPAppResource = {
953
- uri: string;
954
- mimeType: typeof MCP_APP_MIME_TYPE;
955
- html: string;
956
- meta?: MCPAppResourceMeta;
957
+ uri: string;
958
+ mimeType: typeof MCP_APP_MIME_TYPE;
959
+ html: string;
960
+ meta?: MCPAppResourceMeta;
957
961
  };
958
962
  /**
959
963
  * Splits tool definitions into model-visible tools and app-visible tools.
960
964
  */
961
- declare function splitMCPAppTools(definitions: ListToolsResult): {
962
- modelVisible: ListToolsResult;
963
- appVisible: ListToolsResult;
965
+ export declare function splitMCPAppTools(definitions: ListToolsResult): {
966
+ modelVisible: ListToolsResult;
967
+ appVisible: ListToolsResult;
964
968
  };
965
969
  /**
966
970
  * Reads a `ui://` resource from an MCP server and normalizes it for rendering.
967
971
  */
968
- declare function readMCPAppResource({ client, uri, options, }: {
969
- client: Pick<MCPClient, 'readResource'>;
970
- uri: string;
971
- options?: RequestOptions;
972
+ export declare function readMCPAppResource({ client, uri, options }: {
973
+ client: Pick<MCPClient, 'readResource'>;
974
+ uri: string;
975
+ options?: RequestOptions;
972
976
  }): Promise<MCPAppResource>;
973
-
977
+ //#endregion
978
+ //#region src/tool/mcp-app-fingerprint.d.ts
974
979
  /**
975
980
  * Stable SHA-256 digest (base64url) over an MCP App resource's `html`, `csp`,
976
981
  * and `permissions`.
@@ -979,11 +984,12 @@ declare function readMCPAppResource({ client, uri, options, }: {
979
984
  * {@link detectMCPAppResourceDrift} to detect a changed resource. Baseline
980
985
  * storage and the response are the host's concern, mirroring `fingerprintTools`.
981
986
  */
982
- declare function fingerprintMCPAppResource(resource: MCPAppResource): Promise<string>;
987
+ export declare function fingerprintMCPAppResource(resource: MCPAppResource): Promise<string>;
983
988
  /**
984
989
  * Compares two fingerprints from {@link fingerprintMCPAppResource}. Returns
985
990
  * `true` when the current resource differs from its baseline.
986
991
  */
987
- declare function detectMCPAppResourceDrift(current: string, baseline: string): boolean;
988
-
989
- export { type CallToolResult, type CompleteRequestParams, type CompleteResult, type Configuration, type ElicitResult, ElicitResultSchema, type ElicitationRequest, ElicitationRequestSchema, type InitializeResult, type JSONRPCError, type JSONRPCMessage, type JSONRPCNotification, type JSONRPCRequest, type JSONRPCResponse, type ListToolsResult, type MCPAppResource, type MCPAppResourceCSP, type MCPAppResourceMeta, type MCPClient, type ClientCapabilities as MCPClientCapabilities, type MCPClientConfig, type MCPTransport, type MCPTransportCloseOptions, type MCPTransportSendOptions, MCP_APP_MIME_TYPE, type McpProviderMetadata, type McpToolAnnotations, type OAuthAuthorizationServerInformation, type OAuthClientInformation, type OAuthClientMetadata, type OAuthClientProvider, type OAuthTokens, UnauthorizedError, auth, createMCPClient, detectMCPAppResourceDrift, type MCPClient as experimental_MCPClient, type ClientCapabilities as experimental_MCPClientCapabilities, type MCPClientConfig as experimental_MCPClientConfig, createMCPClient as experimental_createMCPClient, fingerprintMCPAppResource, mcpAppClientCapabilities, readMCPAppResource, splitMCPAppTools, validateJSONRPCMessage };
992
+ export declare function detectMCPAppResourceDrift(current: string, baseline: string): boolean;
993
+ //#endregion
994
+ export { type CallToolResult, type CompleteRequestParams, type CompleteResult, type Configuration, type ElicitResult, type ElicitationRequest, type InitializeResult, type JSONRPCError, type JSONRPCMessage, type JSONRPCNotification, type JSONRPCRequest, type JSONRPCResponse, type ListToolsResult, type MCPAppResource, type MCPAppResourceCSP, type MCPAppResourceMeta, type MCPClient, type MCPClient as experimental_MCPClient, type ClientCapabilities as MCPClientCapabilities, type ClientCapabilities as experimental_MCPClientCapabilities, type MCPClientConfig, type MCPClientConfig as experimental_MCPClientConfig, type MCPTransport, type MCPTransportCloseOptions, type MCPTransportSendOptions, type McpProviderMetadata, type McpToolAnnotations, type OAuthAuthorizationServerInformation, type OAuthClientInformation, type OAuthClientMetadata, type OAuthClientProvider, type OAuthTokens, createMCPClient as experimental_createMCPClient };
995
+ //# sourceMappingURL=index.d.ts.map