Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

Finish adding all the toolsets

haxziecb13a64bb5d5
diff --git a/README.md b/README.md
index 226f953d0..dccd69b1b 100644
--- a/README.md
+++ b/README.md
@@ -11,6 +11,19 @@ The core Composio SDK which allows users to interact with the Composio Platform.
- **ConnectedAccounts**: Manage third-party service connections. Includes functionality to create, list, refresh, and manage the status of connected accounts.
- **ActionExecution**: Track and manage the execution of actions within the platform.
+
+## Creating a new toolset
+To create a new Toolset, you need to extend the `BaseComposioToolset<YourToolType>` and implement the `_wrapTool` method to return the tool type of your choice.
+
+To Quickly create a toolset project, execute the following command from the root of the project
+```
+pnpm run create-toolset <your toolset name>
+```
+eg:
+```
+pnpm run create-toolset langchain
+```
+
## Internal
What's not included from @composio/client
- [ ] Zod Schemas for type checking
diff --git a/package.json b/package.json
index b87de1758..c03a9180f 100644
--- a/package.json
+++ b/package.json
@@ -6,6 +6,7 @@
"packages/*"
],
"scripts": {
+ "create-toolset": "bash scripts/create-toolset.sh",
"test": "echo \"Error: no test specified\" && exit 1"
},
"packageManager": "[email protected]"
diff --git a/packages/core/package.json b/packages/core/package.json
index 0dc71f9dd..d9be1c3e8 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -19,6 +19,7 @@
},
"dependencies": {
"@composio/client": "0.1.0-alpha.1",
- "@composio/openai-toolset": "workspace:^"
+ "@composio/openai-toolset": "workspace:^",
+ "zod": "^3.24.2"
}
}
diff --git a/packages/core/src/composio.ts b/packages/core/src/composio.ts
index 897135d7b..1b97b7076 100644
--- a/packages/core/src/composio.ts
+++ b/packages/core/src/composio.ts
@@ -131,9 +131,8 @@ export class Composio<TTool, T extends BaseComposioToolset<TTool>> {
* Generic function to get all the tools
* @returns {Promise<T[]>} Promise with list of tools
*/
- async getTool(id: string): Promise<WrappedTool<T>> {
- const tool = await this.tools.get(id);
- return this.toolset._wrapTool(tool) as WrappedTool<T>;
+ async getTool(slug: string): Promise<WrappedTool<T>> {
+ return this.toolset.getTool(slug) as Promise<WrappedTool<T>>;
}
/**
@@ -141,8 +140,7 @@ export class Composio<TTool, T extends BaseComposioToolset<TTool>> {
* @param query - Query parameters for the tools
* @returns {Promise<T[]>} Promise with list of tools
*/
- async getTools(query?: ToolListParams): Promise<WrappedTool<T>[]> {
- const tools = await this.tools.list(query);
- return tools.items.map((tool) => this.toolset._wrapTool(tool as Tool)) as WrappedTool<T>[];
+ async getTools(query?: ToolListParams): Promise<WrappedTool<T>[] | Record<string, WrappedTool<T>>> {
+ return this.toolset.getTools(query) as Promise<WrappedTool<T>[]>;
}
}
diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts
index e44a9f7f5..8e1da76c9 100644
--- a/packages/core/src/index.ts
+++ b/packages/core/src/index.ts
@@ -1,7 +1,11 @@
+// Core exports
import { Composio } from "./composio";
-import type { ComposioToolset } from "./toolset/ComposioToolset";
-import type { BaseComposioToolset } from "./toolset/BaseToolset";
-import type { Tool } from "./types/tool.types";
+import { ComposioToolset } from "./toolset/ComposioToolset";
+import { BaseComposioToolset } from "./toolset/BaseToolset";
+import type { Tool, ToolListParamsSchema, ToolListParams } from "./types/tool.types";
import type { Toolset } from "./types/toolset.types.";
-export { Composio, ComposioToolset, BaseComposioToolset, Tool, Toolset };
+// Utils exports
+import { jsonSchemaToModel } from "./utils/JsonSchema";
+
+export { Composio, ComposioToolset, BaseComposioToolset, Tool, ToolListParamsSchema, ToolListParams, Toolset, jsonSchemaToModel };
diff --git a/packages/core/src/toolset/BaseToolset.ts b/packages/core/src/toolset/BaseToolset.ts
index f9ac9deec..9d1c04786 100644
--- a/packages/core/src/toolset/BaseToolset.ts
+++ b/packages/core/src/toolset/BaseToolset.ts
@@ -1,5 +1,5 @@
import { Toolset } from "../types/toolset.types.";
-import { Tool, BaseTool } from "../types/tool.types";
+import { Tool, BaseTool, ToolListParams } from "../types/tool.types";
import { Composio } from "../composio";
/**
@@ -33,6 +33,27 @@ export abstract class BaseComposioToolset<TTool = BaseTool> implements Toolset<T
this.client = client;
}
+
+ /**
+ * Get all the tools from the client.
+ * @param params - The parameters for the tool list.
+ * @returns The tools.
+ */
+ async getTools(params?: ToolListParams): Promise<TTool[] | Record<string, TTool>> {
+ const tools = await this.client?.tools.list(params);
+ return tools?.items.map((tool) => this._wrapTool(tool as Tool)) ?? [];
+ }
+
+ /**
+ * Get a tool from the client.
+ * @param slug - The slug of the tool.
+ * @returns The tool.
+ */
+ async getTool(slug: string): Promise<TTool> {
+ const tool = await this.client?.tools.get(slug);
+ return this._wrapTool(tool as Tool);
+ }
+
/**
* Wrap a tool in the toolset.
* @param tool - The tool to wrap.
diff --git a/packages/core/src/types/Tool.types.ts b/packages/core/src/types/Tool.types.ts
index 05b496019..9dc779c2f 100644
--- a/packages/core/src/types/Tool.types.ts
+++ b/packages/core/src/types/Tool.types.ts
@@ -1,4 +1,5 @@
-import { ToolListResponse, ToolRetrieveResponse } from "@composio/client/resources/tools";
+import { ToolRetrieveResponse } from "@composio/client/resources/tools";
+import { z } from "zod";
export type Tool = ToolRetrieveResponse;
@@ -9,4 +10,15 @@ export interface BaseTool {
output_parameters?: Record<string, any>;
}
-export type ToolType<T extends BaseTool> = T;
\ No newline at end of file
+export type ToolType<T extends BaseTool> = T;
+
+
+export const ToolListParamsSchema = z.object({
+ cursor: z.string().optional(),
+ important: z.string().optional(),
+ limit: z.string().optional(),
+ search: z.string().optional(),
+ toolkit_slug: z.string().optional(),
+});
+
+export type ToolListParams = z.infer<typeof ToolListParamsSchema>;
\ No newline at end of file
diff --git a/packages/core/src/utils/JsonSchema.ts b/packages/core/src/utils/JsonSchema.ts
new file mode 100644
index 000000000..6f374a571
--- /dev/null
+++ b/packages/core/src/utils/JsonSchema.ts
@@ -0,0 +1,234 @@
+import z from "zod";
+
+type SchemaTypeToTsType = {
+ [key: string]: unknown;
+};
+
+const PYDANTIC_TYPE_TO_TS_TYPE: SchemaTypeToTsType = {
+ string: String,
+ integer: Number,
+ number: Number,
+ boolean: Boolean,
+ null: null,
+};
+
+export function jsonSchemaToTsType(
+ jsonSchema: Record<string, unknown>
+): unknown {
+ if (!jsonSchema.type) {
+ jsonSchema.type = "string";
+ }
+ const type = jsonSchema.type as string;
+
+ if (type === "array") {
+ const itemsSchema = jsonSchema.items;
+ if (itemsSchema) {
+ const ItemType = jsonSchemaToTsType(
+ itemsSchema as Record<string, unknown>
+ );
+ return ItemType;
+ }
+ return Array;
+ }
+
+ if (type === "object") {
+ const properties = jsonSchema.properties;
+ if (properties) {
+ const nestedModel = jsonSchemaToModel(jsonSchema);
+ return nestedModel;
+ }
+ return Object;
+ }
+
+ const tsType = PYDANTIC_TYPE_TO_TS_TYPE[type];
+ if (tsType !== undefined) {
+ return tsType;
+ }
+
+ throw new Error(`Unsupported JSON schema type: ${type}`);
+}
+
+export function jsonSchemaToTsField(
+ name: string,
+ jsonSchema: Record<string, unknown>,
+ required: string[]
+): [unknown, Record<string, unknown>] {
+ const description = jsonSchema.description;
+ const examples = jsonSchema.examples || [];
+ return [
+ jsonSchemaToTsType(jsonSchema),
+ {
+ description: description,
+ examples: examples,
+ required: required.includes(name),
+ default: required.includes(name) ? undefined : null,
+ },
+ ];
+}
+
+function jsonSchemaPropertiesToTSTypes(value: {
+ type: string;
+ description?: string;
+ examples?: string[];
+ items?: Record<string, unknown>;
+}): z.ZodTypeAny {
+ if (!value.type) {
+ return z.object({});
+ }
+
+ let zodType;
+ switch (value.type) {
+ case "string":
+ zodType = z
+ .string()
+ .describe(
+ (value.description || "") +
+ (value.examples ? `\nExamples: ${value.examples.join(", ")}` : "")
+ );
+ break;
+ case "number":
+ zodType = z
+ .number()
+ .describe(
+ (value.description || "") +
+ (value.examples ? `\nExamples: ${value.examples.join(", ")}` : "")
+ );
+ break;
+ case "integer":
+ zodType = z
+ .number()
+ .int()
+ .describe(
+ (value.description || "") +
+ (value.examples ? `\nExamples: ${value.examples.join(", ")}` : "")
+ );
+ break;
+ case "boolean":
+ zodType = z
+ .boolean()
+ .describe(
+ (value.description || "") +
+ (value.examples ? `\nExamples: ${value.examples.join(", ")}` : "")
+ );
+ break;
+ case "array":
+ zodType = z
+ .array(
+ jsonSchemaPropertiesToTSTypes(
+ value.items as {
+ type: string;
+ description?: string;
+ examples?: string[];
+ items?: Record<string, unknown>;
+ }
+ )
+ )
+ .describe(
+ (value.description || "") +
+ (value.examples ? `\nExamples: ${value.examples.join(", ")}` : "")
+ );
+ break;
+ case "object":
+ zodType = jsonSchemaToModel(value).describe(
+ (value.description || "") +
+ (value.examples ? `\nExamples: ${value.examples.join(", ")}` : "")
+ );
+ break;
+ case "null":
+ zodType = z.null().describe(value.description || "");
+ break;
+ default:
+ throw new Error(`Unsupported JSON schema type: ${value.type}`);
+ }
+
+ return zodType;
+}
+
+export function jsonSchemaToModel(
+ jsonSchema: Record<string, unknown>
+): z.ZodObject<Record<string, z.ZodTypeAny>> {
+ const properties = jsonSchema.properties as Record<string, unknown>;
+ const requiredFields = (jsonSchema.required as string[]) || [];
+ if (!properties) {
+ return z.object({});
+ }
+
+ const zodSchema: Record<string, z.ZodTypeAny> = {};
+ for (const [key, _] of Object.entries(properties)) {
+ const value = _ as Record<string, unknown>;
+ let zodType;
+ if (value.anyOf) {
+ const anyOfTypes = (value.anyOf as Record<string, unknown>[]).map(
+ (schema) =>
+ jsonSchemaPropertiesToTSTypes(
+ schema as {
+ type: string;
+ description?: string;
+ examples?: string[];
+ items?: Record<string, unknown>;
+ }
+ )
+ );
+ zodType = z
+ .union(anyOfTypes as [z.ZodTypeAny, z.ZodTypeAny, ...z.ZodTypeAny[]])
+ .describe(
+ ((value.description as string) || "") +
+ (value.examples
+ ? `\nExamples: ${(value.examples as string[]).join(", ")}`
+ : "")
+ );
+ } else if (value.allOf) {
+ const allOfTypes = (value.allOf as Record<string, unknown>[]).map(
+ (schema) =>
+ jsonSchemaPropertiesToTSTypes(
+ schema as {
+ type: string;
+ description?: string;
+ examples?: string[];
+ items?: Record<string, unknown>;
+ }
+ )
+ );
+ zodType = z
+ .intersection(
+ allOfTypes[0],
+ allOfTypes
+ .slice(1)
+ .reduce(
+ (acc: z.ZodTypeAny, schema: z.ZodTypeAny) => acc.and(schema),
+ allOfTypes[0]
+ )
+ )
+ .describe(
+ ((value.description as string) || "") +
+ (value.examples
+ ? `\nExamples: ${(value.examples as string[]).join(", ")}`
+ : "")
+ );
+ } else {
+ if (!value.type) {
+ value.type = "string";
+ }
+ zodType = jsonSchemaPropertiesToTSTypes(
+ value as {
+ type: string;
+ description?: string;
+ examples?: string[];
+ items?: Record<string, unknown>;
+ }
+ );
+ }
+
+ if (value.description) {
+ zodType = zodType.describe(value.description as string);
+ }
+
+ if (requiredFields.includes(key)) {
+ zodSchema[key] = zodType;
+ } else {
+ zodSchema[key] = zodType.optional();
+ }
+ }
+
+ return z.object(zodSchema);
+}
\ No newline at end of file
diff --git a/packages/examples/sample/src/index.ts b/packages/examples/sample/src/index.ts
index cbe554fbc..7926ce123 100644
--- a/packages/examples/sample/src/index.ts
+++ b/packages/examples/sample/src/index.ts
@@ -1,17 +1,11 @@
import { Composio } from "@composio/core";
import { OpenAIToolset } from "@composio/openai-toolset";
-/**
- * General example
- */
-async function constructorExample() {
- const composio = new Composio({
- apiKey: process.env.COMPOSIO_API_KEY,
- toolset: new OpenAIToolset(),
- });
- const tool = await composio.tools.get("HACKERNEWS_SEARCH_POSTS");
- const sampleTool = await composio.getTool("HACKERNEWS_SEARCH_POSTS");
-}
+const composio = new Composio({
+ apiKey: process.env.COMPOSIO_API_KEY,
+ toolset: new OpenAIToolset(),
+});
-constructorExample();
+const tool = await composio.getTool("HACKERNEWS_SEARCH_POSTS");
+console.log(tool);
diff --git a/packages/toolsets/cloudflare/package.json b/packages/toolsets/cloudflare/package.json
new file mode 100644
index 000000000..1fffbf2c0
--- /dev/null
+++ b/packages/toolsets/cloudflare/package.json
@@ -0,0 +1,22 @@
+{
+ "name": "@composio/cloudflare-toolset",
+ "version": "1.0.0",
+ "description": "",
+ "main": "index.js",
+ "scripts": {
+ "build": "tsup",
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "keywords": [],
+ "author": "",
+ "license": "ISC",
+ "packageManager": "[email protected]",
+ "devDependencies": {
+ "tsup": "^8.4.0",
+ "typescript": "^5.8.3"
+ },
+ "dependencies": {
+ "@cloudflare/workers-types": "^4.20250416.0",
+ "@composio/core": "workspace:^"
+ }
+}
diff --git a/packages/toolsets/cloudflare/src/index.ts b/packages/toolsets/cloudflare/src/index.ts
new file mode 100644
index 000000000..bd572e6e6
--- /dev/null
+++ b/packages/toolsets/cloudflare/src/index.ts
@@ -0,0 +1,79 @@
+import { AiTextGenerationToolInput } from "@cloudflare/workers-types";
+import { BaseComposioToolset, Tool, ToolListParams } from "@composio/core";
+
+export class CloudflareToolset extends BaseComposioToolset<AiTextGenerationToolInput> {
+ static FRAMEWORK_NAME = "cloudflare";
+ private DEFAULT_ENTITY_ID = "default";
+ static fileName: string = "toolsets/cloudflare/src/index.ts";
+
+ /**
+ * Abstract method to wrap a tool in the toolset.
+ * This method is implemented by the toolset.
+ * @param tool - The tool to wrap.
+ * @returns The wrapped tool.
+ */
+ _wrapTool(tool: Tool): AiTextGenerationToolInput {
+ const formattedSchema: AiTextGenerationToolInput["function"] = {
+ name: tool.name!,
+ description: tool.description!,
+ parameters: tool.input_parameters as unknown as {
+ type: "object";
+ properties: {
+ [key: string]: {
+ type: string;
+ description?: string;
+ };
+ };
+ required: string[];
+ },
+ };
+ const cloudflareTool: AiTextGenerationToolInput = {
+ type: "function",
+ function: formattedSchema,
+ };
+ return cloudflareTool;
+ }
+
+ /**
+ * Get all the tools from the Cloudflare API.
+ * @param {ToolListParams} query - The query parameters for the tools.
+ * @returns {Promise<Record<string, AiTextGenerationToolInput>>} The tools from the Cloudflare API.
+ */
+ override async getTools(query?: ToolListParams): Promise<Record<string, AiTextGenerationToolInput>> {
+ if (!this.client) {
+ throw new Error("Client not set");
+ }
+
+ const tools = await this.client.tools.list(query);
+ return tools.items.reduce((tools, tool) => ({
+ ...tools,
+ [tool.name]: this._wrapTool(tool as Tool),
+ }), {});
+ }
+
+
+ /**
+ * Execute a tool call.
+ * @param tool - The tool to execute.
+ * @param userId - The user id.
+ * @returns The results of the tool call.
+ */
+ async executeToolCall(tool: { name: string; arguments: unknown }, userId?: string): Promise<string> {
+ if (!this.client) {
+ throw new Error("Client not set");
+ }
+
+ const toolSchema = await this.client.tools.get(tool.name);
+ const args = typeof tool.arguments === "string"
+ ? JSON.parse(tool.arguments)
+ : tool.arguments;
+ const results = await this.client?.tools.execute(toolSchema.name, {
+ arguments: args,
+ entity_id: this.DEFAULT_ENTITY_ID,
+ connected_account_id: this.client?.getConnectedAccountId(toolSchema.name),
+ });
+
+ return JSON.stringify(results);
+ }
+
+}
diff --git a/packages/toolsets/cloudflare/tsconfig.json b/packages/toolsets/cloudflare/tsconfig.json
new file mode 100644
index 000000000..ad82940d5
--- /dev/null
+++ b/packages/toolsets/cloudflare/tsconfig.json
@@ -0,0 +1,15 @@
+{
+ "compilerOptions": {
+ "target": "ESNext",
+ "module": "ESNext",
+ "declaration": true,
+ "declarationDir": "./dist",
+ "outDir": "./dist",
+ "rootDir": "./src",
+ "strict": true,
+ "esModuleInterop": true,
+ "moduleResolution": "node",
+ "skipLibCheck": true
+ },
+ "include": ["src"]
+}
diff --git a/packages/toolsets/cloudflare/tsup.config.ts b/packages/toolsets/cloudflare/tsup.config.ts
new file mode 100644
index 000000000..f9cdf4040
--- /dev/null
+++ b/packages/toolsets/cloudflare/tsup.config.ts
@@ -0,0 +1,10 @@
+import { defineConfig } from 'tsup';
+
+export default defineConfig({
+ entry: ['src/index.ts'],
+ format: ['esm', 'cjs'],
+ dts: true,
+ clean: true,
+ minify: false,
+ outDir: 'dist',
+});
diff --git a/packages/toolsets/langchain/package.json b/packages/toolsets/langchain/package.json
new file mode 100644
index 000000000..cfc560d4c
--- /dev/null
+++ b/packages/toolsets/langchain/package.json
@@ -0,0 +1,22 @@
+{
+ "name": "@composio/langchain-toolset",
+ "version": "1.0.0",
+ "description": "",
+ "main": "index.js",
+ "scripts": {
+ "build": "tsup",
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "keywords": [],
+ "author": "",
+ "license": "ISC",
+ "packageManager": "[email protected]",
+ "devDependencies": {
+ "tsup": "^8.4.0",
+ "typescript": "^5.8.3"
+ },
+ "dependencies": {
+ "@composio/core": "workspace:^",
+ "@langchain/core": "^0.3.44"
+ }
+}
diff --git a/packages/toolsets/langchain/src/index.ts b/packages/toolsets/langchain/src/index.ts
new file mode 100644
index 000000000..88895b2f3
--- /dev/null
+++ b/packages/toolsets/langchain/src/index.ts
@@ -0,0 +1,44 @@
+import { BaseComposioToolset, jsonSchemaToModel, Tool } from "@composio/core";
+import { DynamicStructuredTool } from "@langchain/core/tools";
+
+
+
+export class LangchainToolset extends BaseComposioToolset<DynamicStructuredTool> {
+ static FRAMEWORK_NAME = "langchain";
+ private DEFAULT_ENTITY_ID = "default";
+ static fileName: string = "toolsets/langchain/src/index.ts";
+
+ /**
+ * Abstract method to wrap a tool in the toolset.
+ * This method is implemented by the toolset.
+ * @param tool - The tool to wrap.
+ * @returns The wrapped tool.
+ */
+ _wrapTool = (tool: Tool): DynamicStructuredTool => {
+ const action = tool.name
+ const description = tool.description;
+ const appName = tool.toolkit.name?.toLowerCase();
+
+ const func = async (...kwargs: unknown[]): Promise<unknown> => {
+ const connectedAccountId = this.client?.getConnectedAccountId(appName)
+ return JSON.stringify(
+ await this.client?.tools.execute(tool.name, {
+ arguments: kwargs[0] as Record<string, unknown>,
+ entity_id: this.DEFAULT_ENTITY_ID,
+ connected_account_id: connectedAccountId,
+ })
+ );
+ };
+
+ const parameters = jsonSchemaToModel(tool.input_parameters);
+
+ // @TODO: Add escriiption an other stuff here
+
+ return new DynamicStructuredTool({
+ name: action,
+ description,
+ schema: parameters,
+ func: func,
+ });
+ }
+}
diff --git a/packages/toolsets/langchain/src/utils/schema.ts b/packages/toolsets/langchain/src/utils/schema.ts
new file mode 100644
index 000000000..e69de29bb
diff --git a/packages/toolsets/langchain/tsconfig.json b/packages/toolsets/langchain/tsconfig.json
new file mode 100644
index 000000000..ad82940d5
--- /dev/null
+++ b/packages/toolsets/langchain/tsconfig.json
@@ -0,0 +1,15 @@
+{
+ "compilerOptions": {
+ "target": "ESNext",
+ "module": "ESNext",
+ "declaration": true,
+ "declarationDir": "./dist",
+ "outDir": "./dist",
+ "rootDir": "./src",
+ "strict": true,
+ "esModuleInterop": true,
+ "moduleResolution": "node",
+ "skipLibCheck": true
+ },
+ "include": ["src"]
+}
diff --git a/packages/toolsets/langchain/tsup.config.ts b/packages/toolsets/langchain/tsup.config.ts
new file mode 100644
index 000000000..f9cdf4040
--- /dev/null
+++ b/packages/toolsets/langchain/tsup.config.ts
@@ -0,0 +1,10 @@
+import { defineConfig } from 'tsup';
+
+export default defineConfig({
+ entry: ['src/index.ts'],
+ format: ['esm', 'cjs'],
+ dts: true,
+ clean: true,
+ minify: false,
+ outDir: 'dist',
+});
diff --git a/packages/toolsets/openai/src/index.ts b/packages/toolsets/openai/src/index.ts
index 782ced256..92799ed2b 100644
--- a/packages/toolsets/openai/src/index.ts
+++ b/packages/toolsets/openai/src/index.ts
@@ -1,4 +1,4 @@
-import { BaseComposioToolset, Composio, Toolset } from "@composio/core";
+import { BaseComposioToolset } from "@composio/core";
import { Tool } from "@composio/core";
import { OpenAI } from "openai";
import { Stream } from "openai/streaming";
@@ -7,6 +7,10 @@ export class OpenAIToolset extends BaseComposioToolset<OpenAI.ChatCompletionTool
static readonly FRAMEWORK_NAME = "openai";
private static readonly FILE_NAME = "toolsets/openai/src/index.ts";
+ constructor() {
+ super();
+ }
+
/**
* Absract method to wrap a tool in the toolset.
* This method is implemented by the toolset.
@@ -25,31 +29,6 @@ export class OpenAIToolset extends BaseComposioToolset<OpenAI.ChatCompletionTool
};
};
- /**
- * Get all the tools from the client.
- * @returns {Promise<OpenAI.ChatCompletionTool[]>} The tools.
- */
- async getTools (): Promise<OpenAI.ChatCompletionTool[]> {
- if (!this.client) {
- throw new Error("Client not set");
- }
- const tools = await this.client.tools.list();
- return tools.items.map((tool) => this._wrapTool(tool as Tool));
- }
-
- /**
- * Get a tool from the client.
- * @param id - The id of the tool.
- * @returns {Promise<OpenAI.ChatCompletionTool>} The tool.
- */
- async getTool (id: string): Promise<OpenAI.ChatCompletionTool> {
- if (!this.client) {
- throw new Error("Client not set");
- }
- const tool = await this.client.tools.get(id);
- return this._wrapTool(tool as Tool);
- }
-
/**
* @TODO include the connectedAccountId / app name in the tool call
* @param tool
diff --git a/packages/toolsets/vercel/package.json b/packages/toolsets/vercel/package.json
new file mode 100644
index 000000000..2caf86691
--- /dev/null
+++ b/packages/toolsets/vercel/package.json
@@ -0,0 +1,22 @@
+{
+ "name": "@composio/vercel-toolset",
+ "version": "1.0.0",
+ "description": "",
+ "main": "index.js",
+ "scripts": {
+ "build": "tsup",
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "keywords": [],
+ "author": "",
+ "license": "ISC",
+ "packageManager": "[email protected]",
+ "devDependencies": {
+ "tsup": "^8.4.0",
+ "typescript": "^5.8.3"
+ },
+ "dependencies": {
+ "@composio/core": "workspace:^",
+ "ai": "^4.3.8"
+ }
+}
diff --git a/packages/toolsets/vercel/src/index.ts b/packages/toolsets/vercel/src/index.ts
new file mode 100644
index 000000000..d79381a10
--- /dev/null
+++ b/packages/toolsets/vercel/src/index.ts
@@ -0,0 +1,68 @@
+import { BaseComposioToolset, Tool as ComposioTool, ToolListParams } from "@composio/core";
+import type { Tool as VercelTool } from "ai";
+import { jsonSchema, tool } from "ai";
+
+export class VercelToolset extends BaseComposioToolset<VercelTool> {
+
+ private static readonly FILE_NAME = "toolsets/vercel/src/index.ts";
+ static readonly FRAMEWORK_NAME = "vercel";
+
+ /**
+ * Get all the tools from the client.
+ * Override the default implementation to return a record of tools.
+ *
+ * @param params - The parameters for the tool list.
+ * @returns The tools.
+ */
+ override async getTools(params?: ToolListParams): Promise<Record<string, VercelTool>> {
+ if (!this.client) {
+ throw new Error("Client not initialized");
+ }
+ const tools = await this.client.tools.list(params);
+ return tools.items.reduce((tools, tool) => ({ ...tools, [tool.name]: this._wrapTool(tool as ComposioTool) }), {});
+ }
+
+ /**
+ * Execute a tool call.
+ * @param tool - The tool to execute.
+ * @param userId - The user id.
+ * @returns {Promise<string>} The result of the tool call.
+ */
+ async executeToolCall(
+ tool: { name: string; arguments: unknown },
+ userId?: string
+ ): Promise<string> {
+ if (!this.client) {
+ throw new Error("Client not initialized");
+ }
+
+ const toolSchema = await this.client.tools.get(tool.name);
+ const appName = toolSchema?.name.toLowerCase();
+ const args = typeof tool.arguments === "string" ? JSON.parse(tool.arguments) : tool.arguments;
+
+ const results = await this.client.tools.execute(toolSchema.name, {
+ arguments: args,
+ entity_id: userId ?? this.client.userId,
+ connected_account_id: this.client.getConnectedAccountId(appName)
+ });
+
+ return JSON.stringify(results);
+ }
+
+ _wrapTool(composioTool: ComposioTool): VercelTool {
+ return tool({
+ description: composioTool.description,
+ // @ts-ignore the type are JSONSchemV7. Internally it's resolved
+ parameters: jsonSchema(composioTool.input_parameters),
+ execute: async (params) => {
+ return await this.executeToolCall(
+ {
+ name: composioTool.name,
+ arguments: JSON.stringify(params),
+ },
+ this.client?.userId
+ );
+ },
+ });
+ }
+}
\ No newline at end of file
diff --git a/packages/toolsets/vercel/tsconfig.json b/packages/toolsets/vercel/tsconfig.json
new file mode 100644
index 000000000..ad82940d5
--- /dev/null
+++ b/packages/toolsets/vercel/tsconfig.json
@@ -0,0 +1,15 @@
+{
+ "compilerOptions": {
+ "target": "ESNext",
+ "module": "ESNext",
+ "declaration": true,
+ "declarationDir": "./dist",
+ "outDir": "./dist",
+ "rootDir": "./src",
+ "strict": true,
+ "esModuleInterop": true,
+ "moduleResolution": "node",
+ "skipLibCheck": true
+ },
+ "include": ["src"]
+}
diff --git a/packages/toolsets/vercel/tsup.config.ts b/packages/toolsets/vercel/tsup.config.ts
new file mode 100644
index 000000000..f9cdf4040
--- /dev/null
+++ b/packages/toolsets/vercel/tsup.config.ts
@@ -0,0 +1,10 @@
+import { defineConfig } from 'tsup';
+
+export default defineConfig({
+ entry: ['src/index.ts'],
+ format: ['esm', 'cjs'],
+ dts: true,
+ clean: true,
+ minify: false,
+ outDir: 'dist',
+});
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index ce58978c3..f2649034a 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -16,6 +16,9 @@ importers:
'@composio/openai-toolset':
specifier: workspace:^
version: link:../toolsets/openai
+ zod:
+ specifier: ^3.24.2
+ version: 3.24.2
devDependencies:
rolldown:
specifier: 1.0.0-beta.7
@@ -46,6 +49,38 @@ importers:
specifier: ^5.8.3
version: 5.8.3
+ packages/toolsets/cloudflare:
+ dependencies:
+ '@cloudflare/workers-types':
+ specifier: ^4.20250416.0
+ version: 4.20250416.0
+ '@composio/core':
+ specifier: workspace:^
+ version: link:../../core
+ devDependencies:
+ tsup:
+ specifier: ^8.4.0
+ typescript:
+ specifier: ^5.8.3
+ version: 5.8.3
+
+ packages/toolsets/langchain:
+ dependencies:
+ '@composio/core':
+ specifier: workspace:^
+ version: link:../../core
+ '@langchain/core':
+ specifier: ^0.3.44
+ devDependencies:
+ tsup:
+ specifier: ^8.4.0
+ typescript:
+ specifier: ^5.8.3
+ version: 5.8.3
+
packages/toolsets/openai:
dependencies:
'@composio/core':
@@ -53,7 +88,23 @@ importers:
version: link:../../core
openai:
specifier: ^4.94.0
- version: 4.94.0
+ version: 4.94.0([email protected])
+ devDependencies:
+ tsup:
+ specifier: ^8.4.0
+ typescript:
+ specifier: ^5.8.3
+ version: 5.8.3
+
+ packages/toolsets/vercel:
+ dependencies:
+ '@composio/core':
+ specifier: workspace:^
+ version: link:../../core
+ ai:
+ specifier: ^4.3.8
devDependencies:
tsup:
specifier: ^8.4.0
@@ -64,6 +115,38 @@ importers:
packages:
+ '@ai-sdk/[email protected]':
+ resolution: {integrity: sha512-kM0xS3GWg3aMChh9zfeM+80vEZfXzR3JEUBdycZLtbRZ2TRT8xOj3WodGHPb06sUK5yD7pAXC/P7ctsi2fvUGQ==}
+ engines: {node: '>=18'}
+ peerDependencies:
+ zod: ^3.23.8
+
+ '@ai-sdk/[email protected]':
+ resolution: {integrity: sha512-qZMxYJ0qqX/RfnuIaab+zp8UAeJn/ygXXAffR5I4N0n1IrvA6qBsjc8hXLmBiMV2zoXlifkacF7sEFnYnjBcqg==}
+ engines: {node: '>=18'}
+
+ '@ai-sdk/[email protected]':
+ resolution: {integrity: sha512-/VYm8xifyngaqFDLXACk/1czDRCefNCdALUyp+kIX6DUIYUWTM93ISoZ+qJ8+3E+FiJAKBQz61o8lIIl+vYtzg==}
+ engines: {node: '>=18'}
+ peerDependencies:
+ react: ^18 || ^19 || ^19.0.0-rc
+ zod: ^3.23.8
+ peerDependenciesMeta:
+ zod:
+ optional: true
+
+ '@ai-sdk/[email protected]':
+ resolution: {integrity: sha512-nls/IJCY+ks3Uj6G/agNhXqQeLVqhNfoJbuNgCny+nX2veY5ADB91EcZUqVeQ/ionul2SeUswPY6Q/DxteY29Q==}
+ engines: {node: '>=18'}
+ peerDependencies:
+ zod: ^3.23.8
+
+ '@cfworker/[email protected]':
+ resolution: {integrity: sha512-gAmrUZSGtKc3AiBL71iNWxDsyUC5uMaKKGdvzYsBoTW/xi42JQHl7eKV2OYzCUqvc+D2RCcf7EXY2iCyFIk6og==}
+
+ '@cloudflare/[email protected]':
+ resolution: {integrity: sha512-i37TX0Clp+MrPdXMBdvKZM7JghCrWD9GtG7E+8ANOAPmtZjUkZfEy9qq46IG3XlNpagPaWDkY3SgJ3s01gPxCw==}
+
'@composio/[email protected]':
resolution: {integrity: sha512-cWN3Kffl1zkJ9LVHXtIAZplyUP1fktNIXgPhKL9RMRrUlQyuwpA8k2so4nlxg4f1C77NZSM+9/gbNOLNRWx21g==}
@@ -248,9 +331,17 @@ packages:
'@jridgewell/[email protected]':
resolution: {integrity: sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==}
+ '@langchain/[email protected]':
+ resolution: {integrity: sha512-3BsSFf7STvPPZyl2kMANgtVnCUvDdyP4k+koP+nY2Tczd5V+RFkuazIn/JOj/xxy/neZjr4PxFU4BFyF1aKXOA==}
+ engines: {node: '>=18'}
+
'@napi-rs/[email protected]':
resolution: {integrity: sha512-OBlgKdX7gin7OIq4fadsjpg+cp2ZphvAIKucHsNfTdJiqdOmOEwQd/bHi0VwNrcw5xpBJyUw6cK/QilCqy1BSg==}
+ '@opentelemetry/[email protected]':
+ resolution: {integrity: sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==}
+ engines: {node: '>=8.0.0'}
+
'@oxc-project/[email protected]':
resolution: {integrity: sha512-rfuwJwvwn9MRthHNXlSo9Eka/u7gC0MhnWAoX3BhE1+rwPOl22nq0K0Y997Hof0tHCOuD7H3/Z8HTfCVhB4c5Q==}
@@ -424,6 +515,9 @@ packages:
resolution: {integrity: sha512-epShhLGQYc4Bv/aceHbmBhOz1XgUnuTZgcxjxk+WXwNyDXavv5QHD1QEFV0FwbTSQtNq6g4ZcV6y0vZakTjswg==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-xFdR6tkm0MWvBfO8xXCSsinYxHcqkQUlcHeSpMC2ukzOb6lwQAfDmW+Qt0AvlGd8HpsS28qKsB+oPeJn9I39jg==}
+
resolution: {integrity: sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==}
@@ -436,6 +530,12 @@ packages:
resolution: {integrity: sha512-Kmpl+z84ILoG+3T/zQFyAJsU6EPTmOCj8/2+83fSN6djd6I4o7uOuGIH6vq3PrjY5BGitSbFuMN18j3iknubbA==}
+ '@types/[email protected]':
+ resolution: {integrity: sha512-wWKOClTTiizcZhXnPY4wikVAwmdYHp8q6DmC+EJUzAMsycb7HB32Kh9RN4+0gExjmPmZSAQjgURXIGATPegAvA==}
+
+ '@types/[email protected]':
+ resolution: {integrity: sha512-7gqG38EyHgyP1S+7+xomFtL+ZNHcKv6DwNaCZmJmo1vgMugyF3TCnXVg4t1uk89mLNwnLtnY3TpOpCOyp1/xHQ==}
+
resolution: {integrity: sha512-ThVF6DCVhA8kUGy+aazFQ4kXQ7E1Ty7A3ypFOe0IcJV8O/M511G99AW24irKrW56Wt44yG9+ij8FaqoBGkuBXg==}
@@ -452,6 +552,16 @@ packages:
resolution: {integrity: sha512-kja8j7PjmncONqaTsB8fQ+wE2mSU2DJ9D4XKoJ5PFWIdRMa6SLSN1ff4mOr4jCbfRSsxR4keIiySJU0N9T5hIQ==}
engines: {node: '>= 8.0.0'}
+ resolution: {integrity: sha512-94iuXn+/I1X6v8I+9nycuHCv3RjtI9UqALw3UfANwaxOGEPtITfImfQg4DAR+3asnJViJ/IdCpWbTyzVXjHWPQ==}
+ engines: {node: '>=18'}
+ peerDependencies:
+ react: ^18 || ^19 || ^19.0.0-rc
+ zod: ^3.23.8
+ peerDependenciesMeta:
+ react:
+ optional: true
+
resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==}
engines: {node: '>=8'}
@@ -464,6 +574,10 @@ packages:
resolution: {integrity: sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==}
engines: {node: '>=8'}
+ resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==}
+ engines: {node: '>=10'}
+
resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==}
engines: {node: '>=12'}
@@ -477,6 +591,9 @@ packages:
resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==}
+ resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==}
+
resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==}
@@ -497,6 +614,18 @@ packages:
resolution: {integrity: sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==}
engines: {node: '>= 0.4'}
+ resolution: {integrity: sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==}
+ engines: {node: '>=10'}
+
+ resolution: {integrity: sha512-zgVZuo2WcZgfUEmsn6eO3kINexW8RAE4maiQ8QNs8CtpPCSyMiYsULR3HQYkm3w8FIA3SberyMJMSldGsW+U3w==}
+ engines: {node: ^12.17.0 || ^14.13 || >=16.0.0}
+
resolution: {integrity: sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==}
engines: {node: '>= 14.16.0'}
@@ -520,6 +649,9 @@ packages:
resolution: {integrity: sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==}
engines: {node: ^14.18.0 || >=16.10.0}
+ resolution: {integrity: sha512-wKGOQRRvdnd89pCeH96e2Fn4wkbenSP6LMHfjfyNLMbGuHEFbMqQNuxXqd0oXG9caIOQ1FTvc5Uijp9/4jujnQ==}
+
resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==}
engines: {node: '>= 8'}
@@ -533,10 +665,21 @@ packages:
supports-color:
optional: true
+ resolution: {integrity: sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==}
+ engines: {node: '>=0.10.0'}
+
resolution: {integrity: sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==}
engines: {node: '>=0.4.0'}
+ resolution: {integrity: sha512-0je+qPKHEMohvfRTCEo3CrPG6cAzAYgmzKyxRiYSSDkS6eGJdyVJm7WaYA5ECaAD9wLB2T4EEeymA5aFVcYXCA==}
+ engines: {node: '>=6'}
+
+ resolution: {integrity: sha512-IayShXAgj/QMXgB0IWmKx+rOPuGMhqm5w6jvFxmVenXKIzRqTAAsbBPT3kWQeGANj3jGgvcvv4yK6SxqYmikgw==}
+
resolution: {integrity: sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==}
engines: {node: '>= 0.4'}
@@ -575,6 +718,9 @@ packages:
resolution: {integrity: sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==}
engines: {node: '>=6'}
+ resolution: {integrity: sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==}
+
resolution: {integrity: sha512-PMXmW2y1hDDfTSRc9gaXIuCCRpuoz3Kaz8cUelp3smouvfT632ozg2vrT6lJsHKKOF59YLbOGfAWGUcKEfRMQw==}
peerDependencies:
@@ -625,6 +771,10 @@ packages:
resolution: {integrity: sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==}
engines: {node: '>= 0.4'}
+ resolution: {integrity: sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==}
+ engines: {node: '>=8'}
+
resolution: {integrity: sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==}
engines: {node: '>= 0.4'}
@@ -654,6 +804,25 @@ packages:
resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==}
engines: {node: '>=10'}
+ resolution: {integrity: sha512-XC63YQeEcS47Y53gg950xiZ4IWmkfMe4p2V9OSaBt26q+p47WHn18izuXzSclCI73B7yGqtfRsT6jcZQI0y08g==}
+
+ resolution: {integrity: sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==}
+
+ resolution: {integrity: sha512-3QItJOXp2AP1uv7waBkao5nCvhEv+QmJAd38Ybq7wNI74Q+BBmnLn4EDKz6yI9xGAIQoUF87qHt+kc1IVxB4zQ==}
+ engines: {node: ^18.0.0 || >=20.0.0}
+ hasBin: true
+
+ resolution: {integrity: sha512-P3Y0YGHzixgnHuuir2mHZCw6heIeZMFLEmQqVrspy9w57+zwk4PJV6+wP6JrNd/gvt5oKHoN11368GnjO8lE5g==}
+ peerDependencies:
+ openai: '*'
+ peerDependenciesMeta:
+ openai:
+ optional: true
+
resolution: {integrity: sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==}
engines: {node: '>=14'}
@@ -694,9 +863,18 @@ packages:
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
+ resolution: {integrity: sha512-71ippSywq5Yb7/tVYyGbkBggbU8H3u5Rz56fH60jGFgr8uHwxs+aSKeqmluIVzM0m0kB7xQjKS6qPfd0b2ZoqQ==}
+ hasBin: true
+
resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==}
+ resolution: {integrity: sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==}
+ engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1}
+ hasBin: true
+
resolution: {integrity: sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==}
engines: {node: '>=10.5.0'}
@@ -726,6 +904,22 @@ packages:
zod:
optional: true
+ resolution: {integrity: sha512-LICb2p9CB7FS+0eR1oqWnHhp0FljGLZCWBE9aix0Uye9W8LTQPwMTYVGWQWIw9RdQiDg4+epXQODwIYJtSJaow==}
+ engines: {node: '>=4'}
+
+ resolution: {integrity: sha512-RwFpb72c/BhQLEXIZ5K2e+AhgNVmIejGlTgiB9MzZ0e93GRvqZ7uSi0dvRF7/XIXDeNkra2fNHBxTyPDGySpjQ==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-312Id396EbJdvRONlngUx0NydfrIQ5lsYu0znKVUzVvArzEIt08V1qhtyESbGVd1FGX7UKtiFp5uwKZdM8wIuQ==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-rhIwUycgwwKcP9yTOOFK/AKsAopjjCakVqLHePO3CC6Mir1Z99xT+R63jZxAT5lFZLa2inS5h+ZS2GvR99/FBg==}
+ engines: {node: '>=8'}
+
resolution: {integrity: sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==}
@@ -770,6 +964,10 @@ packages:
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
engines: {node: '>=6'}
+ resolution: {integrity: sha512-FS+XFBNvn3GTAWq26joslQgWNoFu08F4kl0J4CgdNKADkdSGXQyTCnKteIAJy96Br6YbpEU1LSzV5dYtjMkMDg==}
+ engines: {node: '>=0.10.0'}
+
resolution: {integrity: sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==}
engines: {node: '>= 14.18.0'}
@@ -781,6 +979,10 @@ packages:
resolution: {integrity: sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==}
+ resolution: {integrity: sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==}
+ engines: {node: '>= 4'}
+
resolution: {integrity: sha512-IUa/9lZVqgFilYggiY7jxUbmvU4Q8wVvVqsru+AeMldBccBEhTYZ6/XP6cWsznb8Fv49zfYGaeEpJ5WeVdo6Mg==}
hasBin: true
@@ -795,6 +997,14 @@ packages:
engines: {node: '>=18.0.0', npm: '>=8.0.0'}
hasBin: true
+ resolution: {integrity: sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw==}
+
+ resolution: {integrity: sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==}
+ engines: {node: '>=10'}
+ hasBin: true
+
resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==}
engines: {node: '>=8'}
@@ -807,6 +1017,9 @@ packages:
resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==}
engines: {node: '>=14'}
+ resolution: {integrity: sha512-xMO/8eNREtaROt7tJvWJqHBDTMFN4eiQ5I4JRMuilwfnFcV5W9u7RUkueNkdw0jPqGMX36iCywelS5yilTuOxg==}
+
resolution: {integrity: sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==}
engines: {node: '>= 8'}
@@ -832,6 +1045,15 @@ packages:
engines: {node: '>=16 || 14 >=14.17'}
hasBin: true
+ resolution: {integrity: sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==}
+ engines: {node: '>=8'}
+
+ resolution: {integrity: sha512-dshNvs3ExOqtZ6kJBaAsabhPdHyeY4P2cKwRCniDVifBMoG/SVI7tfLWqPXriVspf2Rg4tPzXJTnwaihIeFw2A==}
+ peerDependencies:
+ react: ^16.11.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
+
resolution: {integrity: sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==}
engines: {node: '>=0.8'}
@@ -839,6 +1061,10 @@ packages:
resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==}
+ resolution: {integrity: sha512-nt6AMGKW1p/70DF/hGBdJB57B8Tspmbp5gfJ8ilhLnt7kkr2ye7hzD6NVG8GGErk2HWF34igrL2CXmNIkzKqKw==}
+ engines: {node: '>=18'}
+
resolution: {integrity: sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==}
@@ -897,6 +1123,15 @@ packages:
resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==}
+ resolution: {integrity: sha512-Rb46I4cGGVBmjamjphe8L/UnvJD+uPPtTkNvX5mZgqdbavhI4EbgIWJiIHXJ8bc/i9EQGPRh4DwEURJ552Do0A==}
+ peerDependencies:
+ react: ^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0
+
+ resolution: {integrity: sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ==}
+ hasBin: true
+
resolution: {integrity: sha512-1Hc0ihzWxBar6NGeZv7fPLY0QuxFMyxwYR2sF1Blu7Wq7EnremwY2W02tit2ij2VJT8HcSkHAQqmFfl77f73Yw==}
peerDependencies:
@@ -934,8 +1169,48 @@ packages:
resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==}
engines: {node: '>=12'}
+ resolution: {integrity: sha512-/AuWwMP+YqiPbsJx5D6TfgRTc4kTLjsh5SOcd4bLsfUg2RcEXrFMJl1DGgdHy2aCfsIA/cr/1JM0xcB2GZji8g==}
+ peerDependencies:
+ zod: ^3.24.1
+
+ resolution: {integrity: sha512-lY7CDW43ECgW9u1TcT3IoXHflywfVqDYze4waEz812jR/bZ8FHDsl7pFQoSZTz5N+2NqRXs8GBwnAwo3ZNxqhQ==}
+
snapshots:
+ dependencies:
+ '@ai-sdk/provider': 1.1.3
+ nanoid: 3.3.11
+ secure-json-parse: 2.7.0
+ zod: 3.24.2
+
+ '@ai-sdk/[email protected]':
+ dependencies:
+ json-schema: 0.4.0
+
+ dependencies:
+ '@ai-sdk/provider-utils': 2.2.7([email protected])
+ '@ai-sdk/ui-utils': 1.2.8([email protected])
+ react: 19.1.0
+ swr: 2.3.3([email protected])
+ throttleit: 2.1.0
+ optionalDependencies:
+ zod: 3.24.2
+
+ dependencies:
+ '@ai-sdk/provider': 1.1.3
+ '@ai-sdk/provider-utils': 2.2.7([email protected])
+ zod: 3.24.2
+ zod-to-json-schema: 3.24.5([email protected])
+
+ '@cfworker/[email protected]': {}
+
+ '@cloudflare/[email protected]': {}
+
'@composio/[email protected]': {}
'@emnapi/[email protected]':
@@ -1055,6 +1330,23 @@ snapshots:
'@jridgewell/resolve-uri': 3.1.2
'@jridgewell/sourcemap-codec': 1.5.0
+ dependencies:
+ '@cfworker/json-schema': 4.1.1
+ ansi-styles: 5.2.0
+ camelcase: 6.3.0
+ decamelize: 1.2.0
+ js-tiktoken: 1.0.19
+ mustache: 4.2.0
+ p-queue: 6.6.2
+ p-retry: 4.6.2
+ uuid: 10.0.0
+ zod: 3.24.2
+ zod-to-json-schema: 3.24.5([email protected])
+ transitivePeerDependencies:
+ - openai
+
'@napi-rs/[email protected]':
dependencies:
'@emnapi/core': 1.4.0
@@ -1062,6 +1354,8 @@ snapshots:
'@tybys/wasm-util': 0.9.0
optional: true
+ '@opentelemetry/[email protected]': {}
+
'@oxc-project/[email protected]': {}
@@ -1174,6 +1468,8 @@ snapshots:
dependencies:
bun-types: 1.2.9
+ '@types/[email protected]': {}
+
'@types/[email protected]': {}
@@ -1189,6 +1485,10 @@ snapshots:
dependencies:
undici-types: 6.21.0
+ '@types/[email protected]': {}
+
+ '@types/[email protected]': {}
+
dependencies:
'@types/node': 22.14.0
@@ -1205,6 +1505,18 @@ snapshots:
dependencies:
humanize-ms: 1.2.1
+ dependencies:
+ '@ai-sdk/provider': 1.1.3
+ '@ai-sdk/provider-utils': 2.2.7([email protected])
+ '@ai-sdk/react': 1.2.9([email protected])([email protected])
+ '@ai-sdk/ui-utils': 1.2.8([email protected])
+ '@opentelemetry/api': 1.9.0
+ jsondiffpatch: 0.6.0
+ zod: 3.24.2
+ optionalDependencies:
+ react: 19.1.0
+
@@ -1213,6 +1525,8 @@ snapshots:
dependencies:
color-convert: 2.0.1
+
@@ -1221,6 +1535,8 @@ snapshots:
+
dependencies:
balanced-match: 1.0.2
@@ -1242,6 +1558,15 @@ snapshots:
es-errors: 1.3.0
function-bind: 1.1.2
+
+ dependencies:
+ ansi-styles: 4.3.0
+ supports-color: 7.2.0
+
+
dependencies:
readdirp: 4.1.2
@@ -1260,6 +1585,10 @@ snapshots:
+ dependencies:
+ simple-wcswidth: 1.0.1
+
dependencies:
path-key: 3.1.1
@@ -1270,8 +1599,14 @@ snapshots:
dependencies:
ms: 2.1.3
+
+
+
dependencies:
call-bind-apply-helpers: 1.0.2
@@ -1329,6 +1664,8 @@ snapshots:
+
optionalDependencies:
picomatch: 4.0.2
@@ -1390,6 +1727,8 @@ snapshots:
+
@@ -1416,6 +1755,30 @@ snapshots:
+ dependencies:
+ base64-js: 1.5.1
+
+
+ dependencies:
+ '@types/diff-match-patch': 1.0.36
+ chalk: 5.4.1
+ diff-match-patch: 1.0.5
+
+ dependencies:
+ '@types/uuid': 10.0.0
+ chalk: 4.1.2
+ console-table-printer: 2.12.1
+ p-queue: 6.6.2
+ p-retry: 4.6.2
+ semver: 7.7.1
+ uuid: 10.0.0
+ optionalDependencies:
+ openai: 4.94.0([email protected])
+
@@ -1442,12 +1805,16 @@ snapshots:
+
dependencies:
any-promise: 1.3.0
object-assign: 4.1.1
thenify-all: 1.6.0
+
@@ -1456,7 +1823,7 @@ snapshots:
dependencies:
'@types/node': 18.19.86
'@types/node-fetch': 2.6.12
@@ -1465,9 +1832,27 @@ snapshots:
form-data-encoder: 1.7.2
formdata-node: 4.4.1
node-fetch: 2.7.0
+ optionalDependencies:
+ zod: 3.24.2
transitivePeerDependencies:
- encoding
+
+ dependencies:
+ eventemitter3: 4.0.7
+ p-timeout: 3.2.0
+
+ dependencies:
+ '@types/retry': 0.12.0
+ retry: 0.13.1
+
+ dependencies:
+ p-finally: 1.0.0
+
@@ -1491,12 +1876,16 @@ snapshots:
+
+
dependencies:
'@oxc-project/types': 0.61.2
@@ -1544,6 +1933,10 @@ snapshots:
'@rollup/rollup-win32-x64-msvc': 4.39.0
fsevents: 2.3.3
+
+
dependencies:
shebang-regex: 3.0.0
@@ -1552,6 +1945,8 @@ snapshots:
+
dependencies:
whatwg-url: 7.1.0
@@ -1586,6 +1981,16 @@ snapshots:
pirates: 4.0.7
ts-interface-checker: 0.1.13
+ dependencies:
+ has-flag: 4.0.0
+
+ dependencies:
+ dequal: 2.0.3
+ react: 19.1.0
+ use-sync-external-store: 1.5.0([email protected])
+
dependencies:
thenify: 3.3.1
@@ -1594,6 +1999,8 @@ snapshots:
dependencies:
any-promise: 1.3.0
+
@@ -1653,6 +2060,12 @@ snapshots:
+ dependencies:
+ react: 19.1.0
+
+
optionalDependencies:
typescript: 5.8.3
@@ -1689,3 +2102,9 @@ snapshots:
ansi-styles: 6.2.1
string-width: 5.1.2
strip-ansi: 7.1.0
+
+ dependencies:
+ zod: 3.24.2
+
diff --git a/scripts/create-toolset.sh b/scripts/create-toolset.sh
new file mode 100644
index 000000000..6dcb1f1ea
--- /dev/null
+++ b/scripts/create-toolset.sh
@@ -0,0 +1,107 @@
+#!/bin/bash
+
+# Check if toolset name is provided
+if [ -z "$1" ]; then
+ echo "Please provide a toolset name"
+ echo "Usage: npm run create-toolset <toolset-name>"
+ exit 1
+fi
+
+TOOLSET_NAME=$1
+TOOLSET_PATH="packages/toolsets/$TOOLSET_NAME"
+CAPITAL_TOOLSET_NAME="$(tr '[:lower:]' '[:upper:]' <<< ${TOOLSET_NAME:0:1})${TOOLSET_NAME:1}"
+
+# Create directory structure
+mkdir -p "$TOOLSET_PATH/src"
+
+# Create package.json
+cat > "$TOOLSET_PATH/package.json" << EOL
+{
+ "name": "@composio/${TOOLSET_NAME}-toolset",
+ "version": "1.0.0",
+ "description": "",
+ "main": "index.js",
+ "scripts": {
+ "build": "tsup",
+ "test": "echo \\"Error: no test specified\\" && exit 1"
+ },
+ "keywords": [],
+ "author": "",
+ "license": "ISC",
+ "packageManager": "[email protected]",
+ "devDependencies": {
+ "tsup": "^8.4.0",
+ "typescript": "^5.8.3"
+ },
+ "dependencies": {
+ "@composio/core": "workspace:^"
+ }
+}
+EOL
+
+# Create tsconfig.json
+cat > "$TOOLSET_PATH/tsconfig.json" << EOL
+{
+ "compilerOptions": {
+ "target": "ESNext",
+ "module": "ESNext",
+ "declaration": true,
+ "declarationDir": "./dist",
+ "outDir": "./dist",
+ "rootDir": "./src",
+ "strict": true,
+ "esModuleInterop": true,
+ "moduleResolution": "node",
+ "skipLibCheck": true
+ },
+ "include": ["src"]
+}
+EOL
+
+# Create tsup.config.ts
+cat > "$TOOLSET_PATH/tsup.config.ts" << EOL
+import { defineConfig } from 'tsup';
+
+export default defineConfig({
+ entry: ['src/index.ts'],
+ format: ['esm', 'cjs'],
+ dts: true,
+ clean: true,
+ minify: false,
+ outDir: 'dist',
+});
+EOL
+
+# Create src/index.ts
+cat > "$TOOLSET_PATH/src/index.ts" << EOL
+import { BaseComposioToolset, Tool } from "@composio/core";
+
+interface ToolType {
+ // Add your tool type here
+}
+
+export class ${CAPITAL_TOOLSET_NAME}Toolset extends BaseComposioToolset<ToolType> {
+ static FRAMEWORK_NAME = "${TOOLSET_NAME}";
+ private DEFAULT_ENTITY_ID = "default";
+ static fileName: string = "toolsets/${TOOLSET_NAME}/src/index.ts";
+
+ /**
+ * Abstract method to wrap a tool in the toolset.
+ * This method is implemented by the toolset.
+ * @param tool - The tool to wrap.
+ * @returns The wrapped tool.
+ */
+ _wrapTool = (tool: Tool): ToolType => {
+ return tool as ToolType;
+ }
+}
+EOL
+
+# Make the script executable
+chmod +x "$TOOLSET_PATH"
+
+# Install dependencies using pnpm
+cd "$TOOLSET_PATH" && pnpm install
+
+echo "✨ Created new toolset at $TOOLSET_PATH"
+echo "✨ Dependencies installed successfully"
\ No newline at end of file