Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
Update readme.md
haxzie83ed783a1c16
diff --git a/README.md b/README.mdindex 9158648b5..70a5e7bf1 100644--- a/README.md+++ b/README.md@@ -1,7 +1,133 @@-# @composio/core+# Composio SDKThe core Composio SDK which allows users to interact with the Composio Platform. It provides a powerful and flexible way to manage and execute tools, handle authentication, and integrate with various platforms and frameworks.+## Project Structure++```+composio/+├── packages/ # Main packages directory+│ ├── core/ # Core SDK package+│ │ └── core/ # Core SDK package+│ ├── toolsets/ # Toolset implementations+│ │ ├── openai/ # OpenAI toolset+│ │ ├── vercel/ # Vercel AI toolset+│ │ ├── langchain/ # LangChain toolset+│ │ └── cloudflare/ # Cloudflare toolset+│ └── wrappers/ # Runtime-specific wrappers+├── examples/ # Example implementations+│ ├── langchain/ # LangChain example+│ ├── openai/ # OpenAI example+│ ├── pre-processors/ # Pre-processors example+│ └── vercel/ # Vercel AI example+├── scripts/ # Development and build scripts+└── .github/ # GitHub configuration+```++## Development Setup++1. **Prerequisites**++ - Node.js (Latest LTS version recommended)+ - [pnpm](https://pnpm.io/) (v10.8.0 or later)+ - [bun](https://bun.sh) for productivity (optional)++2. **Clone and Install**++ ```bash+ git clone https://github.com/ComposioHQ/sdk-v3-ts.git+ cd composio+ pnpm install+ ```++3. **Build**++ ```bash+ pnpm build+ ```++4. **Development Commands**++ ```bash+ # Lint code+ pnpm lint++ # Fix linting issues+ pnpm lint:fix++ # Format code+ pnpm format++ # Create a new toolset+ pnpm create-toolset <toolset-name> [--agentic]++ # Check peer dependencies+ pnpm check:peer-deps++ # Update peer dependencies+ pnpm update:peer-deps+ ```++## Creating a New Toolset++1. Use the create-toolset script:++ ```bash+ pnpm create-toolset my-toolset [--agentic]+ ```++2. The script will create a new toolset in `packages/toolsets/my-toolset` with:++ - Basic toolset implementation+ - TypeScript configuration+ - Package configuration+ - README template++3. Implement the required methods in `src/index.ts`:+ - For non-agentic toolsets: `wrapTool` and `wrapTools`+ - For agentic toolsets: `wrapTool`, `wrapTools`, and execution handlers++## Release Process++1. **Prepare for Release**++ - Ensure all changes are committed+ - Run tests and checks:+ ```bash+ pnpm build+ pnpm check:peer-deps+ ```++2. **Create Changeset**++ ```bash+ pnpm changeset+ ```++ - Follow the prompts to describe your changes+ - Commit the generated changeset file++3. **Publish**+ ```bash+ # This will:+ # 1. Build all packages+ # 2. Check peer dependencies+ # 3. Publish packages to npm+ pnpm run publish+ ```++## Contributing++We welcome contributions! Please see our [Contributing Guide](CONTRIBUTING.md) for more details.++## License++ISC License++## Support++For support, please visit our [Documentation](https://docs.composio.dev) or join our [Discord Community](https://discord.gg/composio).+## Core Features- **Tools**: Manage and execute tools within the Composio ecosystem. Includes functionality to list, retrieve, and execute tools.@@ -298,11 +424,3 @@ pnpm create-toolset my-toolset --agentic- `COMPOSIO_LOGGING_LEVEL`: Logging level (silent, error, warn, info, debug)- `DEVELOPMENT`: Development mode flag- `CI`: CI environment flag--## License--ISC License--## Support--For support, please visit our [Documentation](https://docs.composio.dev) or join our [Discord Community](https://discord.gg/composio).diff --git a/scripts/create-toolset.sh b/scripts/create-toolset.shindex 6ad85b2d0..f4b1ee408 100644--- a/scripts/create-toolset.sh+++ b/scripts/create-toolset.sh@@ -23,9 +23,9 @@ mkdir -p "$TOOLSET_PATH/src"# Create package.jsoncat > "$TOOLSET_PATH/package.json" << EOL{- "name": "@composio/${TOOLSET_NAME}-toolset",- "version": "1.0.0",- "description": "${IS_AGENTIC:+Agentic }Toolset for ${TOOLSET_NAME}",+ "name": "@composio/${TOOLSET_NAME}",+ "version": "0.1.0",+ "description": "${IS_AGENTIC:+Agentic }Toolset for ${TOOLSET_NAME} in Composio SDK","main": "src/index.ts","type": "module","publishConfig": {@@ -40,6 +40,10 @@ cat > "$TOOLSET_PATH/package.json" << EOL"require": "./dist/index.cjs"}},+ "files": [+ "README.md",+ "dist"+ ],"scripts": {"build": "tsup","test": "echo \\"Error: no test specified\\" && exit 1"@@ -48,12 +52,13 @@ cat > "$TOOLSET_PATH/package.json" << EOL"author": "","license": "ISC","packageManager": "[email protected]",+ "peerDependencies": {+ "@composio/core": "^0.1.0"+ },"devDependencies": {+ "@composio/core": "workspace:*","tsup": "^8.4.0","typescript": "^5.8.3"- },- "dependencies": {- "@composio/core": "workspace:^"}}EOL@@ -61,17 +66,18 @@ EOL# Create tsconfig.jsoncat > "$TOOLSET_PATH/tsconfig.json" << EOL{+ "extends": "../../../tsconfig.base.json","compilerOptions": {"target": "ESNext","module": "ESNext","declaration": true,"declarationDir": "./dist","outDir": "./dist",- "rootDir": "./src","strict": true,"esModuleInterop": true,"moduleResolution": "node",- "skipLibCheck": true+ "skipLibCheck": true,+ "resolveJsonModule": true},"include": ["src"]}@@ -93,119 +99,152 @@ EOL# Create src/index.tscat > "$TOOLSET_PATH/src/index.ts" << EOL-import { ${IS_AGENTIC:+BaseAgenticToolset}${!IS_AGENTIC:+BaseNonAgenticToolset} } from "@composio/core";-import type { Tool, ToolListParams } from "@composio/core";-import type { ${IS_AGENTIC:+ModifiersParams}${!IS_AGENTIC:+SchemaModifiersParams} } from "@composio/core";--interface ToolType {- // Add your tool type here-}--interface ToolCollection {- // Add your tool collection here-}-/*** ${CAPITAL_TOOLSET_NAME} Toolset- * ${IS_AGENTIC:+This is an agentic toolset that supports full modifier capabilities.}-${!IS_AGENTIC:+This is a non-agentic toolset that only supports schema modifiers.}- *- * @example- * \`\`\`typescript- * import { Composio } from "@composio/core";- * import { ${CAPITAL_TOOLSET_NAME}Toolset } from "@composio/${TOOLSET_NAME}-toolset";- *- * const composio = new Composio({- * apiKey: "your-api-key",- * toolset: new ${CAPITAL_TOOLSET_NAME}Toolset()- * });- * \`\`\`+ *+ * This toolset provides a set of tools for interacting with ${CAPITAL_TOOLSET_NAME}.+ *+ * @packageDocumentation+ * @module toolsets/${TOOLSET_NAME}*/-export class ${CAPITAL_TOOLSET_NAME}Toolset extends ${IS_AGENTIC:+BaseAgenticToolset}${!IS_AGENTIC:+BaseNonAgenticToolset}<ToolCollection, ToolType> {- static FRAMEWORK_NAME = "${TOOLSET_NAME}";- readonly FILE_NAME: string = "toolsets/${TOOLSET_NAME}/src/index.ts";+import { ${IS_AGENTIC:+BaseAgenticToolset}${!IS_AGENTIC:+BaseNonAgenticToolset}, Tool${IS_AGENTIC:+, ExecuteToolFn} } from '@composio/core';++${IS_AGENTIC:+interface ${CAPITAL_TOOLSET_NAME}Tool {+ // Add your tool type here+}}${!IS_AGENTIC:+interface ${CAPITAL_TOOLSET_NAME}Tool {+ // Add your tool type here+}}++${IS_AGENTIC:+interface ${CAPITAL_TOOLSET_NAME}ToolCollection {+ // Add your tool collection type here+}}${!IS_AGENTIC:+type ${CAPITAL_TOOLSET_NAME}ToolCollection = Array<${CAPITAL_TOOLSET_NAME}Tool>}++export class ${CAPITAL_TOOLSET_NAME}Toolset extends ${IS_AGENTIC:+BaseAgenticToolset}${!IS_AGENTIC:+BaseNonAgenticToolset}<${CAPITAL_TOOLSET_NAME}ToolCollection, ${CAPITAL_TOOLSET_NAME}Tool> {+ readonly name = '${TOOLSET_NAME}';/**- * Wraps a tool in the toolset format.- * This method is implemented by the toolset.+ * Wrap a tool in the ${TOOLSET_NAME} format.* @param tool - The tool to wrap.* @returns The wrapped tool.*/- wrapTool = (tool: Tool): ToolType => {- return tool as ToolType;- }+ ${IS_AGENTIC:+wrapTool(tool: Tool, executeTool: ExecuteToolFn): ${CAPITAL_TOOLSET_NAME}Tool {+ return {+ // Implement your tool wrapping logic here+ } as ${CAPITAL_TOOLSET_NAME}Tool;+ }}${!IS_AGENTIC:+wrapTool(tool: Tool): ${CAPITAL_TOOLSET_NAME}Tool {+ return {+ // Implement your tool wrapping logic here+ } as ${CAPITAL_TOOLSET_NAME}Tool;+ }}/**- * Get all the tools from the Composio API- * @param params - The query parameters to get the tools- * @param modifiers - ${IS_AGENTIC:+Full modifiers to apply to the tools}${!IS_AGENTIC:+Schema modifiers to apply to the tools}- * @returns The tools+ * Wrap a list of tools in the ${TOOLSET_NAME} format.+ * @param tools - The tools to wrap.+ * @returns The wrapped tools.*/- getTools = async (- params?: ToolListParams,- modifiers?: ${IS_AGENTIC:+ModifiersParams}${!IS_AGENTIC:+SchemaModifiersParams}- ): Promise<ToolCollection> => {- return [];- }-- /**- * Get a tool from the Composio API by its slug- * @param slug - The slug of the tool to get- * @param modifiers - ${IS_AGENTIC:+Full modifiers to apply to the tool}${!IS_AGENTIC:+Schema modifiers to apply to the tool}- * @returns The tool- */- getToolBySlug = async (- slug: string,- modifiers?: ${IS_AGENTIC:+ModifiersParams}${!IS_AGENTIC:+SchemaModifiersParams}- ): Promise<ToolType> => {- const tool = await this.getComposio().tools.getToolBySlug(slug, modifiers?.schema);- return this.wrapTool(tool);- }+ ${IS_AGENTIC:+wrapTools(tools: Tool[], executeTool: ExecuteToolFn): ${CAPITAL_TOOLSET_NAME}ToolCollection {+ return tools.reduce((acc, tool) => {+ // Implement your tool collection wrapping logic here+ return acc;+ }, {} as ${CAPITAL_TOOLSET_NAME}ToolCollection);+ }}${!IS_AGENTIC:+wrapTools(tools: Tool[]): ${CAPITAL_TOOLSET_NAME}ToolCollection {+ return tools.map(tool => this.wrapTool(tool));+ }}}EOL# Create README.mdcat > "$TOOLSET_PATH/README.md" << EOL-# @composio/${TOOLSET_NAME}-toolset+# @composio/${TOOLSET_NAME}-${IS_AGENTIC:+Agentic }Toolset for ${TOOLSET_NAME} in Composio SDK.+${IS_AGENTIC:+Agentic }Toolset for ${CAPITAL_TOOLSET_NAME} in Composio SDK.++## Features++${IS_AGENTIC:+- **Full Modifier Support**: Support for both schema and execution modifiers+- **Tool Execution**: Execute tools with proper parameter handling+- **Type Safety**: Full TypeScript support with proper type definitions}${!IS_AGENTIC:+- **Schema Modifiers**: Support for transforming tool schemas+- **Type Safety**: Full TypeScript support with proper type definitions}## Installation\`\`\`bash-pnpm add @composio/${TOOLSET_NAME}-toolset+npm install @composio/${TOOLSET_NAME}+# or+yarn add @composio/${TOOLSET_NAME}+# or+pnpm add @composio/${TOOLSET_NAME}\`\`\`-## Usage+## Quick Start\`\`\`typescript-import { Composio } from "@composio/core";-import { ${CAPITAL_TOOLSET_NAME}Toolset } from "@composio/${TOOLSET_NAME}-toolset";+import { Composio } from '@composio/core';+import { ${CAPITAL_TOOLSET_NAME}Toolset } from '@composio/${TOOLSET_NAME}';+// Initialize Composio with ${CAPITAL_TOOLSET_NAME} toolsetconst composio = new Composio({- apiKey: "your-api-key",- toolset: new ${CAPITAL_TOOLSET_NAME}Toolset()+ apiKey: 'your-composio-api-key',+ toolset: new ${CAPITAL_TOOLSET_NAME}Toolset(),});-// Get all tools-const tools = await composio.getTools();+// Get available tools+const tools = await composio.tools.get('user123', {+ apps: ['gmail', 'googlecalendar'],+ limit: 10,+});+\`\`\`-// Get a specific tool by slug-const tool = await composio.getToolBySlug("tool-slug");+## Usage Examples++### Basic Example++\`\`\`typescript+import { Composio } from '@composio/core';+import { ${CAPITAL_TOOLSET_NAME}Toolset } from '@composio/${TOOLSET_NAME}';++// Initialize Composio+const composio = new Composio({+ apiKey: process.env.COMPOSIO_API_KEY,+ toolset: new ${CAPITAL_TOOLSET_NAME}Toolset(),+});++// Get tools+const tools = await composio.tools.get('user123', {+ apps: ['gmail'],+});++// Use tools with ${CAPITAL_TOOLSET_NAME}+// Add your usage example here\`\`\`-## Features+## API Reference-${IS_AGENTIC:+This is an agentic toolset that supports full modifier capabilities, including:-- Tool execution modifiers-- Schema modifiers-- Custom modifiers+### ${CAPITAL_TOOLSET_NAME}Toolset Class-}${!IS_AGENTIC:+This is a non-agentic toolset that supports schema modifiers for transforming tool schemas.}+The \`${CAPITAL_TOOLSET_NAME}Toolset\` class extends \`${IS_AGENTIC:+BaseAgenticToolset}${!IS_AGENTIC:+BaseNonAgenticToolset}\` and provides ${TOOLSET_NAME}-specific functionality.++#### Methods++##### \`wrapTool(tool: Tool${IS_AGENTIC:+, executeTool: ExecuteToolFn}): ${CAPITAL_TOOLSET_NAME}Tool\`++Wraps a tool in the ${TOOLSET_NAME} format.++\`\`\`typescript+const tool = toolset.wrapTool(composioTool${IS_AGENTIC:+, executeTool});+\`\`\`++## Contributing++We welcome contributions! Please see our [Contributing Guide](../../CONTRIBUTING.md) for more details.## License-ISC+ISC License++## Support++For support, please visit our [Documentation](https://docs.composio.dev) or join our [Discord Community](https://discord.gg/composio).EOL# Make the script executable