@composio/google 0.9.2 → 0.10.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/dist/index.d.mts CHANGED
@@ -2,7 +2,6 @@ import { BaseNonAgenticProvider, ExecuteToolFnOptions, ExecuteToolModifiers, Mcp
2
2
  import { FunctionDeclaration } from "@google/genai";
3
3
 
4
4
  //#region src/index.d.ts
5
-
6
5
  /**
7
6
  * Interface for Google GenAI function declaration
8
7
  * Based on the FunctionDeclaration type from @google/genai
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { BaseNonAgenticProvider } from "@composio/core";
1
+ import { BaseNonAgenticProvider, normalizeToolArguments } from "@composio/core";
2
2
 
3
3
  //#region src/index.ts
4
4
  /**
@@ -199,7 +199,7 @@ var GoogleProvider = class extends BaseNonAgenticProvider {
199
199
  */
200
200
  async executeToolCall(userId, tool, options, modifiers) {
201
201
  const payload = {
202
- arguments: tool.args,
202
+ arguments: normalizeToolArguments(tool.args, tool.name),
203
203
  connectedAccountId: options?.connectedAccountId,
204
204
  customAuthParams: options?.customAuthParams,
205
205
  customConnectionData: options?.customConnectionData,
package/package.json CHANGED
@@ -1,25 +1,25 @@
1
1
  {
2
2
  "name": "@composio/google",
3
- "version": "0.9.2",
3
+ "version": "0.10.0",
4
4
  "description": "Google GenAI Provider for Composio SDK",
5
5
  "main": "dist/index.mjs",
6
+ "type": "module",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/ComposioHQ/composio.git",
10
+ "directory": "ts/packages/providers/google"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/ComposioHQ/composio/issues"
14
+ },
15
+ "homepage": "https://github.com/ComposioHQ/composio/tree/main/ts/packages/providers/google#readme",
6
16
  "publishConfig": {
7
17
  "access": "public"
8
18
  },
9
19
  "exports": {
10
20
  ".": {
11
- "import": {
12
- "types": "./dist/index.d.mts",
13
- "default": "./dist/index.mjs"
14
- },
15
- "require": {
16
- "types": "./dist/index.d.cts",
17
- "default": "./dist/index.cjs"
18
- },
19
- "default": {
20
- "types": "./dist/index.d.cts",
21
- "default": "./dist/index.cjs"
22
- }
21
+ "types": "./dist/index.d.mts",
22
+ "default": "./dist/index.mjs"
23
23
  }
24
24
  },
25
25
  "files": [
@@ -40,13 +40,13 @@
40
40
  "@google/genai": "^1.1.0"
41
41
  },
42
42
  "devDependencies": {
43
- "tsdown": "^0.18.4",
44
- "typescript": "^5.9.2",
45
- "@composio/core": "0.10.0"
43
+ "tsdown": "^0.22.3",
44
+ "typescript": "^6.0.3",
45
+ "@composio/core": "0.12.0"
46
46
  },
47
47
  "scripts": {
48
48
  "clean": "git clean -xdf node_modules",
49
- "build": "pnpm exec tsdown",
49
+ "build": "tsdown",
50
50
  "test": "vitest run"
51
51
  },
52
52
  "types": "dist/index.d.mts"
package/dist/index.cjs DELETED
@@ -1,214 +0,0 @@
1
- let _composio_core = require("@composio/core");
2
-
3
- //#region src/index.ts
4
- /**
5
- * Google GenAI Provider
6
- *
7
- * This provider provides a set of tools for interacting with Google's GenAI API.
8
- * It supports both the Gemini Developer API and Vertex AI implementations.
9
- *
10
- * @packageDocumentation
11
- * @module providers/google
12
- */
13
- /**
14
- * Google GenAI Provider for Composio SDK
15
- * Implements the BaseNonAgenticProvider to wrap Composio tools for use with Google's GenAI API
16
- */
17
- var GoogleProvider = class extends _composio_core.BaseNonAgenticProvider {
18
- name = "google";
19
- /**
20
- * Creates a new instance of the GoogleProvider.
21
- *
22
- * This provider enables integration with Google's GenAI API,
23
- * supporting both the Gemini Developer API and Vertex AI implementations.
24
- *
25
- * @example
26
- * ```typescript
27
- * // Initialize the Google provider
28
- * const provider = new GoogleProvider();
29
- *
30
- * // Use with Composio
31
- * const composio = new Composio({
32
- * apiKey: 'your-api-key',
33
- * provider: new GoogleProvider()
34
- * });
35
- *
36
- * // Use the provider to wrap tools for Google GenAI
37
- * const googleTools = provider.wrapTools(composioTools);
38
- * ```
39
- */
40
- constructor() {
41
- super();
42
- }
43
- /**
44
- * Transform MCP URL response into Anthropic-specific format.
45
- * By default, Anthropic uses the standard format (same as default),
46
- * but this method is here to show providers can customize if needed.
47
- *
48
- * @param data - The MCP URL response data
49
- * @returns Standard MCP server response format
50
- */
51
- wrapMcpServerResponse(data) {
52
- return data.map((item) => ({
53
- url: new URL(item.url),
54
- name: item.name
55
- }));
56
- }
57
- /**
58
- * Wraps a Composio tool in the Google GenAI function declaration format.
59
- *
60
- * This method transforms a Composio tool definition into the format
61
- * expected by Google's GenAI API for function calling.
62
- *
63
- * @param tool - The Composio tool to wrap
64
- * @returns The wrapped tool in Google GenAI format
65
- *
66
- * @example
67
- * ```typescript
68
- * // Wrap a single tool for use with Google GenAI
69
- * const composioTool = {
70
- * slug: 'SEARCH_TOOL',
71
- * description: 'Search for information',
72
- * inputParameters: {
73
- * type: 'object',
74
- * properties: {
75
- * query: { type: 'string' }
76
- * },
77
- * required: ['query']
78
- * }
79
- * };
80
- *
81
- * const googleTool = provider.wrapTool(composioTool);
82
- * // Use with Google GenAI SDK
83
- * const genAI = new GoogleGenerativeAI('YOUR_API_KEY');
84
- * const model = genAI.getGenerativeModel({ model: 'gemini-pro' });
85
- *
86
- * const result = await model.generateContent({
87
- * contents: [{ role: 'user', parts: [{ text: 'Search for Composio' }] }],
88
- * tools: [googleTool]
89
- * });
90
- * ```
91
- */
92
- wrapTool(tool) {
93
- return {
94
- name: tool.slug,
95
- description: tool.description || "",
96
- parameters: {
97
- type: "object",
98
- description: tool.description || "",
99
- properties: tool.inputParameters?.properties || {},
100
- required: tool.inputParameters?.required || []
101
- }
102
- };
103
- }
104
- /**
105
- * Wraps a list of Composio tools in the Google GenAI function declaration format.
106
- *
107
- * This method transforms multiple Composio tool definitions into the format
108
- * expected by Google's GenAI API for function calling.
109
- *
110
- * @param tools - Array of Composio tools to wrap
111
- * @returns Array of wrapped tools in Google GenAI format
112
- *
113
- * @example
114
- * ```typescript
115
- * // Wrap multiple tools for use with Google GenAI
116
- * const composioTools = [
117
- * {
118
- * slug: 'SEARCH_TOOL',
119
- * description: 'Search for information',
120
- * inputParameters: {
121
- * type: 'object',
122
- * properties: {
123
- * query: { type: 'string' }
124
- * },
125
- * required: ['query']
126
- * }
127
- * },
128
- * {
129
- * slug: 'WEATHER_TOOL',
130
- * description: 'Get weather information',
131
- * inputParameters: {
132
- * type: 'object',
133
- * properties: {
134
- * location: { type: 'string' }
135
- * },
136
- * required: ['location']
137
- * }
138
- * }
139
- * ];
140
- *
141
- * const googleTools = provider.wrapTools(composioTools);
142
- *
143
- * // Use with Google GenAI SDK
144
- * const genAI = new GoogleGenerativeAI('YOUR_API_KEY');
145
- * const model = genAI.getGenerativeModel({ model: 'gemini-pro' });
146
- *
147
- * const result = await model.generateContent({
148
- * contents: [{ role: 'user', parts: [{ text: 'How is the weather in New York?' }] }],
149
- * tools: googleTools
150
- * });
151
- * ```
152
- */
153
- wrapTools(tools) {
154
- return tools.map((tool) => this.wrapTool(tool));
155
- }
156
- /**
157
- * Executes a tool call from Google GenAI.
158
- *
159
- * This method processes a function call from Google's GenAI API,
160
- * executes the corresponding Composio tool, and returns the result.
161
- *
162
- * @param userId - The user ID for authentication and tracking
163
- * @param tool - The Google GenAI function call to execute
164
- * @param options - Optional execution options like connected account ID
165
- * @param modifiers - Optional execution modifiers for tool behavior
166
- * @returns The result of the tool execution as a JSON string
167
- *
168
- * @example
169
- * ```typescript
170
- * // Execute a tool call from Google GenAI
171
- * const functionCall = {
172
- * name: 'SEARCH_TOOL',
173
- * args: {
174
- * query: 'composio documentation'
175
- * }
176
- * };
177
- *
178
- * const result = await provider.executeToolCall(
179
- * 'user123',
180
- * functionCall,
181
- * { connectedAccountId: 'conn_xyz456' }
182
- * );
183
- *
184
- * // Parse the result and use it in your application
185
- * const searchResults = JSON.parse(result);
186
- * console.log(searchResults);
187
- *
188
- * // You can also use the result to continue the conversation
189
- * const genAI = new GoogleGenerativeAI('YOUR_API_KEY');
190
- * const model = genAI.getGenerativeModel({ model: 'gemini-pro' });
191
- *
192
- * await model.generateContent({
193
- * contents: [
194
- * { role: 'user', parts: [{ text: 'Search for Composio' }] },
195
- * { role: 'model', parts: [{ functionResponse: { name: 'SEARCH_TOOL', response: result } }] }
196
- * ]
197
- * });
198
- * ```
199
- */
200
- async executeToolCall(userId, tool, options, modifiers) {
201
- const payload = {
202
- arguments: tool.args,
203
- connectedAccountId: options?.connectedAccountId,
204
- customAuthParams: options?.customAuthParams,
205
- customConnectionData: options?.customConnectionData,
206
- userId
207
- };
208
- const result = await this.executeTool(tool.name, payload, modifiers);
209
- return JSON.stringify(result);
210
- }
211
- };
212
-
213
- //#endregion
214
- exports.GoogleProvider = GoogleProvider;
package/dist/index.d.cts DELETED
@@ -1,193 +0,0 @@
1
- import { BaseNonAgenticProvider, ExecuteToolFnOptions, ExecuteToolModifiers, McpServerGetResponse, McpUrlResponse, Tool } from "@composio/core";
2
- import { FunctionDeclaration } from "@google/genai";
3
-
4
- //#region src/index.d.ts
5
-
6
- /**
7
- * Interface for Google GenAI function declaration
8
- * Based on the FunctionDeclaration type from @google/genai
9
- */
10
- type GoogleTool = FunctionDeclaration;
11
- /**
12
- * Interface for Google GenAI function call
13
- * Based on the FunctionCall type from @google/genai
14
- */
15
- interface GoogleGenAIFunctionCall {
16
- name: string;
17
- args: Record<string, unknown>;
18
- }
19
- /**
20
- * Type for a collection of Google GenAI function declarations
21
- */
22
- type GoogleGenAIToolCollection = GoogleTool[];
23
- /**
24
- * Google GenAI Provider for Composio SDK
25
- * Implements the BaseNonAgenticProvider to wrap Composio tools for use with Google's GenAI API
26
- */
27
- declare class GoogleProvider extends BaseNonAgenticProvider<GoogleGenAIToolCollection, GoogleTool, McpServerGetResponse> {
28
- readonly name = "google";
29
- /**
30
- * Creates a new instance of the GoogleProvider.
31
- *
32
- * This provider enables integration with Google's GenAI API,
33
- * supporting both the Gemini Developer API and Vertex AI implementations.
34
- *
35
- * @example
36
- * ```typescript
37
- * // Initialize the Google provider
38
- * const provider = new GoogleProvider();
39
- *
40
- * // Use with Composio
41
- * const composio = new Composio({
42
- * apiKey: 'your-api-key',
43
- * provider: new GoogleProvider()
44
- * });
45
- *
46
- * // Use the provider to wrap tools for Google GenAI
47
- * const googleTools = provider.wrapTools(composioTools);
48
- * ```
49
- */
50
- constructor();
51
- /**
52
- * Transform MCP URL response into Anthropic-specific format.
53
- * By default, Anthropic uses the standard format (same as default),
54
- * but this method is here to show providers can customize if needed.
55
- *
56
- * @param data - The MCP URL response data
57
- * @returns Standard MCP server response format
58
- */
59
- wrapMcpServerResponse(data: McpUrlResponse): McpServerGetResponse;
60
- /**
61
- * Wraps a Composio tool in the Google GenAI function declaration format.
62
- *
63
- * This method transforms a Composio tool definition into the format
64
- * expected by Google's GenAI API for function calling.
65
- *
66
- * @param tool - The Composio tool to wrap
67
- * @returns The wrapped tool in Google GenAI format
68
- *
69
- * @example
70
- * ```typescript
71
- * // Wrap a single tool for use with Google GenAI
72
- * const composioTool = {
73
- * slug: 'SEARCH_TOOL',
74
- * description: 'Search for information',
75
- * inputParameters: {
76
- * type: 'object',
77
- * properties: {
78
- * query: { type: 'string' }
79
- * },
80
- * required: ['query']
81
- * }
82
- * };
83
- *
84
- * const googleTool = provider.wrapTool(composioTool);
85
- * // Use with Google GenAI SDK
86
- * const genAI = new GoogleGenerativeAI('YOUR_API_KEY');
87
- * const model = genAI.getGenerativeModel({ model: 'gemini-pro' });
88
- *
89
- * const result = await model.generateContent({
90
- * contents: [{ role: 'user', parts: [{ text: 'Search for Composio' }] }],
91
- * tools: [googleTool]
92
- * });
93
- * ```
94
- */
95
- wrapTool(tool: Tool): GoogleTool;
96
- /**
97
- * Wraps a list of Composio tools in the Google GenAI function declaration format.
98
- *
99
- * This method transforms multiple Composio tool definitions into the format
100
- * expected by Google's GenAI API for function calling.
101
- *
102
- * @param tools - Array of Composio tools to wrap
103
- * @returns Array of wrapped tools in Google GenAI format
104
- *
105
- * @example
106
- * ```typescript
107
- * // Wrap multiple tools for use with Google GenAI
108
- * const composioTools = [
109
- * {
110
- * slug: 'SEARCH_TOOL',
111
- * description: 'Search for information',
112
- * inputParameters: {
113
- * type: 'object',
114
- * properties: {
115
- * query: { type: 'string' }
116
- * },
117
- * required: ['query']
118
- * }
119
- * },
120
- * {
121
- * slug: 'WEATHER_TOOL',
122
- * description: 'Get weather information',
123
- * inputParameters: {
124
- * type: 'object',
125
- * properties: {
126
- * location: { type: 'string' }
127
- * },
128
- * required: ['location']
129
- * }
130
- * }
131
- * ];
132
- *
133
- * const googleTools = provider.wrapTools(composioTools);
134
- *
135
- * // Use with Google GenAI SDK
136
- * const genAI = new GoogleGenerativeAI('YOUR_API_KEY');
137
- * const model = genAI.getGenerativeModel({ model: 'gemini-pro' });
138
- *
139
- * const result = await model.generateContent({
140
- * contents: [{ role: 'user', parts: [{ text: 'How is the weather in New York?' }] }],
141
- * tools: googleTools
142
- * });
143
- * ```
144
- */
145
- wrapTools(tools: Tool[]): GoogleGenAIToolCollection;
146
- /**
147
- * Executes a tool call from Google GenAI.
148
- *
149
- * This method processes a function call from Google's GenAI API,
150
- * executes the corresponding Composio tool, and returns the result.
151
- *
152
- * @param userId - The user ID for authentication and tracking
153
- * @param tool - The Google GenAI function call to execute
154
- * @param options - Optional execution options like connected account ID
155
- * @param modifiers - Optional execution modifiers for tool behavior
156
- * @returns The result of the tool execution as a JSON string
157
- *
158
- * @example
159
- * ```typescript
160
- * // Execute a tool call from Google GenAI
161
- * const functionCall = {
162
- * name: 'SEARCH_TOOL',
163
- * args: {
164
- * query: 'composio documentation'
165
- * }
166
- * };
167
- *
168
- * const result = await provider.executeToolCall(
169
- * 'user123',
170
- * functionCall,
171
- * { connectedAccountId: 'conn_xyz456' }
172
- * );
173
- *
174
- * // Parse the result and use it in your application
175
- * const searchResults = JSON.parse(result);
176
- * console.log(searchResults);
177
- *
178
- * // You can also use the result to continue the conversation
179
- * const genAI = new GoogleGenerativeAI('YOUR_API_KEY');
180
- * const model = genAI.getGenerativeModel({ model: 'gemini-pro' });
181
- *
182
- * await model.generateContent({
183
- * contents: [
184
- * { role: 'user', parts: [{ text: 'Search for Composio' }] },
185
- * { role: 'model', parts: [{ functionResponse: { name: 'SEARCH_TOOL', response: result } }] }
186
- * ]
187
- * });
188
- * ```
189
- */
190
- executeToolCall(userId: string, tool: GoogleGenAIFunctionCall, options?: ExecuteToolFnOptions, modifiers?: ExecuteToolModifiers): Promise<string>;
191
- }
192
- //#endregion
193
- export { GoogleGenAIFunctionCall, GoogleGenAIToolCollection, GoogleProvider, GoogleTool };