@composio/google 0.1.24 → 0.1.25
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.cjs +52 -22
- package/dist/index.d.cts +13 -1
- package/dist/index.d.ts +13 -1
- package/dist/index.js +52 -22
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -28,21 +28,21 @@ var GoogleProvider = class extends import_core.BaseNonAgenticProvider {
|
|
|
28
28
|
name = "google";
|
|
29
29
|
/**
|
|
30
30
|
* Creates a new instance of the GoogleProvider.
|
|
31
|
-
*
|
|
31
|
+
*
|
|
32
32
|
* This provider enables integration with Google's GenAI API,
|
|
33
33
|
* supporting both the Gemini Developer API and Vertex AI implementations.
|
|
34
|
-
*
|
|
34
|
+
*
|
|
35
35
|
* @example
|
|
36
36
|
* ```typescript
|
|
37
37
|
* // Initialize the Google provider
|
|
38
38
|
* const provider = new GoogleProvider();
|
|
39
|
-
*
|
|
39
|
+
*
|
|
40
40
|
* // Use with Composio
|
|
41
41
|
* const composio = new Composio({
|
|
42
42
|
* apiKey: 'your-api-key',
|
|
43
43
|
* provider: new GoogleProvider()
|
|
44
44
|
* });
|
|
45
|
-
*
|
|
45
|
+
*
|
|
46
46
|
* // Use the provider to wrap tools for Google GenAI
|
|
47
47
|
* const googleTools = provider.wrapTools(composioTools);
|
|
48
48
|
* ```
|
|
@@ -50,15 +50,45 @@ var GoogleProvider = class extends import_core.BaseNonAgenticProvider {
|
|
|
50
50
|
constructor() {
|
|
51
51
|
super();
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Transform MCP URL response into Google-specific format.
|
|
55
|
+
* Google uses the standard format by default.
|
|
56
|
+
*
|
|
57
|
+
* @param data - The MCP URL response data
|
|
58
|
+
* @param serverName - Name of the MCP server
|
|
59
|
+
* @param connectedAccountIds - Optional array of connected account IDs
|
|
60
|
+
* @param userIds - Optional array of user IDs
|
|
61
|
+
* @param toolkits - Optional array of toolkit names
|
|
62
|
+
* @returns Standard MCP server response format
|
|
63
|
+
*/
|
|
64
|
+
wrapMcpServerResponse(data, serverName, connectedAccountIds, userIds, toolkits) {
|
|
65
|
+
if (connectedAccountIds?.length && data.connected_account_urls) {
|
|
66
|
+
return data.connected_account_urls.map((url, index) => ({
|
|
67
|
+
url: new URL(url),
|
|
68
|
+
name: `${serverName}-${connectedAccountIds[index]}`,
|
|
69
|
+
toolkit: toolkits?.[index]
|
|
70
|
+
}));
|
|
71
|
+
} else if (userIds?.length && data.user_ids_url) {
|
|
72
|
+
return data.user_ids_url.map((url, index) => ({
|
|
73
|
+
url: new URL(url),
|
|
74
|
+
name: `${serverName}-${userIds[index]}`,
|
|
75
|
+
toolkit: toolkits?.[index]
|
|
76
|
+
}));
|
|
77
|
+
}
|
|
78
|
+
return {
|
|
79
|
+
url: new URL(data.mcp_url),
|
|
80
|
+
name: serverName
|
|
81
|
+
};
|
|
82
|
+
}
|
|
53
83
|
/**
|
|
54
84
|
* Wraps a Composio tool in the Google GenAI function declaration format.
|
|
55
|
-
*
|
|
85
|
+
*
|
|
56
86
|
* This method transforms a Composio tool definition into the format
|
|
57
87
|
* expected by Google's GenAI API for function calling.
|
|
58
|
-
*
|
|
88
|
+
*
|
|
59
89
|
* @param tool - The Composio tool to wrap
|
|
60
90
|
* @returns The wrapped tool in Google GenAI format
|
|
61
|
-
*
|
|
91
|
+
*
|
|
62
92
|
* @example
|
|
63
93
|
* ```typescript
|
|
64
94
|
* // Wrap a single tool for use with Google GenAI
|
|
@@ -73,12 +103,12 @@ var GoogleProvider = class extends import_core.BaseNonAgenticProvider {
|
|
|
73
103
|
* required: ['query']
|
|
74
104
|
* }
|
|
75
105
|
* };
|
|
76
|
-
*
|
|
106
|
+
*
|
|
77
107
|
* const googleTool = provider.wrapTool(composioTool);
|
|
78
108
|
* // Use with Google GenAI SDK
|
|
79
109
|
* const genAI = new GoogleGenerativeAI('YOUR_API_KEY');
|
|
80
110
|
* const model = genAI.getGenerativeModel({ model: 'gemini-pro' });
|
|
81
|
-
*
|
|
111
|
+
*
|
|
82
112
|
* const result = await model.generateContent({
|
|
83
113
|
* contents: [{ role: 'user', parts: [{ text: 'Search for Composio' }] }],
|
|
84
114
|
* tools: [googleTool]
|
|
@@ -99,13 +129,13 @@ var GoogleProvider = class extends import_core.BaseNonAgenticProvider {
|
|
|
99
129
|
}
|
|
100
130
|
/**
|
|
101
131
|
* Wraps a list of Composio tools in the Google GenAI function declaration format.
|
|
102
|
-
*
|
|
132
|
+
*
|
|
103
133
|
* This method transforms multiple Composio tool definitions into the format
|
|
104
134
|
* expected by Google's GenAI API for function calling.
|
|
105
|
-
*
|
|
135
|
+
*
|
|
106
136
|
* @param tools - Array of Composio tools to wrap
|
|
107
137
|
* @returns Array of wrapped tools in Google GenAI format
|
|
108
|
-
*
|
|
138
|
+
*
|
|
109
139
|
* @example
|
|
110
140
|
* ```typescript
|
|
111
141
|
* // Wrap multiple tools for use with Google GenAI
|
|
@@ -133,13 +163,13 @@ var GoogleProvider = class extends import_core.BaseNonAgenticProvider {
|
|
|
133
163
|
* }
|
|
134
164
|
* }
|
|
135
165
|
* ];
|
|
136
|
-
*
|
|
166
|
+
*
|
|
137
167
|
* const googleTools = provider.wrapTools(composioTools);
|
|
138
|
-
*
|
|
168
|
+
*
|
|
139
169
|
* // Use with Google GenAI SDK
|
|
140
170
|
* const genAI = new GoogleGenerativeAI('YOUR_API_KEY');
|
|
141
171
|
* const model = genAI.getGenerativeModel({ model: 'gemini-pro' });
|
|
142
|
-
*
|
|
172
|
+
*
|
|
143
173
|
* const result = await model.generateContent({
|
|
144
174
|
* contents: [{ role: 'user', parts: [{ text: 'How is the weather in New York?' }] }],
|
|
145
175
|
* tools: googleTools
|
|
@@ -151,16 +181,16 @@ var GoogleProvider = class extends import_core.BaseNonAgenticProvider {
|
|
|
151
181
|
}
|
|
152
182
|
/**
|
|
153
183
|
* Executes a tool call from Google GenAI.
|
|
154
|
-
*
|
|
184
|
+
*
|
|
155
185
|
* This method processes a function call from Google's GenAI API,
|
|
156
186
|
* executes the corresponding Composio tool, and returns the result.
|
|
157
|
-
*
|
|
187
|
+
*
|
|
158
188
|
* @param userId - The user ID for authentication and tracking
|
|
159
189
|
* @param tool - The Google GenAI function call to execute
|
|
160
190
|
* @param options - Optional execution options like connected account ID
|
|
161
191
|
* @param modifiers - Optional execution modifiers for tool behavior
|
|
162
192
|
* @returns The result of the tool execution as a JSON string
|
|
163
|
-
*
|
|
193
|
+
*
|
|
164
194
|
* @example
|
|
165
195
|
* ```typescript
|
|
166
196
|
* // Execute a tool call from Google GenAI
|
|
@@ -170,21 +200,21 @@ var GoogleProvider = class extends import_core.BaseNonAgenticProvider {
|
|
|
170
200
|
* query: 'composio documentation'
|
|
171
201
|
* }
|
|
172
202
|
* };
|
|
173
|
-
*
|
|
203
|
+
*
|
|
174
204
|
* const result = await provider.executeToolCall(
|
|
175
205
|
* 'user123',
|
|
176
206
|
* functionCall,
|
|
177
207
|
* { connectedAccountId: 'conn_xyz456' }
|
|
178
208
|
* );
|
|
179
|
-
*
|
|
209
|
+
*
|
|
180
210
|
* // Parse the result and use it in your application
|
|
181
211
|
* const searchResults = JSON.parse(result);
|
|
182
212
|
* console.log(searchResults);
|
|
183
|
-
*
|
|
213
|
+
*
|
|
184
214
|
* // You can also use the result to continue the conversation
|
|
185
215
|
* const genAI = new GoogleGenerativeAI('YOUR_API_KEY');
|
|
186
216
|
* const model = genAI.getGenerativeModel({ model: 'gemini-pro' });
|
|
187
|
-
*
|
|
217
|
+
*
|
|
188
218
|
* await model.generateContent({
|
|
189
219
|
* contents: [
|
|
190
220
|
* { role: 'user', parts: [{ text: 'Search for Composio' }] },
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseNonAgenticProvider, Tool, ExecuteToolFnOptions, ExecuteToolModifiers } from '@composio/core';
|
|
1
|
+
import { BaseNonAgenticProvider, McpUrlResponse, McpServerGetResponse, Tool, ExecuteToolFnOptions, ExecuteToolModifiers } from '@composio/core';
|
|
2
2
|
import { FunctionDeclaration } from '@google/genai';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -56,6 +56,18 @@ declare class GoogleProvider extends BaseNonAgenticProvider<GoogleGenAIToolColle
|
|
|
56
56
|
* ```
|
|
57
57
|
*/
|
|
58
58
|
constructor();
|
|
59
|
+
/**
|
|
60
|
+
* Transform MCP URL response into Google-specific format.
|
|
61
|
+
* Google uses the standard format by default.
|
|
62
|
+
*
|
|
63
|
+
* @param data - The MCP URL response data
|
|
64
|
+
* @param serverName - Name of the MCP server
|
|
65
|
+
* @param connectedAccountIds - Optional array of connected account IDs
|
|
66
|
+
* @param userIds - Optional array of user IDs
|
|
67
|
+
* @param toolkits - Optional array of toolkit names
|
|
68
|
+
* @returns Standard MCP server response format
|
|
69
|
+
*/
|
|
70
|
+
wrapMcpServerResponse(data: McpUrlResponse, serverName: string, connectedAccountIds?: string[], userIds?: string[], toolkits?: string[]): McpServerGetResponse;
|
|
59
71
|
/**
|
|
60
72
|
* Wraps a Composio tool in the Google GenAI function declaration format.
|
|
61
73
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseNonAgenticProvider, Tool, ExecuteToolFnOptions, ExecuteToolModifiers } from '@composio/core';
|
|
1
|
+
import { BaseNonAgenticProvider, McpUrlResponse, McpServerGetResponse, Tool, ExecuteToolFnOptions, ExecuteToolModifiers } from '@composio/core';
|
|
2
2
|
import { FunctionDeclaration } from '@google/genai';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -56,6 +56,18 @@ declare class GoogleProvider extends BaseNonAgenticProvider<GoogleGenAIToolColle
|
|
|
56
56
|
* ```
|
|
57
57
|
*/
|
|
58
58
|
constructor();
|
|
59
|
+
/**
|
|
60
|
+
* Transform MCP URL response into Google-specific format.
|
|
61
|
+
* Google uses the standard format by default.
|
|
62
|
+
*
|
|
63
|
+
* @param data - The MCP URL response data
|
|
64
|
+
* @param serverName - Name of the MCP server
|
|
65
|
+
* @param connectedAccountIds - Optional array of connected account IDs
|
|
66
|
+
* @param userIds - Optional array of user IDs
|
|
67
|
+
* @param toolkits - Optional array of toolkit names
|
|
68
|
+
* @returns Standard MCP server response format
|
|
69
|
+
*/
|
|
70
|
+
wrapMcpServerResponse(data: McpUrlResponse, serverName: string, connectedAccountIds?: string[], userIds?: string[], toolkits?: string[]): McpServerGetResponse;
|
|
59
71
|
/**
|
|
60
72
|
* Wraps a Composio tool in the Google GenAI function declaration format.
|
|
61
73
|
*
|
package/dist/index.js
CHANGED
|
@@ -6,21 +6,21 @@ var GoogleProvider = class extends BaseNonAgenticProvider {
|
|
|
6
6
|
name = "google";
|
|
7
7
|
/**
|
|
8
8
|
* Creates a new instance of the GoogleProvider.
|
|
9
|
-
*
|
|
9
|
+
*
|
|
10
10
|
* This provider enables integration with Google's GenAI API,
|
|
11
11
|
* supporting both the Gemini Developer API and Vertex AI implementations.
|
|
12
|
-
*
|
|
12
|
+
*
|
|
13
13
|
* @example
|
|
14
14
|
* ```typescript
|
|
15
15
|
* // Initialize the Google provider
|
|
16
16
|
* const provider = new GoogleProvider();
|
|
17
|
-
*
|
|
17
|
+
*
|
|
18
18
|
* // Use with Composio
|
|
19
19
|
* const composio = new Composio({
|
|
20
20
|
* apiKey: 'your-api-key',
|
|
21
21
|
* provider: new GoogleProvider()
|
|
22
22
|
* });
|
|
23
|
-
*
|
|
23
|
+
*
|
|
24
24
|
* // Use the provider to wrap tools for Google GenAI
|
|
25
25
|
* const googleTools = provider.wrapTools(composioTools);
|
|
26
26
|
* ```
|
|
@@ -28,15 +28,45 @@ var GoogleProvider = class extends BaseNonAgenticProvider {
|
|
|
28
28
|
constructor() {
|
|
29
29
|
super();
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Transform MCP URL response into Google-specific format.
|
|
33
|
+
* Google uses the standard format by default.
|
|
34
|
+
*
|
|
35
|
+
* @param data - The MCP URL response data
|
|
36
|
+
* @param serverName - Name of the MCP server
|
|
37
|
+
* @param connectedAccountIds - Optional array of connected account IDs
|
|
38
|
+
* @param userIds - Optional array of user IDs
|
|
39
|
+
* @param toolkits - Optional array of toolkit names
|
|
40
|
+
* @returns Standard MCP server response format
|
|
41
|
+
*/
|
|
42
|
+
wrapMcpServerResponse(data, serverName, connectedAccountIds, userIds, toolkits) {
|
|
43
|
+
if (connectedAccountIds?.length && data.connected_account_urls) {
|
|
44
|
+
return data.connected_account_urls.map((url, index) => ({
|
|
45
|
+
url: new URL(url),
|
|
46
|
+
name: `${serverName}-${connectedAccountIds[index]}`,
|
|
47
|
+
toolkit: toolkits?.[index]
|
|
48
|
+
}));
|
|
49
|
+
} else if (userIds?.length && data.user_ids_url) {
|
|
50
|
+
return data.user_ids_url.map((url, index) => ({
|
|
51
|
+
url: new URL(url),
|
|
52
|
+
name: `${serverName}-${userIds[index]}`,
|
|
53
|
+
toolkit: toolkits?.[index]
|
|
54
|
+
}));
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
url: new URL(data.mcp_url),
|
|
58
|
+
name: serverName
|
|
59
|
+
};
|
|
60
|
+
}
|
|
31
61
|
/**
|
|
32
62
|
* Wraps a Composio tool in the Google GenAI function declaration format.
|
|
33
|
-
*
|
|
63
|
+
*
|
|
34
64
|
* This method transforms a Composio tool definition into the format
|
|
35
65
|
* expected by Google's GenAI API for function calling.
|
|
36
|
-
*
|
|
66
|
+
*
|
|
37
67
|
* @param tool - The Composio tool to wrap
|
|
38
68
|
* @returns The wrapped tool in Google GenAI format
|
|
39
|
-
*
|
|
69
|
+
*
|
|
40
70
|
* @example
|
|
41
71
|
* ```typescript
|
|
42
72
|
* // Wrap a single tool for use with Google GenAI
|
|
@@ -51,12 +81,12 @@ var GoogleProvider = class extends BaseNonAgenticProvider {
|
|
|
51
81
|
* required: ['query']
|
|
52
82
|
* }
|
|
53
83
|
* };
|
|
54
|
-
*
|
|
84
|
+
*
|
|
55
85
|
* const googleTool = provider.wrapTool(composioTool);
|
|
56
86
|
* // Use with Google GenAI SDK
|
|
57
87
|
* const genAI = new GoogleGenerativeAI('YOUR_API_KEY');
|
|
58
88
|
* const model = genAI.getGenerativeModel({ model: 'gemini-pro' });
|
|
59
|
-
*
|
|
89
|
+
*
|
|
60
90
|
* const result = await model.generateContent({
|
|
61
91
|
* contents: [{ role: 'user', parts: [{ text: 'Search for Composio' }] }],
|
|
62
92
|
* tools: [googleTool]
|
|
@@ -77,13 +107,13 @@ var GoogleProvider = class extends BaseNonAgenticProvider {
|
|
|
77
107
|
}
|
|
78
108
|
/**
|
|
79
109
|
* Wraps a list of Composio tools in the Google GenAI function declaration format.
|
|
80
|
-
*
|
|
110
|
+
*
|
|
81
111
|
* This method transforms multiple Composio tool definitions into the format
|
|
82
112
|
* expected by Google's GenAI API for function calling.
|
|
83
|
-
*
|
|
113
|
+
*
|
|
84
114
|
* @param tools - Array of Composio tools to wrap
|
|
85
115
|
* @returns Array of wrapped tools in Google GenAI format
|
|
86
|
-
*
|
|
116
|
+
*
|
|
87
117
|
* @example
|
|
88
118
|
* ```typescript
|
|
89
119
|
* // Wrap multiple tools for use with Google GenAI
|
|
@@ -111,13 +141,13 @@ var GoogleProvider = class extends BaseNonAgenticProvider {
|
|
|
111
141
|
* }
|
|
112
142
|
* }
|
|
113
143
|
* ];
|
|
114
|
-
*
|
|
144
|
+
*
|
|
115
145
|
* const googleTools = provider.wrapTools(composioTools);
|
|
116
|
-
*
|
|
146
|
+
*
|
|
117
147
|
* // Use with Google GenAI SDK
|
|
118
148
|
* const genAI = new GoogleGenerativeAI('YOUR_API_KEY');
|
|
119
149
|
* const model = genAI.getGenerativeModel({ model: 'gemini-pro' });
|
|
120
|
-
*
|
|
150
|
+
*
|
|
121
151
|
* const result = await model.generateContent({
|
|
122
152
|
* contents: [{ role: 'user', parts: [{ text: 'How is the weather in New York?' }] }],
|
|
123
153
|
* tools: googleTools
|
|
@@ -129,16 +159,16 @@ var GoogleProvider = class extends BaseNonAgenticProvider {
|
|
|
129
159
|
}
|
|
130
160
|
/**
|
|
131
161
|
* Executes a tool call from Google GenAI.
|
|
132
|
-
*
|
|
162
|
+
*
|
|
133
163
|
* This method processes a function call from Google's GenAI API,
|
|
134
164
|
* executes the corresponding Composio tool, and returns the result.
|
|
135
|
-
*
|
|
165
|
+
*
|
|
136
166
|
* @param userId - The user ID for authentication and tracking
|
|
137
167
|
* @param tool - The Google GenAI function call to execute
|
|
138
168
|
* @param options - Optional execution options like connected account ID
|
|
139
169
|
* @param modifiers - Optional execution modifiers for tool behavior
|
|
140
170
|
* @returns The result of the tool execution as a JSON string
|
|
141
|
-
*
|
|
171
|
+
*
|
|
142
172
|
* @example
|
|
143
173
|
* ```typescript
|
|
144
174
|
* // Execute a tool call from Google GenAI
|
|
@@ -148,21 +178,21 @@ var GoogleProvider = class extends BaseNonAgenticProvider {
|
|
|
148
178
|
* query: 'composio documentation'
|
|
149
179
|
* }
|
|
150
180
|
* };
|
|
151
|
-
*
|
|
181
|
+
*
|
|
152
182
|
* const result = await provider.executeToolCall(
|
|
153
183
|
* 'user123',
|
|
154
184
|
* functionCall,
|
|
155
185
|
* { connectedAccountId: 'conn_xyz456' }
|
|
156
186
|
* );
|
|
157
|
-
*
|
|
187
|
+
*
|
|
158
188
|
* // Parse the result and use it in your application
|
|
159
189
|
* const searchResults = JSON.parse(result);
|
|
160
190
|
* console.log(searchResults);
|
|
161
|
-
*
|
|
191
|
+
*
|
|
162
192
|
* // You can also use the result to continue the conversation
|
|
163
193
|
* const genAI = new GoogleGenerativeAI('YOUR_API_KEY');
|
|
164
194
|
* const model = genAI.getGenerativeModel({ model: 'gemini-pro' });
|
|
165
|
-
*
|
|
195
|
+
*
|
|
166
196
|
* await model.generateContent({
|
|
167
197
|
* contents: [
|
|
168
198
|
* { role: 'user', parts: [{ text: 'Search for Composio' }] },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@composio/google",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.25",
|
|
4
4
|
"description": "Google GenAI Provider for Composio SDK",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -28,13 +28,13 @@
|
|
|
28
28
|
"author": "",
|
|
29
29
|
"license": "ISC",
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"@composio/core": "0.1.
|
|
31
|
+
"@composio/core": "0.1.25",
|
|
32
32
|
"@google/genai": "^1.1.0"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"tsup": "^8.4.0",
|
|
36
36
|
"typescript": "^5.8.3",
|
|
37
|
-
"@composio/core": "0.1.
|
|
37
|
+
"@composio/core": "0.1.25"
|
|
38
38
|
},
|
|
39
39
|
"scripts": {
|
|
40
40
|
"build": "tsup",
|