@ai-sdk/mcp 1.0.53 → 1.0.55
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/CHANGELOG.md +16 -0
- package/dist/index.d.mts +31 -1
- package/dist/index.d.ts +31 -1
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +49 -0
- package/dist/index.mjs.map +1 -1
- package/dist/mcp-stdio/index.js +29 -0
- package/dist/mcp-stdio/index.js.map +1 -1
- package/dist/mcp-stdio/index.mjs +29 -0
- package/dist/mcp-stdio/index.mjs.map +1 -1
- package/package.json +5 -5
- package/src/index.ts +3 -0
- package/src/tool/mcp-client.ts +37 -0
- package/src/tool/mock-mcp-transport.ts +27 -0
- package/src/tool/types.ts +47 -0
package/src/tool/types.ts
CHANGED
|
@@ -91,6 +91,7 @@ const ElicitationCapabilitySchema = z
|
|
|
91
91
|
const ServerCapabilitiesSchema = z.looseObject({
|
|
92
92
|
experimental: z.optional(z.object({}).loose()),
|
|
93
93
|
logging: z.optional(z.object({}).loose()),
|
|
94
|
+
completions: z.optional(z.object({}).loose()),
|
|
94
95
|
prompts: z.optional(
|
|
95
96
|
z.looseObject({
|
|
96
97
|
listChanged: z.optional(z.boolean()),
|
|
@@ -289,6 +290,52 @@ export const ReadResourceResultSchema = ResultSchema.extend({
|
|
|
289
290
|
});
|
|
290
291
|
export type ReadResourceResult = z.infer<typeof ReadResourceResultSchema>;
|
|
291
292
|
|
|
293
|
+
// Completions
|
|
294
|
+
const PromptReferenceSchema = z
|
|
295
|
+
.object({
|
|
296
|
+
type: z.literal('ref/prompt'),
|
|
297
|
+
name: z.string(),
|
|
298
|
+
})
|
|
299
|
+
.loose();
|
|
300
|
+
|
|
301
|
+
const ResourceReferenceSchema = z
|
|
302
|
+
.object({
|
|
303
|
+
type: z.literal('ref/resource'),
|
|
304
|
+
uri: z.string(),
|
|
305
|
+
})
|
|
306
|
+
.loose();
|
|
307
|
+
|
|
308
|
+
const CompletionArgumentSchema = z
|
|
309
|
+
.object({
|
|
310
|
+
name: z.string(),
|
|
311
|
+
value: z.string(),
|
|
312
|
+
})
|
|
313
|
+
.loose();
|
|
314
|
+
|
|
315
|
+
export const CompleteRequestParamsSchema = BaseParamsSchema.extend({
|
|
316
|
+
ref: z.union([PromptReferenceSchema, ResourceReferenceSchema]),
|
|
317
|
+
argument: CompletionArgumentSchema,
|
|
318
|
+
context: z.optional(
|
|
319
|
+
z
|
|
320
|
+
.object({
|
|
321
|
+
arguments: z.record(z.string(), z.string()),
|
|
322
|
+
})
|
|
323
|
+
.loose(),
|
|
324
|
+
),
|
|
325
|
+
});
|
|
326
|
+
export type CompleteRequestParams = z.infer<typeof CompleteRequestParamsSchema>;
|
|
327
|
+
|
|
328
|
+
export const CompleteResultSchema = ResultSchema.extend({
|
|
329
|
+
completion: z
|
|
330
|
+
.object({
|
|
331
|
+
values: z.array(z.string()).max(100),
|
|
332
|
+
total: z.optional(z.number().int()),
|
|
333
|
+
hasMore: z.optional(z.boolean()),
|
|
334
|
+
})
|
|
335
|
+
.loose(),
|
|
336
|
+
});
|
|
337
|
+
export type CompleteResult = z.infer<typeof CompleteResultSchema>;
|
|
338
|
+
|
|
292
339
|
// Prompts
|
|
293
340
|
const PromptArgumentSchema = z
|
|
294
341
|
.object({
|