tmcp 1.2.0 → 1.3.0
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/README.md +3 -0
- package/package.json +3 -3
- package/src/index.d.ts +15 -12
- package/src/index.js +39 -18
- package/src/internal/internal.d.ts +13 -5
- package/src/validation/index.d.ts +682 -0
- package/src/validation/index.js +248 -0
package/README.md
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
> [!WARNING]
|
|
2
|
+
> Unfortunately i published the 1.0 by mistake...this package is currently under heavy development so there will be breaking changes in minors...threat this `1.x` as the `0.x` of any other package. Sorry for the disservice, every breaking will be properly labeled in the PR name.
|
|
3
|
+
|
|
1
4
|
# tmcp
|
|
2
5
|
|
|
3
6
|
A lightweight, schema-agnostic Model Context Protocol (MCP) server implementation with unified API design.
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tmcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "The main tmcp library",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"keywords": [],
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "https://github.com/paoloricciuti/tmcp.git",
|
|
10
|
+
"url": "git+https://github.com/paoloricciuti/tmcp.git",
|
|
11
11
|
"directory": "packages/tmcp"
|
|
12
12
|
},
|
|
13
13
|
"author": "Paolo Ricciuti",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"scripts": {
|
|
40
40
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
41
41
|
"typecheck": "tsc --noEmit",
|
|
42
|
-
"generate:types": "
|
|
42
|
+
"generate:types": "find ./src -name \"*.d.ts\" -not -path \"./src/internal/*\" -delete && tsc ./src/*.js --declaration --emitDeclarationOnly --target esnext --allowJs --moduleresolution nodenext --module nodenext && publint",
|
|
43
43
|
"prepublish": "pnpm generate:types"
|
|
44
44
|
}
|
|
45
45
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -17,45 +17,45 @@ export class McpServer<StandardSchema extends StandardSchemaV1> {
|
|
|
17
17
|
/**
|
|
18
18
|
* @template {StandardSchema | undefined} [TSchema=undefined]
|
|
19
19
|
* @param {{ name: string; description: string; schema?: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema> extends Record<string, unknown> ? TSchema : never }} options
|
|
20
|
-
* @param {TSchema extends undefined ? (()=>Promise<
|
|
20
|
+
* @param {TSchema extends undefined ? (()=>Promise<CallToolResult> | CallToolResult) : ((input: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>) => Promise<CallToolResult> | CallToolResult)} execute
|
|
21
21
|
*/
|
|
22
22
|
tool<TSchema extends StandardSchema | undefined = undefined>({ name, description, schema }: {
|
|
23
23
|
name: string;
|
|
24
24
|
description: string;
|
|
25
25
|
schema?: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema> extends Record<string, unknown> ? TSchema : never;
|
|
26
|
-
}, execute: TSchema extends undefined ? (() => Promise<
|
|
26
|
+
}, execute: TSchema extends undefined ? (() => Promise<CallToolResult> | CallToolResult) : ((input: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>) => Promise<CallToolResult> | CallToolResult)): void;
|
|
27
27
|
/**
|
|
28
28
|
* @template {StandardSchema | undefined} [TSchema=undefined]
|
|
29
|
-
* @param {{ name: string; description: string; schema?: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema> extends Record<string, unknown> ? TSchema : never; complete?: TSchema extends undefined ? never : Partial<Record<keyof (StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>), Completion
|
|
30
|
-
* @param {TSchema extends undefined ? (()=>Promise<
|
|
29
|
+
* @param {{ name: string; description: string; schema?: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema> extends Record<string, unknown> ? TSchema : never; complete?: NoInfer<TSchema extends undefined ? never : Partial<Record<keyof (StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>), Completion>>> }} options
|
|
30
|
+
* @param {TSchema extends undefined ? (()=>Promise<GetPromptResult> | GetPromptResult) : (input: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>) => Promise<GetPromptResult> | GetPromptResult} execute
|
|
31
31
|
*/
|
|
32
32
|
prompt<TSchema extends StandardSchema | undefined = undefined>({ name, description, schema, complete }: {
|
|
33
33
|
name: string;
|
|
34
34
|
description: string;
|
|
35
35
|
schema?: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema> extends Record<string, unknown> ? TSchema : never;
|
|
36
|
-
complete?: TSchema extends undefined ? never : Partial<Record<keyof StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>, Completion
|
|
37
|
-
}, execute: TSchema extends undefined ? (() => Promise<
|
|
36
|
+
complete?: NoInfer<TSchema extends undefined ? never : Partial<Record<keyof StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>, Completion>>>;
|
|
37
|
+
}, execute: TSchema extends undefined ? (() => Promise<GetPromptResult> | GetPromptResult) : (input: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>) => Promise<GetPromptResult> | GetPromptResult): void;
|
|
38
38
|
/**
|
|
39
39
|
* @param {{ name: string; description: string; uri: string }} options
|
|
40
|
-
* @param {(uri: string) => Promise<
|
|
40
|
+
* @param {(uri: string) => Promise<ReadResourceResult> | ReadResourceResult} execute
|
|
41
41
|
*/
|
|
42
42
|
resource({ name, description, uri }: {
|
|
43
43
|
name: string;
|
|
44
44
|
description: string;
|
|
45
45
|
uri: string;
|
|
46
|
-
}, execute: (uri: string) => Promise<
|
|
46
|
+
}, execute: (uri: string) => Promise<ReadResourceResult> | ReadResourceResult): void;
|
|
47
47
|
/**
|
|
48
48
|
* @template {string} TUri
|
|
49
49
|
* @template {ExtractURITemplateVariables<TUri>} TVariables
|
|
50
|
-
* @param {{ name: string; description: string; uri: TUri; complete?: TVariables extends never ? never : Partial<Record<TVariables, Completion
|
|
51
|
-
* @param {(uri: string, params: Record<TVariables, string | string[]>) => Promise<
|
|
50
|
+
* @param {{ name: string; description: string; uri: TUri; complete?: NoInfer<TVariables extends never ? never : Partial<Record<TVariables, Completion>>> }} options
|
|
51
|
+
* @param {(uri: string, params: Record<TVariables, string | string[]>) => Promise<ReadResourceResult> | ReadResourceResult} execute
|
|
52
52
|
*/
|
|
53
53
|
template<TUri extends string, TVariables extends ExtractURITemplateVariables<TUri>>({ name, description, uri, complete }: {
|
|
54
54
|
name: string;
|
|
55
55
|
description: string;
|
|
56
56
|
uri: TUri;
|
|
57
|
-
complete?: TVariables extends never ? never : Partial<Record<TVariables, Completion
|
|
58
|
-
}, execute: (uri: string, params: Record<TVariables, string | string[]>) => Promise<
|
|
57
|
+
complete?: NoInfer<TVariables extends never ? never : Partial<Record<TVariables, Completion>>>;
|
|
58
|
+
}, execute: (uri: string, params: Record<TVariables, string | string[]>) => Promise<ReadResourceResult> | ReadResourceResult): void;
|
|
59
59
|
/**
|
|
60
60
|
* @param {JSONRPCRequest} request
|
|
61
61
|
* @returns {ReturnType<JSONRPCServer['receive']>}
|
|
@@ -71,7 +71,10 @@ export class McpServer<StandardSchema extends StandardSchemaV1> {
|
|
|
71
71
|
}
|
|
72
72
|
import type { StandardSchemaV1 } from "@standard-schema/spec";
|
|
73
73
|
import type { McpEvents } from "./internal/internal.js";
|
|
74
|
+
import type { CallToolResult } from "./validation/index.js";
|
|
74
75
|
import type { Completion } from "./internal/internal.js";
|
|
76
|
+
import type { GetPromptResult } from "./validation/index.js";
|
|
77
|
+
import type { ReadResourceResult } from "./validation/index.js";
|
|
75
78
|
import type { ExtractURITemplateVariables } from "./internal/uri-template.js";
|
|
76
79
|
import type { JSONRPCRequest } from "json-rpc-2.0";
|
|
77
80
|
import { JSONRPCServer } from 'json-rpc-2.0';
|
package/src/index.js
CHANGED
|
@@ -2,10 +2,18 @@
|
|
|
2
2
|
* @import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
3
3
|
* @import { JSONRPCRequest, JSONRPCParams } from "json-rpc-2.0";
|
|
4
4
|
* @import { ExtractURITemplateVariables } from "./internal/uri-template.js";
|
|
5
|
+
* @import { CallToolResult, ReadResourceResult, GetPromptResult, CompleteResult } from "./validation/index.js";
|
|
5
6
|
* @import { Tool, Completion, Prompt, Resource, ServerOptions, ServerInfo, SubscriptionsKeys, McpEvents } from "./internal/internal.js";
|
|
6
7
|
*/
|
|
7
8
|
import { JSONRPCServer, JSONRPCClient } from 'json-rpc-2.0';
|
|
8
9
|
import { UriTemplateMatcher } from 'uri-template-matcher';
|
|
10
|
+
import {
|
|
11
|
+
CallToolResultSchema,
|
|
12
|
+
ReadResourceResultSchema,
|
|
13
|
+
GetPromptResultSchema,
|
|
14
|
+
CompleteResultSchema,
|
|
15
|
+
} from './validation/index.js';
|
|
16
|
+
import * as v from 'valibot';
|
|
9
17
|
|
|
10
18
|
/**
|
|
11
19
|
* @template {StandardSchemaV1} StandardSchema
|
|
@@ -139,7 +147,7 @@ export class McpServer {
|
|
|
139
147
|
throw new Error(`Tool ${name} not found`);
|
|
140
148
|
}
|
|
141
149
|
if (!tool.schema) {
|
|
142
|
-
return tool.execute();
|
|
150
|
+
return v.parse(CallToolResultSchema, await tool.execute());
|
|
143
151
|
}
|
|
144
152
|
let validated_args = tool.schema['~standard'].validate(args);
|
|
145
153
|
if (validated_args instanceof Promise)
|
|
@@ -149,7 +157,10 @@ export class McpServer {
|
|
|
149
157
|
`Invalid arguments for tool ${name}: ${JSON.stringify(validated_args.issues)}`,
|
|
150
158
|
);
|
|
151
159
|
}
|
|
152
|
-
return
|
|
160
|
+
return v.parse(
|
|
161
|
+
CallToolResultSchema,
|
|
162
|
+
await tool.execute(validated_args.value),
|
|
163
|
+
);
|
|
153
164
|
},
|
|
154
165
|
);
|
|
155
166
|
}
|
|
@@ -204,7 +215,10 @@ export class McpServer {
|
|
|
204
215
|
throw new Error(`Tool ${name} not found`);
|
|
205
216
|
}
|
|
206
217
|
if (!prompt.schema) {
|
|
207
|
-
return
|
|
218
|
+
return v.parse(
|
|
219
|
+
GetPromptResultSchema,
|
|
220
|
+
await prompt.execute(),
|
|
221
|
+
);
|
|
208
222
|
}
|
|
209
223
|
let validated_args = prompt.schema['~standard'].validate(args);
|
|
210
224
|
if (validated_args instanceof Promise)
|
|
@@ -214,7 +228,10 @@ export class McpServer {
|
|
|
214
228
|
`Invalid arguments for tool ${name}: ${JSON.stringify(validated_args.issues)}`,
|
|
215
229
|
);
|
|
216
230
|
}
|
|
217
|
-
return
|
|
231
|
+
return v.parse(
|
|
232
|
+
GetPromptResultSchema,
|
|
233
|
+
await prompt.execute(validated_args.value),
|
|
234
|
+
);
|
|
218
235
|
},
|
|
219
236
|
);
|
|
220
237
|
}
|
|
@@ -281,9 +298,15 @@ export class McpServer {
|
|
|
281
298
|
if (resource.template) {
|
|
282
299
|
if (!params)
|
|
283
300
|
throw new Error('Missing parameters for template resource');
|
|
284
|
-
return
|
|
301
|
+
return v.parse(
|
|
302
|
+
ReadResourceResultSchema,
|
|
303
|
+
await resource.execute(uri, params),
|
|
304
|
+
);
|
|
285
305
|
}
|
|
286
|
-
return
|
|
306
|
+
return v.parse(
|
|
307
|
+
ReadResourceResultSchema,
|
|
308
|
+
await resource.execute(uri),
|
|
309
|
+
);
|
|
287
310
|
});
|
|
288
311
|
}
|
|
289
312
|
/**
|
|
@@ -299,19 +322,17 @@ export class McpServer {
|
|
|
299
322
|
if (!complete) return null;
|
|
300
323
|
const actual_complete = complete[argument.name];
|
|
301
324
|
if (!actual_complete) return null;
|
|
302
|
-
return
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
},
|
|
307
|
-
};
|
|
325
|
+
return v.parse(
|
|
326
|
+
CompleteResultSchema,
|
|
327
|
+
actual_complete(argument.value, context),
|
|
328
|
+
);
|
|
308
329
|
},
|
|
309
330
|
);
|
|
310
331
|
}
|
|
311
332
|
/**
|
|
312
333
|
* @template {StandardSchema | undefined} [TSchema=undefined]
|
|
313
334
|
* @param {{ name: string; description: string; schema?: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema> extends Record<string, unknown> ? TSchema : never }} options
|
|
314
|
-
* @param {TSchema extends undefined ? (()=>Promise<
|
|
335
|
+
* @param {TSchema extends undefined ? (()=>Promise<CallToolResult> | CallToolResult) : ((input: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>) => Promise<CallToolResult> | CallToolResult)} execute
|
|
315
336
|
*/
|
|
316
337
|
tool({ name, description, schema }, execute) {
|
|
317
338
|
if (this.#options.capabilities?.tools?.listChanged) {
|
|
@@ -325,8 +346,8 @@ export class McpServer {
|
|
|
325
346
|
}
|
|
326
347
|
/**
|
|
327
348
|
* @template {StandardSchema | undefined} [TSchema=undefined]
|
|
328
|
-
* @param {{ name: string; description: string; schema?: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema> extends Record<string, unknown> ? TSchema : never; complete?: TSchema extends undefined ? never : Partial<Record<keyof (StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>), Completion
|
|
329
|
-
* @param {TSchema extends undefined ? (()=>Promise<
|
|
349
|
+
* @param {{ name: string; description: string; schema?: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema> extends Record<string, unknown> ? TSchema : never; complete?: NoInfer<TSchema extends undefined ? never : Partial<Record<keyof (StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>), Completion>>> }} options
|
|
350
|
+
* @param {TSchema extends undefined ? (()=>Promise<GetPromptResult> | GetPromptResult) : (input: StandardSchemaV1.InferInput<TSchema extends undefined ? never : TSchema>) => Promise<GetPromptResult> | GetPromptResult} execute
|
|
330
351
|
*/
|
|
331
352
|
prompt({ name, description, schema, complete }, execute) {
|
|
332
353
|
if (complete) {
|
|
@@ -358,7 +379,7 @@ export class McpServer {
|
|
|
358
379
|
}
|
|
359
380
|
/**
|
|
360
381
|
* @param {{ name: string; description: string; uri: string }} options
|
|
361
|
-
* @param {(uri: string) => Promise<
|
|
382
|
+
* @param {(uri: string) => Promise<ReadResourceResult> | ReadResourceResult} execute
|
|
362
383
|
*/
|
|
363
384
|
resource({ name, description, uri }, execute) {
|
|
364
385
|
this.#resource({
|
|
@@ -372,8 +393,8 @@ export class McpServer {
|
|
|
372
393
|
/**
|
|
373
394
|
* @template {string} TUri
|
|
374
395
|
* @template {ExtractURITemplateVariables<TUri>} TVariables
|
|
375
|
-
* @param {{ name: string; description: string; uri: TUri; complete?: TVariables extends never ? never : Partial<Record<TVariables, Completion
|
|
376
|
-
* @param {(uri: string, params: Record<TVariables, string | string[]>) => Promise<
|
|
396
|
+
* @param {{ name: string; description: string; uri: TUri; complete?: NoInfer<TVariables extends never ? never : Partial<Record<TVariables, Completion>>> }} options
|
|
397
|
+
* @param {(uri: string, params: Record<TVariables, string | string[]>) => Promise<ReadResourceResult> | ReadResourceResult} execute
|
|
377
398
|
*/
|
|
378
399
|
template({ name, description, uri, complete }, execute) {
|
|
379
400
|
this.#resource({
|
|
@@ -1,26 +1,32 @@
|
|
|
1
1
|
import { StandardSchemaV1 } from '@standard-schema/spec';
|
|
2
2
|
import { JSONRPCRequest } from 'json-rpc-2.0';
|
|
3
3
|
import { JsonSchemaAdapter } from '../adapter.js';
|
|
4
|
+
import {
|
|
5
|
+
GetPromptResult,
|
|
6
|
+
CallToolResult,
|
|
7
|
+
ReadResourceResult,
|
|
8
|
+
CompleteResult,
|
|
9
|
+
} from '../validation/index.js';
|
|
4
10
|
|
|
5
11
|
export type Tool<TSchema extends StandardSchemaV1 = StandardSchemaV1<any>> = {
|
|
6
12
|
description: string;
|
|
7
13
|
schema: TSchema;
|
|
8
14
|
execute: (
|
|
9
15
|
input?: StandardSchemaV1.InferInput<TSchema>,
|
|
10
|
-
) => Promise<
|
|
16
|
+
) => Promise<CallToolResult> | CallToolResult;
|
|
11
17
|
};
|
|
12
18
|
|
|
13
19
|
export type Completion = (
|
|
14
20
|
query: string,
|
|
15
21
|
context: { arguments: Record<string, string> },
|
|
16
|
-
) =>
|
|
22
|
+
) => CompleteResult;
|
|
17
23
|
|
|
18
24
|
export type Prompt<TSchema extends StandardSchemaV1 = StandardSchemaV1<any>> = {
|
|
19
25
|
description: string;
|
|
20
26
|
schema: TSchema;
|
|
21
27
|
execute: (
|
|
22
28
|
input?: StandardSchemaV1.InferInput<TSchema>,
|
|
23
|
-
) => Promise<
|
|
29
|
+
) => Promise<GetPromptResult> | GetPromptResult;
|
|
24
30
|
};
|
|
25
31
|
|
|
26
32
|
export type Resource =
|
|
@@ -31,13 +37,15 @@ export type Resource =
|
|
|
31
37
|
execute: (
|
|
32
38
|
uri: string,
|
|
33
39
|
params: Record<string, string | string[]>,
|
|
34
|
-
) => Promise<
|
|
40
|
+
) => Promise<ReadResourceResult> | ReadResourceResult;
|
|
35
41
|
}
|
|
36
42
|
| {
|
|
37
43
|
description: string;
|
|
38
44
|
name: string;
|
|
39
45
|
template: false;
|
|
40
|
-
execute: (
|
|
46
|
+
execute: (
|
|
47
|
+
uri: string,
|
|
48
|
+
) => Promise<ReadResourceResult> | ReadResourceResult;
|
|
41
49
|
};
|
|
42
50
|
|
|
43
51
|
export type ServerOptions<TSchema extends StandardSchemaV1> = {
|
|
@@ -0,0 +1,682 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text provided to or from an LLM.
|
|
3
|
+
*/
|
|
4
|
+
export const TextContentSchema: v.LooseObjectSchema<{
|
|
5
|
+
readonly type: v.LiteralSchema<"text", undefined>;
|
|
6
|
+
/**
|
|
7
|
+
* The text content of the message.
|
|
8
|
+
*/
|
|
9
|
+
readonly text: v.StringSchema<undefined>;
|
|
10
|
+
/**
|
|
11
|
+
* See [MCP specification] for notes on _meta usage.
|
|
12
|
+
*/
|
|
13
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
14
|
+
}, undefined>;
|
|
15
|
+
/**
|
|
16
|
+
* An image provided to or from an LLM.
|
|
17
|
+
*/
|
|
18
|
+
export const ImageContentSchema: v.LooseObjectSchema<{
|
|
19
|
+
readonly type: v.LiteralSchema<"image", undefined>;
|
|
20
|
+
/**
|
|
21
|
+
* The base64-encoded image data.
|
|
22
|
+
*/
|
|
23
|
+
readonly data: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.Base64Action<string, undefined>]>;
|
|
24
|
+
/**
|
|
25
|
+
* The MIME type of the image. Different providers may support different image types.
|
|
26
|
+
*/
|
|
27
|
+
readonly mimeType: v.StringSchema<undefined>;
|
|
28
|
+
/**
|
|
29
|
+
* See [MCP specification] for notes on _meta usage.
|
|
30
|
+
*/
|
|
31
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
32
|
+
}, undefined>;
|
|
33
|
+
/**
|
|
34
|
+
* An Audio provided to or from an LLM.
|
|
35
|
+
*/
|
|
36
|
+
export const AudioContentSchema: v.LooseObjectSchema<{
|
|
37
|
+
readonly type: v.LiteralSchema<"audio", undefined>;
|
|
38
|
+
/**
|
|
39
|
+
* The base64-encoded audio data.
|
|
40
|
+
*/
|
|
41
|
+
readonly data: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.Base64Action<string, undefined>]>;
|
|
42
|
+
/**
|
|
43
|
+
* The MIME type of the audio. Different providers may support different audio types.
|
|
44
|
+
*/
|
|
45
|
+
readonly mimeType: v.StringSchema<undefined>;
|
|
46
|
+
/**
|
|
47
|
+
* See [MCP specification] for notes on _meta usage.
|
|
48
|
+
*/
|
|
49
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
50
|
+
}, undefined>;
|
|
51
|
+
/**
|
|
52
|
+
* The contents of a specific resource or sub-resource.
|
|
53
|
+
*/
|
|
54
|
+
export const ResourceContentsSchema: v.LooseObjectSchema<{
|
|
55
|
+
/**
|
|
56
|
+
* The URI of this resource.
|
|
57
|
+
*/
|
|
58
|
+
readonly uri: v.StringSchema<undefined>;
|
|
59
|
+
/**
|
|
60
|
+
* The MIME type of this resource, if known.
|
|
61
|
+
*/
|
|
62
|
+
readonly mimeType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
63
|
+
/**
|
|
64
|
+
* See [MCP specification] for notes on _meta usage.
|
|
65
|
+
*/
|
|
66
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
67
|
+
}, undefined>;
|
|
68
|
+
export const TextResourceContentsSchema: v.LooseObjectSchema<{
|
|
69
|
+
/**
|
|
70
|
+
* The URI of this resource.
|
|
71
|
+
*/
|
|
72
|
+
readonly uri: v.StringSchema<undefined>;
|
|
73
|
+
/**
|
|
74
|
+
* The MIME type of this resource, if known.
|
|
75
|
+
*/
|
|
76
|
+
readonly mimeType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
77
|
+
/**
|
|
78
|
+
* The text of the item. This must only be set if the item can actually be represented as text (not binary data).
|
|
79
|
+
*/
|
|
80
|
+
readonly text: v.StringSchema<undefined>;
|
|
81
|
+
/**
|
|
82
|
+
* See [MCP specification] for notes on _meta usage.
|
|
83
|
+
*/
|
|
84
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
85
|
+
}, undefined>;
|
|
86
|
+
export const BlobResourceContentsSchema: v.LooseObjectSchema<{
|
|
87
|
+
/**
|
|
88
|
+
* The URI of this resource.
|
|
89
|
+
*/
|
|
90
|
+
readonly uri: v.StringSchema<undefined>;
|
|
91
|
+
/**
|
|
92
|
+
* The MIME type of this resource, if known.
|
|
93
|
+
*/
|
|
94
|
+
readonly mimeType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
95
|
+
/**
|
|
96
|
+
* A base64-encoded string representing the binary data of the item.
|
|
97
|
+
*/
|
|
98
|
+
readonly blob: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.Base64Action<string, undefined>]>;
|
|
99
|
+
/**
|
|
100
|
+
* See [MCP specification] for notes on _meta usage.
|
|
101
|
+
*/
|
|
102
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
103
|
+
}, undefined>;
|
|
104
|
+
/**
|
|
105
|
+
* The contents of a resource, embedded into a prompt or tool call result.
|
|
106
|
+
*/
|
|
107
|
+
export const EmbeddedResourceSchema: v.LooseObjectSchema<{
|
|
108
|
+
readonly type: v.LiteralSchema<"resource", undefined>;
|
|
109
|
+
readonly resource: v.UnionSchema<[v.LooseObjectSchema<{
|
|
110
|
+
/**
|
|
111
|
+
* The URI of this resource.
|
|
112
|
+
*/
|
|
113
|
+
readonly uri: v.StringSchema<undefined>;
|
|
114
|
+
/**
|
|
115
|
+
* The MIME type of this resource, if known.
|
|
116
|
+
*/
|
|
117
|
+
readonly mimeType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
118
|
+
/**
|
|
119
|
+
* The text of the item. This must only be set if the item can actually be represented as text (not binary data).
|
|
120
|
+
*/
|
|
121
|
+
readonly text: v.StringSchema<undefined>;
|
|
122
|
+
/**
|
|
123
|
+
* See [MCP specification] for notes on _meta usage.
|
|
124
|
+
*/
|
|
125
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
126
|
+
}, undefined>, v.LooseObjectSchema<{
|
|
127
|
+
/**
|
|
128
|
+
* The URI of this resource.
|
|
129
|
+
*/
|
|
130
|
+
readonly uri: v.StringSchema<undefined>;
|
|
131
|
+
/**
|
|
132
|
+
* The MIME type of this resource, if known.
|
|
133
|
+
*/
|
|
134
|
+
readonly mimeType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
135
|
+
/**
|
|
136
|
+
* A base64-encoded string representing the binary data of the item.
|
|
137
|
+
*/
|
|
138
|
+
readonly blob: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.Base64Action<string, undefined>]>;
|
|
139
|
+
/**
|
|
140
|
+
* See [MCP specification] for notes on _meta usage.
|
|
141
|
+
*/
|
|
142
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
143
|
+
}, undefined>], undefined>;
|
|
144
|
+
/**
|
|
145
|
+
* See [MCP specification] for notes on _meta usage.
|
|
146
|
+
*/
|
|
147
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
148
|
+
}, undefined>;
|
|
149
|
+
/**
|
|
150
|
+
* A resource that the server is capable of reading, included in a prompt or tool call result.
|
|
151
|
+
*/
|
|
152
|
+
export const ResourceLinkSchema: v.LooseObjectSchema<{
|
|
153
|
+
/** Intended for programmatic or logical use, but used as a display name in past specs or fallback */
|
|
154
|
+
readonly name: v.StringSchema<undefined>;
|
|
155
|
+
readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
156
|
+
/**
|
|
157
|
+
* The URI of this resource.
|
|
158
|
+
*/
|
|
159
|
+
readonly uri: v.StringSchema<undefined>;
|
|
160
|
+
/**
|
|
161
|
+
* A description of what this resource represents.
|
|
162
|
+
*/
|
|
163
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
164
|
+
/**
|
|
165
|
+
* The MIME type of this resource, if known.
|
|
166
|
+
*/
|
|
167
|
+
readonly mimeType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
168
|
+
readonly type: v.LiteralSchema<"resource_link", undefined>;
|
|
169
|
+
/**
|
|
170
|
+
* See [MCP specification] for notes on _meta usage.
|
|
171
|
+
*/
|
|
172
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
173
|
+
}, undefined>;
|
|
174
|
+
/**
|
|
175
|
+
* A content block that can be used in prompts and tool results.
|
|
176
|
+
*/
|
|
177
|
+
export const ContentBlockSchema: v.UnionSchema<[v.LooseObjectSchema<{
|
|
178
|
+
readonly type: v.LiteralSchema<"text", undefined>;
|
|
179
|
+
/**
|
|
180
|
+
* The text content of the message.
|
|
181
|
+
*/
|
|
182
|
+
readonly text: v.StringSchema<undefined>;
|
|
183
|
+
/**
|
|
184
|
+
* See [MCP specification] for notes on _meta usage.
|
|
185
|
+
*/
|
|
186
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
187
|
+
}, undefined>, v.LooseObjectSchema<{
|
|
188
|
+
readonly type: v.LiteralSchema<"image", undefined>;
|
|
189
|
+
/**
|
|
190
|
+
* The base64-encoded image data.
|
|
191
|
+
*/
|
|
192
|
+
readonly data: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.Base64Action<string, undefined>]>;
|
|
193
|
+
/**
|
|
194
|
+
* The MIME type of the image. Different providers may support different image types.
|
|
195
|
+
*/
|
|
196
|
+
readonly mimeType: v.StringSchema<undefined>;
|
|
197
|
+
/**
|
|
198
|
+
* See [MCP specification] for notes on _meta usage.
|
|
199
|
+
*/
|
|
200
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
201
|
+
}, undefined>, v.LooseObjectSchema<{
|
|
202
|
+
readonly type: v.LiteralSchema<"audio", undefined>;
|
|
203
|
+
/**
|
|
204
|
+
* The base64-encoded audio data.
|
|
205
|
+
*/
|
|
206
|
+
readonly data: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.Base64Action<string, undefined>]>;
|
|
207
|
+
/**
|
|
208
|
+
* The MIME type of the audio. Different providers may support different audio types.
|
|
209
|
+
*/
|
|
210
|
+
readonly mimeType: v.StringSchema<undefined>;
|
|
211
|
+
/**
|
|
212
|
+
* See [MCP specification] for notes on _meta usage.
|
|
213
|
+
*/
|
|
214
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
215
|
+
}, undefined>, v.LooseObjectSchema<{
|
|
216
|
+
/** Intended for programmatic or logical use, but used as a display name in past specs or fallback */
|
|
217
|
+
readonly name: v.StringSchema<undefined>;
|
|
218
|
+
readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
219
|
+
/**
|
|
220
|
+
* The URI of this resource.
|
|
221
|
+
*/
|
|
222
|
+
readonly uri: v.StringSchema<undefined>;
|
|
223
|
+
/**
|
|
224
|
+
* A description of what this resource represents.
|
|
225
|
+
*/
|
|
226
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
227
|
+
/**
|
|
228
|
+
* The MIME type of this resource, if known.
|
|
229
|
+
*/
|
|
230
|
+
readonly mimeType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
231
|
+
readonly type: v.LiteralSchema<"resource_link", undefined>;
|
|
232
|
+
/**
|
|
233
|
+
* See [MCP specification] for notes on _meta usage.
|
|
234
|
+
*/
|
|
235
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
236
|
+
}, undefined>, v.LooseObjectSchema<{
|
|
237
|
+
readonly type: v.LiteralSchema<"resource", undefined>;
|
|
238
|
+
readonly resource: v.UnionSchema<[v.LooseObjectSchema<{
|
|
239
|
+
/**
|
|
240
|
+
* The URI of this resource.
|
|
241
|
+
*/
|
|
242
|
+
readonly uri: v.StringSchema<undefined>;
|
|
243
|
+
/**
|
|
244
|
+
* The MIME type of this resource, if known.
|
|
245
|
+
*/
|
|
246
|
+
readonly mimeType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
247
|
+
/**
|
|
248
|
+
* The text of the item. This must only be set if the item can actually be represented as text (not binary data).
|
|
249
|
+
*/
|
|
250
|
+
readonly text: v.StringSchema<undefined>;
|
|
251
|
+
/**
|
|
252
|
+
* See [MCP specification] for notes on _meta usage.
|
|
253
|
+
*/
|
|
254
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
255
|
+
}, undefined>, v.LooseObjectSchema<{
|
|
256
|
+
/**
|
|
257
|
+
* The URI of this resource.
|
|
258
|
+
*/
|
|
259
|
+
readonly uri: v.StringSchema<undefined>;
|
|
260
|
+
/**
|
|
261
|
+
* The MIME type of this resource, if known.
|
|
262
|
+
*/
|
|
263
|
+
readonly mimeType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
264
|
+
/**
|
|
265
|
+
* A base64-encoded string representing the binary data of the item.
|
|
266
|
+
*/
|
|
267
|
+
readonly blob: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.Base64Action<string, undefined>]>;
|
|
268
|
+
/**
|
|
269
|
+
* See [MCP specification] for notes on _meta usage.
|
|
270
|
+
*/
|
|
271
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
272
|
+
}, undefined>], undefined>;
|
|
273
|
+
/**
|
|
274
|
+
* See [MCP specification] for notes on _meta usage.
|
|
275
|
+
*/
|
|
276
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
277
|
+
}, undefined>], undefined>;
|
|
278
|
+
/**
|
|
279
|
+
* Describes a message returned as part of a prompt.
|
|
280
|
+
*/
|
|
281
|
+
export const PromptMessageSchema: v.LooseObjectSchema<{
|
|
282
|
+
readonly role: v.PicklistSchema<["user", "assistant"], undefined>;
|
|
283
|
+
readonly content: v.UnionSchema<[v.LooseObjectSchema<{
|
|
284
|
+
readonly type: v.LiteralSchema<"text", undefined>;
|
|
285
|
+
/**
|
|
286
|
+
* The text content of the message.
|
|
287
|
+
*/
|
|
288
|
+
readonly text: v.StringSchema<undefined>;
|
|
289
|
+
/**
|
|
290
|
+
* See [MCP specification] for notes on _meta usage.
|
|
291
|
+
*/
|
|
292
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
293
|
+
}, undefined>, v.LooseObjectSchema<{
|
|
294
|
+
readonly type: v.LiteralSchema<"image", undefined>;
|
|
295
|
+
/**
|
|
296
|
+
* The base64-encoded image data.
|
|
297
|
+
*/
|
|
298
|
+
readonly data: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.Base64Action<string, undefined>]>;
|
|
299
|
+
/**
|
|
300
|
+
* The MIME type of the image. Different providers may support different image types.
|
|
301
|
+
*/
|
|
302
|
+
readonly mimeType: v.StringSchema<undefined>;
|
|
303
|
+
/**
|
|
304
|
+
* See [MCP specification] for notes on _meta usage.
|
|
305
|
+
*/
|
|
306
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
307
|
+
}, undefined>, v.LooseObjectSchema<{
|
|
308
|
+
readonly type: v.LiteralSchema<"audio", undefined>;
|
|
309
|
+
/**
|
|
310
|
+
* The base64-encoded audio data.
|
|
311
|
+
*/
|
|
312
|
+
readonly data: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.Base64Action<string, undefined>]>;
|
|
313
|
+
/**
|
|
314
|
+
* The MIME type of the audio. Different providers may support different audio types.
|
|
315
|
+
*/
|
|
316
|
+
readonly mimeType: v.StringSchema<undefined>;
|
|
317
|
+
/**
|
|
318
|
+
* See [MCP specification] for notes on _meta usage.
|
|
319
|
+
*/
|
|
320
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
321
|
+
}, undefined>, v.LooseObjectSchema<{
|
|
322
|
+
/** Intended for programmatic or logical use, but used as a display name in past specs or fallback */
|
|
323
|
+
readonly name: v.StringSchema<undefined>;
|
|
324
|
+
readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
325
|
+
/**
|
|
326
|
+
* The URI of this resource.
|
|
327
|
+
*/
|
|
328
|
+
readonly uri: v.StringSchema<undefined>;
|
|
329
|
+
/**
|
|
330
|
+
* A description of what this resource represents.
|
|
331
|
+
*/
|
|
332
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
333
|
+
/**
|
|
334
|
+
* The MIME type of this resource, if known.
|
|
335
|
+
*/
|
|
336
|
+
readonly mimeType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
337
|
+
readonly type: v.LiteralSchema<"resource_link", undefined>;
|
|
338
|
+
/**
|
|
339
|
+
* See [MCP specification] for notes on _meta usage.
|
|
340
|
+
*/
|
|
341
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
342
|
+
}, undefined>, v.LooseObjectSchema<{
|
|
343
|
+
readonly type: v.LiteralSchema<"resource", undefined>;
|
|
344
|
+
readonly resource: v.UnionSchema<[v.LooseObjectSchema<{
|
|
345
|
+
/**
|
|
346
|
+
* The URI of this resource.
|
|
347
|
+
*/
|
|
348
|
+
readonly uri: v.StringSchema<undefined>;
|
|
349
|
+
/**
|
|
350
|
+
* The MIME type of this resource, if known.
|
|
351
|
+
*/
|
|
352
|
+
readonly mimeType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
353
|
+
/**
|
|
354
|
+
* The text of the item. This must only be set if the item can actually be represented as text (not binary data).
|
|
355
|
+
*/
|
|
356
|
+
readonly text: v.StringSchema<undefined>;
|
|
357
|
+
/**
|
|
358
|
+
* See [MCP specification] for notes on _meta usage.
|
|
359
|
+
*/
|
|
360
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
361
|
+
}, undefined>, v.LooseObjectSchema<{
|
|
362
|
+
/**
|
|
363
|
+
* The URI of this resource.
|
|
364
|
+
*/
|
|
365
|
+
readonly uri: v.StringSchema<undefined>;
|
|
366
|
+
/**
|
|
367
|
+
* The MIME type of this resource, if known.
|
|
368
|
+
*/
|
|
369
|
+
readonly mimeType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
370
|
+
/**
|
|
371
|
+
* A base64-encoded string representing the binary data of the item.
|
|
372
|
+
*/
|
|
373
|
+
readonly blob: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.Base64Action<string, undefined>]>;
|
|
374
|
+
/**
|
|
375
|
+
* See [MCP specification] for notes on _meta usage.
|
|
376
|
+
*/
|
|
377
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
378
|
+
}, undefined>], undefined>;
|
|
379
|
+
/**
|
|
380
|
+
* See [MCP specification] for notes on _meta usage.
|
|
381
|
+
*/
|
|
382
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
383
|
+
}, undefined>], undefined>;
|
|
384
|
+
}, undefined>;
|
|
385
|
+
/**
|
|
386
|
+
* The server's response to a tool call.
|
|
387
|
+
*/
|
|
388
|
+
export const CallToolResultSchema: v.LooseObjectSchema<{
|
|
389
|
+
/**
|
|
390
|
+
* A list of content objects that represent the result of the tool call.
|
|
391
|
+
*/
|
|
392
|
+
readonly content: v.OptionalSchema<v.ArraySchema<v.UnionSchema<[v.LooseObjectSchema<{
|
|
393
|
+
readonly type: v.LiteralSchema<"text", undefined>;
|
|
394
|
+
/**
|
|
395
|
+
* The text content of the message.
|
|
396
|
+
*/
|
|
397
|
+
readonly text: v.StringSchema<undefined>;
|
|
398
|
+
/**
|
|
399
|
+
* See [MCP specification] for notes on _meta usage.
|
|
400
|
+
*/
|
|
401
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
402
|
+
}, undefined>, v.LooseObjectSchema<{
|
|
403
|
+
readonly type: v.LiteralSchema<"image", undefined>;
|
|
404
|
+
/**
|
|
405
|
+
* The base64-encoded image data.
|
|
406
|
+
*/
|
|
407
|
+
readonly data: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.Base64Action<string, undefined>]>;
|
|
408
|
+
/**
|
|
409
|
+
* The MIME type of the image. Different providers may support different image types.
|
|
410
|
+
*/
|
|
411
|
+
readonly mimeType: v.StringSchema<undefined>;
|
|
412
|
+
/**
|
|
413
|
+
* See [MCP specification] for notes on _meta usage.
|
|
414
|
+
*/
|
|
415
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
416
|
+
}, undefined>, v.LooseObjectSchema<{
|
|
417
|
+
readonly type: v.LiteralSchema<"audio", undefined>;
|
|
418
|
+
/**
|
|
419
|
+
* The base64-encoded audio data.
|
|
420
|
+
*/
|
|
421
|
+
readonly data: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.Base64Action<string, undefined>]>;
|
|
422
|
+
/**
|
|
423
|
+
* The MIME type of the audio. Different providers may support different audio types.
|
|
424
|
+
*/
|
|
425
|
+
readonly mimeType: v.StringSchema<undefined>;
|
|
426
|
+
/**
|
|
427
|
+
* See [MCP specification] for notes on _meta usage.
|
|
428
|
+
*/
|
|
429
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
430
|
+
}, undefined>, v.LooseObjectSchema<{
|
|
431
|
+
/** Intended for programmatic or logical use, but used as a display name in past specs or fallback */
|
|
432
|
+
readonly name: v.StringSchema<undefined>;
|
|
433
|
+
readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
434
|
+
/**
|
|
435
|
+
* The URI of this resource.
|
|
436
|
+
*/
|
|
437
|
+
readonly uri: v.StringSchema<undefined>;
|
|
438
|
+
/**
|
|
439
|
+
* A description of what this resource represents.
|
|
440
|
+
*/
|
|
441
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
442
|
+
/**
|
|
443
|
+
* The MIME type of this resource, if known.
|
|
444
|
+
*/
|
|
445
|
+
readonly mimeType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
446
|
+
readonly type: v.LiteralSchema<"resource_link", undefined>;
|
|
447
|
+
/**
|
|
448
|
+
* See [MCP specification] for notes on _meta usage.
|
|
449
|
+
*/
|
|
450
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
451
|
+
}, undefined>, v.LooseObjectSchema<{
|
|
452
|
+
readonly type: v.LiteralSchema<"resource", undefined>;
|
|
453
|
+
readonly resource: v.UnionSchema<[v.LooseObjectSchema<{
|
|
454
|
+
/**
|
|
455
|
+
* The URI of this resource.
|
|
456
|
+
*/
|
|
457
|
+
readonly uri: v.StringSchema<undefined>;
|
|
458
|
+
/**
|
|
459
|
+
* The MIME type of this resource, if known.
|
|
460
|
+
*/
|
|
461
|
+
readonly mimeType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
462
|
+
/**
|
|
463
|
+
* The text of the item. This must only be set if the item can actually be represented as text (not binary data).
|
|
464
|
+
*/
|
|
465
|
+
readonly text: v.StringSchema<undefined>;
|
|
466
|
+
/**
|
|
467
|
+
* See [MCP specification] for notes on _meta usage.
|
|
468
|
+
*/
|
|
469
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
470
|
+
}, undefined>, v.LooseObjectSchema<{
|
|
471
|
+
/**
|
|
472
|
+
* The URI of this resource.
|
|
473
|
+
*/
|
|
474
|
+
readonly uri: v.StringSchema<undefined>;
|
|
475
|
+
/**
|
|
476
|
+
* The MIME type of this resource, if known.
|
|
477
|
+
*/
|
|
478
|
+
readonly mimeType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
479
|
+
/**
|
|
480
|
+
* A base64-encoded string representing the binary data of the item.
|
|
481
|
+
*/
|
|
482
|
+
readonly blob: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.Base64Action<string, undefined>]>;
|
|
483
|
+
/**
|
|
484
|
+
* See [MCP specification] for notes on _meta usage.
|
|
485
|
+
*/
|
|
486
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
487
|
+
}, undefined>], undefined>;
|
|
488
|
+
/**
|
|
489
|
+
* See [MCP specification] for notes on _meta usage.
|
|
490
|
+
*/
|
|
491
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
492
|
+
}, undefined>], undefined>, undefined>, readonly []>;
|
|
493
|
+
/**
|
|
494
|
+
* An object containing structured tool output.
|
|
495
|
+
*/
|
|
496
|
+
readonly structuredContent: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
497
|
+
/**
|
|
498
|
+
* Whether the tool call ended in an error.
|
|
499
|
+
*/
|
|
500
|
+
readonly isError: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
501
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
502
|
+
}, undefined>;
|
|
503
|
+
/**
|
|
504
|
+
* The server's response to a resources/read request from the client.
|
|
505
|
+
*/
|
|
506
|
+
export const ReadResourceResultSchema: v.LooseObjectSchema<{
|
|
507
|
+
readonly contents: v.ArraySchema<v.UnionSchema<[v.LooseObjectSchema<{
|
|
508
|
+
/**
|
|
509
|
+
* The URI of this resource.
|
|
510
|
+
*/
|
|
511
|
+
readonly uri: v.StringSchema<undefined>;
|
|
512
|
+
/**
|
|
513
|
+
* The MIME type of this resource, if known.
|
|
514
|
+
*/
|
|
515
|
+
readonly mimeType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
516
|
+
/**
|
|
517
|
+
* The text of the item. This must only be set if the item can actually be represented as text (not binary data).
|
|
518
|
+
*/
|
|
519
|
+
readonly text: v.StringSchema<undefined>;
|
|
520
|
+
/**
|
|
521
|
+
* See [MCP specification] for notes on _meta usage.
|
|
522
|
+
*/
|
|
523
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
524
|
+
}, undefined>, v.LooseObjectSchema<{
|
|
525
|
+
/**
|
|
526
|
+
* The URI of this resource.
|
|
527
|
+
*/
|
|
528
|
+
readonly uri: v.StringSchema<undefined>;
|
|
529
|
+
/**
|
|
530
|
+
* The MIME type of this resource, if known.
|
|
531
|
+
*/
|
|
532
|
+
readonly mimeType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
533
|
+
/**
|
|
534
|
+
* A base64-encoded string representing the binary data of the item.
|
|
535
|
+
*/
|
|
536
|
+
readonly blob: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.Base64Action<string, undefined>]>;
|
|
537
|
+
/**
|
|
538
|
+
* See [MCP specification] for notes on _meta usage.
|
|
539
|
+
*/
|
|
540
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
541
|
+
}, undefined>], undefined>, undefined>;
|
|
542
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
543
|
+
}, undefined>;
|
|
544
|
+
/**
|
|
545
|
+
* The server's response to a prompts/get request from the client.
|
|
546
|
+
*/
|
|
547
|
+
export const GetPromptResultSchema: v.LooseObjectSchema<{
|
|
548
|
+
/**
|
|
549
|
+
* An optional description for the prompt.
|
|
550
|
+
*/
|
|
551
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
552
|
+
readonly messages: v.ArraySchema<v.LooseObjectSchema<{
|
|
553
|
+
readonly role: v.PicklistSchema<["user", "assistant"], undefined>;
|
|
554
|
+
readonly content: v.UnionSchema<[v.LooseObjectSchema<{
|
|
555
|
+
readonly type: v.LiteralSchema<"text", undefined>;
|
|
556
|
+
/**
|
|
557
|
+
* The text content of the message.
|
|
558
|
+
*/
|
|
559
|
+
readonly text: v.StringSchema<undefined>;
|
|
560
|
+
/**
|
|
561
|
+
* See [MCP specification] for notes on _meta usage.
|
|
562
|
+
*/
|
|
563
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
564
|
+
}, undefined>, v.LooseObjectSchema<{
|
|
565
|
+
readonly type: v.LiteralSchema<"image", undefined>;
|
|
566
|
+
/**
|
|
567
|
+
* The base64-encoded image data.
|
|
568
|
+
*/
|
|
569
|
+
readonly data: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.Base64Action<string, undefined>]>;
|
|
570
|
+
/**
|
|
571
|
+
* The MIME type of the image. Different providers may support different image types.
|
|
572
|
+
*/
|
|
573
|
+
readonly mimeType: v.StringSchema<undefined>;
|
|
574
|
+
/**
|
|
575
|
+
* See [MCP specification] for notes on _meta usage.
|
|
576
|
+
*/
|
|
577
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
578
|
+
}, undefined>, v.LooseObjectSchema<{
|
|
579
|
+
readonly type: v.LiteralSchema<"audio", undefined>;
|
|
580
|
+
/**
|
|
581
|
+
* The base64-encoded audio data.
|
|
582
|
+
*/
|
|
583
|
+
readonly data: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.Base64Action<string, undefined>]>;
|
|
584
|
+
/**
|
|
585
|
+
* The MIME type of the audio. Different providers may support different audio types.
|
|
586
|
+
*/
|
|
587
|
+
readonly mimeType: v.StringSchema<undefined>;
|
|
588
|
+
/**
|
|
589
|
+
* See [MCP specification] for notes on _meta usage.
|
|
590
|
+
*/
|
|
591
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
592
|
+
}, undefined>, v.LooseObjectSchema<{
|
|
593
|
+
/** Intended for programmatic or logical use, but used as a display name in past specs or fallback */
|
|
594
|
+
readonly name: v.StringSchema<undefined>;
|
|
595
|
+
readonly title: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
596
|
+
/**
|
|
597
|
+
* The URI of this resource.
|
|
598
|
+
*/
|
|
599
|
+
readonly uri: v.StringSchema<undefined>;
|
|
600
|
+
/**
|
|
601
|
+
* A description of what this resource represents.
|
|
602
|
+
*/
|
|
603
|
+
readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
604
|
+
/**
|
|
605
|
+
* The MIME type of this resource, if known.
|
|
606
|
+
*/
|
|
607
|
+
readonly mimeType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
608
|
+
readonly type: v.LiteralSchema<"resource_link", undefined>;
|
|
609
|
+
/**
|
|
610
|
+
* See [MCP specification] for notes on _meta usage.
|
|
611
|
+
*/
|
|
612
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
613
|
+
}, undefined>, v.LooseObjectSchema<{
|
|
614
|
+
readonly type: v.LiteralSchema<"resource", undefined>;
|
|
615
|
+
readonly resource: v.UnionSchema<[v.LooseObjectSchema<{
|
|
616
|
+
/**
|
|
617
|
+
* The URI of this resource.
|
|
618
|
+
*/
|
|
619
|
+
readonly uri: v.StringSchema<undefined>;
|
|
620
|
+
/**
|
|
621
|
+
* The MIME type of this resource, if known.
|
|
622
|
+
*/
|
|
623
|
+
readonly mimeType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
624
|
+
/**
|
|
625
|
+
* The text of the item. This must only be set if the item can actually be represented as text (not binary data).
|
|
626
|
+
*/
|
|
627
|
+
readonly text: v.StringSchema<undefined>;
|
|
628
|
+
/**
|
|
629
|
+
* See [MCP specification] for notes on _meta usage.
|
|
630
|
+
*/
|
|
631
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
632
|
+
}, undefined>, v.LooseObjectSchema<{
|
|
633
|
+
/**
|
|
634
|
+
* The URI of this resource.
|
|
635
|
+
*/
|
|
636
|
+
readonly uri: v.StringSchema<undefined>;
|
|
637
|
+
/**
|
|
638
|
+
* The MIME type of this resource, if known.
|
|
639
|
+
*/
|
|
640
|
+
readonly mimeType: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
|
|
641
|
+
/**
|
|
642
|
+
* A base64-encoded string representing the binary data of the item.
|
|
643
|
+
*/
|
|
644
|
+
readonly blob: v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.Base64Action<string, undefined>]>;
|
|
645
|
+
/**
|
|
646
|
+
* See [MCP specification] for notes on _meta usage.
|
|
647
|
+
*/
|
|
648
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
649
|
+
}, undefined>], undefined>;
|
|
650
|
+
/**
|
|
651
|
+
* See [MCP specification] for notes on _meta usage.
|
|
652
|
+
*/
|
|
653
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
654
|
+
}, undefined>], undefined>;
|
|
655
|
+
}, undefined>, undefined>;
|
|
656
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
657
|
+
}, undefined>;
|
|
658
|
+
/**
|
|
659
|
+
* The server's response to a completion/complete request
|
|
660
|
+
*/
|
|
661
|
+
export const CompleteResultSchema: v.LooseObjectSchema<{
|
|
662
|
+
readonly completion: v.LooseObjectSchema<{
|
|
663
|
+
/**
|
|
664
|
+
* An array of completion values. Must not exceed 100 items.
|
|
665
|
+
*/
|
|
666
|
+
readonly values: v.SchemaWithPipe<readonly [v.ArraySchema<v.StringSchema<undefined>, undefined>, v.MaxLengthAction<string[], 100, undefined>]>;
|
|
667
|
+
/**
|
|
668
|
+
* The total number of completion options available. This can exceed the number of values actually sent in the response.
|
|
669
|
+
*/
|
|
670
|
+
readonly total: v.OptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>]>, undefined>;
|
|
671
|
+
/**
|
|
672
|
+
* Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.
|
|
673
|
+
*/
|
|
674
|
+
readonly hasMore: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
|
|
675
|
+
}, undefined>;
|
|
676
|
+
readonly _meta: v.OptionalSchema<v.LooseObjectSchema<{}, undefined>, undefined>;
|
|
677
|
+
}, undefined>;
|
|
678
|
+
export type CallToolResult = v.InferInput<typeof CallToolResultSchema>;
|
|
679
|
+
export type ReadResourceResult = v.InferInput<typeof ReadResourceResultSchema>;
|
|
680
|
+
export type GetPromptResult = v.InferInput<typeof GetPromptResultSchema>;
|
|
681
|
+
export type CompleteResult = v.InferInput<typeof CompleteResultSchema>;
|
|
682
|
+
import * as v from 'valibot';
|
|
@@ -0,0 +1,248 @@
|
|
|
1
|
+
/* eslint-disable jsdoc/no-undefined-types */
|
|
2
|
+
import * as v from 'valibot';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Text provided to or from an LLM.
|
|
6
|
+
*/
|
|
7
|
+
export const TextContentSchema = v.looseObject({
|
|
8
|
+
type: v.literal('text'),
|
|
9
|
+
/**
|
|
10
|
+
* The text content of the message.
|
|
11
|
+
*/
|
|
12
|
+
text: v.string(),
|
|
13
|
+
/**
|
|
14
|
+
* See [MCP specification] for notes on _meta usage.
|
|
15
|
+
*/
|
|
16
|
+
_meta: v.optional(v.looseObject({})),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* An image provided to or from an LLM.
|
|
21
|
+
*/
|
|
22
|
+
export const ImageContentSchema = v.looseObject({
|
|
23
|
+
type: v.literal('image'),
|
|
24
|
+
/**
|
|
25
|
+
* The base64-encoded image data.
|
|
26
|
+
*/
|
|
27
|
+
data: v.pipe(v.string(), v.base64()),
|
|
28
|
+
/**
|
|
29
|
+
* The MIME type of the image. Different providers may support different image types.
|
|
30
|
+
*/
|
|
31
|
+
mimeType: v.string(),
|
|
32
|
+
/**
|
|
33
|
+
* See [MCP specification] for notes on _meta usage.
|
|
34
|
+
*/
|
|
35
|
+
_meta: v.optional(v.looseObject({})),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* An Audio provided to or from an LLM.
|
|
40
|
+
*/
|
|
41
|
+
export const AudioContentSchema = v.looseObject({
|
|
42
|
+
type: v.literal('audio'),
|
|
43
|
+
/**
|
|
44
|
+
* The base64-encoded audio data.
|
|
45
|
+
*/
|
|
46
|
+
data: v.pipe(v.string(), v.base64()),
|
|
47
|
+
/**
|
|
48
|
+
* The MIME type of the audio. Different providers may support different audio types.
|
|
49
|
+
*/
|
|
50
|
+
mimeType: v.string(),
|
|
51
|
+
/**
|
|
52
|
+
* See [MCP specification] for notes on _meta usage.
|
|
53
|
+
*/
|
|
54
|
+
_meta: v.optional(v.looseObject({})),
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The contents of a specific resource or sub-resource.
|
|
59
|
+
*/
|
|
60
|
+
export const ResourceContentsSchema = v.looseObject({
|
|
61
|
+
/**
|
|
62
|
+
* The URI of this resource.
|
|
63
|
+
*/
|
|
64
|
+
uri: v.string(),
|
|
65
|
+
/**
|
|
66
|
+
* The MIME type of this resource, if known.
|
|
67
|
+
*/
|
|
68
|
+
mimeType: v.optional(v.string()),
|
|
69
|
+
/**
|
|
70
|
+
* See [MCP specification] for notes on _meta usage.
|
|
71
|
+
*/
|
|
72
|
+
_meta: v.optional(v.looseObject({})),
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
export const TextResourceContentsSchema = v.looseObject({
|
|
76
|
+
/**
|
|
77
|
+
* The URI of this resource.
|
|
78
|
+
*/
|
|
79
|
+
uri: v.string(),
|
|
80
|
+
/**
|
|
81
|
+
* The MIME type of this resource, if known.
|
|
82
|
+
*/
|
|
83
|
+
mimeType: v.optional(v.string()),
|
|
84
|
+
/**
|
|
85
|
+
* The text of the item. This must only be set if the item can actually be represented as text (not binary data).
|
|
86
|
+
*/
|
|
87
|
+
text: v.string(),
|
|
88
|
+
/**
|
|
89
|
+
* See [MCP specification] for notes on _meta usage.
|
|
90
|
+
*/
|
|
91
|
+
_meta: v.optional(v.looseObject({})),
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
export const BlobResourceContentsSchema = v.looseObject({
|
|
95
|
+
/**
|
|
96
|
+
* The URI of this resource.
|
|
97
|
+
*/
|
|
98
|
+
uri: v.string(),
|
|
99
|
+
/**
|
|
100
|
+
* The MIME type of this resource, if known.
|
|
101
|
+
*/
|
|
102
|
+
mimeType: v.optional(v.string()),
|
|
103
|
+
/**
|
|
104
|
+
* A base64-encoded string representing the binary data of the item.
|
|
105
|
+
*/
|
|
106
|
+
blob: v.pipe(v.string(), v.base64()),
|
|
107
|
+
/**
|
|
108
|
+
* See [MCP specification] for notes on _meta usage.
|
|
109
|
+
*/
|
|
110
|
+
_meta: v.optional(v.looseObject({})),
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* The contents of a resource, embedded into a prompt or tool call result.
|
|
115
|
+
*/
|
|
116
|
+
export const EmbeddedResourceSchema = v.looseObject({
|
|
117
|
+
type: v.literal('resource'),
|
|
118
|
+
resource: v.union([TextResourceContentsSchema, BlobResourceContentsSchema]),
|
|
119
|
+
/**
|
|
120
|
+
* See [MCP specification] for notes on _meta usage.
|
|
121
|
+
*/
|
|
122
|
+
_meta: v.optional(v.looseObject({})),
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* A resource that the server is capable of reading, included in a prompt or tool call result.
|
|
127
|
+
*/
|
|
128
|
+
export const ResourceLinkSchema = v.looseObject({
|
|
129
|
+
/** Intended for programmatic or logical use, but used as a display name in past specs or fallback */
|
|
130
|
+
name: v.string(),
|
|
131
|
+
title: v.optional(v.string()),
|
|
132
|
+
/**
|
|
133
|
+
* The URI of this resource.
|
|
134
|
+
*/
|
|
135
|
+
uri: v.string(),
|
|
136
|
+
/**
|
|
137
|
+
* A description of what this resource represents.
|
|
138
|
+
*/
|
|
139
|
+
description: v.optional(v.string()),
|
|
140
|
+
/**
|
|
141
|
+
* The MIME type of this resource, if known.
|
|
142
|
+
*/
|
|
143
|
+
mimeType: v.optional(v.string()),
|
|
144
|
+
type: v.literal('resource_link'),
|
|
145
|
+
/**
|
|
146
|
+
* See [MCP specification] for notes on _meta usage.
|
|
147
|
+
*/
|
|
148
|
+
_meta: v.optional(v.looseObject({})),
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* A content block that can be used in prompts and tool results.
|
|
153
|
+
*/
|
|
154
|
+
export const ContentBlockSchema = v.union([
|
|
155
|
+
TextContentSchema,
|
|
156
|
+
ImageContentSchema,
|
|
157
|
+
AudioContentSchema,
|
|
158
|
+
ResourceLinkSchema,
|
|
159
|
+
EmbeddedResourceSchema,
|
|
160
|
+
]);
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Describes a message returned as part of a prompt.
|
|
164
|
+
*/
|
|
165
|
+
export const PromptMessageSchema = v.looseObject({
|
|
166
|
+
role: v.picklist(['user', 'assistant']),
|
|
167
|
+
content: ContentBlockSchema,
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* The server's response to a tool call.
|
|
172
|
+
*/
|
|
173
|
+
export const CallToolResultSchema = v.looseObject({
|
|
174
|
+
/**
|
|
175
|
+
* A list of content objects that represent the result of the tool call.
|
|
176
|
+
*/
|
|
177
|
+
content: v.optional(v.array(ContentBlockSchema), []),
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* An object containing structured tool output.
|
|
181
|
+
*/
|
|
182
|
+
structuredContent: v.optional(v.looseObject({})),
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Whether the tool call ended in an error.
|
|
186
|
+
*/
|
|
187
|
+
isError: v.optional(v.boolean()),
|
|
188
|
+
_meta: v.optional(v.looseObject({})),
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* The server's response to a resources/read request from the client.
|
|
193
|
+
*/
|
|
194
|
+
export const ReadResourceResultSchema = v.looseObject({
|
|
195
|
+
contents: v.array(
|
|
196
|
+
v.union([TextResourceContentsSchema, BlobResourceContentsSchema]),
|
|
197
|
+
),
|
|
198
|
+
_meta: v.optional(v.looseObject({})),
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* The server's response to a prompts/get request from the client.
|
|
203
|
+
*/
|
|
204
|
+
export const GetPromptResultSchema = v.looseObject({
|
|
205
|
+
/**
|
|
206
|
+
* An optional description for the prompt.
|
|
207
|
+
*/
|
|
208
|
+
description: v.optional(v.string()),
|
|
209
|
+
messages: v.array(PromptMessageSchema),
|
|
210
|
+
_meta: v.optional(v.looseObject({})),
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* The server's response to a completion/complete request
|
|
215
|
+
*/
|
|
216
|
+
export const CompleteResultSchema = v.looseObject({
|
|
217
|
+
completion: v.looseObject({
|
|
218
|
+
/**
|
|
219
|
+
* An array of completion values. Must not exceed 100 items.
|
|
220
|
+
*/
|
|
221
|
+
values: v.pipe(v.array(v.string()), v.maxLength(100)),
|
|
222
|
+
/**
|
|
223
|
+
* The total number of completion options available. This can exceed the number of values actually sent in the response.
|
|
224
|
+
*/
|
|
225
|
+
total: v.optional(v.pipe(v.number(), v.integer())),
|
|
226
|
+
/**
|
|
227
|
+
* Indicates whether there are additional completion options beyond those provided in the current response, even if the exact total is unknown.
|
|
228
|
+
*/
|
|
229
|
+
hasMore: v.optional(v.boolean()),
|
|
230
|
+
}),
|
|
231
|
+
_meta: v.optional(v.looseObject({})),
|
|
232
|
+
});
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* @typedef {v.InferInput<typeof CallToolResultSchema>} CallToolResult
|
|
236
|
+
*/
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* @typedef {v.InferInput<typeof ReadResourceResultSchema>} ReadResourceResult
|
|
240
|
+
*/
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* @typedef {v.InferInput<typeof GetPromptResultSchema>} GetPromptResult
|
|
244
|
+
*/
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* @typedef {v.InferInput<typeof CompleteResultSchema>} CompleteResult
|
|
248
|
+
*/
|