integrate-sdk 0.4.10 → 0.4.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -1967,16 +1967,13 @@ function createSimplePlugin(config) {
|
|
|
1967
1967
|
};
|
|
1968
1968
|
}
|
|
1969
1969
|
// src/integrations/vercel-ai.ts
|
|
1970
|
-
function convertMCPSchemaToParameters(inputSchema) {
|
|
1971
|
-
return inputSchema;
|
|
1972
|
-
}
|
|
1973
1970
|
function getProviderForTool(client, toolName) {
|
|
1974
1971
|
return client.getProviderForTool?.(toolName);
|
|
1975
1972
|
}
|
|
1976
1973
|
function convertMCPToolToVercelAI(mcpTool, client, options) {
|
|
1977
1974
|
return {
|
|
1978
1975
|
description: mcpTool.description || `Execute ${mcpTool.name}`,
|
|
1979
|
-
parameters:
|
|
1976
|
+
parameters: mcpTool.inputSchema,
|
|
1980
1977
|
execute: async (args) => {
|
|
1981
1978
|
if (options?.providerTokens) {
|
|
1982
1979
|
const provider = getProviderForTool(client, mcpTool.name);
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Vercel AI SDK Integration
|
|
3
3
|
*
|
|
4
|
-
* Helper functions to convert MCP tools to Vercel AI SDK format
|
|
4
|
+
* Helper functions to convert MCP tools to Vercel AI SDK v5 format
|
|
5
5
|
*/
|
|
6
6
|
import type { MCPClient } from "../client.js";
|
|
7
7
|
import type { MCPTool } from "../protocol/messages.js";
|
|
8
8
|
/**
|
|
9
|
-
* Tool definition
|
|
9
|
+
* Tool definition compatible with Vercel AI SDK v5
|
|
10
|
+
* This matches the CoreTool interface from 'ai' package v5
|
|
10
11
|
*/
|
|
11
12
|
export interface VercelAITool {
|
|
12
|
-
description
|
|
13
|
-
parameters:
|
|
14
|
-
execute: (args:
|
|
13
|
+
description?: string;
|
|
14
|
+
parameters: any;
|
|
15
|
+
execute: (args: any, options?: any) => Promise<any>;
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
18
|
* Options for converting MCP tools to Vercel AI SDK format
|
|
@@ -43,11 +44,11 @@ export interface VercelAIToolsOptions {
|
|
|
43
44
|
*/
|
|
44
45
|
export declare function convertMCPToolToVercelAI(mcpTool: MCPTool, client: MCPClient<any>, options?: VercelAIToolsOptions): VercelAITool;
|
|
45
46
|
/**
|
|
46
|
-
* Convert all enabled MCP tools to Vercel AI SDK format
|
|
47
|
+
* Convert all enabled MCP tools to Vercel AI SDK v5 format
|
|
47
48
|
*
|
|
48
49
|
* @param client - The MCP client instance (must be connected)
|
|
49
50
|
* @param options - Optional configuration including provider tokens for server-side usage
|
|
50
|
-
* @returns Object mapping tool names to Vercel AI SDK tool definitions
|
|
51
|
+
* @returns Object mapping tool names to Vercel AI SDK v5 tool definitions (compatible with CoreTool from 'ai' package v5)
|
|
51
52
|
*
|
|
52
53
|
* @example
|
|
53
54
|
* ```typescript
|
|
@@ -97,15 +98,15 @@ export declare function convertMCPToolToVercelAI(mcpTool: MCPTool, client: MCPCl
|
|
|
97
98
|
* }
|
|
98
99
|
* ```
|
|
99
100
|
*/
|
|
100
|
-
export declare function convertMCPToolsToVercelAI(client: MCPClient<any>, options?: VercelAIToolsOptions): Record<string,
|
|
101
|
+
export declare function convertMCPToolsToVercelAI(client: MCPClient<any>, options?: VercelAIToolsOptions): Record<string, any>;
|
|
101
102
|
/**
|
|
102
|
-
* Get tools in a format compatible with Vercel AI SDK's tools parameter
|
|
103
|
+
* Get tools in a format compatible with Vercel AI SDK v5's tools parameter
|
|
103
104
|
*
|
|
104
|
-
* This
|
|
105
|
+
* This returns the tools in the exact format expected by ai.generateText() and ai.streamText()
|
|
105
106
|
*
|
|
106
107
|
* @param client - The MCP client instance (must be connected)
|
|
107
108
|
* @param options - Optional configuration including provider tokens for server-side usage
|
|
108
|
-
* @returns Tools object ready to pass to generateText({ tools: ... })
|
|
109
|
+
* @returns Tools object ready to pass to generateText({ tools: ... }) or streamText({ tools: ... })
|
|
109
110
|
*
|
|
110
111
|
* @example
|
|
111
112
|
* ```typescript
|
|
@@ -120,5 +121,5 @@ export declare function convertMCPToolsToVercelAI(client: MCPClient<any>, option
|
|
|
120
121
|
* const tools = getVercelAITools(serverClient, { providerTokens });
|
|
121
122
|
* ```
|
|
122
123
|
*/
|
|
123
|
-
export declare function getVercelAITools(client: MCPClient<any>, options?: VercelAIToolsOptions): Record<string,
|
|
124
|
+
export declare function getVercelAITools(client: MCPClient<any>, options?: VercelAIToolsOptions): Record<string, any>;
|
|
124
125
|
//# sourceMappingURL=vercel-ai.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vercel-ai.d.ts","sourceRoot":"","sources":["../../../src/integrations/vercel-ai.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAEvD
|
|
1
|
+
{"version":3,"file":"vercel-ai.d.ts","sourceRoot":"","sources":["../../../src/integrations/vercel-ai.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAEvD;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,GAAG,CAAC;IAChB,OAAO,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;CACrD;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;;;;;;;;;OAaG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzC;AAYD;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,OAAO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