integrate-sdk 0.7.39 → 0.7.41
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/ai/google.d.ts +74 -27
- package/dist/ai/google.d.ts.map +1 -1
- package/dist/ai/google.js +42 -2
- package/dist/ai/index.js +45 -2
- package/dist/ai/openai.d.ts +11 -1
- package/dist/ai/openai.d.ts.map +1 -1
- package/dist/ai/openai.js +3 -0
- package/dist/server.js +45 -2
- package/dist/src/ai/google.d.ts +74 -27
- package/dist/src/ai/google.d.ts.map +1 -1
- package/dist/src/ai/openai.d.ts +11 -1
- package/dist/src/ai/openai.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/ai/google.d.ts
CHANGED
|
@@ -6,9 +6,21 @@
|
|
|
6
6
|
import type { MCPClient } from "../client.js";
|
|
7
7
|
import type { MCPTool } from "../protocol/messages.js";
|
|
8
8
|
import { type AIToolsOptions } from "./utils.js";
|
|
9
|
+
/**
|
|
10
|
+
* Schema type from @google/genai
|
|
11
|
+
*/
|
|
12
|
+
export interface Schema {
|
|
13
|
+
type?: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
enum?: string[];
|
|
16
|
+
items?: Schema;
|
|
17
|
+
properties?: Record<string, Schema>;
|
|
18
|
+
required?: string[];
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
}
|
|
9
21
|
/**
|
|
10
22
|
* Google GenAI function declaration
|
|
11
|
-
* Compatible with @google/genai SDK
|
|
23
|
+
* Compatible with @google/genai SDK FunctionDeclaration type
|
|
12
24
|
*/
|
|
13
25
|
export interface GoogleTool {
|
|
14
26
|
name: string;
|
|
@@ -16,7 +28,7 @@ export interface GoogleTool {
|
|
|
16
28
|
parameters: {
|
|
17
29
|
type: 'object';
|
|
18
30
|
description?: string;
|
|
19
|
-
properties?: Record<string,
|
|
31
|
+
properties?: Record<string, Schema>;
|
|
20
32
|
required?: string[];
|
|
21
33
|
[key: string]: unknown;
|
|
22
34
|
};
|
|
@@ -25,8 +37,8 @@ export interface GoogleTool {
|
|
|
25
37
|
* Google GenAI function call
|
|
26
38
|
*/
|
|
27
39
|
export interface GoogleFunctionCall {
|
|
28
|
-
name
|
|
29
|
-
args
|
|
40
|
+
name?: string;
|
|
41
|
+
args?: Record<string, unknown>;
|
|
30
42
|
}
|
|
31
43
|
/**
|
|
32
44
|
* Options for converting MCP tools to Google GenAI format
|
|
@@ -83,6 +95,39 @@ export declare function convertMCPToolsToGoogle(client: MCPClient<any>, options?
|
|
|
83
95
|
* ```
|
|
84
96
|
*/
|
|
85
97
|
export declare function executeGoogleFunctionCall(client: MCPClient<any>, functionCall: GoogleFunctionCall, options?: GoogleToolsOptions): Promise<string>;
|
|
98
|
+
/**
|
|
99
|
+
* Execute multiple function calls from Google GenAI response
|
|
100
|
+
*
|
|
101
|
+
* This function handles the transformation from Google's function call format
|
|
102
|
+
* to the format expected by the SDK, then executes each call.
|
|
103
|
+
*
|
|
104
|
+
* @param client - The MCP client instance
|
|
105
|
+
* @param functionCalls - Array of function calls from Google GenAI response
|
|
106
|
+
* @param options - Optional configuration including provider tokens
|
|
107
|
+
* @returns Array of execution results
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```typescript
|
|
111
|
+
* // In your API route
|
|
112
|
+
* const response = await ai.models.generateContent({
|
|
113
|
+
* model: 'gemini-2.0-flash-001',
|
|
114
|
+
* contents: messages,
|
|
115
|
+
* config: {
|
|
116
|
+
* tools: [{ functionDeclarations: await getGoogleTools(serverClient) }],
|
|
117
|
+
* },
|
|
118
|
+
* });
|
|
119
|
+
*
|
|
120
|
+
* if (response.functionCalls && response.functionCalls.length > 0) {
|
|
121
|
+
* const results = await executeGoogleFunctionCalls(
|
|
122
|
+
* serverClient,
|
|
123
|
+
* response.functionCalls,
|
|
124
|
+
* { providerTokens }
|
|
125
|
+
* );
|
|
126
|
+
* return Response.json(results);
|
|
127
|
+
* }
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
export declare function executeGoogleFunctionCalls(client: MCPClient<any>, functionCalls: GoogleFunctionCall[] | undefined | null, options?: GoogleToolsOptions): Promise<string[]>;
|
|
86
131
|
/**
|
|
87
132
|
* Get tools in a format compatible with Google GenAI
|
|
88
133
|
*
|
|
@@ -97,21 +142,21 @@ export declare function executeGoogleFunctionCall(client: MCPClient<any>, functi
|
|
|
97
142
|
* // Client-side usage
|
|
98
143
|
* import { createMCPClient, githubIntegration } from 'integrate-sdk';
|
|
99
144
|
* import { getGoogleTools } from 'integrate-sdk/ai/google';
|
|
100
|
-
* import {
|
|
145
|
+
* import { genai } from '@google/genai';
|
|
101
146
|
*
|
|
102
147
|
* const client = createMCPClient({
|
|
103
148
|
* integrations: [githubIntegration({ clientId: '...' })],
|
|
104
149
|
* });
|
|
105
150
|
*
|
|
106
151
|
* const tools = await getGoogleTools(client);
|
|
107
|
-
* const
|
|
108
|
-
* const model = genAI.getGenerativeModel({
|
|
109
|
-
* model: 'gemini-pro',
|
|
110
|
-
* tools: [{ functionDeclarations: tools }]
|
|
111
|
-
* });
|
|
152
|
+
* const ai = genai({ apiKey: 'YOUR_API_KEY' });
|
|
112
153
|
*
|
|
113
|
-
* const
|
|
114
|
-
*
|
|
154
|
+
* const response = await ai.models.generateContent({
|
|
155
|
+
* model: 'gemini-2.0-flash-001',
|
|
156
|
+
* contents: messages,
|
|
157
|
+
* config: {
|
|
158
|
+
* tools: [{ functionDeclarations: tools }]
|
|
159
|
+
* }
|
|
115
160
|
* });
|
|
116
161
|
* ```
|
|
117
162
|
*
|
|
@@ -119,7 +164,8 @@ export declare function executeGoogleFunctionCall(client: MCPClient<any>, functi
|
|
|
119
164
|
* ```typescript
|
|
120
165
|
* // Server-side usage with tokens from client
|
|
121
166
|
* import { createMCPServer, githubIntegration } from 'integrate-sdk/server';
|
|
122
|
-
* import { getGoogleTools,
|
|
167
|
+
* import { getGoogleTools, executeGoogleFunctionCalls } from 'integrate-sdk/ai/google';
|
|
168
|
+
* import { genai } from '@google/genai';
|
|
123
169
|
*
|
|
124
170
|
* const { client: serverClient } = createMCPServer({
|
|
125
171
|
* integrations: [githubIntegration({
|
|
@@ -133,25 +179,26 @@ export declare function executeGoogleFunctionCall(client: MCPClient<any>, functi
|
|
|
133
179
|
* const providerTokens = JSON.parse(req.headers.get('x-integrate-tokens') || '{}');
|
|
134
180
|
* const tools = await getGoogleTools(serverClient, { providerTokens });
|
|
135
181
|
*
|
|
136
|
-
* const
|
|
137
|
-
* const
|
|
138
|
-
* model: 'gemini-
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
* contents: [{ role: 'user', parts: [{ text: 'Create a GitHub issue' }] }]
|
|
182
|
+
* const ai = genai({ apiKey: process.env.GOOGLE_API_KEY });
|
|
183
|
+
* const response = await ai.models.generateContent({
|
|
184
|
+
* model: 'gemini-2.0-flash-001',
|
|
185
|
+
* contents: messages,
|
|
186
|
+
* config: {
|
|
187
|
+
* tools: [{ functionDeclarations: tools }]
|
|
188
|
+
* }
|
|
144
189
|
* });
|
|
145
190
|
*
|
|
146
191
|
* // Handle function calls if any
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
192
|
+
* if (response.functionCalls && response.functionCalls.length > 0) {
|
|
193
|
+
* const results = await executeGoogleFunctionCalls(
|
|
194
|
+
* serverClient,
|
|
195
|
+
* response.functionCalls,
|
|
196
|
+
* { providerTokens }
|
|
197
|
+
* );
|
|
198
|
+
* return Response.json(results);
|
|
152
199
|
* }
|
|
153
200
|
*
|
|
154
|
-
* return Response.json(
|
|
201
|
+
* return Response.json(response);
|
|
155
202
|
* }
|
|
156
203
|
* ```
|
|
157
204
|
*/
|
package/dist/ai/google.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../../src/ai/google.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,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AG,CAAC,EACtB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,UAAU,EAAE,CAAC,CAevB"}
|
package/dist/ai/google.js
CHANGED
|
@@ -4203,14 +4203,43 @@ async function ensureClientConnected(client) {
|
|
|
4203
4203
|
}
|
|
4204
4204
|
|
|
4205
4205
|
// google.ts
|
|
4206
|
+
function convertPropertiesToSchema(properties) {
|
|
4207
|
+
const result = {};
|
|
4208
|
+
for (const [key, value] of Object.entries(properties)) {
|
|
4209
|
+
if (!value || typeof value !== "object") {
|
|
4210
|
+
result[key] = value;
|
|
4211
|
+
continue;
|
|
4212
|
+
}
|
|
4213
|
+
const schema = {
|
|
4214
|
+
type: value.type,
|
|
4215
|
+
description: value.description,
|
|
4216
|
+
enum: value.enum,
|
|
4217
|
+
required: value.required
|
|
4218
|
+
};
|
|
4219
|
+
if (value.items) {
|
|
4220
|
+
schema.items = convertPropertiesToSchema({ items: value.items }).items;
|
|
4221
|
+
}
|
|
4222
|
+
if (value.properties) {
|
|
4223
|
+
schema.properties = convertPropertiesToSchema(value.properties);
|
|
4224
|
+
}
|
|
4225
|
+
for (const [k, v] of Object.entries(value)) {
|
|
4226
|
+
if (!["type", "description", "enum", "required", "items", "properties"].includes(k)) {
|
|
4227
|
+
schema[k] = v;
|
|
4228
|
+
}
|
|
4229
|
+
}
|
|
4230
|
+
result[key] = schema;
|
|
4231
|
+
}
|
|
4232
|
+
return result;
|
|
4233
|
+
}
|
|
4206
4234
|
function convertMCPToolToGoogle(mcpTool, _client, _options) {
|
|
4235
|
+
const properties = mcpTool.inputSchema?.properties || {};
|
|
4207
4236
|
return {
|
|
4208
4237
|
name: mcpTool.name,
|
|
4209
4238
|
description: mcpTool.description || `Execute ${mcpTool.name}`,
|
|
4210
4239
|
parameters: {
|
|
4211
4240
|
type: "object",
|
|
4212
4241
|
description: mcpTool.description || "",
|
|
4213
|
-
properties:
|
|
4242
|
+
properties: convertPropertiesToSchema(properties),
|
|
4214
4243
|
required: mcpTool.inputSchema?.required || []
|
|
4215
4244
|
}
|
|
4216
4245
|
};
|
|
@@ -4220,9 +4249,19 @@ function convertMCPToolsToGoogle(client, options) {
|
|
|
4220
4249
|
return mcpTools.map((mcpTool) => convertMCPToolToGoogle(mcpTool, client, options));
|
|
4221
4250
|
}
|
|
4222
4251
|
async function executeGoogleFunctionCall(client, functionCall, options) {
|
|
4223
|
-
|
|
4252
|
+
if (!functionCall.name) {
|
|
4253
|
+
throw new Error("Function call must have a name");
|
|
4254
|
+
}
|
|
4255
|
+
const result = await executeToolWithToken(client, functionCall.name, functionCall.args || {}, options);
|
|
4224
4256
|
return JSON.stringify(result);
|
|
4225
4257
|
}
|
|
4258
|
+
async function executeGoogleFunctionCalls(client, functionCalls, options) {
|
|
4259
|
+
if (!functionCalls || functionCalls.length === 0) {
|
|
4260
|
+
return [];
|
|
4261
|
+
}
|
|
4262
|
+
const results = await Promise.all(functionCalls.map((call) => executeGoogleFunctionCall(client, call, options)));
|
|
4263
|
+
return results;
|
|
4264
|
+
}
|
|
4226
4265
|
async function getGoogleTools(client, options) {
|
|
4227
4266
|
await ensureClientConnected(client);
|
|
4228
4267
|
let providerTokens = options?.providerTokens;
|
|
@@ -4236,6 +4275,7 @@ async function getGoogleTools(client, options) {
|
|
|
4236
4275
|
}
|
|
4237
4276
|
export {
|
|
4238
4277
|
getGoogleTools,
|
|
4278
|
+
executeGoogleFunctionCalls,
|
|
4239
4279
|
executeGoogleFunctionCall,
|
|
4240
4280
|
convertMCPToolsToGoogle,
|
|
4241
4281
|
convertMCPToolToGoogle
|
package/dist/ai/index.js
CHANGED
|
@@ -4317,14 +4317,43 @@ async function getCloudflareTools(client, options) {
|
|
|
4317
4317
|
}
|
|
4318
4318
|
|
|
4319
4319
|
// google.ts
|
|
4320
|
+
function convertPropertiesToSchema(properties) {
|
|
4321
|
+
const result = {};
|
|
4322
|
+
for (const [key, value] of Object.entries(properties)) {
|
|
4323
|
+
if (!value || typeof value !== "object") {
|
|
4324
|
+
result[key] = value;
|
|
4325
|
+
continue;
|
|
4326
|
+
}
|
|
4327
|
+
const schema = {
|
|
4328
|
+
type: value.type,
|
|
4329
|
+
description: value.description,
|
|
4330
|
+
enum: value.enum,
|
|
4331
|
+
required: value.required
|
|
4332
|
+
};
|
|
4333
|
+
if (value.items) {
|
|
4334
|
+
schema.items = convertPropertiesToSchema({ items: value.items }).items;
|
|
4335
|
+
}
|
|
4336
|
+
if (value.properties) {
|
|
4337
|
+
schema.properties = convertPropertiesToSchema(value.properties);
|
|
4338
|
+
}
|
|
4339
|
+
for (const [k, v] of Object.entries(value)) {
|
|
4340
|
+
if (!["type", "description", "enum", "required", "items", "properties"].includes(k)) {
|
|
4341
|
+
schema[k] = v;
|
|
4342
|
+
}
|
|
4343
|
+
}
|
|
4344
|
+
result[key] = schema;
|
|
4345
|
+
}
|
|
4346
|
+
return result;
|
|
4347
|
+
}
|
|
4320
4348
|
function convertMCPToolToGoogle(mcpTool, _client, _options) {
|
|
4349
|
+
const properties = mcpTool.inputSchema?.properties || {};
|
|
4321
4350
|
return {
|
|
4322
4351
|
name: mcpTool.name,
|
|
4323
4352
|
description: mcpTool.description || `Execute ${mcpTool.name}`,
|
|
4324
4353
|
parameters: {
|
|
4325
4354
|
type: "object",
|
|
4326
4355
|
description: mcpTool.description || "",
|
|
4327
|
-
properties:
|
|
4356
|
+
properties: convertPropertiesToSchema(properties),
|
|
4328
4357
|
required: mcpTool.inputSchema?.required || []
|
|
4329
4358
|
}
|
|
4330
4359
|
};
|
|
@@ -4334,9 +4363,19 @@ function convertMCPToolsToGoogle(client, options) {
|
|
|
4334
4363
|
return mcpTools.map((mcpTool) => convertMCPToolToGoogle(mcpTool, client, options));
|
|
4335
4364
|
}
|
|
4336
4365
|
async function executeGoogleFunctionCall(client, functionCall, options) {
|
|
4337
|
-
|
|
4366
|
+
if (!functionCall.name) {
|
|
4367
|
+
throw new Error("Function call must have a name");
|
|
4368
|
+
}
|
|
4369
|
+
const result = await executeToolWithToken(client, functionCall.name, functionCall.args || {}, options);
|
|
4338
4370
|
return JSON.stringify(result);
|
|
4339
4371
|
}
|
|
4372
|
+
async function executeGoogleFunctionCalls(client, functionCalls, options) {
|
|
4373
|
+
if (!functionCalls || functionCalls.length === 0) {
|
|
4374
|
+
return [];
|
|
4375
|
+
}
|
|
4376
|
+
const results = await Promise.all(functionCalls.map((call) => executeGoogleFunctionCall(client, call, options)));
|
|
4377
|
+
return results;
|
|
4378
|
+
}
|
|
4340
4379
|
async function getGoogleTools(client, options) {
|
|
4341
4380
|
await ensureClientConnected(client);
|
|
4342
4381
|
let providerTokens = options?.providerTokens;
|
|
@@ -4448,6 +4487,9 @@ async function handleOpenAIResponse(client, response, options) {
|
|
|
4448
4487
|
}
|
|
4449
4488
|
const finalOptions = providerTokens ? { ...options, providerTokens } : options;
|
|
4450
4489
|
const functionCalls = response.output.filter((output) => output.type === "function_call");
|
|
4490
|
+
if (functionCalls.length === 0) {
|
|
4491
|
+
return response;
|
|
4492
|
+
}
|
|
4451
4493
|
return handleOpenAIToolCalls(client, functionCalls, finalOptions);
|
|
4452
4494
|
}
|
|
4453
4495
|
|
|
@@ -4613,6 +4655,7 @@ export {
|
|
|
4613
4655
|
getAITools,
|
|
4614
4656
|
executeToolWithToken,
|
|
4615
4657
|
executeOpenAIToolCall,
|
|
4658
|
+
executeGoogleFunctionCalls,
|
|
4616
4659
|
executeGoogleFunctionCall,
|
|
4617
4660
|
executeCloudflareToolCall,
|
|
4618
4661
|
executeAnthropicToolCall,
|
package/dist/ai/openai.d.ts
CHANGED
|
@@ -220,5 +220,15 @@ export declare function handleOpenAIToolCalls(client: MCPClient<any>, toolCalls:
|
|
|
220
220
|
* });
|
|
221
221
|
* ```
|
|
222
222
|
*/
|
|
223
|
-
export declare function handleOpenAIResponse(client: MCPClient<any>, response:
|
|
223
|
+
export declare function handleOpenAIResponse(client: MCPClient<any>, response: {
|
|
224
|
+
output: Array<{
|
|
225
|
+
type: string;
|
|
226
|
+
[key: string]: any;
|
|
227
|
+
}>;
|
|
228
|
+
}, options?: OpenAIToolsOptions): Promise<OpenAI.Responses.ResponseInputItem.FunctionCallOutput[] | {
|
|
229
|
+
output: Array<{
|
|
230
|
+
type: string;
|
|
231
|
+
[key: string]: any;
|
|
232
|
+
}>;
|
|
233
|
+
}>;
|
|
224
234
|
//# sourceMappingURL=openai.d.ts.map
|
package/dist/ai/openai.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../../src/ai/openai.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAkE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AACjH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE;QACV,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,GAAG,IAAI,CAAC;IACT,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,SAAS,CAAC,GAAG,CAAC,EACvB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,UAAU,CAUZ;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,SAAS,CAAC,GAA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O,CAAC,UAAU,EAAE,CAAC,CAevB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,kBAAkB,EAAE,EAChD,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,kBAAkB,EAAE,CAAC,CA+BlE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,QAAQ,EAAE;IAAE,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAA,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC,CAAA;CAAE,EAChE,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,kBAAkB,EAAE,GAAG;IAAE,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAA,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CAyB3H"}
|
package/dist/ai/openai.js
CHANGED
|
@@ -4271,6 +4271,9 @@ async function handleOpenAIResponse(client, response, options) {
|
|
|
4271
4271
|
}
|
|
4272
4272
|
const finalOptions = providerTokens ? { ...options, providerTokens } : options;
|
|
4273
4273
|
const functionCalls = response.output.filter((output) => output.type === "function_call");
|
|
4274
|
+
if (functionCalls.length === 0) {
|
|
4275
|
+
return response;
|
|
4276
|
+
}
|
|
4274
4277
|
return handleOpenAIToolCalls(client, functionCalls, finalOptions);
|
|
4275
4278
|
}
|
|
4276
4279
|
export {
|
package/dist/server.js
CHANGED
|
@@ -6570,6 +6570,9 @@ async function handleOpenAIResponse(client, response, options) {
|
|
|
6570
6570
|
}
|
|
6571
6571
|
const finalOptions = providerTokens ? { ...options, providerTokens } : options;
|
|
6572
6572
|
const functionCalls = response.output.filter((output) => output.type === "function_call");
|
|
6573
|
+
if (functionCalls.length === 0) {
|
|
6574
|
+
return response;
|
|
6575
|
+
}
|
|
6573
6576
|
return handleOpenAIToolCalls(client, functionCalls, finalOptions);
|
|
6574
6577
|
}
|
|
6575
6578
|
// src/ai/openai-agents.ts
|
|
@@ -6672,14 +6675,43 @@ async function handleAnthropicMessage(client, message, options) {
|
|
|
6672
6675
|
];
|
|
6673
6676
|
}
|
|
6674
6677
|
// src/ai/google.ts
|
|
6678
|
+
function convertPropertiesToSchema(properties) {
|
|
6679
|
+
const result = {};
|
|
6680
|
+
for (const [key, value] of Object.entries(properties)) {
|
|
6681
|
+
if (!value || typeof value !== "object") {
|
|
6682
|
+
result[key] = value;
|
|
6683
|
+
continue;
|
|
6684
|
+
}
|
|
6685
|
+
const schema = {
|
|
6686
|
+
type: value.type,
|
|
6687
|
+
description: value.description,
|
|
6688
|
+
enum: value.enum,
|
|
6689
|
+
required: value.required
|
|
6690
|
+
};
|
|
6691
|
+
if (value.items) {
|
|
6692
|
+
schema.items = convertPropertiesToSchema({ items: value.items }).items;
|
|
6693
|
+
}
|
|
6694
|
+
if (value.properties) {
|
|
6695
|
+
schema.properties = convertPropertiesToSchema(value.properties);
|
|
6696
|
+
}
|
|
6697
|
+
for (const [k, v] of Object.entries(value)) {
|
|
6698
|
+
if (!["type", "description", "enum", "required", "items", "properties"].includes(k)) {
|
|
6699
|
+
schema[k] = v;
|
|
6700
|
+
}
|
|
6701
|
+
}
|
|
6702
|
+
result[key] = schema;
|
|
6703
|
+
}
|
|
6704
|
+
return result;
|
|
6705
|
+
}
|
|
6675
6706
|
function convertMCPToolToGoogle(mcpTool, _client, _options) {
|
|
6707
|
+
const properties = mcpTool.inputSchema?.properties || {};
|
|
6676
6708
|
return {
|
|
6677
6709
|
name: mcpTool.name,
|
|
6678
6710
|
description: mcpTool.description || `Execute ${mcpTool.name}`,
|
|
6679
6711
|
parameters: {
|
|
6680
6712
|
type: "object",
|
|
6681
6713
|
description: mcpTool.description || "",
|
|
6682
|
-
properties:
|
|
6714
|
+
properties: convertPropertiesToSchema(properties),
|
|
6683
6715
|
required: mcpTool.inputSchema?.required || []
|
|
6684
6716
|
}
|
|
6685
6717
|
};
|
|
@@ -6689,9 +6721,19 @@ function convertMCPToolsToGoogle(client, options) {
|
|
|
6689
6721
|
return mcpTools.map((mcpTool) => convertMCPToolToGoogle(mcpTool, client, options));
|
|
6690
6722
|
}
|
|
6691
6723
|
async function executeGoogleFunctionCall(client, functionCall, options) {
|
|
6692
|
-
|
|
6724
|
+
if (!functionCall.name) {
|
|
6725
|
+
throw new Error("Function call must have a name");
|
|
6726
|
+
}
|
|
6727
|
+
const result = await executeToolWithToken(client, functionCall.name, functionCall.args || {}, options);
|
|
6693
6728
|
return JSON.stringify(result);
|
|
6694
6729
|
}
|
|
6730
|
+
async function executeGoogleFunctionCalls(client, functionCalls, options) {
|
|
6731
|
+
if (!functionCalls || functionCalls.length === 0) {
|
|
6732
|
+
return [];
|
|
6733
|
+
}
|
|
6734
|
+
const results = await Promise.all(functionCalls.map((call) => executeGoogleFunctionCall(client, call, options)));
|
|
6735
|
+
return results;
|
|
6736
|
+
}
|
|
6695
6737
|
async function getGoogleTools(client, options) {
|
|
6696
6738
|
await ensureClientConnected(client);
|
|
6697
6739
|
let providerTokens = options?.providerTokens;
|
|
@@ -7044,6 +7086,7 @@ export {
|
|
|
7044
7086
|
fromNodeHeaders,
|
|
7045
7087
|
executeToolWithToken,
|
|
7046
7088
|
executeOpenAIToolCall,
|
|
7089
|
+
executeGoogleFunctionCalls,
|
|
7047
7090
|
executeGoogleFunctionCall,
|
|
7048
7091
|
executeCloudflareToolCall,
|
|
7049
7092
|
executeAnthropicToolCall,
|
package/dist/src/ai/google.d.ts
CHANGED
|
@@ -6,9 +6,21 @@
|
|
|
6
6
|
import type { MCPClient } from "../client.js";
|
|
7
7
|
import type { MCPTool } from "../protocol/messages.js";
|
|
8
8
|
import { type AIToolsOptions } from "./utils.js";
|
|
9
|
+
/**
|
|
10
|
+
* Schema type from @google/genai
|
|
11
|
+
*/
|
|
12
|
+
export interface Schema {
|
|
13
|
+
type?: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
enum?: string[];
|
|
16
|
+
items?: Schema;
|
|
17
|
+
properties?: Record<string, Schema>;
|
|
18
|
+
required?: string[];
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
}
|
|
9
21
|
/**
|
|
10
22
|
* Google GenAI function declaration
|
|
11
|
-
* Compatible with @google/genai SDK
|
|
23
|
+
* Compatible with @google/genai SDK FunctionDeclaration type
|
|
12
24
|
*/
|
|
13
25
|
export interface GoogleTool {
|
|
14
26
|
name: string;
|
|
@@ -16,7 +28,7 @@ export interface GoogleTool {
|
|
|
16
28
|
parameters: {
|
|
17
29
|
type: 'object';
|
|
18
30
|
description?: string;
|
|
19
|
-
properties?: Record<string,
|
|
31
|
+
properties?: Record<string, Schema>;
|
|
20
32
|
required?: string[];
|
|
21
33
|
[key: string]: unknown;
|
|
22
34
|
};
|
|
@@ -25,8 +37,8 @@ export interface GoogleTool {
|
|
|
25
37
|
* Google GenAI function call
|
|
26
38
|
*/
|
|
27
39
|
export interface GoogleFunctionCall {
|
|
28
|
-
name
|
|
29
|
-
args
|
|
40
|
+
name?: string;
|
|
41
|
+
args?: Record<string, unknown>;
|
|
30
42
|
}
|
|
31
43
|
/**
|
|
32
44
|
* Options for converting MCP tools to Google GenAI format
|
|
@@ -83,6 +95,39 @@ export declare function convertMCPToolsToGoogle(client: MCPClient<any>, options?
|
|
|
83
95
|
* ```
|
|
84
96
|
*/
|
|
85
97
|
export declare function executeGoogleFunctionCall(client: MCPClient<any>, functionCall: GoogleFunctionCall, options?: GoogleToolsOptions): Promise<string>;
|
|
98
|
+
/**
|
|
99
|
+
* Execute multiple function calls from Google GenAI response
|
|
100
|
+
*
|
|
101
|
+
* This function handles the transformation from Google's function call format
|
|
102
|
+
* to the format expected by the SDK, then executes each call.
|
|
103
|
+
*
|
|
104
|
+
* @param client - The MCP client instance
|
|
105
|
+
* @param functionCalls - Array of function calls from Google GenAI response
|
|
106
|
+
* @param options - Optional configuration including provider tokens
|
|
107
|
+
* @returns Array of execution results
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```typescript
|
|
111
|
+
* // In your API route
|
|
112
|
+
* const response = await ai.models.generateContent({
|
|
113
|
+
* model: 'gemini-2.0-flash-001',
|
|
114
|
+
* contents: messages,
|
|
115
|
+
* config: {
|
|
116
|
+
* tools: [{ functionDeclarations: await getGoogleTools(serverClient) }],
|
|
117
|
+
* },
|
|
118
|
+
* });
|
|
119
|
+
*
|
|
120
|
+
* if (response.functionCalls && response.functionCalls.length > 0) {
|
|
121
|
+
* const results = await executeGoogleFunctionCalls(
|
|
122
|
+
* serverClient,
|
|
123
|
+
* response.functionCalls,
|
|
124
|
+
* { providerTokens }
|
|
125
|
+
* );
|
|
126
|
+
* return Response.json(results);
|
|
127
|
+
* }
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
export declare function executeGoogleFunctionCalls(client: MCPClient<any>, functionCalls: GoogleFunctionCall[] | undefined | null, options?: GoogleToolsOptions): Promise<string[]>;
|
|
86
131
|
/**
|
|
87
132
|
* Get tools in a format compatible with Google GenAI
|
|
88
133
|
*
|
|
@@ -97,21 +142,21 @@ export declare function executeGoogleFunctionCall(client: MCPClient<any>, functi
|
|
|
97
142
|
* // Client-side usage
|
|
98
143
|
* import { createMCPClient, githubIntegration } from 'integrate-sdk';
|
|
99
144
|
* import { getGoogleTools } from 'integrate-sdk/ai/google';
|
|
100
|
-
* import {
|
|
145
|
+
* import { genai } from '@google/genai';
|
|
101
146
|
*
|
|
102
147
|
* const client = createMCPClient({
|
|
103
148
|
* integrations: [githubIntegration({ clientId: '...' })],
|
|
104
149
|
* });
|
|
105
150
|
*
|
|
106
151
|
* const tools = await getGoogleTools(client);
|
|
107
|
-
* const
|
|
108
|
-
* const model = genAI.getGenerativeModel({
|
|
109
|
-
* model: 'gemini-pro',
|
|
110
|
-
* tools: [{ functionDeclarations: tools }]
|
|
111
|
-
* });
|
|
152
|
+
* const ai = genai({ apiKey: 'YOUR_API_KEY' });
|
|
112
153
|
*
|
|
113
|
-
* const
|
|
114
|
-
*
|
|
154
|
+
* const response = await ai.models.generateContent({
|
|
155
|
+
* model: 'gemini-2.0-flash-001',
|
|
156
|
+
* contents: messages,
|
|
157
|
+
* config: {
|
|
158
|
+
* tools: [{ functionDeclarations: tools }]
|
|
159
|
+
* }
|
|
115
160
|
* });
|
|
116
161
|
* ```
|
|
117
162
|
*
|
|
@@ -119,7 +164,8 @@ export declare function executeGoogleFunctionCall(client: MCPClient<any>, functi
|
|
|
119
164
|
* ```typescript
|
|
120
165
|
* // Server-side usage with tokens from client
|
|
121
166
|
* import { createMCPServer, githubIntegration } from 'integrate-sdk/server';
|
|
122
|
-
* import { getGoogleTools,
|
|
167
|
+
* import { getGoogleTools, executeGoogleFunctionCalls } from 'integrate-sdk/ai/google';
|
|
168
|
+
* import { genai } from '@google/genai';
|
|
123
169
|
*
|
|
124
170
|
* const { client: serverClient } = createMCPServer({
|
|
125
171
|
* integrations: [githubIntegration({
|
|
@@ -133,25 +179,26 @@ export declare function executeGoogleFunctionCall(client: MCPClient<any>, functi
|
|
|
133
179
|
* const providerTokens = JSON.parse(req.headers.get('x-integrate-tokens') || '{}');
|
|
134
180
|
* const tools = await getGoogleTools(serverClient, { providerTokens });
|
|
135
181
|
*
|
|
136
|
-
* const
|
|
137
|
-
* const
|
|
138
|
-
* model: 'gemini-
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
* contents: [{ role: 'user', parts: [{ text: 'Create a GitHub issue' }] }]
|
|
182
|
+
* const ai = genai({ apiKey: process.env.GOOGLE_API_KEY });
|
|
183
|
+
* const response = await ai.models.generateContent({
|
|
184
|
+
* model: 'gemini-2.0-flash-001',
|
|
185
|
+
* contents: messages,
|
|
186
|
+
* config: {
|
|
187
|
+
* tools: [{ functionDeclarations: tools }]
|
|
188
|
+
* }
|
|
144
189
|
* });
|
|
145
190
|
*
|
|
146
191
|
* // Handle function calls if any
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
192
|
+
* if (response.functionCalls && response.functionCalls.length > 0) {
|
|
193
|
+
* const results = await executeGoogleFunctionCalls(
|
|
194
|
+
* serverClient,
|
|
195
|
+
* response.functionCalls,
|
|
196
|
+
* { providerTokens }
|
|
197
|
+
* );
|
|
198
|
+
* return Response.json(results);
|
|
152
199
|
* }
|
|
153
200
|
*
|
|
154
|
-
* return Response.json(
|
|
201
|
+
* return Response.json(response);
|
|
155
202
|
* }
|
|
156
203
|
* ```
|
|
157
204
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../../src/ai/google.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAkE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AAEjH;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"google.d.ts","sourceRoot":"","sources":["../../../src/ai/google.ts"],"names":[],"mappings":"AAAA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C5B,UAAU,CAaZ;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,UAAU,EAAE,CAGd;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,yBAAyB,CAC7C,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,YAAY,EAAE,kBAAkB,EAChC,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,MAAM,CAAC,CAYjB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,aAAa,EAAE,kBAAkB,EAAE,GAAG,SAAS,GAAG,IAAI,EACtD,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,MAAM,EAAE,CAAC,CAUnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyEG;AACH,wBAAsB,cAAc,CAClC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,UAAU,EAAE,CAAC,CAevB"}
|
package/dist/src/ai/openai.d.ts
CHANGED
|
@@ -220,5 +220,15 @@ export declare function handleOpenAIToolCalls(client: MCPClient<any>, toolCalls:
|
|
|
220
220
|
* });
|
|
221
221
|
* ```
|
|
222
222
|
*/
|
|
223
|
-
export declare function handleOpenAIResponse(client: MCPClient<any>, response:
|
|
223
|
+
export declare function handleOpenAIResponse(client: MCPClient<any>, response: {
|
|
224
|
+
output: Array<{
|
|
225
|
+
type: string;
|
|
226
|
+
[key: string]: any;
|
|
227
|
+
}>;
|
|
228
|
+
}, options?: OpenAIToolsOptions): Promise<OpenAI.Responses.ResponseInputItem.FunctionCallOutput[] | {
|
|
229
|
+
output: Array<{
|
|
230
|
+
type: string;
|
|
231
|
+
[key: string]: any;
|
|
232
|
+
}>;
|
|
233
|
+
}>;
|
|
224
234
|
//# sourceMappingURL=openai.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai.d.ts","sourceRoot":"","sources":["../../../src/ai/openai.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAkE,KAAK,cAAc,EAAE,MAAM,YAAY,CAAC;AACjH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,UAAU,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE;QACV,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;KACxB,GAAG,IAAI,CAAC;IACT,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CACpC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,SAAS,CAAC,GAAG,CAAC,EACvB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,UAAU,CAUZ;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,OAAO,CAAC,EAAE,kBAAkB,GAC3B,UAAU,EAAE,CAGd;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,q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,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,SAAS,EAAE,MAAM,CAAC,SAAS,CAAC,kBAAkB,EAAE,EAChD,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,kBAAkB,EAAE,CAAC,CA+BlE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,EACtB,QAAQ,EAAE;IAAE,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAA,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC,CAAA;CAAE,EAChE,OAAO,CAAC,EAAE,kBAAkB,GAC3B,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,iBAAiB,CAAC,kBAAkB,EAAE,GAAG;IAAE,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAA,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CAyB3H"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "integrate-sdk",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.41",
|
|
4
4
|
"description": "Type-safe 3rd party integration SDK for the Integrate MCP server",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"openai": ">=4.0.0",
|
|
87
87
|
"@openai/agents": ">=0.1.0",
|
|
88
88
|
"@anthropic-ai/sdk": ">=0.20.0",
|
|
89
|
-
"@google/
|
|
89
|
+
"@google/genai": ">=0.1.0",
|
|
90
90
|
"@cloudflare/workers-types": ">=4.0.0",
|
|
91
91
|
"@langchain/core": ">=0.1.0",
|
|
92
92
|
"llamaindex": ">=0.1.0",
|
|
@@ -108,7 +108,7 @@
|
|
|
108
108
|
"@anthropic-ai/sdk": {
|
|
109
109
|
"optional": true
|
|
110
110
|
},
|
|
111
|
-
"@google/
|
|
111
|
+
"@google/genai": {
|
|
112
112
|
"optional": true
|
|
113
113
|
},
|
|
114
114
|
"@cloudflare/workers-types": {
|