tmcp 1.8.0 → 1.8.1
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/package.json +7 -5
- package/src/types/index.d.ts +946 -0
- package/src/types/index.d.ts.map +61 -0
- package/src/adapter.d.ts +0 -16
- package/src/index.d.ts +0 -140
- package/src/validation/index.d.ts +0 -4319
- package/src/validation/version.d.ts +0 -85
|
@@ -0,0 +1,946 @@
|
|
|
1
|
+
declare module 'tmcp' {
|
|
2
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
3
|
+
import type { JSONRPCRequest, JSONRPCServer, JSONRPCClient } from 'json-rpc-2.0';
|
|
4
|
+
import type { JSONSchema7 } from 'json-schema';
|
|
5
|
+
import * as v from 'valibot';
|
|
6
|
+
export class McpServer<StandardSchema extends StandardSchemaV1> {
|
|
7
|
+
|
|
8
|
+
constructor(server_info: ServerInfo, options: ServerOptions<StandardSchema>);
|
|
9
|
+
|
|
10
|
+
roots: Array<{
|
|
11
|
+
uri: string;
|
|
12
|
+
name?: string;
|
|
13
|
+
}>;
|
|
14
|
+
currentClientCapabilities(): {
|
|
15
|
+
experimental?: {} | undefined;
|
|
16
|
+
sampling?: {} | undefined;
|
|
17
|
+
elicitation?: {} | undefined;
|
|
18
|
+
roots?: {
|
|
19
|
+
listChanged?: boolean | undefined;
|
|
20
|
+
} | undefined;
|
|
21
|
+
} | undefined;
|
|
22
|
+
|
|
23
|
+
on<TEvent extends keyof McpEvents>(event: TEvent, callback: McpEvents[TEvent], options?: AddEventListenerOptions): () => void;
|
|
24
|
+
|
|
25
|
+
tool<TSchema extends StandardSchema | undefined = undefined>({ name, description, title, schema, annotations }: {
|
|
26
|
+
name: string;
|
|
27
|
+
description: string;
|
|
28
|
+
title?: string;
|
|
29
|
+
schema?: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema> extends Record<string, unknown> ? TSchema : never;
|
|
30
|
+
annotations?: ToolAnnotations;
|
|
31
|
+
}, execute: TSchema extends undefined ? (() => Promise<CallToolResult> | CallToolResult) : ((input: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>) => Promise<CallToolResult> | CallToolResult)): void;
|
|
32
|
+
|
|
33
|
+
prompt<TSchema extends StandardSchema | undefined = undefined>({ name, description, title, schema, complete }: {
|
|
34
|
+
name: string;
|
|
35
|
+
description: string;
|
|
36
|
+
title?: string;
|
|
37
|
+
schema?: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema> extends Record<string, unknown> ? TSchema : never;
|
|
38
|
+
complete?: NoInfer<TSchema extends undefined ? never : Partial<Record<keyof StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>, Completion>>>;
|
|
39
|
+
}, execute: TSchema extends undefined ? (() => Promise<GetPromptResult> | GetPromptResult) : (input: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>) => Promise<GetPromptResult> | GetPromptResult): void;
|
|
40
|
+
|
|
41
|
+
resource({ name, description, title, uri }: {
|
|
42
|
+
name: string;
|
|
43
|
+
description: string;
|
|
44
|
+
title?: string;
|
|
45
|
+
uri: string;
|
|
46
|
+
}, execute: (uri: string) => Promise<ReadResourceResult> | ReadResourceResult): void;
|
|
47
|
+
|
|
48
|
+
template<TUri extends string, TVariables extends ExtractURITemplateVariables<TUri>>({ name, description, title, uri, complete, list: list_resources }: {
|
|
49
|
+
name: string;
|
|
50
|
+
description: string;
|
|
51
|
+
title?: string;
|
|
52
|
+
uri: TUri;
|
|
53
|
+
complete?: NoInfer<TVariables extends never ? never : Partial<Record<TVariables, Completion>>>;
|
|
54
|
+
list?: () => Promise<Array<Resource>> | Array<Resource>;
|
|
55
|
+
}, execute: (uri: string, params: Record<TVariables, string | string[]>) => Promise<ReadResourceResult> | ReadResourceResult): void;
|
|
56
|
+
|
|
57
|
+
receive(message: JSONRPCResponse | JSONRPCRequest, session_id?: string): ReturnType<JSONRPCServer["receive"]> | ReturnType<JSONRPCClient["receive"] | undefined>;
|
|
58
|
+
/**
|
|
59
|
+
* Send a notification for subscriptions
|
|
60
|
+
* */
|
|
61
|
+
changed(what: SubscriptionsKeys, id: string): void;
|
|
62
|
+
/**
|
|
63
|
+
* Refresh roots list from client
|
|
64
|
+
*/
|
|
65
|
+
refreshRoots(): Promise<void>;
|
|
66
|
+
|
|
67
|
+
elicitation<TSchema extends StandardSchema>(schema: TSchema): Promise<StandardSchemaV1.InferOutput<TSchema>>;
|
|
68
|
+
/**
|
|
69
|
+
* Request language model sampling from the client
|
|
70
|
+
* */
|
|
71
|
+
message(request: CreateMessageRequestParams): Promise<CreateMessageResult>;
|
|
72
|
+
/**
|
|
73
|
+
* Log a message to the client if logging is enabled and the level is appropriate
|
|
74
|
+
*
|
|
75
|
+
*/
|
|
76
|
+
log(level: LoggingLevel, data: unknown, logger?: string): void;
|
|
77
|
+
#private;
|
|
78
|
+
}
|
|
79
|
+
export type ClientCapabilities = ClientCapabilities_1;
|
|
80
|
+
type Completion = (
|
|
81
|
+
query: string,
|
|
82
|
+
context: { arguments: Record<string, string> },
|
|
83
|
+
) => CompleteResult;
|
|
84
|
+
|
|
85
|
+
type ServerOptions<TSchema extends StandardSchemaV1> = {
|
|
86
|
+
capabilities?: ServerCapabilities;
|
|
87
|
+
instructions?: string;
|
|
88
|
+
adapter: JsonSchemaAdapter<TSchema>;
|
|
89
|
+
pagination?: {
|
|
90
|
+
resources?: { size?: number };
|
|
91
|
+
prompts?: { size?: number };
|
|
92
|
+
};
|
|
93
|
+
logging?: {
|
|
94
|
+
default: LoggingLevel;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
type ServerInfo = {
|
|
99
|
+
name: string;
|
|
100
|
+
version: string;
|
|
101
|
+
description: string;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
type SubscriptionsKeys = 'resource';
|
|
105
|
+
|
|
106
|
+
type McpEvents = {
|
|
107
|
+
send: (message: {
|
|
108
|
+
request: JSONRPCRequest;
|
|
109
|
+
context: {
|
|
110
|
+
sessions?: string[] | undefined;
|
|
111
|
+
};
|
|
112
|
+
}) => void;
|
|
113
|
+
initialize: (initialize_request: InitializeRequestParams) => void;
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* A successful (non-error) response to a request.
|
|
117
|
+
*/
|
|
118
|
+
const JSONRPCResponseSchema:StrictObjectSchema<{
|
|
119
|
+
readonly jsonrpc:LiteralSchema<"2.0", undefined>;
|
|
120
|
+
readonly id:UnionSchema<[StringSchema<undefined>,SchemaWithPipe<readonly [NumberSchema<undefined>,IntegerAction<number, undefined>]>], undefined>;
|
|
121
|
+
readonly result:ObjectSchema<{
|
|
122
|
+
/**
|
|
123
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
124
|
+
* for notes on _meta usage.
|
|
125
|
+
*/
|
|
126
|
+
readonly _meta:OptionalSchema<LooseObjectSchema<{}, undefined>, undefined>;
|
|
127
|
+
}, undefined>;
|
|
128
|
+
}, undefined>;
|
|
129
|
+
/**
|
|
130
|
+
* 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.
|
|
131
|
+
*/
|
|
132
|
+
const ClientCapabilitiesSchema:ObjectSchema<{
|
|
133
|
+
/**
|
|
134
|
+
* Experimental, non-standard capabilities that the client supports.
|
|
135
|
+
*/
|
|
136
|
+
readonly experimental:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
137
|
+
/**
|
|
138
|
+
* Present if the client supports sampling from an LLM.
|
|
139
|
+
*/
|
|
140
|
+
readonly sampling:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
141
|
+
/**
|
|
142
|
+
* Present if the client supports eliciting user input.
|
|
143
|
+
*/
|
|
144
|
+
readonly elicitation:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
145
|
+
/**
|
|
146
|
+
* Present if the client supports listing roots.
|
|
147
|
+
*/
|
|
148
|
+
readonly roots:OptionalSchema<ObjectSchema<{
|
|
149
|
+
/**
|
|
150
|
+
* Whether the client supports issuing notifications for changes to the roots list.
|
|
151
|
+
*/
|
|
152
|
+
readonly listChanged:OptionalSchema<BooleanSchema<undefined>, undefined>;
|
|
153
|
+
}, undefined>, undefined>;
|
|
154
|
+
}, undefined>;
|
|
155
|
+
const InitializeRequestParamsSchema:ObjectSchema<{
|
|
156
|
+
/**
|
|
157
|
+
* The latest version of the Model Context Protocol that the client supports. The client MAY decide to support older versions as well.
|
|
158
|
+
*/
|
|
159
|
+
readonly protocolVersion:StringSchema<undefined>;
|
|
160
|
+
readonly capabilities:ObjectSchema<{
|
|
161
|
+
/**
|
|
162
|
+
* Experimental, non-standard capabilities that the client supports.
|
|
163
|
+
*/
|
|
164
|
+
readonly experimental:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
165
|
+
/**
|
|
166
|
+
* Present if the client supports sampling from an LLM.
|
|
167
|
+
*/
|
|
168
|
+
readonly sampling:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
169
|
+
/**
|
|
170
|
+
* Present if the client supports eliciting user input.
|
|
171
|
+
*/
|
|
172
|
+
readonly elicitation:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
173
|
+
/**
|
|
174
|
+
* Present if the client supports listing roots.
|
|
175
|
+
*/
|
|
176
|
+
readonly roots:OptionalSchema<ObjectSchema<{
|
|
177
|
+
/**
|
|
178
|
+
* Whether the client supports issuing notifications for changes to the roots list.
|
|
179
|
+
*/
|
|
180
|
+
readonly listChanged:OptionalSchema<BooleanSchema<undefined>, undefined>;
|
|
181
|
+
}, undefined>, undefined>;
|
|
182
|
+
}, undefined>;
|
|
183
|
+
readonly clientInfo:ObjectSchema<{
|
|
184
|
+
readonly version:StringSchema<undefined>;
|
|
185
|
+
/** Intended for programmatic or logical use, but used as a display name in past specs or fallback */
|
|
186
|
+
readonly name:StringSchema<undefined>;
|
|
187
|
+
/**
|
|
188
|
+
* Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
|
|
189
|
+
* even by those unfamiliar with domain-specific terminology.
|
|
190
|
+
*
|
|
191
|
+
* If not provided, the name should be used for display (except for Tool,
|
|
192
|
+
* where `annotations.title` should be given precedence over using `name`,
|
|
193
|
+
* if present).
|
|
194
|
+
*/
|
|
195
|
+
readonly title:OptionalSchema<StringSchema<undefined>, undefined>;
|
|
196
|
+
}, undefined>;
|
|
197
|
+
readonly _meta:OptionalSchema<LooseObjectSchema<{
|
|
198
|
+
/**
|
|
199
|
+
* 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.
|
|
200
|
+
*/
|
|
201
|
+
readonly progressToken:OptionalSchema<UnionSchema<[StringSchema<undefined>,SchemaWithPipe<readonly [NumberSchema<undefined>,IntegerAction<number, undefined>]>], undefined>, undefined>;
|
|
202
|
+
}, undefined>, undefined>;
|
|
203
|
+
}, undefined>;
|
|
204
|
+
/**
|
|
205
|
+
* 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.
|
|
206
|
+
*/
|
|
207
|
+
const ServerCapabilitiesSchema:ObjectSchema<{
|
|
208
|
+
/**
|
|
209
|
+
* Experimental, non-standard capabilities that the server supports.
|
|
210
|
+
*/
|
|
211
|
+
readonly experimental:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
212
|
+
/**
|
|
213
|
+
* Present if the server supports sending log messages to the client.
|
|
214
|
+
*/
|
|
215
|
+
readonly logging:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
216
|
+
/**
|
|
217
|
+
* Present if the server supports sending completions to the client.
|
|
218
|
+
*/
|
|
219
|
+
readonly completions:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
220
|
+
/**
|
|
221
|
+
* Present if the server offers any prompt templates.
|
|
222
|
+
*/
|
|
223
|
+
readonly prompts:OptionalSchema<ObjectSchema<{
|
|
224
|
+
/**
|
|
225
|
+
* Whether this server supports issuing notifications for changes to the prompt list.
|
|
226
|
+
*/
|
|
227
|
+
readonly listChanged:OptionalSchema<BooleanSchema<undefined>, undefined>;
|
|
228
|
+
}, undefined>, undefined>;
|
|
229
|
+
/**
|
|
230
|
+
* Present if the server offers any resources to read.
|
|
231
|
+
*/
|
|
232
|
+
readonly resources:OptionalSchema<ObjectSchema<{
|
|
233
|
+
/**
|
|
234
|
+
* Whether this server supports clients subscribing to resource updates.
|
|
235
|
+
*/
|
|
236
|
+
readonly subscribe:OptionalSchema<BooleanSchema<undefined>, undefined>;
|
|
237
|
+
/**
|
|
238
|
+
* Whether this server supports issuing notifications for changes to the resource list.
|
|
239
|
+
*/
|
|
240
|
+
readonly listChanged:OptionalSchema<BooleanSchema<undefined>, undefined>;
|
|
241
|
+
}, undefined>, undefined>;
|
|
242
|
+
/**
|
|
243
|
+
* Present if the server offers any tools to call.
|
|
244
|
+
*/
|
|
245
|
+
readonly tools:OptionalSchema<ObjectSchema<{
|
|
246
|
+
/**
|
|
247
|
+
* Whether this server supports issuing notifications for changes to the tool list.
|
|
248
|
+
*/
|
|
249
|
+
readonly listChanged:OptionalSchema<BooleanSchema<undefined>, undefined>;
|
|
250
|
+
}, undefined>, undefined>;
|
|
251
|
+
}, undefined>;
|
|
252
|
+
/**
|
|
253
|
+
* A known resource that the server is capable of reading.
|
|
254
|
+
*/
|
|
255
|
+
const ResourceSchema:ObjectSchema<{
|
|
256
|
+
/**
|
|
257
|
+
* The URI of this resource.
|
|
258
|
+
*/
|
|
259
|
+
readonly uri:StringSchema<undefined>;
|
|
260
|
+
/**
|
|
261
|
+
* A description of what this resource represents.
|
|
262
|
+
*
|
|
263
|
+
* This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.
|
|
264
|
+
*/
|
|
265
|
+
readonly description:OptionalSchema<StringSchema<undefined>, undefined>;
|
|
266
|
+
/**
|
|
267
|
+
* The MIME type of this resource, if known.
|
|
268
|
+
*/
|
|
269
|
+
readonly mimeType:OptionalSchema<StringSchema<undefined>, undefined>;
|
|
270
|
+
/**
|
|
271
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
272
|
+
* for notes on _meta usage.
|
|
273
|
+
*/
|
|
274
|
+
readonly _meta:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
275
|
+
/** Intended for programmatic or logical use, but used as a display name in past specs or fallback */
|
|
276
|
+
readonly name:StringSchema<undefined>;
|
|
277
|
+
/**
|
|
278
|
+
* Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
|
|
279
|
+
* even by those unfamiliar with domain-specific terminology.
|
|
280
|
+
*
|
|
281
|
+
* If not provided, the name should be used for display (except for Tool,
|
|
282
|
+
* where `annotations.title` should be given precedence over using `name`,
|
|
283
|
+
* if present).
|
|
284
|
+
*/
|
|
285
|
+
readonly title:OptionalSchema<StringSchema<undefined>, undefined>;
|
|
286
|
+
}, undefined>;
|
|
287
|
+
/**
|
|
288
|
+
* The server's response to a resources/read request from the client.
|
|
289
|
+
*/
|
|
290
|
+
const ReadResourceResultSchema:ObjectSchema<{
|
|
291
|
+
readonly contents:ArraySchema<UnionSchema<[ObjectSchema<{
|
|
292
|
+
/**
|
|
293
|
+
* The text of the item. This must only be set if the item can actually be represented as text (not binary data).
|
|
294
|
+
*/
|
|
295
|
+
readonly text:StringSchema<undefined>;
|
|
296
|
+
/**
|
|
297
|
+
* The URI of this resource.
|
|
298
|
+
*/
|
|
299
|
+
readonly uri:StringSchema<undefined>;
|
|
300
|
+
/**
|
|
301
|
+
* The MIME type of this resource, if known.
|
|
302
|
+
*/
|
|
303
|
+
readonly mimeType:OptionalSchema<StringSchema<undefined>, undefined>;
|
|
304
|
+
/**
|
|
305
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
306
|
+
* for notes on _meta usage.
|
|
307
|
+
*/
|
|
308
|
+
readonly _meta:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
309
|
+
}, undefined>,ObjectSchema<{
|
|
310
|
+
/**
|
|
311
|
+
* A base64-encoded string representing the binary data of the item.
|
|
312
|
+
*/
|
|
313
|
+
readonly blob:SchemaWithPipe<readonly [StringSchema<undefined>,Base64Action<string, undefined>]>;
|
|
314
|
+
/**
|
|
315
|
+
* The URI of this resource.
|
|
316
|
+
*/
|
|
317
|
+
readonly uri:StringSchema<undefined>;
|
|
318
|
+
/**
|
|
319
|
+
* The MIME type of this resource, if known.
|
|
320
|
+
*/
|
|
321
|
+
readonly mimeType:OptionalSchema<StringSchema<undefined>, undefined>;
|
|
322
|
+
/**
|
|
323
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
324
|
+
* for notes on _meta usage.
|
|
325
|
+
*/
|
|
326
|
+
readonly _meta:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
327
|
+
}, undefined>], undefined>, undefined>;
|
|
328
|
+
/**
|
|
329
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
330
|
+
* for notes on _meta usage.
|
|
331
|
+
*/
|
|
332
|
+
readonly _meta:OptionalSchema<LooseObjectSchema<{}, undefined>, undefined>;
|
|
333
|
+
}, undefined>;
|
|
334
|
+
/**
|
|
335
|
+
* The server's response to a prompts/get request from the client.
|
|
336
|
+
*/
|
|
337
|
+
const GetPromptResultSchema:ObjectSchema<{
|
|
338
|
+
/**
|
|
339
|
+
* An optional description for the prompt.
|
|
340
|
+
*/
|
|
341
|
+
readonly description:OptionalSchema<StringSchema<undefined>, undefined>;
|
|
342
|
+
readonly messages:ArraySchema<ObjectSchema<{
|
|
343
|
+
readonly role:PicklistSchema<["user", "assistant"], undefined>;
|
|
344
|
+
readonly content:UnionSchema<[ObjectSchema<{
|
|
345
|
+
readonly type:LiteralSchema<"text", undefined>;
|
|
346
|
+
/**
|
|
347
|
+
* The text content of the message.
|
|
348
|
+
*/
|
|
349
|
+
readonly text:StringSchema<undefined>;
|
|
350
|
+
/**
|
|
351
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
352
|
+
* for notes on _meta usage.
|
|
353
|
+
*/
|
|
354
|
+
readonly _meta:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
355
|
+
}, undefined>,ObjectSchema<{
|
|
356
|
+
readonly type:LiteralSchema<"image", undefined>;
|
|
357
|
+
/**
|
|
358
|
+
* The base64-encoded image data.
|
|
359
|
+
*/
|
|
360
|
+
readonly data:SchemaWithPipe<readonly [StringSchema<undefined>,Base64Action<string, undefined>]>;
|
|
361
|
+
/**
|
|
362
|
+
* The MIME type of the image. Different providers may support different image types.
|
|
363
|
+
*/
|
|
364
|
+
readonly mimeType:StringSchema<undefined>;
|
|
365
|
+
/**
|
|
366
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
367
|
+
* for notes on _meta usage.
|
|
368
|
+
*/
|
|
369
|
+
readonly _meta:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
370
|
+
}, undefined>,ObjectSchema<{
|
|
371
|
+
readonly type:LiteralSchema<"audio", undefined>;
|
|
372
|
+
/**
|
|
373
|
+
* The base64-encoded audio data.
|
|
374
|
+
*/
|
|
375
|
+
readonly data:SchemaWithPipe<readonly [StringSchema<undefined>,Base64Action<string, undefined>]>;
|
|
376
|
+
/**
|
|
377
|
+
* The MIME type of the audio. Different providers may support different audio types.
|
|
378
|
+
*/
|
|
379
|
+
readonly mimeType:StringSchema<undefined>;
|
|
380
|
+
/**
|
|
381
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
382
|
+
* for notes on _meta usage.
|
|
383
|
+
*/
|
|
384
|
+
readonly _meta:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
385
|
+
}, undefined>,ObjectSchema<{
|
|
386
|
+
readonly type:LiteralSchema<"resource_link", undefined>;
|
|
387
|
+
/**
|
|
388
|
+
* The URI of this resource.
|
|
389
|
+
*/
|
|
390
|
+
readonly uri:StringSchema<undefined>;
|
|
391
|
+
/**
|
|
392
|
+
* A description of what this resource represents.
|
|
393
|
+
*
|
|
394
|
+
* This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.
|
|
395
|
+
*/
|
|
396
|
+
readonly description:OptionalSchema<StringSchema<undefined>, undefined>;
|
|
397
|
+
/**
|
|
398
|
+
* The MIME type of this resource, if known.
|
|
399
|
+
*/
|
|
400
|
+
readonly mimeType:OptionalSchema<StringSchema<undefined>, undefined>;
|
|
401
|
+
/**
|
|
402
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
403
|
+
* for notes on _meta usage.
|
|
404
|
+
*/
|
|
405
|
+
readonly _meta:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
406
|
+
/** Intended for programmatic or logical use, but used as a display name in past specs or fallback */
|
|
407
|
+
readonly name:StringSchema<undefined>;
|
|
408
|
+
/**
|
|
409
|
+
* Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
|
|
410
|
+
* even by those unfamiliar with domain-specific terminology.
|
|
411
|
+
*
|
|
412
|
+
* If not provided, the name should be used for display (except for Tool,
|
|
413
|
+
* where `annotations.title` should be given precedence over using `name`,
|
|
414
|
+
* if present).
|
|
415
|
+
*/
|
|
416
|
+
readonly title:OptionalSchema<StringSchema<undefined>, undefined>;
|
|
417
|
+
}, undefined>,ObjectSchema<{
|
|
418
|
+
readonly type:LiteralSchema<"resource", undefined>;
|
|
419
|
+
readonly resource:UnionSchema<[ObjectSchema<{
|
|
420
|
+
/**
|
|
421
|
+
* The text of the item. This must only be set if the item can actually be represented as text (not binary data).
|
|
422
|
+
*/
|
|
423
|
+
readonly text:StringSchema<undefined>;
|
|
424
|
+
/**
|
|
425
|
+
* The URI of this resource.
|
|
426
|
+
*/
|
|
427
|
+
readonly uri:StringSchema<undefined>;
|
|
428
|
+
/**
|
|
429
|
+
* The MIME type of this resource, if known.
|
|
430
|
+
*/
|
|
431
|
+
readonly mimeType:OptionalSchema<StringSchema<undefined>, undefined>;
|
|
432
|
+
/**
|
|
433
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
434
|
+
* for notes on _meta usage.
|
|
435
|
+
*/
|
|
436
|
+
readonly _meta:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
437
|
+
}, undefined>,ObjectSchema<{
|
|
438
|
+
/**
|
|
439
|
+
* A base64-encoded string representing the binary data of the item.
|
|
440
|
+
*/
|
|
441
|
+
readonly blob:SchemaWithPipe<readonly [StringSchema<undefined>,Base64Action<string, undefined>]>;
|
|
442
|
+
/**
|
|
443
|
+
* The URI of this resource.
|
|
444
|
+
*/
|
|
445
|
+
readonly uri:StringSchema<undefined>;
|
|
446
|
+
/**
|
|
447
|
+
* The MIME type of this resource, if known.
|
|
448
|
+
*/
|
|
449
|
+
readonly mimeType:OptionalSchema<StringSchema<undefined>, undefined>;
|
|
450
|
+
/**
|
|
451
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
452
|
+
* for notes on _meta usage.
|
|
453
|
+
*/
|
|
454
|
+
readonly _meta:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
455
|
+
}, undefined>], undefined>;
|
|
456
|
+
/**
|
|
457
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
458
|
+
* for notes on _meta usage.
|
|
459
|
+
*/
|
|
460
|
+
readonly _meta:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
461
|
+
}, undefined>], undefined>;
|
|
462
|
+
}, undefined>, undefined>;
|
|
463
|
+
/**
|
|
464
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
465
|
+
* for notes on _meta usage.
|
|
466
|
+
*/
|
|
467
|
+
readonly _meta:OptionalSchema<LooseObjectSchema<{}, undefined>, undefined>;
|
|
468
|
+
}, undefined>;
|
|
469
|
+
/**
|
|
470
|
+
* Additional properties describing a Tool to clients.
|
|
471
|
+
*
|
|
472
|
+
* NOTE: all properties in ToolAnnotations are **hints**.
|
|
473
|
+
* They are not guaranteed to provide a faithful description of
|
|
474
|
+
* tool behavior (including descriptive properties like `title`).
|
|
475
|
+
*
|
|
476
|
+
* Clients should never make tool use decisions based on ToolAnnotations
|
|
477
|
+
* received from untrusted servers.
|
|
478
|
+
*/
|
|
479
|
+
const ToolAnnotationsSchema:ObjectSchema<{
|
|
480
|
+
/**
|
|
481
|
+
* A human-readable title for the tool.
|
|
482
|
+
*/
|
|
483
|
+
readonly title:OptionalSchema<StringSchema<undefined>, undefined>;
|
|
484
|
+
/**
|
|
485
|
+
* If true, the tool does not modify its environment.
|
|
486
|
+
*
|
|
487
|
+
* Default: false
|
|
488
|
+
*/
|
|
489
|
+
readonly readOnlyHint:OptionalSchema<BooleanSchema<undefined>, undefined>;
|
|
490
|
+
/**
|
|
491
|
+
* If true, the tool may perform destructive updates to its environment.
|
|
492
|
+
* If false, the tool performs only additive updates.
|
|
493
|
+
*
|
|
494
|
+
* (This property is meaningful only when `readOnlyHint == false`)
|
|
495
|
+
*
|
|
496
|
+
* Default: true
|
|
497
|
+
*/
|
|
498
|
+
readonly destructiveHint:OptionalSchema<BooleanSchema<undefined>, undefined>;
|
|
499
|
+
/**
|
|
500
|
+
* If true, calling the tool repeatedly with the same arguments
|
|
501
|
+
* will have no additional effect on the its environment.
|
|
502
|
+
*
|
|
503
|
+
* (This property is meaningful only when `readOnlyHint == false`)
|
|
504
|
+
*
|
|
505
|
+
* Default: false
|
|
506
|
+
*/
|
|
507
|
+
readonly idempotentHint:OptionalSchema<BooleanSchema<undefined>, undefined>;
|
|
508
|
+
/**
|
|
509
|
+
* If true, this tool may interact with an "open world" of external
|
|
510
|
+
* entities. If false, the tool's domain of interaction is closed.
|
|
511
|
+
* For example, the world of a web search tool is open, whereas that
|
|
512
|
+
* of a memory tool is not.
|
|
513
|
+
*
|
|
514
|
+
* Default: true
|
|
515
|
+
*/
|
|
516
|
+
readonly openWorldHint:OptionalSchema<BooleanSchema<undefined>, undefined>;
|
|
517
|
+
}, undefined>;
|
|
518
|
+
/**
|
|
519
|
+
* The server's response to a tool call.
|
|
520
|
+
*/
|
|
521
|
+
const CallToolResultSchema:ObjectSchema<{
|
|
522
|
+
/**
|
|
523
|
+
* A list of content objects that represent the result of the tool call.
|
|
524
|
+
*
|
|
525
|
+
* If the Tool does not define an outputSchema, this field MUST be present in the result.
|
|
526
|
+
* For backwards compatibility, this field is always present, but it may be empty.
|
|
527
|
+
*/
|
|
528
|
+
readonly content:OptionalSchema<ArraySchema<UnionSchema<[ObjectSchema<{
|
|
529
|
+
readonly type:LiteralSchema<"text", undefined>;
|
|
530
|
+
/**
|
|
531
|
+
* The text content of the message.
|
|
532
|
+
*/
|
|
533
|
+
readonly text:StringSchema<undefined>;
|
|
534
|
+
/**
|
|
535
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
536
|
+
* for notes on _meta usage.
|
|
537
|
+
*/
|
|
538
|
+
readonly _meta:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
539
|
+
}, undefined>,ObjectSchema<{
|
|
540
|
+
readonly type:LiteralSchema<"image", undefined>;
|
|
541
|
+
/**
|
|
542
|
+
* The base64-encoded image data.
|
|
543
|
+
*/
|
|
544
|
+
readonly data:SchemaWithPipe<readonly [StringSchema<undefined>,Base64Action<string, undefined>]>;
|
|
545
|
+
/**
|
|
546
|
+
* The MIME type of the image. Different providers may support different image types.
|
|
547
|
+
*/
|
|
548
|
+
readonly mimeType:StringSchema<undefined>;
|
|
549
|
+
/**
|
|
550
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
551
|
+
* for notes on _meta usage.
|
|
552
|
+
*/
|
|
553
|
+
readonly _meta:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
554
|
+
}, undefined>,ObjectSchema<{
|
|
555
|
+
readonly type:LiteralSchema<"audio", undefined>;
|
|
556
|
+
/**
|
|
557
|
+
* The base64-encoded audio data.
|
|
558
|
+
*/
|
|
559
|
+
readonly data:SchemaWithPipe<readonly [StringSchema<undefined>,Base64Action<string, undefined>]>;
|
|
560
|
+
/**
|
|
561
|
+
* The MIME type of the audio. Different providers may support different audio types.
|
|
562
|
+
*/
|
|
563
|
+
readonly mimeType:StringSchema<undefined>;
|
|
564
|
+
/**
|
|
565
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
566
|
+
* for notes on _meta usage.
|
|
567
|
+
*/
|
|
568
|
+
readonly _meta:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
569
|
+
}, undefined>,ObjectSchema<{
|
|
570
|
+
readonly type:LiteralSchema<"resource_link", undefined>;
|
|
571
|
+
/**
|
|
572
|
+
* The URI of this resource.
|
|
573
|
+
*/
|
|
574
|
+
readonly uri:StringSchema<undefined>;
|
|
575
|
+
/**
|
|
576
|
+
* A description of what this resource represents.
|
|
577
|
+
*
|
|
578
|
+
* This can be used by clients to improve the LLM's understanding of available resources. It can be thought of like a "hint" to the model.
|
|
579
|
+
*/
|
|
580
|
+
readonly description:OptionalSchema<StringSchema<undefined>, undefined>;
|
|
581
|
+
/**
|
|
582
|
+
* The MIME type of this resource, if known.
|
|
583
|
+
*/
|
|
584
|
+
readonly mimeType:OptionalSchema<StringSchema<undefined>, undefined>;
|
|
585
|
+
/**
|
|
586
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
587
|
+
* for notes on _meta usage.
|
|
588
|
+
*/
|
|
589
|
+
readonly _meta:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
590
|
+
/** Intended for programmatic or logical use, but used as a display name in past specs or fallback */
|
|
591
|
+
readonly name:StringSchema<undefined>;
|
|
592
|
+
/**
|
|
593
|
+
* Intended for UI and end-user contexts — optimized to be human-readable and easily understood,
|
|
594
|
+
* even by those unfamiliar with domain-specific terminology.
|
|
595
|
+
*
|
|
596
|
+
* If not provided, the name should be used for display (except for Tool,
|
|
597
|
+
* where `annotations.title` should be given precedence over using `name`,
|
|
598
|
+
* if present).
|
|
599
|
+
*/
|
|
600
|
+
readonly title:OptionalSchema<StringSchema<undefined>, undefined>;
|
|
601
|
+
}, undefined>,ObjectSchema<{
|
|
602
|
+
readonly type:LiteralSchema<"resource", undefined>;
|
|
603
|
+
readonly resource:UnionSchema<[ObjectSchema<{
|
|
604
|
+
/**
|
|
605
|
+
* The text of the item. This must only be set if the item can actually be represented as text (not binary data).
|
|
606
|
+
*/
|
|
607
|
+
readonly text:StringSchema<undefined>;
|
|
608
|
+
/**
|
|
609
|
+
* The URI of this resource.
|
|
610
|
+
*/
|
|
611
|
+
readonly uri:StringSchema<undefined>;
|
|
612
|
+
/**
|
|
613
|
+
* The MIME type of this resource, if known.
|
|
614
|
+
*/
|
|
615
|
+
readonly mimeType:OptionalSchema<StringSchema<undefined>, undefined>;
|
|
616
|
+
/**
|
|
617
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
618
|
+
* for notes on _meta usage.
|
|
619
|
+
*/
|
|
620
|
+
readonly _meta:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
621
|
+
}, undefined>,ObjectSchema<{
|
|
622
|
+
/**
|
|
623
|
+
* A base64-encoded string representing the binary data of the item.
|
|
624
|
+
*/
|
|
625
|
+
readonly blob:SchemaWithPipe<readonly [StringSchema<undefined>,Base64Action<string, undefined>]>;
|
|
626
|
+
/**
|
|
627
|
+
* The URI of this resource.
|
|
628
|
+
*/
|
|
629
|
+
readonly uri:StringSchema<undefined>;
|
|
630
|
+
/**
|
|
631
|
+
* The MIME type of this resource, if known.
|
|
632
|
+
*/
|
|
633
|
+
readonly mimeType:OptionalSchema<StringSchema<undefined>, undefined>;
|
|
634
|
+
/**
|
|
635
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
636
|
+
* for notes on _meta usage.
|
|
637
|
+
*/
|
|
638
|
+
readonly _meta:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
639
|
+
}, undefined>], undefined>;
|
|
640
|
+
/**
|
|
641
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
642
|
+
* for notes on _meta usage.
|
|
643
|
+
*/
|
|
644
|
+
readonly _meta:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
645
|
+
}, undefined>], undefined>, undefined>, readonly []>;
|
|
646
|
+
/**
|
|
647
|
+
* An object containing structured tool output.
|
|
648
|
+
*
|
|
649
|
+
* If the Tool defines an outputSchema, this field MUST be present in the result, and contain a JSON object that matches the schema.
|
|
650
|
+
*/
|
|
651
|
+
readonly structuredContent:OptionalSchema<LooseObjectSchema<{}, undefined>, undefined>;
|
|
652
|
+
/**
|
|
653
|
+
* Whether the tool call ended in an error.
|
|
654
|
+
*
|
|
655
|
+
* If not set, this is assumed to be false (the call was successful).
|
|
656
|
+
*
|
|
657
|
+
* Any errors that originate from the tool SHOULD be reported inside the result
|
|
658
|
+
* object, with `isError` set to true, _not_ as an MCP protocol-level error
|
|
659
|
+
* response. Otherwise, the LLM would not be able to see that an error occurred
|
|
660
|
+
* and self-correct.
|
|
661
|
+
*
|
|
662
|
+
* However, any errors in _finding_ the tool, an error indicating that the
|
|
663
|
+
* server does not support tool calls, or any other exceptional conditions,
|
|
664
|
+
* should be reported as an MCP error response.
|
|
665
|
+
*/
|
|
666
|
+
readonly isError:OptionalSchema<BooleanSchema<undefined>, undefined>;
|
|
667
|
+
/**
|
|
668
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
669
|
+
* for notes on _meta usage.
|
|
670
|
+
*/
|
|
671
|
+
readonly _meta:OptionalSchema<LooseObjectSchema<{}, undefined>, undefined>;
|
|
672
|
+
}, undefined>;
|
|
673
|
+
/**
|
|
674
|
+
* The severity of a log message.
|
|
675
|
+
*/
|
|
676
|
+
const LoggingLevelSchema:PicklistSchema<["debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"], undefined>;
|
|
677
|
+
const CreateMessageRequestParamsSchema:ObjectSchema<{
|
|
678
|
+
readonly messages:ArraySchema<ObjectSchema<{
|
|
679
|
+
readonly role:PicklistSchema<["user", "assistant"], undefined>;
|
|
680
|
+
readonly content:UnionSchema<[ObjectSchema<{
|
|
681
|
+
readonly type:LiteralSchema<"text", undefined>;
|
|
682
|
+
/**
|
|
683
|
+
* The text content of the message.
|
|
684
|
+
*/
|
|
685
|
+
readonly text:StringSchema<undefined>;
|
|
686
|
+
/**
|
|
687
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
688
|
+
* for notes on _meta usage.
|
|
689
|
+
*/
|
|
690
|
+
readonly _meta:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
691
|
+
}, undefined>,ObjectSchema<{
|
|
692
|
+
readonly type:LiteralSchema<"image", undefined>;
|
|
693
|
+
/**
|
|
694
|
+
* The base64-encoded image data.
|
|
695
|
+
*/
|
|
696
|
+
readonly data:SchemaWithPipe<readonly [StringSchema<undefined>,Base64Action<string, undefined>]>;
|
|
697
|
+
/**
|
|
698
|
+
* The MIME type of the image. Different providers may support different image types.
|
|
699
|
+
*/
|
|
700
|
+
readonly mimeType:StringSchema<undefined>;
|
|
701
|
+
/**
|
|
702
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
703
|
+
* for notes on _meta usage.
|
|
704
|
+
*/
|
|
705
|
+
readonly _meta:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
706
|
+
}, undefined>,ObjectSchema<{
|
|
707
|
+
readonly type:LiteralSchema<"audio", undefined>;
|
|
708
|
+
/**
|
|
709
|
+
* The base64-encoded audio data.
|
|
710
|
+
*/
|
|
711
|
+
readonly data:SchemaWithPipe<readonly [StringSchema<undefined>,Base64Action<string, undefined>]>;
|
|
712
|
+
/**
|
|
713
|
+
* The MIME type of the audio. Different providers may support different audio types.
|
|
714
|
+
*/
|
|
715
|
+
readonly mimeType:StringSchema<undefined>;
|
|
716
|
+
/**
|
|
717
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
718
|
+
* for notes on _meta usage.
|
|
719
|
+
*/
|
|
720
|
+
readonly _meta:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
721
|
+
}, undefined>], undefined>;
|
|
722
|
+
}, undefined>, undefined>;
|
|
723
|
+
/**
|
|
724
|
+
* An optional system prompt the server wants to use for sampling. The client MAY modify or omit this prompt.
|
|
725
|
+
*/
|
|
726
|
+
readonly systemPrompt:OptionalSchema<StringSchema<undefined>, undefined>;
|
|
727
|
+
/**
|
|
728
|
+
* A request to include context from one or more MCP servers (including the caller), to be attached to the prompt. The client MAY ignore this request.
|
|
729
|
+
*/
|
|
730
|
+
readonly includeContext:OptionalSchema<PicklistSchema<["none", "thisServer", "allServers"], undefined>, undefined>;
|
|
731
|
+
readonly temperature:OptionalSchema<NumberSchema<undefined>, undefined>;
|
|
732
|
+
/**
|
|
733
|
+
* The maximum number of tokens to sample, as requested by the server. The client MAY choose to sample fewer tokens than requested.
|
|
734
|
+
*/
|
|
735
|
+
readonly maxTokens:SchemaWithPipe<readonly [NumberSchema<undefined>,IntegerAction<number, undefined>]>;
|
|
736
|
+
readonly stopSequences:OptionalSchema<ArraySchema<StringSchema<undefined>, undefined>, undefined>;
|
|
737
|
+
/**
|
|
738
|
+
* Optional metadata to pass through to the LLM provider. The format of this metadata is provider-specific.
|
|
739
|
+
*/
|
|
740
|
+
readonly metadata:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
741
|
+
/**
|
|
742
|
+
* The server's preferences for which model to select.
|
|
743
|
+
*/
|
|
744
|
+
readonly modelPreferences:OptionalSchema<ObjectSchema<{
|
|
745
|
+
/**
|
|
746
|
+
* Optional hints to use for model selection.
|
|
747
|
+
*/
|
|
748
|
+
readonly hints:OptionalSchema<ArraySchema<ObjectSchema<{
|
|
749
|
+
/**
|
|
750
|
+
* A hint for a model name.
|
|
751
|
+
*/
|
|
752
|
+
readonly name:OptionalSchema<StringSchema<undefined>, undefined>;
|
|
753
|
+
}, undefined>, undefined>, undefined>;
|
|
754
|
+
/**
|
|
755
|
+
* How much to prioritize cost when selecting a model.
|
|
756
|
+
*/
|
|
757
|
+
readonly costPriority:OptionalSchema<SchemaWithPipe<readonly [NumberSchema<undefined>,MinValueAction<number, 0, undefined>,MaxValueAction<number, 1, undefined>]>, undefined>;
|
|
758
|
+
/**
|
|
759
|
+
* How much to prioritize sampling speed (latency) when selecting a model.
|
|
760
|
+
*/
|
|
761
|
+
readonly speedPriority:OptionalSchema<SchemaWithPipe<readonly [NumberSchema<undefined>,MinValueAction<number, 0, undefined>,MaxValueAction<number, 1, undefined>]>, undefined>;
|
|
762
|
+
/**
|
|
763
|
+
* How much to prioritize intelligence and capabilities when selecting a model.
|
|
764
|
+
*/
|
|
765
|
+
readonly intelligencePriority:OptionalSchema<SchemaWithPipe<readonly [NumberSchema<undefined>,MinValueAction<number, 0, undefined>,MaxValueAction<number, 1, undefined>]>, undefined>;
|
|
766
|
+
}, undefined>, undefined>;
|
|
767
|
+
readonly _meta:OptionalSchema<LooseObjectSchema<{
|
|
768
|
+
/**
|
|
769
|
+
* 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.
|
|
770
|
+
*/
|
|
771
|
+
readonly progressToken:OptionalSchema<UnionSchema<[StringSchema<undefined>,SchemaWithPipe<readonly [NumberSchema<undefined>,IntegerAction<number, undefined>]>], undefined>, undefined>;
|
|
772
|
+
}, undefined>, undefined>;
|
|
773
|
+
}, undefined>;
|
|
774
|
+
/**
|
|
775
|
+
* The client's response to a sampling/create_message request from the server. The client should inform the user before returning the sampled message, to allow them to inspect the response (human in the loop) and decide whether to allow the server to see it.
|
|
776
|
+
*/
|
|
777
|
+
const CreateMessageResultSchema:ObjectSchema<{
|
|
778
|
+
/**
|
|
779
|
+
* The name of the model that generated the message.
|
|
780
|
+
*/
|
|
781
|
+
readonly model:StringSchema<undefined>;
|
|
782
|
+
/**
|
|
783
|
+
* The reason why sampling stopped.
|
|
784
|
+
*/
|
|
785
|
+
readonly stopReason:OptionalSchema<UnionSchema<[PicklistSchema<["endTurn", "stopSequence", "maxTokens"], undefined>,StringSchema<undefined>], undefined>, undefined>;
|
|
786
|
+
readonly role:PicklistSchema<["user", "assistant"], undefined>;
|
|
787
|
+
readonly content:VariantSchema<"type", [ObjectSchema<{
|
|
788
|
+
readonly type:LiteralSchema<"text", undefined>;
|
|
789
|
+
/**
|
|
790
|
+
* The text content of the message.
|
|
791
|
+
*/
|
|
792
|
+
readonly text:StringSchema<undefined>;
|
|
793
|
+
/**
|
|
794
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
795
|
+
* for notes on _meta usage.
|
|
796
|
+
*/
|
|
797
|
+
readonly _meta:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
798
|
+
}, undefined>,ObjectSchema<{
|
|
799
|
+
readonly type:LiteralSchema<"image", undefined>;
|
|
800
|
+
/**
|
|
801
|
+
* The base64-encoded image data.
|
|
802
|
+
*/
|
|
803
|
+
readonly data:SchemaWithPipe<readonly [StringSchema<undefined>,Base64Action<string, undefined>]>;
|
|
804
|
+
/**
|
|
805
|
+
* The MIME type of the image. Different providers may support different image types.
|
|
806
|
+
*/
|
|
807
|
+
readonly mimeType:StringSchema<undefined>;
|
|
808
|
+
/**
|
|
809
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
810
|
+
* for notes on _meta usage.
|
|
811
|
+
*/
|
|
812
|
+
readonly _meta:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
813
|
+
}, undefined>,ObjectSchema<{
|
|
814
|
+
readonly type:LiteralSchema<"audio", undefined>;
|
|
815
|
+
/**
|
|
816
|
+
* The base64-encoded audio data.
|
|
817
|
+
*/
|
|
818
|
+
readonly data:SchemaWithPipe<readonly [StringSchema<undefined>,Base64Action<string, undefined>]>;
|
|
819
|
+
/**
|
|
820
|
+
* The MIME type of the audio. Different providers may support different audio types.
|
|
821
|
+
*/
|
|
822
|
+
readonly mimeType:StringSchema<undefined>;
|
|
823
|
+
/**
|
|
824
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
825
|
+
* for notes on _meta usage.
|
|
826
|
+
*/
|
|
827
|
+
readonly _meta:OptionalSchema<ObjectSchema<{}, undefined>, undefined>;
|
|
828
|
+
}, undefined>], undefined>;
|
|
829
|
+
/**
|
|
830
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
831
|
+
* for notes on _meta usage.
|
|
832
|
+
*/
|
|
833
|
+
readonly _meta:OptionalSchema<LooseObjectSchema<{}, undefined>, undefined>;
|
|
834
|
+
}, undefined>;
|
|
835
|
+
/**
|
|
836
|
+
* The server's response to a completion/complete request
|
|
837
|
+
*/
|
|
838
|
+
const CompleteResultSchema:ObjectSchema<{
|
|
839
|
+
readonly completion:ObjectSchema<{
|
|
840
|
+
/**
|
|
841
|
+
* An array of completion values. Must not exceed 100 items.
|
|
842
|
+
*/
|
|
843
|
+
readonly values:SchemaWithPipe<readonly [ArraySchema<StringSchema<undefined>, undefined>,MaxLengthAction<string[], 100, undefined>]>;
|
|
844
|
+
/**
|
|
845
|
+
* The total number of completion options available. This can exceed the number of values actually sent in the response.
|
|
846
|
+
*/
|
|
847
|
+
readonly total:OptionalSchema<SchemaWithPipe<readonly [NumberSchema<undefined>,IntegerAction<number, undefined>]>, undefined>;
|
|
848
|
+
/**
|
|
849
|
+
* Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.
|
|
850
|
+
*/
|
|
851
|
+
readonly hasMore:OptionalSchema<BooleanSchema<undefined>, undefined>;
|
|
852
|
+
}, undefined>;
|
|
853
|
+
/**
|
|
854
|
+
* See [MCP specification](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/47339c03c143bb4ec01a26e721a1b8fe66634ebe/docs/specification/draft/basic/index.mdx#general-fields)
|
|
855
|
+
* for notes on _meta usage.
|
|
856
|
+
*/
|
|
857
|
+
readonly _meta:OptionalSchema<LooseObjectSchema<{}, undefined>, undefined>;
|
|
858
|
+
}, undefined>;
|
|
859
|
+
type ClientCapabilities_1 =InferInput<typeof ClientCapabilitiesSchema>;
|
|
860
|
+
type ServerCapabilities =InferInput<typeof ServerCapabilitiesSchema>;
|
|
861
|
+
type InitializeRequestParams =InferInput<typeof InitializeRequestParamsSchema>;
|
|
862
|
+
type CallToolResult =InferInput<typeof CallToolResultSchema>;
|
|
863
|
+
type ReadResourceResult =InferInput<typeof ReadResourceResultSchema>;
|
|
864
|
+
type GetPromptResult =InferInput<typeof GetPromptResultSchema>;
|
|
865
|
+
type CompleteResult =InferInput<typeof CompleteResultSchema>;
|
|
866
|
+
type CreateMessageRequestParams =InferInput<typeof CreateMessageRequestParamsSchema>;
|
|
867
|
+
type CreateMessageResult =InferInput<typeof CreateMessageResultSchema>;
|
|
868
|
+
type Resource =InferInput<typeof ResourceSchema>;
|
|
869
|
+
type JSONRPCResponse =InferInput<typeof JSONRPCResponseSchema>;
|
|
870
|
+
type LoggingLevel =InferInput<typeof LoggingLevelSchema>;
|
|
871
|
+
type ToolAnnotations =InferInput<typeof ToolAnnotationsSchema>;
|
|
872
|
+
// Helper type to remove whitespace
|
|
873
|
+
type Trim<S extends string> = S extends ` ${infer R}`
|
|
874
|
+
? Trim<R>
|
|
875
|
+
: S extends `${infer L} `
|
|
876
|
+
? Trim<L>
|
|
877
|
+
: S;
|
|
878
|
+
|
|
879
|
+
// Helper type to extract variable name, removing modifiers
|
|
880
|
+
type ExtractVarName<S extends string> = S extends `${infer Name}:${string}`
|
|
881
|
+
? Trim<Name> // Remove prefix modifier
|
|
882
|
+
: S extends `${infer Name}*`
|
|
883
|
+
? Trim<Name> // Remove explode modifier
|
|
884
|
+
: Trim<S>;
|
|
885
|
+
|
|
886
|
+
// Helper type to split comma-separated variables
|
|
887
|
+
type SplitVariables<S extends string> = S extends `${infer First},${infer Rest}`
|
|
888
|
+
? ExtractVarName<First> | SplitVariables<Rest>
|
|
889
|
+
: ExtractVarName<S>;
|
|
890
|
+
|
|
891
|
+
// Helper type to extract content from braces and handle operators
|
|
892
|
+
type ExtractFromExpression<S extends string> = S extends `+${infer Vars}`
|
|
893
|
+
? SplitVariables<Vars> // Reserved {+var}
|
|
894
|
+
: S extends `#${infer Vars}`
|
|
895
|
+
? SplitVariables<Vars> // Fragment {#var}
|
|
896
|
+
: S extends `.${infer Vars}`
|
|
897
|
+
? SplitVariables<Vars> // Label {.var}
|
|
898
|
+
: S extends `/${infer Vars}`
|
|
899
|
+
? SplitVariables<Vars> // Path {/var}
|
|
900
|
+
: S extends `;${infer Vars}`
|
|
901
|
+
? SplitVariables<Vars> // Path-style {;var}
|
|
902
|
+
: S extends `?${infer Vars}`
|
|
903
|
+
? SplitVariables<Vars> // Query {?var}
|
|
904
|
+
: S extends `&${infer Vars}`
|
|
905
|
+
? SplitVariables<Vars> // Query continuation {&var}
|
|
906
|
+
: SplitVariables<S>; // Simple {var}
|
|
907
|
+
|
|
908
|
+
// Main recursive type to extract all variables from URI template
|
|
909
|
+
type ExtractVariablesFromTemplate<S extends string> =
|
|
910
|
+
S extends `${string}{${infer Expression}}${infer Rest}`
|
|
911
|
+
? ExtractFromExpression<Expression> | ExtractVariablesFromTemplate<Rest>
|
|
912
|
+
: never;
|
|
913
|
+
|
|
914
|
+
// Main exported type
|
|
915
|
+
type ExtractURITemplateVariables<T extends string> =
|
|
916
|
+
ExtractVariablesFromTemplate<T>;
|
|
917
|
+
/**
|
|
918
|
+
* @import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
919
|
+
* @import { JSONSchema7 } from "json-schema";
|
|
920
|
+
*/
|
|
921
|
+
|
|
922
|
+
class JsonSchemaAdapter<TSchema extends StandardSchemaV1> {
|
|
923
|
+
|
|
924
|
+
toJsonSchema(schema: TSchema): Promise<JSONSchema7>;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
export {};
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
declare module 'tmcp/adapter' {
|
|
931
|
+
import type { StandardSchemaV1 } from '@standard-schema/spec';
|
|
932
|
+
import type { JSONSchema7 } from 'json-schema';
|
|
933
|
+
/**
|
|
934
|
+
* @import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
935
|
+
* @import { JSONSchema7 } from "json-schema";
|
|
936
|
+
*/
|
|
937
|
+
|
|
938
|
+
export class JsonSchemaAdapter<TSchema extends StandardSchemaV1> {
|
|
939
|
+
|
|
940
|
+
toJsonSchema(schema: TSchema): Promise<JSONSchema7>;
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
export {};
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
//# sourceMappingURL=index.d.ts.map
|