@devries-cameron20 / composio-1 / commits / 17ab595bd
Fork 0

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

docs: remove deprecated fern documentation system

Migration to Fumadocs is complete. Remove the fern/ directory and all related configuration: deprecated CI workflows, gitignore rules, CODEOWNERS entry, and references in CLAUDE.md, README.md, context7.json, and pyproject.toml. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Sushmithamallesh committed Feb 19, 2026 at 14:02 UTC 17ab595bd00c40f6f1229ac3794dddc826541938
350 files changed +5 -32831
.github/CODEOWNERS
-1
@@ -1,4 +1,3 @@
1 -fern/ @haxzie @sushmithamallesh
1 docs/ @sushmithamallesh
2 ts/ @haxzie
3 python/ @haxzie
.github/workflows/check_broken_links.yml deleted
-82
@@ -1,82 +0,0 @@
1 -name: Check Broken Links (DEPRECATED - Fern)
2 -
3 -# DEPRECATED: This workflow checks broken links in the old Fern-based docs.
4 -# The new docs in /docs use docs-check-links.yml instead.
5 -# This workflow is disabled.
6 -
7 -on:
8 - pull_request:
9 - paths:
10 - - 'fern/**'
11 - push:
12 - branches:
13 - - master
14 - - next
15 -
16 -jobs:
17 - check-broken-links:
18 - # DEPRECATED: Disabled - using new docs system in /docs
19 - if: false
20 - runs-on: ubuntu-latest
21 - container:
22 - image: ghcr.io/composiohq/dev-base:latest
23 - permissions: read-all
24 - env:
25 - COMPOSIO_API_KEY: ${{ secrets.COMPOSIO_API_KEY }}
26 -
27 - steps:
28 - - name: Checkout repository
29 - uses: actions/checkout@v6
30 -
31 - - name: Setup Bun
32 - uses: oven-sh/setup-bun@v2
33 - with:
34 - bun-version-file: '.bun-version'
35 -
36 - - name: Install dependencies
37 - run: pnpm install
38 - env:
39 - BYPASS_BUN_VERSION_CHECK: '1'
40 -
41 - - name: Install git
42 - run: |
43 - apt-get update && apt-get install -y git
44 -
45 - - name: Install Python Dependencies
46 - working-directory: ./fern
47 - run: |
48 - uv sync
49 - uv pip install ../python
50 -
51 - - name: Install Fern
52 - run: npm install -g fern-api
53 -
54 - - name: Build documentation with Turbo
55 - working-directory: ./fern
56 - run: pnpm turbo run build --filter=composio-docs
57 -
58 - - name: Check for broken links
59 - working-directory: ./fern
60 - run: |
61 - set +e
62 - OUTPUT=$(fern docs broken-links 2>&1)
63 - EXIT_CODE=$?
64 - set -e
65 -
66 - echo "$OUTPUT"
67 -
68 - if [ $EXIT_CODE -ne 0 ]; then
69 - echo "::error::Found broken links in documentation"
70 -
71 - # Extract and format broken links for better visibility
72 - echo ""
73 - echo "## ❌ Broken Links Found"
74 - echo ""
75 - echo "$OUTPUT" | grep -E "(broken link to|fix here:)" | while read -r line; do
76 - echo "- $line"
77 - done
78 -
79 - exit 1
80 - else
81 - echo "✅ No broken links found"
82 - fi
.github/workflows/preview_docs.yml deleted
-72
@@ -1,72 +0,0 @@
1 -name: Preview Docs (DEPRECATED - Fern)
2 -
3 -# DEPRECATED: This workflow previews the old Fern-based docs.
4 -# The new docs are in /docs and previewed via Vercel.
5 -# This workflow is disabled.
6 -
7 -on:
8 - pull_request:
9 - paths:
10 - - 'fern/**'
11 -
12 -jobs:
13 - run:
14 - # DEPRECATED: Disabled - using new docs system in /docs
15 - if: false
16 - runs-on: ubuntu-latest
17 - container:
18 - image: ghcr.io/composiohq/dev-base:latest
19 - permissions: write-all
20 - env:
21 - COMPOSIO_API_KEY: ${{ inputs.api_key || secrets.COMPOSIO_API_KEY }}
22 -
23 - steps:
24 - - name: Checkout repository
25 - uses: actions/checkout@v6
26 -
27 - - name: Setup Bun
28 - uses: oven-sh/setup-bun@v2
29 - with:
30 - bun-version-file: '.bun-version'
31 -
32 - - name: Install dependencies
33 - run: pnpm install
34 -
35 - - name: Install git
36 - run: |
37 - apt-get update && apt-get install -y git
38 -
39 - - name: Install Python Dependencies
40 - working-directory: ./fern
41 - run: |
42 - uv sync
43 - uv pip install ../python
44 -
45 - - name: Install Fern
46 - run: npm install -g fern-api
47 -
48 - - name: Generate preview URL
49 - id: generate-docs
50 - working-directory: ./fern
51 - env:
52 - FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
53 - POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
54 - shell: bash
55 - run: |
56 - set -o pipefail
57 - pnpm turbo run preview | tee preview.log
58 -
59 - URL=$(grep -oP 'Published docs to \K.*(?= \()' preview.log | tail -n 1 || true)
60 -
61 - if [ -z "$URL" ]; then
62 - echo "::error::Failed to extract preview URL from preview.log"
63 - exit 1
64 - fi
65 -
66 - echo "Preview URL: $URL"
67 - echo "Preview your docs: $URL" > preview_url.txt
68 -
69 - - name: Comment URL in PR
70 - uses: thollander/actions-comment-pull-request@v3
71 - with:
72 - file-path: fern/preview_url.txt
.github/workflows/publish_docs.yml deleted
-71
@@ -1,71 +0,0 @@
1 -name: Publish Docs (DEPRECATED - Fern)
2 -
3 -# DEPRECATED: This workflow publishes the old Fern-based docs.
4 -# The new docs are in /docs and deployed via Vercel.
5 -# This workflow is disabled - remove 'if: false' to re-enable if needed.
6 -
7 -on:
8 - push:
9 - branches:
10 - - next
11 - workflow_dispatch:
12 - inputs:
13 - branch:
14 - description: 'Branch to publish docs from'
15 - required: false
16 - default: 'next'
17 - type: string
18 - repository_dispatch:
19 - types: [apollo-production-deploy]
20 -
21 -jobs:
22 - run:
23 - runs-on: ubuntu-latest
24 - container:
25 - image: ghcr.io/composiohq/dev-base:latest
26 - # DEPRECATED: Disabled - using new docs system in /docs
27 - if: false
28 - permissions: write-all
29 - env:
30 - COMPOSIO_API_KEY: ${{ inputs.api_key || secrets.COMPOSIO_API_KEY }}
31 - steps:
32 - - name: Checkout repository
33 - uses: actions/checkout@v6
34 -
35 - - name: Setup Bun
36 - uses: oven-sh/setup-bun@v2
37 - with:
38 - bun-version-file: '.bun-version'
39 -
40 - - name: Log trigger source
41 - run: |
42 - echo "Workflow triggered by: ${{ github.event_name }}"
43 - if [ "${{ github.event_name }}" = "repository_dispatch" ]; then
44 - echo "Triggered by Apollo production deployment"
45 - echo "Hermes commit: ${{ github.event.client_payload.hermes_commit }}"
46 - echo "Timestamp: ${{ github.event.client_payload.timestamp }}"
47 - fi
48 -
49 - - name: Install git
50 - run: apt-get update && apt-get install -y git
51 -
52 - - name: Install dependencies
53 - run: pnpm install
54 - env:
55 - BYPASS_BUN_VERSION_CHECK: '1'
56 -
57 - - name: Install Python Dependencies
58 - working-directory: ./fern
59 - run: |
60 - uv sync
61 - uv pip install ../python
62 -
63 - - name: Publish Docs
64 - working-directory: ./fern
65 - env:
66 - POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
67 - FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
68 - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69 - CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
70 - CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
71 - run: pnpm turbo run publish
.gitignore
-14
@@ -39,18 +39,6 @@ report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
39 # lerna
40 lerna-debug.log*
41
42 -# fern
43 -fern/tools/*
44 -fern/toolkits/*
45 -!fern/toolkits/src/
46 -!fern/toolkits/src/**
47 -!fern/tools/src/
48 -!fern/tools/src/**
49 -fern/apis/openapi.yml
50 -fern/apis/openapi.json
51 -fern/apis/openapi-mcp.json
52 -fern/pages/dist/
53 -fern/pages/sdk/
42
43 # Python cache files
44 __pycache__/
@@ -65,8 +53,6 @@ __pycache__/
53 # VS Code
54 .vscode
55 temp/
68 -fern/llms-txt-worker/public/*
69 -!fern/llms-txt-worker/public/.keepFolder
56
57 # E2E test node_modules
58 test/e2e/*/node_modules
CLAUDE.md
+3 -3
@@ -8,7 +8,7 @@ This is the Composio SDK v3 repository containing both TypeScript and Python SDK
8
9 ## Memories and Notes
10
11 -- For documentation tasks, refer to `fern/CLAUDE.md`
11 +- For documentation tasks, refer to `docs/CLAUDE.md`
12
13 ## Effect.ts Reference Source
14
@@ -112,7 +112,7 @@ composio/
112 │ │ └── ts-builders/ # TypeScript code generation utilities
113 │ └── examples/ # Usage examples for different providers
114 ├── python/ # Python SDK
115 -├── fern/ # Documentation and API specs
115 +├── docs/ # Documentation (Fumadocs)
116 └── examples/ # Cross-platform examples
117 ```
118
@@ -194,7 +194,7 @@ CI # CI environment flag
194 - **Type Definitions**: `ts/packages/core/src/types/`
195 - **Error Classes**: `ts/packages/core/src/errors/`
196 - **Examples**: `ts/examples/` and `examples/`
197 -- **Documentation**: `ts/docs/` and `fern/`
197 +- **Documentation**: `docs/`
198 - **Build Configs**: `turbo.jsonc`, `tsconfig.base.json`, `tsdown.config.base.ts`
199 - **E2E Tests**: `ts/e2e-tests/`
200
README.md
+1 -1
@@ -143,7 +143,7 @@ To update the OpenAPI specifications used for generating SDK documentation:
143 pnpm api:pull
144 ```
145
146 -This command pulls the OpenAPI specification from `https://backend.composio.dev/api/v3/openapi.json` (defined in `fern/scripts/pull-openapi-spec.sh`) and updates the local API documentation files.
146 +This command pulls the OpenAPI specification from `https://backend.composio.dev/api/v3/openapi.json` and updates the local API documentation files.
147
148 This is pulled automatically with build step.
149
context7.json
+1 -1
@@ -1,7 +1,7 @@
1 {
2 "projectTitle": "Composio",
3 "description": "Composio equip's your AI agents & LLMs with 100+ high-quality integrations via function calling",
4 - "folders": ["fern/pages/src", "fern/snippets", "ts", "python"],
4 + "folders": ["docs/content", "ts", "python"],
5 "excludeFolders": [],
6 "excludeFiles": [
7 "CHANGELOG.md",
fern/.python-version deleted
-1
@@ -1 +0,0 @@
1 -3.12
fern/CLAUDE.md deleted
-121
@@ -1,121 +0,0 @@
1 -# CLAUDE.md
2 -
3 -> **⚠️ DEPRECATED**: This Fern-based documentation system is deprecated. The new documentation is in `/docs` (built with Fumadocs). See `/docs/CLAUDE.md` for current documentation guidelines.
4 -
5 ----
6 -
7 -You are reviewing technical documentation for the Composio SDK and API.
8 -
9 -Your task is to:
10 -- Catch and fix any and all grammar and spelling mistakes.
11 -- Find logical gaps in explanations that might make it difficult to understand a concept for a user.
12 -- Find and suggest fixes in ``` codeblocks when proper practices aren’t being followed.
13 -
14 -Read through the previous docs in `fern/pages/src` to understand how they are written.
15 -
16 -### Proper documentation practices
17 -
18 -- BLUF: Bottom-Line Up Front. Show logical graduation for a concept from basic understanding and then add in more information as needed.
19 -- Progressive disclosure. For example: “Executing tools:: Show how to execute tool; then show parameters, then show authentication” or “Authenticating tools:: Show basic OAuth authentication, show auth config creation flow, show how to get params and then create connection”
20 -- Proper structure and flow: Given the entire understanding of the docs and product, proper docs should exist in proper folders and be linked properly.
21 -- If a concept is cross-linking or referencing another concept, cross linking should be done.
22 -- Scientifically structured—organized like a research paper or technical white paper, with a logical flow and strict attention to detail.
23 -- Focused on user success — no marketing language or fluff; just the necessary information.
24 -
25 -### Review Guidelines
26 -
27 -- Titles must always start with an uppercase letter, followed by lowercase letters unless it is a name. Examples: Getting started, Text to speech, Conversational AI...
28 -- No emojis or icons unless absolutely necessary.
29 -- Scientific research tone—professional, factual, and straightforward.
30 -- Avoid long text blocks. Use short paragraphs and line breaks.
31 -- Do not use marketing/promotional language.
32 -- Be concise, direct, and avoid wordiness.
33 -- Tailor the tone and style depending on the location of the content.
34 -- If the user asks you to update the changelog, you must create a new changelog file in the /fern/docs/pages/changelog folder with the following file name: `2024-10-13.md` (the date should be the current date).
35 -- Ensure there are well-designed links (if applicable) to take the technical or non-technical reader to the relevant page.
36 -
37 -
38 -## Components
39 -
40 -Suggest to use the following components whenever possible to enhance readability and structure.
41 -
42 -### Code Snippets
43 -
44 -How to Use SnippetCode Component
45 -
46 -Basic Usage
47 -
48 -For local files:
49 -```
50 -<SnippetCode src="fern/snippets/get-started/pyth
51 -on/quickstart.py" />
52 -```
53 -For GitHub files:
54 -<SnippetCode
55 -githubUrl="[https://github.com/ComposioHQ/compo](https://github.com/ComposioHQ/compo)
56 -sio/blob/master/python/examples/quickstart.py"
57 -title="[quickstart.py](http://quickstart.py)"
58 -/>
59 -
60 -Advanced Options
61 -
62 -Select specific lines:
63 -```
64 -<SnippetCode
65 -src="fern/snippets/tool-calling/python/example
66 -.py"
67 -startLine={10}
68 -endLine={25}
69 -/>
70 -```
71 -Highlight lines:
72 -```
73 -<SnippetCode
74 -
75 -githubUrl="[https://github.com/ComposioHQ/composi](https://github.com/ComposioHQ/composi)
76 -o/blob/master/python/examples/gmail.py#L20-L40"
77 -highlightStart={25}
78 -highlightEnd={30}
79 -title="Gmail Integration"
80 -/>
81 -```
82 -The component ensures your documentation stays
83 -in sync with actual code examples, whether
84 -they're local snippets or from GitHub
85 -repositories.
86 -
87 -### Accordions
88 -
89 -```
90 -<AccordionGroup>
91 - <Accordion title="Option 1">
92 - You can put other components inside Accordions.
93 - ```ts
94 - export function generateRandomNumber() {
95 - return Math.random();
96 - }
97 - ```
98 - </Accordion>
99 - <Accordion title="Option 2">
100 - This is a second option.
101 - </Accordion>
102 -
103 - <Accordion title="Option 3">
104 - This is a third option.
105 - </Accordion>
106 -</AccordionGroup>
107 -```
108 -
109 -### Callouts (Tips, Notes, Warnings, etc.)
110 -
111 -```
112 -<Tip title="Example Callout" icon="leaf">
113 -This Callout uses a title and a custom icon.
114 -</Tip>
115 -<Note>This adds a note in the content</Note>
116 -<Warning>This raises a warning to watch out for</Warning>
117 -<Error>This indicates a potential error</Error>
118 -<Info>This draws attention to important information</Info>
119 -<Tip>This suggests a helpful tip</Tip>
120 -<Check>This brings us a checked status</Check>
121 -```
\ No newline at end of file
fern/README.md deleted
-116
@@ -1,116 +0,0 @@
1 -# Composio Documentation (DEPRECATED)
2 -
3 -> **⚠️ DEPRECATED**: This Fern-based documentation system is deprecated. The new documentation is now located in the `/docs` directory and built with [Fumadocs](https://fumadocs.dev/). Please make all documentation changes there instead.
4 ->
5 -> This directory is kept for reference only and will be removed in a future release.
6 -
7 ----
8 -
9 -Welcome to the Composio documentation! This guide will help you contribute to our documentation with ease.
10 -
11 -## Table of Contents
12 -
13 -- [Prerequisites](#prerequisites)
14 -- [One-Time Setup](#one-time-setup)
15 -- [Development Workflow](#development-workflow)
16 -- [Troubleshooting](#troubleshooting)
17 -- [Contributing Guidelines](#contributing-guidelines)
18 -
19 -## Prerequisites
20 -
21 -Before you start, make sure you have the following installed on your system:
22 -
23 -- **Node.js** (version 18 or higher) - [Download here](https://nodejs.org/)
24 -- **pnpm** (package manager) - Install with `npm install -g pnpm`
25 -- **Git** - For version control
26 -- **A Composio API key** - Get one from [Composio Dashboard](https://platform.composio.dev?next_page=/settings)
27 -
28 -## One-Time Setup
29 -
30 -Follow these steps once when you first set up the project:
31 -
32 -### 1. Clone and Navigate to the Project
33 -
34 -```bash
35 -git clone <repository-url>
36 -cd composio1/fern
37 -```
38 -
39 -### 2. Install Dependencies
40 -
41 -```bash
42 -pnpm install
43 -```
44 -
45 -### 3. Install Python Dependencies
46 -
47 -UV is required for generating tool and Python documentation:
48 -
49 -```bash
50 -curl -LsSf https://astral.sh/uv/install.sh | sh
51 -```
52 -
53 -**Install the Python SDK**
54 -```bash
55 -uv sync && uv pip install python/
56 -```
57 -
58 -### 4. Install and Setup Fern CLI
59 -
60 -Fern is the documentation framework we use:
61 -
62 -```bash
63 -npm install -g fern-api
64 -fern login
65 -```
66 -
67 -### 5. Set Up Your API Key
68 -
69 -Export your Composio API key (you'll need this for generating tool documentation):
70 -
71 -```bash
72 -export COMPOSIO_API_KEY=your_api_key_here
73 -```
74 -
75 -**Pro tip:** Add this to your shell profile (`.bashrc`, `.zshrc`, etc.) so you don't have to set it every time.
76 -
77 -## Development Workflow
78 -
79 -Once you've completed the one-time setup, use this workflow for ongoing development:
80 -
81 -### 1. Start the Development Server
82 -
83 -```bash
84 -pnpm turbo run dev
85 -```
86 -
87 -This will:
88 -
89 -- Comment out tool docs for faster development
90 -- Build example code
91 -- Start the documentation server at http://localhost:3000
92 -
93 -### 2. Make Your Changes
94 -
95 -- Edit the documentation files in the `fern/pages/src` directories.
96 -- If adding new docs, make sure to add them in `docs.yml`
97 -- Refer to [Fern docs](https://buildwithfern.com/learn/docs/getting-started/overview)
98 -
99 -### 3. Check Your Work
100 -
101 -Before submitting your changes, run these commands to ensure everything is working:
102 -
103 -```bash
104 -# Check for broken links and other issues
105 -cd fern/ && pnpm run links
106 -
107 -# Or use the check command (faster, but comments out tool docs)
108 -cd fern/ && pnpm run check
109 -```
110 -
111 -### 4. Submit Your Changes
112 -
113 -1. Commit your changes to a new branch
114 -2. Push to your fork
115 -3. Create a pull request
116 -5. You will see preview links generated in the PR, use that to share.
fern/apis/openapi-overrides.yml deleted
-33
@@ -1,33 +0,0 @@
1 -paths:
2 - /api/v3/mcp/validate/{uuid}:
3 - get:
4 - x-fern-ignore: true
5 - /api/v3/labs/tool_router/session:
6 - post:
7 - x-fern-ignore: true
8 - /api/v3/cli/get-session:
9 - get:
10 - x-fern-ignore: true
11 - /api/v3/cli/create-session:
12 - post:
13 - x-fern-ignore: true
14 - /api/v3/auth/session/logout:
15 - post:
16 - x-fern-ignore: true
17 - /api/v3/tool_router/session/{session_id}/execute:
18 - post:
19 - parameters:
20 - - ~ # keep session_id (first param)
21 - - x-fern-ignore: true # hide x-session-access-key (second param)
22 -components:
23 - securitySchemes:
24 - ApiKeyAuth:
25 - type: apiKey
26 - in: header
27 - name: x-api-key
28 - description: API key authentication
29 - CookieAuth:
30 - # type: apiKey
31 - # in: header
32 - # name: authToken
33 - # description: Cookie based authentication
fern/apis/v3/generators.yml deleted
-6
@@ -1,6 +0,0 @@
1 -api:
2 - specs:
3 - - openapi: ../openapi.json
4 - overrides: ../openapi-overrides.yml
5 - settings:
6 - title-as-schema-name: false
fern/assets/IBMPlexMono-Light.ttf
Binary files a/fern/assets/IBMPlexMono-Light.ttf and /dev/null differ
fern/assets/Inter-Medium.woff2
Binary files a/fern/assets/Inter-Medium.woff2 and /dev/null differ
fern/assets/favicon.png
Binary files a/fern/assets/favicon.png and /dev/null differ
fern/assets/images/after-execute.png
Binary files a/fern/assets/images/after-execute.png and /dev/null differ
fern/assets/images/anthropic-logo.svg deleted
-14
@@ -1,14 +0,0 @@
1 -<svg fill="currentColor" fill-rule="evenodd" height="64" style="flex:none;line-height:1" viewBox="0 0 24 24" width="64" xmlns="http://www.w3.org/2000/svg">
2 - <title>Anthropic</title>
3 - <style>
4 - .logo-path {
5 - fill: #000;
6 - }
7 - @media (prefers-color-scheme: dark) {
8 - .logo-path {
9 - fill: #fff;
10 - }
11 - }
12 - </style>
13 - <path class="logo-path" d="M13.827 3.52h3.603L24 20h-3.603l-6.57-16.48zm-7.258 0h3.767L16.906 20h-3.674l-1.343-3.461H5.017l-1.344 3.46H0L6.57 3.522zm4.132 9.959L8.453 7.687 6.205 13.48H10.7z"></path>
14 -</svg>
\ No newline at end of file
fern/assets/images/ask-index-docs.png
Binary files a/fern/assets/images/ask-index-docs.png and /dev/null differ
fern/assets/images/auth-config-creation.png
Binary files a/fern/assets/images/auth-config-creation.png and /dev/null differ
fern/assets/images/auth-screen-example.png
Binary files a/fern/assets/images/auth-screen-example.png and /dev/null differ
fern/assets/images/before-execute.png
Binary files a/fern/assets/images/before-execute.png and /dev/null differ
fern/assets/images/composio-auth-app.png
Binary files a/fern/assets/images/composio-auth-app.png and /dev/null differ
fern/assets/images/cursor-settings.png
Binary files a/fern/assets/images/cursor-settings.png and /dev/null differ
fern/assets/images/custom-auth-app.png
Binary files a/fern/assets/images/custom-auth-app.png and /dev/null differ
fern/assets/images/custom-auth-hubspot.png
Binary files a/fern/assets/images/custom-auth-hubspot.png and /dev/null differ
fern/assets/images/custom-auth-posthog.png
Binary files a/fern/assets/images/custom-auth-posthog.png and /dev/null differ
fern/assets/images/custom-redirect-uri.png
Binary files a/fern/assets/images/custom-redirect-uri.png and /dev/null differ
fern/assets/images/debugging-info/debugging-info.png
Binary files a/fern/assets/images/debugging-info/debugging-info.png and /dev/null differ
fern/assets/images/debugging-info/project-settings.jpeg
Binary files a/fern/assets/images/debugging-info/project-settings.jpeg and /dev/null differ
fern/assets/images/examples/ai-email-labels.png
Binary files a/fern/assets/images/examples/ai-email-labels.png and /dev/null differ
fern/assets/images/examples/auth-configs.png
Binary files a/fern/assets/images/examples/auth-configs.png and /dev/null differ
fern/assets/images/examples/connection-status.png
Binary files a/fern/assets/images/examples/connection-status.png and /dev/null differ
fern/assets/images/examples/create-connection.png
Binary files a/fern/assets/images/examples/create-connection.png and /dev/null differ
fern/assets/images/examples/custom-tool-component.png
Binary files a/fern/assets/images/examples/custom-tool-component.png and /dev/null differ
fern/assets/images/examples/gmail-agent-trace.png
Binary files a/fern/assets/images/examples/gmail-agent-trace.png and /dev/null differ
fern/assets/images/examples/toolkits.png
Binary files a/fern/assets/images/examples/toolkits.png and /dev/null differ
fern/assets/images/examples/trigger-config.png
Binary files a/fern/assets/images/examples/trigger-config.png and /dev/null differ
fern/assets/images/examples/webhook-secret.png
Binary files a/fern/assets/images/examples/webhook-secret.png and /dev/null differ
fern/assets/images/executingtools.png
Binary files a/fern/assets/images/executingtools.png and /dev/null differ
fern/assets/images/github-callback.png
Binary files a/fern/assets/images/github-callback.png and /dev/null differ
fern/assets/images/github-oauth-config.png
Binary files a/fern/assets/images/github-oauth-config.png and /dev/null differ
fern/assets/images/google-callback.png
Binary files a/fern/assets/images/google-callback.png and /dev/null differ
fern/assets/images/google-logo.svg deleted
-1
@@ -1 +0,0 @@
1 -<svg viewBox="0 0 256 262" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid"><path d="M255.878 133.451c0-10.734-.871-18.567-2.756-26.69H130.55v48.448h71.947c-1.45 12.04-9.283 30.172-26.69 42.356l-.244 1.622 38.755 30.023 2.685.268c24.659-22.774 38.875-56.282 38.875-96.027" fill="#4285F4"/><path d="M130.55 261.1c35.248 0 64.839-11.605 86.453-31.622l-41.196-31.913c-11.024 7.688-25.82 13.055-45.257 13.055-34.523 0-63.824-22.773-74.269-54.25l-1.531.13-40.298 31.187-.527 1.465C35.393 231.798 79.49 261.1 130.55 261.1" fill="#34A853"/><path d="M56.281 156.37c-2.756-8.123-4.351-16.827-4.351-25.82 0-8.994 1.595-17.697 4.206-25.82l-.073-1.73L15.26 71.312l-1.335.635C5.077 89.644 0 109.517 0 130.55s5.077 40.905 13.925 58.602l42.356-32.782" fill="#FBBC05"/><path d="M130.55 50.479c24.514 0 41.05 10.589 50.479 19.438l36.844-35.974C195.245 12.91 165.798 0 130.55 0 79.49 0 35.393 29.301 13.925 71.947l42.211 32.783c10.59-31.477 39.891-54.251 74.414-54.251" fill="#EB4335"/></svg>
\ No newline at end of file
fern/assets/images/google-oauth-config.png
Binary files a/fern/assets/images/google-oauth-config.png and /dev/null differ
fern/assets/images/index-docs.png
Binary files a/fern/assets/images/index-docs.png and /dev/null differ
fern/assets/images/integration-step-3-0.png
Binary files a/fern/assets/images/integration-step-3-0.png and /dev/null differ
fern/assets/images/langgraph-logo.svg deleted
-14
@@ -1,14 +0,0 @@
1 -<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 207.43 32">
2 - <style>
3 - .logo-path {
4 - fill: #000;
5 - }
6 - @media (prefers-color-scheme: dark) {
7 - .logo-path {
8 - fill: #fff;
9 - }
10 - }
11 - </style>
12 - <path class="logo-path" d="M15.81 0h30.6c8.72 0 15.81 7.12 15.81 15.87s-7.09 15.87-15.81 15.87h-30.6C7.09 31.73 0 24.61 0 15.87S7.09 0 15.81 0m14.05 24.59c.38.4.95.38 1.46.28.23-.19-.1-.43-.42-.66-.19-.14-.38-.27-.43-.39.18-.21-.34-.7-.75-1.08-.17-.16-.32-.3-.39-.39-.29-.31-.4-.71-.52-1.11-.08-.26-.15-.53-.28-.77-.79-1.84-1.7-3.66-2.97-5.21-.82-1.03-1.75-1.96-2.68-2.88-.6-.6-1.2-1.19-1.77-1.82-.59-.61-.94-1.35-1.29-2.1-.3-.63-.59-1.25-1.03-1.8-1.31-1.95-5.46-2.48-6.07.27 0 .08-.02.14-.1.19-.34.25-.64.53-.89.87-.62.86-.71 2.32.06 3.09v-.05c.03-.39.05-.76.36-1.04.59.51 1.49.69 2.18.31.83 1.19 1.09 2.63 1.36 4.07.22 1.2.44 2.41.99 3.48l.03.06c.32.54.65 1.08 1.07 1.55.15.23.46.49.77.74.41.33.81.66.85.95v.38c0 .75 0 1.53.48 2.15.27.54-.39 1.08-.91 1.02-.29.04-.6-.04-.92-.11-.43-.1-.85-.21-1.2 0-.1.1-.24.11-.38.11-.17 0-.33 0-.43.18-.02.05-.07.11-.12.17-.11.13-.23.28-.09.39.01 0 .03-.02.04-.03.21-.16.42-.32.7-.22-.04.21.1.27.24.33.02 0 .05.02.07.03 0 .05-.01.1-.02.15-.02.12-.05.23.05.34.04-.04.08-.09.12-.14.09-.12.19-.24.36-.29.37.5.75.29 1.22.03.53-.29 1.19-.65 2.1-.14-.35-.02-.66.02-.9.31-.06.06-.11.14 0 .22.54-.35.76-.22.97-.11.15.09.3.17.55.06.06-.03.12-.06.18-.1.4-.22.81-.44 1.3-.36-.36.1-.49.33-.63.58-.07.12-.14.25-.24.37-.05.05-.08.12-.02.21.75-.06 1.03-.25 1.42-.51.18-.12.39-.26.68-.41.32-.2.64-.07.95.05.34.13.66.26.96-.03.1-.09.21-.09.33-.09h.13c-.09-.5-.62-.5-1.16-.49-.62 0-1.25.01-1.23-.76.58-.39.58-1.08.59-1.72 0-.16 0-.31.01-.46.42.24.87.42 1.32.6.42.17.84.34 1.23.56.41.66 1.05 1.53 1.9 1.47.02-.07.04-.12.07-.19.05 0 .1.02.15.03.22.06.46.12.58-.15Zm16.67-7.48c.49.49 1.16.77 1.86.77s1.36-.28 1.86-.77c.49-.49.77-1.16.77-1.85a2.63 2.63 0 0 0-2.63-2.62c-.33 0-.65.06-.94.18l-1.5-2.2-1.05.72 1.51 2.21a2.61 2.61 0 0 0 .13 3.56ZM41.81 10c.37.18.77.28 1.19.27.56 0 1.11-.19 1.55-.52.45-.34.78-.81.94-1.34.16-.54.15-1.11-.04-1.64a2.58 2.58 0 0 0-1.01-1.29c-.34-.23-.73-.37-1.14-.43-.41-.05-.82 0-1.21.13-.39.14-.74.37-1.02.66a2.61 2.61 0 0 0-.68 2.26c.07.4.24.79.48 1.11.25.33.57.59.94.78Zm0 15.21c.37.18.77.28 1.19.27.56 0 1.11-.19 1.55-.52.45-.34.78-.81.94-1.34.16-.54.15-1.11-.04-1.64a2.58 2.58 0 0 0-1.01-1.29c-.34-.23-.73-.37-1.14-.43-.41-.05-.82 0-1.21.13-.39.14-.74.37-1.02.66a2.61 2.61 0 0 0-.68 2.26c.07.4.24.79.48 1.11.25.33.57.59.94.78Zm2.42-9.3v-1.3h-4.02c-.1-.39-.29-.76-.56-1.07l1.51-2.24-1.1-.73-1.51 2.24c-.28-.1-.57-.15-.86-.16-.69 0-1.36.27-1.85.76s-.77 1.15-.77 1.84.28 1.35.77 1.84 1.16.76 1.85.76c.29 0 .59-.06.86-.16l1.51 2.24 1.09-.73-1.5-2.24c.27-.31.46-.67.56-1.07h4.02Z" style="fill-rule: evenodd"/>
13 - <path class="logo-path" d="M148.76 7.61c-1.36-1.08-3.25-1.63-5.59-1.63-1.69 0-3.23.4-4.57 1.18-1.35.79-2.42 1.93-3.19 3.41-.78 1.48-1.17 3.28-1.17 5.36 0 1.59.23 3.02.69 4.25s1.1 2.28 1.92 3.12c.81.84 1.77 1.49 2.85 1.93s2.25.66 3.48.66c1.84 0 3.44-.4 4.76-1.19s2.34-1.9 3.05-3.29c.71-1.4 1.07-3.01 1.07-4.81 0-.05 0-.22-.01-.49 0-.22-.02-.4-.03-.54h-6.65v2.34h3.42v.11c-.18 1.11-.5 2.06-.97 2.8-.47.75-1.09 1.31-1.83 1.68s-1.63.55-2.6.54c-1.31-.02-2.41-.32-3.29-.91-.87-.59-1.54-1.42-1.97-2.47s-.65-2.3-.65-3.71.22-2.67.66-3.73s1.1-1.91 1.97-2.49c.87-.59 1.98-.88 3.28-.86 1.3 0 2.39.35 3.23 1.04.82.68 1.43 1.59 1.8 2.71l3.12-.49c-.49-1.91-1.42-3.42-2.76-4.49Zm40.43 4.09c-1.01-.67-2.19-1-3.56-1s-2.53.33-3.46 1c-.19.14-.37.28-.54.44V11.1h-2.85V32h3.25v-7.16c.06.04.12.09.18.13.96.67 2.14 1 3.55 1 1.33 0 2.49-.33 3.48-1s1.76-1.58 2.3-2.73.82-2.45.82-3.9-.28-2.77-.83-3.92-1.33-2.05-2.34-2.72m-.64 9.04c-.26.72-.67 1.29-1.21 1.71s-1.24.63-2.08.63-1.57-.2-2.1-.6-.92-.95-1.16-1.67c-.25-.71-.37-1.54-.37-2.48s.12-1.78.37-2.48c.24-.71.63-1.26 1.14-1.66q.78-.6 2.01-.6c.87 0 1.58.21 2.14.64.56.42.98 1 1.25 1.72s.4 1.52.4 2.39-.13 1.69-.39 2.4m18.78-4.61c-.06-.56-.18-1.15-.38-1.78s-.5-1.21-.91-1.77c-.41-.55-.96-1.01-1.66-1.37s-1.58-.54-2.65-.54c-1.36 0-2.5.3-3.43.89-.5.32-.93.7-1.3 1.13V6.26h-2.88v19.29h3.27v-7.43c0-.88.1-1.61.29-2.18.2-.57.46-1.01.78-1.34.33-.33.69-.56 1.09-.69s.81-.2 1.22-.2c.77 0 1.38.16 1.83.5.45.33.79.75 1.02 1.27.23.51.37 1.05.44 1.6.06.55.09 1.06.09 1.51v6.97h3.27v-8.08c0-.35-.03-.8-.09-1.36Zm-45.71-4.9c-.44.03-.88.11-1.3.25-.42.13-.81.32-1.15.55q-.615.375-1.05.96c-.13.17-.24.35-.36.55l-.12.21v-2.47h-2.69v14.16h3.07v-7.2c0-.55.07-1.07.2-1.55s.35-.91.63-1.28c.28-.38.65-.69 1.1-.93.44-.27.96-.43 1.51-.47.52-.04.99 0 1.4.1v-2.84c-.4-.06-.82-.08-1.24-.05ZM74.91 6.25v19.24h13.25v-2.91H77.92V6.25zm20.32 4.56c-2.89 0-5.05 1.35-5.93 3.72-.06.15-.22.61-.22.61l2.48 1.6.34-.88c.57-1.5 1.64-2.19 3.34-2.19s2.68.83 2.66 2.45v.27s-2.25.37-3.18.56c-3.96.84-5.62 2.35-5.62 4.83 0 1.32.73 2.75 2.07 3.55.8.48 1.85.66 3 .66.76 0 1.5-.11 2.18-.32 1.56-.52 1.99-1.53 1.99-1.53v1.33h2.58v-9.49c0-3.23-2.12-5.15-5.67-5.15Zm2.67 10.13c0 1-1.09 2.4-3.62 2.4-.71 0-1.22-.19-1.56-.47-.45-.38-.6-.92-.54-1.4.03-.21.15-.66.62-1.04.48-.4 1.32-.68 2.62-.97 1.07-.23 2.48-.49 2.48-.49zm72.73-10.13c-2.89 0-5.05 1.35-5.93 3.72-.06.15-.22.61-.22.61l2.48 1.6.34-.88c.57-1.5 1.64-2.19 3.34-2.19s2.68.83 2.66 2.45v.27s-2.26.37-3.18.56c-3.96.84-5.62 2.35-5.62 4.83 0 1.32.73 2.75 2.07 3.55.8.48 1.85.66 3 .66.76 0 1.5-.11 2.18-.32 1.56-.52 1.99-1.53 1.99-1.53v1.33h2.58v-9.49c0-3.23-2.12-5.15-5.67-5.15Zm2.67 10.13c0 1-1.09 2.4-3.62 2.4-.71 0-1.22-.19-1.56-.47-.45-.38-.6-.92-.54-1.4.03-.21.15-.66.62-1.04.48-.4 1.32-.68 2.62-.97 1.07-.23 2.48-.49 2.48-.49zm-62.88-10.13c-.36 0-.71.02-1.04.07-2.31.35-2.98 1.52-2.98 1.52v-1.17h-2.89v14.23h3.01v-7.89c0-2.68 1.96-3.9 3.77-3.9 1.96 0 2.92 1.06 2.92 3.23v8.56h3.01v-8.98c0-3.5-2.22-5.67-5.8-5.67m18.36.41v1.47s-.74-1.88-4.09-1.88c-4.17 0-6.76 2.88-6.76 7.51 0 2.61.83 4.67 2.31 5.97 1.15 1.01 2.68 1.53 4.5 1.56 1.27.02 2.09-.32 2.6-.65.99-.63 1.35-1.22 1.35-1.22s-.04.47-.12 1.1c-.05.46-.16.78-.16.78-.46 1.63-1.8 2.57-3.75 2.57s-3.14-.64-3.37-1.91l-2.93.87c.51 2.44 2.79 3.89 6.12 3.89 2.26 0 4.03-.61 5.27-1.83s1.88-2.99 1.88-5.24v-13h-2.85Zm-.19 7.23c0 2.85-1.39 4.55-3.72 4.55-2.5 0-3.93-1.71-3.93-4.68s1.43-4.65 3.93-4.65c2.27 0 3.7 1.69 3.72 4.42z"/>
14 -</svg>
\ No newline at end of file
fern/assets/images/mcp-api-key-toggle.png
Binary files a/fern/assets/images/mcp-api-key-toggle.png and /dev/null differ
fern/assets/images/oauth-branding.png
Binary files a/fern/assets/images/oauth-branding.png and /dev/null differ
fern/assets/images/oauth-composio-branding.png
Binary files a/fern/assets/images/oauth-composio-branding.png and /dev/null differ
fern/assets/images/openai-logo.svg deleted
-13
@@ -1,13 +0,0 @@
1 -<svg xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid" viewBox="0 0 256 260">
2 - <style>
3 - .logo-path {
4 - fill: #000;
5 - }
6 - @media (prefers-color-scheme: dark) {
7 - .logo-path {
8 - fill: #fff;
9 - }
10 - }
11 - </style>
12 - <path class="logo-path" d="M239.184 106.203a64.716 64.716 0 0 0-5.576-53.103C219.452 28.459 191 15.784 163.213 21.74A65.586 65.586 0 0 0 52.096 45.22a64.716 64.716 0 0 0-43.23 31.36c-14.31 24.602-11.061 55.634 8.033 76.74a64.665 64.665 0 0 0 5.525 53.102c14.174 24.65 42.644 37.324 70.446 31.36a64.72 64.72 0 0 0 48.754 21.744c28.481.025 53.714-18.361 62.414-45.481a64.767 64.767 0 0 0 43.229-31.36c14.137-24.558 10.875-55.423-8.083-76.483Zm-97.56 136.338a48.397 48.397 0 0 1-31.105-11.255l1.535-.87 51.67-29.825a8.595 8.595 0 0 0 4.247-7.367v-72.85l21.845 12.636c.218.111.37.32.409.563v60.367c-.056 26.818-21.783 48.545-48.601 48.601Zm-104.466-44.61a48.345 48.345 0 0 1-5.781-32.589l1.534.921 51.722 29.826a8.339 8.339 0 0 0 8.441 0l63.181-36.425v25.221a.87.87 0 0 1-.358.665l-52.335 30.184c-23.257 13.398-52.97 5.431-66.404-17.803ZM23.549 85.38a48.499 48.499 0 0 1 25.58-21.333v61.39a8.288 8.288 0 0 0 4.195 7.316l62.874 36.272-21.845 12.636a.819.819 0 0 1-.767 0L41.353 151.53c-23.211-13.454-31.171-43.144-17.804-66.405v.256Zm179.466 41.695-63.08-36.63L161.73 77.86a.819.819 0 0 1 .768 0l52.233 30.184a48.6 48.6 0 0 1-7.316 87.635v-61.391a8.544 8.544 0 0 0-4.4-7.213Zm21.742-32.69-1.535-.922-51.619-30.081a8.39 8.39 0 0 0-8.492 0L99.98 99.808V74.587a.716.716 0 0 1 .307-.665l52.233-30.133a48.652 48.652 0 0 1 72.236 50.391v.205ZM88.061 139.097l-21.845-12.585a.87.87 0 0 1-.41-.614V65.685a48.652 48.652 0 0 1 79.757-37.346l-1.535.87-51.67 29.825a8.595 8.595 0 0 0-4.246 7.367l-.051 72.697Zm11.868-25.58 28.138-16.217 28.188 16.218v32.434l-28.086 16.218-28.188-16.218-.052-32.434Z"/>
13 -</svg>
\ No newline at end of file
fern/assets/images/schema-modifier.png
Binary files a/fern/assets/images/schema-modifier.png and /dev/null differ
fern/assets/images/setup-webhook.png
Binary files a/fern/assets/images/setup-webhook.png and /dev/null differ
fern/assets/images/tool-router/auth-config-custom-redirect.png
Binary files a/fern/assets/images/tool-router/auth-config-custom-redirect.png and /dev/null differ
fern/assets/images/trigger-config.png
Binary files a/fern/assets/images/trigger-config.png and /dev/null differ
fern/assets/images/trigger-enable-disable.png
Binary files a/fern/assets/images/trigger-enable-disable.png and /dev/null differ
fern/assets/images/triggers.png
Binary files a/fern/assets/images/triggers.png and /dev/null differ
fern/assets/images/vercel-logo.svg deleted
-13
@@ -1,13 +0,0 @@
1 -<svg viewBox="0 0 256 222" xmlns="http://www.w3.org/2000/svg" preserveAspectRatio="xMidYMid">
2 - <style>
3 - .logo-path {
4 - fill: #000;
5 - }
6 - @media (prefers-color-scheme: dark) {
7 - .logo-path {
8 - fill: #fff;
9 - }
10 - }
11 - </style>
12 - <path class="logo-path" d="m128 0 128 221.705H0z"/>
13 -</svg>
\ No newline at end of file
fern/assets/input.css deleted
-753
@@ -1,753 +0,0 @@
1 -@tailwind components;
2 -@tailwind utilities;
3 -
4 -:root {
5 - --space-xs: 12px;
6 - --space-sm: 16px;
7 - --space-md: 24px;
8 - --space-lg: 32px;
9 - --space-xl: 40px;
10 - --page-padding-inline: var(--space-lg);
11 - --section-gap: var(--space-xl);
12 - --surface-background: #F7F4F0;
13 - --accent-primary: #FF782F;
14 - --sidebar-border-color: #d9d3c2;
15 - --simple-card-bg-color: #f5f4f2;
16 - --divider-border-color: #bdbdbd;
17 - --radius-button: 6px;
18 - --radius-card: 10px;
19 - --radius-panel: 8px;
20 - --radius-section: 16px;
21 - --radius-pill: 999px;
22 - --shadow-soft: 0 18px 40px rgba(15, 6, 2, 0.08);
23 - --shadow-strong: 0 36px 80px rgba(15, 6, 2, 0.12);
24 -}
25 -
26 -.dark {
27 - --surface-background: #0F0602;
28 - --accent-primary: #FF9233;
29 - --sidebar-border-color: #2c1b13;
30 - --simple-card-bg-color: #1a1a1a;
31 - --divider-border-color: #1a1a1a;
32 -}
33 -
34 -/* Sidebar layout alignment */
35 -.fern-theme-default.fern-container {
36 - background-color: var(--surface-background);
37 -}
38 -
39 -.fern-theme-default.fern-container .fern-header {
40 - background-color: var(--surface-background);
41 - border-bottom: 1px solid var(--divider-border-color);
42 - padding: 0 var(--page-padding-inline);
43 - min-height: 64px;
44 - display: flex;
45 - align-items: center;
46 -}
47 -
48 -.fern-theme-default.fern-container .fern-header-tabs {
49 - background-color: var(--surface-background);
50 - border-bottom: 1px solid var(--divider-border-color);
51 - padding: 0 var(--page-padding-inline);
52 -}
53 -
54 -.fern-theme-default.fern-container .fern-sidebar-container {
55 - border-right: 1px solid var(--sidebar-border-color);
56 - background-color: var(--surface-background);
57 -}
58 -
59 -.fern-changelog>main {
60 - width: 100%;
61 -}
62 -
63 -h1,
64 -h2,
65 -h3,
66 -h4,
67 -h5,
68 -h6 {
69 - font-weight: 400 !important;
70 - font-family: Roobert !important;
71 -}
72 -
73 -h1 {
74 - font-size: 35px !important;
75 -}
76 -
77 -h2 {
78 - letter-spacing: -0.01em;
79 - font-style: normal;
80 - font-size: 24px !important;
81 - line-height: 110%;
82 -}
83 -
84 -.fern-sidebar-heading-content {
85 - font-weight: 500 !important;
86 -}
87 -
88 -.fern-header-tab-button .font-medium {
89 - font-weight: 500 !important;
90 -}
91 -
92 -.fern-sidebar-heading-content {
93 - font-weight: 500 !important;
94 -}
95 -
96 -.fern-header-tab-button .font-medium {
97 - font-weight: 500 !important;
98 -}
99 -
100 -.fern-mdx-link {
101 - font-weight: 400 !important;
102 -}
103 -
104 -.fern-announcement .fern-mdx-link, .fern-announcement svg.external-link-icon {
105 - color: #fff !important;
106 -}
107 -
108 -
109 -.font-semibold {
110 - font-weight: 500 !important;
111 -}
112 -
113 -.fern-api-property-key {
114 - font-weight: 500 !important;
115 -}
116 -
117 -th {
118 - font-weight: 500 !important;
119 -}
120 -
121 -@layer utilities {
122 - .image-desktop {
123 - @apply hidden md:block rounded-t-lg;
124 - }
125 -
126 - .image-mobile {
127 - @apply block md:hidden rounded-t-lg;
128 - }
129 -
130 - .rounded-card {
131 - border-radius: var(--radius-card);
132 - }
133 -
134 - .rounded-panel {
135 - border-radius: var(--radius-panel);
136 - }
137 -
138 - .rounded-pill {
139 - border-radius: var(--radius-pill);
140 - }
141 -
142 - .shadow-soft {
143 - box-shadow: var(--shadow-soft);
144 - }
145 -
146 - .shadow-strong {
147 - box-shadow: var(--shadow-strong);
148 - }
149 -}
150 -
151 -/*! BEGIN STYLESHEET_HUB2 */
152 -.flex-col-to-row {
153 - flex-direction: column;
154 -}
155 -
156 -.flex-row-to-col {
157 - flex-direction: row;
158 -}
159 -
160 -.w-100-to-50 {
161 - max-width: 100%;
162 -}
163 -
164 -.w-100-to-75-to-50 {
165 - max-width: 100%;
166 -}
167 -
168 -.h1-title {
169 - font-family: Roobert !important;
170 - letter-spacing: -0.01em;
171 - font-style: normal;
172 - font-weight: 400;
173 - font-size: 35px !important;
174 - line-height: 100%;
175 -}
176 -
177 -.h2-title {
178 - font-family: Roobert !important;
179 - letter-spacing: -0.01em;
180 - font-style: normal;
181 - font-weight: 400 !important;
182 - font-size: 24px !important;
183 - line-height: 110%;
184 -}
185 -
186 -.h3-title {
187 - font-family: Roobert !important;
188 - font-style: normal;
189 - font-weight: 500;
190 - font-size: 16.8px !important;
191 - line-height: 124%;
192 - margin-block-start: 1em !important;
193 - margin-block-end: 1em !important;
194 -}
195 -
196 -.h4-title {
197 - font-family: Roobert !important;
198 - font-style: normal;
199 - font-weight: 500;
200 - font-size: 16px !important;
201 - line-height: 150%;
202 - margin-block-start: 1em !important;
203 - margin-block-end: 1em !important;
204 -}
205 -
206 -.p-base {
207 - font-family: Roobert !important;
208 - font-style: normal;
209 - font-weight: 400;
210 - font-size: 14px !important;
211 - line-height: 150%;
212 - letter-spacing: 0.03em;
213 -}
214 -
215 -@media only screen and (min-width: 768px) {
216 - .flex-col-to-row {
217 - flex-direction: row;
218 - }
219 -
220 - .flex-row-to-col {
221 - flex-direction: column;
222 - }
223 -
224 - .w-100-to-50 {
225 - max-width: 45%;
226 - }
227 -
228 - .w-100-to-75-to-50 {
229 - max-width: 75%;
230 - }
231 -}
232 -
233 -@media only screen and (min-width: 1024px) {
234 - .w-100-to-75-to-50 {
235 - max-width: 50%;
236 - }
237 -
238 - .p-base {
239 - font-size: 16px;
240 - }
241 -}
242 -
243 -@media (max-width: 1024px) {
244 - .fern-body {
245 - gap: 0px !important;
246 - }
247 -}
248 -
249 -/*! END STYLESHEET_HUB2 */
250 -
251 -/*~~~~~~~~~GENERAL STYLES~~~~~~~~~~~*/
252 -.grid-container-fluid {
253 - margin: 0 !important;
254 -}
255 -
256 -#content-container {
257 - max-width: 100% !important;
258 -}
259 -
260 -#content-head h1 {
261 - display: none;
262 -}
263 -
264 -.page-title {
265 - margin-bottom: var(--space-md) !important;
266 -}
267 -
268 -/* Mobile First Design */
269 -
270 -.divider {
271 - border: solid var(--divider-border-color);
272 - border-width: 1px 0px 0px 0px;
273 - margin-bottom: var(--section-gap);
274 -}
275 -
276 -.page-title-container {
277 - display: flex;
278 - flex-direction: column;
279 - justify-content: start;
280 - height: 100%;
281 - padding-top: var(--section-gap);
282 -}
283 -
284 -.page-secondary-title-container {
285 - margin-top: calc(var(--section-gap) + var(--space-xs));
286 - margin-bottom: var(--space-lg);
287 -}
288 -
289 -.page-blurb {
290 - width: 100%;
291 -}
292 -
293 -.all-cards-container {
294 - padding-left: var(--space-sm);
295 - padding-right: var(--space-sm);
296 - padding-bottom: var(--section-gap);
297 -}
298 -
299 -.cards-container {
300 - display: flex;
301 - flex-direction: column;
302 - gap: var(--space-md);
303 -}
304 -
305 -@layer components {
306 - .small-tag-light {
307 - display: flex;
308 - flex-direction: row;
309 - justify-content: center;
310 - align-items: center;
311 - padding: 4px 12px;
312 - width: 90px;
313 - height: 22px;
314 - background: #ebebf8;
315 - border: 1px solid rgba(43, 38, 73, 0.2);
316 - border-radius: var(--radius-pill);
317 - font-size: 10.5px;
318 - color: #333293;
319 - white-space: nowrap;
320 - }
321 -
322 - .small-tag-dark {
323 - display: flex;
324 - flex-direction: row;
325 - justify-content: center;
326 - align-items: center;
327 - padding: 4px 12px;
328 - width: 72px;
329 - height: 22px;
330 - background: linear-gradient(0deg, rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.2)),
331 - #2b2649;
332 - border: 1px solid rgba(46, 78, 74, 0.5);
333 - border-radius: var(--radius-pill);
334 - font-size: 10.5px;
335 - color: #ebebf8;
336 - white-space: nowrap;
337 - }
338 -}
339 -
340 -.small-tag-container {
341 - display: flex;
342 - flex-direction: row;
343 - gap: 12px;
344 -}
345 -
346 -.simple-card-container {
347 - width: 100%;
348 - display: flex;
349 - flex-direction: column;
350 - border: 1px solid var(--divider-border-color);
351 - border-radius: var(--radius-card);
352 -}
353 -
354 -.simple-card-text-and-link-container {
355 - background: var(--simple-card-bg-color);
356 - border-top: 1px solid var(--divider-border-color);
357 - border-radius: 0px 0px var(--radius-card) var(--radius-card);
358 - flex-grow: 1;
359 - display: flex;
360 - flex-direction: column;
361 -}
362 -
363 -.simple-card-text-container {
364 - display: flex;
365 - flex-direction: column;
366 - /* padding: 0px 24px 0px 24px; */
367 - /* if there is a tag or time data exists on the card */
368 - padding: 32px 24px 16px 24px;
369 -}
370 -
371 -.simple-card-link-container {
372 - display: flex;
373 - flex-direction: column;
374 - padding: 14px 24px 17px 24px;
375 - text-decoration: none;
376 - margin-top: auto;
377 -}
378 -
379 -.toc-list {
380 - display: flex;
381 - flex-direction: column;
382 - flex-wrap: wrap;
383 -}
384 -
385 -.toc-item {
386 - padding: 8px 16px 8px 0px;
387 - border-radius: var(--radius-card);
388 - margin-right: 8px;
389 - white-space: nowrap;
390 -}
391 -
392 -/* MD and above */
393 -@media only screen and (min-width: 768px) {
394 - .page-blurb {
395 - width: 60%;
396 - }
397 -
398 - .all-cards-container {
399 - padding-left: 0px;
400 - padding-right: 0px;
401 - padding-bottom: 0px;
402 - }
403 -
404 - .page-title-container {
405 - min-height: 260px;
406 - background-image: none !important;
407 - height: auto;
408 - padding-top: 0px;
409 - justify-content: center;
410 - }
411 -
412 - .page-secondary-title-container {
413 - margin-top: 70px;
414 - }
415 -
416 - .cards-container {
417 - display: grid;
418 - grid-template-columns: repeat(2, minmax(0, 1fr));
419 - grid-auto-rows: auto;
420 - gap: var(--section-gap);
421 - }
422 -
423 - .p-title {
424 - min-height: 72px;
425 - }
426 -
427 - .simple-card-link-container {
428 - padding-top: 0px;
429 - }
430 -
431 - .toc-list {
432 - flex-direction: row;
433 - }
434 -}
435 -
436 -/* LG and higher */
437 -@media only screen and (min-width: 1024px) {
438 - .page-title-container {
439 - padding-top: 0px;
440 - }
441 -
442 - .page-blurb {
443 - width: 50%;
444 - }
445 -
446 - .cards-container {
447 - display: grid;
448 - grid-template-columns: repeat(3, minmax(0, 1fr));
449 - grid-auto-rows: auto;
450 - gap: var(--section-gap);
451 - }
452 -
453 - .p-title {
454 - min-height: 72px;
455 - }
456 -}
457 -
458 -.header {
459 - padding: 9px 0 17px 0;
460 - display: flex;
461 - flex-direction: column;
462 -}
463 -
464 -.fern-header .fern-button-text {
465 - font-family: Roobert,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif !important;
466 - -webkit-font-smoothing: unset !important;
467 -}
468 -
469 -.fern-sidebar-content .fern-button-text {
470 - font-family: Roobert,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Open Sans,Helvetica Neue,sans-serif !important;
471 - -webkit-font-smoothing: unset !important;
472 -}
473 -
474 -#content {
475 - padding: 0 var(--page-padding-inline);
476 -}
477 -
478 -#content-head {
479 - display: none;
480 -}
481 -
482 -.guide-page-title {
483 - font-size: 29px !important;
484 -}
485 -
486 -.back-button .github-button {
487 - border-radius: 0 !important;
488 - border-width: 0 !important;
489 - background-color: inherit !important;
490 -}
491 -
492 -.cookbook-nav-container {
493 - display: flex;
494 - flex-direction: row;
495 - justify-content: space-between;
496 - align-items: center;
497 -}
498 -
499 -.authors-container {
500 - display: flex;
501 - flex-direction: row;
502 - flex-flow: row wrap;
503 - gap: 2px 14px;
504 -}
505 -
506 -.author-container:not(:is(.simple-card-container *)) {
507 - margin-bottom: 10px;
508 - margin-top: -10px;
509 -}
510 -
511 -.author-container:is(.simple-card-container *) {
512 - margin-top: 20px;
513 -}
514 -
515 -.author-container {
516 - line-height: 1.5em;
517 - display: flex;
518 - flex-direction: row;
519 - vertical-align: middle;
520 - flex-shrink: 0;
521 -}
522 -
523 -.author-image {
524 - height: 1.5em;
525 - margin: 0px 6px 6px 0px !important;
526 - border-radius: 50%;
527 -}
528 -
529 -.author-name {
530 - white-space: nowrap;
531 - vertical-align: middle;
532 -}
533 -
534 -@media only screen and (min-width: 620px) {
535 - .guide-page-title {
536 - width: 70%;
537 - }
538 -
539 - .header {
540 - display: flex;
541 - flex-direction: row;
542 - align-items: center;
543 - justify-content: space-between;
544 - padding: 9px 0 17px 0;
545 - }
546 -
547 - .git--button {
548 - width: 145px !important;
549 - display: flex;
550 - flex-direction: row;
551 - justify-content: center;
552 - align-items: center;
553 - padding: 8px 16px;
554 -
555 - width: 154px;
556 - height: 35px;
557 -
558 - background: #d4d9d4;
559 - border: 1px solid #9daaa4;
560 - border-radius: var(--radius-button);
561 - }
562 -}
563 -
564 -@media only screen and (min-width: 1024px) {
565 - .guide-page-title {
566 - font-size: 46px !important;
567 - }
568 -
569 - .header {
570 - padding: 9px 0 32px 0;
571 - }
572 -}
573 -
574 -.side {
575 - width: 40% !important;
576 - float: right !important;
577 - margin-left: .75rem !important;
578 -}
579 -
580 -.light-bg {
581 - background-color: #f7f7f7 !important;
582 - border-color: #e0e0e0 !important;
583 - border-radius: var(--radius-panel) !important;
584 - border-width: 1px !important;
585 - padding: 15px !important;
586 -}
587 -
588 -.dark-text {
589 - color: #1a1a1a !important;
590 -}
591 -
592 -.dataframe {
593 - display: block !important;
594 - overflow: auto !important;
595 - border-color: #e0e0e0 !important;
596 - border-radius: var(--radius-panel) !important;
597 - border-width: 1px !important;
598 -}
599 -
600 -:is(.dark) .dataframe {
601 - border-color: #ffffff22 !important;
602 -}
603 -
604 -.fern-table td {
605 - max-width: 400px !important;
606 - overflow: wrap !important;
607 -}
608 -
609 -.fern-table th {
610 - max-width: 400px !important;
611 - overflow: wrap !important;
612 -}
613 -
614 -.orange-text {
615 - color: #e69138 !important;
616 - white-space : pre-wrap !important;
617 -}
618 -.dark-orange-text{
619 - color: #b45f06 !important;
620 -}
621 -.dark-red-text {
622 - color: #a20302 !important;
623 - white-space : pre-wrap !important;
624 -}
625 -.red-text {
626 - color: #cc0100 !important;
627 -}
628 -.bloody-red-text {
629 - color: #a31515 !important;
630 -}
631 -.dark-pink-text {
632 - color: #b80672 !important;
633 -}
634 -.magenta-text {
635 - color: #cc669f !important;
636 - white-space : pre-wrap !important;
637 -}
638 -.dark-magenta-text {
639 - color: #78345a !important;
640 -}
641 -.sangria-text {
642 - color: #981ea0 !important;
643 -}
644 -.dark-sangria-text {
645 - color: #6b1570 !important;
646 -}
647 -.brown-text {
648 - color: #5b0f00 !important;
649 -}
650 -.green-text {
651 - color: #6aa84f !important;
652 - white-space : pre-wrap !important;
653 -}
654 -.grass-green-text {
655 - color: #38761d !important;
656 -}
657 -.dark-green-text {
658 - color: #284e13 !important;
659 -}
660 -.quartz-text {
661 - color: #a64d79 !important;
662 -}
663 -.blue-text {
664 - color: #4078f2 !important;
665 -}
666 -.dark-blue-text {
667 - color: #1255cc !important;
668 -}
669 -.purple-text {
670 - color: #674ea7 !important;
671 -}
672 -.dark-purple-text {
673 - color: #361c75 !important;
674 -}
675 -.markdown-body code {
676 - color: inherit !important;
677 -}
678 -.cm-s-neo .cm-keyword {
679 - color: inherit !important;
680 -}
681 -.cm-s-neo .cm-variable {
682 - color: inherit !important;
683 -}
684 -.cm-s-neo .cm-string {
685 - color: inherit !important;
686 -}
687 -.cm-s-neo .cm-property {
688 - color: inherit !important;
689 -}
690 -.theme-light {
691 - color: #cc669f !important;
692 -}
693 -.override {
694 - line-height:100% !important;
695 -}
696 -.yellow-highlight{
697 - background-color: yellow !important;
698 - display: inline-block !important;
699 - width: 100px !important; /* Adjust the width as needed */
700 - /*height: 20px !important;*/ /* Adjust the height as needed */
701 -}
702 -
703 -.extra-yellow {
704 - color: #a31515 !important;
705 - background-color: #ffff00 !important;
706 -}
707 -
708 -.extra-green {
709 - color: #38761d !important;
710 -}
711 -
712 -/*
713 - This is hacky fix for the code block comment color
714 -*/
715 -.code-block-line-content span[style*="color: rgb(194, 195, 197)"] {
716 - color: rgb(155, 156, 158) !important;
717 -}
718 -
719 -:is(.dark) .simple-card-container {
720 - --divider-border-color: #2c2c2c;
721 -}
722 -
723 -.fern-header .fern-button.minimal {
724 - font-weight: 500 !important;
725 -}
726 -
727 -.fern-header .fern-button.minimal:hover,
728 -.fern-header .fern-button.minimal:focus-visible {
729 - background-color: rgba(30, 27, 22, 0.08);
730 -}
731 -
732 -.dark .fern-header .fern-button.minimal:hover,
733 -.dark .fern-header .fern-button.minimal:focus-visible {
734 - background-color: rgba(247, 244, 240, 0.08);
735 -}
736 -
737 -.fern-header-actions {
738 - display: flex;
739 - align-items: center;
740 - gap: var(--space-sm);
741 -}
742 -
743 -.fern-header .fern-button.minimal {
744 - color: var(--accent-primary) !important;
745 - font-weight: 500 !important;
746 - padding: 0 !important;
747 - text-decoration: underline;
748 - text-decoration-color: rgba(255, 120, 47, 0.4);
749 -}
750 -
751 -.dark .fern-header .fern-button.minimal[href*="platform.composio.dev"] {
752 - color: var(--accent-primary) !important;
753 -}
\ No newline at end of file
fern/assets/logo-dark.svg deleted
-19
@@ -1,19 +0,0 @@
1 -<svg width="677" height="123" viewBox="0 0 677 123" fill="none" xmlns="http://www.w3.org/2000/svg">
2 -<g clip-path="url(#clip0_2_396)">
3 -<path d="M102.18 33.85L34.5023 20.0087C30.0648 19.0977 25.8918 22.5065 25.8918 27.0322V59.0936V60.798V92.859C25.8918 97.3847 30.0648 100.794 34.5023 99.8829L102.18 86.0415" stroke="white" stroke-width="3.43015" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
4 -<path d="M49.9235 8.87123C49.9237 2.51319 56.4226 -1.73892 62.2423 0.695182L62.5192 0.816015L62.5254 0.819543L98.7302 17.5403C101.908 18.9726 103.899 22.1461 103.9 25.592V39.7567C103.9 44.9242 99.4988 49.0053 94.3571 48.6075L53.3536 45.5471V74.344L94.3508 71.2834L94.8313 71.2588C99.7553 71.1388 103.898 75.1151 103.869 80.1051V94.2698C103.869 97.7424 101.825 100.869 98.7059 102.32L98.7004 102.321L62.5263 119.012L62.5272 119.013C56.6282 121.743 49.9235 117.443 49.9235 110.962V97.4634C49.6577 97.5681 49.3731 97.6377 49.0742 97.6594L29.0653 99.0999C27.3934 99.22 25.9707 97.8951 25.9704 96.2188V81.3638C25.9705 80.7879 26.1425 80.2477 26.4379 79.7929L9.97728 81.0225H9.97114C4.84357 81.386 0.435072 77.3177 0.435059 72.1708V47.7202C0.435428 42.5512 4.83999 38.4682 9.98351 38.8695H9.98261L26.079 40.0708C26.0092 39.8222 25.9705 39.5609 25.9704 39.2911V23.6428C25.9704 21.3581 28.0142 19.6154 30.2702 19.9764L49.3229 23.0246C49.5323 23.0581 49.7328 23.1153 49.9235 23.1903V8.87123ZM94.6182 74.7039H94.6118L53.3536 77.7837V95.6878L100.44 85.8461V80.0928L100.435 79.8018C100.294 76.8093 97.6708 74.4657 94.6182 74.7039ZM25.3089 43.4532C25.5967 43.9033 25.7639 44.4367 25.764 45.0063V75.413C25.764 75.7655 25.6979 76.1031 25.5815 76.4166L49.9235 74.5998V45.2904L25.3089 43.4532ZM53.3536 42.1073L94.6118 45.1872L94.6182 45.1881L94.9108 45.2031C97.9282 45.2766 100.47 42.8343 100.47 39.7567V33.8024L53.3536 23.9533V42.1073Z" fill="white"/>
5 -</g>
6 -<path d="M645.482 102.441C626.178 102.441 614.085 89.4608 614.085 71.044C614.085 52.5164 626.178 39.5359 645.482 39.5359C664.787 39.5359 676.88 52.5164 676.88 71.044C676.88 89.4608 664.787 102.441 645.482 102.441ZM645.482 90.903C654.691 90.903 659.572 83.2479 659.572 71.044C659.572 58.7292 654.691 51.0741 645.482 51.0741C636.274 51.0741 631.392 58.7292 631.392 71.044C631.392 83.2479 636.274 90.903 645.482 90.903Z" fill="white"/>
7 -<path d="M607.739 32.7689H590.21V16.793H607.739V32.7689ZM607.407 101.111H590.432V40.8678H607.407V101.111Z" fill="white"/>
8 -<path d="M555.782 102.441C540.915 102.441 529.821 96.1174 527.713 82.9151H544.799C546.019 89.017 551.122 90.903 556.448 90.903C563.881 90.903 567.875 88.4623 567.875 84.5792C567.875 80.9181 565.434 79.1429 557.224 77.2569L546.574 74.9271C535.146 72.4863 528.934 67.161 528.934 58.1745C528.934 46.7473 540.694 39.5359 555.116 39.5359C568.762 39.5359 580.19 45.194 582.852 56.8432H565.767C564.436 53.0711 560.109 51.0741 555.227 51.0741C549.791 51.0741 545.131 53.0711 545.131 56.8432C545.131 60.2824 548.571 61.6138 554.783 62.9451L565.434 65.2749C578.082 68.0485 584.073 73.4848 584.073 83.2479C584.073 95.5627 571.869 102.441 555.782 102.441Z" fill="white"/>
9 -<path d="M493.572 102.441C474.268 102.441 462.175 89.4608 462.175 71.044C462.175 52.5164 474.268 39.5359 493.572 39.5359C512.877 39.5359 524.969 52.5164 524.969 71.044C524.969 89.4608 512.877 102.441 493.572 102.441ZM493.572 90.903C502.781 90.903 507.662 83.2479 507.662 71.044C507.662 58.7292 502.781 51.0741 493.572 51.0741C484.364 51.0741 479.482 58.7292 479.482 71.044C479.482 83.2479 484.364 90.903 493.572 90.903Z" fill="white"/>
10 -<path d="M433.747 39.5359C448.613 39.5359 458.598 52.9601 458.598 71.044C458.598 89.1279 448.613 102.441 433.747 102.441C424.427 102.441 416.994 96.7831 413.777 89.017V122.855H396.913V40.8672H413.777V54.4024C416.44 46.5254 423.207 39.5359 433.747 39.5359ZM427.201 90.903C436.409 90.903 441.291 83.2479 441.291 71.044C441.291 58.7292 436.409 51.0741 427.201 51.0741C417.993 51.0741 413.111 58.7292 413.111 71.044C413.111 83.2479 417.993 90.903 427.201 90.903Z" fill="white"/>
11 -<path d="M368.273 39.5359C381.808 39.5359 387.577 49.4099 387.577 62.9451V63.167V101.11H370.603V66.8281V66.6063C370.603 56.1775 367.386 51.4069 360.396 51.4069C353.407 51.4069 350.078 56.1775 350.078 66.8281V101.11H333.104V66.8281V66.6063C333.104 56.1775 329.886 51.4069 322.897 51.4069C315.908 51.4069 312.579 56.1775 312.579 66.8281V101.11H295.605V40.8672H312.468V53.182C315.353 45.7488 320.789 39.5359 330.996 39.5359C341.425 39.5359 347.194 46.5254 349.302 54.1805C351.964 46.8582 357.733 39.5359 368.273 39.5359Z" fill="white"/>
12 -<path d="M257.697 102.441C238.393 102.441 226.3 89.4608 226.3 71.044C226.3 52.5164 238.393 39.5359 257.697 39.5359C277.002 39.5359 289.094 52.5164 289.094 71.044C289.094 89.4608 277.002 102.441 257.697 102.441ZM257.697 90.903C266.906 90.903 271.787 83.2479 271.787 71.044C271.787 58.7292 266.906 51.0741 257.697 51.0741C248.489 51.0741 243.607 58.7292 243.607 71.044C243.607 83.2479 248.489 90.903 257.697 90.903Z" fill="white"/>
13 -<path d="M183.931 102.443C160.633 102.443 142.771 85.801 142.771 58.9525C142.771 32.215 160.522 15.4624 184.042 15.4624C204.012 15.4624 219.322 26.6678 223.76 45.5283H205.454C202.237 36.4308 195.802 29.3304 184.042 29.3304C170.063 29.3304 160.855 40.9796 160.855 58.9525C160.855 77.0364 170.396 88.5746 184.042 88.5746C195.136 88.5746 202.57 82.6946 206.009 72.1549H224.315C218.768 93.0124 203.568 102.443 183.931 102.443Z" fill="white"/>
14 -<defs>
15 -<clipPath id="clip0_2_396">
16 -<rect width="103.863" height="120.12" fill="white" transform="translate(0.435059)"/>
17 -</clipPath>
18 -</defs>
19 -</svg>
fern/assets/logo.svg deleted
-19
@@ -1,19 +0,0 @@
1 -<svg width="677" height="123" viewBox="0 0 677 123" fill="none" xmlns="http://www.w3.org/2000/svg">
2 -<g clip-path="url(#clip0_2_368)">
3 -<path d="M101.745 33.85L34.0672 20.0087C29.6297 19.0977 25.4568 22.5065 25.4568 27.0322V59.0936V60.798V92.859C25.4568 97.3847 29.6297 100.794 34.0672 99.8829L101.745 86.0415" stroke="black" stroke-width="3.43015" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
4 -<path d="M49.4884 8.87123C49.4886 2.51319 55.9876 -1.73892 61.8072 0.695182L62.0842 0.816015L62.0903 0.819543L98.2952 17.5403C101.472 18.9726 103.464 22.1461 103.465 25.592V39.7567C103.465 44.9242 99.0638 49.0053 93.9221 48.6075L52.9185 45.5471V74.344L93.9158 71.2834L94.3962 71.2588C99.3203 71.1388 103.463 75.1151 103.434 80.1051V94.2698C103.434 97.7424 101.39 100.869 98.2708 102.32L98.2654 102.321L62.0912 119.012L62.0921 119.013C56.1931 121.743 49.4884 117.443 49.4884 110.962V97.4634C49.2226 97.5681 48.9381 97.6377 48.6391 97.6594L28.6303 99.0999C26.9584 99.22 25.5356 97.8951 25.5353 96.2188V81.3638C25.5354 80.7879 25.7074 80.2477 26.0028 79.7929L9.54222 81.0225H9.53608C4.40851 81.386 1.332e-05 77.3177 0 72.1708V47.7202C0.000369179 42.5512 4.40493 38.4682 9.54846 38.8695H9.54755L25.6439 40.0708C25.5742 39.8222 25.5354 39.5609 25.5353 39.2911V23.6428C25.5353 21.3581 27.5792 19.6154 29.8351 19.9764L48.8878 23.0246C49.0973 23.0581 49.2977 23.1153 49.4884 23.1903V8.87123ZM94.1831 74.7039H94.1768L52.9185 77.7837V95.6878L100.005 85.8461V80.0928L99.9994 79.8018C99.8586 76.8093 97.2358 74.4657 94.1831 74.7039ZM24.8739 43.4532C25.1616 43.9033 25.3289 44.4367 25.329 45.0063V75.413C25.329 75.7655 25.2629 76.1031 25.1464 76.4166L49.4884 74.5998V45.2904L24.8739 43.4532ZM52.9185 42.1073L94.1768 45.1872L94.1831 45.1881L94.4757 45.2031C97.4932 45.2766 100.035 42.8343 100.035 39.7567V33.8024L52.9185 23.9533V42.1073Z" fill="black"/>
5 -</g>
6 -<path d="M645.048 102.086C625.743 102.086 613.65 89.1053 613.65 70.6886C613.65 52.1609 625.743 39.1804 645.048 39.1804C664.352 39.1804 676.445 52.1609 676.445 70.6886C676.445 89.1053 664.352 102.086 645.048 102.086ZM645.048 90.5476C654.256 90.5476 659.138 82.8924 659.138 70.6886C659.138 58.3738 654.256 50.7186 645.048 50.7186C635.839 50.7186 630.958 58.3738 630.958 70.6886C630.958 82.8924 635.839 90.5476 645.048 90.5476Z" fill="black"/>
7 -<path d="M607.305 32.4135H589.775V16.4375H607.305V32.4135ZM606.972 100.755H589.997V40.5124H606.972V100.755Z" fill="black"/>
8 -<path d="M555.346 102.086C540.48 102.086 529.386 95.7619 527.278 82.5596H544.363C545.583 88.6615 550.687 90.5476 556.012 90.5476C563.445 90.5476 567.439 88.1068 567.439 84.2238C567.439 80.5626 564.999 78.7875 556.789 76.9014L546.138 74.5716C534.711 72.1308 528.498 66.8055 528.498 57.819C528.498 46.3918 540.258 39.1804 554.681 39.1804C568.327 39.1804 579.754 44.8386 582.417 56.4877H565.331C564 52.7156 559.673 50.7186 554.792 50.7186C549.355 50.7186 544.696 52.7156 544.696 56.4877C544.696 59.927 548.135 61.2583 554.348 62.5896L564.999 64.9195C577.646 67.6931 583.637 73.1293 583.637 82.8924C583.637 95.2072 571.433 102.086 555.346 102.086Z" fill="black"/>
9 -<path d="M493.137 102.086C473.833 102.086 461.74 89.1053 461.74 70.6886C461.74 52.1609 473.833 39.1804 493.137 39.1804C512.441 39.1804 524.534 52.1609 524.534 70.6886C524.534 89.1053 512.441 102.086 493.137 102.086ZM493.137 90.5476C502.346 90.5476 507.227 82.8924 507.227 70.6886C507.227 58.3738 502.346 50.7186 493.137 50.7186C483.929 50.7186 479.047 58.3738 479.047 70.6886C479.047 82.8924 483.929 90.5476 493.137 90.5476Z" fill="black"/>
10 -<path d="M433.312 39.1804C448.178 39.1804 458.163 52.6047 458.163 70.6886C458.163 88.7725 448.178 102.086 433.312 102.086C423.992 102.086 416.559 96.4276 413.342 88.6615V122.499H396.478V40.5117H413.342V54.0469C416.004 46.1699 422.772 39.1804 433.312 39.1804ZM426.766 90.5476C435.974 90.5476 440.856 82.8924 440.856 70.6886C440.856 58.3738 435.974 50.7186 426.766 50.7186C417.558 50.7186 412.676 58.3738 412.676 70.6886C412.676 82.8924 417.558 90.5476 426.766 90.5476Z" fill="black"/>
11 -<path d="M367.839 39.1804C381.374 39.1804 387.143 49.0544 387.143 62.5896V62.8115V100.754H370.168V66.4727V66.2508C370.168 55.822 366.951 51.0514 359.962 51.0514C352.972 51.0514 349.644 55.822 349.644 66.4727V100.754H332.669V66.4727V66.2508C332.669 55.822 329.452 51.0514 322.462 51.0514C315.473 51.0514 312.145 55.822 312.145 66.4727V100.754H295.17V40.5117H312.034V52.8265C314.918 45.3933 320.354 39.1804 330.561 39.1804C340.99 39.1804 346.759 46.1699 348.867 53.825C351.53 46.5027 357.299 39.1804 367.839 39.1804Z" fill="black"/>
12 -<path d="M257.262 102.086C237.958 102.086 225.865 89.1053 225.865 70.6886C225.865 52.1609 237.958 39.1804 257.262 39.1804C276.566 39.1804 288.659 52.1609 288.659 70.6886C288.659 89.1053 276.566 102.086 257.262 102.086ZM257.262 90.5476C266.47 90.5476 271.352 82.8924 271.352 70.6886C271.352 58.3738 266.47 50.7186 257.262 50.7186C248.054 50.7186 243.172 58.3738 243.172 70.6886C243.172 82.8924 248.054 90.5476 257.262 90.5476Z" fill="black"/>
13 -<path d="M183.496 102.087C160.198 102.087 142.336 85.4455 142.336 58.597C142.336 31.8595 160.087 15.1069 183.607 15.1069C203.577 15.1069 218.887 26.3123 223.325 45.1728H205.019C201.802 36.0754 195.367 28.975 183.607 28.975C169.628 28.975 160.42 40.6241 160.42 58.597C160.42 76.6809 169.961 88.2191 183.607 88.2191C194.701 88.2191 202.135 82.3391 205.574 71.7994H223.88C218.332 92.6569 203.133 102.087 183.496 102.087Z" fill="black"/>
14 -<defs>
15 -<clipPath id="clip0_2_368">
16 -<rect width="103.863" height="120.12" fill="white"/>
17 -</clipPath>
18 -</defs>
19 -</svg>
fern/assets/videos/enabling-triggers.mp4
Binary files a/fern/assets/videos/enabling-triggers.mp4 and /dev/null differ
fern/components/authors-container.tsx deleted
-21
@@ -1,21 +0,0 @@
1 -export interface Author {
2 - name: string;
3 - imageSrc: string;
4 -}
5 -
6 -export const AuthorsContainer = ({ authors }: { authors: Author[] }) => {
7 - return (
8 - <div className="authors-container">
9 - {authors.map((author, i) => (
10 - <div className="author-container" key={i}>
11 - <img
12 - className="author-image"
13 - src={author.imageSrc}
14 - alt={author.name}
15 - />
16 - <span className="author-name">{author.name}</span>
17 - </div>
18 - ))}
19 - </div>
20 - );
21 -};
fern/components/cards-container.tsx deleted
-15
@@ -1,15 +0,0 @@
1 -import { SimpleCard, SimpleCardProps } from "./simple-card";
2 -
3 -export interface CardsContainerProps {
4 - cards: SimpleCardProps[];
5 -}
6 -
7 -export function CardsContainer({ cards }: CardsContainerProps) {
8 - return (
9 - <div className="cards-container">
10 - {cards.map((card, index) => (
11 - <SimpleCard key={index} {...card} />
12 - ))}
13 - </div>
14 - );
15 -}
fern/components/cookbook-header.tsx deleted
-75
@@ -1,75 +0,0 @@
1 -export const CookbookHeader = ({ href }: { href: string }) => {
2 - return (
3 - <div className="cookbook-nav-container">
4 - <a
5 - href="/page/cookbooks"
6 - className="back-button group inline-block cursor-pointer font-medium "
7 - rel="noreferrer"
8 - target="_self"
9 - >
10 - <div className="pr-1 inline-block group-hover:no-underline">
11 - <svg
12 - width="11.8"
13 - height="11"
14 - viewBox="0 0 14 13"
15 - fill="none"
16 - xmlns="http://www.w3.org/2000/svg"
17 - >
18 - <path
19 - d="M1.1554 7.20808C1.35066 7.40335 1.66724 7.40335 1.8625 7.20808L7.18477 1.88582C7.38003 1.69055 7.38003 1.37397 7.18477 1.17871L6.83121 0.825157C6.63595 0.629895 6.31937 0.629896 6.12411 0.825157L0.801842 6.14742C0.60658 6.34269 0.60658 6.65927 0.801842 6.85453L1.1554 7.20808Z"
20 - fill="currentColor"
21 - />
22 - <path
23 - d="M1.1554 5.79226C1.35066 5.597 1.66724 5.597 1.8625 5.79226L7.18477 11.1145C7.38003 11.3098 7.38003 11.6264 7.18477 11.8216L6.83121 12.1752C6.63595 12.3705 6.31937 12.3705 6.12411 12.1752L0.801842 6.85292C0.60658 6.65766 0.60658 6.34108 0.801842 6.14582L1.1554 5.79226Z"
24 - fill="currentColor"
25 - />
26 - <path
27 - d="M2.52491 6.23674C2.52492 5.9606 2.74878 5.73675 3.02491 5.73675H6.28412C6.4513 5.73675 6.60742 5.8203 6.70015 5.95941L7.03347 6.45941C7.25499 6.79169 7.01679 7.23675 6.61745 7.23675H3.0249C2.74876 7.23675 2.5249 7.01289 2.5249 6.73674L2.52491 6.23674Z"
28 - fill="currentColor"
29 - />
30 - <path
31 - d="M13.5517 6.73676C13.5517 7.0129 13.3278 7.23675 13.0517 7.23675H8.79246C8.62528 7.23675 8.46916 7.1532 8.37643 7.0141L8.04311 6.5141C7.8216 6.18182 8.05979 5.73675 8.45914 5.73675H13.0517C13.3278 5.73675 13.5517 5.96062 13.5517 6.23676L13.5517 6.73676Z"
32 - fill="currentColor"
33 - />
34 - </svg>
35 - </div>
36 - Back to Cookbooks
37 - </a>
38 -
39 - <a
40 - href={href}
41 - className="github-button group inline-block cursor-pointer font-medium "
42 - rel="noreferrer"
43 - target="_blank"
44 - >
45 - Open in GitHub
46 - <div className="pl-1 inline-block group-hover:no-underline">
47 - <svg
48 - width="14"
49 - height="10"
50 - viewBox="0 0 14 10"
51 - fill="none"
52 - xmlns="http://www.w3.org/2000/svg"
53 - >
54 - <path
55 - d="M8.63218 0.366821C8.35604 0.366821 8.13218 0.590679 8.13218 0.866821V8.39364C8.13218 8.66978 8.35604 8.89364 8.63218 8.89364H9.13218C9.40832 8.89364 9.63218 8.66978 9.63218 8.39364V0.866821C9.63218 0.590678 9.40832 0.366821 9.13218 0.366821H8.63218Z"
56 - fill="currentColor"
57 - />
58 - <path
59 - d="M9.63332 1.36796C9.63332 1.6441 9.40946 1.86796 9.13332 1.86796H1.6065C1.33035 1.86796 1.1065 1.6441 1.1065 1.36796V0.867956C1.1065 0.591813 1.33035 0.367956 1.6065 0.367956H9.13332C9.40946 0.367956 9.63332 0.591813 9.63332 0.867956V1.36796Z"
60 - fill="currentColor"
61 - />
62 - <path
63 - d="M8.35063 2.02206C8.54588 2.21732 8.54588 2.5339 8.35062 2.72916L6.04601 5.03377C5.9278 5.15198 5.75833 5.20329 5.59439 5.1705L5.00515 5.05264C4.61356 4.97432 4.46728 4.49118 4.74966 4.2088L7.28997 1.66849C7.48523 1.47323 7.80182 1.47323 7.99708 1.6685L8.35063 2.02206Z"
64 - fill="currentColor"
65 - />
66 - <path
67 - d="M0.199967 9.46558C0.0047119 9.27032 0.0047151 8.95374 0.199974 8.75848L3.21169 5.74677C3.3299 5.62855 3.49938 5.57724 3.66331 5.61003L4.25256 5.72789C4.64414 5.80621 4.79042 6.28935 4.50804 6.57173L1.26063 9.81915C1.06536 10.0144 0.748774 10.0144 0.553513 9.81914L0.199967 9.46558Z"
68 - fill="currentColor"
69 - />
70 - </svg>
71 - </div>
72 - </a>
73 - </div>
74 - );
75 -};
fern/components/secondary-title-container.tsx deleted
-24
@@ -1,24 +0,0 @@
1 -import { PropsWithChildren } from "react";
2 -
3 -interface SecondaryTitleContainerProps {
4 - id?: string;
5 - title: string;
6 - description: string;
7 -}
8 -
9 -export function SecondaryTitleContainer({
10 - id,
11 - title,
12 - description,
13 - children,
14 -}: PropsWithChildren<SecondaryTitleContainerProps>) {
15 - return (
16 - <div className="page-secondary-title-container">
17 - <h2 id={id} className="h2-title page-title mb-6">
18 - {title}
19 - </h2>
20 - <p className="p-base page-blurb mb-6">{description}</p>
21 - {children}
22 - </div>
23 - );
24 -}
fern/components/simple-card.tsx deleted
-60
@@ -1,60 +0,0 @@
1 -import { ReactElement } from "react";
2 -import ArrowRightIcon from "../icons/arrow-right";
3 -import { type Author, AuthorsContainer } from "./authors-container";
4 -
5 -export interface SimpleCardProps {
6 - title: string;
7 - description: string;
8 - imageSrc: string;
9 - tags: string[];
10 - href: string;
11 - authors?: Author[];
12 -}
13 -
14 -export function SimpleCard({
15 - title,
16 - description,
17 - imageSrc,
18 - tags,
19 - href,
20 - authors,
21 -}: SimpleCardProps): ReactElement {
22 - return (
23 - <div className="simple-card-container">
24 - <a
25 - href={href}
26 - target="_blank"
27 - className="flex flex-1 flex-col justify-stretch"
28 - >
29 - <img className="image-desktop w-full" src={imageSrc} />
30 - <img className="image-mobile w-full" src={imageSrc} />
31 - <div className="simple-card-text-and-link-container">
32 - <div className="simple-card-text-container">
33 - <div className="small-tag-container">
34 - {tags.map((tag, idx) => (
35 - <span key={idx} className="small-tag-light dark:small-tag-dark">
36 - {tag}
37 - </span>
38 - ))}
39 - </div>
40 - <p className="h4-title simple-card-title">{title}</p>
41 - <p className="p-title">{description}</p>
42 - {authors != null && authors.length > 0 && (
43 - <AuthorsContainer authors={authors} />
44 - )}
45 - </div>
46 - <div className="simple-card-link-container">
47 - <div className="flex items-center">
48 - <span className="group inline-block cursor-pointer font-medium text-[#39594D] dark:text-[#517B6A] hover:text-black dark:hover:text-white">
49 - Build this
50 - <span className="ml-2 inline-block group-hover:no-underline">
51 - <ArrowRightIcon />
52 - </span>
53 - </span>
54 - </div>
55 - </div>
56 - </div>
57 - </a>
58 - </div>
59 - );
60 -}
fern/custom.js deleted
-9
@@ -1,9 +0,0 @@
1 -// Decimal chat widget
2 -(function() {
3 - var s = document.createElement('script');
4 - s.src = 'https://app.getdecimal.ai/widget/v1/widget.js';
5 - s.setAttribute('data-widget-id', 'wgt_Ze0kCx97w7YXIydXpEAbAVWfu7FO6HG1');
6 - s.setAttribute('data-public-config', 'eyJhbGciOiJIUzI1NiJ9.eyJ3aWQiOiJ3Z3RfWmUwa0N4OTd3N1lYSXlkWHBFQWJBVldmdTdGTzZIRzEiLCJkb21haW5zIjpbImNvbXBvc2lvLmRldiIsImNvbXBvc2lvLWRlY2ltYWwudmVyY2VsLmFwcCIsImxvY2FsaG9zdDozMDAwIiwiZG9jcy5jb21wb3Npby5kZXYiXSwiaWF0IjoxNzY3Mzc2ODkyfQ.Aflg_XVLCmd2tY9P9h4YWle2FKA_DRZFLBhp0yClJCE');
7 - s.async = true;
8 - document.head.appendChild(s);
9 -})();
\ No newline at end of file
fern/docs.yml deleted
-492
@@ -1,492 +0,0 @@
1 -instances:
2 -- url: v3composio.docs.buildwithfern.com
3 - custom-domain: docs.composio.dev
4 -title: Composio Docs
5 -default-language: python
6 -logo:
7 - light: assets/logo.svg
8 - dark: assets/logo-dark.svg
9 - height: 16
10 - href: /
11 -favicon: assets/favicon.png
12 -typography:
13 - bodyFont:
14 - name: Inter
15 - paths:
16 - - path: assets/Inter-Medium.woff2
17 - weight: '500'
18 - headingsFont:
19 - name: Inter
20 - paths:
21 - - path: assets/Inter-Medium.woff2
22 - weight: '500'
23 - codeFont:
24 - name: IBM Plex Mono
25 - paths:
26 - - path: assets/IBMPlexMono-Light.ttf
27 - weight: '400'
28 -navbar-links:
29 -- type: minimal
30 - text: Status
31 - url: https://status.composio.dev/
32 -- type: outlined
33 - text: Dashboard
34 - rightIcon: fa-light fa-arrow-up-right
35 - url: https://platform.composio.dev/auth
36 -layout:
37 - page-width: full
38 - content-width: 60rem
39 - tabs-placement: header
40 - searchbar-placement: header
41 - header-height: 64px
42 - sidebar-width: 255px
43 -settings:
44 - hide-404-page: true
45 - http-snippets: true
46 -js:
47 - - path: ./custom.js
48 -colors:
49 - accent-primary:
50 - light: '#FF782F'
51 - dark: '#FF9233'
52 - background:
53 - light: '#F7F4F0'
54 - dark: '#0F0602'
55 - sidebar-background:
56 - light: '#F7F4F0'
57 - dark: '#0F0602'
58 - header-background:
59 - light: '#F7F4F0'
60 - dark: '#0F0602'
61 -analytics:
62 - posthog:
63 - api-key: ${POSTHOG_API_KEY}
64 -redirects:
65 -- source: /tools/:path
66 - destination: /toolkits/:path
67 -- source: /changelog
68 - destination: /docs/changelog
69 -- source: /changelog/:date
70 - destination: /docs/changelog/:date
71 -- source: /sdk-reference/python
72 - destination: /python
73 -- source: /sdk-reference/python/:path
74 - destination: /python/:path
75 -- source: /sdk-reference/type-script
76 - destination: /type-script
77 -- source: /sdk-reference/type-script/:path
78 - destination: /type-script/:path
79 -- source: /docs/tool-router/quick-start
80 - destination: /docs/tool-router/quick-start-deprecated
81 -tabs:
82 - docs:
83 - display-name: Docs
84 - slug: docs
85 - tool-router:
86 - display-name: Tool Router
87 - icon: fa-light fa-sparkles
88 - slug: tool-router
89 - providers:
90 - display-name: Providers
91 - skip-slug: true
92 - toolkits:
93 - display-name: Toolkits
94 - skip-slug: true
95 - api-reference:
96 - display-name: API Reference
97 - skip-slug: true
98 - examples:
99 - display-name: Examples
100 - skip-slug: true
101 -navigation:
102 -- tab: docs
103 - layout:
104 - - section: Get Started
105 - icon: fa-light fa-rocket
106 - skip-slug: true
107 - contents:
108 - - page: Welcome
109 - path: pages/dist/get-started/welcome.mdx
110 - slug: welcome
111 - - page: Quickstart
112 - path: pages/dist/get-started/quickstart.mdx
113 - slug: quickstart
114 - - page: IDE and Agent Setup
115 - path: pages/dist/get-started/dev-setup.mdx
116 - slug: dev-setup
117 - - page: Providers
118 - path: pages/dist/get-started/providers.mdx
119 - slug: providers
120 - - changelog: ./pages/src/changelog
121 - title: Changelog
122 - slug: changelog
123 - - section: Capabilities
124 - icon: fa-light fa-layer-group
125 - skip-slug: true
126 - contents:
127 - - link: Tool Router
128 - href: /tool-router/overview
129 - - page: Managed Authentication
130 - path: pages/dist/capabilities/managed-authentication.mdx
131 - slug: managed-authentication
132 - - page: Tools
133 - path: pages/dist/capabilities/tools.mdx
134 - slug: tools
135 - - page: MCP
136 - path: pages/dist/capabilities/mcp.mdx
137 - slug: mcp
138 - - page: Triggers
139 - path: pages/dist/capabilities/triggers.mdx
140 - slug: triggers
141 - - section: Tools and Triggers
142 - icon: fa-light fa-wrench
143 - skip-slug: true
144 - contents:
145 - - page: Fetching tools and schemas
146 - path: pages/dist/tools-and-triggers/fetching-tools.mdx
147 - slug: fetching-tools
148 - - page: Authenticating Tools
149 - path: pages/dist/tools-and-triggers/authenticating-tools.mdx
150 - slug: authenticating-tools
151 - - page: Executing Tools
152 - path: pages/dist/tools-and-triggers/executing-tools.mdx
153 - slug: executing-tools
154 - - page: Using Triggers
155 - path: pages/dist/tools-and-triggers/using-triggers.mdx
156 - slug: using-triggers
157 - - section: Modify tool behavior
158 - slug: tools/modify
159 - contents:
160 - - page: Modifying tool schemas
161 - path: pages/dist/tools-and-triggers/schema-modifiers.mdx
162 - slug: modifying-tool-schemas
163 - - page: Modifying tool inputs
164 - path: pages/dist/tools-and-triggers/before-execution-modifiers.mdx
165 - slug: modifying-tool-inputs
166 - - page: Modifying tool outputs
167 - path: pages/dist/tools-and-triggers/after-execution-modifiers.mdx
168 - slug: modifying-tool-outputs
169 - - page: Custom tools
170 - path: pages/dist/tools-and-triggers/custom-tools.mdx
171 - slug: custom-tools
172 - - page: Toolkit Versioning
173 - path: pages/dist/tools-and-triggers/toolkit-versioning.mdx
174 - slug: toolkit-versioning
175 - - section: Authentication
176 - icon: fa-light fa-key
177 - skip-slug: true
178 - contents:
179 - - page: Custom Auth Configs
180 - path: pages/dist/authentication/custom-auth-configs.mdx
181 - slug: custom-auth-configs
182 - - page: Programmatic Auth Configs
183 - path: pages/dist/authentication/programmatic-auth-configs.mdx
184 - slug: programmatic-auth-configs
185 - - page: Custom Auth Parameters
186 - path: pages/dist/authentication/custom-auth-params.mdx
187 - slug: custom-auth-params
188 - - page: Connected Accounts
189 - path: pages/dist/authentication/connected-accounts.mdx
190 - slug: connected-accounts
191 - - page: User Management
192 - path: pages/dist/authentication/user-management.mdx
193 - slug: user-management
194 - - section: MCP
195 - icon: fa-light fa-database
196 - skip-slug: true
197 - contents:
198 - - page: Quickstart
199 - path: pages/dist/mcp/quickstart.mdx
200 - slug: mcp-quickstart
201 - - page: Server management
202 - path: pages/dist/mcp/server-management.mdx
203 - slug: mcp-server-management
204 - - page: Providers
205 - path: pages/dist/mcp/providers.mdx
206 - slug: mcp-providers
207 - - section: Tool Router (Beta)
208 - icon: fa-light fa-flask
209 - skip-slug: true
210 - hidden: true
211 - contents:
212 - - page: Quick Start (Deprecated)
213 - path: pages/dist/tool-router/quick-start-deprecated.mdx
214 - slug: tool-router/quick-start-deprecated
215 - hidden: true
216 - - section: Resources
217 - icon: fa-light fa-book
218 - skip-slug: true
219 - contents:
220 - - page: CLI
221 - path: pages/dist/resources/cli.mdx
222 - slug: cli
223 - - page: Debugging Info
224 - path: pages/dist/resources/debugging-info.mdx
225 - slug: resources/debugging-info
226 - - section: Migration Guides
227 - slug: migration-guide
228 - contents:
229 - - page: Overview
230 - path: pages/dist/migration-guide/index.mdx
231 - slug: overview
232 - - page: New SDK Migration
233 - path: pages/dist/migration-guide/new-sdk.mdx
234 - slug: new-sdk
235 - - page: Toolkit Versioning Migration
236 - path: pages/dist/migration-guide/toolkit-versioning.mdx
237 - slug: toolkit-versioning
238 - - section: Troubleshooting
239 - slug: troubleshooting
240 - contents:
241 - - page: Overview
242 - path: pages/dist/resources/troubleshooting/overview.mdx
243 - slug: overview
244 - - page: API
245 - path: pages/dist/resources/troubleshooting/api.mdx
246 - slug: api
247 - - page: Authentication
248 - path: pages/dist/resources/troubleshooting/authentication.mdx
249 - slug: authentication
250 - - page: CLI
251 - path: pages/dist/resources/troubleshooting/cli.mdx
252 - slug: cli
253 - - page: Dashboard
254 - path: pages/dist/resources/troubleshooting/dashboard.mdx
255 - slug: dashboard
256 - - page: MCP
257 - path: pages/dist/resources/troubleshooting/mcp.mdx
258 - slug: mcp
259 - - page: SDKs
260 - path: pages/dist/resources/troubleshooting/sdks.mdx
261 - slug: sdks
262 - - page: Tools & Toolkits
263 - path: pages/dist/resources/troubleshooting/tools.mdx
264 - slug: tools
265 - - page: Triggers
266 - path: pages/dist/resources/troubleshooting/triggers.mdx
267 - slug: triggers
268 -- tab: tool-router
269 - layout:
270 - - section: Get Started
271 - icon: fa-light fa-rocket
272 - skip-slug: true
273 - contents:
274 - - page: Overview
275 - path: pages/dist/tool-router/overview.mdx
276 - slug: overview
277 - - page: Quickstart
278 - path: pages/dist/tool-router/quickstart.mdx
279 - slug: quickstart
280 - - section: Core Concepts
281 - icon: fa-light fa-brain
282 - skip-slug: true
283 - contents:
284 - - page: Users and Sessions
285 - path: pages/dist/tool-router/users-and-sessions.mdx
286 - slug: users-and-sessions
287 - - page: Authentication
288 - path: pages/dist/tool-router/authentication.mdx
289 - slug: authentication
290 - - page: Tools and Toolkits
291 - path: pages/dist/tool-router/tools-and-toolkits.mdx
292 - slug: tools-and-toolkits
293 - - section: Guides
294 - icon: fa-light fa-book
295 - skip-slug: true
296 - contents:
297 - - page: Using In-chat Authentication
298 - path: pages/dist/tool-router/using-in-chat-authentication.mdx
299 - slug: using-in-chat-authentication
300 - - page: Manually Authenticating Users
301 - path: pages/dist/tool-router/manually-authenticating-users.mdx
302 - slug: manually-authenticating-users
303 - - page: Managing Multiple Accounts for a User
304 - path: pages/dist/tool-router/managing-multiple-accounts.mdx
305 - slug: managing-multiple-accounts
306 - - page: White-labeling Authentication
307 - path: pages/dist/tool-router/white-labeling-authentication.mdx
308 - slug: white-labeling-authentication
309 - - page: Using Custom Auth Configs
310 - path: pages/dist/tool-router/using-custom-auth-configs.mdx
311 - slug: using-custom-auth-configs
312 - - page: Using with MCP Clients
313 - path: pages/dist/tool-router/using-with-mcp-clients.mdx
314 - slug: using-with-mcp-clients
315 - - page: Using as a native tool
316 - path: pages/dist/tool-router/using-as-a-native-tool.mdx
317 - slug: using-as-a-native-tool
318 - - section: Resources
319 - icon: fa-light fa-book
320 - skip-slug: true
321 - contents:
322 - - section: Migration Guides
323 - slug: migration-guide
324 - contents:
325 - - page: Beta to Stable Migration
326 - path: pages/dist/tool-router/migration/tool-router-beta-to-stable.mdx
327 - slug: tool-router/migration-guide/beta-to-stable
328 -- tab: providers
329 - layout:
330 - - section: Supported Providers
331 - contents:
332 - - page: OpenAI Provider
333 - path: pages/dist/providers/openai.mdx
334 - - page: Anthropic Provider
335 - path: pages/dist/providers/anthropic.mdx
336 - - page: Google Provider
337 - path: pages/dist/providers/google.mdx
338 - - page: LangChain Provider
339 - path: pages/dist/providers/langchain.mdx
340 - - page: LlamaIndex Provider
341 - path: pages/dist/providers/llamaindex.mdx
342 - - page: CrewAI Provider
343 - path: pages/dist/providers/crewai.mdx
344 - - page: Vercel AI SDK Provider
345 - path: pages/dist/providers/vercel.mdx
346 - - page: OpenAI Agents Provider
347 - path: pages/dist/providers/openai-agents.mdx
348 - - page: Mastra Provider
349 - path: pages/dist/providers/mastra.mdx
350 - - section: Writing your own provider
351 - skip-slug: true
352 - icon: fa-light fa-code
353 - contents:
354 - - page: TypeScript
355 - path: pages/dist/providers/ts-custom.mdx
356 - slug: providers/custom/typescript
357 - - page: Python
358 - path: pages/dist/providers/py-custom.mdx
359 - slug: providers/custom/python
360 -- tab: toolkits
361 - layout:
362 - - section: Toolkits
363 - skip-slug: true
364 - contents:
365 - - page: Introduction
366 - path: toolkits/src/introduction.mdx
367 - slug: toolkits/introduction
368 - - page: Premium Tools
369 - path: toolkits/src/premium-tools.mdx
370 - slug: toolkits/premium-tools
371 - - section: Important
372 - skip-slug: true
373 - contents:
374 - - page: Github
375 - slug: toolkits/github
376 - path: toolkits/github.mdx
377 - - page: Gmail
378 - slug: toolkits/gmail
379 - path: toolkits/gmail.mdx
380 - - page: Notion
381 - slug: toolkits/notion
382 - path: toolkits/notion.mdx
383 - - section: Scheduling & Booking
384 - skip-slug: true
385 - contents:
386 - - page: Google Calendar
387 - slug: toolkits/googlecalendar
388 - path: toolkits/googlecalendar.mdx
389 - - section: No Auth
390 - skip-slug: true
391 - contents:
392 - - page: Composio
393 - slug: toolkits/composio
394 - path: toolkits/composio.mdx
395 -- tab: api-reference
396 - layout:
397 - - section: REST API
398 - contents:
399 - - api: v3
400 - api-name: v3
401 - skip-slug: true
402 - paginated: false
403 - flattened: true
404 - - section: Python SDK
405 - slug: python
406 - icon: fa-brands fa-python
407 - contents:
408 - - page: Python SDK Reference
409 - slug: python-sdk-reference
410 - path: pages/dist/sdk/python/sdk-reference.md
411 - - section: TypeScript SDK
412 - slug: type-script
413 - icon: fa-brands fa-js
414 - contents:
415 - - section: Core Classes
416 - slug: core-classes
417 - contents:
418 - - page: Composio
419 - slug: composio
420 - path: pages/dist/sdk/typescript/composio/classes/Composio.mdx
421 - - page: ComposioProvider
422 - slug: composio-provider
423 - path: pages/dist/sdk/typescript/provider/ComposioProvider/classes/ComposioProvider.mdx
424 - - page: OpenAIProvider
425 - slug: open-ai-provider
426 - path: pages/dist/sdk/typescript/provider/OpenAIProvider/classes/OpenAIProvider.mdx
427 - - page: BaseAgenticProvider
428 - slug: base-agentic-provider
429 - path: pages/dist/sdk/typescript/provider/BaseProvider/classes/BaseAgenticProvider.mdx
430 - - page: BaseNonAgenticProvider
431 - slug: base-non-agentic-provider
432 - path: pages/dist/sdk/typescript/provider/BaseProvider/classes/BaseNonAgenticProvider.mdx
433 - - section: Models
434 - slug: models
435 - contents:
436 - - page: Tools
437 - slug: tools
438 - path: pages/dist/sdk/typescript/models/Tools/classes/Tools.mdx
439 - - page: Toolkits
440 - slug: toolkits
441 - path: pages/dist/sdk/typescript/models/Toolkits/classes/Toolkits.mdx
442 - - page: Triggers
443 - slug: triggers
444 - path: pages/dist/sdk/typescript/models/Triggers/classes/Triggers.mdx
445 - - page: AuthConfigs
446 - slug: auth-configs
447 - path: pages/dist/sdk/typescript/AuthConfigs/classes/AuthConfigs.mdx
448 - - page: ConnectedAccounts
449 - slug: connected-accounts
450 - path: pages/dist/sdk/typescript/ConnectedAccounts/classes/ConnectedAccounts.mdx
451 - - page: CustomTools
452 - slug: custom-tools
453 - path: pages/dist/sdk/typescript/CustomTools/classes/CustomTools.mdx
454 -- tab: examples
455 - layout:
456 - - section: Getting Started
457 - icon: fa-light fa-rocket
458 - skip-slug: true
459 - contents:
460 - - page: Basic FastAPI Server
461 - path: pages/dist/examples/fast-api.mdx
462 - slug: examples/fast-api
463 - - page: Basic Hono Server
464 - path: pages/dist/examples/hono.mdx
465 - slug: examples/hono
466 - - section: Productivity & Automation
467 - icon: fa-light fa-bolt
468 - skip-slug: true
469 - contents:
470 - - page: Gmail Labeller
471 - path: pages/dist/examples/utility_agents/gmail_labeler.mdx
472 - slug: examples/gmail-labeler
473 - - page: Slack summariser
474 - path: pages/dist/examples/utility_agents/slack_summariser.mdx
475 - slug: examples/slack-summariser
476 - - page: Supabase SQL Agent
477 - path: pages/dist/examples/utility_agents/supabase_sql_agent.mdx
478 - slug: examples/supabase-sql-agent
479 - - section: Full Stack Applications
480 - icon: fa-light fa-globe
481 - skip-slug: true
482 - contents:
483 - - page: Full Stack Chat App
484 - path: pages/dist/examples/chat_applications/vercel_chat.mdx
485 - slug: examples/vercel-chat
486 - - section: Behind the curtain
487 - icon: fa-light fa-person-booth
488 - skip-slug: true
489 - contents:
490 - - page: Tool Generator
491 - path: pages/dist/examples/tool-generator/tool-generator.mdx
492 - slug: examples/tool-generator
\ No newline at end of file
fern/fern.config.json deleted
-4
@@ -1,4 +0,0 @@
1 -{
2 - "organization": "composio",
3 - "version": "3.22.3"
4 -}
fern/generators/python_sdk/__init__.py deleted
-6
@@ -1,6 +0,0 @@
1 -"""
2 -Python SDK documentation generator for Composio.
3 -
4 -This module provides tools to generate SDK documentation from Python code
5 -using autodoc markers in markdown files.
6 -"""
\ No newline at end of file
fern/generators/python_sdk/autodoc_core/__init__.py deleted
-1
@@ -1 +0,0 @@
1 -# Empty init file to make this a package
\ No newline at end of file
fern/generators/python_sdk/autodoc_core/autodoc.py deleted
-635
@@ -1,635 +0,0 @@
1 -import importlib
2 -import inspect
3 -import json
4 -import re
5 -
6 -from .convert_md_to_mdx import convert_md_docstring_to_mdx
7 -from .convert_rst_to_mdx import convert_rst_docstring_to_mdx, find_indent, is_empty_line
8 -from .external import HUGGINFACE_LIBS, get_external_object_link
9 -
10 -
11 -def find_object_in_package(object_name, package):
12 - """
13 - Find an object from its name inside a given package.
14 -
15 - Args:
16 - - **object_name** (`str`) -- The name of the object to retrieve.
17 - - **package** (`types.ModuleType`) -- The package to look into.
18 - """
19 - path_splits = object_name.split(".")
20 - if path_splits[0] == package.__name__:
21 - path_splits = path_splits[1:]
22 -
23 - module = package
24 - for idx, split in enumerate(path_splits):
25 - submodule = getattr(module, split, None)
26 - if submodule is None:
27 - try:
28 - # Try importing at this level
29 - full_module_path = f"{module.__name__}.{split}"
30 - importlib.import_module(full_module_path)
31 - submodule = getattr(module, split, None)
32 - except ImportError:
33 - return None # Return None if the module cannot be found or imported
34 - module = submodule
35 - if module is None:
36 - return None
37 -
38 - return module
39 -
40 -
41 -def remove_example_tags(text):
42 - tags = ["<exampletitle>", "</exampletitle>", "<example>", "</example>"]
43 - for tag in tags:
44 - text = text.replace(tag, "")
45 - return text
46 -
47 -
48 -def get_shortest_path(obj, package):
49 - """
50 - Simplifies the path to `obj` to be the shortest possible, for instance if `obj` is in the main init of its
51 - package.
52 - """
53 - if isinstance(obj, property):
54 - # Properties have no __module__ or __name__ attributes, but their getter function does.
55 - obj = obj.fget
56 -
57 - if not hasattr(obj, "__module__") or obj.__module__ is None:
58 - return None
59 - long_path = obj.__module__
60 - # Sometimes methods are defined in another module from the class (flax.struct.dataclass)
61 - if not long_path.startswith(package.__name__):
62 - return None
63 - long_name = obj.__qualname__ if hasattr(obj, "__qualname__") else obj.__name__
64 - short_name = long_name.split(".")[0]
65 - path_splits = long_path.split(".")
66 - module = package
67 - idx = module.__name__.count(".")
68 - while idx + 1 < len(path_splits) and not hasattr(module, short_name):
69 - idx += 1
70 - module = getattr(module, path_splits[idx])
71 - return ".".join(path_splits[: idx + 1]) + "." + long_name
72 -
73 -
74 -def get_type_name(typ):
75 - """
76 - Returns the name of the type passed, properly dealing with type annotations.
77 - """
78 - if isinstance(typ, type):
79 - # If it's a class, use its name.
80 - return getattr(typ, "__qualname__", None) or getattr(typ, "__name__", None) or str(typ)
81 - return str(typ) # otherwise, trust its string representation
82 -
83 -
84 -def format_signature(obj):
85 - """
86 - Retrieves the signature of a class, function or method.
87 - Returns `List(Dict(str, str))` (i.e. [{'do_lower_case', ' = True'}, ...])
88 - where `key` of `Dict` is f'{param_name}' & `value` of `Dict` is f': {annotation} = {default}'
89 - """
90 - params = []
91 - if is_getset_descriptor(obj):
92 - return params
93 - try:
94 - signature = inspect.signature(obj)
95 - except ValueError:
96 - # TODO: This fails for ModelOutput. Check if this is normal.
97 - return ""
98 -
99 - for idx, param in enumerate(signature.parameters.values()):
100 - param_name = param.name
101 - if idx == 0 and param_name in ("self", "cls"):
102 - continue
103 - if param.kind == inspect._ParameterKind.VAR_POSITIONAL:
104 - param_name = f"*{param_name}"
105 - elif param.kind == inspect._ParameterKind.VAR_KEYWORD:
106 - param_name = f"**{param_name}"
107 - param_type_val = ""
108 - if param.annotation != inspect._empty:
109 - annotation = get_type_name(param.annotation)
110 - param_type_val += f": {annotation}"
111 - if param.default != inspect._empty:
112 - default = param.default
113 - default = repr(default)
114 - param_type_val += f" = {default}"
115 - params.append({"name": param_name, "val": param_type_val})
116 - return params
117 -
118 -
119 -_re_parameters = re.compile(r"<parameters>(.*)</parameters>", re.DOTALL)
120 -_re_returns = re.compile(r"<returns>(.*)</returns>", re.DOTALL)
121 -_re_returntype = re.compile(r"<returntype>(.*)</returntype>", re.DOTALL)
122 -_re_yields = re.compile(r"<yields>(.*)</yields>", re.DOTALL)
123 -_re_yieldtype = re.compile(r"<yieldtype>(.*)</yieldtype>", re.DOTALL)
124 -_re_example_tags = re.compile(r"(<exampletitle>|<example>)")
125 -_re_parameter_group = re.compile(r"^> (.*)$", re.MULTILINE)
126 -_re_raises = re.compile(r"<raises>(.*)</raises>", re.DOTALL)
127 -_re_raisederrors = re.compile(r"<raisederrors>(.*)</raisederrors>", re.DOTALL)
128 -
129 -
130 -def get_signature_component(name, anchor, signature, object_doc, source_link=None, is_getset_desc=False):
131 - """
132 - Returns the svelte `Docstring` component string.
133 -
134 - Args:
135 - - **name** (`str`) -- The name of the function or class to document.
136 - - **anchor** (`str`) -- The anchor name of the function or class that will be used for hash links.
137 - - **signature** (`List(Dict(str,str))`) -- The signature of the object.
138 - - **object_doc** (`str`) -- The docstring of the the object.
139 - - **source_link** (Union[`str`, `None`], *optional*, defaults to `None`) -- The github source link of the the object.
140 - - **is_getset_desc** (`bool`, *optional*, defaults to `False`) -- Whether the type of obj is `getset_descriptor`.
141 - """
142 -
143 - def inside_example_finder_closure(match, tag):
144 - """
145 - This closure find whether parameters and/or returns sections has example code block inside it
146 - """
147 - match_str = match.group(1)
148 - examples_inside = _re_example_tags.search(match_str)
149 - if examples_inside:
150 - example_tag = examples_inside.group(1)
151 - match_str = match_str.replace(example_tag, f"</{tag}>{example_tag}", 1)
152 - return f"<{tag}>{match_str}"
153 - return f"<{tag}>{match_str}</{tag}>"
154 -
155 - def regex_closure(object_doc, regex):
156 - """
157 - This closure matches given regex & removes the matched group from object_doc
158 - """
159 - re_match = regex.search(object_doc)
160 - object_doc = regex.sub("", object_doc)
161 - match = None
162 - if re_match:
163 - _match = re_match.group(1).strip()
164 - if len(_match):
165 - match = _match
166 - return object_doc, match
167 -
168 - object_doc = _re_returns.sub(lambda m: inside_example_finder_closure(m, "returns"), object_doc)
169 - object_doc = _re_parameters.sub(lambda m: inside_example_finder_closure(m, "parameters"), object_doc)
170 -
171 - object_doc, parameters = regex_closure(object_doc, _re_parameters)
172 - object_doc, return_description = regex_closure(object_doc, _re_returns)
173 - object_doc, returntype = regex_closure(object_doc, _re_returntype)
174 - object_doc, yield_description = regex_closure(object_doc, _re_yields)
175 - object_doc, yieldtype = regex_closure(object_doc, _re_yieldtype)
176 - object_doc, raise_description = regex_closure(object_doc, _re_raises)
177 - object_doc, raisederrors = regex_closure(object_doc, _re_raisederrors)
178 - object_doc = remove_example_tags(object_doc)
179 - object_doc = hashlink_example_codeblock(object_doc, anchor)
180 -
181 - svelte_str = "<docstring>"
182 - svelte_str += f"<name>{name}</name>"
183 - svelte_str += f"<anchor>{anchor}</anchor>"
184 - if source_link:
185 - svelte_str += f"<source>{source_link}</source>"
186 - svelte_str += f"<parameters>{json.dumps(signature)}</parameters>"
187 - if is_getset_desc:
188 - svelte_str += "<isgetsetdescriptor>"
189 -
190 - if parameters is not None:
191 - parameters_str = ""
192 - groups = _re_parameter_group.split(parameters)
193 - group_default = groups.pop(0)
194 - parameters_str += f"<paramsdesc>{group_default}</paramsdesc>"
195 - n_groups = len(groups) // 2
196 - for idx in range(n_groups):
197 - id = idx + 1
198 - title, group = groups[2 * idx], groups[2 * idx + 1]
199 - parameters_str += f"<paramsdesc{id}title>{title}</paramsdesc{id}title>"
200 - parameters_str += f"<paramsdesc{id}>{group}</paramsdesc{id}>"
201 -
202 - svelte_str += parameters_str
203 - svelte_str += f"<paramgroups>{n_groups}</paramgroups>"
204 -
205 - if returntype is not None:
206 - svelte_str += f"<rettype>{returntype}</rettype>"
207 - if return_description is not None:
208 - svelte_str += f"<retdesc>{return_description}</retdesc>"
209 -
210 - if yieldtype is not None:
211 - svelte_str += f"<yieldtype>{yieldtype}</yieldtype>"
212 - if yield_description is not None:
213 - svelte_str += f"<yielddesc>{yield_description}</yielddesc>"
214 -
215 - if raise_description is not None:
216 - svelte_str += f"<raises>{raise_description}</raises>"
217 - if raisederrors is not None:
218 - svelte_str += f"<raisederrors>{raisederrors}</raisederrors>"
219 -
220 - svelte_str += "</docstring>"
221 -
222 - return svelte_str + f"\n{object_doc}\n"
223 -
224 -
225 -# Re pattern to catch :obj:`xx`, :class:`xx`, :func:`xx` or :meth:`xx`.
226 -_re_rst_special_words = re.compile(r":(?:obj|func|class|meth):`([^`]+)`")
227 -# Re pattern to catch things between double backquotes.
228 -_re_double_backquotes = re.compile(r"(^|[^`])``([^`]+)``([^`]|$)")
229 -# Re pattern to catch example introduction.
230 -_re_rst_example = re.compile(r"^\s*Example.*::\s*$", flags=re.MULTILINE)
231 -
232 -
233 -def is_rst_docstring(docstring):
234 - """
235 - Returns `True` if `docstring` is written in rst.
236 - """
237 - if _re_rst_special_words.search(docstring) is not None:
238 - return True
239 - if _re_double_backquotes.search(docstring) is not None:
240 - return True
241 - if _re_rst_example.search(docstring) is not None:
242 - return True
243 - return False
244 -
245 -
246 -# Re pattern to catch example introduction & example code block.
247 -_re_example_codeblock = re.compile(r"((.*:\s+)?^```((?!```)(.|\n))*```)", re.MULTILINE)
248 -
249 -
250 -def hashlink_example_codeblock(object_doc, object_anchor):
251 - """
252 - Returns the svelte `ExampleCodeBlock` component string.
253 -
254 - Args:
255 - - **object_doc** (`str`) -- The docstring of the the object.
256 - - **anchor** (`str`) -- The anchor name of the function or class that will be used for hash links.
257 - """
258 -
259 - example_id = 0
260 -
261 - def add_example_svelte_blocks(match):
262 - """
263 - This closure matches `_re_example_codeblock` regex & creates `ExampleCodeBlock` svelte component
264 - """
265 - nonlocal example_id
266 -
267 - example_id += 1
268 - id_str = "" if example_id == 1 else f"-{example_id}"
269 - example_anchor = f"{object_anchor}.example{id_str}"
270 - return f'<ExampleCodeBlock anchor="{example_anchor}">\n\n{match.group(1)}\n\n</ExampleCodeBlock>'
271 -
272 - object_doc = _re_example_codeblock.sub(add_example_svelte_blocks, object_doc)
273 - return object_doc
274 -
275 -
276 -# Re pattern to numpystyle docstring (e.g Parameter -------).
277 -_re_numpydocstring = re.compile(r"(Parameter|Raise|Return|Yield)s?\n\s*----+\n")
278 -
279 -
280 -def is_numpy_docstring(docstring):
281 - """
282 - Returns `True` if `docstring` is written in numpystyle.
283 - """
284 - return _re_numpydocstring.search(docstring)
285 -
286 -
287 -def is_dataclass_autodoc(obj):
288 - """
289 - Returns boolean whether object's doc was generated automatically by `dataclass`.
290 - """
291 - if is_getset_descriptor(obj):
292 - return False
293 - try:
294 - signature = str(inspect.signature(obj))
295 - except ValueError:
296 - # object doesn't have signature
297 - return False
298 - doc = obj.__doc__
299 - doc_generated = obj.__name__ + signature
300 - is_generated = doc in doc_generated
301 - return is_generated
302 -
303 -
304 -def is_getset_descriptor(obj):
305 - """
306 - Returns boolean whether object is `getset_descriptor`.
307 - """
308 - # used by tokenizers @property bindings
309 - obj_repr = str(type(obj))
310 - return "getset_descriptor" in obj_repr
311 -
312 -
313 -def get_source_link(obj, page_info, version_tag_suffix="src/"):
314 - """
315 - Returns the link to the source code of an object on GitHub.
316 - """
317 - # Repo name defaults to package_name, but if provided in page_info, it will be used instead.
318 - repo_name = page_info.get("repo_name", page_info.get("package_name"))
319 - version_tag = page_info.get("version_tag", "next")
320 - repo_owner = page_info.get("repo_owner", "composiohq")
321 - base_link = f"https://github.com/{repo_owner}/{repo_name}/blob/{version_tag}/{version_tag_suffix}"
322 - module = obj.__module__.replace(".", "/")
323 - line_number = inspect.getsourcelines(obj)[1]
324 - source_file = inspect.getsourcefile(obj)
325 - if source_file.endswith("__init__.py"):
326 - return f"{base_link}{module}/__init__.py#L{line_number}"
327 - return f"{base_link}{module}.py#L{line_number}"
328 -
329 -
330 -def get_source_path(object_name, package):
331 - """
332 - Find a path to file in which given object was defined.
333 -
334 - Args:
335 - - object_name (`str`): The name of the object to retrieve.
336 - - package (`types.ModuleType`): The package to look into.
337 - """
338 - obj = obj = find_object_in_package(object_name=object_name, package=package)
339 - obj_path = inspect.getfile(obj)
340 - return obj_path
341 -
342 -
343 -def document_object(object_name, package, page_info, full_name=True, anchor_name=None, version_tag_suffix="src/"):
344 - """
345 - Writes the document of a function, class or method.
346 -
347 - Args:
348 - object_name (`str`): The name of the object to document.
349 - package (`types.ModuleType`): The package of the object.
350 - full_name (`bool`, *optional*, defaults to `True`): Whether to write the full name of the object or not.
351 - anchor_name (`str`, *optional*): The name to give to the anchor for this object.
352 - version_tag_suffix (`str`, *optional*, defaults to `"src/"`):
353 - Suffix to add after the version tag (e.g. 1.3.0 or main) in the documentation links.
354 - For example, the default `"src/"` suffix will result in a base link as `https://github.com/{repo_owner}/{package_name}/blob/{version_tag}/src/`.
355 - For example, `version_tag_suffix=""` will result in a base link as `https://github.com/{repo_owner}/{package_name}/blob/{version_tag}/`.
356 - """
357 - if page_info is None:
358 - page_info = {}
359 - if "package_name" not in page_info:
360 - page_info["package_name"] = package.__name__
361 - obj = find_object_in_package(object_name=object_name, package=package)
362 - if obj is None:
363 - raise ValueError(
364 - f"Unable to find {object_name} in {package.__name__}. Make sure the path to that object is correct."
365 - )
366 - if isinstance(obj, property):
367 - # Propreties have no __module__ or __name__ attributes, but their getter function does.
368 - obj = obj.fget
369 -
370 - if anchor_name is None:
371 - anchor_name = get_shortest_path(obj, package)
372 - if full_name and anchor_name is not None:
373 - name = anchor_name
374 - else:
375 - name = obj.__name__
376 -
377 - prefix = "class " if isinstance(obj, type) else ""
378 - object_doc = ""
379 - signature_name = prefix + name
380 - signature = format_signature(obj)
381 - check = None
382 - if getattr(obj, "__doc__", None) is not None and len(obj.__doc__) > 0:
383 - object_doc = obj.__doc__
384 - if is_dataclass_autodoc(obj):
385 - object_doc = ""
386 - elif is_rst_docstring(object_doc):
387 - object_doc = convert_rst_docstring_to_mdx(obj.__doc__, page_info)
388 - else:
389 - check = quality_check_docstring(object_doc, object_name=object_name)
390 - object_doc = convert_md_docstring_to_mdx(obj.__doc__, page_info)
391 -
392 - try:
393 - source_link = get_source_link(obj, page_info, version_tag_suffix)
394 - except (AttributeError, OSError, TypeError):
395 - # tokenizers obj do NOT have `__module__` attribute & can NOT be used with inspect.getsourcelines
396 - source_link = None
397 - is_getset_desc = is_getset_descriptor(obj)
398 - component = get_signature_component(
399 - signature_name, anchor_name, signature, object_doc, source_link, is_getset_desc
400 - )
401 - documentation = "\n" + component + "\n"
402 - return documentation, check
403 -
404 -
405 -def find_documented_methods(clas):
406 - """
407 - Find all the public methods of a given class that have a nonempty documentation, filtering the methods documented
408 - the exact same way in a superclass.
409 - """
410 - public_attrs = {a: getattr(clas, a) for a in dir(clas) if not a.startswith("_")}
411 - public_methods = {a: m for a, m in public_attrs.items() if callable(m) and not isinstance(m, type)}
412 - documented_methods = {
413 - a: m for a, m in public_methods.items() if getattr(m, "__doc__", None) is not None and len(m.__doc__) > 0
414 - }
415 -
416 - superclasses = clas.mro()[1:]
417 - for superclass in superclasses:
418 - superclass_methods = {a: getattr(superclass, a) for a in documented_methods.keys() if hasattr(superclass, a)}
419 - documented_methods = {
420 - a: m
421 - for a, m in documented_methods.items()
422 - if (
423 - a not in superclass_methods
424 - or getattr(superclass_methods[a], "__doc__", None) is None
425 - or m.__doc__ != superclass_methods[a].__doc__
426 - )
427 - }
428 - return list(documented_methods.keys())
429 -
430 -
431 -docstring_css_classes = "docstring border-l-2 border-t-2 pl-4 pt-3.5 border-gray-100 rounded-tl-xl mb-6 mt-8"
432 -
433 -
434 -def autodoc(object_name, package, methods=None, return_anchors=False, page_info=None, version_tag_suffix="python/"):
435 - """
436 - Generates the documentation of an object, with a potential filtering on the methods for a class.
437 -
438 - Args:
439 - object_name (`str`): The name of the function or class to document.
440 - package (`types.ModuleType`): The package of the object.
441 - methods (`List[str]`, *optional*):
442 - A list of methods to document if `obj` is a class. If nothing is passed, all public methods with a new
443 - docstring compared to the superclasses are documented. If a list of methods is passed and ou want to add
444 - all those methods, the key "all" will add them.
445 - return_anchors (`bool`, *optional*, defaults to `False`):
446 - Whether or not to return the list of anchors generated.
447 - page_info (`Dict[str, str]`, *optional*): Some information about the page.
448 - version_tag_suffix (`str`, *optional*, defaults to `"python/"`):
449 - Suffix to add after the version tag (e.g. 1.3.0 or main) in the documentation links.
450 - For example, the default `"src/"` suffix will result in a base link as `https://github.com/{repo_owner}/{package_name}/blob/{version_tag}/src/`.
451 - For example, `version_tag_suffix=""` will result in a base link as `https://github.com/{repo_owner}/{package_name}/blob/{version_tag}/`.
452 - """
453 - if page_info is None:
454 - page_info = {}
455 - if "package_name" not in page_info:
456 - page_info["package_name"] = package.__name__
457 -
458 - errors = []
459 - obj = find_object_in_package(object_name=object_name, package=package)
460 - documentation, check = document_object(
461 - object_name=object_name, package=package, page_info=page_info, version_tag_suffix=version_tag_suffix
462 - )
463 - if check is not None:
464 - errors.append(check)
465 -
466 - if return_anchors:
467 - anchors = [get_shortest_path(obj, package)]
468 - if isinstance(obj, type):
469 - documentation, check = document_object(
470 - object_name=object_name, package=package, page_info=page_info, version_tag_suffix=version_tag_suffix
471 - )
472 - if check is not None:
473 - errors.append(check)
474 - if methods is None:
475 - methods = find_documented_methods(obj)
476 - elif "all" in methods:
477 - methods.remove("all")
478 - methods_to_add = find_documented_methods(obj)
479 - methods.extend([m for m in methods_to_add if m not in methods])
480 - elif "none" in methods:
481 - methods = []
482 - for method in methods:
483 - anchor_name = f"{anchors[0]}.{method}"
484 - method_doc, check = document_object(
485 - object_name=f"{object_name}.{method}",
486 - package=package,
487 - page_info=page_info,
488 - full_name=False,
489 - anchor_name=anchor_name,
490 - version_tag_suffix=version_tag_suffix,
491 - )
492 - if check is not None:
493 - errors.append(check)
494 - documentation += f'\n<div class="{docstring_css_classes}">\n\n' + method_doc + "</div>"
495 - if return_anchors:
496 - # The anchor name of the method might be different from its
497 - method = find_object_in_package(f"{anchors[0]}.{method}", package=package)
498 - method_name = get_shortest_path(method, package=package)
499 - if anchor_name == method_name or method_name is None:
500 - anchors.append(anchor_name)
501 - else:
502 - anchors.append((anchor_name, method_name))
503 - documentation = f'<div class="{docstring_css_classes}">\n\n' + documentation + "</div>\n"
504 -
505 - return (documentation, anchors, errors) if return_anchors else documentation
506 -
507 -
508 -def resolve_links_in_text(text, package, mapping, page_info):
509 - """
510 - Resolve links of the form [`SomeClass`] to the link in the documentation to `SomeClass`.
511 -
512 - Args:
513 - text (`str`): The text in which to convert the links.
514 - package (`types.ModuleType`): The package in which to search objects for.
515 - mapping (`Dict[str, str]`): The map from anchor names of objects to their page in the documentation.
516 - page_info (`Dict[str, str]`): Some information about the page.
517 - """
518 - package_name = page_info.get("package_name", package.__name__)
519 - version = page_info.get("version", "main")
520 - language = page_info.get("language", "en")
521 -
522 - prefix = f"/docs/{package_name}/{version}/{language}/"
523 -
524 - def _resolve_link(search):
525 - object_or_param_name, last_char = search.groups()
526 - # Deal with external libs first.
527 - lib_name = object_or_param_name.split(".")[0]
528 - if lib_name.startswith("~"):
529 - lib_name = lib_name[1:]
530 - if lib_name in HUGGINFACE_LIBS and lib_name != package_name:
531 - link = get_external_object_link(object_or_param_name, page_info)
532 - return f"{link}{last_char}"
533 - object_name, param_name = None, None
534 - # If `#` is in the name, assume it's a link to the function/method parameter.
535 - if "#" in object_or_param_name:
536 - object_name_for_param = object_or_param_name.split("#", 1)[0]
537 - # Strip preceding `~` if it's there.
538 - object_name_for_param = (
539 - object_name_for_param[1:] if object_name_for_param.startswith("~") else object_name_for_param
540 - )
541 - obj = find_object_in_package(object_name_for_param, package)
542 - param_name = object_or_param_name.split("#", 1)[-1]
543 - # If the name begins with `~`, we shortcut to the last part.
544 - elif object_or_param_name.startswith("~"):
545 - obj = find_object_in_package(object_or_param_name[1:], package)
546 - object_name = object_or_param_name.split(".")[-1]
547 - else:
548 - obj = find_object_in_package(object_or_param_name, package)
549 - object_name = object_or_param_name
550 - # Object not found, return the original link text.
551 - if obj is None:
552 - return f"`{object_or_param_name}`{last_char}"
553 -
554 - link_name = object_name if param_name is None else param_name
555 -
556 - # If the link points to an object and the object is not a class, we add ()
557 - if param_name is None and not isinstance(obj, (type, property)):
558 - link_name = f"{link_name}()"
559 -
560 - # Link to the anchor
561 - anchor = get_shortest_path(obj, package)
562 - if anchor not in mapping:
563 - return f"`{link_name}`{last_char}"
564 - page = f"{prefix}{mapping[anchor]}"
565 - if param_name:
566 - anchor = f"{anchor}.{param_name}"
567 - if "#" in page:
568 - return f"[{link_name}]({page}){last_char}"
569 - else:
570 - return f"[{link_name}]({page}#{anchor}){last_char}"
571 -
572 - return re.sub(r"\[`([^`]+)`\]([^\(])", _resolve_link, text)
573 -
574 -
575 -# Re pattern that catches the start of a block code with potential indent.
576 -_re_start_code_block = re.compile(r"^\s*```.*$", flags=re.MULTILINE)
577 -# Re pattern that catches return blocks of the form `Return:`.
578 -_re_returns_block = re.compile(r"^\s*Returns?:\s*$")
579 -
580 -
581 -def quality_check_docstring(docstring, object_name=None):
582 - """
583 - Check if a docstring is not going to generate a common error on moon-landing, by asserting it does not have:
584 -
585 - - an empty Return block
586 - - two (or more) Return blocks
587 - - a code sample not properly closed.
588 -
589 - This function only returns an error message and does not raise an exception, as we will raise one single exception
590 - with all the problems at the end.
591 -
592 - Args:
593 - docstring (`str`): The docstring to check.
594 - obejct_name (`str`, *optional*): The name of the object being documented.
595 - Will be added to the error message if passed.
596 -
597 - Returns:
598 - Optional `str`: Returns `None` if the docstring is correct and an error message otherwise.
599 - """
600 -
601 - lines = docstring.split("\n")
602 - in_code = False
603 - code_indent = 0
604 - return_blocks = 0
605 - error_message = ""
606 -
607 - for idx, line in enumerate(lines):
608 - if not in_code and _re_start_code_block.search(line) is not None:
609 - in_code = True
610 - code_indent = find_indent(line)
611 - elif in_code and line.rstrip() == " " * code_indent + "```":
612 - in_code = False
613 - elif _re_returns_block.search(line) is not None:
614 - next_line_idx = idx + 1
615 - while next_line_idx < len(lines) and is_empty_line(lines[next_line_idx]):
616 - next_line_idx += 1
617 - if next_line_idx >= len(lines) or find_indent(lines[next_line_idx]) <= find_indent(line):
618 - error_message += "- The return block is empty.\n"
619 - else:
620 - return_blocks += 1
621 -
622 - if in_code:
623 - error_message += "- A code block has been opened but is not closed.\n"
624 - if return_blocks >= 2:
625 - error_message += f"- There are {return_blocks} Returns block. Only one max is supported.\n"
626 -
627 - if len(error_message) == 0:
628 - return
629 -
630 - if object_name is not None:
631 - error_message = (
632 - f"The docstring of {object_name} comports the following issue(s) and needs fixing:\n" + error_message
633 - )
634 -
635 - return error_message
fern/generators/python_sdk/autodoc_core/convert_md_to_mdx.py deleted
-241
@@ -1,241 +0,0 @@
1 -# coding=utf-8
2 -# Copyright 2021 The HuggingFace Team. All rights reserved.
3 -#
4 -# Licensed under the Apache License, Version 2.0 (the "License");
5 -# you may not use this file except in compliance with the License.
6 -# You may obtain a copy of the License at
7 -#
8 -# http://www.apache.org/licenses/LICENSE-2.0
9 -#
10 -# Unless required by applicable law or agreed to in writing, software
11 -# distributed under the License is distributed on an "AS IS" BASIS,
12 -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 -# See the License for the specific language governing permissions and
14 -# limitations under the License.
15 -
16 -
17 -import json
18 -import re
19 -import tempfile
20 -
21 -from .convert_rst_to_mdx import parse_rst_docstring, remove_indent
22 -
23 -
24 -_re_doctest_flags = re.compile(r"^(>>>.*\S)(\s+)# doctest:\s+\+[A-Z_]+\s*$", flags=re.MULTILINE)
25 -
26 -
27 -def convert_md_to_mdx(md_text, page_info):
28 - """
29 - Convert a document written in md to mdx.
30 - """
31 - return (
32 - """<script lang="ts">
33 -import {onMount} from "svelte";
34 -import Tip from "$lib/Tip.svelte";
35 -import Youtube from "$lib/Youtube.svelte";
36 -import Docstring from "$lib/Docstring.svelte";
37 -import CodeBlock from "$lib/CodeBlock.svelte";
38 -import CodeBlockFw from "$lib/CodeBlockFw.svelte";
39 -import DocNotebookDropdown from "$lib/DocNotebookDropdown.svelte";
40 -import CourseFloatingBanner from "$lib/CourseFloatingBanner.svelte";
41 -import IconCopyLink from "$lib/IconCopyLink.svelte";
42 -import FrameworkContent from "$lib/FrameworkContent.svelte";
43 -import Markdown from "$lib/Markdown.svelte";
44 -import Question from "$lib/Question.svelte";
45 -import FrameworkSwitchCourse from "$lib/FrameworkSwitchCourse.svelte";
46 -import InferenceApi from "$lib/InferenceApi.svelte";
47 -import TokenizersLanguageContent from "$lib/TokenizersLanguageContent.svelte";
48 -import ExampleCodeBlock from "$lib/ExampleCodeBlock.svelte";
49 -import Added from "$lib/Added.svelte";
50 -import Changed from "$lib/Changed.svelte";
51 -import Deprecated from "$lib/Deprecated.svelte";
52 -import PipelineIcon from "$lib/PipelineIcon.svelte";
53 -import PipelineTag from "$lib/PipelineTag.svelte";
54 -import Heading from "$lib/Heading.svelte";
55 -import HfOptions from "$lib/HfOptions.svelte";
56 -import HfOption from "$lib/HfOption.svelte";
57 -import EditOnGithub from "$lib/EditOnGithub.svelte";
58 -import InferenceSnippet from "$lib/InferenceSnippet/InferenceSnippet.svelte";
59 -let fw: "pt" | "tf" = "pt";
60 -onMount(() => {
61 - const urlParams = new URLSearchParams(window.location.search);
62 - fw = urlParams.get("fw") || "pt";
63 -});
64 -</script>
65 -<svelte:head>
66 - <meta name="hf:doc:metadata" content={metadata} >
67 -</svelte:head>
68 -
69 -<!--HF DOCBUILD BODY START-->
70 -
71 -HF_DOC_BODY_START
72 -
73 -"""
74 - + process_md(md_text, page_info)
75 - + edit_on_github(page_info)
76 - + """
77 -
78 -<!--HF DOCBUILD BODY END-->
79 -
80 -HF_DOC_BODY_END
81 -
82 -"""
83 - )
84 -
85 -
86 -def edit_on_github(page_info):
87 - """
88 - Svelte component string that adds "Update on Github" btn.
89 - """
90 - if "path" not in page_info or "repo_name" not in page_info:
91 - return ""
92 - path = str(page_info["path"])
93 - package_name = page_info["repo_name"]
94 - idx = path.find(package_name)
95 - if idx == -1:
96 - return ""
97 - relative_path = path[idx + len(package_name) :]
98 - if relative_path.startswith("/"):
99 - relative_path = relative_path[1:]
100 - source = f'https://github.com/{page_info["repo_owner"]}/{page_info["repo_name"]}/blob/main/{relative_path}'
101 - return f'\n\n<EditOnGithub source="{source}" />\n\n'
102 -
103 -
104 -def convert_img_links(text, page_info):
105 - """
106 - Convert image links to correct URL paths.
107 - """
108 - if "package_name" not in page_info:
109 - raise ValueError("`page_info` must contain at least the package_name.")
110 - package_name = page_info["package_name"]
111 - version = page_info.get("version", "main")
112 - language = page_info.get("language", "en")
113 -
114 - _re_img_link = re.compile(r"(src=\"|\()/imgs/")
115 - while _re_img_link.search(text):
116 - text = _re_img_link.sub(rf"\1/docs/{package_name}/{version}/{language}/imgs/", text)
117 - return text
118 -
119 -
120 -_re_md_img_tag_alt = re.compile(r"!\[([^\]]+)\]", re.I)
121 -_re_html_img_tag_alt = re.compile(r"<img [^>]*?alt=([\"'])([^\1]*?)\1[^>]*?>", re.I)
122 -
123 -
124 -def escape_img_alt_description(text):
125 - """
126 - Escapes ` with ' inside <img> alt description since it causes svelte/mdsvex compiler error.
127 - """
128 -
129 - def replace_md_alt_content(match):
130 - alt_content = match.group(1)
131 - new_alt_content = alt_content.replace("`", "'")
132 - return match.group(0).replace(alt_content, new_alt_content)
133 -
134 - def replace_html_alt_content(match):
135 - alt_content = match.group(2) # group(2) contains the alt text for the HTML regex
136 - new_alt_content = alt_content.replace("`", "'")
137 - return match.group(0).replace(alt_content, new_alt_content)
138 -
139 - # Replace markdown style image alt text
140 - if _re_md_img_tag_alt.search(text):
141 - text = _re_md_img_tag_alt.sub(replace_md_alt_content, text)
142 -
143 - # Replace HTML style image alt text
144 - if _re_html_img_tag_alt.search(text):
145 - text = _re_html_img_tag_alt.sub(replace_html_alt_content, text)
146 -
147 - return text
148 -
149 -
150 -def fix_img_links(text, page_info):
151 - text = convert_img_links(text, page_info)
152 - text = escape_img_alt_description(text)
153 - return text
154 -
155 -
156 -def clean_doctest_syntax(text):
157 - """
158 - Clean the doctest artifacts in a given content.
159 - """
160 - text = text.replace(">>> # ===PT-TF-SPLIT===", "===PT-TF-SPLIT===")
161 - text = _re_doctest_flags.sub(r"\1", text)
162 - return text
163 -
164 -
165 -_re_include_template = r"([ \t]*)<{include_name}>(((?!<{include_name}>).)*)<\/{include_name}>"
166 -_re_include = re.compile(_re_include_template.format(include_name="include"), re.DOTALL)
167 -_re_literalinclude = re.compile(_re_include_template.format(include_name="literalinclude"), re.DOTALL)
168 -
169 -
170 -def convert_file_include_helper(match, page_info, is_code=True):
171 - """
172 - Convert an `include` or `literalinclude` regex match into markdown blocks or markdown code blocks,
173 - by opening a file and copying specified start-end section into markdown block.
174 -
175 - If `is_code` is True, the block will be rendered as a code block, otherwise it will be rendered
176 - as a markdown block.
177 - """
178 - include_info = json.loads(match[2].strip())
179 - indent = match[1]
180 - include_name = "literalinclude" if is_code else "include"
181 - if tempfile.gettempdir() in str(page_info["path"]):
182 - return f"\n`Please restart doc-builder preview commands to see {include_name} rendered`\n"
183 - file = page_info["path"].parent / include_info["path"]
184 - with open(file, "r", encoding="utf-8-sig") as reader:
185 - lines = reader.readlines()
186 - include = lines # defaults to entire file
187 - if "start-after" in include_info or "end-before" in include_info:
188 - start_after, end_before = -1, -1
189 - for idx, line in enumerate(lines):
190 - line = line.strip()
191 - line = re.sub(r"\W+$", "", line)
192 - if line.endswith(include_info["start-after"]):
193 - start_after = idx + 1
194 - if line.endswith(include_info["end-before"]):
195 - end_before = idx
196 - if start_after == -1 or end_before == -1:
197 - raise ValueError(f"The following '{include_name}' does NOT exist:\n{match[0]}")
198 - include = lines[start_after:end_before]
199 - include = [indent + line[include_info.get("dedent", 0) :] for line in include]
200 - include = "".join(include).rstrip()
201 - return f"""{indent}```{include_info.get('language', '')}\n{include}\n{indent}```""" if is_code else include
202 -
203 -
204 -def convert_include(text, page_info):
205 - """
206 - Convert an `include` into markdown.
207 - """
208 - text = _re_include.sub(lambda m: convert_file_include_helper(m, page_info, is_code=False), text)
209 - return text
210 -
211 -
212 -def convert_literalinclude(text, page_info):
213 - """
214 - Convert a `literalinclude` into markdown code blocks.
215 - """
216 - text = _re_literalinclude.sub(lambda m: convert_file_include_helper(m, page_info, is_code=True), text)
217 - return text
218 -
219 -
220 -def convert_md_docstring_to_mdx(docstring, page_info):
221 - """
222 - Convert a docstring written in Markdown to mdx.
223 - """
224 - text = parse_rst_docstring(docstring)
225 - text = remove_indent(text)
226 - return process_md(text, page_info)
227 -
228 -
229 -def process_md(text, page_info):
230 - """
231 - Processes markdown by:
232 - 1. Convert include
233 - 2. Convert literalinclude
234 - 3. Clean doctest syntax
235 - 4. Fix image links
236 - """
237 - text = convert_include(text, page_info)
238 - text = convert_literalinclude(text, page_info)
239 - text = clean_doctest_syntax(text)
240 - text = fix_img_links(text, page_info)
241 - return text
fern/generators/python_sdk/autodoc_core/convert_rst_to_mdx.py deleted
-705
@@ -1,705 +0,0 @@
1 -# coding=utf-8
2 -# Copyright 2021 The HuggingFace Team. All rights reserved.
3 -#
4 -# Licensed under the Apache License, Version 2.0 (the "License");
5 -# you may not use this file except in compliance with the License.
6 -# You may obtain a copy of the License at
7 -#
8 -# http://www.apache.org/licenses/LICENSE-2.0
9 -#
10 -# Unless required by applicable law or agreed to in writing, software
11 -# distributed under the License is distributed on an "AS IS" BASIS,
12 -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 -# See the License for the specific language governing permissions and
14 -# limitations under the License.
15 -
16 -
17 -import re
18 -
19 -
20 -# Re pattern to catch things inside ` ` in :obj:`thing`.
21 -_re_obj = re.compile(r":obj:`([^`]+)`")
22 -# Re pattern to catch things inside ` ` in :math:`thing`.
23 -_re_math = re.compile(r":math:`([^`]+)`")
24 -# Re pattern to catch things between single backquotes.
25 -_re_single_backquotes = re.compile(r"(^|[^`])`([^`]+)`([^`]|$)")
26 -# Re pattern to catch things between double backquotes.
27 -_re_double_backquotes = re.compile(r"(^|[^`])``([^`]+)``([^`]|$)")
28 -# Re pattern to catch things inside ` ` in :func/class/meth:`thing`.
29 -_re_func_class = re.compile(r":(?:func|class|meth):`([^`]+)`")
30 -
31 -
32 -def convert_rst_formatting(text):
33 - """
34 - Convert rst syntax for formatting to markdown in a given text.
35 - """
36 - # Remove :class:, :func: and :meth: markers. To code-links and put double backquotes
37 - # (to not be caught by the italic conversion).
38 - text = _re_func_class.sub(r"[``\1``]", text)
39 - # Remove :obj: markers. What's after is in a single backquotes so we put in double backquotes
40 - # (to not be caught by the italic conversion).
41 - text = _re_obj.sub(r"``\1``", text)
42 - # Remove :math: markers.
43 - text = _re_math.sub(r"\\\\(\1\\\\)", text)
44 - # Convert content in single backquotes to italic.
45 - text = _re_single_backquotes.sub(r"\1*\2*\3", text)
46 - # Convert content in double backquotes to single backquotes.
47 - text = _re_double_backquotes.sub(r"\1`\2`\3", text)
48 - # Remove remaining ::
49 - text = re.sub(r"::\n", "", text)
50 -
51 - # Remove new lines inside blocks in backsticks as they will be kept.
52 - lines = text.split("\n")
53 - in_code = False
54 - text = None
55 - for line in lines:
56 - if in_code:
57 - splits = line.split("`")
58 - in_code = len(splits) > 1 and len(splits) % 2 == 1
59 - if len(splits) == 1:
60 - # Some forgotten lone backstick
61 - text += "\n" + line
62 - else:
63 - text += " " + line.lstrip()
64 - else:
65 - if text is not None:
66 - text += "\n" + line
67 - else:
68 - text = line
69 - splits = line.split("`")
70 - in_code = len(splits) % 2 == 0
71 - return text
72 -
73 -
74 -# Re pattern to catch description and url in links of the form `description <url>`_.
75 -_re_links = re.compile(r"`([^`]+\S)\s+</*([^/][^>`]*)>`_+")
76 -# Re pattern to catch description and url in links of the form :prefix_link:`description <url>`_.
77 -_re_prefix_links = re.compile(r":prefix_link:`([^`]+\S)\s+</*([^/][^>`]*)>`")
78 -# Re pattern to catch reference in links of the form :doc:`reference`.
79 -_re_simple_doc = re.compile(r":doc:`([^`<]*)`")
80 -# Re pattern to catch description and reference in links of the form :doc:`description <reference>`.
81 -_re_doc_with_description = re.compile(r":doc:`([^`<]+\S)\s+</*([^/][^>`]*)>`")
82 -# Re pattern to catch reference in links of the form :ref:`reference`.
83 -_re_simple_ref = re.compile(r":ref:`([^`<]*)`")
84 -# Re pattern to catch description and reference in links of the form :ref:`description <reference>`.
85 -_re_ref_with_description = re.compile(r":ref:`([^`<]+\S)\s+<([^>]*)>`")
86 -
87 -
88 -def convert_rst_links(text, page_info):
89 - """
90 - Convert the rst links in text to markdown.
91 - """
92 - if "package_name" not in page_info:
93 - raise ValueError("`page_info` must contain at least the package_name.")
94 - package_name = page_info["package_name"]
95 - version = page_info.get("version", "main")
96 - language = page_info.get("language", "en")
97 - no_prefix = page_info.get("no_prefix", False)
98 -
99 - prefix = "" if no_prefix else f"/docs/{package_name}/{version}/{language}/"
100 - # Links of the form :doc:`page`
101 - text = _re_simple_doc.sub(rf"[\1]({prefix}\1)", text)
102 - # Links of the form :doc:`text <page>`
103 - text = _re_doc_with_description.sub(rf"[\1]({prefix}\2)", text)
104 -
105 - if "page" in page_info and not no_prefix:
106 - page = str(page_info["page"])
107 - if page.endswith(".html"):
108 - page = page[:-5]
109 - prefix = f"{prefix}{page}"
110 - else:
111 - prefix = ""
112 - # Refs of the form :ref:`page`
113 - text = _re_simple_ref.sub(rf"[\1]({prefix}#\1)", text)
114 - # Refs of the form :ref:`text <page>`
115 - text = _re_ref_with_description.sub(rf"[\1]({prefix}#\2)", text)
116 -
117 - # Links with a prefix
118 - # TODO: when it exists, use the API to deal with prefix links properly.
119 - prefix = f"https://github.com/huggingface/{package_name}/tree/main/"
120 - text = _re_prefix_links.sub(rf"[\1]({prefix}\2)", text)
121 - # Other links
122 - text = _re_links.sub(r"[\1](\2)", text)
123 - # Relative links or Transformers links need to remove the .html
124 - if "(https://https://huggingface.co/" in text or re.search(r"\(\.+/", text) is not None:
125 - text = text.replace(".html", "")
126 - return text
127 -
128 -
129 -# Re pattern that catches examples blocks of the form `Example::`.
130 -_re_example = re.compile(r"^\s*(\S.*)::\s*$")
131 -# Re pattern that catches rst blocks of the form `.. block_name::`.
132 -_re_block = re.compile(r"^\s*\.\.\s+(\S+)::")
133 -# Re pattern that catches what's after the :: in rst blocks of the form `.. block_name:: something`.
134 -_re_block_info = re.compile(r"^\s*\.\.\s+\S+::\s*(\S.*)$")
135 -
136 -
137 -def is_empty_line(line):
138 - return len(line) == 0 or line.isspace()
139 -
140 -
141 -def find_indent(line):
142 - """
143 - Returns the number of spaces that start a line indent.
144 - """
145 - search = re.search(r"^(\s*)(?:\S|$)", line)
146 - if search is None:
147 - return 0
148 - return len(search.groups()[0])
149 -
150 -
151 -_re_rst_option = re.compile(r"^\s*:(\S+):(.*)$")
152 -
153 -
154 -def convert_special_chars(text):
155 - """
156 - Converts { and < that have special meanings in MDX.
157 - """
158 - text = text.replace("{", "&amp;lcub;")
159 - # We don't want to replace those by the HTML code, so we temporarily set them at LTHTML
160 - text = re.sub(r"<(img|br|hr|Youtube)", r"LTHTML\1", text) # html void elements with no closing counterpart
161 - _re_lt_html = re.compile(r"<(\S+)([^>]*>)(((?!</\1>).)*)<(/\1>)", re.DOTALL)
162 - while _re_lt_html.search(text):
163 - text = _re_lt_html.sub(r"LTHTML\1\2\3LTHTML\5", text)
164 - text = re.sub(r"(^|[^<])<([^<]|$)", r"\1&amp;lt;\2", text)
165 - text = text.replace("LTHTML", "<")
166 - return text
167 -
168 -
169 -def parse_options(block_content):
170 - """
171 - Parses the option in some rst block content.
172 - """
173 - block_lines = block_content.split("\n")
174 - block_indent = find_indent(block_lines[0])
175 - current_option = None
176 - result = {}
177 - for line in block_lines:
178 - if _re_rst_option.search(line) is not None:
179 - current_option, value = _re_rst_option.search(line).groups()
180 - result[current_option] = value.lstrip()
181 - elif find_indent(line) > block_indent:
182 - result[current_option] += " " + line.lstrip()
183 -
184 - return result
185 -
186 -
187 -def apply_min_indent(text, min_indent):
188 - """
189 - Make sure all lines in a text are have a minimum indentation.
190 -
191 - Args:
192 - text (`str`): The text to treat.
193 - min_indent (`int`): The minimal indentation.
194 -
195 - Returns:
196 - `str`: The processed text.
197 - """
198 - lines = text.split("\n")
199 - idx = 0
200 - while idx < len(lines):
201 - if is_empty_line(lines[idx]):
202 - idx += 1
203 - continue
204 - indent = find_indent(lines[idx])
205 - if indent < min_indent:
206 - while idx < len(lines) and (find_indent(lines[idx]) >= indent or is_empty_line(lines[idx])):
207 - if not is_empty_line(lines[idx]):
208 - lines[idx] = " " * (min_indent - indent) + lines[idx]
209 - idx += 1
210 - else:
211 - idx += 1
212 -
213 - return "\n".join(lines)
214 -
215 -
216 -def convert_rst_blocks(text, page_info):
217 - """
218 - Converts rst special blocks (examples, notes) into MDX.
219 - """
220 - if "package_name" not in page_info:
221 - raise ValueError("`page_info` must contain at least the package_name.")
222 - package_name = page_info["package_name"]
223 - version = page_info.get("version", "main")
224 - language = page_info.get("language", "en")
225 -
226 - lines = text.split("\n")
227 - idx = 0
228 - new_lines = []
229 - while idx < len(lines):
230 - block_type = None
231 - block_info = None
232 - if _re_block.search(lines[idx]) is not None:
233 - block_type = _re_block.search(lines[idx]).groups()[0]
234 - if _re_block_info.search(lines[idx]) is not None:
235 - block_info = _re_block_info.search(lines[idx]).groups()[0]
236 - elif _re_example.search(lines[idx]) is not None:
237 - block_type = "code-block-example"
238 - block_info = "python"
239 - example_name = _re_example.search(lines[idx]).groups()[0]
240 - new_lines.append(f"<exampletitle>{example_name}:</exampletitle>\n")
241 - elif lines[idx].strip() == "..":
242 - block_type = "comment"
243 - elif lines[idx].strip() == "::":
244 - block_type = "code-block"
245 -
246 - if block_type is not None:
247 - block_indent = find_indent(lines[idx])
248 - # Find the next nonempty line
249 - idx += 1
250 - while idx < len(lines) and is_empty_line(lines[idx]):
251 - idx += 1
252 - # Grab the indent of the return line, this block will stop when we unindent under it (or has already)
253 - example_indent = find_indent(lines[idx]) if idx < len(lines) else block_indent
254 -
255 - if example_indent == block_indent:
256 - block_content = ""
257 - else:
258 - block_lines = []
259 - while idx < len(lines) and (is_empty_line(lines[idx]) or find_indent(lines[idx]) >= example_indent):
260 - block_lines.append(lines[idx][example_indent:])
261 - idx += 1
262 - block_content = "\n".join(block_lines)
263 -
264 - if block_type in ["code", "code-block"]:
265 - prefix = "```" if block_info is None else f"```{block_info}"
266 - new_lines.append(f"{prefix}\n{block_content.strip()}\n```\n")
267 - elif block_type == "code-block-example":
268 - prefix = f"<example>```{block_info}"
269 - new_lines.append(f"{prefix}\n{block_content.strip()}\n```\n</example>")
270 - elif block_type == "note":
271 - new_lines.append(apply_min_indent(f"<Tip>\n\n{block_content.strip()}\n\n</Tip>\n", block_indent))
272 - elif block_type == "warning":
273 - new_lines.append(
274 - apply_min_indent("<Tip warning={true}>\n\n" + f"{block_content.strip()}\n\n</Tip>\n", block_indent)
275 - )
276 - elif block_type == "raw":
277 - new_lines.append(block_content.strip() + "\n")
278 - elif block_type == "math":
279 - new_lines.append(f"$${block_content.strip()}$$\n")
280 - elif block_type == "comment":
281 - new_lines.append(f"<!--{block_content.strip()}\n-->\n")
282 - elif block_type == "autofunction":
283 - if block_info is not None:
284 - new_lines.append(f"[[autodoc]] {block_info}\n")
285 - elif block_type == "autoclass":
286 - if block_info is not None:
287 - block = f"[[autodoc]] {block_info}\n"
288 - options = parse_options(block_content)
289 - if "special-members" in options:
290 - special_members = options["special-members"].split(", ")
291 - for special_member in special_members:
292 - block += f" - {special_member}\n"
293 - if "members" in options:
294 - members = options["members"]
295 - if len(members) == 0:
296 - block += " - all\n"
297 - else:
298 - for member in members.split(", "):
299 - block += f" - {member}\n"
300 - new_lines.append(block)
301 - elif block_type == "image":
302 - options = parse_options(block_content)
303 - target = options.pop("target", None)
304 - if block_info is not None:
305 - options["src"] = block_info
306 - else:
307 - if target is None:
308 - raise ValueError("Image source not defined.")
309 - options["src"] = target
310 - # Adapt path
311 - options["src"] = options["src"].replace("/imgs/", f"/docs/{package_name}/{version}/{language}/imgs/")
312 - html_code = " ".join([f'{key}="{value}"' for key, value in options.items()])
313 - new_lines.append(f"<img {html_code}/>\n")
314 -
315 - else:
316 - new_lines.append(f"{block_type},{block_info}\n{block_content.rstrip()}\n")
317 -
318 - else:
319 - new_lines.append(lines[idx])
320 - idx += 1
321 -
322 - return "\n".join(new_lines)
323 -
324 -
325 -# Re pattern that catches rst args blocks of the form `Parameters:`.
326 -_re_args = re.compile(r"^\s*(Args?|Arguments?|Attributes?|Params?|Parameters?):\s*$")
327 -# Re pattern that catches return blocks of the form `Return:`.
328 -_re_returns = re.compile(r"^\s*(Return|Yield|Raise)s?:\s*$")
329 -
330 -
331 -def split_return_line(line):
332 - """
333 - Split the return line with format `type: some doc`. Type may contain colons in the form of :obj: or :class:.
334 - """
335 - splits_on_colon = line.split(":")
336 - idx = 1
337 - while idx < len(splits_on_colon) and splits_on_colon[idx] in ["obj", "class"]:
338 - idx += 2
339 - if idx >= len(splits_on_colon):
340 - if len(splits_on_colon) % 2 == 1 and re.search(r"`\w+`$", line.rstrip()):
341 - return line, ""
342 - return None, line
343 - return ":".join(splits_on_colon[:idx]), ":".join(splits_on_colon[idx:])
344 -
345 -
346 -def split_raise_line(line):
347 - """
348 - Split the raise line with format `SomeError some doc`.
349 - """
350 - splits_on_colon = line.strip().split(" ")
351 - error_type, doc = splits_on_colon[0], " ".join(splits_on_colon[1:])
352 - if error_type and error_type[-1] == ":":
353 - error_type = error_type[:-1]
354 - return error_type, doc
355 -
356 -
357 -def split_arg_line(line):
358 - """
359 - Split the return line with format `type: some doc`. Type may contain colons in the form of :obj: or :class:.
360 - """
361 - splits_on_colon = line.split(":")
362 - idx = 1
363 - while idx < len(splits_on_colon) and splits_on_colon[idx] in ["obj", "class"]:
364 - idx += 2
365 - if idx >= len(splits_on_colon):
366 - return line, ""
367 - return ":".join(splits_on_colon[:idx]), ":".join(splits_on_colon[idx:])
368 -
369 -
370 -class InvalidRstDocstringError(ValueError):
371 - pass
372 -
373 -
374 -_re_parameters = re.compile(r"<parameters>(((?!<parameters>).)*)</parameters>", re.DOTALL)
375 -_re_md_link = re.compile(r"\[(.+)\]\(.+\)", re.DOTALL)
376 -
377 -
378 -def parse_rst_docstring(docstring):
379 - """
380 - Parses a docstring written in rst, in particular the list of arguments and the return type.
381 - """
382 - lines = docstring.split("\n")
383 - idx = 0
384 - while idx < len(lines):
385 - # Parameters section
386 - if _re_args.search(lines[idx]) is not None:
387 - # Title of the section.
388 - lines[idx] = "<parameters>\n"
389 - # Find the next nonempty line
390 - idx += 1
391 - while is_empty_line(lines[idx]):
392 - idx += 1
393 - # Grab the indent of the list of parameters, this block will stop when we unindent under it or we see the
394 - # Returns or Raises block.
395 - param_indent = find_indent(lines[idx])
396 - while (
397 - idx < len(lines) and find_indent(lines[idx]) == param_indent and _re_returns.search(lines[idx]) is None
398 - ):
399 - intro, doc = split_arg_line(lines[idx])
400 - # Line starting with a > after indent indicate a "section title" in the parameters.
401 - if intro.lstrip().startswith(">"):
402 - lines[idx] = intro.lstrip()
403 - else:
404 - lines[idx] = re.sub(r"^\s*(\S+)(\s)?", r"- **\1**\2", intro) + " --" + doc
405 - idx += 1
406 - while idx < len(lines) and (is_empty_line(lines[idx]) or find_indent(lines[idx]) > param_indent):
407 - idx += 1
408 - lines.insert(idx, "</parameters>\n")
409 - idx += 1
410 -
411 - # Returns section
412 - elif _re_returns.search(lines[idx]) is not None:
413 - # tag is either `return` or `yield`
414 - tag = _re_returns.match(lines[idx]).group(1).lower()
415 - # Title of the section.
416 - lines[idx] = f"<{tag}s>\n"
417 - # Find the next nonempty line
418 - idx += 1
419 - while is_empty_line(lines[idx]):
420 - idx += 1
421 -
422 - # Grab the indent of the return line, this block will stop when we unindent under it.
423 - return_indent = find_indent(lines[idx])
424 - raised_errors = []
425 - # The line may contain the return type.
426 - if tag in ["return", "yield"]:
427 - return_type, return_description = split_return_line(lines[idx])
428 - lines[idx] = return_description
429 - idx += 1
430 - while idx < len(lines) and (is_empty_line(lines[idx]) or find_indent(lines[idx]) >= return_indent):
431 - idx += 1
432 - else:
433 - while idx < len(lines) and find_indent(lines[idx]) == return_indent:
434 - return_type, return_description = split_raise_line(lines[idx])
435 - raised_error = re.sub(r"^\s*`?([\w\.]*)`?$", r"``\1``", return_type)
436 - lines[idx] = "- " + raised_error + " -- " + return_description
437 - md_link = _re_md_link.match(raised_error)
438 - if md_link:
439 - raised_error = md_link[1]
440 - raised_error = re.sub(r"^\s*`?([\w\.]*)`?$", r"``\1``", raised_error)
441 - if raised_error not in raised_errors:
442 - raised_errors.append(raised_error)
443 - idx += 1
444 - while idx < len(lines) and (is_empty_line(lines[idx]) or find_indent(lines[idx]) > return_indent):
445 - idx += 1
446 -
447 - lines.insert(idx, f"</{tag}s>\n")
448 - idx += 1
449 -
450 - # Return block finished, we insert the return type if one was specified
451 - if tag in ["return", "yield"] and return_type is not None:
452 - lines[idx - 1] += f"\n<{tag}type>{return_type}</{tag}type>\n"
453 - elif len(raised_errors) > 0:
454 - # raised errors
455 - lines[idx - 1] += f"\n<raisederrors>{' or '.join(raised_errors)}</raisederrors>\n"
456 -
457 - else:
458 - idx += 1
459 -
460 - result = "\n".join(lines)
461 -
462 - # combine multiple <parameters> blocks into one block
463 - if result.count("<parameters>") > 1:
464 - parameters_blocks = _re_parameters.findall(result)
465 - parameters_blocks = [pb[0].strip() for pb in parameters_blocks]
466 - parameters_str = "\n".join(parameters_blocks)
467 - result = _re_parameters.sub("", result)
468 - result += f"\n<parameters>{parameters_str}</parameters>\n"
469 -
470 - return result
471 -
472 -
473 -_re_list = re.compile(r"^\s*(-|\*|\d+\.)\s")
474 -_re_autodoc = re.compile(r"^\s*\[\[autodoc\]\]\s+(\S+)\s*$")
475 -
476 -
477 -def remove_indent(text):
478 - """
479 - Remove indents in text, except the one linked to lists (or sublists).
480 - """
481 - lines = text.split("\n")
482 - # List of indents to remember for nested lists
483 - current_indents = []
484 - # List of new indents to remember for nested lists
485 - new_indents = []
486 - is_inside_code = False
487 - code_indent = 0
488 - for idx, line in enumerate(lines):
489 - # Line is an item in a list.
490 - if _re_list.search(line) is not None:
491 - indent = find_indent(line)
492 - # Is it a new list / new level of nestedness?
493 - if len(current_indents) == 0 or indent > current_indents[-1]:
494 - current_indents.append(indent)
495 - new_indent = 0 if len(new_indents) == 0 else new_indents[-1]
496 - lines[idx] = " " * new_indent + line[indent:]
497 - new_indent += len(_re_list.search(line).groups()[0]) + 1
498 - new_indents.append(new_indent)
499 - # Otherwise it's an existing level of list (current one, or previous one)
500 - else:
501 - # Let's find the proper level of indentation
502 - level = len(current_indents) - 1
503 - while level >= 0 and current_indents[level] != indent:
504 - level -= 1
505 - current_indents = current_indents[: level + 1]
506 - new_indents = new_indents[:level]
507 - new_indent = 0 if len(new_indents) == 0 else new_indents[-1]
508 - lines[idx] = " " * new_indent + line[indent:]
509 - new_indent += len(_re_list.search(line).groups()[0]) + 1
510 - new_indents.append(new_indent)
511 -
512 - # Line is an autodoc, we keep the indent for the list just after if there is one.
513 - elif _re_autodoc.search(line) is not None:
514 - indent = find_indent(line)
515 - current_indents = [indent]
516 - new_indents = [4]
517 - lines[idx] = line.strip()
518 -
519 - # Deal with empty lines separately
520 - elif is_empty_line(line):
521 - lines[idx] = ""
522 -
523 - # Code blocks
524 - elif line.lstrip().startswith("```"):
525 - is_inside_code = not is_inside_code
526 - if is_inside_code:
527 - code_indent = find_indent(line)
528 - lines[idx] = line[code_indent:]
529 - elif is_inside_code:
530 - lines[idx] = line[code_indent:]
531 -
532 - else:
533 - indent = find_indent(line)
534 - if len(current_indents) > 0 and indent > current_indents[-1]:
535 - lines[idx] = " " * new_indents[-1] + line[indent:]
536 - elif len(current_indents) > 0:
537 - # Let's find the proper level of indentation
538 - level = len(current_indents) - 1
539 - while level >= 0 and current_indents[level] > indent:
540 - level -= 1
541 - current_indents = current_indents[: level + 1]
542 - if level >= 0:
543 - if current_indents[level] < indent:
544 - new_indents = new_indents[: level + 1]
545 - else:
546 - new_indents = new_indents[:level]
547 - new_indent = 0 if len(new_indents) == 0 else new_indents[-1]
548 - lines[idx] = " " * new_indent + line[indent:]
549 - new_indents.append(new_indent)
550 - else:
551 - new_indents = []
552 - lines[idx] = line[indent:]
553 - else:
554 - lines[idx] = line[indent:]
555 -
556 - return "\n".join(lines)
557 -
558 -
559 -def base_rst_to_mdx(text, page_info, unindent=True):
560 - """
561 - Convert a text from rst to mdx, with the base operations necessary for both docstrings and rst docs.
562 - """
563 - text = convert_rst_links(text, page_info)
564 - text = convert_special_chars(text)
565 - text = convert_rst_blocks(text, page_info)
566 - # Convert * in lists to - to avoid the formatting conversion treat them as bold.
567 - text = re.sub(r"^(\s*)\*(\s)", r"\1-\2", text, flags=re.MULTILINE)
568 - text = convert_rst_formatting(text)
569 - return remove_indent(text) if unindent else text
570 -
571 -
572 -def convert_rst_docstring_to_mdx(docstring, page_info):
573 - """
574 - Convert a docstring written in rst to mdx.
575 - """
576 - text = parse_rst_docstring(docstring)
577 - return base_rst_to_mdx(text, page_info)
578 -
579 -
580 -def process_titles(lines):
581 - """Converts rst titles to markdown titles."""
582 - title_chars = """= - ` : ' " ~ ^ _ * + # < >""".split(" ")
583 - title_levels = {}
584 - new_lines = []
585 - for line in lines:
586 - if (
587 - len(new_lines) > 0
588 - and len(line) >= len(new_lines[-1])
589 - and len(set(line)) == 1
590 - and line[0] in title_chars
591 - and line != "::"
592 - ):
593 - char = line[0]
594 - level = title_levels.get(char, len(title_levels) + 1)
595 - if level not in title_levels:
596 - title_levels[char] = level
597 - new_lines[-1] = f"{'#' * level} {new_lines[-1]}"
598 - else:
599 - new_lines.append(line)
600 - return new_lines
601 -
602 -
603 -# Matches lines with a pattern of a table new line in rst.
604 -_re_ignore_line_table = re.compile(r"^(\+[\-\s]+)+\+\s*$")
605 -# Matches lines with a pattern of a table new line in rst, with a first column empty.
606 -_re_ignore_line_table1 = re.compile(r"^\|\s+(\+[\-\s]+)+\+\s*$")
607 -# Matches lines with a pattern of a first table line in rst.
608 -_re_sep_line_table = re.compile(r"^(\+[=\s]+)+\+\s*$")
609 -# Re pattern that catches anchors of the type .. reference:
610 -_re_anchor_section = re.compile(r"^\.\.\s+_(\S+):")
611 -
612 -
613 -def split_pt_tf_code_blocks(text):
614 - """
615 - Split PyTorch and TensorFlow specific block codes.
616 - """
617 - lines = text.split("\n")
618 - new_lines = []
619 - idx = 0
620 - while idx < len(lines):
621 - if lines[idx].startswith("```"):
622 - code_lines = {"common": [lines[idx]], "pytorch": [], "tensorflow": []}
623 - is_pytorch = False
624 - is_tensorflow = False
625 - idx += 1
626 - while idx < len(lines) and lines[idx].strip() != "```":
627 - if "## PYTORCH CODE" in lines[idx]:
628 - is_pytorch = True
629 - is_tensorflow = False
630 - elif "## TENSORFLOW CODE" in lines[idx]:
631 - is_tensorflow = True
632 - is_pytorch = False
633 - elif is_pytorch:
634 - code_lines["pytorch"].append(lines[idx])
635 - elif is_tensorflow:
636 - code_lines["tensorflow"].append(lines[idx])
637 - else:
638 - code_lines["common"].append(lines[idx])
639 - idx += 1
640 - if len(code_lines["pytorch"]) > 0 or len(code_lines["tensorflow"]) > 0:
641 - block_lines = ["<frameworkcontent>", "<pt>"]
642 - block_lines.extend(code_lines["common"].copy() + code_lines["pytorch"])
643 - block_lines.extend(["```", "</pt>", "<tf>"])
644 - block_lines.extend(code_lines["common"].copy() + code_lines["tensorflow"])
645 - block_lines.extend(["```", "</tf>", "</frameworkcontent>"])
646 - new_lines.extend(block_lines)
647 - else:
648 - block_lines = code_lines["common"] + ["```"]
649 - new_lines.extend(block_lines)
650 - idx += 1
651 - else:
652 - new_lines.append(lines[idx])
653 - idx += 1
654 - return "\n".join(new_lines)
655 -
656 -
657 -def convert_rst_to_mdx(rst_text, page_info, add_imports=True):
658 - """
659 - Convert a document written in rst to mdx.
660 - """
661 - lines = rst_text.split("\n")
662 - lines = process_titles(lines)
663 - if add_imports:
664 - new_lines = [
665 - '<script lang="ts">',
666 - ' import Tip from "$lib/Tip.svelte";',
667 - ' import Youtube from "$lib/Youtube.svelte";',
668 - ' import Docstring from "$lib/Docstring.svelte";',
669 - ' import CodeBlock from "$lib/CodeBlock.svelte";',
670 - ' import CodeBlockFw from "$lib/CodeBlockFw.svelte";',
671 - ' import DocNotebookDropdown from "$lib/DocNotebookDropdown.svelte";',
672 - ' import CourseFloatingBanner from "$lib/CourseFloatingBanner.svelte";',
673 - ' import IconCopyLink from "$lib/IconCopyLink.svelte";',
674 - ' import FrameworkContent from "$lib/FrameworkContent.svelte";',
675 - ' import Markdown from "$lib/Markdown.svelte";',
676 - ' import ExampleCodeBlock from "$lib/ExampleCodeBlock.svelte";',
677 - ' import Added from "$lib/Added.svelte";',
678 - ' import Changed from "$lib/Changed.svelte";',
679 - ' import Deprecated from "$lib/Deprecated.svelte";',
680 - ' import PipelineIcon from "$lib/PipelineIcon.svelte";',
681 - ' import PipelineTag from "$lib/PipelineTag.svelte";',
682 - " ",
683 - ' export let fw: "pt" | "tf"',
684 - "</script>",
685 - "<svelte:head>",
686 - '<meta name="hf:doc:metadata" content={JSON.stringify(metadata)} >',
687 - "</svelte:head>",
688 - "",
689 - ]
690 - else:
691 - new_lines = []
692 - for line in lines:
693 - if _re_ignore_line_table.search(line) is not None:
694 - continue
695 - elif _re_ignore_line_table1.search(line) is not None:
696 - continue
697 - elif _re_sep_line_table.search(line) is not None:
698 - line = line.replace("=", "-").replace("+", "|")
699 - elif _re_anchor_section.search(line) is not None:
700 - anchor_name = _re_anchor_section.search(line).groups()[0]
701 - line = f"<a id='{anchor_name}'></a>"
702 - new_lines.append(line)
703 - text = "\n".join(new_lines)
704 -
705 - return split_pt_tf_code_blocks(base_rst_to_mdx(text, page_info))
fern/generators/python_sdk/autodoc_core/external.py deleted
-153
@@ -1,153 +0,0 @@
1 -# coding=utf-8
2 -# Copyright 2022 The HuggingFace Team. All rights reserved.
3 -#
4 -# Licensed under the Apache License, Version 2.0 (the "License");
5 -# you may not use this file except in compliance with the License.
6 -# You may obtain a copy of the License at
7 -#
8 -# http://www.apache.org/licenses/LICENSE-2.0
9 -#
10 -# Unless required by applicable law or agreed to in writing, software
11 -# distributed under the License is distributed on an "AS IS" BASIS,
12 -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 -# See the License for the specific language governing permissions and
14 -# limitations under the License.
15 -
16 -import os
17 -import re
18 -import tempfile
19 -import zlib
20 -
21 -import git
22 -import requests
23 -
24 -
25 -HF_DOC_PREFIX = "https://huggingface.co/docs/"
26 -EXTERNAL_DOC_OBJECTS_CACHE = {}
27 -HUGGINFACE_LIBS = [
28 - "accelerate",
29 - "datasets",
30 - "evaluate",
31 - "huggingface_hub",
32 - "optimum",
33 - "tokenizers",
34 - "transformers",
35 - "trl",
36 -]
37 -
38 -
39 -def post_process_objects_inv(object_data, doc_url):
40 - """
41 - Post-processes the data in sphinx-like format to get a dictionary object_name: link in doc.
42 -
43 - Args:
44 - object_data (`str`): The data in the `objects.inv` object (except the first 4 lines).
45 - doc_url (`str`): The documentation url of the package.
46 - """
47 - links = {}
48 - for line in object_data:
49 - if len(line) == 0:
50 - continue
51 - name, typ, _, link = line.split(" ")[:4]
52 - if typ in ["py:class", "py:function", "py:method"]:
53 - link = link.replace("$", name)
54 - links[name] = f"{doc_url}/{link}"
55 - return links
56 -
57 -
58 -def get_stable_version(package_name, repo_owner="huggingface", repo_name=None):
59 - """
60 - Gets the version of the last release of a package.
61 -
62 - Args:
63 - package_name (`str`): The name of the package.
64 - repo_owner (`str`): The owner of the GitHub repo.
65 - repo_name (`str`, *optional*, defaults to `package_name`):
66 - The name of the GitHub repo. If not provided, will be the same as the package name.
67 - """
68 - repo_name = repo_name if repo_name is not None else package_name
69 - github_url = f"https://github.com/{repo_owner}/{repo_name}"
70 - try:
71 - # Get the version tags from the GitHub repo in decreasing order (that's what '-v:refname' means)
72 - result = git.cmd.Git().ls_remote(github_url, sort="-v:refname", tags=True)
73 - except git.GitCommandError:
74 - return "main"
75 -
76 - # One line per tag
77 - for line in result.split("\n"):
78 - # Lines returned are {sha}\trefs/tags/{tag}^{}, we grab the tag
79 - candidate = line.split("/")[-1].replace("^", "").replace("{}", "")
80 - # Some tags are not versions (looking at your VERSION and delete tags Datasets)
81 - if re.search(r"v?\d+\.\d+\.\d+", candidate):
82 - # Add the v is missing (looking at you Datasets :-p)
83 - return candidate if candidate.startswith("v") else f"v{candidate}"
84 -
85 - return "main"
86 -
87 -
88 -def get_objects_map(package_name, version="main", language="en", repo_owner="huggingface", repo_name=None):
89 - """
90 - Downloads the `objects.inv` for a package and post-processes it to get a nice dictionary.
91 -
92 - Args:
93 - package_name (`str`): The name of the external package.
94 - version (`str`, *optional*, defaults to `"main"`): The version of the package for which documentation is built.
95 - language (`str`, *optional*, defaults to `"en"`): The language of the documentation being built.
96 - repo_owner (`str`, *optional*, defaults to `"huggingface"`): The owner of the GitHub repo.
97 - repo_name (`str`, *optional*, defaults to `package_name`):
98 - The name of the GitHub repo. If not provided, it will be the same as the package name.
99 - """
100 - repo_name = repo_name if repo_name is not None else package_name
101 - # We link to main in `package_name` from the main doc (or PR docs) but to the last stable release otherwise.
102 - if version in ["main", "master"] or version.startswith("pr_"):
103 - package_version = "main"
104 - else:
105 - package_version = get_stable_version(package_name, repo_owner, repo_name)
106 -
107 - doc_url = f"{HF_DOC_PREFIX}{package_name}/{package_version}/{language}"
108 - url = f"{doc_url}/objects.inv"
109 - try:
110 - request = requests.get(url, stream=True)
111 - request.raise_for_status()
112 - with tempfile.TemporaryDirectory() as tmp_dir:
113 - tmp_file = os.path.join(tmp_dir, "objects.inv")
114 - with open(tmp_file, "ab") as writer:
115 - for chunk in request.iter_content(chunk_size=1024):
116 - if chunk: # filter out keep-alive new chunks
117 - writer.write(chunk)
118 -
119 - with open(tmp_file, "rb") as reader:
120 - object_lines = reader.readlines()[4:]
121 - object_data = zlib.decompress(b"".join(object_lines)).decode().split("\n")
122 - return post_process_objects_inv(object_data, doc_url)
123 - except Exception:
124 - return {}
125 -
126 -
127 -def get_external_object_link(object_name, page_info):
128 - if object_name.startswith("~"):
129 - object_name = object_name[1:]
130 - link_name = object_name.split(".")[-1]
131 - else:
132 - link_name = object_name
133 -
134 - version = page_info.get("version", "main")
135 - language = page_info.get("language", "en")
136 - if language != "en":
137 - # No resolving for other languages then English as we don't translate API doc pages/docstrings for now.
138 - return f"`{link_name}`"
139 -
140 - package_name = object_name.split(".")[0]
141 - if package_name not in HUGGINFACE_LIBS:
142 - # No resolving for non-HF libs for now.
143 - return f"`{link_name}`"
144 -
145 - if package_name not in EXTERNAL_DOC_OBJECTS_CACHE:
146 - EXTERNAL_DOC_OBJECTS_CACHE[package_name] = get_objects_map(package_name, version=version, language=language)
147 - object_url = EXTERNAL_DOC_OBJECTS_CACHE[package_name].get(object_name, None)
148 -
149 - if object_url is None:
150 - # Object not found in the lib
151 - return f"`{link_name}`"
152 - else:
153 - return f"[{link_name}]({object_url})"
fern/generators/python_sdk/generate_docs.py deleted
-56
@@ -1,56 +0,0 @@
1 -#!/usr/bin/env python
2 -"""
3 -Generate SDK documentation for Composio Python SDK.
4 -
5 -Usage:
6 - uv run python generators/python-sdk/generate_docs.py
7 -"""
8 -import sys
9 -from pathlib import Path
10 -
11 -# Add current directory to path
12 -sys.path.insert(0, str(Path(__file__).parent))
13 -
14 -# Add local python package directory to path (for local composio package)
15 -workspace_root = Path(__file__).parent.parent.parent.parent
16 -python_dir = workspace_root / "python"
17 -if python_dir.exists():
18 - sys.path.insert(0, str(python_dir))
19 - print(f"Using local composio package from: {python_dir}")
20 -else:
21 - print(f"Warning: Local python directory not found at {python_dir}")
22 -
23 -from generators.python_sdk.process_sdk_docs import build_sdk_docs
24 -
25 -
26 -def main():
27 - """Generate SDK documentation."""
28 - fern_dir = Path(__file__).parent.parent.parent
29 - source_dir = fern_dir / "generators" / "python_sdk" / "templates"
30 - output_dir = fern_dir / "pages" / "dist" / "sdk" / "python"
31 -
32 - print("Generating Composio Python SDK documentation...")
33 - print(f"Source: {source_dir}")
34 - print(f"Output: {output_dir}")
35 -
36 - try:
37 - anchors = build_sdk_docs(
38 - source_dir=source_dir,
39 - output_dir=output_dir,
40 - package_name="composio",
41 - version="next",
42 - clean=False # Don't clean to preserve other files
43 - )
44 -
45 - print(f"\n✓ Successfully generated documentation with {len(anchors)} anchors")
46 - print(f"✓ Output written to: {output_dir}")
47 -
48 - except Exception as e:
49 - print(f"\n✗ Error generating documentation: {e}")
50 - import traceback
51 - traceback.print_exc()
52 - sys.exit(1)
53 -
54 -
55 -if __name__ == "__main__":
56 - main()
\ No newline at end of file
fern/generators/python_sdk/markdown_formatter.py deleted
-286
@@ -1,286 +0,0 @@
1 -"""
2 -Custom markdown formatter for autodoc output
3 -"""
4 -import json
5 -import re
6 -from typing import List, Dict, Optional, Tuple
7 -
8 -def format_signature_markdown(name: str, anchor: str, signature: List[Dict[str, str]],
9 - object_doc: str, source_link: Optional[str] = None,
10 - is_getset_desc: bool = False) -> str:
11 - """
12 - Generate markdown documentation instead of XML/Svelte components.
13 -
14 - This replaces get_signature_component() to output clean Markdown.
15 - """
16 - output = []
17 -
18 - # Extract structured data from the docstring
19 - doc_data = parse_structured_docstring(object_doc)
20 -
21 - # Add the main heading with an invisible anchor
22 - # Determine heading level based on whether it's a class or method
23 - if name.startswith('class '):
24 - class_name = name.replace('class ', '')
25 - heading = f'<a id="{anchor}"></a>\n\n### `{class_name}`\n'
26 - elif '.' in anchor and not name.startswith('class'):
27 - # This is a method - use h4
28 - heading = f'<a id="{anchor}"></a>\n\n#### `{name}`\n'
29 - else:
30 - heading = f'<a id="{anchor}"></a>\n\n### `{name}`\n'
31 - output.append(heading)
32 -
33 - # Add source link if available
34 - if source_link:
35 - output.append(f"[View source]({source_link})\n")
36 -
37 - # Add signature
38 - if signature and not is_getset_desc:
39 - params = []
40 - for param in signature:
41 - param_str = param["name"] + param["val"]
42 - params.append(param_str)
43 -
44 - # Format signature in a code block
45 - if name.startswith("class "):
46 - class_name = name.replace("class ", "")
47 - output.append(f"```python\n{class_name}({', '.join(params)})\n```\n")
48 - else:
49 - output.append(f"```python\n{name}({', '.join(params)})\n```\n")
50 -
51 - # Add the main description
52 - if doc_data['description']:
53 - output.append(doc_data['description'] + "\n")
54 -
55 - # Add parameters section
56 - if doc_data['parameters']:
57 - # Format parameters as a table
58 - table = format_parameters_table(doc_data['parameters'])
59 - output.append(table + "\n")
60 -
61 - # Add returns section
62 - if doc_data['returns']:
63 - # Parse the return description
64 - return_desc = parse_return_line(doc_data['returns'])
65 - if not return_desc:
66 - # If not in :return: format, use the raw text
67 - return_desc = doc_data['returns']
68 -
69 - # Format the return value
70 - if doc_data['return_type']:
71 - output.append(f"**Returns:** `{doc_data['return_type']}` — {return_desc}\n")
72 - else:
73 - output.append(f"**Returns:** {return_desc}\n")
74 -
75 - # Add raises section
76 - if doc_data['raises']:
77 - output.append("**Raises:**\n")
78 - output.append(doc_data['raises'] + "\n")
79 -
80 - # Add examples
81 - if doc_data['examples']:
82 - for example in doc_data['examples']:
83 - output.append(example + "\n")
84 -
85 - return "\n".join(output)
86 -
87 -
88 -def parse_param_line(line: str) -> Tuple[Optional[str], Optional[str]]:
89 - """
90 - Parse a parameter line like ":param name: description" into (name, description).
91 - """
92 - match = re.match(r':param\s+(\w+):\s*(.+)', line.strip())
93 - if match:
94 - return match.group(1), match.group(2)
95 - return None, None
96 -
97 -
98 -def parse_return_line(line: str) -> Optional[str]:
99 - """
100 - Parse a return line like ":return: description" into description.
101 - """
102 - match = re.match(r':return:\s*(.+)', line.strip())
103 - if match:
104 - return match.group(1)
105 - return None
106 -
107 -
108 -def format_parameters_table(params_text: str) -> str:
109 - """
110 - Convert parameter text into a markdown table.
111 - """
112 - lines = params_text.strip().split('\n')
113 - params = []
114 -
115 - for line in lines:
116 - name, desc = parse_param_line(line)
117 - if name and desc:
118 - params.append((name, desc))
119 -
120 - if not params:
121 - return params_text # Return original if no params found
122 -
123 - # Build markdown table
124 - table = ["| Parameter | Description |", "| --- | --- |"]
125 - for name, desc in params:
126 - # Clean up the description - remove trailing period if present
127 - desc = desc.rstrip('.')
128 - table.append(f"| `{name}` | {desc} |")
129 -
130 - return "\n".join(table)
131 -
132 -
133 -def parse_structured_docstring(docstring: str) -> Dict[str, any]:
134 - """
135 - Parse the structured docstring that contains XML tags and extract the data.
136 - Also handles RST-style parameter documentation.
137 - """
138 - data = {
139 - 'description': '',
140 - 'parameters': None,
141 - 'returns': None,
142 - 'return_type': None,
143 - 'raises': None,
144 - 'examples': []
145 - }
146 -
147 - # First, check for XML-wrapped sections
148 - # Parameters
149 - params_match = re.search(r'<parameters>(.*?)</parameters>', docstring, re.DOTALL)
150 - if params_match:
151 - data['parameters'] = params_match.group(1).strip()
152 - docstring = docstring.replace(params_match.group(0), '')
153 -
154 - # Returns
155 - returns_match = re.search(r'<returns>(.*?)</returns>', docstring, re.DOTALL)
156 - if returns_match:
157 - data['returns'] = returns_match.group(1).strip()
158 - docstring = docstring.replace(returns_match.group(0), '')
159 -
160 - # Return type
161 - rettype_match = re.search(r'<returntype>(.*?)</returntype>', docstring, re.DOTALL)
162 - if rettype_match:
163 - data['return_type'] = rettype_match.group(1).strip()
164 - docstring = docstring.replace(rettype_match.group(0), '')
165 -
166 - # Raises
167 - raises_match = re.search(r'<raises>(.*?)</raises>', docstring, re.DOTALL)
168 - if raises_match:
169 - data['raises'] = raises_match.group(1).strip()
170 - docstring = docstring.replace(raises_match.group(0), '')
171 -
172 - # Examples
173 - example_matches = re.findall(r'<ExampleCodeBlock[^>]*>(.*?)</ExampleCodeBlock>', docstring, re.DOTALL)
174 - for match in example_matches:
175 - data['examples'].append(match.strip())
176 - docstring = docstring.replace(match, '')
177 -
178 - # If no XML parameters found, look for RST-style parameters
179 - if not data['parameters']:
180 - lines = docstring.split('\n')
181 - param_lines = []
182 - return_lines = []
183 - description_lines = []
184 - in_params = False
185 - in_return = False
186 -
187 - for line in lines:
188 - if line.strip().startswith(':param '):
189 - in_params = True
190 - in_return = False
191 - param_lines.append(line)
192 - elif line.strip().startswith(':return:'):
193 - in_params = False
194 - in_return = True
195 - return_lines.append(line)
196 - elif line.strip().startswith(':raises:') or line.strip().startswith(':rtype:'):
197 - in_params = False
198 - in_return = False
199 - # Handle other RST fields if needed
200 - elif in_params and line.strip():
201 - param_lines.append(line)
202 - elif in_return and line.strip():
203 - return_lines.append(line)
204 - elif not in_params and not in_return and not line.strip().startswith(':'):
205 - description_lines.append(line)
206 -
207 - if param_lines:
208 - data['parameters'] = '\n'.join(param_lines)
209 - if return_lines:
210 - data['returns'] = '\n'.join(return_lines)
211 -
212 - # Clean up description
213 - data['description'] = '\n'.join(description_lines).strip()
214 - else:
215 - # The remaining docstring is the description
216 - data['description'] = docstring.strip()
217 -
218 - return data
219 -
220 -
221 -def create_custom_autodoc(original_autodoc):
222 - """
223 - Wrapper that modifies autodoc to use markdown formatting.
224 - """
225 - def markdown_autodoc(object_name, package, methods=None, return_anchors=False,
226 - page_info=None, version_tag_suffix="src/"):
227 - # Get the original result
228 - result = original_autodoc(object_name, package, methods=methods,
229 - return_anchors=return_anchors, page_info=page_info,
230 - version_tag_suffix=version_tag_suffix)
231 -
232 - if return_anchors:
233 - doc, anchors, errors = result
234 - # Convert the XML documentation to markdown
235 - doc = convert_xml_to_markdown(doc)
236 - return doc, anchors, errors
237 - else:
238 - # Convert the XML documentation to markdown
239 - return convert_xml_to_markdown(result)
240 -
241 - return markdown_autodoc
242 -
243 -
244 -def convert_xml_to_markdown(xml_doc: str) -> str:
245 - """
246 - Convert the XML/Svelte component output to clean Markdown.
247 - """
248 - output_parts = []
249 -
250 - # Remove all wrapping divs
251 - xml_doc = re.sub(r'<div class="[^"]*">\s*', '', xml_doc, flags=re.DOTALL)
252 - xml_doc = re.sub(r'</div>\s*', '', xml_doc, flags=re.DOTALL)
253 -
254 - # Find all docstring components (main class + methods)
255 - docstring_pattern = r'<docstring>(.*?)</docstring>(.*?)(?=<docstring>|$)'
256 - matches = re.findall(docstring_pattern, xml_doc, re.DOTALL)
257 -
258 - if not matches:
259 - # No docstring components found, return as-is
260 - return xml_doc
261 -
262 - for docstring_content, remaining_doc in matches:
263 - # Parse each docstring component
264 - name_match = re.search(r'<name>(.*?)</name>', docstring_content)
265 - anchor_match = re.search(r'<anchor>(.*?)</anchor>', docstring_content)
266 - source_match = re.search(r'<source>(.*?)</source>', docstring_content)
267 - params_match = re.search(r'<parameters>(.*?)</parameters>', docstring_content)
268 -
269 - name = name_match.group(1) if name_match else ""
270 - anchor = anchor_match.group(1) if anchor_match else ""
271 - source = source_match.group(1) if source_match else None
272 -
273 - # Parse parameters
274 - signature = []
275 - if params_match:
276 - try:
277 - signature = json.loads(params_match.group(1))
278 - except:
279 - pass
280 -
281 - # Format this component
282 - formatted = format_signature_markdown(name, anchor, signature, remaining_doc.strip(), source)
283 - output_parts.append(formatted)
284 -
285 - # Join all parts with appropriate spacing
286 - return "\n\n".join(output_parts)
\ No newline at end of file
fern/generators/python_sdk/process_sdk_docs.py deleted
-172
@@ -1,172 +0,0 @@
1 -#!/usr/bin/env python
2 -"""
3 -Process SDK documentation files with autodoc markers.
4 -
5 -This is a simplified version that doesn't require toctree validation.
6 -"""
7 -import os
8 -import re
9 -import importlib
10 -import logging
11 -from pathlib import Path
12 -from typing import Dict, Optional, Tuple
13 -from tqdm import tqdm
14 -
15 -from .autodoc_core.autodoc import autodoc, resolve_links_in_text
16 -from .markdown_formatter import convert_xml_to_markdown
17 -
18 -# Pattern to find [[autodoc]] markers
19 -_re_autodoc = re.compile(r"^\s*\[\[autodoc\]\]\s+(\S+)\s*$")
20 -
21 -# Setup logging
22 -logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
23 -logger = logging.getLogger(__name__)
24 -
25 -
26 -def process_autodoc_file(
27 - file_path: Path,
28 - package,
29 - page_info: Dict[str, str],
30 - version_tag_suffix: str = "python/"
31 -) -> Tuple[str, Dict[str, str]]:
32 - """
33 - Process a single file containing autodoc markers.
34 -
35 - Args:
36 - file_path: Path to the markdown file
37 - package: The Python package to document
38 - page_info: Information about the documentation page
39 - version_tag_suffix: Suffix for version tags in links
40 -
41 - Returns:
42 - Tuple of (processed content, anchor mapping)
43 - """
44 - with open(file_path, 'r', encoding='utf-8') as f:
45 - lines = f.read().split('\n')
46 -
47 - new_lines = []
48 - idx = 0
49 - anchors = {}
50 -
51 - while idx < len(lines):
52 - if _re_autodoc.search(lines[idx]) is not None:
53 - object_name = _re_autodoc.search(lines[idx]).groups()[0]
54 - logger.info(f"Processing autodoc: {object_name}")
55 -
56 - try:
57 - result = autodoc(
58 - object_name,
59 - package,
60 - return_anchors=True,
61 - page_info=page_info,
62 - version_tag_suffix=version_tag_suffix
63 - )
64 -
65 - doc, new_anchors, errors = result
66 - doc = convert_xml_to_markdown(doc)
67 -
68 - # Collect anchors
69 - page_name = file_path.stem
70 - for anchor in new_anchors:
71 - if isinstance(anchor, tuple):
72 - for a in anchor:
73 - anchors[a] = page_name
74 - else:
75 - anchors[anchor] = page_name
76 -
77 - if errors:
78 - logger.warning(f"Autodoc warnings for {object_name}: {errors}")
79 -
80 - new_lines.append(doc.strip())
81 -
82 - except Exception as e:
83 - logger.error(f"Error processing {object_name}: {e}")
84 - new_lines.append(lines[idx])
85 - else:
86 - new_lines.append(lines[idx])
87 -
88 - idx += 1
89 -
90 - content = '\n'.join(new_lines)
91 - return content, anchors
92 -
93 -
94 -def build_sdk_docs(
95 - source_dir: Path,
96 - output_dir: Path,
97 - package_name: str,
98 - version: str = "main",
99 - clean: bool = False
100 -):
101 - """
102 - Build SDK documentation from markdown files with autodoc markers.
103 -
104 - Args:
105 - source_dir: Directory containing source markdown files
106 - output_dir: Directory where processed files will be written
107 - package_name: Name of the Python package to document
108 - version: Version of the documentation
109 - clean: Whether to clean the output directory before building
110 - """
111 - source_dir = Path(source_dir)
112 - output_dir = Path(output_dir)
113 -
114 - if not source_dir.exists():
115 - raise ValueError(f"Source directory {source_dir} does not exist")
116 -
117 - # Clean output directory if requested
118 - if clean and output_dir.exists():
119 - import shutil
120 - shutil.rmtree(output_dir)
121 -
122 - output_dir.mkdir(parents=True, exist_ok=True)
123 -
124 - # Import the package
125 - try:
126 - package = importlib.import_module(package_name)
127 - except ImportError as e:
128 - raise ImportError(f"Failed to import package {package_name}: {e}")
129 -
130 - # Page info for documentation
131 - page_info = {
132 - "version": version,
133 - "version_tag": version,
134 - "language": "en",
135 - "package_name": package_name,
136 - }
137 -
138 - # Phase 1: Process all files and collect anchors
139 - logger.info("Phase 1: Processing autodoc markers and collecting anchors")
140 - all_anchors = {}
141 - file_contents = {}
142 -
143 - markdown_files = list(source_dir.glob("**/*.md")) + list(source_dir.glob("**/*.mdx"))
144 -
145 - for file_path in tqdm(markdown_files, desc="Processing files"):
146 - if file_path.is_file():
147 - logger.info(f"Processing: {file_path}")
148 - content, anchors = process_autodoc_file(file_path, package, page_info)
149 -
150 - # Store content and anchors
151 - relative_path = file_path.relative_to(source_dir)
152 - file_contents[relative_path] = content
153 - all_anchors.update(anchors)
154 -
155 - logger.info(f"Collected {len(all_anchors)} anchors")
156 -
157 - # Phase 2: Resolve cross-references
158 - logger.info("Phase 2: Resolving cross-references")
159 -
160 - for relative_path, content in tqdm(file_contents.items(), desc="Resolving links"):
161 - # Resolve cross-references
162 - resolved_content = resolve_links_in_text(content, package, all_anchors, page_info)
163 -
164 - # Write output file
165 - output_path = output_dir / relative_path
166 - output_path.parent.mkdir(parents=True, exist_ok=True)
167 -
168 - with open(output_path, 'w', encoding='utf-8') as f:
169 - f.write(resolved_content)
170 -
171 - logger.info(f"Documentation built successfully in {output_dir}")
172 - return all_anchors
\ No newline at end of file
fern/generators/python_sdk/templates/index.mdx
fern/generators/python_sdk/templates/sdk-reference.md deleted
-55
@@ -1,55 +0,0 @@
1 -# Composio Python SDK Reference
2 -
3 -This is the comprehensive SDK reference for the Composio Python SDK.
4 -
5 -## Main SDK Class
6 -
7 -The main entry point for the Composio SDK.
8 -
9 -[[autodoc]] composio.Composio
10 -
11 -## Core Models
12 -
13 -### Tools
14 -
15 -[[autodoc]] composio.core.models.Tools
16 -
17 -### Toolkits
18 -
19 -[[autodoc]] composio.core.models.Toolkits
20 -
21 -### Connected Accounts
22 -
23 -[[autodoc]] composio.core.models.ConnectedAccounts
24 -
25 -### Auth Configs
26 -
27 -[[autodoc]] composio.core.models.AuthConfigs
28 -
29 -### Triggers
30 -
31 -[[autodoc]] composio.core.models.Triggers
32 -
33 -## Decorators
34 -
35 -### before_execute
36 -
37 -[[autodoc]] composio.before_execute
38 -
39 -### after_execute
40 -
41 -[[autodoc]] composio.after_execute
42 -
43 -### schema_modifier
44 -
45 -[[autodoc]] composio.schema_modifier
46 -
47 -## Cross References
48 -
49 -The [`Composio`] class is the main entry point for all SDK operations. It provides access to:
50 -- [`Tools`] for tool management and execution
51 -- [`Toolkits`] for toolkit operations
52 -- [`ConnectedAccounts`] for managing authentication
53 -- [`Triggers`] for webhook and event handling
54 -
55 -When you call [`Tools.execute`], it can use the [`before_execute`] and [`after_execute`] decorators to modify behavior.
\ No newline at end of file
fern/generators/python_sdk/test_generator.py deleted
-83
@@ -1,83 +0,0 @@
1 -#!/usr/bin/env python
2 -"""
3 -Test the SDK documentation generator
4 -"""
5 -import sys
6 -from pathlib import Path
7 -import tempfile
8 -import shutil
9 -
10 -# Add current directory to path
11 -sys.path.insert(0, str(Path(__file__).parent))
12 -
13 -from process_sdk_docs import build_sdk_docs
14 -
15 -
16 -def test_generator():
17 - """Test the documentation generator with a simple example."""
18 -
19 - # Use the actual fern directory structure
20 - fern_dir = Path(__file__).parent.parent.parent
21 - source_dir = fern_dir / "generators" / "python-sdk" / "templates"
22 - output_dir = fern_dir / "docs" / "sdk" / "python"
23 -
24 - # Create source directory if it doesn't exist
25 - source_dir.mkdir(parents=True, exist_ok=True)
26 -
27 - # Create a test markdown file
28 - test_file = source_dir / "sdk-reference.md"
29 - if not test_file.exists():
30 - test_file.write_text("""# Composio SDK Reference
31 -
32 -## Main Class
33 -
34 -[[autodoc]] composio.Composio
35 -
36 -## Tools
37 -
38 -[[autodoc]] composio.core.models.Tools
39 -
40 -## Cross References
41 -
42 -The [`Composio`] class is the main entry point.
43 -""")
44 -
45 - print(f"Created test file: {test_file}")
46 - print("Running documentation generator...")
47 -
48 - try:
49 - # Run the generator
50 - anchors = build_sdk_docs(
51 - source_dir=source_dir,
52 - output_dir=output_dir,
53 - package_name="composio",
54 - version="test",
55 - repo_owner="composio"
56 - )
57 -
58 - print(f"\nGenerated {len(anchors)} anchors")
59 - print("\nOutput files:")
60 - for file in output_dir.rglob("*"):
61 - if file.is_file():
62 - print(f" - {file.relative_to(output_dir)}")
63 - print(f" Size: {file.stat().st_size} bytes")
64 -
65 - # Read and display the output
66 - output_file = output_dir / "sdk-reference.md"
67 - if output_file.exists():
68 - print("\nGenerated content preview:")
69 - print("-" * 50)
70 - content = output_file.read_text()
71 - print(content[:500] + "..." if len(content) > 500 else content)
72 - print("-" * 50)
73 -
74 - print("\nTest completed successfully!")
75 -
76 - except Exception as e:
77 - print(f"\nError during test: {e}")
78 - import traceback
79 - traceback.print_exc()
80 -
81 -
82 -if __name__ == "__main__":
83 - test_generator()
\ No newline at end of file
fern/generators/tool_doc_generator/__init__.py deleted
-1
@@ -1 +0,0 @@
1 -"""Tool Documentation Generator for Composio."""
\ No newline at end of file
fern/generators/tool_doc_generator/base_docs.py deleted
-18
@@ -1,18 +0,0 @@
1 -base_layout = [
2 - {
3 - "section": "Toolkits",
4 - "skip-slug": True,
5 - "contents": [
6 - {
7 - "page": "Introduction",
8 - "path": "toolkits/src/introduction.mdx",
9 - "slug": "toolkits/introduction"
10 - },
11 - {
12 - "page": "Premium Tools",
13 - "path": "toolkits/src/premium-tools.mdx",
14 - "slug": "toolkits/premium-tools"
15 - }
16 - ]
17 - }
18 -]
fern/generators/tool_doc_generator/main.py deleted
-986
@@ -1,986 +0,0 @@
1 -#!/usr/bin/env python
2 -"""
3 -Tool Documentation Generator for Composio.
4 -
5 -This script automates the generation of MDX documentation for Composio tools.
6 -"""
7 -
8 -import argparse
9 -import concurrent.futures
10 -import html
11 -import logging
12 -import os
13 -import re
14 -import sys
15 -import threading
16 -import traceback
17 -import typing as t
18 -from dataclasses import dataclass, field
19 -from pathlib import Path
20 -
21 -# Disable telemetry to avoid background network requests
22 -os.environ["COMPOSIO_TELEMETRY_DISABLED"] = "true"
23 -os.environ["COMPOSIO_DISABLE_TELEMETRY"] = "true"
24 -os.environ["TELEMETRY_DISABLED"] = "true"
25 -
26 -# Import MDX linting functionality
27 -from composio import Composio
28 -from composio.client.types import (
29 - Tool,
30 - toolkit_list_response,
31 - toolkit_retrieve_response,
32 -)
33 -from dotenv import load_dotenv
34 -from inflection import titleize
35 -from generators.tool_doc_generator.mdx_formatter import MDX
36 -from generators.tool_doc_generator.base_docs import base_layout
37 -
38 -# Import from the same directory
39 -
40 -
41 -IMPORTANT_TOOL_SLUGS = [
42 - "twitter",
43 - "gmail",
44 - "github",
45 - "notion",
46 - "googlesheets",
47 - "shopify",
48 - "stripe",
49 -]
50 -
51 -
52 -try:
53 - from ruamel.yaml import YAML
54 -
55 - USE_RUAMEL = True
56 -except ImportError:
57 - # Fallback to standard yaml if ruamel.yaml is not available
58 - import yaml as yaml_module # Renamed to avoid unused import warning
59 -
60 - USE_RUAMEL = False
61 - logger = logging.getLogger(__name__)
62 - logger.warning(
63 - "ruamel.yaml not found, falling back to standard yaml. Install with: uv pip install ruamel.yaml"
64 - )
65 -
66 -
67 -# Configure logging
68 -logger = logging.getLogger(__name__)
69 -
70 -
71 -class TelemetryFilter(logging.Filter):
72 - """Filter out telemetry-related log messages"""
73 -
74 - def filter(self, record):
75 - # Filter out telemetry-related messages
76 - message = record.getMessage()
77 - telemetry_keywords = [
78 - "telemetry.composio.dev",
79 - "telemetry",
80 - "TELEMETRY",
81 - "metrics/invocations",
82 - "errors",
83 - ]
84 -
85 - # Also filter by logger name
86 - if "telemetry" in record.name.lower():
87 - return False
88 -
89 - # Filter by message content
90 - for keyword in telemetry_keywords:
91 - if keyword in message:
92 - return False
93 -
94 - return True
95 -
96 -
97 -def sanitize_html(text: str) -> str:
98 - """
99 - Sanitize HTML content by removing HTML tags and decoding HTML entities.
100 - Also escapes problematic characters that might break MDX parsing.
101 -
102 - Args:
103 - text: The text to sanitize
104 -
105 - Returns:
106 - Sanitized text safe for MDX
107 - """
108 - if not text:
109 - return ""
110 -
111 - # Convert text to string if it's not already
112 - text = str(text)
113 -
114 - # Remove HTML tags
115 - text = re.sub(r"<.*?>", "", text)
116 -
117 - # Handle comparison operators that break MDX
118 - # These are the specific patterns we saw in the error output
119 - text = re.sub(r"<(\d+)", r"less than \1", text) # <4mb -> less than 4mb
120 - text = re.sub(r">(\d+)", r"greater than \1", text) # >10 -> greater than 10
121 - text = re.sub(r"<=(\d+)", r"less than or equal to \1", text)
122 - text = re.sub(r">=(\d+)", r"greater than or equal to \1", text)
123 -
124 - # For standalone < and > characters, replace with safer alternatives
125 - text = re.sub(r"(?<!\w)<(?!\w)", "&lt;", text)
126 - text = re.sub(r"(?<!\w)>(?!\w)", "&gt;", text)
127 -
128 - # Replace quote types that can break MDX
129 -
130 - # Escape pipe characters that can break tables
131 - text = text.replace("|", "\\|")
132 - text = re.sub(r"\{([^}]*)\s+([^}]*)\}", r"{\1_\2}", text)
133 -
134 - # Handle JSON examples with quotes
135 - if "{" in text and "}" in text:
136 - # Replace single and double quotes in JSON with backticks
137 - text = re.sub(
138 - r"(\{[^{}]*\})", lambda m: m.group(0).replace("'", "`").replace('"', "`"), text
139 - )
140 -
141 - # If we still have curly braces, wrap them in code tags
142 - text = re.sub(r"(\{[^{}]+\})", r"`\1`", text)
143 -
144 - # Handle special characters that might trigger MDX parsing
145 - text = text.replace("$", "\\$")
146 - text = text.replace("%", "\\%")
147 -
148 - # Some special HTML entities need to be preserved during unescaping
149 - text = html.unescape(text.replace("&lt;", "_LT_").replace("&gt;", "_GT_"))
150 - text = text.replace("_LT_", "&lt;").replace("_GT_", "&gt;")
151 -
152 - # Remove any trailing/leading whitespace
153 - text = text.strip()
154 -
155 - return text
156 -
157 -
158 -@dataclass
159 -class DocumentContent:
160 - """Document content builder for Composio tool documentation."""
161 -
162 - _blocks: list[str] = field(default_factory=list)
163 -
164 - def add_frontmatter(self, app_name: str, category: t.Optional[str] = None) -> "DocumentContent":
165 - """
166 - Add frontmatter section to the document.
167 -
168 - Args:
169 - app_name: The name of the application
170 - category: The category of the application
171 -
172 - Returns:
173 - Self reference for method chaining
174 - """
175 - self._blocks.append(MDX.as_frontmatter(app_name, category))
176 - return self
177 -
178 - def add_overview_section(
179 - self,
180 - app_name: str,
181 - app_id: str,
182 - description: str,
183 - auth_schemes: t.Optional[t.List[toolkit_retrieve_response.AuthConfigDetail]] = None,
184 - tags: t.Optional[list] = None,
185 - ) -> "DocumentContent":
186 - """
187 - Add overview section to the document.
188 -
189 - Args:
190 - app_name: The name of the application
191 - app_id: The application ID
192 - description: Application description
193 - auth_schemes: Authentication schemes for the app
194 - tags: Tags supported by the app
195 -
196 - Returns:
197 - Self reference for method chaining
198 - """
199 - # Main overview header
200 - self._blocks.extend(
201 - [
202 - "## Overview",
203 - f"**SLUG**: `{app_id.upper()}`",
204 - f"### Description\n{sanitize_html(description)}",
205 - ]
206 - )
207 -
208 - # Authentication schemes if present
209 - if auth_schemes:
210 - self._add_auth_schemes(auth_schemes)
211 -
212 - # Tags if present
213 - if tags:
214 - self._blocks.append("### Tags Supported")
215 - for tag in tags:
216 - self._blocks.append(f"- `{tag}`")
217 -
218 - return self
219 -
220 - def add_connection_section(
221 - self,
222 - app_name: str,
223 - app_slug: str,
224 - auth_schemes: t.Optional[t.List[toolkit_retrieve_response.AuthConfigDetail]] = None,
225 - ) -> None:
226 - schemes = ", ".join(
227 - self._get_auth_type(s) for s in (auth_schemes or []) if self._extract_auth_fields(s)
228 - )
229 - self._blocks.extend(
230 - [
231 - f"""## Connecting to {app_name}
232 -### Create an auth config
233 -Use the dashboard to create an auth config for the {app_name} toolkit. This allows you to connect multiple {app_name} accounts to Composio for agents to use.
234 -
235 -<Steps>
236 - <Step title="Select App">
237 - Navigate to **[{app_name}](https://platform.composio.dev?next_page=/marketplace/{app_name})**.
238 - </Step>
239 - <Step title="Configure Auth Config Settings">
240 - Select among the supported auth schemes of and configure them here.
241 - </Step>
242 - <Step title="Create and Get auth config ID">
243 - Click **"Create {app_name} Auth Config"**. After creation, **copy the displayed ID starting with `ac_`**. This is your auth config ID. This is _not_ a sensitive ID -- you can save it in environment variables or a database.
244 - **This ID will be used to create connections to the toolkit for a given user.**
245 - </Step>
246 -</Steps>
247 -"""
248 - ],
249 - )
250 -
251 - # Add auth code snippets
252 - self._add_auth_section(app_name, app_slug, auth_schemes)
253 -
254 - def _add_auth_section(
255 - self,
256 - app_name: str,
257 - app_slug: str,
258 - auth_schemes: t.List[toolkit_retrieve_response.AuthConfigDetail] = None,
259 - ) -> None:
260 - """Add code snippets for each auth scheme using direct template processing"""
261 - if not auth_schemes:
262 - return
263 -
264 - self._blocks.append("### Connect Your Account")
265 -
266 - # Group auth schemes by type to avoid duplicates
267 - seen_auth_types = set()
268 -
269 - for scheme in auth_schemes:
270 - # Get normalized auth type
271 - auth_type_display = self._get_auth_type(scheme)
272 - auth_type_key = auth_type_display.lower().replace(" ", "_")
273 -
274 - # Skip if we've already shown this auth type or if it's no_auth
275 - if auth_type_key in seen_auth_types or auth_type_key == "no_auth":
276 - continue
277 - seen_auth_types.add(auth_type_key)
278 -
279 - # Add section for this auth type
280 - self._blocks.append(f"#### Using {auth_type_display}")
281 -
282 - # Prepare variables for template replacement
283 - template_vars = {
284 - "toolkit_name": app_name,
285 - "toolkit_slug": app_slug.lower(),
286 - "auth_config_id": f"ac_YOUR_{app_slug.upper()}_CONFIG_ID",
287 - "user_id": "user@example.com",
288 - "api_key_placeholder": f"your_{app_slug.lower()}_api_key",
289 - "username_placeholder": f"your_{app_slug.lower()}_username",
290 - "password_placeholder": f"your_{app_slug.lower()}_password",
291 - "bearer_token_placeholder": f"your_{app_slug.lower()}_bearer_token"
292 - }
293 -
294 - try:
295 - # Create code blocks using the new template method
296 - python_block = MDX.as_code_block_from_template(
297 - f"templates/python/{auth_type_key}.py",
298 - template_vars=template_vars,
299 - title="Python",
300 - max_lines=40,
301 - word_wrap=True
302 - )
303 -
304 - typescript_block = MDX.as_code_block_from_template(
305 - f"templates/typescript/{auth_type_key}.ts",
306 - template_vars=template_vars,
307 - title="TypeScript",
308 - max_lines=40,
309 - word_wrap=True
310 - )
311 -
312 - # Add code blocks wrapped in CodeGroup
313 - self._blocks.append(MDX.as_code_group(python_block, typescript_block))
314 -
315 - except Exception as e:
316 - logger.warning(f"Failed to process auth template for {auth_type_key}: {e}")
317 - # Fallback to a simple message if template processing fails
318 - self._blocks.append(f"*Authentication template for {auth_type_display} coming soon*")
319 -
320 - def _add_auth_schemes(
321 - self, auth_schemes: t.List[toolkit_retrieve_response.AuthConfigDetail]
322 - ) -> None:
323 - """Add authentication schemes section."""
324 - self._blocks.append("### Authentication Details")
325 -
326 - for scheme in auth_schemes:
327 - fields = self._extract_auth_fields(scheme)
328 - if fields:
329 - auth_type = self._get_auth_type(scheme)
330 - self._blocks.append(MDX.as_accordion(auth_type, "\n".join(fields)))
331 -
332 - def _extract_auth_fields(
333 - self, scheme: toolkit_retrieve_response.AuthConfigDetail
334 - ) -> t.List[str]:
335 - """Extract authentication fields from scheme."""
336 - fields = []
337 -
338 - if hasattr(scheme, "fields") and scheme.fields:
339 - for field in scheme.fields:
340 - fields.extend(self._process_tuple_field(field))
341 -
342 - return fields
343 -
344 - def _process_tuple_field(self, field: tuple) -> t.List[str]:
345 - """Process tuple-style authentication field."""
346 - fields = []
347 - _, field_config = field
348 -
349 - for field_list, required in [
350 - (getattr(field_config, "required", []), True),
351 - (getattr(field_config, "optional", []), False),
352 - ]:
353 - for f in field_list:
354 - if hasattr(f, "name"):
355 - fields.append(self._create_param_from_field(f, required))
356 -
357 - return fields
358 -
359 - def _create_param_from_field(
360 - self, field: toolkit_retrieve_response.AuthConfigDetail, required: t.Optional[bool] = None
361 - ) -> str:
362 - """Create parameter string from field object."""
363 - return MDX.as_param(
364 - name=str(field.name).replace('"', '\\"'),
365 - required=required if required is not None else getattr(field, "required", False),
366 - typ=str(getattr(field, "type", "")).replace('"', '\\"'),
367 - default=str(getattr(field, "default", "")).replace('"', '\\"')
368 - if getattr(field, "default", None)
369 - else "",
370 - doc=str(getattr(field, "description", "")).replace('"', '\\"'),
371 - )
372 -
373 - def _get_auth_type(self, scheme: toolkit_retrieve_response.AuthConfigDetail) -> str:
374 - """Get authentication type from scheme."""
375 - auth_type = (
376 - getattr(scheme, "mode", None)
377 - or getattr(scheme, "type", None)
378 - or getattr(scheme, "auth_type", None)
379 - or getattr(scheme, "auth_mode", None)
380 - or "Authentication"
381 - )
382 -
383 - auth_type_mapping = {
384 - "oauth2": "OAuth2",
385 - "OAUTH2": "OAuth2",
386 - "api_key": "API Key",
387 - "API_KEY": "API Key",
388 - "bearer_token": "Bearer Token",
389 - "BEARER_TOKEN": "Bearer Token",
390 - "basic": "Basic Auth",
391 - "BASIC": "Basic Auth",
392 - "no_auth": "No Authentication",
393 - "NO_AUTH": "No Authentication",
394 - }
395 -
396 - return auth_type_mapping.get(auth_type, auth_type.replace("_", " ").title())
397 -
398 - def add_actions(self, actions: t.List[Tool], app_name: str, app_slug: str) -> "DocumentContent":
399 - """
400 - Add actions section to the document.
401 -
402 - Args:
403 - actions: List of tool models to document
404 - app_name: The name of the application
405 - app_slug: The application slug
406 -
407 - Returns:
408 - Self reference for method chaining
409 - """
410 - # If this is the first action, add the Actions header
411 - if not any("## Tools" in block for block in self._blocks):
412 - self._blocks.append("## Tools")
413 - self._blocks.append("### Executing tools")
414 - self._blocks.append(f"""To prototype you can execute some tools to see the responses and working on the [{app_name} toolkit's playground](https://app.composio.dev/app/{app_name})""")
415 - self._blocks.append("")
416 - self._blocks.append("For code examples, see the [Tool calling guide](/tool-calling/executing-tool-calls) and [Provider examples](/provider-apis).")
417 - self._blocks.append("### Tool List")
418 -
419 - action_contents = []
420 -
421 - logger.info(f"Processing {len(actions)} actions for documentation")
422 - for i, tool in enumerate(actions):
423 - content = self._process_tool(tool)
424 - if content:
425 - action_contents.append(content)
426 -
427 - # Only wrap in accordion group if there are actions
428 - if action_contents:
429 - self._blocks.append(MDX.as_accordion_group("\n".join(action_contents)))
430 - else:
431 - logger.info(f"No action content generated for {len(actions)} tools")
432 - self._blocks.append("""This app has actions coming soon! Feel free to raise a request for it in our [GitHub Issues](https://github.com/ComposioHQ/composio/issues).
433 -
434 - You can also create [custom actions](/tool-calling/customizing-tools#extending-composio-toolkits) for the app using Composio Auth.""")
435 - return self
436 -
437 - def _process_tool(self, tool: Tool) -> t.Optional[str]:
438 - """Process a single tool and return accordion content."""
439 - tool_data = self._extract_tool_data(tool)
440 - if not tool_data["name"]:
441 - return None
442 -
443 - content = [
444 - f"**Tool Name:** {self._sanitize_action_name(tool_data['name'])}\n\n**Description**\n",
445 - MDX.as_code_block(tool_data["description"], "text"),
446 - ]
447 -
448 - # Add parameters
449 - content.append("\n**Action Parameters**\n")
450 - content.append("\n".join(self._process_parameters(tool_data["params"])))
451 -
452 - # Add responses
453 - content.append("\n**Action Response**\n")
454 - content.append("\n".join(self._process_parameters(tool_data["response"])))
455 -
456 - # safe_name = self._sanitize_action_name(tool_data['name'])
457 - return MDX.as_accordion(tool_data["slug"], "\n".join(content))
458 -
459 - def _extract_tool_data(self, tool: Tool) -> t.Dict[str, t.Any]:
460 - """Extract data from tool object or dict."""
461 -
462 - return {
463 - "name": tool.name or tool.slug,
464 - "description": tool.description,
465 - "slug": tool.slug,
466 - "params": tool.input_parameters,
467 - "response": tool.output_parameters,
468 - }
469 -
470 - def _process_parameters(self, params: t.Any) -> t.List[str]:
471 - """Process parameters from various formats."""
472 - if not params or not isinstance(params, dict):
473 - return []
474 -
475 - param_list = []
476 -
477 - if "properties" in params:
478 - properties = params.get("properties", {})
479 - required = params.get("required", [])
480 -
481 - for name, schema in properties.items():
482 - param_list.append(
483 - MDX.as_param(
484 - name=name,
485 - typ=str(schema.get("type", "")),
486 - doc=sanitize_html(schema.get("description", "")),
487 - default=schema.get("default", ""),
488 - required=name in required,
489 - )
490 - )
491 - else:
492 - for name, schema in params.items():
493 - if isinstance(schema, dict):
494 - param_list.append(
495 - MDX.as_param(
496 - name=name,
497 - typ=str(schema.get("type", "")),
498 - doc=sanitize_html(schema.get("description", "")),
499 - default=schema.get("default", ""),
500 - required=schema.get("required", False),
501 - )
502 - )
503 -
504 - return param_list
505 -
506 - def _sanitize_action_name(self, name: str) -> str:
507 - """Sanitize action name for MDX."""
508 - if "<" in name or ">" in name:
509 - replacements = [
510 - (r"<(\d+)", r"less than \1"),
511 - (r">(\d+)", r"greater than \1"),
512 - (r"<=(\d+)", r"less than or equal to \1"),
513 - (r">=(\d+)", r"greater than or equal to \1"),
514 - ]
515 - for pattern, replacement in replacements:
516 - name = re.sub(pattern, replacement, name)
517 - name = name.replace("<", "&lt;").replace(">", "&gt;")
518 -
519 - return name
520 -
521 - def __str__(self) -> str:
522 - """Convert document content to string."""
523 - return "\n\n".join(self._blocks)
524 -
525 -
526 -class ToolDocGenerator:
527 - """
528 - Tool Documentation Generator for Composio.
529 -
530 - Generates MDX documentation files for Composio tools.
531 - """
532 -
533 - def __init__(self, include_local: bool = False):
534 - """
535 - Initialize the tool documentation generator.
536 -
537 - Args:
538 - include_local: Whether to include local development tools
539 - """
540 - # Load environment variables
541 - load_dotenv()
542 -
543 - # Initialize composio client
544 - self.composio = Composio()
545 - self.include_local = include_local
546 -
547 - # For tracking generated tools
548 - self.generated_tools = []
549 - self.problematic_actions = []
550 -
551 - def generate_docs(
552 - self, output_path: Path, max_workers: int | None = None, limit: int | None = None
553 - ) -> None:
554 - """
555 - Generate documentation for all apps in parallel.
556 -
557 - Args:
558 - output_path: Path to output directory
559 - max_workers: Maximum number of parallel workers (default: CPU count * 5)
560 - limit: Limit processing to first N toolkits (for debugging)
561 - """
562 - # Ensure output directory exists
563 - output_path.mkdir(parents=True, exist_ok=True)
564 -
565 - # Get all apps
566 - toolkits = self.composio.toolkits.get()
567 -
568 - # Apply limit if specified
569 - if limit is not None:
570 - toolkits = toolkits[:limit]
571 - logger.info(f"Limited to first {limit} toolkits")
572 -
573 - logger.info(f"Starting documentation generation for {len(toolkits)} toolkits")
574 -
575 - # Track failures with a synchronized list
576 - from threading import Lock
577 -
578 - failed_apps = []
579 - failed_apps_lock = Lock()
580 -
581 - # Set default max workers if not specified
582 - if max_workers is None:
583 - import multiprocessing
584 -
585 - # Use CPU count as default but cap at 10 to avoid connection pool issues
586 - max_workers = min(10, multiprocessing.cpu_count())
587 -
588 - def process_app(toolkit):
589 - """Process a single toolkit with proper exception handling"""
590 - try:
591 - self._generate_app_doc(toolkit, output_path)
592 - logger.info(f"✅ Generated docs for {toolkit.name}")
593 - return True
594 - except Exception as e:
595 - with failed_apps_lock:
596 - failed_apps.append((toolkit.name, str(e)))
597 - logger.error(f"❌ Failed to generate docs for {toolkit.name}: {e}")
598 - if logger.isEnabledFor(logging.DEBUG):
599 - logger.info(traceback.format_exc())
600 - return False
601 -
602 - # Use ThreadPoolExecutor for parallel processing
603 - with concurrent.futures.ThreadPoolExecutor(max_workers=max_workers) as executor:
604 - # Submit all app processing tasks
605 - future_to_app = {executor.submit(process_app, toolkit): toolkit for toolkit in toolkits}
606 -
607 - # Collect results as they complete
608 - success_count = 0
609 - for future in concurrent.futures.as_completed(future_to_app):
610 - if future.result():
611 - success_count += 1
612 -
613 - # Log final statistics
614 - if failed_apps:
615 - logger.warning("\nFailed to generate docs for the following toolkits:")
616 - for app_name, error in failed_apps:
617 - logger.warning(f"- {app_name}: {error}")
618 - logger.warning(f"\nTotal failed toolkits: {len(failed_apps)}/{len(toolkits)}")
619 - else:
620 - logger.info(f"\nSuccessfully generated docs for all {len(toolkits)} toolkits!")
621 -
622 - logger.info(
623 - f"Generated {success_count} toolkit docs in parallel using {max_workers} workers"
624 - )
625 -
626 - # Update docs.yml with the generated tools
627 - self.update_docs_yml(output_path.parent / "docs.yml")
628 -
629 - def _generate_app_doc(self, toolkit: toolkit_list_response.Item, output_path: Path) -> None:
630 - """
631 - Generate documentation for a single toolkit.
632 -
633 - Args:
634 - toolkit: The toolkit to generate documentation for
635 - output_path: Output directory path
636 - """
637 - # Get toolkit model and tools
638 - toolkit_model = self.composio.toolkits.get(slug=toolkit.slug)
639 - tools = self.composio.tools.get_raw_composio_tools(toolkits=[toolkit.slug], limit=99999)
640 - logger.info(f"Toolkit tools: {toolkit}")
641 -
642 - logger.info(f"Retrieved {len(tools)} tools for {toolkit.name}")
643 -
644 - # Skip toolkits with zero tools
645 - if len(tools) == 0:
646 - logger.info(f"Skipping {toolkit.name} - no tools available")
647 - return
648 -
649 - if tools:
650 - logger.debug(f"First tool type: {type(tools[0])}")
651 - if hasattr(tools[0], "__dict__"):
652 - logger.debug(f"First tool attributes: {list(tools[0].__dict__.keys())}")
653 - elif isinstance(tools[0], dict):
654 - logger.debug(f"First tool dict keys: {list(tools[0].keys())}")
655 - logger.debug(f"Sample tool: {str(tools[0])[:200]}...")
656 -
657 - # Create content
658 - content = DocumentContent()
659 -
660 - # Special case for Monday - use lowercase everywhere
661 - display_name = toolkit.name
662 - if toolkit.name == "Monday":
663 - display_name = "monday"
664 -
665 - # Extract category from toolkit meta
666 - category = None
667 - if toolkit_model.meta.categories:
668 - # Use the first category if multiple exist
669 - category = (
670 - toolkit_model.meta.categories[0].get("name")
671 - if isinstance(toolkit_model.meta.categories[0], dict)
672 - else getattr(toolkit_model.meta.categories[0], "name", None)
673 - )
674 -
675 - # Add frontmatter
676 - content.add_frontmatter(display_name, category)
677 -
678 - # Handle auth schemes safely
679 - auth_schemes = None
680 - try:
681 - auth_schemes = toolkit_model.auth_config_details
682 - except Exception as e:
683 - logger.info(f"Could not process auth schemes for {display_name}: {e}")
684 - # Continue without auth schemes
685 -
686 - no_auth = "NO_AUTH" in (toolkit.auth_schemes or [])
687 -
688 - logger.info(f"No auth: {no_auth}")
689 -
690 - # Add overview section
691 - # For no-auth tools, don't pass auth_schemes to avoid showing authentication details
692 - content.add_overview_section(
693 - app_name=display_name,
694 - app_id=toolkit.slug,
695 - description=toolkit.meta.description,
696 - auth_schemes=None if no_auth else auth_schemes,
697 - )
698 -
699 - # Only add connection section if authentication is required
700 - if not no_auth:
701 - content.add_connection_section(
702 - app_name=display_name, app_slug=toolkit.slug, auth_schemes=auth_schemes
703 - )
704 -
705 - # Filter out problematic actions
706 - filtered_tools = []
707 - for tool in tools:
708 - # Extract tool slug for filtering
709 - if isinstance(tool, dict):
710 - if "function" in tool:
711 - tool_slug = tool["function"].get("name", "")
712 - else:
713 - tool_slug = tool.get("slug", "")
714 - else:
715 - tool_slug = getattr(tool, "slug", "")
716 -
717 - if tool_slug not in self.problematic_actions:
718 - filtered_tools.append(tool)
719 - else:
720 - logger.info(f"Filtered out problematic tool: {tool_slug}")
721 -
722 - logger.info(f"After filtering: {len(filtered_tools)} tools remaining out of {len(tools)}")
723 -
724 - # Add actions section (only the filtered ones)
725 - content.add_actions(filtered_tools, app_name=display_name, app_slug=toolkit.slug)
726 -
727 - # Write to file
728 - filename = f"{toolkit.slug.lower()}.mdx"
729 - output_file = output_path / filename
730 - content_str = str(content)
731 -
732 - output_file.write_text(content_str)
733 -
734 - # Track the generated tool for docs.yml update
735 - with threading.Lock():
736 - # Special case for Monday - keep it lowercase in sidebar too
737 - if toolkit.name == "Monday":
738 - yml_display_name = "monday"
739 - else:
740 - yml_display_name = titleize(toolkit.name.lower())
741 -
742 - self.generated_tools.append(
743 - {
744 - "name": toolkit.slug.lower(),
745 - "display_name": yml_display_name,
746 - "path": f"toolkits/{filename}",
747 - "category": category,
748 - "tool_count": len(tools),
749 - "no_auth": no_auth,
750 - }
751 - )
752 -
753 - def update_docs_yml(self, docs_yml_path: Path) -> None:
754 - """
755 - Update the docs.yml file with the generated tools, grouped by section:
756 - - Important
757 - - Categories (each key becomes a section)
758 - - Proxy Apps
759 - - No Auth
760 -
761 - Args:
762 - docs_yml_path: Path to the docs.yml file
763 - """
764 - import yaml # Use PyYAML for writing
765 -
766 - logger.info(f"Updating docs.yml with {len(self.generated_tools)} tools")
767 -
768 - try:
769 - # Sort tools alphabetically by name
770 - sorted_tools = sorted(self.generated_tools, key=lambda x: x["name"])
771 -
772 - # Prepare sections
773 - important_tools = []
774 - proxy_apps = []
775 - no_auth_tools = []
776 - categories: dict[str, list] = {}
777 -
778 - for tool in sorted_tools:
779 - entry = {
780 - "page": tool["display_name"],
781 - "slug": "toolkits/" + tool["name"],
782 - "path": tool["path"],
783 - }
784 - name = tool["name"]
785 - category = tool.get("category", "").strip()
786 -
787 - if name in IMPORTANT_TOOL_SLUGS:
788 - important_tools.append(entry)
789 - elif tool.get("tool_count") == 0:
790 - proxy_apps.append(entry)
791 - elif tool.get("no_auth"):
792 - no_auth_tools.append(entry)
793 - elif category:
794 - lower_category = category.lower()
795 - if lower_category not in categories:
796 - categories[lower_category] = []
797 - categories[lower_category].append(entry)
798 -
799 - # Read the current docs.yml
800 - with open(docs_yml_path, "r") as f:
801 - docs_data = yaml.safe_load(f)
802 -
803 - logger.info(f"Important tools: {important_tools}")
804 - logger.info(f"Proxy apps: {proxy_apps}")
805 - logger.info(f"No auth tools: {no_auth_tools}")
806 -
807 - # Sort categories by number of elements (descending), then by name
808 - sorted_categories = sorted(
809 - categories.items(), key=lambda item: (-len(item[1]), item[0])
810 - )
811 -
812 - logger.info(f"Category keys: {list(categories.keys())}")
813 - logger.info(f"Sorted categories keys: {[cat for cat, _ in sorted_categories]}")
814 -
815 - # Find the "tools" tab section in the navigation structure
816 - for tab_section in docs_data.get("navigation", []):
817 - if tab_section.get("tab") == "toolkits":
818 - logger.info(f"Tab section: {tab_section}")
819 - new_layout = []
820 -
821 - # Always add the Tool section with Introduction first
822 - new_layout.append(base_layout[0])
823 -
824 - # Add Important section if present
825 - if important_tools:
826 - new_layout.append(
827 - {
828 - "section": "Important",
829 - "skip-slug": True,
830 - "contents": important_tools,
831 - }
832 - )
833 -
834 - # Add each category as its own section
835 - for cat, tools_list in sorted_categories:
836 - if tools_list:
837 - new_layout.append(
838 - {
839 - "section": titleize(cat),
840 - "skip-slug": True,
841 - "contents": tools_list,
842 - }
843 - )
844 -
845 - # Add Proxy Apps section if present
846 - if proxy_apps:
847 - new_layout.append(
848 - {
849 - "section": "Proxy Apps",
850 - "skip-slug": True,
851 - "contents": proxy_apps,
852 - }
853 - )
854 -
855 - # Add No Auth section if present
856 - if no_auth_tools:
857 - new_layout.append(
858 - {
859 - "section": "No Auth",
860 - "skip-slug": True,
861 - "contents": no_auth_tools,
862 - }
863 - )
864 -
865 - logger.info("new_layout: %s", new_layout)
866 - tab_section["layout"] = new_layout
867 - break
868 -
869 - # Write the updated YAML back to the file
870 - with open(docs_yml_path, "w") as f:
871 - yaml.dump(docs_data, f, default_flow_style=False, sort_keys=False)
872 -
873 - logger.info(f"✅ Updated docs.yml with {len(self.generated_tools)} tools")
874 -
875 - except Exception as e:
876 - logger.error(f"Failed to update docs.yml: {e}")
877 - if logger.isEnabledFor(logging.DEBUG):
878 - logger.info(traceback.format_exc())
879 -
880 -
881 -def configure_logging(log_level: str) -> None:
882 - """
883 - Configure logging settings.
884 -
885 - Args:
886 - log_level: Logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
887 - """
888 - numeric_level = getattr(logging, log_level.upper(), None)
889 - if not isinstance(numeric_level, int):
890 - raise ValueError(f"Invalid log level: {log_level}")
891 -
892 - logging.basicConfig(
893 - level=numeric_level,
894 - format="%(asctime)s - %(levelname)s - %(message)s",
895 - datefmt="%Y-%m-%d %H:%M:%S",
896 - )
897 -
898 - # Add telemetry filter to root logger to filter out telemetry requests
899 - telemetry_filter = TelemetryFilter()
900 - logging.getLogger().addFilter(telemetry_filter)
901 -
902 - # Also add filter to specific loggers that might handle HTTP requests
903 - for logger_name in ["httpx", "urllib3", "requests"]:
904 - logging.getLogger(logger_name).addFilter(telemetry_filter)
905 -
906 -
907 -def cli_main() -> int:
908 - """
909 - Command-line entry point.
910 -
911 - Returns:
912 - Exit code (0 for success, non-zero for failure)
913 - """
914 - parser = argparse.ArgumentParser(description="Generate Tool Documentation for Composio")
915 - parser.add_argument(
916 - "--output",
917 - "-o",
918 - type=str,
919 - help="Path for documentation output (default: ./tools)",
920 - default="./toolkits",
921 - )
922 - parser.add_argument(
923 - "--include-local",
924 - action="store_true",
925 - help="Include local development tools",
926 - default=False,
927 - )
928 - parser.add_argument(
929 - "--log-level",
930 - choices=["debug", "info", "warning", "error", "critical"],
931 - default="info",
932 - help="Set logging level",
933 - )
934 - parser.add_argument(
935 - "--workers",
936 - "-w",
937 - type=int,
938 - help="Number of parallel worker threads (default: CPU count)",
939 - default=None,
940 - )
941 - parser.add_argument(
942 - "--lint-only",
943 - action="store_true",
944 - help="Only lint existing MDX files without generating new ones",
945 - default=False,
946 - )
947 - parser.add_argument(
948 - "--no-lint",
949 - action="store_true",
950 - help="Skip the linting step when generating documentation",
951 - default=False,
952 - )
953 - parser.add_argument(
954 - "--limit",
955 - "-l",
956 - type=int,
957 - help="Limit processing to first N toolkits (for debugging)",
958 - default=None,
959 - )
960 -
961 - args = parser.parse_args()
962 -
963 - try:
964 - # Configure logging
965 - configure_logging(args.log_level)
966 -
967 - # Convert output path to absolute path
968 - output_path = Path(args.output).resolve()
969 - # Create generator
970 - generator = ToolDocGenerator(include_local=args.include_local)
971 -
972 - # Generate docs with specified number of workers
973 - generator.generate_docs(output_path, max_workers=args.workers, limit=args.limit)
974 -
975 - # Force exit immediately without waiting for background telemetry
976 - logger.info("Documentation generation complete. Exiting immediately.")
977 - os._exit(0)
978 - except Exception as e:
979 - logger.error(f"Error generating documentation: {e}")
980 - if logger.isEnabledFor(logging.DEBUG):
981 - logger.info(traceback.format_exc())
982 - return 1
983 -
984 -
985 -if __name__ == "__main__":
986 - sys.exit(cli_main())
fern/generators/tool_doc_generator/mdx_formatter.py deleted
-557
@@ -1,557 +0,0 @@
1 -"""
2 -MDX Formatter for Composio tool documentation.
3 -
4 -This module provides utilities for formatting MDX content for Composio tool documentation.
5 -"""
6 -
7 -import re
8 -import typing as t
9 -from dataclasses import dataclass
10 -from pathlib import Path
11 -import logging
12 -
13 -logger = logging.getLogger(__name__)
14 -
15 -
16 -class MDX:
17 - """
18 - Utilities for generating MDX components and formatting.
19 -
20 - This class provides static methods to format content as different MDX components
21 - used in documentation, including frontmatter, accordions, parameter fields, etc.
22 - """
23 -
24 - @staticmethod
25 - def as_frontmatter(app_name: str | None = None, category: str | None = None) -> str:
26 - """
27 - Generate MDX frontmatter.
28 -
29 - Args:
30 - app_name: The name of the application
31 - category: The category of the application
32 -
33 - Returns:
34 - Formatted MDX frontmatter string
35 - """
36 - frontmatter = f'title: "{app_name}"'
37 - if app_name is not None:
38 - frontmatter += f'\nsubtitle: "Learn how to use {app_name} with Composio"'
39 - if category is not None:
40 - frontmatter += f'\ncategory: "{category}"'
41 - frontmatter += f'\nimage: "https://og.composio.dev/api/og?title=Using%20{app_name}%20with%20Composio"'
42 - return "---\n" + frontmatter + "\n---\n"
43 -
44 - @staticmethod
45 - def as_card(content: str) -> str:
46 - """
47 - Format content as a Card component.
48 -
49 - Args:
50 - content: The content to be wrapped in a Card
51 -
52 - Returns:
53 - Formatted MDX Card string
54 - """
55 - return f"<Card>\n{content}\n</Card>\n"
56 -
57 - @staticmethod
58 - def escape_mdx_content(content: str) -> str:
59 - """
60 - Escape content for safe use inside MDX components.
61 -
62 - Args:
63 - content: The content to escape
64 -
65 - Returns:
66 - Escaped content safe for MDX components
67 - """
68 - if not content:
69 - return ""
70 -
71 - # Convert to string if it's not already
72 - content = str(content)
73 -
74 - # Handle very complex patterns that break MDX parsing
75 - # Example: `value`: `slug`
76 - if re.search(r'`[^`]+`\s*:\s*`[^`]+`', content):
77 - # Replace patterns like `key`: `value` with "key": "value"
78 - content = re.sub(r'`([^`]+)`\s*:\s*`([^`]+)`', r'"\1": "\2"', content)
79 -
80 - # Escape comparison operators with numbers (which cause common MDX parsing errors)
81 - # Handle both with and without spaces
82 - content = re.sub(r'<(\d+)', r'less than \1', content) # <4mb -> less than 4mb
83 - content = re.sub(r'>(\d+)', r'greater than \1', content) # >10 -> greater than 10
84 - content = re.sub(r'<=(\d+)', r'less than or equal to \1', content)
85 - content = re.sub(r'>=(\d+)', r'greater than or equal to \1', content)
86 -
87 - # Replace standalone < and > characters with HTML entities
88 - content = re.sub(r'(?<!\w)<(?!\w)', '&lt;', content)
89 - content = re.sub(r'(?<!\w)>(?!\w)', '&gt;', content)
90 -
91 - # Fix pipes in tables (these break MDX table formatting)
92 - content = content.replace("|", "\\|")
93 -
94 - # Replace variable placeholders like {journey id} with [journey id]
95 - # These often cause MDX parsing issues
96 - content = re.sub(r'\{([^{}]*?)\}', r'[\1]', content)
97 -
98 - # Handle JSON-like examples that contain quotes and objects
99 - if '{' in content and '}' in content:
100 - # First, escape all quotes in JSON examples with double quotes
101 - # Use double quotes instead of backticks for nested JSON
102 - content = re.sub(r"(\{[^}]*)'([^']*)'([^}]*\})", r'\1"\2"\3', content)
103 - content = re.sub(r'(\{[^}]*)"([^"]*)"([^}]*\})', r'\1"\2"\3', content)
104 -
105 - # If we still have {, } in content, wrap the whole thing in quotes
106 - content = re.sub(r'(\{[^{}]*?\})', r'"\1"', content)
107 -
108 - # Handle special case of "repo | slug" pattern that causes errors
109 - content = re.sub(r'\|\s*slug', r'or slug', content)
110 -
111 - # Escape special format characters used in MDX
112 - content = content.replace("$", "\\$")
113 - content = content.replace("==", "\\=\\=")
114 -
115 - # Handle HTML-like tags that might appear in documentation
116 - content = re.sub(r'<([a-zA-Z][^>]*?)>', r'&lt;\1&gt;', content)
117 -
118 - # Fix malformed HTML tags
119 - content = re.sub(r'<ul\s*-', r'<ul><li>', content)
120 -
121 - # Fix nested backticks that may be causing issues
122 - if content.count('`') > 2:
123 - # Replace complex nested backticks with quoted text
124 - content = re.sub(r'`([^`]*)`([^`]*)`([^`]*)`', r'"\1\2\3"', content)
125 -
126 - return content
127 -
128 - @staticmethod
129 - def as_param(
130 - name: str,
131 - typ: str,
132 - doc: str = "",
133 - required: bool = False,
134 - default: t.Optional[str] = None
135 - ) -> str:
136 - """
137 - Format a parameter field.
138 -
139 - Args:
140 - name: Parameter name
141 - typ: Parameter type
142 - doc: Parameter description
143 - required: Whether the parameter is required
144 - default: Default value for the parameter
145 -
146 - Returns:
147 - Formatted ParamField component string
148 - """
149 - # Make sure name and type are properly escaped
150 - safe_name = name.replace('"', '\\"')
151 - safe_type = typ.replace('"', '\\"')
152 -
153 - # Handle required and default attributes
154 - attributes = ""
155 - if required:
156 - attributes += ' required={true}'
157 - if default and default != "None" and default != "":
158 - safe_default = str(default).replace('"', '\\"')
159 - attributes += f' default="{safe_default}"'
160 -
161 - return (
162 - f'<ParamField path="{safe_name}" type="{safe_type}"{attributes}>\n'
163 - "</ParamField>\n"
164 - )
165 -
166 - @staticmethod
167 - def as_accordion(title: str, content: str) -> str:
168 - """
169 - Format content as an accordion component.
170 -
171 - Args:
172 - title: The title/header for the accordion
173 - content: The content inside the accordion
174 -
175 - Returns:
176 - Formatted accordion MDX string
177 - """
178 - # Escape characters in title that might break MDX
179 - # First, escape quotes to avoid breaking the title attribute
180 - safe_title = title.replace('"', '\\"')
181 -
182 - # Handle comparison operators that caused issues in the check
183 - # For example: files <384kb or limited to <4mb
184 - safe_title = re.sub(r'<(\d+)', r'less than \1', safe_title)
185 - safe_title = re.sub(r'>(\d+)', r'greater than \1', safe_title)
186 - safe_title = re.sub(r'<=(\d+)', r'less than or equal to \1', safe_title)
187 - safe_title = re.sub(r'>=(\d+)', r'greater than or equal to \1', safe_title)
188 -
189 - # Escape standalone < and > characters
190 - safe_title = re.sub(r'(?<!\w)<(?!\w)', '&lt;', safe_title)
191 - safe_title = re.sub(r'(?<!\w)>(?!\w)', '&gt;', safe_title)
192 -
193 - return f'<Accordion title="{safe_title}">\n{content}\n</Accordion>\n'
194 -
195 - @staticmethod
196 - def as_accordion_group(content: str) -> str:
197 - """
198 - Format content as an accordion group.
199 -
200 - Args:
201 - content: The content inside the accordion group
202 -
203 - Returns:
204 - Formatted accordion group MDX string
205 - """
206 - return f'<AccordionGroup>\n{content}\n</AccordionGroup>\n'
207 -
208 - @staticmethod
209 - def as_code_block(
210 - content: str,
211 - language: str = "python",
212 - display_name: str = None,
213 - highlight_lines: str = None, # e.g., "25-30" or "5"
214 - title: str = None,
215 - max_lines: int = None,
216 - word_wrap: bool = True
217 - ) -> str:
218 - """
219 - Format content as a code block using backticks with full formatting support.
220 -
221 - Args:
222 - content: The code to be displayed
223 - language: The programming language for syntax highlighting (e.g., "python", "typescript")
224 - display_name: Display name for the language tab (deprecated - use title instead)
225 - highlight_lines: Lines to highlight (e.g., "25-30" or "5")
226 - title: Title for the code block (e.g., "Python", "TypeScript")
227 - max_lines: Maximum number of lines to display
228 - word_wrap: Whether to wrap long lines
229 -
230 - Returns:
231 - Formatted code block MDX string with all attributes
232 - """
233 - # Build the code fence header
234 - header_parts = [language]
235 -
236 - # Add line highlighting if provided
237 - if highlight_lines:
238 - header_parts.append(f"{{{highlight_lines}}}")
239 -
240 - # Add title if provided (use display_name as fallback)
241 - title_to_use = title or display_name
242 - if title_to_use:
243 - # Escape quotes in title
244 - safe_title = title_to_use.replace('"', '\\"')
245 - header_parts.append(f'title="{safe_title}"')
246 -
247 - # Add max lines if provided
248 - if max_lines:
249 - header_parts.append(f"maxLines={max_lines}")
250 -
251 - # Add word wrap if enabled (default is True)
252 - if word_wrap:
253 - header_parts.append("wordWrap")
254 -
255 - # Join all parts with spaces
256 - header = " ".join(header_parts)
257 -
258 - return f"```{header}\n{content}\n```\n"
259 -
260 - @staticmethod
261 - def as_code_group(*code_blocks: str) -> str:
262 - """
263 - Wrap multiple code blocks in a CodeGroup component.
264 -
265 - Args:
266 - *code_blocks: Variable number of code block strings
267 -
268 - Returns:
269 - Formatted CodeGroup MDX string containing all code blocks
270 - """
271 - return f"<CodeGroup>\n{''.join(code_blocks)}</CodeGroup>\n"
272 -
273 - @staticmethod
274 - def _replace_template_variables(content: str, variables: dict) -> str:
275 - """
276 - Replace {{variable}} patterns with their values, supporting transformations.
277 -
278 - Supports patterns like:
279 - - {{variable}}
280 - - {{variable|upper}}
281 - - {{variable|lower}}
282 - - {{variable|title}}
283 - - {{variable|default:'fallback value'}}
284 -
285 - Args:
286 - content: Template content with {{variable}} placeholders
287 - variables: Dictionary of variable names to values
288 -
289 - Returns:
290 - Content with variables replaced
291 - """
292 - def replace_var(match):
293 - var_name = match.group(1)
294 - transform = match.group(2)
295 - default = match.group(3)
296 -
297 - # Get the value or use default
298 - value = variables.get(var_name)
299 - if value is None:
300 - value = default.strip("'\"") if default else match.group(0)
301 - else:
302 - value = str(value)
303 -
304 - # Apply transformation if specified
305 - if transform:
306 - if transform == 'upper':
307 - value = value.upper()
308 - elif transform == 'lower':
309 - value = value.lower()
310 - elif transform == 'title':
311 - value = value.capitalize()
312 -
313 - return value
314 -
315 - # Pattern matches: {{var_name|transform|default:'value'}}
316 - pattern = r'\{\{(\w+)(?:\|(\w+))?(?:\|default:[\'"]([^\'"]*)[\'"])?\}\}'
317 - return re.sub(pattern, replace_var, content)
318 -
319 - @staticmethod
320 - def _read_template_file(template_path: str, base_path: t.Optional[Path] = None) -> str:
321 - """
322 - Read a template file.
323 -
324 - Args:
325 - template_path: Path to template file (can be relative)
326 - base_path: Base path to resolve relative paths from (defaults to current file's parent)
327 -
328 - Returns:
329 - Template content as string
330 - """
331 - if base_path is None:
332 - # Default to the directory containing this file's parent (tool_doc_generator)
333 - base_path = Path(__file__).parent
334 -
335 - # Resolve the full path
336 - if Path(template_path).is_absolute():
337 - full_path = Path(template_path)
338 - else:
339 - full_path = base_path / template_path
340 -
341 - try:
342 - with open(full_path, 'r', encoding='utf-8') as f:
343 - return f.read()
344 - except FileNotFoundError:
345 - logger.warning(f"Template not found: {full_path}")
346 - return f"# Template not found: {template_path}"
347 -
348 - @staticmethod
349 - def _detect_language_from_path(file_path: str) -> str:
350 - """
351 - Detect programming language from file extension.
352 -
353 - Args:
354 - file_path: Path to the file
355 -
356 - Returns:
357 - Language identifier for syntax highlighting
358 - """
359 - extension_map = {
360 - '.py': 'python',
361 - '.js': 'javascript',
362 - '.ts': 'typescript',
363 - '.tsx': 'typescript',
364 - '.jsx': 'javascript',
365 - '.java': 'java',
366 - '.cpp': 'cpp',
367 - '.c': 'c',
368 - '.go': 'go',
369 - '.rs': 'rust',
370 - '.php': 'php',
371 - '.rb': 'ruby',
372 - '.swift': 'swift',
373 - '.kt': 'kotlin',
374 - '.scala': 'scala',
375 - '.sh': 'bash',
376 - '.yml': 'yaml',
377 - '.yaml': 'yaml',
378 - '.json': 'json',
379 - '.xml': 'xml',
380 - '.html': 'html',
381 - '.css': 'css',
382 - '.scss': 'scss',
383 - '.sql': 'sql',
384 - }
385 -
386 - suffix = Path(file_path).suffix.lower()
387 - return extension_map.get(suffix, 'text')
388 -
389 - @staticmethod
390 - def as_code_block_from_template(
391 - template_path: str,
392 - template_vars: dict = None,
393 - language: str = None,
394 - display_name: str = None,
395 - highlight_lines: str = None,
396 - title: str = None,
397 - max_lines: int = None,
398 - word_wrap: bool = True,
399 - base_path: t.Optional[Path] = None
400 - ) -> str:
401 - """
402 - Create a code block from a template file with variable replacement.
403 -
404 - Args:
405 - template_path: Path to template file (relative to base_path)
406 - template_vars: Dictionary of variables to replace in template
407 - language: Override auto-detected language (e.g., "python", "typescript")
408 - display_name: Display name for the language tab (deprecated - use title instead)
409 - highlight_lines: Lines to highlight (e.g., "25-30" or "5")
410 - title: Title for the code block (e.g., "Python", "TypeScript")
411 - max_lines: Maximum number of lines to display
412 - word_wrap: Whether to wrap long lines
413 - base_path: Base path for resolving template_path
414 -
415 - Returns:
416 - Formatted code block MDX string
417 - """
418 - # Read template file
419 - content = MDX._read_template_file(template_path, base_path)
420 -
421 - # Replace variables if provided
422 - if template_vars:
423 - content = MDX._replace_template_variables(content, template_vars)
424 -
425 - # Auto-detect language from file extension if not provided
426 - if not language:
427 - language = MDX._detect_language_from_path(template_path)
428 -
429 - # Use existing as_code_block with all formatting
430 - return MDX.as_code_block(
431 - content=content,
432 - language=language,
433 - display_name=display_name,
434 - highlight_lines=highlight_lines,
435 - title=title,
436 - max_lines=max_lines,
437 - word_wrap=word_wrap
438 - )
439 -
440 - @staticmethod
441 - def as_markdown_table(headers: list, rows: list) -> str:
442 - """
443 - Create a markdown table with headers and rows.
444 -
445 - Args:
446 - headers: List of header strings
447 - rows: List of row lists where each inner list contains values for each column
448 -
449 - Returns:
450 - Formatted markdown table string
451 - """
452 - if not headers or not rows:
453 - return ""
454 -
455 - # Remove empty columns (all values are empty, None, or "No description provided")
456 - cols_to_keep = []
457 - for col_idx in range(len(headers)):
458 - col_values = [row[col_idx] if col_idx < len(row) else "" for row in rows]
459 - has_valid_value = any(
460 - str(val) and str(val).strip() not in ["", "None", "No description provided"]
461 - for val in col_values
462 - )
463 - if has_valid_value:
464 - cols_to_keep.append(col_idx)
465 -
466 - # If no valid columns, return empty string
467 - if not cols_to_keep:
468 - return ""
469 -
470 - # Create new headers and rows with only the columns to keep
471 - filtered_headers = [headers[i] for i in cols_to_keep]
472 - filtered_rows = []
473 - for row in rows:
474 - filtered_row = []
475 - for i in cols_to_keep:
476 - val = row[i] if i < len(row) else ""
477 - filtered_row.append(val)
478 - filtered_rows.append(filtered_row)
479 -
480 - # Generate the table
481 - table = "| " + " | ".join(filtered_headers) + " |\n"
482 - table += "| " + " | ".join(["---" for _ in filtered_headers]) + " |\n"
483 -
484 - for row in filtered_rows:
485 - # Ensure row has same number of columns as headers
486 - row_data = row + [""] * (len(filtered_headers) - len(row))
487 - # Replace None and "No description provided" with empty strings
488 - row_data = [
489 - str(col) if str(col).strip() not in ["None", "No description provided"] else ""
490 - for col in row_data
491 - ]
492 - table += "| " + " | ".join(row_data) + " |\n"
493 -
494 - return table
495 -
496 - @staticmethod
497 - def as_param_table(params: list) -> str:
498 - """
499 - Create a parameter table from param metadata.
500 -
501 - Args:
502 - params: List of parameter dictionaries
503 -
504 - Returns:
505 - Markdown table of parameters
506 - """
507 - if not params:
508 - return ""
509 -
510 - headers = ["Name", "Type", "Description", "Default"]
511 - rows = []
512 -
513 - for param in params:
514 - # Check which fields exist and add them
515 - description = param.get('description', '')
516 - default = param.get('default', '')
517 -
518 - # Skip description if it's "No description provided"
519 - if description == "No description provided":
520 - description = ''
521 -
522 - # Skip default if it's "None"
523 - if default == "None":
524 - default = ''
525 -
526 - row = [
527 - f"`{param['name']}`",
528 - f"`{param['type']}`",
529 - description,
530 - default
531 - ]
532 - rows.append(row)
533 -
534 - return MDX.as_markdown_table(headers, rows)
535 -
536 - @staticmethod
537 - def as_relative_link(target_name: str, target_path: str) -> str:
538 - """
539 - Create a relative markdown link to another doc page.
540 -
541 - Args:
542 - target_name: Display name for the link
543 - target_path: Relative path to the target doc
544 -
545 - Returns:
546 - Markdown link string
547 - """
548 - return f"[{target_name}]({target_path})"
549 -
550 -
551 -@dataclass
552 -class DocumentSection:
553 - """Base class for document sections."""
554 -
555 - def to_mdx(self) -> str:
556 - """Convert section to MDX text."""
557 - raise NotImplementedError("Subclasses must implement to_mdx()")
\ No newline at end of file
fern/generators/tool_doc_generator/pre_commit_tool_doc.py deleted
-111
@@ -1,111 +0,0 @@
1 -#!/usr/bin/env python
2 -"""
3 -Minimal docs.yml updater for pre-commit hooks.
4 -
5 -This script provides a minimal version that just sets the base layout
6 -for the tools section in docs.yml.
7 -"""
8 -
9 -import argparse
10 -import logging
11 -import sys
12 -from pathlib import Path
13 -
14 -import yaml
15 -
16 -from generators.tool_doc_generator.base_docs import base_layout
17 -
18 -logger = logging.getLogger(__name__)
19 -
20 -
21 -def update_docs_yml_minimal(docs_yml_path: Path) -> None:
22 - """
23 - Minimal update of docs.yml file with just the base layout.
24 -
25 - Args:
26 - docs_yml_path: Path to the docs.yml file
27 - """
28 - logger.info("Updating docs.yml with minimal base layout")
29 -
30 - try:
31 - # Read the current docs.yml
32 - with open(docs_yml_path, "r") as f:
33 - docs_data = yaml.safe_load(f)
34 -
35 - # Find the "tools" tab section in the navigation structure
36 - for tab_section in docs_data.get("navigation", []):
37 - if tab_section.get("tab") == "tools":
38 - logger.info("Found tools tab section, setting base layout")
39 - tab_section["layout"] = base_layout
40 - break
41 - else:
42 - logger.warning("No tools tab section found in docs.yml")
43 - return
44 -
45 - # Write the updated YAML back to the file
46 - with open(docs_yml_path, "w") as f:
47 - yaml.dump(docs_data, f, default_flow_style=False, sort_keys=False)
48 -
49 - logger.info("✅ Updated docs.yml with base layout")
50 -
51 - except Exception as e:
52 - logger.error(f"Failed to update docs.yml: {e}")
53 - raise
54 -
55 -
56 -def configure_logging(log_level: str = "info") -> None:
57 - """Configure logging settings."""
58 - numeric_level = getattr(logging, log_level.upper(), None)
59 - if not isinstance(numeric_level, int):
60 - raise ValueError(f"Invalid log level: {log_level}")
61 -
62 - logging.basicConfig(
63 - level=numeric_level,
64 - format="%(asctime)s - %(levelname)s - %(message)s",
65 - datefmt="%Y-%m-%d %H:%M:%S",
66 - )
67 -
68 -
69 -def main() -> int:
70 - """Command-line entry point for minimal docs.yml update."""
71 - parser = argparse.ArgumentParser(
72 - description="Minimal docs.yml updater for pre-commit hooks"
73 - )
74 - parser.add_argument(
75 - "--docs-yml",
76 - type=str,
77 - help="Path to docs.yml file (default: ./docs.yml)",
78 - default="./docs.yml",
79 - )
80 - parser.add_argument(
81 - "--log-level",
82 - choices=["debug", "info", "warning", "error", "critical"],
83 - default="info",
84 - help="Set logging level",
85 - )
86 -
87 - args = parser.parse_args()
88 -
89 - try:
90 - # Configure logging
91 - configure_logging(args.log_level)
92 -
93 - # Convert path to absolute path
94 - docs_yml_path = Path(args.docs_yml).resolve()
95 -
96 - if not docs_yml_path.exists():
97 - logger.error(f"docs.yml file not found: {docs_yml_path}")
98 - return 1
99 -
100 - # Update docs.yml with minimal layout
101 - update_docs_yml_minimal(docs_yml_path)
102 -
103 - return 0
104 -
105 - except Exception as e:
106 - logger.error(f"Error updating docs.yml: {e}")
107 - return 1
108 -
109 -
110 -if __name__ == "__main__":
111 - sys.exit(main())
\ No newline at end of file
fern/generators/tool_doc_generator/templates/python/api_key.py deleted
-31
@@ -1,31 +0,0 @@
1 -from composio import Composio
2 -
3 -# Replace these with your actual values
4 -{{toolkit_slug}}_auth_config_id = "{{auth_config_id|default:'ac_YOUR_AUTH_CONFIG_ID'}}" # Auth config ID created above
5 -user_id = "0000-0000-0000" # UUID from database/app
6 -
7 -composio = Composio()
8 -
9 -def authenticate_toolkit(user_id: str, auth_config_id: str):
10 - # Replace this with a method to retrieve an API key from the user.
11 - # Or supply your own.
12 - user_api_key = input("[!] Enter API key")
13 -
14 - connection_request = composio.connected_accounts.initiate(
15 - user_id=user_id,
16 - auth_config_id=auth_config_id,
17 - config={"auth_scheme": "API_KEY", "val": {"generic_api_key": user_api_key}}
18 - )
19 -
20 - # API Key authentication is immediate - no redirect needed
21 - print(f"Successfully connected {{toolkit_name}} for user {user_id}")
22 - print(f"Connection status: {connection_request.status}")
23 -
24 - return connection_request.id
25 -
26 -
27 -connection_id = authenticate_toolkit(user_id, {{toolkit_slug}}_auth_config_id)
28 -
29 -# You can verify the connection using:
30 -connected_account = composio.connected_accounts.get(connection_id)
31 -print(f"Connected account: {connected_account}")
\ No newline at end of file
fern/generators/tool_doc_generator/templates/python/basic_auth.py deleted
-26
@@ -1,26 +0,0 @@
1 -from composio import Composio
2 -from composio.types import auth_scheme
3 -
4 -# Replace these with your actual values
5 -{{toolkit_slug}}_auth_config_id = "{{auth_config_id|default:'ac_YOUR_AUTH_CONFIG_ID'}}"
6 -user_id = "{{user_id|default:'user@example.com'}}"
7 -username = "{{username_placeholder|default:'your_username'}}"
8 -password = "{{password_placeholder|default:'your_password'}}"
9 -
10 -composio = Composio()
11 -
12 -# Create a new connected account for {{toolkit_name}} using Basic Auth
13 -connection_request = composio.connected_accounts.initiate(
14 - user_id=user_id,
15 - auth_config_id={{toolkit_slug}}_auth_config_id,
16 - config=auth_scheme.basic_auth(
17 - username=username,
18 - password=password
19 - )
20 -)
21 -
22 -# Basic authentication is immediate - no redirect needed
23 -print(f"Successfully connected {{toolkit_name}} for user {user_id}")
24 -
25 -# You can verify the connection using:
26 -# connected_account = composio.connected_accounts.get(user_id=user_id, app_id="{{toolkit_slug|upper}}")
\ No newline at end of file
fern/generators/tool_doc_generator/templates/python/bearer_token.py deleted
-30
@@ -1,30 +0,0 @@
1 -from composio import Composio
2 -
3 -# Auth config ID created above
4 -{{toolkit_slug}}_auth_config_id = "{{auth_config_id|default:'ac_YOUR_AUTH_CONFIG_ID'}}"
5 -
6 -# UUID from database/application
7 -user_id = "0000-0000-0000"
8 -
9 -composio = Composio()
10 -
11 -
12 -def authenticate_toolkit(user_id: str, auth_config_id: str):
13 - # Replace this with a method to retrieve the Bearer Token from the user.
14 - bearer_token = input("[!] Enter bearer token")
15 - connection_request = composio.connected_accounts.initiate(
16 - user_id=user_id,
17 - auth_config_id=auth_config_id,
18 - config={"auth_scheme": "BEARER_TOKEN", "val": bearer_token}
19 - )
20 - print(f"Successfully connected {{toolkit_name}} for user {user_id}")
21 - print(f"Connection status: {connection_request.status}")
22 -
23 - return connection_request.id
24 -
25 -
26 -connection_id = authenticate_toolkit(user_id, {{toolkit_slug}}_auth_config_id)
27 -
28 -# You can verify the connection using:
29 -connected_account = composio.connected_accounts.get(connection_id)
30 -print(f"Connected account: {connected_account}")
\ No newline at end of file
fern/generators/tool_doc_generator/templates/python/google_tools.py deleted
-25
@@ -1,25 +0,0 @@
1 -from composio import Composio
2 -from composio_google import GoogleProvider
3 -from google import genai
4 -from google.genai import types
5 -
6 -# Create composio client
7 -composio = Composio(provider=GoogleProvider())
8 -# Create google client
9 -client = genai.Client()
10 -
11 -# User ID must be a valid UUID format
12 -user_id = "0000-0000-0000" # Replace with actual user UUID from your database
13 -
14 -# Get tools for {{toolkit_name}}
15 -tools = composio.tools.get(user_id, toolkits=["{{toolkit_slug|upper}}"])
16 -
17 -print("[!] Tools:", tools)
18 -
19 -# Create genai client config
20 -config = types.GenerateContentConfig(tools=tools)
21 -
22 -# Use the chat interface
23 -chat = client.chats.create(model="gemini-2.0-flash", config=config)
24 -response = chat.send_message("What can you do with {{toolkit_name}}?")
25 -print("[!] Response:", response.text)
\ No newline at end of file
fern/generators/tool_doc_generator/templates/python/oauth2.py deleted
-29
@@ -1,29 +0,0 @@
1 -from composio import Composio
2 -
3 -# Replace these with your actual values
4 -{{toolkit_slug}}_auth_config_id = "{{auth_config_id|default:'ac_YOUR_AUTH_CONFIG_ID'}}" # Auth config ID created above
5 -user_id = "0000-0000-0000" # UUID from database/application
6 -
7 -composio = Composio()
8 -
9 -
10 -def authenticate_toolkit(user_id: str, auth_config_id: str):
11 - connection_request = composio.connected_accounts.initiate(
12 - user_id=user_id,
13 - auth_config_id=auth_config_id,
14 - )
15 -
16 - print(
17 - f"Visit this URL to authenticate {{toolkit_name}}: {connection_request.redirect_url}"
18 - )
19 -
20 - # This will wait for the auth flow to be completed
21 - connection_request.wait_for_connection(timeout=15)
22 - return connection_request.id
23 -
24 -
25 -connection_id = authenticate_toolkit(user_id, {{toolkit_slug}}_auth_config_id)
26 -
27 -# You can also verify the connection status using:
28 -connected_account = composio.connected_accounts.get(connection_id)
29 -print(f"Connected account: {connected_account}")
\ No newline at end of file
fern/generators/tool_doc_generator/templates/python/openai_tools.py deleted
-33
@@ -1,33 +0,0 @@
1 -from composio import Composio
2 -from openai import OpenAI
3 -import json
4 -
5 -openai = OpenAI()
6 -composio = Composio()
7 -
8 -# User ID must be a valid UUID format
9 -user_id = "0000-0000-0000" # Replace with actual user UUID from your database
10 -
11 -tools = composio.tools.get(user_id=user_id, toolkits=["{{toolkit_slug|upper}}"])
12 -
13 -print("[!] Tools:")
14 -print(json.dumps(tools))
15 -
16 -def invoke_llm(task = "What can you do?"):
17 - completion = openai.chat.completions.create(
18 - model="gpt-4o",
19 - messages=[
20 - {
21 - "role": "user",
22 - "content": task, # Your task here!
23 - },
24 - ],
25 - tools=tools,
26 - )
27 -
28 - # Handle Result from tool call
29 - result = composio.provider.handle_tool_calls(user_id=user_id, response=completion)
30 - print(f"[!] Completion: {completion}")
31 - print(f"[!] Tool call result: {result}")
32 -
33 -invoke_llm()
\ No newline at end of file
fern/generators/tool_doc_generator/templates/typescript/anthropic_tools.ts deleted
-38
@@ -1,38 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -import { AnthropicProvider } from '@composio/anthropic';
3 -import { Anthropic } from '@anthropic-ai/sdk';
4 -
5 -const composio = new Composio({
6 - provider: new AnthropicProvider({
7 - cacheTools: false, // default
8 - }),
9 -});
10 -
11 -const anthropic = new Anthropic();
12 -
13 -// User ID must be a valid UUID format
14 -const userId = "0000-0000-0000"; // Replace with actual user UUID from your database
15 -
16 -// Get tools for {{toolkit_name}}
17 -const tools = await composio.tools.get(userId, {
18 - toolkits: ["{{toolkit_slug|upper}}"],
19 -});
20 -
21 -console.log("[!] Tools:", tools);
22 -
23 -// Create a message with the tools
24 -const msg = await anthropic.messages.create({
25 - model: 'claude-3-5-sonnet-20240620',
26 - messages: [
27 - {
28 - role: 'user',
29 - content: 'What can you do with {{toolkit_name}}?', // Your task here!
30 - },
31 - ],
32 - tools: tools,
33 - max_tokens: 1000,
34 -});
35 -
36 -// Handle tool calls if any
37 -const result = await composio.provider.handleToolCalls(userId, msg);
38 -console.log("[!] Result:", result);
\ No newline at end of file
fern/generators/tool_doc_generator/templates/typescript/api_key.ts deleted
-37
@@ -1,37 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -import { AuthScheme } from '@composio/core';
3 -// Replace these with your actual values
4 -const {{toolkit_slug}}_auth_config_id = "ac_YOUR_{{toolkit_slug|upper}}_CONFIG_ID"; // Auth config ID created above
5 -const userId = "{{user_id|default:'user@example.com'}}"; // User ID from database/application
6 -
7 -const composio = new Composio();
8 -
9 -async function authenticateToolkit(userId: string, authConfigId: string) {
10 - // TODO: Replace this with a method to retrieve the API key from the user.
11 - // In production, this should be securely retrieved from your database or user input.
12 - // For example: const userApiKey = await getUserApiKey(userId);
13 - const userApiKey = "your_{{toolkit_slug}}_api_key"; // Replace with actual API key
14 -
15 - const connectionRequest = await composio.connectedAccounts.initiate(
16 - userId,
17 - authConfigId,
18 - {
19 - config: AuthScheme.APIKey({
20 - api_key: userApiKey
21 - })
22 - }
23 - );
24 -
25 - // API Key authentication is immediate - no redirect needed
26 - console.log(`Successfully connected {{toolkit_name}} for user ${userId}`);
27 - console.log(`Connection status: ${connectionRequest.status}`);
28 -
29 - return connectionRequest.id;
30 -}
31 -
32 -// Authenticate the toolkit
33 -const connectionId = await authenticateToolkit(userId, {{toolkit_slug}}_auth_config_id);
34 -
35 -// You can verify the connection using:
36 -const connectedAccount = await composio.connectedAccounts.get(connectionId);
37 -console.log("Connected account:", connectedAccount);
\ No newline at end of file
fern/generators/tool_doc_generator/templates/typescript/basic_auth.ts deleted
-40
@@ -1,40 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -
3 -// Replace these with your actual values
4 -const {{toolkit_slug}}_auth_config_id = "{{auth_config_id|default:'ac_YOUR_AUTH_CONFIG_ID'}}"; // Auth config ID created above
5 -const userId = "{{user_id|default:'user@example.com'}}"; // User ID from database/application
6 -
7 -const composio = new Composio();
8 -
9 -async function authenticateToolkit(userId: string, authConfigId: string) {
10 - // TODO: Replace these with a method to retrieve credentials from the user.
11 - // In production, these should be securely retrieved from your database or user input.
12 - // For example: const { username, password } = await getUserCredentials(userId);
13 - const username = "{{username_placeholder|default:'your_username'}}"; // Replace with actual username
14 - const password = "{{password_placeholder|default:'your_password'}}"; // Replace with actual password
15 -
16 - const connectionRequest = await composio.connectedAccounts.initiate({
17 - userId: userId,
18 - authConfigId: authConfigId,
19 - config: {
20 - authScheme: "BASIC",
21 - config: {
22 - username: username,
23 - password: password
24 - }
25 - }
26 - });
27 -
28 - // Basic authentication is immediate - no redirect needed
29 - console.log(`Successfully connected {{toolkit_name}} for user ${userId}`);
30 - console.log(`Connection status: ${connectionRequest.status}`);
31 -
32 - return connectionRequest.id;
33 -}
34 -
35 -// Authenticate the toolkit
36 -const connectionId = await authenticateToolkit(userId, {{toolkit_slug}}_auth_config_id);
37 -
38 -// You can verify the connection using:
39 -const connectedAccount = await composio.connectedAccounts.get(connectionId);
40 -console.log("Connected account:", connectedAccount);
\ No newline at end of file
fern/generators/tool_doc_generator/templates/typescript/bearer_token.ts deleted
-37
@@ -1,37 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -import { AuthScheme } from '@composio/core';
3 -// Replace these with your actual values
4 -const {{toolkit_slug}}_auth_config_id = "ac_YOUR_{{toolkit_slug|upper}}_CONFIG_ID"; // Auth config ID created above
5 -const userId = "{{user_id|default:'user@example.com'}}"; // User ID from database/application
6 -
7 -const composio = new Composio();
8 -
9 -async function authenticateToolkit(userId: string, authConfigId: string) {
10 - // TODO: Replace this with a method to retrieve the Bearer Token from the user.
11 - // In production, this should be securely retrieved from your database or user input.
12 - // For example: const bearerToken = await getUserBearerToken(userId);
13 - const bearerToken = "your_{{toolkit_slug}}_bearer_token"; // Replace with actual bearer token
14 -
15 - const connectionRequest = await composio.connectedAccounts.initiate(
16 - userId,
17 - authConfigId,
18 - {
19 - config: AuthScheme.BearerToken({
20 - token: bearerToken
21 - })
22 - }
23 - );
24 -
25 - // Bearer token authentication is immediate - no redirect needed
26 - console.log(`Successfully connected {{toolkit_name}} for user ${userId}`);
27 - console.log(`Connection status: ${connectionRequest.status}`);
28 -
29 - return connectionRequest.id;
30 -}
31 -
32 -// Authenticate the toolkit
33 -const connectionId = await authenticateToolkit(userId, {{toolkit_slug}}_auth_config_id);
34 -
35 -// You can verify the connection using:
36 -const connectedAccount = await composio.connectedAccounts.get(connectionId);
37 -console.log("Connected account:", connectedAccount);
\ No newline at end of file
fern/generators/tool_doc_generator/templates/typescript/oauth2.ts deleted
-28
@@ -1,28 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -
3 -// Replace these with your actual values
4 -const {{toolkit_slug}}_auth_config_id = "ac_YOUR_{{toolkit_slug|upper}}_CONFIG_ID"; // Auth config ID created above
5 -const userId = "{{user_id|default:'user@example.com'}}"; // User ID from database/application
6 -
7 -const composio = new Composio();
8 -
9 -async function authenticateToolkit(userId: string, authConfigId: string) {
10 - const connectionRequest = await composio.connectedAccounts.initiate(
11 - userId,
12 - authConfigId
13 - );
14 -
15 - console.log(`Visit this URL to authenticate {{toolkit_name}}: ${connectionRequest.redirectUrl}`);
16 -
17 - // This will wait for the auth flow to be completed
18 - await connectionRequest.waitForConnection(60);
19 -
20 - return connectionRequest.id;
21 -}
22 -
23 -// Authenticate the toolkit
24 -const connectionId = await authenticateToolkit(userId, {{toolkit_slug}}_auth_config_id);
25 -
26 -// You can also verify the connection status using:
27 -const connectedAccount = await composio.connectedAccounts.get(connectionId);
28 -console.log("Connected account:", connectedAccount);
\ No newline at end of file
fern/generators/tool_doc_generator/templates/typescript/vercel_tools.ts deleted
-34
@@ -1,34 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -import { generateText } from 'ai';
3 -import { anthropic } from '@ai-sdk/anthropic';
4 -import { VercelProvider } from '@composio/vercel';
5 -
6 -const composio = new Composio({
7 - apiKey: process.env.COMPOSIO_API_KEY,
8 - provider: new VercelProvider(),
9 -});
10 -
11 -// User ID must be a valid UUID format
12 -const userId = "0000-0000-0000"; // Replace with actual user UUID from your database
13 -
14 -// Get tools for {{toolkit_name}}
15 -const tools = await composio.tools.get(userId, {
16 - toolkits: ["{{toolkit_slug|upper}}"]
17 -});
18 -
19 -console.log("[!] Tools:", tools);
20 -
21 -// Generate text with tools
22 -const { text } = await generateText({
23 - model: anthropic('claude-3-7-sonnet-20250219'),
24 - messages: [
25 - {
26 - role: 'user',
27 - content: "What can you do with {{toolkit_name}}?", // Your task here!
28 - },
29 - ],
30 - tools,
31 - maxSteps: 3,
32 -});
33 -
34 -console.log("[!] Result:", text);
\ No newline at end of file
fern/llms-txt-worker/package.json deleted
-17
@@ -1,17 +0,0 @@
1 -{
2 - "name": "@composio/llms-txt-worker",
3 - "version": "0.0.0",
4 - "private": true,
5 - "scripts": {
6 - "build": "echo 'llms.txt generated by parent turbo task'",
7 - "deploy": "wrangler deploy",
8 - "publish": "wrangler deploy",
9 - "dev": "wrangler dev",
10 - "start": "wrangler dev"
11 - },
12 - "devDependencies": {
13 - "@cloudflare/workers-types": "catalog:",
14 - "typescript": "catalog:",
15 - "wrangler": "catalog:"
16 - }
17 -}
\ No newline at end of file
fern/llms-txt-worker/public/.keepFolder
fern/llms-txt-worker/src/index.ts deleted
-31
@@ -1,31 +0,0 @@
1 -interface Env {
2 - ASSETS: {
3 - fetch: (request: Request) => Promise<Response>;
4 - };
5 -}
6 -
7 -interface ExecutionContext {
8 - waitUntil(promise: Promise<unknown>): void;
9 - passThroughOnException(): void;
10 -}
11 -
12 -export default {
13 - async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
14 - const url = new URL(request.url);
15 -
16 - // Serve static llms.txt for both /llm.txt and /llms.txt
17 - if (url.pathname === '/llms.txt' || url.pathname === '/llm.txt') {
18 - // Always fetch the llms.txt file, regardless of which path was requested
19 - const llmsRequest = new Request(new URL('/llms.txt', request.url).toString(), request);
20 - return env.ASSETS.fetch(llmsRequest);
21 - }
22 -
23 - // Serve robots-only/tools.json
24 - if (url.pathname === '/robots-only/tools.json') {
25 - return env.ASSETS.fetch(request);
26 - }
27 -
28 - // Everything else — proxy to origin that docs.composio.dev points to
29 - return fetch(request);
30 - },
31 -};
fern/llms-txt-worker/tsconfig.json deleted
-8
@@ -1,8 +0,0 @@
1 -{
2 - "$schema": "https://json.schemastore.org/tsconfig",
3 - "extends": "./tsconfig.options.json",
4 - "compilerOptions": {
5 - "rootDir": "./src"
6 - },
7 - "include": ["src/**/*.ts"]
8 -}
\ No newline at end of file
fern/llms-txt-worker/tsconfig.options.json deleted
-18
@@ -1,18 +0,0 @@
1 -{
2 - "$schema": "https://json.schemastore.org/tsconfig",
3 - "compilerOptions": {
4 - "target": "ES2022",
5 - "lib": ["ES2022", "DOM"],
6 - "module": "ES2022",
7 - "moduleResolution": "bundler",
8 - "allowSyntheticDefaultImports": true,
9 - "esModuleInterop": true,
10 - "strict": true,
11 - "skipLibCheck": true,
12 - "pretty": true,
13 - "noImplicitReturns": true,
14 - "noFallthroughCasesInSwitch": true,
15 - "types": ["@cloudflare/workers-types"]
16 - },
17 - "exclude": ["node_modules", "**/dist"]
18 -}
\ No newline at end of file
fern/llms-txt-worker/turbo.json deleted
-31
@@ -1,31 +0,0 @@
1 -{
2 - "$schema": "https://turbo.build/schema.json",
3 - "extends": [
4 - "//"
5 - ],
6 - "tasks": {
7 - "build": {
8 - "cache": false
9 - },
10 - "publish": {
11 - "dependsOn": [
12 - "^build"
13 - ],
14 - "cache": false,
15 - "env": [
16 - "CLOUDFLARE_API_TOKEN",
17 - "CLOUDFLARE_ACCOUNT_ID"
18 - ]
19 - },
20 - "deploy": {
21 - "dependsOn": [
22 - "^build"
23 - ],
24 - "cache": false,
25 - "env": [
26 - "CLOUDFLARE_API_TOKEN",
27 - "CLOUDFLARE_ACCOUNT_ID"
28 - ]
29 - }
30 - }
31 -}
\ No newline at end of file
fern/llms-txt-worker/wrangler.jsonc deleted
-13
@@ -1,13 +0,0 @@
1 -{
2 - "$schema": "node_modules/wrangler/config-schema.json",
3 - "name": "composio-docs-proxy",
4 - "main": "src/index.ts",
5 - "compatibility_date": "2025-07-26",
6 - "assets": {
7 - "directory": "./public/",
8 - "binding": "ASSETS"
9 - },
10 - "routes": [
11 - { "pattern": "docs.composio.dev/*", "zone_name": "composio.dev" }
12 - ]
13 - }
\ No newline at end of file
fern/package.json deleted
-79
@@ -1,79 +0,0 @@
1 -{
2 - "name": "composio-docs",
3 - "version": "0.0.0",
4 - "type": "module",
5 - "private": true,
6 - "packageManager": "pnpm@10.28.0",
7 - "scripts": {
8 - "preinstall": "npx only-allow pnpm",
9 - "clean": "git clean -xdf node_modules",
10 - "compile": "npx tailwindcss -i ./assets/input.css -o ./dist/output.css",
11 - "tools:generate": "uv run generators/tool_doc_generator/main.py --workers 10",
12 - "tools:generate:dev": "uv run generators/tool_doc_generator/main.py --workers 10 --limit ${LIMIT:-5}",
13 - "sdkdocs": "pnpm run sdkdocs:ts && pnpm run sdkdocs:python",
14 - "sdkdocs:ts": "pnpm exec typedoc",
15 - "sdkdocs:python": "uv run python generators/python_sdk/generate_docs.py",
16 - "css:compile": "npx tailwindcss -i ./assets/input.css -o ./dist/output.css",
17 - "css:watch": "npx tailwindcss -i ./assets/input.css -o ./dist/output.css --watch",
18 - "api:pull": "bash scripts/pull-openapi-spec.sh",
19 - "snippets:build": "bun run scripts/build-snippets.ts",
20 - "snippets:dev": "bun watch scripts/build-snippets.ts --watch",
21 - "add-og": "uv run scripts/add_og_imgs.py",
22 - "check": "fern check",
23 - "dev": "bun run scripts/build-snippets.ts && (bun run scripts/build-snippets.ts --watch & fern docs dev)",
24 - "dev:docs": "fern docs dev",
25 - "links": "fern docs broken-links",
26 - "build": "echo 'Build orchestrated by Turbo'",
27 - "preview": "fern generate --docs --preview --log-level debug",
28 - "publish": "fern generate --docs",
29 - "generate": "pnpm tools:generate && pnpm sdkdocs",
30 - "snippet:new": "bun run scripts/snippet-new.ts",
31 - "doc:new": "bun run scripts/doc-new.ts",
32 - "llms:build": "bun run scripts/build-llms-txt.ts",
33 - "llms:dev": "bun run scripts/build-llms-txt.ts --watch",
34 - "llms:deploy": "turbo run deploy --filter=@composio/llms-txt-worker"
35 - },
36 - "dependencies": {
37 - "fern-api": "^0.51.39",
38 - "gray-matter": "^4.0.3",
39 - "supergateway": "^3.4.3"
40 - },
41 - "devDependencies": {
42 - "@ai-sdk/anthropic": "^1.2.12",
43 - "@anthropic-ai/sdk": "^0.52.0",
44 - "@composio/core": "workspace:*",
45 - "@composio/google": "workspace:*",
46 - "@composio/langchain": "workspace:*",
47 - "@composio/llamaindex": "workspace:*",
48 - "@composio/openai": "workspace:*",
49 - "@composio/openai-agents": "workspace:*",
50 - "@composio/vercel": "workspace:*",
51 - "@google/genai": "^1.1.0",
52 - "@langchain/langgraph": "^0.2.72",
53 - "@langchain/openai": "^0.5.10",
54 - "@llamaindex/openai": "^0.4.20",
55 - "@llamaindex/workflow": "^1.1.24",
56 - "@openai/agents": "^0.2.1",
57 - "@types/convict": "^6.1.6",
58 - "@types/glob": "^8.1.0",
59 - "@types/node": "^20.17.57",
60 - "@types/react": "^18.3.23",
61 - "@types/yaml": "^1.9.7",
62 - "ai": "catalog:",
63 - "composio-core": "^0.5.39",
64 - "hono": "catalog:",
65 - "messages": "link:@langchain/core/messages",
66 - "next": "^15.3.3",
67 - "only-allow": "^1.2.1",
68 - "openai": "^4.94.0",
69 - "react": "^18.3.1",
70 - "tailwindcss": "^3.4.17",
71 - "typedoc": "^0.28.5",
72 - "typedoc-plugin-markdown": "^4.6.4",
73 - "typedoc-plugin-zod": "^1.4.1",
74 - "typescript": "catalog:",
75 - "uuid": "catalog:",
76 - "vitest": "catalog:",
77 - "yaml": "^2.8.0"
78 - }
79 -}
\ No newline at end of file
fern/packages/snippet-tester/package.json deleted
-30
@@ -1,30 +0,0 @@
1 -{
2 - "name": "snippet-tester",
3 - "version": "1.0.0",
4 - "description": "",
5 - "main": "index.js",
6 - "scripts": {
7 - "clean": "git clean -xdf node_modules",
8 - "test": "bun test",
9 - "start": "bun run src/index.ts"
10 - },
11 - "keywords": [],
12 - "author": "",
13 - "license": "ISC",
14 - "dependencies": {
15 - "@pnpm/find-workspace-dir": "^7.0.2",
16 - "cohere": "^1.1.1",
17 - "cohere-ai": "^7.14.0",
18 - "convict": "^6.2.4",
19 - "glob": "^11.0.0",
20 - "nodemon": "^3.1.7",
21 - "ts-node": "^10.9.2"
22 - },
23 - "devDependencies": {
24 - "@types/convict": "^6.1.6",
25 - "@types/glob": "^8.1.0",
26 - "@types/node": "^20.10.0",
27 - "typescript": "catalog:",
28 - "bun-types": "latest"
29 - }
30 -}
fern/packages/snippet-tester/src/config.ts deleted
-27
@@ -1,27 +0,0 @@
1 -import path from "path";
2 -
3 -export interface Language {
4 - name: string;
5 - exec: (file: string) => string;
6 - snippetRoot: (base: string) => string;
7 - glob: string;
8 -}
9 -
10 -export const config: {
11 - languages: Language[];
12 -} = {
13 - "languages": [
14 - {
15 - "name": "typescript",
16 - "exec": (file: string) => `bun run ${file}`,
17 - "snippetRoot": (base: string) => path.join(base, "./snippets/typescript"),
18 - "glob": "**/*.ts"
19 - },
20 - {
21 - "name": "python",
22 - "exec": (file: string) => `poetry run python ${file}`,
23 - "snippetRoot": (base: string) => path.join(base, "./snippets/python"),
24 - "glob": "**/*.py"
25 - },
26 - ]
27 -}
\ No newline at end of file
fern/packages/snippet-tester/src/index.ts deleted
-62
@@ -1,62 +0,0 @@
1 -import { config } from './config';
2 -import { execCmd, getFilesByExtension } from './utils';
3 -import * as fs from 'fs';
4 -import { glob } from 'glob';
5 -import path from 'path';
6 -
7 -// recurse up until you find a pnpm-workspace.yaml
8 -const findPnpmWorkspaceDir = (curDir = __dirname) => {
9 - if (curDir === "/") {
10 - throw new Error("Could not find pnpm-workspace.yaml")
11 - }
12 -
13 - if (fs.existsSync(path.resolve(curDir, "pnpm-lock.yaml"))) {
14 - return curDir
15 - }
16 -
17 - return findPnpmWorkspaceDir(fs.realpathSync(path.resolve(curDir, "..")))
18 -}
19 -
20 -const main = async () => {
21 - const workspaceDir = findPnpmWorkspaceDir();
22 -
23 - console.log("Testing snippets in workspace directory:", workspaceDir);
24 -
25 - for (const lang of config.languages) {
26 - console.log(`\nTesting ${lang.name} snippets...`);
27 - const cwd = lang.snippetRoot(workspaceDir);
28 -
29 - try {
30 - const filePaths = glob.globSync(lang.glob, { cwd });
31 -
32 - if (filePaths.length === 0) {
33 - console.log(`No ${lang.name} snippets found.`);
34 - continue;
35 - }
36 -
37 - console.log(`Found ${filePaths.length} ${lang.name} snippet(s).`);
38 -
39 - for (const filePath of filePaths) {
40 - console.log(`\nTesting: ${filePath}`);
41 - const { error, stderr, stdout } = await execCmd(lang.exec(filePath), cwd);
42 -
43 - if (error) {
44 - console.error(`❌ Error running ${filePath}:`);
45 - console.error(stderr || error.message);
46 - } else {
47 - console.log(`✅ Success: ${filePath}`);
48 - if (stdout) {
49 - console.log("Output:", stdout);
50 - }
51 - }
52 - }
53 - } catch (err) {
54 - console.error(`Error processing ${lang.name} snippets:`, err);
55 - }
56 - }
57 -};
58 -
59 -main().catch(err => {
60 - console.error("Fatal error:", err);
61 - process.exit(1);
62 -});
\ No newline at end of file
fern/packages/snippet-tester/src/tests/__snapshots__/snippets.test.ts.snap deleted
-1293
@@ -1,1293 +0,0 @@
1 -// Jest Snapshot v1, https://goo.gl/fbAQLP
2 -
3 -exports[`Testing language golang testing file chat-post/default/main.go 1`] = `null`;
4 -
5 -exports[`Testing language golang testing file chat-post/documents/main.go 1`] = `null`;
6 -
7 -exports[`Testing language golang testing file chat-post/stream/main.go 1`] = `null`;
8 -
9 -exports[`Testing language golang testing file chat-post/tools/main.go 1`] = `null`;
10 -
11 -exports[`Testing language golang testing file classify-post/main.go 1`] = `null`;
12 -
13 -exports[`Testing language golang testing file connector-create/main.go 1`] = `
14 -[Error: Command failed: go run connector-create/main.go
15 -2024/10/28 14:44:44 400: {"message":"a connector url must end with the path /search"}
16 -exit status 1
17 -]
18 -`;
19 -
20 -exports[`Testing language golang testing file connector-delete/main.go 1`] = `
21 -[Error: Command failed: go run connector-delete/main.go
22 -2024/10/28 14:44:44 404: {"message":"connector not found, id = connector_id"}
23 -exit status 1
24 -]
25 -`;
26 -
27 -exports[`Testing language golang testing file connector-get/main.go 1`] = `
28 -[Error: Command failed: go run connector-get/main.go
29 -2024/10/28 14:44:44 404: {"message":"connector not found, id = connector_id"}
30 -exit status 1
31 -]
32 -`;
33 -
34 -exports[`Testing language golang testing file connector-patch/main.go 1`] = `
35 -[Error: Command failed: go run connector-patch/main.go
36 -2024/10/28 14:44:43 404: {"message":"connector not found, id = connector_id"}
37 -exit status 1
38 -]
39 -`;
40 -
41 -exports[`Testing language golang testing file connectors-id-oauth-authorize-post/main.go 1`] = `
42 -[Error: Command failed: go run connectors-id-oauth-authorize-post/main.go
43 -2024/10/28 14:44:43 404: {"message":"connector not found, id = connector_id"}
44 -exit status 1
45 -]
46 -`;
47 -
48 -exports[`Testing language golang testing file connectors-list/main.go 1`] = `null`;
49 -
50 -exports[`Testing language golang testing file dataset-delete/main.go 1`] = `
51 -[Error: Command failed: go run dataset-delete/main.go
52 -2024/10/28 14:44:42 404: {"message":"dataset with the id 'dataset_id' not found"}
53 -exit status 1
54 -]
55 -`;
56 -
57 -exports[`Testing language golang testing file dataset-get/main.go 1`] = `
58 -[Error: Command failed: go run dataset-get/main.go
59 -2024/10/28 14:44:42 404: {"message":"dataset with the id 'dataset_id' not found"}
60 -exit status 1
61 -]
62 -`;
63 -
64 -exports[`Testing language golang testing file dataset-post/main.go 1`] = `
65 -[Error: Command failed: go run dataset-post/main.go
66 -2024/10/28 14:44:41 400: {"message":"output dataset types are not supported for upload"}
67 -exit status 1
68 -]
69 -`;
70 -
71 -exports[`Testing language golang testing file dataset-usage-get/main.go 1`] = `
72 -[Error: Command failed: go run dataset-usage-get/main.go
73 -2024/10/28 14:44:41 json: cannot unmarshal string into Go struct field unmarshaler.organization_usage of type int64
74 -exit status 1
75 -]
76 -`;
77 -
78 -exports[`Testing language golang testing file detokenize-post/main.go 1`] = `null`;
79 -
80 -exports[`Testing language golang testing file embed-jobs-cancel/main.go 1`] = `
81 -[Error: Command failed: go run embed-jobs-cancel/main.go
82 -2024/10/28 14:44:40 404: {"message":"resource not found: could not find embed job with the ID: embed_job_id"}
83 -exit status 1
84 -]
85 -`;
86 -
87 -exports[`Testing language golang testing file embed-jobs-get/main.go 1`] = `
88 -[Error: Command failed: go run embed-jobs-get/main.go
89 -2024/10/28 14:44:40 404: {"message":"resource not found: could not find embed job with the ID: embed_job_id"}
90 -exit status 1
91 -]
92 -`;
93 -
94 -exports[`Testing language golang testing file embed-jobs-post/main.go 1`] = `
95 -[Error: Command failed: go run embed-jobs-post/main.go
96 -2024/10/28 14:44:40 400: {"message":"a model parameter is required for this endpoint."}
97 -exit status 1
98 -]
99 -`;
100 -
101 -exports[`Testing language golang testing file embed-post/main.go 1`] = `null`;
102 -
103 -exports[`Testing language golang testing file emebed-jobs-get/main.go 1`] = `null`;
104 -
105 -exports[`Testing language golang testing file finetuning/create-finetuned-model/main.go 1`] = `
106 -[Error: Command failed: go run finetuning/create-finetuned-model/main.go
107 -2024/10/28 14:44:38 400: {"message":"dataset with id \\"my-dataset-id\\" does not exist"}
108 -exit status 1
109 -]
110 -`;
111 -
112 -exports[`Testing language golang testing file finetuning/delete-finetuned-model/main.go 1`] = `
113 -[Error: Command failed: go run finetuning/delete-finetuned-model/main.go
114 -2024/10/28 14:44:38 400: {"message":"fine-tuned model ID is not a valid UUID: 'test-id'"}
115 -exit status 1
116 -]
117 -`;
118 -
119 -exports[`Testing language golang testing file finetuning/get-finetuned-model/main.go 1`] = `
120 -[Error: Command failed: go run finetuning/get-finetuned-model/main.go
121 -2024/10/28 14:44:37 400: {"message":"finetuned_model.id is not a valid UUID: 'test-id'"}
122 -exit status 1
123 -]
124 -`;
125 -
126 -exports[`Testing language golang testing file finetuning/list-events/main.go 1`] = `
127 -[Error: Command failed: go run finetuning/list-events/main.go
128 -2024/10/28 14:44:35 500: {"message":"failed to retrieve total size"}
129 -exit status 1
130 -]
131 -`;
132 -
133 -exports[`Testing language golang testing file finetuning/list-finetuned-models/main.go 1`] = `null`;
134 -
135 -exports[`Testing language golang testing file finetuning/list-training-step-metrics/main.go 1`] = `
136 -[Error: Command failed: go run finetuning/list-training-step-metrics/main.go
137 -2024/10/28 14:44:32 400: {"message":"invalid finetune ID"}
138 -exit status 1
139 -]
140 -`;
141 -
142 -exports[`Testing language golang testing file finetuning/update-finetuned-model/main.go 1`] = `
143 -[Error: Command failed: go run finetuning/update-finetuned-model/main.go
144 -2024/10/28 14:44:31 400: {"message":"finetuned_model.id is not a valid UUID: 'test-id'"}
145 -exit status 1
146 -]
147 -`;
148 -
149 -exports[`Testing language golang testing file generate-post/main.go 1`] = `null`;
150 -
151 -exports[`Testing language golang testing file models-list-get/main.go 1`] = `null`;
152 -
153 -exports[`Testing language golang testing file rerank-post/main.go 1`] = `null`;
154 -
155 -exports[`Testing language golang testing file summarize-post/main.go 1`] = `null`;
156 -
157 -exports[`Testing language golang testing file tokenize-post/main.go 1`] = `null`;
158 -
159 -exports[`Testing language java testing file app/src/main/java/ClassifyPost.java 1`] = `null`;
160 -
161 -exports[`Testing language java testing file app/src/main/java/ConnectorCreate.java 1`] = `
162 -[Error: Command failed: gradle -PmainClass=ConnectorCreate run
163 -Error: Could not find or load main class ConnectorCreate
164 -Caused by: java.lang.ClassNotFoundException: ConnectorCreate
165 -
166 -FAILURE: Build failed with an exception.
167 -
168 -* What went wrong:
169 -Execution failed for task ':app:run'.
170 -> Process 'command '/Users/billy/.gradle/jdks/eclipse_adoptium-21-aarch64-os_x.2/jdk-21.0.4+7/Contents/Home/bin/java'' finished with non-zero exit value 1
171 -
172 -* Try:
173 -> Run with --stacktrace option to get the stack trace.
174 -> Run with --info or --debug option to get more log output.
175 -> Run with --scan to get full insights.
176 -> Get more help at https://help.gradle.org.
177 -
178 -BUILD FAILED in 3s
179 -]
180 -`;
181 -
182 -exports[`Testing language java testing file app/src/main/java/ConnectorDelete.java 1`] = `
183 -[Error: Command failed: gradle -PmainClass=ConnectorDelete run
184 -Exception in thread "main" CohereApiApiError{message: NotFoundError, statusCode: 404, body: {message=connector not found, id = test-id}}
185 - at com.cohere.api.resources.connectors.ConnectorsClient.delete(ConnectorsClient.java:359)
186 - at com.cohere.api.resources.connectors.ConnectorsClient.delete(ConnectorsClient.java:317)
187 - at ConnectorDelete.main(ConnectorDelete.java:8)
188 -
189 -FAILURE: Build failed with an exception.
190 -
191 -* What went wrong:
192 -Execution failed for task ':app:run'.
193 -> Process 'command '/Users/billy/.gradle/jdks/eclipse_adoptium-21-aarch64-os_x.2/jdk-21.0.4+7/Contents/Home/bin/java'' finished with non-zero exit value 1
194 -
195 -* Try:
196 -> Run with --stacktrace option to get the stack trace.
197 -> Run with --info or --debug option to get more log output.
198 -> Run with --scan to get full insights.
199 -> Get more help at https://help.gradle.org.
200 -
201 -BUILD FAILED in 10s
202 -]
203 -`;
204 -
205 -exports[`Testing language java testing file app/src/main/java/ConnectorGet.java 1`] = `
206 -[Error: Command failed: gradle -PmainClass=ConnectorGet run
207 -Exception in thread "main" CohereApiApiError{message: NotFoundError, statusCode: 404, body: {message=connector not found, id = test-id}}
208 - at com.cohere.api.resources.connectors.ConnectorsClient.get(ConnectorsClient.java:278)
209 - at com.cohere.api.resources.connectors.ConnectorsClient.get(ConnectorsClient.java:237)
210 - at ConnectorGet.main(ConnectorGet.java:9)
211 -
212 -FAILURE: Build failed with an exception.
213 -
214 -* What went wrong:
215 -Execution failed for task ':app:run'.
216 -> Process 'command '/Users/billy/.gradle/jdks/eclipse_adoptium-21-aarch64-os_x.2/jdk-21.0.4+7/Contents/Home/bin/java'' finished with non-zero exit value 1
217 -
218 -* Try:
219 -> Run with --stacktrace option to get the stack trace.
220 -> Run with --info or --debug option to get more log output.
221 -> Run with --scan to get full insights.
222 -> Get more help at https://help.gradle.org.
223 -
224 -BUILD FAILED in 10s
225 -]
226 -`;
227 -
228 -exports[`Testing language java testing file app/src/main/java/ConnectorPatch.java 1`] = `
229 -[Error: Command failed: gradle -PmainClass=ConnectorPatch run
230 -
231 -FAILURE: Build failed with an exception.
232 -
233 -* What went wrong:
234 -Execution failed for task ':app:compileJava'.
235 -> Cannot access output property 'destinationDirectory' of task ':app:compileJava'. Accessing unreadable inputs or outputs is not supported. Declare the task as untracked by using Task.doNotTrackState(). For more information, please refer to https://docs.gradle.org/8.10/userguide/incremental_build.html#sec:disable-state-tracking in the Gradle documentation.
236 - > java.nio.file.NoSuchFileException: /Users/billy/repositories/cohere-developer-experience/snippets/java/app/build/classes/java/main/DatasetDelete.class
237 -
238 -* Try:
239 -> Run with --stacktrace option to get the stack trace.
240 -> Run with --info or --debug option to get more log output.
241 -> Run with --scan to get full insights.
242 -> Get more help at https://help.gradle.org.
243 -
244 -BUILD FAILED in 9s
245 -]
246 -`;
247 -
248 -exports[`Testing language java testing file app/src/main/java/ConnectorsIdOauthAuthorizePost.java 1`] = `
249 -[Error: Command failed: gradle -PmainClass=ConnectorsIdOauthAuthorizePost run
250 -Exception in thread "main" CohereApiApiError{message: NotFoundError, statusCode: 404, body: {message=connector not found, id = test-id}}
251 - at com.cohere.api.resources.connectors.ConnectorsClient.oAuthAuthorize(ConnectorsClient.java:545)
252 - at com.cohere.api.resources.connectors.ConnectorsClient.oAuthAuthorize(ConnectorsClient.java:499)
253 - at ConnectorsIdOauthAuthorizePost.main(ConnectorsIdOauthAuthorizePost.java:12)
254 -
255 -FAILURE: Build failed with an exception.
256 -
257 -* What went wrong:
258 -Execution failed for task ':app:run'.
259 -> Process 'command '/Users/billy/.gradle/jdks/eclipse_adoptium-21-aarch64-os_x.2/jdk-21.0.4+7/Contents/Home/bin/java'' finished with non-zero exit value 1
260 -
261 -* Try:
262 -> Run with --stacktrace option to get the stack trace.
263 -> Run with --info or --debug option to get more log output.
264 -> Run with --scan to get full insights.
265 -> Get more help at https://help.gradle.org.
266 -
267 -BUILD FAILED in 12s
268 -]
269 -`;
270 -
271 -exports[`Testing language java testing file app/src/main/java/ConnectorsList.java 1`] = `null`;
272 -
273 -exports[`Testing language java testing file app/src/main/java/DatasetDelete.java 1`] = `
274 -[Error: Command failed: gradle -PmainClass=DatasetDelete run
275 -Exception in thread "main" CohereApiApiError{message: NotFoundError, statusCode: 404, body: {message=dataset with the id 'id' not found}}
276 - at com.cohere.api.resources.datasets.DatasetsClient.delete(DatasetsClient.java:489)
277 - at com.cohere.api.resources.datasets.DatasetsClient.delete(DatasetsClient.java:447)
278 - at DatasetDelete.main(DatasetDelete.java:8)
279 -
280 -FAILURE: Build failed with an exception.
281 -
282 -* What went wrong:
283 -Execution failed for task ':app:run'.
284 -> Process 'command '/Users/billy/.gradle/jdks/eclipse_adoptium-21-aarch64-os_x.2/jdk-21.0.4+7/Contents/Home/bin/java'' finished with non-zero exit value 1
285 -
286 -* Try:
287 -> Run with --stacktrace option to get the stack trace.
288 -> Run with --info or --debug option to get more log output.
289 -> Run with --scan to get full insights.
290 -> Get more help at https://help.gradle.org.
291 -
292 -BUILD FAILED in 12s
293 -]
294 -`;
295 -
296 -exports[`Testing language java testing file app/src/main/java/DatasetGet.java 1`] = `
297 -[Error: Command failed: gradle -PmainClass=DatasetGet run
298 -Exception in thread "main" CohereApiApiError{message: NotFoundError, statusCode: 404, body: {message=dataset with the id 'dataset_id' not found}}
299 - at com.cohere.api.resources.datasets.DatasetsClient.get(DatasetsClient.java:408)
300 - at com.cohere.api.resources.datasets.DatasetsClient.get(DatasetsClient.java:367)
301 - at DatasetGet.main(DatasetGet.java:9)
302 -
303 -FAILURE: Build failed with an exception.
304 -
305 -* What went wrong:
306 -Execution failed for task ':app:run'.
307 -> Process 'command '/Users/billy/.gradle/jdks/eclipse_adoptium-21-aarch64-os_x.2/jdk-21.0.4+7/Contents/Home/bin/java'' finished with non-zero exit value 1
308 -
309 -* Try:
310 -> Run with --stacktrace option to get the stack trace.
311 -> Run with --info or --debug option to get more log output.
312 -> Run with --scan to get full insights.
313 -> Get more help at https://help.gradle.org.
314 -
315 -BUILD FAILED in 18s
316 -]
317 -`;
318 -
319 -exports[`Testing language java testing file app/src/main/java/DatasetPost.java 1`] = `
320 -[Error: Command failed: gradle -PmainClass=DatasetPost run
321 -Exception in thread "main" java.lang.RuntimeException: java.lang.NullPointerException: Cannot invoke "java.io.File.toPath()" because "data" is null
322 - at com.cohere.api.resources.datasets.DatasetsClient.create(DatasetsClient.java:219)
323 - at com.cohere.api.resources.datasets.DatasetsClient.create(DatasetsClient.java:165)
324 - at DatasetPost.main(DatasetPost.java:14)
325 -Caused by: java.lang.NullPointerException: Cannot invoke "java.io.File.toPath()" because "data" is null
326 - at com.cohere.api.resources.datasets.DatasetsClient.create(DatasetsClient.java:206)
327 - ... 2 more
328 -
329 -FAILURE: Build failed with an exception.
330 -
331 -* What went wrong:
332 -Execution failed for task ':app:run'.
333 -> Process 'command '/Users/billy/.gradle/jdks/eclipse_adoptium-21-aarch64-os_x.2/jdk-21.0.4+7/Contents/Home/bin/java'' finished with non-zero exit value 1
334 -
335 -* Try:
336 -> Run with --stacktrace option to get the stack trace.
337 -> Run with --info or --debug option to get more log output.
338 -> Run with --scan to get full insights.
339 -> Get more help at https://help.gradle.org.
340 -
341 -BUILD FAILED in 19s
342 -]
343 -`;
344 -
345 -exports[`Testing language java testing file app/src/main/java/DatasetUsageGet.java 1`] = `null`;
346 -
347 -exports[`Testing language java testing file app/src/main/java/DetokenizePost.java 1`] = `null`;
348 -
349 -exports[`Testing language java testing file app/src/main/java/EmbedJobsCancel.java 1`] = `
350 -[Error: Command failed: gradle -PmainClass=EmbedJobsCancel run
351 -Error: Could not find or load main class EmbedJobsCancel
352 -Caused by: java.lang.ClassNotFoundException: EmbedJobsCancel
353 -
354 -FAILURE: Build failed with an exception.
355 -
356 -* What went wrong:
357 -Execution failed for task ':app:run'.
358 -> Process 'command '/Users/billy/.gradle/jdks/eclipse_adoptium-21-aarch64-os_x.2/jdk-21.0.4+7/Contents/Home/bin/java'' finished with non-zero exit value 1
359 -
360 -* Try:
361 -> Run with --stacktrace option to get the stack trace.
362 -> Run with --info or --debug option to get more log output.
363 -> Run with --scan to get full insights.
364 -> Get more help at https://help.gradle.org.
365 -
366 -BUILD FAILED in 7s
367 -]
368 -`;
369 -
370 -exports[`Testing language java testing file app/src/main/java/EmbedJobsGet.java 1`] = `null`;
371 -
372 -exports[`Testing language java testing file app/src/main/java/EmbedJobsPost.java 1`] = `
373 -[Error: Command failed: gradle -PmainClass=EmbedJobsPost run
374 -Exception in thread "main" CohereApiApiError{message: NotFoundError, statusCode: 404, body: {message=dataset with id ds.id not found}}
375 - at com.cohere.api.resources.embedjobs.EmbedJobsClient.create(EmbedJobsClient.java:179)
376 - at com.cohere.api.resources.embedjobs.EmbedJobsClient.create(EmbedJobsClient.java:132)
377 - at EmbedJobsPost.main(EmbedJobsPost.java:13)
378 -
379 -FAILURE: Build failed with an exception.
380 -
381 -* What went wrong:
382 -Execution failed for task ':app:run'.
383 -> Process 'command '/Users/billy/.gradle/jdks/eclipse_adoptium-21-aarch64-os_x.2/jdk-21.0.4+7/Contents/Home/bin/java'' finished with non-zero exit value 1
384 -
385 -* Try:
386 -> Run with --stacktrace option to get the stack trace.
387 -> Run with --info or --debug option to get more log output.
388 -> Run with --scan to get full insights.
389 -> Get more help at https://help.gradle.org.
390 -
391 -BUILD FAILED in 37s
392 -]
393 -`;
394 -
395 -exports[`Testing language java testing file app/src/main/java/EmbedPost.java 1`] = `null`;
396 -
397 -exports[`Testing language java testing file app/src/main/java/EmebedJobsGet.java 1`] = `
398 -[Error: Command failed: gradle -PmainClass=EmebedJobsGet run
399 -Exception in thread "main" CohereApiApiError{message: NotFoundError, statusCode: 404, body: {message=resource not found: could not find embed job with the ID: job_id}}
400 - at com.cohere.api.resources.embedjobs.EmbedJobsClient.get(EmbedJobsClient.java:259)
401 - at com.cohere.api.resources.embedjobs.EmbedJobsClient.get(EmbedJobsClient.java:218)
402 - at EmebedJobsGet.main(EmebedJobsGet.java:9)
403 -
404 -FAILURE: Build failed with an exception.
405 -
406 -* What went wrong:
407 -Execution failed for task ':app:run'.
408 -> Process 'command '/Users/billy/.gradle/jdks/eclipse_adoptium-21-aarch64-os_x.2/jdk-21.0.4+7/Contents/Home/bin/java'' finished with non-zero exit value 1
409 -
410 -* Try:
411 -> Run with --stacktrace option to get the stack trace.
412 -> Run with --info or --debug option to get more log output.
413 -> Run with --scan to get full insights.
414 -> Get more help at https://help.gradle.org.
415 -
416 -BUILD FAILED in 6s
417 -]
418 -`;
419 -
420 -exports[`Testing language java testing file app/src/main/java/GeneratePost.java 1`] = `
421 -[Error: Command failed: gradle -PmainClass=GeneratePost run
422 -
423 -FAILURE: Build failed with an exception.
424 -
425 -* What went wrong:
426 -Execution failed for task ':app:compileJava'.
427 -> Cannot access output property 'destinationDirectory' of task ':app:compileJava'. Accessing unreadable inputs or outputs is not supported. Declare the task as untracked by using Task.doNotTrackState(). For more information, please refer to https://docs.gradle.org/8.10/userguide/incremental_build.html#sec:disable-state-tracking in the Gradle documentation.
428 - > java.nio.file.NoSuchFileException: /Users/billy/repositories/cohere-developer-experience/snippets/java/app/build/classes/java/main/DatasetDelete.class
429 -
430 -* Try:
431 -> Run with --stacktrace option to get the stack trace.
432 -> Run with --info or --debug option to get more log output.
433 -> Run with --scan to get full insights.
434 -> Get more help at https://help.gradle.org.
435 -
436 -BUILD FAILED in 22s
437 -]
438 -`;
439 -
440 -exports[`Testing language java testing file app/src/main/java/ModelsListGet.java 1`] = `
441 -[Error: Command failed: gradle -PmainClass=ModelsListGet run
442 -Exception in thread "main" com.cohere.api.core.CohereApiError: Network error executing HTTP request
443 - at com.cohere.api.resources.models.ModelsClient.list(ModelsClient.java:220)
444 - at com.cohere.api.resources.models.ModelsClient.list(ModelsClient.java:137)
445 - at com.cohere.api.resources.models.ModelsClient.list(ModelsClient.java:130)
446 - at ModelsListGet.main(ModelsListGet.java:9)
447 -Caused by: com.fasterxml.jackson.databind.exc.InvalidFormatException: Cannot deserialize value of type \`com.cohere.api.types.CompatibleEndpoint\` from String "embed_image": not one of the values accepted for Enum class: [rate, summarize, classify, generate, chat, embed, rerank]
448 - at [Source: (String)"{"models":[{"name":"embed-multilingual-v3.0","endpoints":["embed","classify"],"finetuned":false,"context_length":512,"tokenizer_url":"https://storage.googleapis.com/cohere-public/tokenizers/embed-multilingual-v3.0.json","default_endpoints":[]},{"name":"rerank-multilingual-v3-cophillips","endpoints":["rerank"],"finetuned":false,"context_length":4096,"tokenizer_url":"https://storage.googleapis.com/cohere-public/tokenizers/rerank-multilingual-v3-cophillips.json","default_endpoints":[]},{"name":"emb"[truncated 4086 chars]; line: 1, column: 1211] (through reference chain: com.cohere.api.types.ListModelsResponse$Builder["models"]->java.util.ArrayList[5]->com.cohere.api.types.GetModelResponse$Builder["endpoints"]->java.util.ArrayList[0])
449 - at com.fasterxml.jackson.databind.exc.InvalidFormatException.from(InvalidFormatException.java:67)
450 - at com.fasterxml.jackson.databind.DeserializationContext.weirdStringException(DeserializationContext.java:1991)
451 - at com.fasterxml.jackson.databind.DeserializationContext.handleWeirdStringValue(DeserializationContext.java:1219)
452 - at com.fasterxml.jackson.databind.deser.std.EnumDeserializer._deserializeAltString(EnumDeserializer.java:357)
453 - at com.fasterxml.jackson.databind.deser.std.EnumDeserializer._fromString(EnumDeserializer.java:231)
454 - at com.fasterxml.jackson.databind.deser.std.EnumDeserializer.deserialize(EnumDeserializer.java:198)
455 - at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer._deserializeFromArray(CollectionDeserializer.java:355)
456 - at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:244)
457 - at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:28)
458 - at com.fasterxml.jackson.databind.deser.std.ReferenceTypeDeserializer.deserialize(ReferenceTypeDeserializer.java:204)
459 - at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeSetAndReturn(MethodProperty.java:158)
460 - at com.fasterxml.jackson.databind.deser.BuilderBasedDeserializer.vanillaDeserialize(BuilderBasedDeserializer.java:293)
461 - at com.fasterxml.jackson.databind.deser.BuilderBasedDeserializer.deserialize(BuilderBasedDeserializer.java:217)
462 - at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer._deserializeFromArray(CollectionDeserializer.java:355)
463 - at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:244)
464 - at com.fasterxml.jackson.databind.deser.std.CollectionDeserializer.deserialize(CollectionDeserializer.java:28)
465 - at com.fasterxml.jackson.databind.deser.impl.MethodProperty.deserializeSetAndReturn(MethodProperty.java:158)
466 - at com.fasterxml.jackson.databind.deser.BuilderBasedDeserializer.vanillaDeserialize(BuilderBasedDeserializer.java:293)
467 - at com.fasterxml.jackson.databind.deser.BuilderBasedDeserializer.deserialize(BuilderBasedDeserializer.java:217)
468 - at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:322)
469 - at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4675)
470 - at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3630)
471 - at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3598)
472 - at com.cohere.api.resources.models.ModelsClient.list(ModelsClient.java:173)
473 - ... 3 more
474 -
475 -FAILURE: Build failed with an exception.
476 -
477 -* What went wrong:
478 -Execution failed for task ':app:run'.
479 -> Process 'command '/Users/billy/.gradle/jdks/eclipse_adoptium-21-aarch64-os_x.2/jdk-21.0.4+7/Contents/Home/bin/java'' finished with non-zero exit value 1
480 -
481 -* Try:
482 -> Run with --stacktrace option to get the stack trace.
483 -> Run with --info or --debug option to get more log output.
484 -> Run with --scan to get full insights.
485 -> Get more help at https://help.gradle.org.
486 -
487 -BUILD FAILED in 21s
488 -]
489 -`;
490 -
491 -exports[`Testing language java testing file app/src/main/java/RerankPost.java 1`] = `null`;
492 -
493 -exports[`Testing language java testing file app/src/main/java/SummarizePost.java 1`] = `null`;
494 -
495 -exports[`Testing language java testing file app/src/main/java/TokenizePost.java 1`] = `null`;
496 -
497 -exports[`Testing language java testing file app/src/main/java/chatpost/Default.java 1`] = `null`;
498 -
499 -exports[`Testing language java testing file app/src/main/java/chatpost/Documents.java 1`] = `null`;
500 -
501 -exports[`Testing language java testing file app/src/main/java/chatpost/Stream.java 1`] = `
502 -[Error: Command failed: gradle -PmainClass=chatpost.Stream run
503 -Exception in thread "main" java.lang.IllegalStateException: closed
504 - at okio.RealBufferedSource.select(RealBufferedSource.kt:221)
505 - at okhttp3.internal.Util.readBomAsCharset(Util.kt:265)
506 - at okhttp3.ResponseBody$BomAwareReader.read(ResponseBody.kt:208)
507 - at java.base/java.io.Reader.read(Reader.java:212)
508 - at java.base/java.util.Scanner.readInput(Scanner.java:890)
509 - at java.base/java.util.Scanner.hasNext(Scanner.java:1454)
510 - at com.cohere.api.core.Stream$1.hasNext(Stream.java:60)
511 - at chatpost.Stream.main(Stream.java:37)
512 -
513 -FAILURE: Build failed with an exception.
514 -
515 -* What went wrong:
516 -Execution failed for task ':app:run'.
517 -> Process 'command '/Users/billy/.gradle/jdks/eclipse_adoptium-21-aarch64-os_x.2/jdk-21.0.4+7/Contents/Home/bin/java'' finished with non-zero exit value 1
518 -
519 -* Try:
520 -> Run with --stacktrace option to get the stack trace.
521 -> Run with --info or --debug option to get more log output.
522 -> Run with --scan to get full insights.
523 -> Get more help at https://help.gradle.org.
524 -
525 -BUILD FAILED in 9s
526 -]
527 -`;
528 -
529 -exports[`Testing language java testing file app/src/main/java/chatpost/Tools.java 1`] = `null`;
530 -
531 -exports[`Testing language java testing file app/src/main/java/finetuning/CreateFinetunedModel.java 1`] = `
532 -[Error: Command failed: gradle -PmainClass=finetuning.CreateFinetunedModel run
533 -Exception in thread "main" CohereApiApiError{message: BadRequestError, statusCode: 400, body: {message=dataset with id "my-dataset-id" does not exist}}
534 - at com.cohere.api.resources.finetuning.FinetuningClient.createFinetunedModel(FinetuningClient.java:156)
535 - at com.cohere.api.resources.finetuning.FinetuningClient.createFinetunedModel(FinetuningClient.java:121)
536 - at finetuning.CreateFinetunedModel.main(CreateFinetunedModel.java:13)
537 -
538 -FAILURE: Build failed with an exception.
539 -
540 -* What went wrong:
541 -Execution failed for task ':app:run'.
542 -> Process 'command '/Users/billy/.gradle/jdks/eclipse_adoptium-21-aarch64-os_x.2/jdk-21.0.4+7/Contents/Home/bin/java'' finished with non-zero exit value 1
543 -
544 -* Try:
545 -> Run with --stacktrace option to get the stack trace.
546 -> Run with --info or --debug option to get more log output.
547 -> Run with --scan to get full insights.
548 -> Get more help at https://help.gradle.org.
549 -
550 -BUILD FAILED in 11s
551 -]
552 -`;
553 -
554 -exports[`Testing language java testing file app/src/main/java/finetuning/DeleteFinetunedModel.java 1`] = `
555 -[Error: Command failed: gradle -PmainClass=finetuning.DeleteFinetunedModel run
556 -Error: Could not find or load main class finetuning.DeleteFinetunedModel
557 -Caused by: java.lang.ClassNotFoundException: finetuning.DeleteFinetunedModel
558 -
559 -FAILURE: Build failed with an exception.
560 -
561 -* What went wrong:
562 -Execution failed for task ':app:run'.
563 -> Process 'command '/Users/billy/.gradle/jdks/eclipse_adoptium-21-aarch64-os_x.2/jdk-21.0.4+7/Contents/Home/bin/java'' finished with non-zero exit value 1
564 -
565 -* Try:
566 -> Run with --stacktrace option to get the stack trace.
567 -> Run with --info or --debug option to get more log output.
568 -> Run with --scan to get full insights.
569 -> Get more help at https://help.gradle.org.
570 -
571 -BUILD FAILED in 6s
572 -]
573 -`;
574 -
575 -exports[`Testing language java testing file app/src/main/java/finetuning/GetFinetunedModel.java 1`] = `
576 -[Error: Command failed: gradle -PmainClass=finetuning.GetFinetunedModel run
577 -
578 -FAILURE: Build failed with an exception.
579 -
580 -* What went wrong:
581 -Execution failed for task ':app:compileJava'.
582 -> Cannot access output property 'destinationDirectory' of task ':app:compileJava'. Accessing unreadable inputs or outputs is not supported. Declare the task as untracked by using Task.doNotTrackState(). For more information, please refer to https://docs.gradle.org/8.10/userguide/incremental_build.html#sec:disable-state-tracking in the Gradle documentation.
583 - > java.nio.file.NoSuchFileException: /Users/billy/repositories/cohere-developer-experience/snippets/java/app/build/classes/java/main/DatasetDelete.class
584 -
585 -* Try:
586 -> Run with --stacktrace option to get the stack trace.
587 -> Run with --info or --debug option to get more log output.
588 -> Run with --scan to get full insights.
589 -> Get more help at https://help.gradle.org.
590 -
591 -BUILD FAILED in 4s
592 -]
593 -`;
594 -
595 -exports[`Testing language java testing file app/src/main/java/finetuning/ListEvents.java 1`] = `
596 -[Error: Command failed: gradle -PmainClass=finetuning.ListEvents run
597 -Exception in thread "main" CohereApiApiError{message: InternalServerError, statusCode: 500, body: {message=failed to retrieve total size}}
598 - at com.cohere.api.resources.finetuning.FinetuningClient.listEvents(FinetuningClient.java:428)
599 - at com.cohere.api.resources.finetuning.FinetuningClient.listEvents(FinetuningClient.java:377)
600 - at com.cohere.api.resources.finetuning.FinetuningClient.listEvents(FinetuningClient.java:372)
601 - at finetuning.ListEvents.main(ListEvents.java:11)
602 -
603 -FAILURE: Build failed with an exception.
604 -
605 -* What went wrong:
606 -Execution failed for task ':app:run'.
607 -> Process 'command '/Users/billy/.gradle/jdks/eclipse_adoptium-21-aarch64-os_x.2/jdk-21.0.4+7/Contents/Home/bin/java'' finished with non-zero exit value 1
608 -
609 -* Try:
610 -> Run with --stacktrace option to get the stack trace.
611 -> Run with --info or --debug option to get more log output.
612 -> Run with --scan to get full insights.
613 -> Get more help at https://help.gradle.org.
614 -
615 -BUILD FAILED in 19s
616 -]
617 -`;
618 -
619 -exports[`Testing language java testing file app/src/main/java/finetuning/ListFinetunedModels.java 1`] = `null`;
620 -
621 -exports[`Testing language java testing file app/src/main/java/finetuning/ListTrainingStepMetrics.java 1`] = `
622 -[Error: Command failed: gradle -PmainClass=finetuning.ListTrainingStepMetrics run
623 -Exception in thread "main" CohereApiApiError{message: BadRequestError, statusCode: 400, body: {message=invalid finetune ID}}
624 - at com.cohere.api.resources.finetuning.FinetuningClient.listTrainingStepMetrics(FinetuningClient.java:490)
625 - at com.cohere.api.resources.finetuning.FinetuningClient.listTrainingStepMetrics(FinetuningClient.java:453)
626 - at com.cohere.api.resources.finetuning.FinetuningClient.listTrainingStepMetrics(FinetuningClient.java:446)
627 - at finetuning.ListTrainingStepMetrics.main(ListTrainingStepMetrics.java:12)
628 -
629 -FAILURE: Build failed with an exception.
630 -
631 -* What went wrong:
632 -Execution failed for task ':app:run'.
633 -> Process 'command '/Users/billy/.gradle/jdks/eclipse_adoptium-21-aarch64-os_x.2/jdk-21.0.4+7/Contents/Home/bin/java'' finished with non-zero exit value 1
634 -
635 -* Try:
636 -> Run with --stacktrace option to get the stack trace.
637 -> Run with --info or --debug option to get more log output.
638 -> Run with --scan to get full insights.
639 -> Get more help at https://help.gradle.org.
640 -
641 -BUILD FAILED in 6s
642 -]
643 -`;
644 -
645 -exports[`Testing language java testing file app/src/main/java/finetuning/UpdateFinetunedModel.java 1`] = `
646 -[Error: Command failed: gradle -PmainClass=finetuning.UpdateFinetunedModel run
647 -Exception in thread "main" CohereApiApiError{message: BadRequestError, statusCode: 400, body: {message=finetuned_model.id is not a valid UUID: 'test-id'}}
648 - at com.cohere.api.resources.finetuning.FinetuningClient.updateFinetunedModel(FinetuningClient.java:342)
649 - at com.cohere.api.resources.finetuning.FinetuningClient.updateFinetunedModel(FinetuningClient.java:305)
650 - at finetuning.UpdateFinetunedModel.main(UpdateFinetunedModel.java:17)
651 -
652 -FAILURE: Build failed with an exception.
653 -
654 -* What went wrong:
655 -Execution failed for task ':app:run'.
656 -> Process 'command '/Users/billy/.gradle/jdks/eclipse_adoptium-21-aarch64-os_x.2/jdk-21.0.4+7/Contents/Home/bin/java'' finished with non-zero exit value 1
657 -
658 -* Try:
659 -> Run with --stacktrace option to get the stack trace.
660 -> Run with --info or --debug option to get more log output.
661 -> Run with --scan to get full insights.
662 -> Get more help at https://help.gradle.org.
663 -
664 -BUILD FAILED in 7s
665 -]
666 -`;
667 -
668 -exports[`Testing language node testing file chat-post/default.js 1`] = `null`;
669 -
670 -exports[`Testing language node testing file chat-post/documents.js 1`] = `null`;
671 -
672 -exports[`Testing language node testing file chat-post/stream.js 1`] = `
673 -[Error: Command failed: node chat-post/stream.js
674 -node:internal/streams/writable:474
675 - throw new ERR_INVALID_ARG_TYPE(
676 - ^
677 -
678 -TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of Object
679 - at _write (node:internal/streams/writable:474:13)
680 - at Writable.write (node:internal/streams/writable:502:10)
681 - at file:///Users/billy/repositories/cohere-developer-experience/snippets/node/chat-post/stream.js:23:22
682 - at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
683 - code: 'ERR_INVALID_ARG_TYPE'
684 -}
685 -
686 -Node.js v20.13.0
687 -]
688 -`;
689 -
690 -exports[`Testing language node testing file chat-post/tools.js 1`] = `null`;
691 -
692 -exports[`Testing language node testing file classify-post.js 1`] = `null`;
693 -
694 -exports[`Testing language node testing file connector-create.js 1`] = `
695 -[Error: Command failed: node connector-create.js
696 -/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/connectors/client/Client.js:256
697 - throw new Cohere.BadRequestError(_response.error.body);
698 - ^
699 -
700 -BadRequestError: BadRequestError
701 -Status code: 400
702 -Body: {
703 - "message": "connector not reachable at https://example.com/search. error: request failed with status code 405"
704 -}
705 - at Connectors.<anonymous> (/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/connectors/client/Client.js:256:31)
706 - at Generator.next (<anonymous>)
707 - at fulfilled (/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/connectors/client/Client.js:31:58)
708 - at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
709 - statusCode: 400,
710 - body: {
711 - message: 'connector not reachable at https://example.com/search. error: request failed with status code 405'
712 - }
713 -}
714 -
715 -Node.js v20.13.0
716 -]
717 -`;
718 -
719 -exports[`Testing language node testing file connector-delete.js 1`] = `
720 -[Error: Command failed: node connector-delete.js
721 -/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/connectors/client/Client.js:522
722 - throw new Cohere.NotFoundError(_response.error.body);
723 - ^
724 -
725 -NotFoundError: NotFoundError
726 -Status code: 404
727 -Body: {
728 - "message": "connector not found, id = connector-id"
729 -}
730 - at Connectors.<anonymous> (/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/connectors/client/Client.js:522:31)
731 - at Generator.next (<anonymous>)
732 - at fulfilled (/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/connectors/client/Client.js:31:58)
733 - at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
734 - statusCode: 404,
735 - body: { message: 'connector not found, id = connector-id' }
736 -}
737 -
738 -Node.js v20.13.0
739 -]
740 -`;
741 -
742 -exports[`Testing language node testing file connector-get.js 1`] = `
743 -[Error: Command failed: node connector-get.js
744 -/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/connectors/client/Client.js:392
745 - throw new Cohere.NotFoundError(_response.error.body);
746 - ^
747 -
748 -NotFoundError: NotFoundError
749 -Status code: 404
750 -Body: {
751 - "message": "connector not found, id = connector-id"
752 -}
753 - at Connectors.<anonymous> (/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/connectors/client/Client.js:392:31)
754 - at Generator.next (<anonymous>)
755 - at fulfilled (/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/connectors/client/Client.js:31:58)
756 - at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
757 - statusCode: 404,
758 - body: { message: 'connector not found, id = connector-id' }
759 -}
760 -
761 -Node.js v20.13.0
762 -]
763 -`;
764 -
765 -exports[`Testing language node testing file connector-patch.js 1`] = `
766 -[Error: Command failed: node connector-patch.js
767 -file:///Users/billy/repositories/cohere-developer-experience/snippets/node/connector-patch.js:8
768 - const connector = await cohere.connectors.update(connector.id, {
769 - ^
770 -
771 -ReferenceError: Cannot access 'connector' before initialization
772 - at file:///Users/billy/repositories/cohere-developer-experience/snippets/node/connector-patch.js:8:52
773 - at file:///Users/billy/repositories/cohere-developer-experience/snippets/node/connector-patch.js:14:3
774 - at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
775 - at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
776 - at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)
777 -
778 -Node.js v20.13.0
779 -]
780 -`;
781 -
782 -exports[`Testing language node testing file connectors-id-oauth-authorize-post.js 1`] = `
783 -[Error: Command failed: node connectors-id-oauth-authorize-post.js
784 -/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/connectors/client/Client.js:795
785 - throw new Cohere.NotFoundError(_response.error.body);
786 - ^
787 -
788 -NotFoundError: NotFoundError
789 -Status code: 404
790 -Body: {
791 - "message": "connector not found, id = connector-id"
792 -}
793 - at Connectors.<anonymous> (/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/connectors/client/Client.js:795:31)
794 - at Generator.next (<anonymous>)
795 - at fulfilled (/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/connectors/client/Client.js:31:58)
796 - at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
797 - statusCode: 404,
798 - body: { message: 'connector not found, id = connector-id' }
799 -}
800 -
801 -Node.js v20.13.0
802 -]
803 -`;
804 -
805 -exports[`Testing language node testing file connectors-list.js 1`] = `null`;
806 -
807 -exports[`Testing language node testing file dataset-get.js 1`] = `
808 -[Error: Command failed: node dataset-get.js
809 -/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/datasets/client/Client.js:560
810 - throw new Cohere.NotFoundError(_response.error.body);
811 - ^
812 -
813 -NotFoundError: NotFoundError
814 -Status code: 404
815 -Body: {
816 - "message": "dataset with the id '<<datasetId>>' not found"
817 -}
818 - at Datasets.<anonymous> (/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/datasets/client/Client.js:560:31)
819 - at Generator.next (<anonymous>)
820 - at fulfilled (/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/datasets/client/Client.js:31:58)
821 - at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
822 - statusCode: 404,
823 - body: { message: "dataset with the id '<<datasetId>>' not found" }
824 -}
825 -
826 -Node.js v20.13.0
827 -]
828 -`;
829 -
830 -exports[`Testing language node testing file dataset-post.js 1`] = `
831 -[Error: Command failed: node dataset-post.js
832 -file:///Users/billy/repositories/cohere-developer-experience/snippets/node/dataset-post.js:2
833 -const fs = require('fs');
834 - ^
835 -
836 -ReferenceError: require is not defined in ES module scope, you can use import instead
837 -This file is being treated as an ES module because it has a '.js' file extension and '/Users/billy/repositories/cohere-developer-experience/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
838 - at file:///Users/billy/repositories/cohere-developer-experience/snippets/node/dataset-post.js:2:12
839 - at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
840 - at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
841 - at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)
842 -
843 -Node.js v20.13.0
844 -]
845 -`;
846 -
847 -exports[`Testing language node testing file dataset-usage-get.js 1`] = `null`;
848 -
849 -exports[`Testing language node testing file detokenize-post.js 1`] = `null`;
850 -
851 -exports[`Testing language node testing file embed-jobs-cancel.js 1`] = `
852 -[Error: Command failed: node embed-jobs-cancel.js
853 -/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/embedJobs/client/Client.js:507
854 - throw new Cohere.NotFoundError(_response.error.body);
855 - ^
856 -
857 -NotFoundError: NotFoundError
858 -Status code: 404
859 -Body: {
860 - "message": "resource not found: could not find embed job with the ID: job_id"
861 -}
862 - at EmbedJobs.<anonymous> (/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/embedJobs/client/Client.js:507:31)
863 - at Generator.next (<anonymous>)
864 - at fulfilled (/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/embedJobs/client/Client.js:31:58)
865 - at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
866 - statusCode: 404,
867 - body: {
868 - message: 'resource not found: could not find embed job with the ID: job_id'
869 - }
870 -}
871 -
872 -Node.js v20.13.0
873 -]
874 -`;
875 -
876 -exports[`Testing language node testing file embed-jobs-get.js 1`] = `null`;
877 -
878 -exports[`Testing language node testing file embed-jobs-post.js 1`] = `
879 -[Error: Command failed: node embed-jobs-post.js
880 -/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/embedJobs/client/Client.js:253
881 - throw new Cohere.NotFoundError(_response.error.body);
882 - ^
883 -
884 -NotFoundError: NotFoundError
885 -Status code: 404
886 -Body: {
887 - "message": "dataset with id my-dataset not found"
888 -}
889 - at EmbedJobs.<anonymous> (/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/embedJobs/client/Client.js:253:31)
890 - at Generator.next (<anonymous>)
891 - at fulfilled (/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/embedJobs/client/Client.js:31:58)
892 - at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
893 - statusCode: 404,
894 - body: { message: 'dataset with id my-dataset not found' }
895 -}
896 -
897 -Node.js v20.13.0
898 -]
899 -`;
900 -
901 -exports[`Testing language node testing file embed-post.js 1`] = `null`;
902 -
903 -exports[`Testing language node testing file emebed-jobs-get.js 1`] = `
904 -[Error: Command failed: node emebed-jobs-get.js
905 -/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/embedJobs/client/Client.js:383
906 - throw new Cohere.NotFoundError(_response.error.body);
907 - ^
908 -
909 -NotFoundError: NotFoundError
910 -Status code: 404
911 -Body: {
912 - "message": "resource not found: could not find embed job with the ID: job_id"
913 -}
914 - at EmbedJobs.<anonymous> (/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/embedJobs/client/Client.js:383:31)
915 - at Generator.next (<anonymous>)
916 - at fulfilled (/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/embedJobs/client/Client.js:31:58)
917 - at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
918 - statusCode: 404,
919 - body: {
920 - message: 'resource not found: could not find embed job with the ID: job_id'
921 - }
922 -}
923 -
924 -Node.js v20.13.0
925 -]
926 -`;
927 -
928 -exports[`Testing language node testing file finetuning/create-finetuned-model.js 1`] = `
929 -[Error: Command failed: node finetuning/create-finetuned-model.js
930 -file:///Users/billy/repositories/cohere-developer-experience/snippets/node/finetuning/create-finetuned-model.js:12
931 - base_type: Cohere.Finetuning.BaseType.BaseTypeChat,
932 - ^
933 -
934 -TypeError: Cannot read properties of undefined (reading 'BaseType')
935 - at file:///Users/billy/repositories/cohere-developer-experience/snippets/node/finetuning/create-finetuned-model.js:12:38
936 - at file:///Users/billy/repositories/cohere-developer-experience/snippets/node/finetuning/create-finetuned-model.js:19:3
937 - at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
938 - at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
939 - at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)
940 -
941 -Node.js v20.13.0
942 -]
943 -`;
944 -
945 -exports[`Testing language node testing file finetuning/delete-finetuned-model.js 1`] = `
946 -[Error: Command failed: node finetuning/delete-finetuned-model.js
947 -/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/finetuning/client/Client.js:379
948 - throw new Cohere.BadRequestError(_response.error.body);
949 - ^
950 -
951 -BadRequestError: BadRequestError
952 -Status code: 400
953 -Body: {
954 - "message": "fine-tuned model ID is not a valid UUID: 'test-id'"
955 -}
956 - at Finetuning.<anonymous> (/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/finetuning/client/Client.js:379:31)
957 - at Generator.next (<anonymous>)
958 - at fulfilled (/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/finetuning/client/Client.js:31:58)
959 - at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
960 - statusCode: 400,
961 - body: { message: "fine-tuned model ID is not a valid UUID: 'test-id'" }
962 -}
963 -
964 -Node.js v20.13.0
965 -]
966 -`;
967 -
968 -exports[`Testing language node testing file finetuning/get-finetuned-model.js 1`] = `
969 -[Error: Command failed: node finetuning/get-finetuned-model.js
970 -/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/finetuning/client/Client.js:296
971 - throw new Cohere.BadRequestError(_response.error.body);
972 - ^
973 -
974 -BadRequestError: BadRequestError
975 -Status code: 400
976 -Body: {
977 - "message": "finetuned_model.id is not a valid UUID: 'test-id'"
978 -}
979 - at Finetuning.<anonymous> (/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/finetuning/client/Client.js:296:31)
980 - at Generator.next (<anonymous>)
981 - at fulfilled (/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/finetuning/client/Client.js:31:58)
982 - at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
983 - statusCode: 400,
984 - body: { message: "finetuned_model.id is not a valid UUID: 'test-id'" }
985 -}
986 -
987 -Node.js v20.13.0
988 -]
989 -`;
990 -
991 -exports[`Testing language node testing file finetuning/list-events.js 1`] = `
992 -[Error: Command failed: node finetuning/list-events.js
993 -/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/finetuning/client/Client.js:580
994 - throw new Cohere.InternalServerError(_response.error.body);
995 - ^
996 -
997 -InternalServerError: InternalServerError
998 -Status code: 500
999 -Body: {
1000 - "message": "failed to retrieve total size"
1001 -}
1002 - at Finetuning.<anonymous> (/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/finetuning/client/Client.js:580:31)
1003 - at Generator.next (<anonymous>)
1004 - at fulfilled (/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/finetuning/client/Client.js:31:58)
1005 - at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
1006 - statusCode: 500,
1007 - body: { message: 'failed to retrieve total size' }
1008 -}
1009 -
1010 -Node.js v20.13.0
1011 -]
1012 -`;
1013 -
1014 -exports[`Testing language node testing file finetuning/list-finetuned-models.js 1`] = `null`;
1015 -
1016 -exports[`Testing language node testing file finetuning/list-training-step-metrics.js 1`] = `
1017 -[Error: Command failed: node finetuning/list-training-step-metrics.js
1018 -/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/finetuning/client/Client.js:665
1019 - throw new Cohere.BadRequestError(_response.error.body);
1020 - ^
1021 -
1022 -BadRequestError: BadRequestError
1023 -Status code: 400
1024 -Body: {
1025 - "message": "invalid finetune ID"
1026 -}
1027 - at Finetuning.<anonymous> (/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/finetuning/client/Client.js:665:31)
1028 - at Generator.next (<anonymous>)
1029 - at fulfilled (/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/finetuning/client/Client.js:31:58)
1030 - at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
1031 - statusCode: 400,
1032 - body: { message: 'invalid finetune ID' }
1033 -}
1034 -
1035 -Node.js v20.13.0
1036 -]
1037 -`;
1038 -
1039 -exports[`Testing language node testing file finetuning/update-finetuned-model.js 1`] = `
1040 -[Error: Command failed: node finetuning/update-finetuned-model.js
1041 -/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/core/schemas/builders/schema-utils/getSchemaUtils.js:23
1042 - throw new JsonError_1.JsonError(raw.errors);
1043 - ^
1044 -
1045 -JsonError: Missing required key "settings"
1046 - at Object.jsonOrThrow (/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/core/schemas/builders/schema-utils/getSchemaUtils.js:23:19)
1047 - at Finetuning.<anonymous> (/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/finetuning/client/Client.js:455:73)
1048 - at Generator.next (<anonymous>)
1049 - at fulfilled (/Users/billy/repositories/cohere-developer-experience/node_modules/.pnpm/cohere-ai@7.14.0_@aws-sdk+client-sso-oidc@3.679.0_@aws-sdk+client-sts@3.679.0_/node_modules/cohere-ai/api/resources/finetuning/client/Client.js:31:58) {
1050 - errors: [ { path: [], message: 'Missing required key "settings"' } ]
1051 -}
1052 -
1053 -Node.js v20.13.0
1054 -]
1055 -`;
1056 -
1057 -exports[`Testing language node testing file generate-post.js 1`] = `null`;
1058 -
1059 -exports[`Testing language node testing file models-list-get.js 1`] = `null`;
1060 -
1061 -exports[`Testing language node testing file rerank-post.js 1`] = `null`;
1062 -
1063 -exports[`Testing language node testing file summarize-post.js 1`] = `null`;
1064 -
1065 -exports[`Testing language node testing file tokenize-post.js 1`] = `null`;
1066 -
1067 -exports[`Testing language python testing file chat-post.py 1`] = `null`;
1068 -
1069 -exports[`Testing language python testing file chat-post/default.py 1`] = `null`;
1070 -
1071 -exports[`Testing language python testing file chat-post/documents.py 1`] = `null`;
1072 -
1073 -exports[`Testing language python testing file chat-post/stream.py 1`] = `null`;
1074 -
1075 -exports[`Testing language python testing file chat-post/tools.py 1`] = `null`;
1076 -
1077 -exports[`Testing language python testing file classify-post.py 1`] = `null`;
1078 -
1079 -exports[`Testing language python testing file connector-create.py 1`] = `
1080 -[Error: Command failed: poetry run python connector-create.py
1081 -Traceback (most recent call last):
1082 - File "/Users/billy/repositories/cohere-developer-experience/snippets/python/connector-create.py", line 4, in <module>
1083 - response = co.connectors.create(
1084 - ^^^^^^^^^^^^^^^^^^^^^
1085 - File "/Users/billy/Library/Caches/pypoetry/virtualenvs/py-snips-je53b3MO-py3.11/lib/python3.11/site-packages/cohere/connectors/client.py", line 307, in create
1086 - raise BadRequestError(
1087 -cohere.errors.bad_request_error.BadRequestError: status_code: 400, body: {'message': 'connector not reachable at https://connector-example.com/search. error: Post "https://connector-example.com/search": Internal Server Error'}
1088 -]
1089 -`;
1090 -
1091 -exports[`Testing language python testing file connector-delete.py 1`] = `
1092 -[Error: Command failed: poetry run python connector-delete.py
1093 -Traceback (most recent call last):
1094 - File "/Users/billy/repositories/cohere-developer-experience/snippets/python/connector-delete.py", line 4, in <module>
1095 - co.connectors.delete("test-id")
1096 - File "/Users/billy/Library/Caches/pypoetry/virtualenvs/py-snips-je53b3MO-py3.11/lib/python3.11/site-packages/cohere/connectors/client.py", line 653, in delete
1097 - raise NotFoundError(
1098 -cohere.errors.not_found_error.NotFoundError: status_code: 404, body: {'message': 'connector not found, id = test-id'}
1099 -]
1100 -`;
1101 -
1102 -exports[`Testing language python testing file connector-get.py 1`] = `
1103 -[Error: Command failed: poetry run python connector-get.py
1104 -Traceback (most recent call last):
1105 - File "/Users/billy/repositories/cohere-developer-experience/snippets/python/connector-get.py", line 4, in <module>
1106 - response = co.connectors.get("test-id")
1107 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1108 - File "/Users/billy/Library/Caches/pypoetry/virtualenvs/py-snips-je53b3MO-py3.11/lib/python3.11/site-packages/cohere/connectors/client.py", line 495, in get
1109 - raise NotFoundError(
1110 -cohere.errors.not_found_error.NotFoundError: status_code: 404, body: {'message': 'connector not found, id = test-id'}
1111 -]
1112 -`;
1113 -
1114 -exports[`Testing language python testing file connector-patch.py 1`] = `
1115 -[Error: Command failed: poetry run python connector-patch.py
1116 -Traceback (most recent call last):
1117 - File "/Users/billy/repositories/cohere-developer-experience/snippets/python/connector-patch.py", line 4, in <module>
1118 - response = co.connectors.update(
1119 - ^^^^^^^^^^^^^^^^^^^^^
1120 -TypeError: ConnectorsClient.update() got an unexpected keyword argument 'connector_id'
1121 -]
1122 -`;
1123 -
1124 -exports[`Testing language python testing file connectors-id-oauth-authorize-post.py 1`] = `
1125 -[Error: Command failed: poetry run python connectors-id-oauth-authorize-post.py
1126 -Traceback (most recent call last):
1127 - File "/Users/billy/repositories/cohere-developer-experience/snippets/python/connectors-id-oauth-authorize-post.py", line 4, in <module>
1128 - response = co.connectors.o_auth_authorize(
1129 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1130 -TypeError: ConnectorsClient.o_auth_authorize() got an unexpected keyword argument 'connector_id'
1131 -]
1132 -`;
1133 -
1134 -exports[`Testing language python testing file connectors-list.py 1`] = `null`;
1135 -
1136 -exports[`Testing language python testing file dataset-delete.py 1`] = `
1137 -[Error: Command failed: poetry run python dataset-delete.py
1138 -Traceback (most recent call last):
1139 - File "/Users/billy/repositories/cohere-developer-experience/snippets/python/dataset-delete.py", line 6, in <module>
1140 - co.datasets.delete("id")
1141 - File "/Users/billy/Library/Caches/pypoetry/virtualenvs/py-snips-je53b3MO-py3.11/lib/python3.11/site-packages/cohere/datasets/client.py", line 840, in delete
1142 - raise NotFoundError(
1143 -cohere.errors.not_found_error.NotFoundError: status_code: 404, body: {'message': "dataset with the id 'id' not found"}
1144 -]
1145 -`;
1146 -
1147 -exports[`Testing language python testing file dataset-get.py 1`] = `
1148 -[Error: Command failed: poetry run python dataset-get.py
1149 -Traceback (most recent call last):
1150 - File "/Users/billy/repositories/cohere-developer-experience/snippets/python/dataset-get.py", line 6, in <module>
1151 - response = co.datasets.get(id="<<datasetId>>")
1152 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1153 - File "/Users/billy/Library/Caches/pypoetry/virtualenvs/py-snips-je53b3MO-py3.11/lib/python3.11/site-packages/cohere/datasets/client.py", line 681, in get
1154 - raise NotFoundError(
1155 -cohere.errors.not_found_error.NotFoundError: status_code: 404, body: {'message': "dataset with the id '<<datasetId>>' not found"}
1156 -]
1157 -`;
1158 -
1159 -exports[`Testing language python testing file dataset-post.py 1`] = `
1160 -[Error: Command failed: poetry run python dataset-post.py
1161 -Traceback (most recent call last):
1162 - File "/Users/billy/repositories/cohere-developer-experience/snippets/python/dataset-post.py", line 8, in <module>
1163 - data=open("./chat.jsonl", "rb"),
1164 - ^^^^^^^^^^^^^^^^^^^^^^^^^^
1165 -FileNotFoundError: [Errno 2] No such file or directory: './chat.jsonl'
1166 -]
1167 -`;
1168 -
1169 -exports[`Testing language python testing file dataset-usage-get.py 1`] = `null`;
1170 -
1171 -exports[`Testing language python testing file detokenize-post.py 1`] = `null`;
1172 -
1173 -exports[`Testing language python testing file embed-jobs-cancel.py 1`] = `
1174 -[Error: Command failed: poetry run python embed-jobs-cancel.py
1175 -Traceback (most recent call last):
1176 - File "/Users/billy/repositories/cohere-developer-experience/snippets/python/embed-jobs-cancel.py", line 6, in <module>
1177 - co.embed_jobs.cancel("job_id")
1178 - File "/Users/billy/Library/Caches/pypoetry/virtualenvs/py-snips-je53b3MO-py3.11/lib/python3.11/site-packages/cohere/embed_jobs/client.py", line 630, in cancel
1179 - raise NotFoundError(
1180 -cohere.errors.not_found_error.NotFoundError: status_code: 404, body: {'message': 'resource not found: could not find embed job with the ID: job_id'}
1181 -]
1182 -`;
1183 -
1184 -exports[`Testing language python testing file embed-jobs-get.py 1`] = `null`;
1185 -
1186 -exports[`Testing language python testing file embed-jobs-post.py 1`] = `
1187 -[Error: Command failed: poetry run python embed-jobs-post.py
1188 -Traceback (most recent call last):
1189 - File "/Users/billy/repositories/cohere-developer-experience/snippets/python/embed-jobs-post.py", line 6, in <module>
1190 - job = co.embed_jobs.create(
1191 - ^^^^^^^^^^^^^^^^^^^^^
1192 - File "/Users/billy/Library/Caches/pypoetry/virtualenvs/py-snips-je53b3MO-py3.11/lib/python3.11/site-packages/cohere/embed_jobs/client.py", line 321, in create
1193 - raise NotFoundError(
1194 -cohere.errors.not_found_error.NotFoundError: status_code: 404, body: {'message': 'dataset with id my-dataset-id not found'}
1195 -]
1196 -`;
1197 -
1198 -exports[`Testing language python testing file embed-post.py 1`] = `null`;
1199 -
1200 -exports[`Testing language python testing file emebed-jobs-get.py 1`] = `
1201 -[Error: Command failed: poetry run python emebed-jobs-get.py
1202 -Traceback (most recent call last):
1203 - File "/Users/billy/repositories/cohere-developer-experience/snippets/python/emebed-jobs-get.py", line 6, in <module>
1204 - response = co.embed_jobs.get("job_id")
1205 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^
1206 - File "/Users/billy/Library/Caches/pypoetry/virtualenvs/py-snips-je53b3MO-py3.11/lib/python3.11/site-packages/cohere/embed_jobs/client.py", line 479, in get
1207 - raise NotFoundError(
1208 -cohere.errors.not_found_error.NotFoundError: status_code: 404, body: {'message': 'resource not found: could not find embed job with the ID: job_id'}
1209 -]
1210 -`;
1211 -
1212 -exports[`Testing language python testing file finetuning/create-finetuned-model.py 1`] = `
1213 -[Error: Command failed: poetry run python finetuning/create-finetuned-model.py
1214 -Traceback (most recent call last):
1215 - File "/Users/billy/repositories/cohere-developer-experience/snippets/python/finetuning/create-finetuned-model.py", line 17, in <module>
1216 - finetuned_model = co.finetuning.create_finetuned_model(
1217 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1218 - File "/Users/billy/Library/Caches/pypoetry/virtualenvs/py-snips-je53b3MO-py3.11/lib/python3.11/site-packages/cohere/finetuning/client.py", line 220, in create_finetuned_model
1219 - raise BadRequestError(
1220 -cohere.errors.bad_request_error.BadRequestError: status_code: 400, body: {'message': 'proto:\\xa0(line 1:258): unknown field "train_epoch"'}
1221 -]
1222 -`;
1223 -
1224 -exports[`Testing language python testing file finetuning/delete-finetuned-model.py 1`] = `
1225 -[Error: Command failed: poetry run python finetuning/delete-finetuned-model.py
1226 -Traceback (most recent call last):
1227 - File "/Users/billy/repositories/cohere-developer-experience/snippets/python/finetuning/delete-finetuned-model.py", line 4, in <module>
1228 - co.finetuning.delete_finetuned_model("test-id")
1229 - File "/Users/billy/Library/Caches/pypoetry/virtualenvs/py-snips-je53b3MO-py3.11/lib/python3.11/site-packages/cohere/finetuning/client.py", line 436, in delete_finetuned_model
1230 - raise BadRequestError(
1231 -cohere.errors.bad_request_error.BadRequestError: status_code: 400, body: {'message': "fine-tuned model ID is not a valid UUID: 'test-id'"}
1232 -]
1233 -`;
1234 -
1235 -exports[`Testing language python testing file finetuning/get-finetuned-model.py 1`] = `
1236 -[Error: Command failed: poetry run python finetuning/get-finetuned-model.py
1237 -Traceback (most recent call last):
1238 - File "/Users/billy/repositories/cohere-developer-experience/snippets/python/finetuning/get-finetuned-model.py", line 4, in <module>
1239 - response = co.finetuning.get_finetuned_model("test-id")
1240 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1241 - File "/Users/billy/Library/Caches/pypoetry/virtualenvs/py-snips-je53b3MO-py3.11/lib/python3.11/site-packages/cohere/finetuning/client.py", line 328, in get_finetuned_model
1242 - raise BadRequestError(
1243 -cohere.errors.bad_request_error.BadRequestError: status_code: 400, body: {'message': "finetuned_model.id is not a valid UUID: 'test-id'"}
1244 -]
1245 -`;
1246 -
1247 -exports[`Testing language python testing file finetuning/list-events.py 1`] = `
1248 -[Error: Command failed: poetry run python finetuning/list-events.py
1249 -Traceback (most recent call last):
1250 - File "/Users/billy/repositories/cohere-developer-experience/snippets/python/finetuning/list-events.py", line 4, in <module>
1251 - response = co.finetuning.list_events(finetuned_model_id="test-id")
1252 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1253 - File "/Users/billy/Library/Caches/pypoetry/virtualenvs/py-snips-je53b3MO-py3.11/lib/python3.11/site-packages/cohere/finetuning/client.py", line 779, in list_events
1254 - raise InternalServerError(
1255 -cohere.errors.internal_server_error.InternalServerError: status_code: 500, body: {'message': 'failed to retrieve total size'}
1256 -]
1257 -`;
1258 -
1259 -exports[`Testing language python testing file finetuning/list-finetuned-models.py 1`] = `null`;
1260 -
1261 -exports[`Testing language python testing file finetuning/list-training-step-metrics.py 1`] = `
1262 -[Error: Command failed: poetry run python finetuning/list-training-step-metrics.py
1263 -Traceback (most recent call last):
1264 - File "/Users/billy/repositories/cohere-developer-experience/snippets/python/finetuning/list-training-step-metrics.py", line 4, in <module>
1265 - train_step_metrics = co.finetuning.list_training_step_metrics(
1266 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1267 - File "/Users/billy/Library/Caches/pypoetry/virtualenvs/py-snips-je53b3MO-py3.11/lib/python3.11/site-packages/cohere/finetuning/client.py", line 862, in list_training_step_metrics
1268 - raise BadRequestError(
1269 -cohere.errors.bad_request_error.BadRequestError: status_code: 400, body: {'message': 'invalid finetune ID'}
1270 -]
1271 -`;
1272 -
1273 -exports[`Testing language python testing file finetuning/update-finetuned-model.py 1`] = `
1274 -[Error: Command failed: poetry run python finetuning/update-finetuned-model.py
1275 -Traceback (most recent call last):
1276 - File "/Users/billy/repositories/cohere-developer-experience/snippets/python/finetuning/update-finetuned-model.py", line 8, in <module>
1277 - finetuned_model = co.finetuning.update_finetuned_model(
1278 - ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1279 - File "/Users/billy/Library/Caches/pypoetry/virtualenvs/py-snips-je53b3MO-py3.11/lib/python3.11/site-packages/cohere/finetuning/client.py", line 605, in update_finetuned_model
1280 - raise BadRequestError(
1281 -cohere.errors.bad_request_error.BadRequestError: status_code: 400, body: {'message': "finetuned_model.id is not a valid UUID: 'test-id'"}
1282 -]
1283 -`;
1284 -
1285 -exports[`Testing language python testing file generate-post.py 1`] = `null`;
1286 -
1287 -exports[`Testing language python testing file models-list-get.py 1`] = `null`;
1288 -
1289 -exports[`Testing language python testing file rerank-post.py 1`] = `null`;
1290 -
1291 -exports[`Testing language python testing file summarize-post.py 1`] = `null`;
1292 -
1293 -exports[`Testing language python testing file tokenize-post.py 1`] = `null`;
fern/packages/snippet-tester/src/tests/snippets.test.ts deleted
-32
@@ -1,32 +0,0 @@
1 -import { describe, expect, test } from 'bun:test';
2 -import * as fs from "fs";
3 -import { glob } from "glob";
4 -import path from 'path';
5 -import { config, Language } from '../config';
6 -import { execCmd } from '../utils';
7 -
8 -// recurse up until you find a pnpm-workspace.yaml
9 -const findPnpmWorkspaceDir = (curDir = __dirname) => {
10 - if (curDir === "/") {
11 - throw new Error("Could not find pnpm-workspace.yaml")
12 - }
13 -
14 - if (fs.existsSync(path.resolve(curDir, "pnpm-lock.yaml"))) {
15 - return curDir
16 - }
17 -
18 - return findPnpmWorkspaceDir(fs.realpathSync(path.resolve(curDir, "..")))
19 -}
20 -
21 -const workspaceDir = findPnpmWorkspaceDir()
22 -
23 -describe.each(config.languages.map(o => [o.name, o] as [string, Language]))("Testing language %s", (name: string, lang: Language) => {
24 - const cwd = lang.snippetRoot(workspaceDir)
25 - const filePaths = glob.globSync(lang.glob, { cwd })
26 -
27 - test.each(filePaths)('testing file %s', async (filePath: string) => {
28 - const { error } = await execCmd(lang.exec(filePath), cwd)
29 -
30 - expect(error).toMatchSnapshot()
31 - }, { timeout: 1000000 });
32 -})
\ No newline at end of file
fern/packages/snippet-tester/src/utils.ts deleted
-67
@@ -1,67 +0,0 @@
1 -import * as childProcess from "child_process"
2 -import fs from "fs"
3 -
4 -export const findAndReplace = async (paths: string[], find: RegExp, replace: string) => {
5 - await Promise.all(paths.map(async (path) => {
6 - const file = await fs.promises.readFile(path)
7 - const content = file.toString()
8 - const newContent = content.replace(find, replace)
9 - await fs.promises.writeFile(path, newContent)
10 - }))
11 -}
12 -
13 -export const execCmd = async (cmd: string, cwd: string): Promise<{error: null | childProcess.ExecException, stderr: string, stdout: string}> => {
14 - return new Promise((resolve, reject) => {
15 - try {
16 - childProcess.exec(cmd, {cwd}, (error, stdout, stderr) => {
17 - if (error) {
18 - resolve({error, stderr, stdout})
19 - }
20 - resolve({ error, stderr, stdout})
21 - })
22 - } catch (error) {
23 - if (error instanceof Error) {
24 - resolve({error: error as childProcess.ExecException, stderr: '', stdout: ''})
25 - } else {
26 - resolve({error: null, stderr: String(error), stdout: ''})
27 - }
28 - }
29 - })
30 -}
31 -
32 -export const getFilesByExtension = async (base: string, extension: string): Promise<string[]> => {
33 - const list = await fs.promises.readdir(base)
34 - const all = await Promise.all(list.flatMap((file) => {
35 - const filepath = `${base}/${file}`
36 -
37 - if (fs.statSync(filepath).isDirectory()) {
38 - return getFilesByExtension(filepath, extension)
39 - } else if (file.endsWith(extension)) {
40 - return filepath
41 - }
42 -
43 - return []
44 - }))
45 -
46 - return all.flat()
47 -}
48 -
49 -export const execTypescriptFile = async (projectRoot: string, file: string) => {
50 - const cmd = `bun run ${file}`
51 - return execCmd(cmd, projectRoot)
52 -}
53 -
54 -export const execJavaFile = async (projectRoot: string, file: string) => {
55 - const cmd = `java ${file}`
56 - return execCmd(cmd, projectRoot)
57 -}
58 -
59 -export const execPythonFile = async (projectRoot: string, file: string) => {
60 - const cmd = `python ${file}`
61 - return execCmd(cmd, projectRoot)
62 -}
63 -
64 -export const execGoFile = async (projectRoot: string, file: string) => {
65 - const cmd = `go run ${file}`
66 - return execCmd(cmd, projectRoot)
67 -}
fern/packages/snippet-tester/tsconfig.json deleted
-24
@@ -1,24 +0,0 @@
1 -{
2 - "compilerOptions": {
3 - "target": "es2022",
4 - "lib": ["ESNext"],
5 - "module": "esnext",
6 - "moduleResolution": "bundler",
7 - "types": ["bun-types"],
8 - "skipLibCheck": true,
9 - "resolveJsonModule": true,
10 - "allowImportingTsExtensions": true,
11 - "isolatedModules": true,
12 - "noEmit": true,
13 - "strict": true,
14 - "noUnusedLocals": true,
15 - "noUnusedParameters": true,
16 - "noFallthroughCasesInSwitch": true,
17 - "outDir": "dist",
18 - "declaration": true,
19 - "esModuleInterop": true,
20 - "forceConsistentCasingInFileNames": true
21 - },
22 - "include": ["src/**/*"],
23 - "exclude": ["node_modules", "dist"]
24 -}
\ No newline at end of file
fern/pages/src/authentication/connected-accounts.mdx deleted
-194
@@ -1,194 +0,0 @@
1 ----
2 -title: Connected Accounts
3 -image: "https://og.composio.dev/api/og?title=Connected%20Accounts"
4 -subtitle: "Manage and monitor user connections to toolkits"
5 -keywords: "connected accounts, manage connections, refresh tokens, account status, account credentials, disable accounts, delete accounts, redacted, mask secrets, mask connected account secrets"
6 -hide-nav-links: true
7 ----
8 -
9 -Connected accounts are authenticated connections between your users and toolkits. After users authenticate (see [Authenticating tools](/docs/authenticating-tools)), you can manage these accounts throughout their lifecycle.
10 -
11 -Composio automatically handles token refresh and credential management. This guide covers manual operations: listing, retrieving, refreshing, enabling, disabling, and deleting accounts.
12 -
13 -## List accounts
14 -
15 -Retrieve all connected accounts with optional filters:
16 -
17 -<CodeGroup>
18 -<SnippetCode
19 - src="fern/snippets/authentication/python/connected-accounts-management.py"
20 - title="Python"
21 - startLine={12}
22 - endLine={22}
23 -/>
24 -
25 -<SnippetCode
26 - src="fern/snippets/authentication/typescript/connected-accounts-management.ts"
27 - title="TypeScript"
28 - startLine={12}
29 - endLine={22}
30 -/>
31 -</CodeGroup>
32 -
33 -
34 -## Get account details
35 -
36 -Retrieve a connected account by ID:
37 -
38 -<CodeGroup>
39 -<SnippetCode
40 - src="fern/snippets/authentication/python/connected-accounts-management.py"
41 - title="Python"
42 - startLine={25}
43 - endLine={28}
44 -/>
45 -
46 -<SnippetCode
47 - src="fern/snippets/authentication/typescript/connected-accounts-management.ts"
48 - title="TypeScript"
49 - startLine={25}
50 - endLine={28}
51 -/>
52 -</CodeGroup>
53 -
54 -### Get account credentials
55 -
56 -Get account credentials for use with your own tools:
57 -
58 -<CodeGroup>
59 -<SnippetCode
60 - src="fern/snippets/authentication/python/connected-accounts-management.py"
61 - title="Python"
62 - startLine={32}
63 - endLine={39}
64 -/>
65 -
66 -<SnippetCode
67 - src="fern/snippets/authentication/typescript/connected-accounts-management.ts"
68 - title="TypeScript"
69 - startLine={32}
70 - endLine={40}
71 -/>
72 -</CodeGroup>
73 -
74 -<Warning>
75 -If credentials return as `REDACTED` instead of actual values, the **Mask Connected Account Secrets** setting is enabled on your account. This setting redacts all sensitive credential data (tokens, secrets, API keys) for security purposes.
76 -
77 -To view actual credentials, navigate to **Settings → Project Settings → Project Configuration** and disable "Mask Connected Account Secrets".
78 -</Warning>
79 -
80 -## Refresh credentials
81 -
82 -Manually refresh credentials for a connected account:
83 -
84 -<CodeGroup>
85 -<SnippetCode
86 - src="fern/snippets/authentication/python/connected-accounts-management.py"
87 - title="Python"
88 - startLine={43}
89 - endLine={50}
90 -/>
91 -
92 -<SnippetCode
93 - src="fern/snippets/authentication/typescript/connected-accounts-management.ts"
94 - title="TypeScript"
95 - startLine={44}
96 - endLine={52}
97 -/>
98 -</CodeGroup>
99 -
100 -
101 -## Enable and disable accounts
102 -
103 -Change account status without deleting. Set to INACTIVE to pause access, or ACTIVE to restore. Useful for:
104 -- Pausing access during subscription lapses
105 -- Temporary disconnection
106 -
107 -<CodeGroup>
108 -<SnippetCode
109 - src="fern/snippets/authentication/python/connected-accounts-management.py"
110 - title="Python"
111 - startLine={54}
112 - endLine={60}
113 -/>
114 -
115 -<SnippetCode
116 - src="fern/snippets/authentication/typescript/connected-accounts-management.ts"
117 - title="TypeScript"
118 - startLine={56}
119 - endLine={62}
120 -/>
121 -</CodeGroup>
122 -
123 -<Warning>
124 -INACTIVE accounts cannot execute tools. Tool execution will fail until the status is changed.
125 -</Warning>
126 -
127 -## Delete accounts
128 -
129 -Permanently remove a connected account and revoke all credentials:
130 -
131 -<CodeGroup>
132 -<SnippetCode
133 - src="fern/snippets/authentication/python/connected-accounts-management.py"
134 - title="Python"
135 - startLine={64}
136 - endLine={66}
137 -/>
138 -
139 -<SnippetCode
140 - src="fern/snippets/authentication/typescript/connected-accounts-management.ts"
141 - title="TypeScript"
142 - startLine={66}
143 - endLine={68}
144 -/>
145 -</CodeGroup>
146 -
147 -<Warning>
148 -Deletion is permanent. Users must re-authenticate to reconnect.
149 -</Warning>
150 -
151 -## Multiple accounts
152 -
153 -Users can connect multiple accounts for the same toolkit (e.g., personal and work Gmail).
154 -
155 -<Note>
156 -Use `link()` for creating accounts, as it provides hosted authentication and allows multiple accounts by default. See [Connect Link authentication](/docs/authenticating-tools#hosted-authentication-connect-link).
157 -</Note>
158 -
159 -<CodeGroup>
160 -<SnippetCode
161 - src="fern/snippets/authentication/python/connected-accounts-management.py"
162 - title="Python"
163 - startLine={70}
164 - endLine={93}
165 -/>
166 -
167 -<SnippetCode
168 - src="fern/snippets/authentication/typescript/connected-accounts-management.ts"
169 - title="TypeScript"
170 - startLine={72}
171 - endLine={99}
172 -/>
173 -</CodeGroup>
174 -
175 -### Execute with a specific account
176 -
177 -When you have multiple accounts, specify which one to use with `connected_account_id`:
178 -
179 -<CodeGroup>
180 -<SnippetCode
181 - src="fern/snippets/authentication/python/connected-accounts-management.py"
182 - title="Python"
183 - startLine={95}
184 - endLine={102}
185 -/>
186 -
187 -<SnippetCode
188 - src="fern/snippets/authentication/typescript/connected-accounts-management.ts"
189 - title="TypeScript"
190 - startLine={101}
191 - endLine={107}
192 -/>
193 -</CodeGroup>
194 -
fern/pages/src/authentication/custom-auth-configs.mdx deleted
-254
@@ -1,254 +0,0 @@
1 ----
2 -title: Custom Auth Configs
3 -image: "https://og.composio.dev/api/og?title=Custom%20Auth%20Configs" # image for socials
4 -subtitle: 'Customize auth configs for any toolkit'
5 -keywords: ''
6 -hide-nav-links: true
7 ----
8 -
9 -Many toolkits support a level of customization for the auth config, specifically OAuth applications.
10 -
11 -This guide will walk you through the process of customizing the auth config for toolkits where you can configure your own developer app.
12 -
13 -## Creating a custom auth config
14 -
15 -To create a custom auth config, click **Create Auth Config** in your dashboard, then navigate to **Authentication management** → **Manage authentication with custom credentials**.
16 -
17 -You'll need to customize the auth config when you want to use different values than the defaults - such as your own subdomain, base URL, client ID, client secret, etc.
18 -
19 -<Tabs>
20 -<Tab title="Example: PostHog">
21 -You may change the subdomain for the PostHog toolkit to match your own instance.
22 -<Frame background="subtle" title="PostHog Auth Config Settings">
23 -<img src="../../../assets/images/custom-auth-posthog.png" style={{ maxHeight: '400px', width: 'auto', display: 'block', margin: '0 auto' }} />
24 -</Frame>
25 -</Tab>
26 -<Tab title="Example: Hubspot">
27 -For Hubspot you may customize everything here. For each auth scheme there is a different set of fields.
28 -
29 -If you choose to use your own developer app for the OAuth2 scheme, you will have to provide the client ID and client secret.
30 -
31 -<Frame background="subtle" title="Hubspot Auth Config Settings">
32 -<img src="../../../assets/images/custom-auth-hubspot.png" style={{ maxHeight: '400px', width: 'auto', display: 'block', margin: '0 auto' }} />
33 -</Frame>
34 -</Tab>
35 -</Tabs>
36 -
37 -Toolkits that support OAuth2 allow using your own developer app. This is the recommended approach for most cases.
38 -
39 -<Tip title="Use your own developer app!" icon="fa-light fa-exclamation">
40 -We recommend using your own developer app for the OAuth2 scheme as it is more suited for production usage with many users and more granular control over scopes.
41 -
42 -However, getting OAuth approvals takes time, so Composio provides a default developer app!
43 -
44 -</Tip>
45 -
46 -## OAuth2 Auth Configs
47 -
48 -<Steps>
49 -<Step title="Generate the OAuth Client ID and Client Secret">
50 -To set up a custom OAuth config, you'll need the OAuth Client ID and Client Secret.
51 -
52 -You can generate the client ID and client secret from your provider's OAuth configuration page.
53 -
54 -Examples for Google and GitHub:
55 -
56 -<Tabs>
57 - <Tab title="Google">
58 - <Frame background="subtle" caption="Google OAuth Configuration">
59 - <img src="../../../assets/images/google-oauth-config.png" style={{ maxHeight: '400px', width: 'auto', display: 'block', margin: '0 auto' }} />
60 - </Frame>
61 - </Tab>
62 - <Tab title="GitHub">
63 - <Frame background="subtle" caption="GitHub OAuth Configuration">
64 - <img src="../../../assets/images/github-oauth-config.png" style={{ maxHeight: '400px', width: 'auto', display: 'block', margin: '0 auto' }} />
65 - </Frame>
66 - </Tab>
67 -</Tabs>
68 -
69 -</Step>
70 -<Step title="Set the Authorized Redirect URI">
71 -When creating your OAuth app, make sure to configure the Authorized Redirect URI to point to the Composio callback URL below:
72 -
73 -```
74 -https://backend.composio.dev/api/v3/toolkits/auth/callback
75 -```
76 -
77 -</Step>
78 -<Step title="Create the auth config">
79 -Once you have the OAuth credentials, you can add them to the auth config in the dashboard.
80 -
81 -1. Select the OAuth2 scheme.
82 -2. Select the scopes to request from users. Default scopes are pre-filled for most apps.
83 -3. Add the OAuth client ID and client secret for your developer app. Keep the redirect URL as is for now!
84 -4. Click Create!
85 -
86 -<Frame background="subtle" title="Auth Config Settings">
87 - <img src="../../../assets/images/integration-step-3-0.png" style={{ maxHeight: '450px', width: 'auto', display: 'block', margin: '0 auto' }} />
88 -</Frame>
89 -
90 -
91 -</Step>
92 -</Steps>
93 -
94 -This auth config is now ready to be used in your application!
95 -
96 -<CodeGroup>
97 -```python Python maxLines=60
98 -# Create a new connected account
99 -connection_request = composio.connected_accounts.initiate(
100 - user_id="user_id",
101 - auth_config_id="ac_1234",
102 - callback_url="https://yourapp.com/oauth/callback"
103 -)
104 -
105 -# Redirect the user to connection_request.redirect_url
106 -print(connection_request.redirect_url)
107 -
108 -# Wait for the connection to be established
109 -connected_account = connection_request.wait_for_connection()
110 -print(connected_account)
111 -```
112 -```typescript TypeScript maxLines=60
113 -const connReq = await composio.connectedAccounts.initiate(userId, "ac_1234", {
114 - callbackUrl: "https://yourapp.com/oauth/callback",
115 -});
116 -
117 -// Redirect the user to connReq.redirectUrl
118 -console.log(connReq.redirectUrl);
119 -
120 -const connection = await composio.connectedAccounts.waitForConnection(
121 - connReq.id
122 -);
123 -
124 -console.log(connection);
125 -```
126 -
127 -</CodeGroup>
128 -
129 -
130 -### White-labeling the OAuth Consent Screen
131 -
132 -By default the users will see an OAuth screen like the one below:
133 -
134 -<Frame background="subtle" caption="Composio's Domain in OAuth Consent Screen">
135 - <img src="../../../assets/images/oauth-branding.png" style={{ maxHeight: '350px', width: 'auto', display: 'block', margin: '0 auto' }} />
136 -</Frame>
137 -
138 -The OAuth redirect URL is surfaced in some OAuth providers' consent screens. This may cause confusion for some users as that URL is not of the same domain as the application.
139 -
140 -To remediate this:
141 -
142 -<Steps>
143 -<Step title="Set the Authorized Redirect URI">
144 -Specify the Authorized Redirect URI to your own domain in the OAuth configuration.
145 -For example:
146 -```
147 -https://yourdomain.com/api/composio-redirect
148 -```
149 -
150 -</Step>
151 -<Step title="Create a redirect logic">
152 -Create a redirect logic, either through your DNS or in your application to redirect that endpoint to `https://backend.composio.dev/api/v3/toolkits/auth/callback`
153 -
154 -**Example: API Route for OAuth Redirect**
155 -
156 -<CodeGroup>
157 -```python FastAPI (app.py)
158 -from fastapi import FastAPI
159 -from fastapi.responses import RedirectResponse
160 -
161 -from composio import Composio
162 -
163 -# Create a FastAPI app
164 -app = FastAPI()
165 -
166 -# Create a Composio client
167 -composio = Composio()
168 -
169 -
170 -@app.get("/authorize/{toolkit}")
171 -def authorize_app(toolkit: str):
172 - # retrieve the user id from your app
173 - user_id = "<user_id>"
174 -
175 - # retrieve the auth config id from your app
176 - auth_config_id = "<auth_config_id>"
177 -
178 - # initiate the connection request
179 - connection_request = composio.connected_accounts.initiate(
180 - user_id=user_id,
181 - auth_config_id=auth_config_id,
182 - callback_url="https://yourapp.com/oauth/callback"
183 - )
184 - return RedirectResponse(url=connection_request.redirect_url)
185 -```
186 -
187 -```typescript Next.js (pages/api/composio-redirect.ts)
188 -import type { NextApiRequest, NextApiResponse } from 'next';
189 -
190 -export default function handler(req: NextApiRequest, res: NextApiResponse) {
191 - // The target Composio endpoint that handles OAuth callbacks
192 - const composioEndpoint = 'https://backend.composio.dev/api/v3/toolkits/auth/callback';
193 -
194 -// Extract and preserve all query parameters
195 -const queryParams = new URLSearchParams();
196 -Object.entries(req.query).forEach(([key, value]) => {
197 -if (typeof value === 'string') {
198 -queryParams.append(key, value);
199 -}
200 -});
201 -
202 -// Redirect to Composio with all query parameters intact
203 -const redirectUrl = `${composioEndpoint}?${queryParams.toString()}`;
204 -res.redirect(302, redirectUrl);
205 -}
206 -
207 -```
208 -
209 -</CodeGroup>
210 -</Step>
211 -<Step title="Create the auth config">
212 -Specify your custom redirect URI in the auth config settings!
213 -
214 -<Frame background="subtle" title="Auth Config Settings">
215 -<img src="../../../assets/images/custom-redirect-uri.png" style={{ maxHeight: '400px', width: 'auto', display: 'block', margin: '0 auto' }} />
216 -</Frame>
217 -</Step>
218 -</Steps>
219 -
220 -With this setup, you can use `https://yourdomain.com/api/composio-redirect` as your OAuth redirect URI, which will create a better user experience by keeping users on your domain during the OAuth flow.
221 -
222 -<Accordion title="How does this work?">
223 -
224 -The custom OAuth config allows you to use your own domain in the OAuth consent screen instead of Composio's domain. Here's the core difference:
225 -
226 -```mermaid
227 -flowchart TD
228 - A[Your App initiates OAuth] --> B[User redirected to OAuth Provider]
229 - B --> C{Redirect URI Configuration}
230 -
231 - C -->|Direct Setup| D[Provider redirects to<br/>backend.composio.dev]
232 - C -->|Custom Domain| E[Provider redirects to<br/>yourdomain.com/api/composio-redirect]
233 -
234 - E --> F[Your endpoint forwards to<br/>backend.composio.dev]
235 -
236 - D --> G[Composio exchanges code for token]
237 - F --> G
238 -
239 - G --> H[Connection established]
240 -
241 - style E fill:#e1f5fe
242 - style F fill:#e1f5fe
243 - style C fill:#fff3e0
244 -```
245 -
246 -**Key Benefits:**
247 -
248 -- **Custom Domain**: Users see your domain in OAuth consent screens, not Composio's
249 -- **Same Security**: Your domain just forwards the OAuth callback - no token handling
250 -- **Better UX**: Maintains brand consistency throughout the auth flow
251 -
252 -The custom redirect endpoint is a simple passthrough that preserves all OAuth parameters while keeping users on your domain.
253 -
254 -</Accordion>
fern/pages/src/authentication/custom-auth-params.mdx deleted
-124
@@ -1,124 +0,0 @@
1 ----
2 -title: Custom Auth Parameters
3 -image: "https://og.composio.dev/api/og?title=Custom%20Auth%20Parameters" # image for socials
4 -subtitle: "Inject custom credentials in headers or parameters"
5 -keywords: ""
6 -hide-nav-links: true
7 ----
8 -
9 -In cases where Composio is not being used for managing the auth but only for the tools, it is possible to use the `beforeExecute` hook to inject custom auth headers or parameters for a toolkit.
10 -
11 -## Setup and Initialization
12 -
13 -First, initialize the Composio SDK with your API key:
14 -
15 -<CodeGroup>
16 -```python Python maxLines=10
17 -from composio import Composio
18 -
19 -composio = Composio()
20 -```
21 -```typescript TypeScript maxLines=10
22 -import { Composio } from "@composio/core";
23 -
24 -const composio = new Composio({
25 - apiKey: process.env.COMPOSIO_API_KEY,
26 -});
27 -```
28 -</CodeGroup>
29 -
30 -## Creating the Auth Modifier Function
31 -
32 -Define a function that modifies authentication parameters for specific toolkits. This function checks the toolkit name and adds custom authentication headers when needed.
33 -
34 -<Card title="This is a Before Execute Modifier!" href="/docs/modifying-tool-inputs" icon="fa-light fa-magic">
35 -
36 -Before Execute Modifiers are a way to modify the parameters of a tool before it is executed. In this case, they are useful for adding custom authentication headers or parameters to a tool.
37 -</Card>
38 -
39 -<CodeGroup>
40 -```python Python maxLines=25
41 -from composio import before_execute
42 -from composio.types import ToolExecuteParams
43 -
44 -
45 -@before_execute(toolkits=["NOTION"])
46 -def add_custom_auth(
47 - tool: str,
48 - toolkit: str,
49 - params: ToolExecuteParams,
50 -) -> ToolExecuteParams:
51 - if params["custom_auth_params"] is None:
52 - params["custom_auth_params"] = {"parameters": []}
53 -
54 - params["custom_auth_params"]["parameters"].append(
55 - {
56 - "name": "x-api-key",
57 - "value": os.getenv("NOTION_API_KEY"),
58 - "in": "header",
59 - }
60 - )
61 - return params
62 -```
63 -```typescript TypeScript maxLines=25
64 -const authModifier = (toolSlug: string, toolkitSlug: string, params: any) => {
65 - // Add authentication parameters for specific toolkits
66 - if (toolkitSlug === "NOTION") {
67 - if (!params.customAuthParams) {
68 - params.customAuthParams = {};
69 - }
70 -
71 - if (!params.customAuthParams.parameters) {
72 - params.customAuthParams.parameters = [];
73 - }
74 -
75 - // Add an API key to the headers
76 - params.customAuthParams.parameters.push({
77 - in: "header",
78 - name: "X-API-Key",
79 - value: process.env.CUSTOM_API_KEY,
80 - });
81 - }
82 - return params;
83 -};
84 -```
85 -</CodeGroup>
86 -
87 -## Executing Tools with Custom Auth
88 -
89 -Execute the tool using the custom authentication modifier. The `beforeExecute` hook allows you to modify parameters before the tool runs.
90 -
91 -
92 -Following is an example of how to execute a tool with a custom authentication modifier for Completion Providers.
93 -
94 -For Agentic Providers, read about [Modifying tool inputs](/docs/modifying-tool-inputs).
95 -
96 -<CodeGroup>
97 -```python Python maxLines=20
98 -result = composio.tools.execute(
99 - slug="NOTION_GET_DATABASE_ITEMS",
100 - user_id="default",
101 - arguments={},
102 - modifiers=[
103 - add_custom_auth,
104 - ],
105 -)
106 -print(result)
107 -```
108 -```typescript TypeScript maxLines=20
109 -const result = await composio.tools.execute(
110 - "NOTION_GET_DATABASE_ITEMS",
111 - {
112 - userId: "sid",
113 - arguments: {
114 - database_id: "1234567890",
115 - },
116 - },
117 - {
118 - beforeExecute: authModifier,
119 - }
120 -);
121 -
122 -console.log(JSON.stringify(result, null, 2));
123 -```
124 -</CodeGroup>
\ No newline at end of file
fern/pages/src/authentication/programmatic-auth-configs.mdx deleted
-196
@@ -1,196 +0,0 @@
1 ----
2 -title: Programmatic Auth Configs
3 -image: "https://og.composio.dev/api/og?title=Programmatic%20Auth%20Configs" # image for socials
4 -subtitle: "Create auth configs programmatically"
5 -keywords: ""
6 -hide-nav-links: true
7 ----
8 -
9 -Auth configs are created once and reused many times. However, when managing multiple toolkits, you may want to create auth configs programmatically.
10 -
11 -- When creating and destroying auth configs multiple times in your app's lifecycle.
12 -- When creating auth configs for your users' users.
13 -
14 -## OAuth2 based apps
15 -
16 -### Using Composio Default Auth
17 -Since OAuth2 is the most common authentication type for applications, Composio provides managed auth for most OAuth2 based applications.
18 -This is to speed up development and prototyping.
19 -This means you don't have to provide your own OAuth credentials.
20 -
21 -<CodeGroup>
22 -```python Python maxLines=60 wordWrap
23 -from composio import Composio
24 -
25 -composio = Composio()
26 -
27 -# Use composio managed auth
28 -auth_config = composio.auth_configs.create(
29 - toolkit="github",
30 - options={
31 - "type": "use_composio_managed_auth",
32 - },
33 -)
34 -print(auth_config)
35 -```
36 -
37 -```typescript TypeScript maxLines=60 wordWrap {7}
38 -import { Composio } from "@composio/core";
39 -
40 -const composio = new Composio();
41 -
42 -const authConfig = await composio.authConfigs.create("GITHUB", {
43 - name: "GitHub",
44 - type: "use_composio_managed_auth",
45 -});
46 -
47 -console.log(authConfig);
48 -```
49 -</CodeGroup>
50 -
51 -The returned `auth_config_id` should be stored securely in your database for future use to be created and destroyed multiple times.
52 -
53 -You can also provide your own authentication details. The required `credentials` and `authScheme` depend on the auth type.
54 -
55 -### Using your own OAuth2 credentials
56 -Setting up and using your own OAuth2 credentials is the recommended way when going to production or expecting high usage.
57 -
58 -In this example, we're using our own OAuth2 client ID and secret to create the auth config for Notion.
59 -
60 -<CodeGroup>
61 -```python Python maxLines=60 wordWrap {7}
62 -# Use custom auth
63 -auth_config = composio.auth_configs.create(
64 - toolkit="notion",
65 - options={
66 - "name": "Notion Auth",
67 - "type": "use_custom_auth",
68 - "auth_scheme": "OAUTH2",
69 - "credentials": {
70 - "client_id": "1234567890",
71 - "client_secret": "1234567890",
72 - "oauth_redirect_uri": "https://backend.composio.dev/api/v3/toolkits/auth/callback",
73 - },
74 - },
75 -)
76 -print(auth_config)
77 -```
78 -```typescript TypeScript maxLines=60 wordWrap {3}
79 -const authConfig = await composio.authConfigs.create("NOTION", {
80 - name: "Notion",
81 - type: "use_custom_auth",
82 - credentials: {
83 - client_id: "1234567890",
84 - client_secret: "1234567890",
85 - oauth_redirect_uri: "https://backend.composio.dev/api/v3/toolkits/auth/callback",
86 - },
87 - authScheme: "OAUTH2",
88 -});
89 -
90 -console.log(authConfig);
91 -```
92 -</CodeGroup>
93 -
94 -<Note>
95 -You can specify a custom redirect URI by including the `oauth_redirect_uri` parameter in the credentials object. If not provided, Composio uses the default redirect URI.
96 -</Note>
97 -
98 -**Specifying the authorized redirect URI**
99 -The process of setting up your own OAuth2 credentials usually involves generating a client ID and secret and specifying the **authorized redirect URI** in the OAuth configuration.
100 -
101 -<Tip>
102 -The **authorized redirect URI** is the URI that captures the OAuth code that is returned to the app.
103 -</Tip>
104 -
105 -While doing so, you must ensure to set the **authorized redirect URI** in the OAuth configuration to:
106 -
107 -```
108 -https://backend.composio.dev/api/v3/toolkits/auth/callback
109 -```
110 -<Tabs>
111 -<Tab title="Redirect URI for GitHub">
112 -<Frame>
113 -<img src="../../../assets/images/github-callback.png" alt="Developer settings for GitHub OAuth2 app"/>
114 -</Frame>
115 -</Tab>
116 -<Tab title="Redirect URI for Google">
117 -<Frame>
118 -<img src="../../../assets/images/google-callback.png" alt="Developer settings for Google OAuth2 app"/>
119 -</Frame>
120 -</Tab>
121 -</Tabs>
122 -
123 -### Specifying scopes
124 -Composio requests a set of appropriate default OAuth2 scopes for each toolkit wherever possible. However, you can override or modify these scopes by passing a `scopes` field to the `credentials` object.
125 -
126 -<CodeGroup>
127 -<SnippetCode
128 - src="fern/snippets/authentication/python/define-scopes.py"
129 - title="Python"
130 - startLine={1}
131 - endLine={17}
132 - highlightStart={11}
133 - highlightEnd={13}
134 -/>
135 -
136 -<SnippetCode
137 - src="fern/snippets/authentication/typescript/define-scopes.ts"
138 - title="TypeScript"
139 - startLine={1}
140 - endLine={17}
141 - highlightStart={8}
142 - highlightEnd={10}
143 -/>
144 -</CodeGroup>
145 -
146 -
147 -## Other auth types
148 -Composio supports many applications that use different authentication types like API keys, Bearer tokens, JWT and even no authentication at all.
149 -
150 -Generating the auth config for other auth types only has minor differences.
151 -- `use_custom_auth` is used instead of `use_composio_managed_auth`
152 -- The `credentials` field is used to pass the authentication details
153 -- The `authScheme` field is used to specify the auth type
154 -
155 -<CodeGroup>
156 -<SnippetCode
157 - src="fern/snippets/authentication/python/auth-config.py"
158 - title="Python"
159 - startLine={5}
160 - endLine={17}
161 -/>
162 -<SnippetCode
163 - src="fern/snippets/authentication/typescript/auth-config.ts"
164 - title="TypeScript"
165 - startLine={5}
166 - endLine={17}
167 -/>
168 -</CodeGroup>
169 -
170 -## Programmatically inspecting fields
171 -In cases where you need to dynamically discover the exact field names and handle different auth schemes programmatically, you can inspect the auth config details first.
172 -
173 -This works for all auth types.
174 -
175 -<CodeGroup>
176 -```python Python maxLines=60 wordWrap
177 -required_fields = composio.toolkits.get_auth_config_creation_fields(
178 - toolkit="NOTION",
179 - auth_scheme="OAUTH2",
180 - required_only=True,
181 -)
182 -print(required_fields)
183 -```
184 -```typescript TypeScript maxLines=60
185 -const toolkits = await composio.toolkits.get("NOTION");
186 -
187 -// Extract field names from authConfigDetails
188 -const authFields = await composio.toolkits.getAuthConfigCreationFields('NOTION', 'OAUTH2', {
189 - requiredOnly: true,
190 -});
191 -
192 -console.log("Required auth config fields:", authFields);
193 -```
194 -</CodeGroup>
195 -
196 -and then inspect the required fields and specify them in the `credentials` object.
\ No newline at end of file
fern/pages/src/authentication/user-management.mdx deleted
-316
@@ -1,316 +0,0 @@
1 ----
2 -title: "User Management"
3 -image: "https://og.composio.dev/api/og?title=User%20Management" # image for socials
4 -keywords: "user management, user Id, user context, external user ID"
5 -subtitle: "Manage users and their connected accounts"
6 -hide-nav-links: false
7 ----
8 -
9 -## What are User IDs?
10 -User IDs determine whose connected accounts and data you're accessing in Composio. Every tool execution, connection authorization, and account operation
11 -requires a `userId` parameter that identifies which context to use.
12 -
13 -User IDs act as containers that group connected accounts together across toolkits. Depending on your application, you can use User IDs to represent an
14 -individual user, a team, or an entire organization.
15 -
16 -## Quick Decision Guide
17 -
18 -**How do users access connected accounts in your app?**
19 -
20 -- **Each user connects their own personal accounts?**
21 -Use User IDs
22 -*Use your database UUID or primary key (e.g., `user.id`)*
23 -*Example: Users connect their personal Gmail, GitHub*
24 -
25 -- **Teams share the same connected accounts?**
26 -Use Organization IDs
27 -*Use your organization UUID or primary key (e.g., `organization.id`)*
28 -*Example: Company Slack workspace*
29 -
30 -## Patterns
31 -
32 -### User IDs (Individual Accounts)
33 -
34 -In production applications with multiple users, where each user connects and manages their own accounts.
35 -
36 -**Choosing User IDs:**
37 -
38 -- Recommended: Database UUID or primary key (`user.id`)
39 -- Acceptable: Unique username (`user.username`)
40 -- Avoid: Email addresses (emails can change)
41 -
42 -<CodeGroup>
43 -```typescript Typescript
44 -// Use your database's user ID (UUID, primary key, etc.)
45 -const userId = user.id; // e.g., "550e8400-e29b-41d4-a716-446655440000"
46 -
47 -const tools = await composio.tools.get(userId, {
48 - toolkits: ['github'],
49 -});
50 -
51 -const result = await composio.tools.execute('GITHUB_GET_REPO', {
52 - userId: userId,
53 - arguments: { owner: 'example', repo: 'repo' },
54 -});
55 -```
56 -
57 -```python Python
58 -# Use your database's user ID (UUID, primary key, etc.)
59 -user_id = user.id; # e.g., "550e8400-e29b-41d4-a716-446655440000"
60 -
61 -tools = composio.tools.get(
62 - user_id=user_id,
63 - toolkits=["GITHUB"],
64 -)
65 -
66 -result = composio.tools.execute(
67 - "GITHUB_GET_REPO",
68 - user_id=user_id,
69 - arguments={
70 - "owner": 'example',
71 - "repo": 'repo'
72 - }
73 -)
74 -```
75 -
76 -</CodeGroup>
77 -<Warning>
78 -Never use 'default' as an User ID in production with users. This could expose other users' data
79 -</Warning>
80 -
81 -### Organization IDs (Team Accounts)
82 -
83 -For applications where teams share connections - one admin connects accounts, all team members use them.
84 -
85 -**When to use:**
86 -- Team tools: Slack, Microsoft Teams, Jira
87 -- Shared accounts: support(at)company.com, company GitHub org
88 -- Enterprise apps: IT manages connections for all employees
89 -
90 -<CodeGroup>
91 -```typescript TypeScript
92 -// Use the organization ID as userId
93 -const userId = organization.id; // e.g., "org_550e8400"
94 -
95 -// All users in the organization share the same connected accounts
96 -const tools = await composio.tools.get(userId, {
97 - toolkits: ['slack'],
98 -});
99 -
100 -// Execute tools in the organization context
101 -const result = await composio.tools.execute('SLACK_SEND_MESSAGE', {
102 - userId: userId,
103 - arguments: {
104 - channel: '#general',
105 - text: 'Hello from the team!',
106 - },
107 -});
108 -```
109 -```python Python
110 -# Use the organization ID as userId
111 -user_id = organization.id # e.g., "org_550e8400"
112 -
113 -# All users in the organization share the same connected accounts
114 -tools = composio.tools.get(
115 - user_id=user_id,
116 - toolkits=["SLACK"],
117 -)
118 -
119 -# Execute tools in the organization context
120 -result = composio.tools.execute(
121 - "SLACK_SEND_MESSAGE",
122 - user_id=user_id,
123 - arguments={
124 - "channel": '#general',
125 - "text": 'Hello from the team!'
126 - }
127 -)
128 -```
129 -</CodeGroup>
130 -
131 -## Multiple Connected Accounts
132 -
133 -A single User ID can have multiple connected accounts for the same toolkit. For example, a user might connect both their personal and work Gmail accounts.
134 -
135 -**Key concepts:**
136 -- Each connected account gets a unique Connected Account ID
137 -- Multiple accounts can exist under the same User ID for any toolkit
138 -- You can specify which account to use when executing tools
139 -
140 -**Account selection:**
141 -- **Explicit:** Specify the Connected Account ID to target a specific account
142 -- **Default:** If no Connected Account ID is provided, the most recently connected account is used
143 -
144 -## Examples
145 -### Organization-Based Application
146 -
147 -In B2B applications, typically an admin connects accounts once and all team members share access. Here's a complete implementation:
148 -
149 -**Key concepts:**
150 -- Admin performs the OAuth connection using organization ID
151 -- All team members execute tools using the same organization ID
152 -- Permission checks ensure users can only access their organization's connections
153 -```typescript TypeScript
154 -import { Composio } from '@composio/core';
155 -const composio = new Composio({
156 - apiKey: process.env.COMPOSIO_API_KEY,
157 -});
158 -
159 -// 1. Admin connects Slack for the entire organization
160 -async function connectOrganizationToSlack(organizationId: string, adminUserId: string) {
161 - // Use organization ID as userId in Composio
162 - const connectionRequest = await composio.toolkits.authorize(organizationId, 'slack');
163 -
164 - // Store the connection request for the admin to complete
165 - await storeConnectionRequest(organizationId, adminUserId, connectionRequest);
166 -
167 - return connectionRequest.redirectUrl;
168 -}
169 -
170 -// 2. Any user in the organization can use the connected tools
171 -async function sendSlackMessage(organizationId: string, channel: string, message: string) {
172 - return await composio.tools.execute('SLACK_SEND_MESSAGE', {
173 - userId: organizationId, // organization ID, not individual user ID
174 - arguments: {
175 - channel: channel,
176 - text: message,
177 - },
178 - });
179 -}
180 -
181 -// 3. Check if organization has required connections
182 -async function getOrganizationTools(organizationId: string) {
183 - return await composio.tools.get(organizationId, {
184 - toolkits: ['slack', 'github', 'jira'],
185 - });
186 -}
187 -
188 -// Usage in your API endpoint
189 -app.post('/api/slack/message', async (req, res) => {
190 - const { channel, message } = req.body;
191 - const organizationId = req.user.organizationId; // Get from your auth system
192 -
193 - // Verify user has permission to send messages for this organization
194 - // The userCanSendMessages function is your responsibility - implement it based on your application's permission model (role-based, feature flags, etc.).
195 - if (!(await userCanSendMessages(req.user.id, organizationId))) {
196 - return res.status(403).json({ error: 'Insufficient permissions' });
197 - }
198 -
199 - try {
200 - const result = await sendSlackMessage(organizationId, channel, message);
201 - res.json(result.data);
202 - } catch (error) {
203 - res.status(500).json({ error: 'Failed to send message' });
204 - }
205 -});
206 -```
207 -
208 -
209 -### Multi-User Application
210 -
211 -In B2C applications, each user connects and manages their own accounts. Every user goes through their own OAuth flow and their data remains completely isolated.
212 -
213 -**Key concepts:**
214 -- Each user authorizes their own accounts using their unique user ID
215 -- Connections are isolated - users can only access their own connected accounts
216 -- No permission checks needed since users only access their own data
217 -
218 -```typescript TypeScript
219 -import { Composio } from '@composio/core';
220 -const composio = new Composio({
221 - apiKey: process.env.COMPOSIO_API_KEY,
222 -});
223 -
224 -// 1. User initiates GitHub connection
225 -async function connectUserToGitHub(userId: string) {
226 - const connectionRequest = await composio.toolkits.authorize(userId, 'github');
227 - return connectionRequest.redirectUrl;
228 -}
229 -
230 -// 2. Get user's connected GitHub tools
231 -async function getUserGitHubTools(userId: string) {
232 - return await composio.tools.get(userId, {
233 - toolkits: ['github'],
234 - });
235 -}
236 -
237 -// 3. Execute tool for specific user
238 -async function getUserRepos(userId: string) {
239 - return await composio.tools.execute('GITHUB_LIST_REPOS', {
240 - userId: userId,
241 - arguments: {
242 - per_page: 10,
243 - },
244 - });
245 -}
246 -
247 -// Usage in your API endpoint
248 -app.get('/api/github/repos', async (req, res) => {
249 - const userId = req.user.id; // Get from your auth system
250 -
251 - try {
252 - const repos = await getUserRepos(userId);
253 - res.json(repos.data);
254 - } catch (error) {
255 - res.status(500).json({ error: 'Failed to fetch repos' });
256 - }
257 -});
258 -```
259 -
260 -**Data isolation**: Composio ensures each userId's connections and data are completely separate. User A can never access User B's repositories.
261 -
262 -### Hybrid Pattern
263 -
264 -Many applications need both personal and team resources. Users might connect their personal Gmail while sharing the company Slack workspace.
265 -
266 -**Common scenarios:**
267 -- Personal calendars + shared project management
268 -- Individual GitHub accounts + organization repositories
269 -
270 -<CodeGroup>
271 -```typescript TypeScript
272 -// ❌ Wrong: Using individual user ID for org-connected tool
273 -const userTools = await composio.tools.get(req.user.id, {
274 - toolkits: ['slack'], // Fails - Slack is connected at org level
275 -});
276 -
277 -// ✅ Correct: Match the ID type to how the tool was connected
278 -const userPersonalTools = await composio.tools.get(req.user.id, {
279 - toolkits: ['gmail'], // User's personal Gmail
280 -});
281 -
282 -const orgSharedTools = await composio.tools.get(req.user.organizationId, {
283 - toolkits: ['slack', 'jira'], // Organization's shared tools
284 -});
285 -```
286 -```python Python
287 -# ❌ Wrong: Using individual user ID for org-connected tool
288 -user_tools = composio.tools.get(
289 - user_id="user_123", # Individual user ID
290 - toolkits=["slack"] # Fails - Slack is connected at org level
291 -)
292 -
293 -# ✅ Correct: Match the ID type to how the tool was connected
294 -user_personal_tools = composio.tools.get(
295 - user_id="user_123", # Individual user ID
296 - toolkits=["gmail"] # User's personal Gmail
297 -)
298 -
299 -org_shared_tools = composio.tools.get(
300 - user_id="org_123", # Organization ID
301 - toolkits=["slack", "jira"] # Organization's shared tools
302 -)
303 -```
304 -</CodeGroup>
305 -Remember: The userId must match how the account was connected. If admin connected Slack with org ID, all members must use org ID to access it.
306 -
307 -## Best Practices
308 -
309 -**Your responsibilities:**
310 -- Pass the correct User ID for each user
311 -- Verify user permissions before executing organization tools
312 -- Never use 'default' in production with multiple users
313 -- Keep User IDs consistent across your application and Composio
314 -- Use stable identifiers that won't change over time
315 -
316 -**Data isolation:** Composio ensures complete isolation between User IDs. Users cannot access another ID's connections or data.
\ No newline at end of file
fern/pages/src/capabilities/managed-authentication.mdx deleted
-39
@@ -1,39 +0,0 @@
1 ----
2 -title: Managed Authentication
3 -image: "https://og.composio.dev/api/og?title=Managed%20Authentication&description=Enterprise-grade%20authentication%20for%20AI%20agents"
4 -subtitle: "Auth management for your AI agents"
5 -description: "Let your AI agents authenticate with 500+ apps on behalf of users. OAuth, API keys, user isolation, and white-labeling built in."
6 -keywords: "managed authentication, ai agent auth, oauth, api keys, user isolation, white-labeling, connected accounts"
7 -hide-nav-links: false
8 ----
9 -
10 -Composio handles OAuth flows, API keys, token refresh, and credential storage for 500+ apps.
11 -
12 -## Quick links
13 -
14 -<CardGroup cols={3}>
15 - <Card
16 - title="Authenticating tools"
17 - icon="fa-light fa-key"
18 - href="/docs/authenticating-tools"
19 - >
20 - Create auth configs and connect user accounts via Connect Link or direct SDK integration
21 - </Card>
22 -
23 - <Card
24 - title="White-labeling"
25 - icon="fa-light fa-palette"
26 - href="/docs/custom-auth-configs"
27 - >
28 - Use your own OAuth apps and remove Composio branding from auth screens
29 - </Card>
30 -
31 - <Card
32 - title="Connected Accounts API"
33 - icon="fa-light fa-plug"
34 - href="/api-reference/connected-accounts"
35 - >
36 - Manage user connections programmatically
37 - </Card>
38 -
39 -</CardGroup>
fern/pages/src/capabilities/mcp.mdx deleted
-45
@@ -1,45 +0,0 @@
1 ----
2 -title: MCP (Model Context Protocol)
3 -image: "https://og.composio.dev/api/og?title=MCP&description=Universal%20tool%20protocol%20for%20any%20AI%20client"
4 -subtitle: "Universal tool protocol for any AI client"
5 -description: "Connect 500+ tools to Claude Desktop, Continue.dev, and any MCP-compatible client. Framework-agnostic integration with zero code changes."
6 -keywords: "mcp, model context protocol, claude desktop, continue dev, ai tools, framework agnostic, tool server"
7 -hide-nav-links: false
8 ----
9 -
10 -Connect Composio tools to Claude Desktop, Cursor, Windsurf, and any MCP-compatible client. Configure once, use everywhere.
11 -
12 -<CardGroup cols={2}>
13 - <Card
14 - title="MCP quickstart"
15 - icon="fa-light fa-rocket"
16 - href="/mcp/quickstart"
17 - >
18 - Set up MCP with Claude Desktop or other clients
19 - </Card>
20 -
21 - <Card
22 - title="Server management"
23 - icon="fa-light fa-server"
24 - href="/mcp/server-management"
25 - >
26 - Configure toolkits, authentication, and permissions
27 - </Card>
28 -
29 - <Card
30 - title="MCP providers"
31 - icon="fa-light fa-plug"
32 - href="/mcp/providers"
33 - >
34 - Integration guides for Claude Desktop, Cursor, Windsurf
35 - </Card>
36 -
37 - <Card
38 - title="Tool Router"
39 - icon="fa-light fa-route"
40 - href="/tool-router/overview"
41 - >
42 - Single MCP server and Tool that can search, authenticate, and execute across all Composio tools
43 - </Card>
44 -</CardGroup>
45 -
fern/pages/src/capabilities/tools.mdx deleted
-45
@@ -1,45 +0,0 @@
1 ----
2 -title: Tools
3 -image: "https://og.composio.dev/api/og?title=Tools&description=500%2B%20authenticated%20actions%20for%20AI%20agents"
4 -subtitle: "500+ authenticated actions for AI agents"
5 -description: "Give your AI agents the ability to execute real-world actions across 500+ integrations. From GitHub commits to Slack messages—all with user authentication built in."
6 -keywords: "ai tools, agent tools, authenticated actions, tool calling, github actions, slack integration, gmail api"
7 -hide-nav-links: false
8 ----
9 -
10 -Pre-built tools for GitHub, Slack, Gmail, and 500+ other services. Each tool handles authentication, error handling, and returns structured JSON responses.
11 -
12 -<CardGroup cols={2}>
13 - <Card
14 - title="Fetching tools"
15 - icon="fa-light fa-download"
16 - href="/docs/fetching-tools"
17 - >
18 - Retrieve and filter tools by toolkit, tags, or specific tool names
19 - </Card>
20 -
21 - <Card
22 - title="Executing tools"
23 - icon="fa-light fa-play"
24 - href="/docs/executing-tools"
25 - >
26 - Execute tools and handle responses in your application
27 - </Card>
28 -
29 - <Card
30 - title="Custom tools"
31 - icon="fa-light fa-hammer"
32 - href="/docs/custom-tools"
33 - >
34 - Build your own tools for proprietary systems and APIs
35 - </Card>
36 -
37 - <Card
38 - title="Tool Router"
39 - icon="fa-light fa-route"
40 - href="/tool-router/overview"
41 - >
42 - Single MCP server and Tool that can search, authenticate, and execute across all Composio tools
43 - </Card>
44 -</CardGroup>
45 -
fern/pages/src/capabilities/triggers.mdx deleted
-29
@@ -1,29 +0,0 @@
1 ----
2 -title: Triggers
3 -image: "https://og.composio.dev/api/og?title=Triggers&description=Real-time%20events%20from%20500%2B%20integrations"
4 -subtitle: "Real-time events from 500+ integrations"
5 -description: "React to events as they happen across your connected services. From GitHub commits to Slack messages—build event-driven AI workflows with zero webhook infrastructure."
6 -keywords: "webhooks, triggers, real-time events, event-driven, github webhooks, slack events, automation"
7 -hide-nav-links: false
8 ----
9 -
10 -Subscribe to real-time events from GitHub, Slack, Gmail, and other services. Composio handles webhook configuration, retries, and delivery.
11 -
12 -<CardGroup cols={2}>
13 - <Card
14 - title="Using triggers"
15 - icon="fa-light fa-bolt"
16 - href="/docs/using-triggers"
17 - >
18 - Subscribe to events and handle them in your application
19 - </Card>
20 -
21 - <Card
22 - title="Slack summarizer example"
23 - icon="fa-light fa-diagram-project"
24 - href="/examples/slack-summariser"
25 - >
26 - Event-driven workflow example
27 - </Card>
28 -</CardGroup>
29 -
fern/pages/src/changelog/01-07-26.md deleted
-171
@@ -1,171 +0,0 @@
1 -# Consistent Error Response Structure
2 -
3 -Tool execution errors now return a standardized response format across all failure types. Previously, the `data` field was empty on errors—now it always includes `status_code` and `message`, matching the structure of successful responses.
4 -
5 -## What Changed
6 -
7 -All error responses from tool execution now include:
8 -- `data.status_code`: HTTP status code (or `null` for non-HTTP errors)
9 -- `data.message`: Detailed error message
10 -- `error`: Same detailed message at the top level
11 -
12 -## Before vs After
13 -
14 -**Previous error response:**
15 -```json
16 -{
17 - "data": {},
18 - "successfull": false,
19 - "error": "404 Client Error: Not Found for url: ...",
20 -}
21 -```
22 -
23 -**New error response:**
24 -```json
25 -{
26 - "data": {
27 - "http_error": "404 Client Error: Not Found for url: ...",
28 - "status_code": 404,
29 - "message": "Resource not found: The requested item does not exist"
30 - },
31 - "successfull": false,
32 - "error": "Resource not found: The requested item does not exist",
33 -}
34 -```
35 -
36 -## Why This Matters
37 -
38 -- **Easier parsing**: Agents and code can reliably access error details from `data.message` without special-casing empty `data` objects
39 -- **Better debugging**: Detailed error messages replace generic HTTP error strings
40 -- **Consistent schema**: Same response shape whether the tool succeeds or fails
41 -
42 ----
43 -
44 -# Union Types Preserved in Tool Schemas
45 -
46 -Tool schemas now use standard JSON Schema `anyOf` for union types, providing accurate type information for LLMs and code generators.
47 -
48 -## What Changed
49 -
50 -Two changes affect how types appear in request/response schemas:
51 -
52 -| Change | Scope | Description |
53 -|--------|-------|-------------|
54 -| **Nullable fields** | **All toolkits** | Fields that accept `null` now use `anyOf: [{type}, {type: "null"}]` instead of `type` + `nullable: true` |
55 -| **Multi-type fields** | 157 toolkits | Fields accepting multiple value types (e.g., `string \| number`) preserve the full `anyOf` array instead of flattening to the first type |
56 -
57 -<Accordion title="Toolkits with multi-type union fields (157 total)">
58 -
59 -### CRM & Sales
60 -active_campaign, apollo, attio, autobound, capsule_crm, firmao, forcemanager, gong, hubspot, instantly, intercom, kommo, leadfeeder, lever, magnetic, pipedrive, pipeline_crm, salesforce, salesforce_service_cloud, zoominfo
61 -
62 -### Marketing & Email
63 -active_trail, beamer, delighted, dripcel, enginemailer, mailerlite, moosend, mopinion, sendspark, toneden
64 -
65 -### Communication & Collaboration
66 -chmeetings, discord, helpdesk, helpwise, missive, slack, textit
67 -
68 -### Productivity & Project Management
69 -basecamp, clicksend, clientary, dart, fibery, monday, notion, onedesk, productboard, rocketlane, todoist
70 -
71 -### Developer Tools & APIs
72 -algolia, anonyflow, api_ninjas, api_sports, apify, appdrag, backendless, browserless, bubble, cloudconvert, cloudinary, cloudlayer, convertapi, databricks, datadog, datarobot, deepseek, deployhq, digital_ocean, docmosis, docugenerate, encodian, gitea, gitlab, globalping, groqcloud, hookdeck, hyperbrowser, imgbb, imgix, kibana, neutrino, npm, openai, openrouter, parsera, parseur, phantombuster, pinecone, prismic, procfu, replicate, scrape_do, serpapi, shotstack, snowflake, supabase, tavily, v0, vercel, writer, zenrows
73 -
74 -### E-commerce & Payments
75 -brex, btcpay_server, coupa, flutterwave, gift_up, lemon_squeezy, quaderno, ramp, shopify, stripe, zoho_invoice
76 -
77 -### HR & Recruiting
78 -ashby, bamboohr, recruitee
79 -
80 -### Data & Analytics
81 -amplitude, census_bureau, college_football_data, currencyscoop, diffbot, ip2location, mixpanel, nasa, rosette_text_analytics, securitytrails, textrazor, twelve_data
82 -
83 -### Documents & Files
84 -carbone, doc_certs, documenso, dropbox, excel, files_com, grist, pdf_co, share_point
85 -
86 -### Design & Media
87 -canva, canvas, claid_ai, deepimage, heygen, metatextai
88 -
89 -### Customer Support
90 -freshdesk, retently, servicem8, sevdesk, storeganise
91 -
92 -### Calendar & Scheduling
93 -calendly, deadline_funnel, etermin, googlecalendar
94 -
95 -### Social Media
96 -facebook, instagram, reddit
97 -
98 -### Location & Maps
99 -addresszen, geoapify, google_maps, mapbox
100 -
101 -### Email Verification & Validation
102 -clearout, icypeas, neverbounce, zerobounce
103 -
104 -### Other Integrations
105 -bitwarden, canny, cardly, castingwords, confluence, formdesk, getform, habitica, headout, highergov, jira, keen_io, landbot, moonclerk, one_drive, outlook, googlesheets, resend, ritekit, sms_alert, tapfiliate, thanks_io, uptimerobot
106 -
107 -</Accordion>
108 -
109 -## Before vs After
110 -For example, the `GOOGLECALENDAR_GET_CURRENT_DATE_TIME` request schema changes:
111 -**Previous (only a single type):**
112 -```json
113 -{
114 - "timezone": {
115 - "default": 0,
116 - "description": "Timezone specification...",
117 - "title": "Timezone",
118 - "type": "string"
119 - }
120 -}
121 -```
122 -
123 -**Now (Union types preserved):**
124 -```json
125 -{
126 - "timezone": {
127 - "anyOf": [
128 - { "type": "string" },
129 - { "type": "number" }
130 - ],
131 - "default": 0,
132 - "description": "Timezone specification...",
133 - "title": "Timezone"
134 - }
135 -}
136 -```
137 -
138 -Similarly, nullable fields like `page_token` in `GOOGLECALENDAR_LIST_CALENDARS`:
139 -
140 -**Previous:**
141 -```json
142 -{
143 - "page_token": {
144 - "default": null,
145 - "description": "Token for the page of results to return...",
146 - "nullable": true,
147 - "title": "Page Token",
148 - "type": "string"
149 - }
150 -}
151 -```
152 -
153 -**Now:**
154 -```json
155 -{
156 - "page_token": {
157 - "anyOf": [
158 - { "type": "string" },
159 - { "type": "null" }
160 - ],
161 - "default": null,
162 - "description": "Token for the page of results to return...",
163 - "title": "Page Token"
164 - }
165 -}
166 -```
167 -
168 -## Why This Matters
169 -
170 -- **Accurate schemas**: LLMs and code generators see the full set of allowed types
171 -- **Better validation**: Input validation can now correctly accept all valid types, not just the first one
\ No newline at end of file
fern/pages/src/changelog/01-08-26-mcp-api-key-enforcement.md deleted
-144
@@ -1,144 +0,0 @@
1 -# Optional API Key Enforcement for MCP Servers
2 -
3 -We've introduced a new project-level security setting that allows you to require API key authentication for all MCP server requests. This opt-in feature gives you fine-grained control over who can access your MCP endpoints.
4 -
5 -<Note>
6 -**Opt-in today, default soon**: This feature is currently opt-in. Starting **March 1, 2026**, it will be enabled by default for new organizations. We recommend enabling it now to prepare your integrations.
7 -</Note>
8 -
9 -## What's New
10 -
11 -A new **"Require API Key for MCP"** toggle is now available in your Project Settings. When enabled, all requests to your MCP servers must include a valid Composio API key in the request headers.
12 -
13 -| Setting | Default | Impact |
14 -|---------|---------|--------|
15 -| `require_mcp_api_key` | `false` | Opt-in; no changes to existing behavior |
16 -
17 -## How It Works
18 -
19 -When the setting is **disabled** (default):
20 -- MCP servers work without API key authentication
21 -- Existing integrations continue to function unchanged
22 -
23 -When the setting is **enabled**:
24 -- All MCP requests must include the `x-api-key` header with a valid Composio API key
25 -- Requests without a valid API key receive `401 Unauthorized`
26 -- Only API keys belonging to the same project are accepted
27 -
28 -### Request Examples
29 -
30 -**Without API key (when enforcement is enabled):**
31 -```bash
32 -curl -X POST "https://mcp.composio.dev/{your_mcp_server_url}" \
33 - -H "Content-Type: application/json" \
34 - -d '{"jsonrpc":"2.0","id":1,"method":"initialize"}'
35 -
36 -# Response: 401 Unauthorized
37 -```
38 -
39 -**With API key:**
40 -```bash
41 -curl -X POST "https://mcp.composio.dev/{your_mcp_server_url}" \
42 - -H "Content-Type: application/json" \
43 - -H "x-api-key: ak_your_api_key" \
44 - -d '{"jsonrpc":"2.0","id":1,"method":"initialize"}'
45 -
46 -# Response: 200 OK
47 -```
48 -
49 -## Enabling the Setting
50 -
51 -### Via Dashboard
52 -
53 -1. Navigate to [Project Settings](https://platform.composio.dev/{workspace}/{project}/settings)
54 -2. Go to the **Project Configuration** tab
55 -3. Find the **"Require API Key for MCP"** toggle
56 -4. Enable the toggle
57 -
58 -<Frame>
59 - <img src="/assets/images/mcp-api-key-toggle.png" alt="MCP API Key Toggle in Project Settings" />
60 -</Frame>
61 -
62 -### Via API
63 -
64 -Update your project configuration using the API:
65 -
66 -```bash
67 -curl -X PATCH "https://backend.composio.dev/api/v3/org/project/config" \
68 - -H "Content-Type: application/json" \
69 - -H "x-api-key: ak_your_api_key" \
70 - -d '{"require_mcp_api_key": true}'
71 -```
72 -
73 -**Response:**
74 -```json
75 -{
76 - "require_mcp_api_key": true,
77 - "is_2FA_enabled": true,
78 - "mask_secret_keys_in_connected_account": true,
79 - "log_visibility_setting": "show_all"
80 -}
81 -```
82 -
83 -### Via Code
84 -
85 -<CodeGroup>
86 -```python title="Python"
87 -import requests
88 -
89 -response = requests.patch(
90 - "https://backend.composio.dev/api/v3/org/project/config",
91 - headers={
92 - "Content-Type": "application/json",
93 - "x-api-key": "ak_your_api_key"
94 - },
95 - json={"require_mcp_api_key": True}
96 -)
97 -
98 -print(response.json())
99 -```
100 -```typescript title="TypeScript"
101 -const response = await fetch(
102 - "https://backend.composio.dev/api/v3/org/project/config",
103 - {
104 - method: "PATCH",
105 - headers: {
106 - "Content-Type": "application/json",
107 - "x-api-key": "ak_your_api_key"
108 - },
109 - body: JSON.stringify({ require_mcp_api_key: true })
110 - }
111 -);
112 -
113 -console.log(await response.json());
114 -```
115 -</CodeGroup>
116 -
117 -## When to Use This
118 -
119 -Enable API key enforcement when you need to:
120 -
121 -- **Prevent unauthorized access** to your MCP servers
122 -- **Control which applications** can interact with your MCP endpoints
123 -- **Add an extra security layer** for production deployments
124 -- **Audit and track** MCP server usage through API key attribution
125 -
126 -## API Reference
127 -
128 -### Get Current Setting
129 -
130 -```http
131 -GET /api/v3/org/project/config
132 -```
133 -
134 -### Update Setting
135 -
136 -```http
137 -PATCH /api/v3/org/project/config
138 -```
139 -
140 -```json
141 -{
142 - "require_mcp_api_key": true
143 -}
144 -```
fern/pages/src/changelog/01-09-26.md deleted
-204
@@ -1,204 +0,0 @@
1 -# Tool Enum Name Shortening
2 -
3 -Shortened tool enum names across 181 actions to ensure compatibility with all AI agent frameworks.
4 -
5 -## Why This Change?
6 -
7 -Some agent frameworks have a **64-character limit** on tool/function names. Several tool enums exceeded this limit, causing compatibility issues.
8 -
9 -## No Action Required
10 -
11 -**This change will not break your integration if you are using `latest` toolkit versions** or fetching tools dynamically. The SDK automatically resolves the correct tool names.
12 -
13 -<details>
14 -<summary><strong>View All Enum Changes (181 tools)</strong></summary>
15 -
16 -| Old Enum | New Enum |
17 -|----------|----------|
18 -| `ACTIVE_TRAIL_GET_ACCOUNT_INTEGRATIONDATA_ACTIVECOMMERCE` | `ACTIVE_TRAIL_GET_ACCOUNT_INTEGRATIONDATA` |
19 -| `ACTIVE_TRAIL_GET_AUTOMATION_REPORTS_SMS_CAMPAIGN_SUMMARY_REPORT` | `ACTIVE_TRAIL_GET_AUTOMATION_REPORTS_SMS_CAMPAIGN_SUMMARY` |
20 -| `BIG_DATA_CLOUD_REVERSE_GEOCODING_WITH_TIMEZONE_API` | `BIG_DATA_CLOUD_REVERSE_GEOCODING_TIMEZONE_API` |
21 -| `CLICKSEND_RECHARGE_TRANSACTIONS_BY_TRANSACTION_ID_GET` | `CLICKSEND_RECHARGE_TXNS_BY_TXN_ID_GET` |
22 -| `CODEMAGIC_API_V3_VARIABLE_GROUPS_VARIABLE_GROUP_ID_UPDATE_GROUP` | `CODEMAGIC_API_V3_VARIABLE_GROUPS_VARIABLE_GROUP_ID_UPDATE` |
23 -| `COUPA_GET_ALL_FUNDS_TRANSFERS_IN_A_SPECIFIC_PAYMENT_BATCH_BY_PAYMENT_BATCH_ID` | `COUPA_GET_ALL_FUNDS_TRANSFERS_SPECIFIC_PAYMENT_BATCH` |
24 -| `COUPA_GET_PO_CONFIRMATION_IN_CANCELLED_STATUS_AND_NOT_EXPORTED` | `COUPA_GET_PO_CONFIRMATION_CANCELLED_STATUS_NOT_EXPORTED` |
25 -| `DATABRICKS_CATALOG_CREDENTIALS_GENERATE_TEMPORARY_SERVICE_CREDENTIAL` | `DATABRICKS_CATALOG_CREDS_GENERATE_TEMP_SERVICE_CRED` |
26 -| `DATABRICKS_CATALOG_CREDENTIALS_VALIDATE_CREDENTIAL` | `DATABRICKS_CATALOG_CREDS_VALIDATE_CRED` |
27 -| `DATABRICKS_CATALOG_EXTERNAL_METADATA_UPDATE_EXTERNAL_METADATA` | `DATABRICKS_CATALOG_EXTERNAL_METADATA_UPDATE_EXTERNAL` |
28 -| `DATABRICKS_CATALOG_RFA_GET_ACCESS_REQUEST_DESTINATIONS` | `DATABRICKS_CATALOG_RFA_GET_ACCESS_REQUEST_DESTS` |
29 -| `DATABRICKS_CATALOG_RFA_UPDATE_ACCESS_REQUEST_DESTINATIONS` | `DATABRICKS_CATALOG_RFA_UPDATE_ACCESS_REQUEST_DESTS` |
30 -| `DATABRICKS_CATALOG_TEMPORARY_PATH_CREDENTIALS_GENERATE_TEMPORARY_PATH_CREDENTIALS` | `DATABRICKS_CATALOG_TEMP_PATH_CREDS_GENERATE_TEMP_PATH_CREDS` |
31 -| `DATABRICKS_COMPUTE_CLUSTER_POLICIES_GET_PERMISSION_LEVELS` | `DATABRICKS_COMPUTE_CLUSTER_POLICIES_GET_PERM_LEVELS` |
32 -| `DATABRICKS_COMPUTE_CLUSTER_POLICIES_GET_PERMISSIONS` | `DATABRICKS_COMPUTE_CLUSTER_POLICIES_GET_PERMS` |
33 -| `DATABRICKS_COMPUTE_CLUSTER_POLICIES_SET_PERMISSIONS` | `DATABRICKS_COMPUTE_CLUSTER_POLICIES_SET_PERMS` |
34 -| `DATABRICKS_COMPUTE_CLUSTER_POLICIES_UPDATE_PERMISSIONS` | `DATABRICKS_COMPUTE_CLUSTER_POLICIES_UPDATE_PERMS` |
35 -| `DATABRICKS_COMPUTE_INSTANCE_POOLS_GET_PERMISSION_LEVELS` | `DATABRICKS_COMPUTE_INSTANCE_POOLS_GET_PERM_LEVELS` |
36 -| `DATABRICKS_COMPUTE_INSTANCE_POOLS_UPDATE_PERMISSIONS` | `DATABRICKS_COMPUTE_INSTANCE_POOLS_UPDATE_PERMS` |
37 -| `DATABRICKS_COMPUTE_POLICY_COMPLIANCE_FOR_CLUSTERS_ENFORCE_COMPLIANCE` | `DATABRICKS_COMPUTE_POLICY_COMPL_FOR_CLUSTERS_ENFORCE_COMPL` |
38 -| `DATABRICKS_COMPUTE_POLICY_COMPLIANCE_FOR_CLUSTERS_GET_COMPLIANCE` | `DATABRICKS_COMPUTE_POLICY_COMPL_FOR_CLUSTERS_GET_COMPL` |
39 -| `DATABRICKS_DASHBOARDS_GENIE_DELETE_CONVERSATION_MESSAGE` | `DATABRICKS_DASHBOARDS_GENIE_DELETE_CONV_MESSAGE` |
40 -| `DATABRICKS_DASHBOARDS_GENIE_EXECUTE_MESSAGE_ATTACHMENT_QUERY` | `DATABRICKS_DASHBOARDS_GENIE_EXECUTE_MESSAGE_ATTACH_QUERY` |
41 -| `DATABRICKS_DASHBOARDS_GENIE_GET_MESSAGE_ATTACHMENT_QUERY_RESULT` | `DATABRICKS_DASHBOARDS_GENIE_GET_MESSAGE_ATTACH_QUERY_RESULT` |
42 -| `DATABRICKS_DASHBOARDS_GENIE_GET_MESSAGE_QUERY_RESULT_BY_ATTACHMENT` | `DATABRICKS_DASHBOARDS_GENIE_GET_MESSAGE_QUERY_RESULT_ATTACH` |
43 -| `DATABRICKS_DASHBOARDS_GENIE_LIST_CONVERSATION_MESSAGES` | `DATABRICKS_DASHBOARDS_GENIE_LIST_CONV_MESSAGES` |
44 -| `DATABRICKS_DASHBOARDS_LAKEVIEW_EMBEDDED_GET_PUBLISHED_DASHBOARD_TOKEN_INFO` | `DATABRICKS_DASHBOARDS_LAKEVIEW_EMBEDDED_GET_PUBLISHED_DASH` |
45 -| `DATABRICKS_DATABASE_DATABASE_GENERATE_DATABASE_CREDENTIAL` | `DATABRICKS_DATABASE_DATABASE_GENERATE_DATABASE_CRED` |
46 -| `DATABRICKS_IAM_PERMISSION_MIGRATION_MIGRATE_PERMISSIONS` | `DATABRICKS_IAM_PERM_MIGRATION_MIGRATE_PERMS` |
47 -| `DATABRICKS_IAMV2_WORKSPACE_IAM_V2_GET_WORKSPACE_ACCESS_DETAIL_LOCAL` | `DATABRICKS_IAMV2_WORKSPACE_IAM_V2_GET_WORKSPACE_ACCESS` |
48 -| `DATABRICKS_JOB_PERMISSION_LEVELS_GETPERMISSIONLEVELS` | `DATABRICKS_JOB_PERM_LEVELS_GETPERMISSIONLEVELS` |
49 -| `DATABRICKS_JOBS_POLICY_COMPLIANCE_FOR_JOBS_GET_COMPLIANCE` | `DATABRICKS_JOBS_POLICY_COMPL_FOR_JOBS_GET_COMPL` |
50 -| `DATABRICKS_MARKETPLACE_CONSUMER_INSTALLATIONS_CREATE` | `DATABRICKS_MKTPLACE_CONSUMER_INSTALLATIONS_CREATE` |
51 -| `DATABRICKS_MARKETPLACE_CONSUMER_INSTALLATIONS_DELETE` | `DATABRICKS_MKTPLACE_CONSUMER_INSTALLATIONS_DELETE` |
52 -| `DATABRICKS_MARKETPLACE_CONSUMER_INSTALLATIONS_UPDATE` | `DATABRICKS_MKTPLACE_CONSUMER_INSTALLATIONS_UPDATE` |
53 -| `DATABRICKS_MARKETPLACE_CONSUMER_LISTINGS_BATCH_GET` | `DATABRICKS_MKTPLACE_CONSUMER_LISTINGS_BATCH_GET` |
54 -| `DATABRICKS_MARKETPLACE_CONSUMER_PERSONALIZATION_REQUESTS_GET` | `DATABRICKS_MKTPLACE_CONSUMER_PERSONALIZATION_REQUESTS_GET` |
55 -| `DATABRICKS_MARKETPLACE_CONSUMER_PROVIDERS_BATCH_GET` | `DATABRICKS_MKTPLACE_CONSUMER_PROVIDERS_BATCH_GET` |
56 -| `DATABRICKS_MARKETPLACE_PROVIDER_EXCHANGES_DELETE_LISTING_FROM_EXCHANGE` | `DATABRICKS_MKTPLACE_PROVIDER_EXCHANGES_DELETE_LISTING` |
57 -| `DATABRICKS_MARKETPLACE_PROVIDER_PROVIDER_ANALYTICS_DASHBOARDS_CREATE` | `DATABRICKS_MKTPLACE_PROVIDER_ANALYTICS_DASHBOARDS_CREATE` |
58 -| `DATABRICKS_MARKETPLACE_PROVIDER_PROVIDER_ANALYTICS_DASHBOARDS_GET` | `DATABRICKS_MKTPLACE_PROVIDER_ANALYTICS_DASHBOARDS_GET` |
59 -| `DATABRICKS_MARKETPLACE_PROVIDER_PROVIDER_ANALYTICS_DASHBOARDS_GET_LATEST_VERSION` | `DATABRICKS_MKTPLACE_PROVIDER_ANALYTICS_DASH_GET_LATEST` |
60 -| `DATABRICKS_ML_FEATURE_ENGINEERING_DELETE_KAFKA_CONFIG` | `DATABRICKS_ML_FEATURE_ENG_DELETE_KAFKA_CONFIG` |
61 -| `DATABRICKS_ML_MATERIALIZED_FEATURES_DELETE_FEATURE_TAG` | `DATABRICKS_ML_MAT_FEATURES_DELETE_FEATURE_TAG` |
62 -| `DATABRICKS_ML_MATERIALIZED_FEATURES_GET_FEATURE_TAG` | `DATABRICKS_ML_MAT_FEATURES_GET_FEATURE_TAG` |
63 -| `DATABRICKS_ML_MATERIALIZED_FEATURES_UPDATE_FEATURE_TAG` | `DATABRICKS_ML_MAT_FEATURES_UPDATE_FEATURE_TAG` |
64 -| `DATABRICKS_ML_MODEL_REGISTRY_GET_PERMISSION_LEVELS` | `DATABRICKS_ML_MODEL_REGISTRY_GET_PERM_LEVELS` |
65 -| `DATABRICKS_PIPELINES_PIPELINES_GET_PERMISSION_LEVELS` | `DATABRICKS_PIPELINES_PIPELINES_GET_PERM_LEVELS` |
66 -| `DATABRICKS_QUALITYMONITORV2_QUALITY_MONITOR_V2_CREATE_QUALITY_MONITOR` | `DATABRICKS_QUALITYMONITORV2_QUALITY_MONITOR_V2_CREATE` |
67 -| `DATABRICKS_SERVING_SERVING_ENDPOINTS_CREATE_PROVISIONED_THROUGHPUT_ENDPOINT` | `DATABRICKS_SERVING_SERVING_ENDPOINTS_CREATE_PROV_THPUT` |
68 -| `DATABRICKS_SERVING_SERVING_ENDPOINTS_GET_PERMISSION_LEVELS` | `DATABRICKS_SERVING_SERVING_ENDPOINTS_GET_PERM_LEVELS` |
69 -| `DATABRICKS_SETTINGS_AIBI_DASHBOARD_EMBEDDING_ACCESS_POLICY_DELETE` | `DATABRICKS_SETTINGS_AIBI_DASH_EMBEDDING_ACCESS_POLICY_DELETE` |
70 -| `DATABRICKS_SETTINGS_AIBI_DASHBOARD_EMBEDDING_ACCESS_POLICY_GET` | `DATABRICKS_SETTINGS_AIBI_DASH_EMBEDDING_ACCESS_POLICY_GET` |
71 -| `DATABRICKS_SETTINGS_AIBI_DASHBOARD_EMBEDDING_ACCESS_POLICY_UPDATE` | `DATABRICKS_SETTINGS_AIBI_DASH_EMBEDDING_ACCESS_POLICY_UPDATE` |
72 -| `DATABRICKS_SETTINGS_AIBI_DASHBOARD_EMBEDDING_APPROVED_DOMAINS_DELETE` | `DATABRICKS_SETTINGS_AIBI_DASH_EMBEDDING_DOMAINS_DELETE` |
73 -| `DATABRICKS_SETTINGS_AIBI_DASHBOARD_EMBEDDING_APPROVED_DOMAINS_GET` | `DATABRICKS_SETTINGS_AIBI_DASH_EMBEDDING_APPROVED_DOMAINS_GET` |
74 -| `DATABRICKS_SETTINGS_AIBI_DASHBOARD_EMBEDDING_APPROVED_DOMAINS_UPDATE` | `DATABRICKS_SETTINGS_AIBI_DASH_EMBEDDING_DOMAINS_UPDATE` |
75 -| `DATABRICKS_SETTINGS_COMPLIANCE_SECURITY_PROFILE_GET` | `DATABRICKS_SETTINGS_COMPL_SECURITY_PROFILE_GET` |
76 -| `DATABRICKS_SETTINGS_DASHBOARD_EMAIL_SUBSCRIPTIONS_DELETE` | `DATABRICKS_SETTINGS_DASH_EMAIL_SUBS_DELETE` |
77 -| `DATABRICKS_SETTINGS_DASHBOARD_EMAIL_SUBSCRIPTIONS_GET` | `DATABRICKS_SETTINGS_DASH_EMAIL_SUBS_GET` |
78 -| `DATABRICKS_SETTINGS_DASHBOARD_EMAIL_SUBSCRIPTIONS_UPDATE` | `DATABRICKS_SETTINGS_DASH_EMAIL_SUBS_UPDATE` |
79 -| `DATABRICKS_SETTINGS_ENABLE_EXPORT_NOTEBOOK_GET_ENABLE_EXPORT_NOTEBOOK` | `DATABRICKS_SETTINGS_ENABLE_EXPORT_NOTEBOOK_GET_ENABLE` |
80 -| `DATABRICKS_SETTINGS_ENABLE_EXPORT_NOTEBOOK_PATCH_ENABLE_EXPORT_NOTEBOOK` | `DATABRICKS_SETTINGS_ENABLE_EXPORT_NOTEBOOK_PATCH_ENABLE` |
81 -| `DATABRICKS_SETTINGS_ENABLE_NOTEBOOK_TABLE_CLIPBOARD_GET_ENABLE_NOTEBOOK_TABLE_CLIPBOARD` | `DATABRICKS_SETTINGS_ENABLE_NOTEBOOK_TABLE_CLIPBOARD_GET` |
82 -| `DATABRICKS_SETTINGS_ENABLE_NOTEBOOK_TABLE_CLIPBOARD_PATCH_ENABLE_NOTEBOOK_TABLE_CLIPBOARD` | `DATABRICKS_SETTINGS_ENABLE_NOTEBOOK_TABLE_CLIPBOARD_PATCH` |
83 -| `DATABRICKS_SETTINGS_ENABLE_RESULTS_DOWNLOADING_GET_ENABLE_RESULTS_DOWNLOADING` | `DATABRICKS_SETTINGS_ENABLE_RESULTS_DOWNLOADING_GET_ENABLE` |
84 -| `DATABRICKS_SETTINGS_LLM_PROXY_PARTNER_POWERED_WORKSPACE_DELETE` | `DATABRICKS_SETTINGS_LLM_PROXY_PARTNER_WORKSPACE_DELETE` |
85 -| `DATABRICKS_SETTINGS_LLM_PROXY_PARTNER_POWERED_WORKSPACE_UPDATE` | `DATABRICKS_SETTINGS_LLM_PROXY_PARTNER_WORKSPACE_UPDATE` |
86 -| `DATABRICKS_SETTINGS_NOTIFICATION_DESTINATIONS_CREATE` | `DATABRICKS_SETTINGS_NOTIF_DESTS_CREATE` |
87 -| `DATABRICKS_SETTINGS_NOTIFICATION_DESTINATIONS_DELETE` | `DATABRICKS_SETTINGS_NOTIF_DESTS_DELETE` |
88 -| `DATABRICKS_SETTINGS_NOTIFICATION_DESTINATIONS_UPDATE` | `DATABRICKS_SETTINGS_NOTIF_DESTS_UPDATE` |
89 -| `DATABRICKS_SETTINGS_TOKEN_MANAGEMENT_GET_PERMISSION_LEVELS` | `DATABRICKS_SETTINGS_TOKEN_MGMT_GET_PERM_LEVELS` |
90 -| `DATABRICKS_SETTINGS_TOKEN_MANAGEMENT_GET_PERMISSIONS` | `DATABRICKS_SETTINGS_TOKEN_MGMT_GET_PERMS` |
91 -| `DATABRICKS_SETTINGS_TOKEN_MANAGEMENT_SET_PERMISSIONS` | `DATABRICKS_SETTINGS_TOKEN_MGMT_SET_PERMS` |
92 -| `DATABRICKS_SETTINGS_TOKEN_MANAGEMENT_UPDATE_PERMISSIONS` | `DATABRICKS_SETTINGS_TOKEN_MGMT_UPDATE_PERMS` |
93 -| `DATABRICKS_SETTINGSV2_WORKSPACE_SETTINGS_V2_GET_PUBLIC_WORKSPACE_SETTING` | `DATABRICKS_SETTINGSV2_WORKSPACE_SETTINGS_V2_GET_PUBLIC` |
94 -| `DATABRICKS_SQL_STATEMENT_EXECUTION_CANCEL_EXECUTION` | `DATABRICKS_SQL_STATEMENT_EXEC_CANCEL_EXEC` |
95 -| `DATABRICKS_VECTORSEARCH_VECTOR_SEARCH_ENDPOINTS_CREATE_ENDPOINT` | `DATABRICKS_VECTORSEARCH_VECTOR_SEARCH_ENDPOINTS_CREATE` |
96 -| `DATABRICKS_VECTORSEARCH_VECTOR_SEARCH_INDEXES_UPSERT_DATA_VECTOR_INDEX` | `DATABRICKS_VECTORSEARCH_VECTOR_SEARCH_INDEXES_UPSERT_DATA` |
97 -| `DEPLOYHQ_DELETE_PROJECTS_PROJECT_BUILD_CACHE_FILES_IDENTIFIER` | `DEPLOYHQ_DELETE_PROJECTS_PROJECT_BUILD_CACHE_FILES` |
98 -| `DROPBOX_SIGN_EDIT_AND_RESEND_EMBEDDED_SIGNATURE_REQUEST_WITH_TEMPLATE` | `DROPBOX_SIGN_EDIT_RESEND_EMBEDDED_SIGNATURE_REQUEST_TEMPLATE` |
99 -| `GITHUB_CREATE_OR_UPDATE_CUSTOM_PROPERTIES_FOR_AN_ORGANIZATION` | `GITHUB_CREATE_OR_UPDATE_CUSTOM_PROPERTIES_FOR_AN_ORG` |
100 -| `GOOGLE_ANALYTICS_ANALYTICS_ADMIN_PROPERTIES_BIG_QUERY_LINKS_LIST` | `GOOGLE_ANALYTICS_ANALYTICS_ADMIN_PROPERTIES_BIG_QUERY_LINKS` |
101 -| `GOOGLE_ANALYTICS_ANALYTICSADMIN_PROPERTIES_CHANNELGROUPS_LIST` | `GOOGLE_ANALYTICS_ANALYTICSADMIN_PROPERTIES_CHANNELGROUPS` |
102 -| `GOOGLE_ANALYTICS_ANALYTICSADMIN_PROPERTIES_CONVERSIONEVENTS_LIST` | `GOOGLE_ANALYTICS_ANALYTICSADMIN_PROPERTIES_CONVERSIONEVENTS` |
103 -| `GOOGLE_ANALYTICS_ANALYTICSADMIN_PROPERTIES_CUSTOMDIMENSIONS_LIST` | `GOOGLE_ANALYTICS_ANALYTICSADMIN_PROPERTIES_CUSTOMDIMENSIONS` |
104 -| `GOOGLE_ANALYTICS_ANALYTICSADMIN_PROPERTIES_DATASTREAMS_MEASUREMENTPROTOCOLSECRETS_LIST` | `GOOGLE_ANALYTICS_ANALYTICSADMIN_PROPERTIES_DATASTREAMS` |
105 -| `GOOGLE_ANALYTICS_ANALYTICS_ADMIN_PROPERTIES_DISPLAY_VIDEO360_ADVERTISER_LINK_PROPOSALS_LIST` | `GOOGLE_ANALYTICS_ADMIN_PROPS_DV360_LINK_PROPOSALS_LIST` |
106 -| `GOOGLE_ANALYTICS_ANALYTICS_ADMIN_PROPERTIES_DISPLAY_VIDEO360_ADVERTISER_LINKS_LIST` | `GOOGLE_ANALYTICS_ADMIN_PROPS_DV360_AD_LINKS_LIST` |
107 -| `GOOGLE_ANALYTICS_ANALYTICSADMIN_PROPERTIES_EXPANDEDDATASETS_LIST` | `GOOGLE_ANALYTICS_ANALYTICSADMIN_PROPERTIES_EXPANDEDDATASETS` |
108 -| `GOOGLE_ANALYTICS_ANALYTICSADMIN_PROPERTIES_FIREBASELINKS_LIST` | `GOOGLE_ANALYTICS_ANALYTICSADMIN_PROPERTIES_FIREBASELINKS` |
109 -| `GOOGLE_ANALYTICS_ANALYTICS_ADMIN_PROPERTIES_GOOGLE_ADS_LINKS_LIST` | `GOOGLE_ANALYTICS_ANALYTICS_ADMIN_PROPERTIES_GOOGLE_ADS` |
110 -| `GOOGLE_ANALYTICS_ANALYTICS_ADMIN_PROPERTIES_SEARCH_ADS360_LINKS_LIST` | `GOOGLE_ANALYTICS_ANALYTICS_ADMIN_PROPERTIES_SEARCH_ADS360` |
111 -| `GOOGLE_ANALYTICS_PROPERTIES_DATASTREAMS_EVENTCREATERULES_LIST_ACTION` | `GOOGLE_ANALYTICS_PROPERTIES_DATASTREAMS_EVENTCREATERULES` |
112 -| `GOOGLE_CLASSROOM_COURSES_ANNOUNCEMENTS_ADD_ON_ATTACHMENTS_DELETE` | `GOOGLE_CLASSROOM_COURSES_ANNOUNCES_ADD_ON_ATTACHS_DELETE` |
113 -| `GOOGLE_CLASSROOM_COURSES_ANNOUNCEMENTS_ADD_ON_ATTACHMENTS_GET` | `GOOGLE_CLASSROOM_COURSES_ANNOUNCES_ADD_ON_ATTACHS_GET` |
114 -| `GOOGLE_CLASSROOM_COURSES_ANNOUNCEMENTS_ADD_ON_ATTACHMENTS_LIST` | `GOOGLE_CLASSROOM_COURSES_ANNOUNCES_ADD_ON_ATTACHS_LIST` |
115 -| `GOOGLE_CLASSROOM_COURSES_COURSE_WORK_ADD_ON_ATTACHMENTS_DELETE` | `GOOGLE_CLASSROOM_COURSES_COURSE_WORK_ADD_ON_ATTACHS_DELETE` |
116 -| `GOOGLE_CLASSROOM_COURSES_COURSE_WORK_MATERIALS_ADD_ON_ATTACHMENTS_LIST` | `GOOGLE_CLASSROOM_COURSES_COURSE_WORK_MATERIALS_ADD_ATTACHS` |
117 -| `GOOGLE_CLASSROOM_COURSES_COURSE_WORK_MATERIALS_GET_ADD_ON_CONTEXT` | `GOOGLE_CLASSROOM_COURSES_COURSE_WORK_MATERIALS_GET_ADD` |
118 -| `INSTANTLY_DFY_EMAIL_ACCOUNT_ORDERS_DOMAINS_PRE_WARMED_UP_LIST_POST` | `INSTANTLY_DFY_EMAIL_ACCOUNT_ORDERS_DOMAINS_PRE_WARMED_UP` |
119 -| `INSTANTLY_LIST_INBOX_PLACEMENT_BLACKLIST_AND_SPAM_ASSASSIN_REPORTS` | `INSTANTLY_LIST_INBOX_PLACEMENT_BLACKLIST_SPAM_ASSASSIN` |
120 -| `METABASE_DELETE_API_USER_KEY_VALUE_NAMESPACE_NAMESPACE_KEY_KEY` | `METABASE_DELETE_API_USER_KEY_VALUE_NAMESPACE_NAMESPACE_KEY` |
121 -| `METABASE_GET_API_AUTOMAGIC_DASHBOARDS_DATABASE_ID_CANDIDATES` | `METABASE_GET_API_AUTO_DASHBOARDS_DATABASE_ID_CANDIDATES` |
122 -| `METABASE_GET_API_AUTOMAGIC_DASHBOARDS_ENTITY_ENTITY_ID_OR_QUERY_CELL_CELL_QUERY` | `METABASE_GET_AUTOMAGIC_DASH_ENTITY_CELL_QUERY` |
123 -| `METABASE_GET_API_AUTOMAGIC_DASHBOARDS_ENTITY_ENTITY_ID_OR_QUERY_CELL_CELL_QUERY_RULE_PREFIX` | `METABASE_GET_AUTOMAGIC_DASH_ENTITY_CELL_QUERY_RULE` |
124 -| `METABASE_GET_API_AUTOMAGIC_DASHBOARDS_ENTITY_ENTITY_ID_OR_QUERY_QUERY_METADATA` | `METABASE_GET_AUTOMAGIC_DASH_ENTITY_QUERY_METADATA` |
125 -| `METABASE_GET_API_DASHBOARD_ID_PARAMS_PARAM_KEY_REMAPPING` | `METABASE_GET_API_DASH_ID_PARAMS_PARAM_KEY_REMAPPING` |
126 -| `METABASE_GET_API_DASHBOARD_ID_PARAMS_PARAM_KEY_VALUES` | `METABASE_GET_API_DASH_ID_PARAMS_PARAM_KEY_VALUES` |
127 -| `METABASE_POST_API_DASHBOARD_SAVE_COLLECTION_PARENT_COLLECTION_ID` | `METABASE_POST_API_DASH_SAVE_COLLECTION_PARENT_COLLECTION_ID` |
128 -| `METABASE_POST_API_EE_METABOT_TOOLS_CREATE_DASHBOARD_SUBSCRIPTION` | `METABASE_POST_API_EE_METABOT_TOOLS_CREATE_DASH_SUB` |
129 -| `METABASE_POST_API_EE_METABOT_TOOLS_GET_DASHBOARD_DETAILS` | `METABASE_POST_API_EE_METABOT_TOOLS_GET_DASH_DETAILS` |
130 -| `METABASE_POST_API_EE_METABOT_TOOLS_GET_DOCUMENT_DETAILS` | `METABASE_POST_API_EE_METABOT_TOOLS_GET_DOC_DETAILS` |
131 -| `SALESFORCE_GET_VALUES_FOR_ALL_PICKLIST_FIELDS_OF_A_RECORD_TYPE` | `SALESFORCE_GET_PICKLIST_VALUES_BY_RECORD_TYPE` |
132 -| `SALESFORCE_GET_UIAPI_LIST_INFO_ACCOUNT_RECENT_LISTS_ONLY_TRUE` | `SALESFORCE_GET_UI_API_LIST_INFO_RECENT` |
133 -| `SALESFORCE_GET_UIAPI_RELATED_LIST_PREFERENCES_BATCH_ACCOUNTRELATEDCONTACTLISTACCOUNTRELATEDOPPORTUNITYLIST` | `SALESFORCE_GET_RELATED_LIST_PREFS_BATCH` |
134 -| `SALESFORCE_SERVICE_CLOUD_VISITOR_SENSITIVE_DATA_RULE_TRIGGERED` | `SALESFORCE_SERVICE_CLOUD_VISITOR_SENSITIVE_DATA_RULE` |
135 -| `SAP_SUCCESSFACTORS_CREATE_OR_UPDATE_A_SUCCESSOR_NOMINATION_FOR_A_POSITION_OR_TALENT_POOL` | `SAP_SUCCESSFACTORS_CREATE_UPDATE_SUCCESSOR_NOMINATION` |
136 -| `SAP_SUCCESSFACTORS_DELETE_A_NOMINATION_FOR_A_POSITION_OR_TALENT_POOL` | `SAP_SUCCESSFACTORS_DELETE_NOMINATION_POSITION_TALENT_POOL` |
137 -| `SAP_SUCCESSFACTORS_GET_FEEDBACK_RECORDS_SERVICE_AVAILABLE_VIA_SAP_BUSINESS_ACCELERATOR_HUB` | `SAP_SUCCESSFACTORS_GET_FEEDBACK_RECORDS_SERVICE_AVAILABLE` |
138 -| `SAP_SUCCESSFACTORS_GET_ODATA_METADATA_FOR_CALIBRATION_SESSION_SERVICE` | `SAP_SUCCESSFACTORS_GET_ODATA_METADATA_CALIB_SESSION_SERVICE` |
139 -| `SAP_SUCCESSFACTORS_GET_ODATA_METADATA_FOR_CLOCK_INCLOCK_OUT_INTEGRATION_SERVICE` | `SAP_SUCCESSFACTORS_GET_ODATA_METADATA_CLOCK_INCLOCK_OUT` |
140 -| `SAP_SUCCESSFACTORS_GET_ODATA_METADATA_FOR_ONBOARDING_ADDITIONAL_SERVICES` | `SAP_SUCCESSFACTORS_GET_ODATA_METADATA_ONBOARDING_ADDL` |
141 -| `SAP_SUCCESSFACTORS_GET_PENDING_FEEDBACK_REQUESTS_OR_FEEDBACK_REQUEST_RECORDS` | `SAP_SUCCESSFACTORS_GET_PENDING_FEEDBACK_REQUESTS_FEEDBACK` |
142 -| `SAP_SUCCESSFACTORS_QUERY_A_CLOCK_IN_CLOCK_OUT_GROUP_BY_CODE_WITH_TIME_EVENT_TYPES` | `SAP_SUCCESSFACTORS_QUERY_CLOCK_CLOCK_OUT_GROUP_CODE_TIME` |
143 -| `SAP_SUCCESSFACTORS_QUERY_ALL_AVAILABLE_CLOCK_IN_CLOCK_OUT_GROUPS` | `SAP_SUCCESSFACTORS_QUERY_ALL_AVAILABLE_CLOCK_CLOCK_OUT` |
144 -| `SAP_SUCCESSFACTORS_REFRESH_METADATA_FOR_CONTINUOUS_FEEDBACK_SERVICE` | `SAP_SUCCESSFACTORS_REFRESH_METADATA_CONT_FEEDBACK_SERVICE` |
145 -| `SAP_SUCCESSFACTORS_UPDATE_THE_INTERNAL_USERNAME_OF_NEW_HIRES_AFTER_HIRING_PROCESS_IS_COMPLETED_FROM_ACTIVE_DIRECTORY` | `SAP_SUCCESSFACTORS_UPDATE_INTERNAL_USERNAME_NEW_HIRES_AFTER` |
146 -| `SENTRY_RETRIEVE_CUSTOM_INTEGRATION_ISSUE_LINKS_FOR_THE_GIVEN_SENTRY_ISSUE` | `SENTRY_RETRIEVE_CUSTOM_INTEG_ISSUE_LINKS_GIVEN_SENTRY_ISSUE` |
147 -| `SENTRY_RETRIEVE_THE_CUSTOM_INTEGRATIONS_CREATED_BY_AN_ORGANIZATION` | `SENTRY_RETRIEVE_THE_CUSTOM_INTEGS_CREATED_BY_AN_ORG` |
148 -| `SHOPIFY_ADJUSTS_THE_INVENTORY_LEVEL_OF_AN_INVENTORY_ITEM_AT_A_LOCATION` | `SHOPIFY_ADJUSTS_INVENTORY_LEVEL_INVENTORY_ITEM_AT_LOCATION` |
149 -| `SHOPIFY_CREATE_PRICE_RULES_PARAM_PRICE_RULE_ID_DISCOUNT_CODES` | `SHOPIFY_CREATE_PRICE_RULES_PARAM_PRICE_RULE_ID_DISCOUNT` |
150 -| `SHOPIFY_DELETE_FULFILLMENT_SERVICES_PARAM_FULFILLMENT_SERVICE_ID` | `SHOPIFY_DELETE_FULFILLMENT_SERVICES_PARAM_FULFILLMENT` |
151 -| `SHOPIFY_GET_COUNTRIES_PARAM_COUNTRY_ID_PROVINCES_PARAM_PROVINCE_ID` | `SHOPIFY_GET_COUNTRIES_PARAM_COUNTRY_ID_PROVINCES_PARAM` |
152 -| `SHOPIFY_GET_FULFILLMENT_ORDERS_PARAM_FULFILLMENT_ORDER_ID_LOCATIONS_FOR_MOVE` | `SHOPIFY_GET_FULFILLMENT_ORDERS_PARAM_FULFILLMENT_ORDER_ID` |
153 -| `SHOPIFY_GET_PRICE_RULES_PARAM_PRICE_RULE_ID_BATCH_PARAM_BATCH_ID` | `SHOPIFY_GET_PRICE_RULES_PARAM_PRICE_RULE_ID_BATCH_PARAM` |
154 -| `SHOPIFY_PERFORMS_BULK_OPERATIONS_FOR_MULTIPLE_CUSTOMER_ADDRESSES` | `SHOPIFY_PERFORMS_BULK_OPERATIONS_MULTIPLE_CUSTOMER_ADDRESSES` |
155 -| `SHOPIFY_RETRIEVE_A_LIST_OF_METAFIELDS_FROM_THE_RESOURCE_S_ENDPOINT` | `SHOPIFY_RETRIEVE_LIST_METAFIELDS_RESOURCE_S_ENDPOINT` |
156 -| `SHOPIFY_RETRIEVE_A_LIST_OF_PRODUCTS_BELONGING_TO_A_COLLECTION` | `SHOPIFY_RETRIEVE_LIST_PRODUCTS_BELONGING_COLLECTION` |
157 -| `SHOPIFY_RETRIEVES_A_LIST_OF_ALL_ARTICLE_TAGS_FROM_A_SPECIFIC_BLOG` | `SHOPIFY_RETRIEVES_LIST_ALL_ARTICLE_TAGS_SPECIFIC_BLOG` |
158 -| `SHOPIFY_RETRIEVES_A_LIST_OF_DISCOUNT_CODES_FOR_A_DISCOUNT_CODE_CREATION_JOB` | `SHOPIFY_RETRIEVES_LIST_DISCOUNT_CODES_DISCOUNT_CODE` |
159 -| `SHOPIFY_RETRIEVES_A_LIST_OF_STOREFRONT_ACCESS_TOKENS_THAT_HAVE_BEEN_ISSUED` | `SHOPIFY_RETRIEVES_LIST_STOREFRONT_ACCESS_TOKENS_THAT_HAVE` |
160 -| `SHOPIFY_RETRIEVES_FULFILLMENTS_ASSOCIATED_WITH_A_FULFILLMENT_ORDER` | `SHOPIFY_RETRIEVES_FULFILLMENTS_ASSOCIATED_FULFILLMENT_ORDER` |
161 -| `SHOPIFY_SETS_THE_INVENTORY_LEVEL_FOR_AN_INVENTORY_ITEM_AT_A_LOCATION` | `SHOPIFY_SETS_INVENTORY_LEVEL_INVENTORY_ITEM_AT_LOCATION` |
162 -| `SHOPIFY_SHOP_RETRIEVE_A_LIST_OF_METAFIELDS_FROM_THE_RESOURCE_S_ENDPOINT` | `SHOPIFY_SHOP_RETRIEVE_LIST_METAFIELDS_RESOURCE_S_ENDPOINT` |
163 -| `SHOPIFY_UPDATE_COUNTRIES_PARAM_COUNTRY_ID_PROVINCES_PARAM_PROVINCE_ID` | `SHOPIFY_UPDATE_COUNTRIES_PARAM_COUNTRY_ID_PROVINCES_PARAM` |
164 -| `STRIPE_DELETE_CUSTOMERS_CUSTOMER_SUBSCRIPTIONS_SUBSCRIPTION_EXPOSED_ID` | `STRIPE_DELETE_CUSTOMER_SUB_EXPOSED_ID` |
165 -| `STRIPE_DELETE_CUSTOMERS_CUSTOMER_SUBSCRIPTIONS_SUBSCRIPTION_EXPOSED_ID_DISCOUNT` | `STRIPE_DELETE_CUSTOMER_SUB_EXPOSED_ID_DISCOUNT` |
166 -| `STRIPE_GET_CUSTOMERS_CUSTOMER_BALANCE_TRANSACTIONS_TRANSACTION` | `STRIPE_GET_CUSTOMERS_CUSTOMER_BALANCE_TXNS_TXN` |
167 -| `STRIPE_GET_CUSTOMERS_CUSTOMER_SUBSCRIPTIONS_SUBSCRIPTION_EXPOSED_ID` | `STRIPE_GET_CUSTOMERS_CUSTOMER_SUBS_SUB_EXPOSED_ID` |
168 -| `STRIPE_GET_CUSTOMERS_CUSTOMER_SUBSCRIPTIONS_SUBSCRIPTION_EXPOSED_ID_DISCOUNT` | `STRIPE_GET_CUSTOMERS_CUSTOMER_SUBS_SUB_EXPOSED_ID_DISCOUNT` |
169 -| `STRIPE_GET_V1_ACCOUNTS_CAPABILITIES_CAPABILITIES_ACCOUNTS_CAPABILITIES` | `STRIPE_GET_V1_ACCOUNTS_CAPABILITIES_CAPABILITIES_ACCOUNTS` |
170 -| `STRIPE_GET_V1_BILLING_CREDIT_BALANCE_TRANSACTIONS_OVERVIEW_BILLING_CREDIT_BALANCE_TRANSACTIONS` | `STRIPE_GET_V1_BILLING_CREDIT_BALANCE_TXNS_OVERVIEW_BILLING` |
171 -| `STRIPE_GET_V1_BILLING_PORTAL_CONFIGURATIONS_OVERVIEW_BILLING_PORTAL_CONFIGURATIONS` | `STRIPE_GET_V1_BILLING_PORTAL_CONFIGS_OVERVIEW_BILLING` |
172 -| `STRIPE_GET_V1_ENTITLEMENTS_ACTIVE_ENTITLEMENTS_ACTIVE_ENTITLEMENT` | `STRIPE_GET_V1_ENTITLEMENTS_ACTIVE_ENTITLEMENTS_ACTIVE` |
173 -| `STRIPE_GET_V1_FINANCIAL_CONNECTIONS_ACCOUNTS_OVERVIEW_FINANCIAL_CONNECTIONS_ACCOUNTS` | `STRIPE_GET_V1_FIN_CONNS_ACCOUNTS_OVERVIEW_FIN_CONNS_ACCOUNTS` |
174 -| `STRIPE_GET_V1_PAYMENT_METHOD_CONFIGURATIONS_LIST_PAYMENT_METHOD` | `STRIPE_GET_V1_PAYMENT_METHOD_CONFIGS_LIST_PAYMENT_METHOD` |
175 -| `STRIPE_GET_V1_PAYMENT_METHOD_CONFIGURATIONS_LIST_PAYMENT_METHOD2` | `STRIPE_GET_V1_PAYMENT_METHOD_CONFIGS_LIST_PAYMENT_METHOD2` |
176 -| `STRIPE_GET_V1_QUOTES_COMPUTED_UPFRONT_LINE_ITEMS_LIST_ALL_QUOTES` | `STRIPE_GET_V1_QUOTES_COMPUTED_UPFRONT_LINE_ITEMS_LIST_ALL` |
177 -| `STRIPE_GET_V1_REPORTING_REPORT_TYPES_OVERVIEW_REPORTING_REPORT_TYPES` | `STRIPE_GET_V1_REPORTING_REPORT_TYPES_OVERVIEW_REPORTING` |
178 -| `STRIPE_GET_V1_TEST_HELPERS_TEST_CLOCKS_DELETE_A_TEST_TEST_HELPERS_TEST_CLOCKS` | `STRIPE_GET_V1_TEST_HELPERS_TEST_CLOCKS_DELETE_TEST_TEST` |
179 -| `STRIPE_POST_CUSTOMERS_CUSTOMER_SUBSCRIPTIONS_SUBSCRIPTION_EXPOSED_ID` | `STRIPE_POST_CUSTOMERS_CUSTOMER_SUBS_SUB_EXPOSED_ID` |
180 -| `STRIPE_POST_PAYMENT_RECORDS_ID_REPORT_PAYMENT_ATTEMPT_CANCELED` | `STRIPE_POST_PAYMENT_RECORDS_REPORT_ATTEMPT_CANCELED` |
181 -| `STRIPE_POST_PAYMENT_RECORDS_ID_REPORT_PAYMENT_ATTEMPT_INFORMATIONAL` | `STRIPE_POST_PAYMENT_RECORDS_REPORT_ATTEMPT_INFO` |
182 -| `STRIPE_POST_TAX_TRANSACTIONS_CREATE_FROM_CALCULATION_OVERVIEW` | `STRIPE_POST_TAX_TXNS_CREATE_FROM_CALCULATION_OVERVIEW` |
183 -| `STRIPE_POST_TERMINAL_READERS_CANCEL_ACTION_SET_READER_DISPLAY` | `STRIPE_POST_TERMINAL_READERS_CANCEL_ACTION_SET_READER` |
184 -| `STRIPE_POST_TERMINAL_READERS_COLLECT_INPUTS_SET_READER_DISPLAY` | `STRIPE_POST_TERMINAL_READERS_COLLECT_INPUTS_SET_READER` |
185 -| `STRIPE_POST_TERMINAL_READERS_CONFIRM_PAYMENT_INTENT_SET_READER_DISPLAY` | `STRIPE_POST_TERMINAL_READERS_CONFIRM_PAYMENT_INTENT_SET` |
186 -| `STRIPE_POST_TEST_HELPERS_CUSTOMERS_FUND_CASH_BALANCE_FUND_A_TEST` | `STRIPE_POST_TEST_HELPERS_CUSTOMERS_FUND_CASH_BALANCE_FUND` |
187 -| `STRIPE_POST_TEST_HELPERS_TERMINAL_READERS_READER_PRESENT_PAYMENT_METHOD` | `STRIPE_POST_TEST_HELPERS_TERMINAL_READERS_READER_PRESENT` |
188 -| `STRIPE_POST_TEST_HELPERS_TERMINAL_READERS_READER_SUCCEED_INPUT_COLLECTION` | `STRIPE_POST_TEST_HELPERS_TERMINAL_READERS_READER_SUCCEED` |
189 -| `STRIPE_POST_TEST_HELPERS_TERMINAL_READERS_READER_TIMEOUT_INPUT_COLLECTION` | `STRIPE_POST_TEST_HELPERS_TERMINAL_READERS_READER_TIMEOUT` |
190 -| `STRIPE_POST_V1_BILLING_PORTAL_CONFIGURATIONS_OVERVIEW_BILLING_PORTAL_CONFIGURATIONS` | `STRIPE_POST_V1_BILLING_PORTAL_CONFIGS_OVERVIEW_BILLING` |
191 -| `STRIPE_POST_V1_PAYMENT_METHOD_CONFIGURATIONS_LIST_PAYMENT_METHOD2` | `STRIPE_POST_V1_PAYMENT_METHOD_CONFIGS_LIST_PAYMENT_METHOD2` |
192 -| `STRIPE_POST_V1_PAYMENT_METHOD_DOMAINS_PAYMENT_METHOD_DOMAINS2` | `STRIPE_POST_V1_PAYMENT_METHOD_DOMAINS_PAYMENT_METHOD` |
193 -| `STRIPE_POST_V1_PAYMENT_RECORDS_REPORT_PAYMENT_ATTEMPT_CANCELED_OVERVIEW` | `STRIPE_POST_V1_PAYMENT_RECORDS_REPORT_CANCELED` |
194 -| `STRIPE_POST_V1_PAYMENT_RECORDS_REPORT_PAYMENT_ATTEMPT_GUARANTEED_OVERVIEW` | `STRIPE_POST_V1_PAYMENT_RECORDS_REPORT_GUARANTEED` |
195 -| `STRIPE_POST_V1_PAYMENT_RECORDS_REPORT_PAYMENT_ATTEMPT_INFORMATIONAL_OVERVIEW` | `STRIPE_POST_V1_PAYMENT_RECORDS_REPORT_INFO` |
196 -| `STRIPE_POST_V1_PAYMENT_RECORDS_REPORT_PAYMENT_ATTEMPT_OVERVIEW` | `STRIPE_POST_V1_PAYMENT_RECORDS_REPORT_ATTEMPT` |
197 -| `STRIPE_POST_V1_TEST_HELPERS_CONFIRMATION_TOKENS_CREATE_A_TEST` | `STRIPE_POST_V1_TEST_HELPERS_CONFIRMATION_TOKENS_CREATE_TEST` |
198 -| `STRIPE_POST_V2_BILLING_METER_EVENT_ADJUSTMENTS_METER_EVENT_ADJUSTMENTS` | `STRIPE_POST_V2_BILLING_METER_EVENT_ADJUSTMENTS_METER_EVENT` |
199 -
200 -</details>
201 -
202 -## Migration
203 -
204 -If you're referencing any affected tool enums by their old names, update to the new shortened names.
fern/pages/src/changelog/01-12-26-tool-router-improvements.md deleted
-127
@@ -1,127 +0,0 @@
1 -# Tool Router Improvements and New Features
2 -
3 -## Version Information
4 -
5 -### TypeScript/JavaScript
6 -- Package: `@composio/core` and provider packages
7 -- Version: `0.3.4` to `0.4.0`
8 -
9 -### Python
10 -- Package: `composio-core` and provider packages
11 -- Version: `0.10.4` to `0.10.5`
12 -
13 -## New Features
14 -
15 -### 1. Wait for Connections Property
16 -
17 -Added `waitForConnections` (TypeScript) / `wait_for_connections` (Python) property to manage connections configuration. This allows tool router sessions to wait for users to complete authentication before proceeding to the next step.
18 -
19 -**TypeScript:**
20 -```typescript
21 -const session = await composio.toolRouter.create(userId, {
22 - manageConnections: {
23 - enable: true,
24 - callbackUrl: 'https://example.com/callback',
25 - waitForConnections: true // NEW
26 - }
27 -});
28 -```
29 -
30 -**Python:**
31 -```python
32 -session = tool_router.create(
33 - user_id="user_123",
34 - manage_connections={
35 - "enable": True,
36 - "callback_url": "https://example.com/callback",
37 - "wait_for_connections": True # NEW
38 - }
39 -)
40 -```
41 -
42 -### 2. Session-Specific Modifier Types
43 -
44 -Introduced new modifier types for better session-based tool execution: `SessionExecuteMetaModifiers` and `SessionMetaToolOptions`.
45 -
46 -**TypeScript:**
47 -```typescript
48 -const tools = await session.tools({
49 - modifySchema: ({ toolSlug, toolkitSlug, schema }) => schema,
50 - beforeExecute: ({ toolSlug, toolkitSlug, sessionId, params }) => params,
51 - afterExecute: ({ toolSlug, toolkitSlug, sessionId, result }) => result
52 -});
53 -```
54 -
55 -**Python:**
56 -```python
57 -from composio.core.models import before_execute_meta, after_execute_meta
58 -
59 -@before_execute_meta
60 -def before_modifier(tool, toolkit, session_id, params):
61 - return params
62 -
63 -@after_execute_meta
64 -def after_modifier(tool, toolkit, session_id, response):
65 - return response
66 -
67 -tools = session.tools(modifiers=[before_modifier, after_modifier])
68 -```
69 -
70 -### 3. Dedicated Method for Tool Router Meta Tools
71 -
72 -Added `getRawToolRouterMetaTools` (TypeScript) / `get_raw_tool_router_meta_tools` (Python) method in the Tools class for fetching meta tools directly from a tool router session.
73 -
74 -**TypeScript:**
75 -```typescript
76 -const metaTools = await composio.tools.getRawToolRouterMetaTools('session_123', {
77 - modifySchema: ({ toolSlug, toolkitSlug, schema }) => {
78 - // Customize schema
79 - return schema;
80 - }
81 -});
82 -```
83 -
84 -**Python:**
85 -```python
86 -meta_tools = tools_model.get_raw_tool_router_meta_tools(
87 - session_id="session_123",
88 - modifiers=[schema_modifier]
89 -)
90 -```
91 -
92 -## Internal Improvements
93 -
94 -### 1. Performance Optimization
95 -
96 -Eliminated unnecessary tool fetching during tool router execution, resulting in faster tool execution with fewer API calls.
97 -
98 -### 2. Improved Architecture
99 -
100 -Tool router sessions now fetch tools directly from the session API endpoint instead of using tool slugs, providing better consistency and reliability.
101 -
102 -### 3. Simplified Implementation
103 -
104 -Removed redundant tool schema fetching in execution paths, using a hardcoded 'composio' toolkit slug for meta tools.
105 -
106 -## Backward Compatibility
107 -
108 -This release is fully backward compatible:
109 -
110 -- All existing code continues to work without modifications
111 -- New properties are optional with sensible defaults
112 -- New modifier types can be adopted incrementally
113 -- Internal changes have no impact on public APIs
114 -- No migration required
115 -
116 -## Impact Summary
117 -
118 -| Change | Runtime Breaking | TypeScript Breaking | Migration Required |
119 -|--------|------------------|---------------------|-------------------|
120 -| `wait_for_connections` property | No | No | No |
121 -| Session-specific modifiers | No | No | No |
122 -| `getRawToolRouterMetaTools` method | No | No | No |
123 -| Tool router uses session API | No | No | No |
124 -| Optimized tool execution | No | No | No |
125 -
126 -All changes follow semantic versioning principles and maintain full backward compatibility.
127 -
fern/pages/src/changelog/01-14-26-auth-config-patch-semantics.md deleted
-189
@@ -1,189 +0,0 @@
1 -# True PATCH Semantics for Auth Config Updates
2 -
3 -## Version Information
4 -
5 -### TypeScript/JavaScript
6 -- Package: `@composio/core` and provider packages
7 -- Version: `0.5.1`+
8 -
9 -### Python
10 -- Package: `composio-core` and provider packages
11 -- Version: `0.10.7`+
12 -
13 ----
14 -
15 -The `PATCH /api/v3/auth_configs/{id}` endpoint now implements proper partial update semantics. Previously, omitting fields would clear them (behaving like PUT). Now, omitted fields are preserved—only explicitly provided fields are modified.
16 -
17 -<Warning>
18 -**Breaking Change**: If you relied on omitting fields to clear them, you must now explicitly send `null` or `[]`. See [Migration Guide](#migration-guide) below.
19 -</Warning>
20 -
21 -## What Changed
22 -
23 -| Field | Before (Buggy) | After (Correct) |
24 -| ----------------------------- | ------------------------ | --------------------------------- |
25 -| `credentials` | Required on every update | Optional—merged with existing |
26 -| `tool_access_config` | Reset to `{}` if omitted | Preserved if omitted |
27 -| `scopes` (type: default) | Cleared if omitted | Preserved if omitted |
28 -| `restrict_to_following_tools` | Reset to `[]` if omitted | Preserved if omitted |
29 -
30 -<Note>
31 -**Merge Behavior**: The `credentials` object is merged—send only the fields you want to change, and existing fields are preserved.
32 -</Note>
33 -
34 -## New Capabilities
35 -
36 -### Rotate a Single Credential Field
37 -
38 -Update just `client_secret` without resending `client_id` or other fields:
39 -
40 -<CodeBlocks>
41 -```python title="Python SDK"
42 -from composio import Composio
43 -
44 -composio = Composio()
45 -
46 -# Only send the field you want to update - other credentials are preserved
47 -
48 -composio.auth_configs.update(
49 -"ac_yourAuthConfigId",
50 -options={
51 -"type": "custom",
52 -"credentials": {
53 -"client_secret": "new_rotated_secret",
54 -},
55 -},
56 -)
57 -
58 -````
59 -
60 -```typescript title="TypeScript SDK"
61 -import { Composio } from "@composio/core";
62 -
63 -const composio = new Composio();
64 -
65 -// Only send the field you want to update - other credentials are preserved
66 -await composio.authConfigs.update("ac_yourAuthConfigId", {
67 - type: "custom",
68 - credentials: {
69 - client_secret: "new_rotated_secret",
70 - },
71 -});
72 -````
73 -
74 -</CodeBlocks>
75 -
76 -### Update Tool Restrictions Without Touching Credentials
77 -
78 -Previously, this would fail because `credentials` was required. Now it works:
79 -
80 -<CodeBlocks>
81 -```python title="Python SDK"
82 -from composio import Composio
83 -
84 -composio = Composio()
85 -
86 -# Update tool restrictions - credentials are automatically preserved
87 -
88 -composio.auth_configs.update(
89 -"ac_yourAuthConfigId",
90 -options={
91 -"type": "custom",
92 -"tool_access_config": {
93 -"tools_available_for_execution": ["GMAIL_SEND_EMAIL", "GMAIL_READ_EMAIL"],
94 -},
95 -},
96 -)
97 -
98 -````
99 -
100 -```typescript title="TypeScript SDK"
101 -import { Composio } from "@composio/core";
102 -
103 -const composio = new Composio();
104 -
105 -// Note: TypeScript SDK currently requires credentials for custom type updates
106 -await composio.authConfigs.update("ac_yourAuthConfigId", {
107 - type: "custom",
108 - credentials: {
109 - // Include existing credentials when using TS SDK
110 - },
111 - toolAccessConfig: {
112 - toolsAvailableForExecution: ["GMAIL_SEND_EMAIL", "GMAIL_READ_EMAIL"],
113 - },
114 -});
115 -````
116 -
117 -</CodeBlocks>
118 -
119 -## Migration Guide
120 -
121 -### Am I Affected?
122 -
123 -**Yes**, if your code relied on omitting fields to clear them.
124 -
125 -**No**, if you always send complete payloads or only use PATCH to update specific fields.
126 -
127 -### How to Clear Fields Explicitly
128 -
129 -| To Clear | Python SDK | TypeScript SDK |
130 -| -------------------- | ------------------------------------------------------------- | ------------------------------------------------------ |
131 -| `tool_access_config` | `"tool_access_config": {"tools_available_for_execution": []}` | `toolAccessConfig: { toolsAvailableForExecution: [] }` |
132 -| `scopes` (default) | `"scopes": ""` | `scopes: ""` (via HTTP API) |
133 -
134 -<CodeBlocks>
135 -```python title="Python SDK - Clear tool restrictions"
136 -from composio import Composio
137 -
138 -composio = Composio()
139 -
140 -# Explicitly clear tool restrictions with empty array
141 -
142 -composio.auth_configs.update(
143 -"ac_yourAuthConfigId",
144 -options={
145 -"type": "custom",
146 -"tool_access_config": {
147 -"tools_available_for_execution": [],
148 -},
149 -},
150 -)
151 -
152 -````
153 -
154 -```typescript title="TypeScript SDK - Clear tool restrictions"
155 -import { Composio } from "@composio/core";
156 -
157 -const composio = new Composio();
158 -
159 -// Explicitly clear tool restrictions with empty array
160 -await composio.authConfigs.update("ac_yourAuthConfigId", {
161 - type: "custom",
162 - credentials: {
163 - // Include existing credentials when using TS SDK
164 - },
165 - toolAccessConfig: {
166 - toolsAvailableForExecution: [],
167 - },
168 -});
169 -````
170 -
171 -</CodeBlocks>
172 -
173 -### Raw HTTP API
174 -
175 -For users calling the API directly:
176 -
177 -```bash
178 -# Rotate single credential
179 -curl -X PATCH "https://backend.composio.dev/api/v3/auth_configs/{id}" \
180 - -H "x-api-key: YOUR_API_KEY" \
181 - -H "Content-Type: application/json" \
182 - -d '{"type": "custom", "credentials": {"client_secret": "new_secret"}}'
183 -
184 -# Clear tool restrictions
185 -curl -X PATCH "https://backend.composio.dev/api/v3/auth_configs/{id}" \
186 - -H "x-api-key: YOUR_API_KEY" \
187 - -H "Content-Type: application/json" \
188 - -d '{"type": "custom", "tool_access_config": {"tools_available_for_execution": []}}'
189 -```
fern/pages/src/changelog/01-20-26-file-modifier-anyof-support.md deleted
-136
@@ -1,136 +0,0 @@
1 -# [Critical] File Upload/Download Fixes for `latest` tool with anyOf, oneOf, and allOf Schemas
2 -
3 -## Version Information
4 -
5 -### TypeScript/JavaScript
6 -- Package: `@composio/core` and provider packages
7 -- Version: `0.5.3`+
8 -
9 -### Python
10 -- Package: `composio` and provider packages
11 -- Version: `0.10.8`+
12 -
13 ----
14 -
15 -The file handling modifiers now properly handle `file_uploadable` and `file_downloadable` properties nested within `anyOf`, `oneOf`, and `allOf` JSON Schema declarations. Previously, only direct child properties (and partial `allOf` support) were detected for file upload/download transformations.
16 -
17 -<Note>
18 -We recommend updating to version `0.5.3` (TypeScript) or `0.10.8` (Python) or later to ensure file uploads and downloads work correctly with tools that use union or intersection types in their schemas.
19 -</Note>
20 -
21 -## What Changed
22 -
23 -### Before (Bug)
24 -
25 -File properties inside `anyOf`, `oneOf`, or `allOf` were not detected:
26 -
27 -```typescript
28 -// This schema's file_uploadable was NOT being processed
29 -inputParameters: {
30 - type: 'object',
31 - properties: {
32 - fileInput: {
33 - anyOf: [
34 - {
35 - type: 'string',
36 - file_uploadable: true // ❌ Not detected
37 - },
38 - {
39 - type: 'null'
40 - }
41 - ]
42 - }
43 - }
44 -}
45 -```
46 -
47 -### After (Fixed)
48 -
49 -File properties are now correctly detected and processed at any nesting level:
50 -
51 -```typescript
52 -// Now properly detected and transformed
53 -inputParameters: {
54 - type: 'object',
55 - properties: {
56 - fileInput: {
57 - anyOf: [
58 - {
59 - type: 'string',
60 - file_uploadable: true // ✅ Detected and processed
61 - },
62 - {
63 - type: 'null'
64 - }
65 - ]
66 - }
67 - }
68 -}
69 -```
70 -
71 -## Affected Scenarios
72 -
73 -| Scenario | Before | After |
74 -|----------|--------|-------|
75 -| `file_uploadable` in `anyOf` | Not detected | ✅ Works |
76 -| `file_uploadable` in `oneOf` | Not detected | ✅ Works |
77 -| `file_uploadable` in `allOf` | Not detected | ✅ Works |
78 -| `file_downloadable` in `anyOf` | Not detected | ✅ Works |
79 -| `file_downloadable` in `oneOf` | Not detected | ✅ Works |
80 -| `file_downloadable` in `allOf` | Not detected | ✅ Works |
81 -| Nested objects inside union types | Not detected | ✅ Works |
82 -| Array items with union types | Not detected | ✅ Works |
83 -
84 -## How to Update
85 -
86 -### TypeScript/JavaScript
87 -
88 -<CodeBlocks>
89 -```bash title="npm"
90 -npm update @composio/core@latest
91 -```
92 -
93 -```bash title="pnpm"
94 -pnpm update @composio/core@latest
95 -```
96 -
97 -```bash title="yarn"
98 -yarn upgrade @composio/core@latest
99 -```
100 -</CodeBlocks>
101 -
102 -### Python
103 -
104 -<CodeBlocks>
105 -```bash title="pip"
106 -pip install --upgrade composio
107 -```
108 -
109 -```bash title="uv"
110 -uv pip install --upgrade composio
111 -```
112 -
113 -```bash title="poetry"
114 -poetry update composio
115 -```
116 -</CodeBlocks>
117 -
118 -## Backward Compatibility
119 -
120 -This release is fully backward compatible:
121 -
122 -- All existing code continues to work without modifications
123 -- No migration required
124 -- File upload/download for direct properties continues to work as before
125 -- The fix only adds support for previously unsupported schema patterns
126 -
127 -## Impact Summary
128 -
129 -| Change | Runtime Breaking | TypeScript Breaking | Migration Required |
130 -|--------|------------------|---------------------|-------------------|
131 -| `anyOf` support for file uploads | No | No | No |
132 -| `oneOf` support for file uploads | No | No | No |
133 -| `allOf` support for file uploads | No | No | No |
134 -| `anyOf` support for file downloads | No | No | No |
135 -| `oneOf` support for file downloads | No | No | No |
136 -| `allOf` support for file downloads | No | No | No |
fern/pages/src/changelog/01-20-26-file-ttl.md deleted
-56
@@ -1,56 +0,0 @@
1 -# File handling in tool execution now uses presigned URLs
2 -
3 -## Summary
4 -
5 -Files involved in tool execution are now shared via presigned URLs with a default TTL (time-to-live) of 1 hour. You can customize the file TTL through your project configuration.
6 -
7 -## What changed
8 -
9 -When tools return files (images, documents, exports, etc.), these files are now delivered as presigned URLs with a configurable TTL instead of non-expiring URLs. This provides:
10 -
11 -- **Automatic cleanup** - Files expire after the configured TTL
12 -- **Configurable retention** - Adjust file availability based on your application's needs
13 -
14 -## Default behavior
15 -
16 -All files returned from tool execution now have a **1 hour TTL** by default. After this period, the presigned URLs expire and files are no longer accessible.
17 -
18 -## Configuring file TTL
19 -
20 -You can adjust the file TTL to match your application's needs.
21 -
22 -### Via Dashboard
23 -
24 -1. Navigate to **Project Settings** in your Composio dashboard
25 -2. Find the **File TTL** configuration option
26 -3. Set your desired TTL value
27 -
28 -### Via API
29 -
30 -Use the [Update Project Config API](https://docs.composio.dev/rest-api/projects/patch-org-project-config) to programmatically configure the file TTL:
31 -
32 -```bash
33 -curl -X PATCH "https://backend.composio.dev/api/v3/org/projects/config" \
34 - -H "x-api-key: YOUR_API_KEY" \
35 - -H "Content-Type: application/json" \
36 - -d '{
37 - "fileTtl": 3600
38 - }'
39 -```
40 -
41 -## Impact
42 -
43 -| Aspect | Before | After |
44 -|--------|--------|-------|
45 -| File delivery | Non-expiring URLs | Presigned URLs with TTL |
46 -| Default expiry | None | 1 hour |
47 -| TTL customization | Not available | Configurable via project settings |
48 -
49 -## Migration
50 -
51 -No code changes are required. Your existing integrations will continue to receive file URLs as before, but these URLs will now expire after the configured TTL.
52 -
53 -If your application stores or caches file URLs for later use, ensure you handle URL expiration appropriately by either:
54 -- Downloading files before the TTL expires
55 -- Re-executing the tool to obtain fresh URLs when needed
56 -- Increasing the TTL via project settings to match your retention requirements
fern/pages/src/changelog/01-21-26-initiate-active-status-filter.md deleted
-44
@@ -1,44 +0,0 @@
1 -# Connected Account Initiate Now Filters by ACTIVE Status
2 -
3 -## Version Information
4 -
5 -### TypeScript/JavaScript
6 -- Package: `@composio/core`
7 -- Version: `0.5.4`+
8 -
9 -### Python
10 -- Package: `composio`
11 -- Version: `0.10.9`+
12 -
13 ----
14 -
15 -The `initiate()` method now only considers ACTIVE connected accounts when checking for duplicates. Previously, expired or inactive accounts would incorrectly trigger the multiple accounts error.
16 -
17 -## What Changed
18 -
19 -When calling `connectedAccounts.initiate()`, the SDK now filters by `statuses: ["ACTIVE"]` when checking for existing accounts. This prevents expired or inactive accounts from blocking new connection creation.
20 -
21 -### Before (Bug)
22 -
23 -```typescript
24 -// Expired accounts would incorrectly trigger ComposioMultipleConnectedAccountsError
25 -await composio.connectedAccounts.initiate(userId, authConfigId);
26 -// ❌ Error: Multiple connected accounts found (even if they're all expired)
27 -```
28 -
29 -### After (Fixed)
30 -
31 -```typescript
32 -// Only ACTIVE accounts are considered
33 -await composio.connectedAccounts.initiate(userId, authConfigId);
34 -// ✅ Works - expired/inactive accounts are ignored
35 -```
36 -
37 -## Affected SDKs
38 -
39 -- **TypeScript**: `@composio/core`
40 -- **Python**: `composio`
41 -
42 -## Backward Compatibility
43 -
44 -This is a bug fix with no breaking changes. The behavior now matches the expected intent of the multiple accounts check.
fern/pages/src/changelog/01-22-26-experimental-assistive-prompts.md deleted
-113
@@ -1,113 +0,0 @@
1 -# Experimental Assistive Prompts and API Updates
2 -
3 -## Version Information
4 -
5 -### TypeScript/JavaScript
6 -- Package: `@composio/core`
7 -- Version: `0.5.5`+
8 -
9 -### Python
10 -- Package: `composio`
11 -- Version: `0.10.10`+
12 -
13 -## New Features
14 -
15 -### Experimental Assistive Prompt Configuration
16 -
17 -Tool Router sessions now support experimental configuration for timezone-aware assistive prompts. When you provide a user's timezone, the session returns a contextual assistive prompt that includes timezone-specific guidance.
18 -
19 -<Warning>
20 -This is an experimental feature. The API may change or be removed in future versions.
21 -</Warning>
22 -
23 -<CodeBlocks>
24 -```python title="Python SDK"
25 -from composio import Composio
26 -
27 -composio = Composio()
28 -
29 -session = composio.tool_router.create(
30 - user_id="user_123",
31 - toolkits=["github"],
32 - experimental={
33 - "assistive_prompt": {
34 - "user_timezone": "America/New_York",
35 - }
36 - },
37 -)
38 -
39 -# Access the generated assistive prompt
40 -if session.experimental:
41 - print(session.experimental.assistive_prompt)
42 -```
43 -
44 -```typescript title="TypeScript SDK"
45 -import { Composio } from "@composio/core";
46 -
47 -const composio = new Composio();
48 -
49 -const session = await composio.toolRouter.create("user_123", {
50 - toolkits: ["github"],
51 - experimental: {
52 - assistivePrompt: {
53 - userTimezone: "America/New_York",
54 - },
55 - },
56 -});
57 -
58 -// Access the generated assistive prompt
59 -if (session.experimental) {
60 - console.log(session.experimental.assistivePrompt);
61 -}
62 -```
63 -</CodeBlocks>
64 -
65 -<Note>
66 -The `experimental` field is only available on sessions created with `create()`. Sessions retrieved with `use()` do not include the experimental data.
67 -</Note>
68 -
69 -### Toolkit Endpoint Method
70 -
71 -The toolkit retrieve response now includes `getCurrentUserEndpointMethod` (TypeScript) / `get_current_user_endpoint_method` (Python) to indicate the HTTP method for the current user endpoint.
72 -
73 -## Breaking Changes
74 -
75 -### Trigger Pagination: `page` Replaced with `cursor`
76 -
77 -The `page` parameter in `listActive` / `list_active` for trigger instances has been replaced with `cursor` for cursor-based pagination. There was a bug in earlier APIs which caused `page` param to be ignored, going ahead for pagination please use `cursor` instead.
78 -
79 -<CodeBlocks>
80 -```python title="Python SDK"
81 -# Before (deprecated)
82 -triggers = composio.triggers.list_active(page=1, limit=10)
83 -
84 -# After
85 -triggers = composio.triggers.list_active(cursor="cursor_string", limit=10)
86 -# Use response.next_cursor for the next page
87 -```
88 -
89 -```typescript title="TypeScript SDK"
90 -// Before (deprecated)
91 -const triggers = await composio.triggers.listActive({ page: 1, limit: 10 });
92 -
93 -// After
94 -const triggers = await composio.triggers.listActive({ cursor: "cursor_string", limit: 10 });
95 -// Use response.nextCursor for the next page
96 -```
97 -</CodeBlocks>
98 -
99 -## Impact Summary
100 -
101 -| Change | Runtime Breaking | TypeScript Breaking | Migration Required |
102 -|--------|------------------|---------------------|-------------------|
103 -| Experimental assistive prompts | No | No | No |
104 -| `getCurrentUserEndpointMethod` field | No | No | No |
105 -| `page` → `cursor` in triggers | Yes | Yes | Yes (if using `page`) |
106 -
107 -## Migration Guide
108 -
109 -If you are using the `page` parameter in `listActive` / `list_active`:
110 -
111 -1. Replace `page` with `cursor`
112 -2. For the first request, omit the `cursor` parameter or pass `undefined`/`None`
113 -3. Use the `nextCursor` / `next_cursor` from the response for subsequent requests
fern/pages/src/changelog/09-15-25.md deleted
-86
@@ -1,86 +0,0 @@
1 -# Introducing Composio Auth Links
2 -
3 -Composio Auth Links provide a **hosted authentication solution** that eliminates the need for developers to build custom authentication forms. Instead of manually rendering OAuth consent screens, API key input forms, or custom authentication fields, developers can simply redirect users to a Composio-hosted URL that handles the entire authentication process automatically.
4 -
5 -## Why Use Auth Links?
6 -
7 -- **Zero UI Development**: No need to build forms for OAuth, API keys, or custom fields like subdomains
8 -- **Universal Authentication**: Works seamlessly across all supported third-party services
9 -- **Reduced Complexity**: Replace complex OAuth flows with a simple redirect
10 -- **Better UX**: Professional, consistent authentication experience for end users
11 -- **Faster Integration**: Get authentication working in minutes, not hours
12 -
13 ----
14 -
15 -## Python SDK (v0.8.11)
16 -
17 -**Added**
18 -
19 -- **Composio Connect Link Support**: New `link()` method for creating external authentication links
20 - - Added `link()` method to `ConnectedAccounts` class for generating user authentication links
21 - - Support for callback URL redirection after authentication
22 - - Enhanced user experience with external link-based authentication flow
23 - - **No manual form rendering required** - Composio handles all authentication UI
24 -
25 -**Examples:**
26 -
27 -```python
28 -# Basic usage - create a connection request
29 -connection_request = composio.connected_accounts.link('user_123', 'auth_config_123')
30 -redirect_url = connection_request.redirect_url
31 -print(f"Visit: {redirect_url} to authenticate your account")
32 -
33 -# Wait for the connection to be established
34 -connected_account = connection_request.wait_for_connection()
35 -
36 -# With callback URL
37 -connection_request = composio.connected_accounts.link(
38 - 'user_123',
39 - 'auth_config_123',
40 - callback_url='<https://your-app.com/callback>'
41 -)
42 -
43 -```
44 -
45 -## TypeScript SDK (v0.1.51)
46 -
47 -**Added**
48 -
49 -- **Composio Connect Links**: Added support for composio connect links
50 - - New `link()` method in `ConnectedAccounts` class for generating authentication URLs
51 - - Support for callback URL redirection with `CreateConnectedAccountLinkOptions`
52 - - Comprehensive TypeScript types and validation for link creation options
53 - - **Eliminates need for custom authentication forms** - just redirect users to the link
54 -
55 -**Examples:**
56 -
57 -```tsx
58 -// Basic usage - create a connection request
59 -const connectionRequest = await composio.connectedAccounts.link('user_123', 'auth_config_123');
60 -const redirectUrl = connectionRequest.redirectUrl;
61 -console.log(`Visit: ${redirectUrl} to authenticate your account`);
62 -
63 -// Wait for the connection to be established
64 -const connectedAccount = await connectionRequest.waitForConnection();
65 -
66 -// With callback URL
67 -const connectionRequest = await composio.connectedAccounts.link('user_123', 'auth_config_123', {
68 - callbackUrl: '<https://your-app.com/callback>'
69 -});
70 -
71 -```
72 -
73 -## Key Benefits
74 -
75 -- **No Form Building**: Composio handles OAuth consent, API key collection, and custom field inputs
76 -- **Hosted Authentication Flow**: Professional UI that works across all supported services
77 -- **Callback URL Support**: Control where users return after successful authentication
78 -- **Connection Waiting**: Built-in polling to detect when authentication completes
79 -- **Cross-Platform Consistency**: Identical developer experience across Python and TypeScript
80 -
81 -## Customisation
82 -
83 -You can customise the app logo and name showed in the authentication page via the dashboard. Head over your project via `platform.composio.dev` and choose Settings → Auth Links to upload a new logo and change the name.
84 -
85 -## Migration Note
86 -This feature replaces manual authentication form development with a simple redirect-based approach, significantly reducing integration time and complexity while providing a better user experience. Auth links are drop in replacement for `composio.connectedAccounts.initate`, you can safely swap this to `composio.connectedAccounts.link`
\ No newline at end of file
fern/pages/src/changelog/09-16-25.md deleted
-123
@@ -1,123 +0,0 @@
1 -# Toolkit Versioning in SDKs
2 -
3 -Composio Toolkit Versioning provides **granular control over tool versions** across all your integrations. Instead of always using the latest version of tools, developers can now specify exact toolkit versions, ensuring consistent behavior and controlled updates in production environments.
4 -
5 -## Why Use Toolkit Versioning?
6 -
7 -- **Version Stability**: Pin specific toolkit versions to avoid unexpected changes in production
8 -- **Controlled Updates**: Test new toolkit versions before deploying to production
9 -- **Environment Consistency**: Ensure the same toolkit versions across development, staging, and production
10 -- **Rollback Capability**: Easily revert to previous toolkit versions if issues arise
11 -- **Fine-grained Control**: Set different versions for different toolkits based on your needs
12 -
13 ----
14 -
15 -## Python SDK (v0.8.11)
16 -
17 -**Added**
18 -
19 -- **Toolkit Versioning Support**: New `toolkit_versions` parameter for controlling tool versions
20 - - Added `toolkit_versions` parameter to `Composio` class initialization
21 - - Support for global version setting (e.g., `'latest'`)
22 - - Support for per-toolkit version mapping (e.g., `{'github': '20250902_00', 'slack': '20250902_00'}`)
23 - - Environment variable support with `COMPOSIO_TOOLKIT_VERSION_<TOOLKIT_NAME>` pattern
24 - - New `toolkit_version.py` utility module for version resolution logic
25 -
26 -**Examples:**
27 -
28 -```python
29 -# Global version for all toolkits, only `latest` is supported
30 -composio = Composio(toolkit_versions='latest')
31 -
32 -# Per-toolkit version mapping
33 -composio = Composio(toolkit_versions={
34 - 'github': '20250902_00',
35 - 'slack': '20250902_00',
36 - 'gmail': '20250901_01'
37 -})
38 -
39 -# Using environment variables
40 -# Set COMPOSIO_TOOLKIT_VERSION_GITHUB=20250902_00
41 -composio = Composio() # Automatically picks up env vars
42 -
43 -# Get tools with specific versions
44 -tools = composio.tools.get('default', {'toolkits': ['github']})
45 -```
46 -
47 -## TypeScript SDK (v0.1.52)
48 -
49 -**Added**
50 -
51 -- **Toolkit Versioning Support**: Added `toolkitVersions` configuration option
52 - - New `toolkitVersions` parameter in `Composio` class constructor
53 - - Support for global version string or per-toolkit version mapping
54 - - Environment variable parsing with `getToolkitVersionsFromEnv()` utility
55 - - Enhanced `getRawComposioToolBySlug()` method for version-specific tool retrieval
56 - - Version-aware tool filtering and search capabilities
57 -
58 -**Examples:**
59 -
60 -```typescript
61 -// Global version for all toolkits
62 -const composio = new Composio({
63 - toolkitVersions: '20250902_00'
64 -});
65 -
66 -// Per-toolkit version mapping
67 -const composio = new Composio({
68 - toolkitVersions: {
69 - 'github': '20250902_00',
70 - 'slack': '20250902_00',
71 - 'gmail': '20250901_01'
72 - }
73 -});
74 -
75 -// Using environment variables
76 -// Set COMPOSIO_TOOLKIT_VERSION_GITHUB=20250902_00
77 -const composio = new Composio(); // Automatically picks up env vars
78 -
79 -// Get specific tool version
80 -const tool = await composio.tools.getRawComposioToolBySlug(
81 - 'GITHUB_GET_REPO',
82 -);
83 -
84 -// Get tools with version-aware filtering
85 -const tools = await composio.tools.get('default', {
86 - toolkits: ['github'],
87 - limit: 10
88 -});
89 -```
90 -
91 -## Key Benefits
92 -
93 -- **Environment Variables**: Set `COMPOSIO_TOOLKIT_VERSION_<TOOLKIT_NAME>=<VERSION>` for automatic version resolution
94 -- **Flexible Configuration**: Choose between global versions or per-toolkit version mapping
95 -- **Backward Compatibility**: Existing code works unchanged - versioning is opt-in
96 -- **Version Fallback**: Automatically falls back to 'latest' when no version is specified
97 -- **Cross-Platform Consistency**: Identical developer experience across Python and TypeScript
98 -
99 -## Version Format
100 -
101 -Toolkit versions follow the format: `YYYYMMDD_NN` (e.g., `20250902_00`) or use `'latest'` for the most recent version only supported at global scope and not individual toolkit level.
102 -
103 -## Environment Variables
104 -
105 -```bash
106 -# Set specific versions for different toolkits
107 -export COMPOSIO_TOOLKIT_VERSION_GITHUB=20250902_00
108 -export COMPOSIO_TOOLKIT_VERSION_SLACK=20250902_00
109 -export COMPOSIO_TOOLKIT_VERSION_GMAIL=20250901_01
110 -```
111 -
112 -## Migration Note
113 -
114 -This feature is fully backward compatible. Existing code will continue to work without changes, using the latest versions by default. To enable versioning, simply add the `toolkit_versions` parameter during SDK initialization.
115 -
116 ----
117 -
118 -## Additional Updates
119 -
120 -- **Package Updates**: Bumped all Python provider packages to v0.8.10
121 -- **Documentation**: Enhanced API documentation with versioning examples
122 -- **Testing**: Added comprehensive test coverage (400+ new test cases) for versioning functionality
123 -- **Examples**: New versioning examples demonstrating practical usage patterns
fern/pages/src/changelog/09-26-25.md deleted
-511
@@ -1,511 +0,0 @@
1 -# MCP (Model Control Protocol) & Experimental ToolRouter
2 -
3 -Composio now introduces **comprehensive MCP (Model Control Protocol) support** and an **experimental ToolRouter** for creating isolated, scoped sessions with advanced toolkit management. These features enable seamless integration with modern AI frameworks and provide powerful session-based tool routing capabilities.
4 -
5 -## Why Use MCP & ToolRouter?
6 -
7 -- **Framework Integration**: Native MCP support for Vercel AI, Mastra, OpenAI Agents, and LangChain
8 -- **Session Isolation**: Create isolated sessions with specific toolkit configurations
9 -- **Advanced Authentication**: Flexible auth config management per toolkit
10 -- **Scoped Access**: Control which tools are available within each session
11 -- **Multi-Service Workflows**: Route tool calls efficiently across different services
12 -- **Development & Testing**: Perfect for testing and development with scoped MCP server access
13 -
14 -## TypeScript SDK (v0.1.53)
15 -
16 -### **Added: MCP API**
17 -
18 -**Core MCP Features:**
19 -- **MCP Server Creation**: Create and manage MCP server configurations
20 -- **User-Specific URLs**: Generate unique MCP server URLs for individual users
21 -- **Toolkit Configuration**: Support for multiple toolkits with custom auth configs
22 -- **Tool Filtering**: Specify allowed tools per configuration
23 -- **Connection Management**: Choose between manual and automatic account management
24 -
25 -**Basic Usage:**
26 -
27 -```typescript
28 -import { Composio } from '@composio/core';
29 -
30 -const composio = new Composio({
31 - apiKey: process.env.COMPOSIO_API_KEY,
32 -});
33 -
34 -// Create MCP configuration
35 -const mcpConfig = await composio.mcp.create('my-server-name', {
36 - toolkits: [
37 - { toolkit: 'github', authConfigId: 'ac_233434343' },
38 - { toolkit: 'gmail', authConfigId: 'ac_567890123' }
39 - ],
40 - allowedTools: ['GITHUB_CREATE_ISSUE', 'GMAIL_SEND_EMAIL'],
41 - manuallyManageConnections: false,
42 -});
43 -
44 -// Generate server instance for a user
45 -const serverInstance = await composio.mcp.generate('user123', mcpConfig.id);
46 -console.log('MCP URL:', serverInstance.url);
47 -```
48 -
49 -**Framework Integration Examples:**
50 -
51 -```typescript
52 -// Vercel AI Integration
53 -import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
54 -import { experimental_createMCPClient as createMCPClient } from 'ai';
55 -
56 -const mcpClient = await createMCPClient({
57 - name: 'composio-mcp-client',
58 - transport: new SSEClientTransport(new URL(serverInstance.url)),
59 -});
60 -
61 -// Mastra Integration
62 -import { MCPClient as MastraMCPClient } from '@mastra/mcp';
63 -
64 -const mcpClient = new MastraMCPClient({
65 - servers: {
66 - composio: { url: new URL(mcpSession.url) },
67 - },
68 -});
69 -
70 -// OpenAI Agents Integration
71 -import { hostedMcpTool } from '@openai/agents';
72 -
73 -const tools = [
74 - hostedMcpTool({
75 - serverLabel: 'composio',
76 - serverUrl: mcpSession.url,
77 - }),
78 -];
79 -```
80 -
81 -### **Added: Experimental ToolRouter**
82 -
83 -**Core ToolRouter Features:**
84 -- **Session-Based Routing**: Create isolated sessions for specific users and toolkit combinations
85 -- **Dynamic Configuration**: Configure toolkits and auth configs per session
86 -- **MCP Server URLs**: Each session gets a unique MCP server endpoint
87 -- **Flexible Toolkit Management**: Support for string names or detailed toolkit configurations
88 -- **Connection Control**: Manual or automatic connection management per session
89 -
90 -**Basic Usage:**
91 -
92 -```typescript
93 -// Create session with simple toolkit names
94 -const session = await composio.experimental.toolRouter.createSession('user_123', {
95 - toolkits: ['gmail', 'slack', 'github'],
96 -});
97 -
98 -// Create session with auth configs
99 -const session = await composio.experimental.toolRouter.createSession('user_456', {
100 - toolkits: [
101 - { toolkit: 'gmail', authConfigId: 'ac_gmail_work' },
102 - { toolkit: 'slack', authConfigId: 'ac_slack_team' },
103 - { toolkit: 'github', authConfigId: 'ac_github_personal' },
104 - ],
105 - manuallyManageConnections: true,
106 -});
107 -
108 -console.log('Session ID:', session.sessionId);
109 -console.log('MCP URL:', session.url);
110 -```
111 -
112 -**Advanced Multi-Service Integration:**
113 -
114 -```typescript
115 -// Complex workflow session
116 -const integrationSession = await composio.experimental.toolRouter.createSession('user_789', {
117 - toolkits: [
118 - { toolkit: 'gmail', authConfigId: 'ac_gmail_work' },
119 - { toolkit: 'slack', authConfigId: 'ac_slack_team' },
120 - { toolkit: 'github', authConfigId: 'ac_github_personal' },
121 - { toolkit: 'notion', authConfigId: 'ac_notion_workspace' },
122 - { toolkit: 'calendar', authConfigId: 'ac_gcal_primary' },
123 - ],
124 -});
125 -
126 -// Use with any MCP client
127 -const mcpClient = new MCPClient(integrationSession.url);
128 -```
129 -
130 -**Framework-Specific Examples:**
131 -
132 -```typescript
133 -// Mastra Integration
134 -const mcpSession = await composio.experimental.toolRouter.createSession(userId, {
135 - toolkits: ["gmail"],
136 - manuallyManageConnections: true,
137 -});
138 -
139 -const agent = new MastraAgent({
140 - name: 'Gmail Assistant',
141 - model: openai('gpt-4o-mini'),
142 - tools: await mcpClient.getTools(),
143 -});
144 -
145 -// OpenAI Agents Integration
146 -const tools = [
147 - hostedMcpTool({
148 - serverLabel: 'composio tool router',
149 - serverUrl: mcpSession.url,
150 - requireApproval: {
151 - never: { toolNames: ['GMAIL_FETCH_EMAILS'] },
152 - },
153 - }),
154 -];
155 -```
156 -
157 -
158 -
159 -## Python SDK (v0.8.17)
160 -
161 -### **Added: MCP Support**
162 -
163 -**Core MCP Features:**
164 -- **Server Configuration**: Create and manage MCP server configurations
165 -- **Toolkit Management**: Support for both simple toolkit names and detailed configurations
166 -- **Authentication Control**: Per-toolkit auth config specification
167 -- **Tool Filtering**: Specify allowed tools across all toolkits
168 -- **User Instance Generation**: Generate user-specific MCP server instances
169 -
170 -**Basic Usage:**
171 -
172 -```python
173 -from composio import Composio
174 -
175 -composio = Composio()
176 -
177 -# Create MCP server with toolkit configurations
178 -server = composio.mcp.create(
179 - 'personal-mcp-server',
180 - toolkits=[
181 - {
182 - 'toolkit': 'github',
183 - 'auth_config_id': 'ac_xyz',
184 - },
185 - {
186 - 'toolkit': 'slack',
187 - 'auth_config_id': 'ac_abc',
188 - },
189 - ],
190 - allowed_tools=['GITHUB_CREATE_ISSUE', 'SLACK_SEND_MESSAGE'],
191 - manually_manage_connections=False
192 -)
193 -
194 -# Generate server instance for a user
195 -mcp_instance = server.generate('user_12345')
196 -print(f"MCP URL: {mcp_instance['url']}")
197 -```
198 -
199 -**Simple Toolkit Usage:**
200 -
201 -```python
202 -# Using simple toolkit names
203 -server = composio.mcp.create(
204 - 'simple-mcp-server',
205 - toolkits=['composio_search', 'text_to_pdf'],
206 - allowed_tools=['COMPOSIO_SEARCH_DUCK_DUCK_GO_SEARCH', 'TEXT_TO_PDF_CONVERT_TEXT_TO_PDF']
207 -)
208 -
209 -# All tools from toolkits (default behavior)
210 -server = composio.mcp.create(
211 - 'all-tools-server',
212 - toolkits=['composio_search', 'text_to_pdf']
213 - # allowed_tools=None means all tools from these toolkits
214 -)
215 -```
216 -
217 -**LangChain Integration:**
218 -
219 -```python
220 -import asyncio
221 -from composio import Composio
222 -from langchain_mcp_adapters.client import MultiServerMCPClient
223 -from langgraph.prebuilt import create_react_agent
224 -
225 -composio = Composio()
226 -
227 -mcp_config = composio.mcp.create(
228 - name="langchain-slack-mcp",
229 - toolkits=[{"toolkit": "slack", "auth_config_id": "<auth-config-id>"}],
230 -)
231 -
232 -mcp_server = mcp_config.generate(user_id='<user-id>')
233 -
234 -client = MultiServerMCPClient({
235 - "composio": {
236 - "url": mcp_server["url"],
237 - "transport": "streamable_http",
238 - }
239 -})
240 -
241 -async def langchain_mcp(message: str):
242 - tools = await client.get_tools()
243 - agent = create_react_agent("openai:gpt-4.1", tools)
244 - response = await agent.ainvoke({"messages": message})
245 - return response
246 -
247 -response = asyncio.run(langchain_mcp("Show me 20 most used slack channels"))
248 -```
249 -
250 -### **Added: Experimental ToolRouter**
251 -
252 -**Core ToolRouter Features:**
253 -- **Session Management**: Create isolated tool routing sessions for users
254 -- **Toolkit Configuration**: Support for both simple toolkit names and detailed configurations
255 -- **Session Isolation**: Each session gets its own MCP URL and session ID
256 -- **Flexible Authentication**: Per-session auth config management
257 -- **Scoped Tool Access**: Control which tools are available within each session
258 -
259 -**Basic Usage:**
260 -
261 -```python
262 -from composio import Composio
263 -
264 -composio = Composio()
265 -
266 -# Create a tool router session
267 -session = composio.experimental.tool_router.create_session(
268 - user_id='user_123',
269 - toolkits=['github', 'slack'],
270 - manually_manage_connections=False
271 -)
272 -
273 -print(f"Session ID: {session['session_id']}")
274 -print(f"MCP URL: {session['url']}")
275 -```
276 -
277 -**Advanced Configuration:**
278 -
279 -```python
280 -# Create session with detailed toolkit configurations
281 -session = composio.experimental.tool_router.create_session(
282 - user_id='user_456',
283 - toolkits=[
284 - {
285 - 'toolkit': 'github',
286 - 'auth_config_id': 'ac_github_123'
287 - },
288 - {
289 - 'toolkit': 'slack',
290 - 'auth_config_id': 'ac_slack_456'
291 - }
292 - ],
293 - manually_manage_connections=True
294 -)
295 -
296 -# Minimal session (no specific toolkits)
297 -session = composio.experimental.tool_router.create_session(
298 - user_id='user_789'
299 -)
300 -```
301 -
302 -**Integration with AI Frameworks:**
303 -
304 -```python
305 -import asyncio
306 -from composio import Composio
307 -from langchain_mcp_adapters.client import MultiServerMCPClient
308 -
309 -composio = Composio()
310 -
311 -# Create tool router session
312 -session = composio.experimental.tool_router.create_session(
313 - user_id='ai_user',
314 - toolkits=['composio_search', 'text_to_pdf']
315 -)
316 -
317 -# Use with LangChain MCP client
318 -client = MultiServerMCPClient({
319 - "composio": {
320 - "url": session["url"],
321 - "transport": "streamable_http",
322 - }
323 -})
324 -
325 -async def use_tool_router():
326 - tools = await client.get_tools()
327 - # Use tools in your AI workflow
328 - return tools
329 -
330 -tools = asyncio.run(use_tool_router())
331 -```
332 -
333 -
334 -
335 -## Migration Guide
336 -
337 -### **TypeScript SDK: Migrating to New MCP API**
338 -
339 -The new MCP API provides enhanced functionality and better integration patterns. Here's how to migrate from the previous MCP implementation:
340 -
341 -#### **Before (Legacy MCP)**
342 -
343 -```typescript
344 -// Legacy MCP approach (still accessible via deprecated.mcp)
345 -import { Composio } from '@composio/core';
346 -
347 -const composio = new Composio();
348 -
349 -// Old MCP server creation
350 -const legacyMCP = await composio.deprecated.mcp.createServer({
351 - name: 'my-server',
352 - toolkits: ['github', 'gmail'],
353 -});
354 -
355 -// Direct URL usage
356 -const mcpUrl = legacyMCP.url;
357 -```
358 -
359 -#### **After (New MCP API)**
360 -
361 -```typescript
362 -// New MCP API approach
363 -import { Composio } from '@composio/core';
364 -
365 -const composio = new Composio({
366 - apiKey: process.env.COMPOSIO_API_KEY,
367 -});
368 -
369 -// Step 1: Create MCP configuration
370 -const mcpConfig = await composio.mcp.create('my-server', {
371 - toolkits: [
372 - { toolkit: 'github', authConfigId: 'ac_github_123' },
373 - { toolkit: 'gmail', authConfigId: 'ac_gmail_456' }
374 - ],
375 - allowedTools: ['GITHUB_CREATE_ISSUE', 'GMAIL_SEND_EMAIL'],
376 - manuallyManageConnections: false,
377 -});
378 -
379 -// Step 2: Generate user-specific server instance
380 -const serverInstance = await composio.mcp.generate('user_123', mcpConfig.id);
381 -const mcpUrl = serverInstance.url;
382 -```
383 -
384 -#### **Key Migration Changes**
385 -
386 -1. **Two-Step Process**:
387 - - **Before**: Single step server creation
388 - - **After**: Create configuration, then generate user instances
389 -
390 -2. **Enhanced Configuration**:
391 - - **Before**: Simple toolkit names only
392 - - **After**: Detailed toolkit configs with auth, tool filtering, connection management
393 -
394 -3. **User-Specific URLs**:
395 - - **Before**: Single server URL for all users
396 - - **After**: Unique URLs per user for better isolation
397 -
398 -4. **Backward Compatibility**:
399 - - **Legacy Access**: Old MCP functionality remains available via `composio.deprecated.mcp`
400 - - **Gradual Migration**: Migrate at your own pace without breaking existing implementations
401 -
402 -#### **Migration Benefits**
403 -
404 -- **Better Security**: User-specific sessions with isolated access
405 -- **Enhanced Control**: Fine-grained toolkit and tool management
406 -- **Framework Integration**: Native support for modern AI frameworks
407 -- **Scalability**: Better resource management and user isolation
408 -
409 -#### **Migration Timeline**
410 -
411 -- **Phase 1**: New MCP API available alongside legacy implementation
412 -- **Phase 2**: Legacy MCP accessible via `deprecated.mcp` namespace
413 -- **Phase 3**: Full deprecation (timeline to be announced)
414 -
415 -**Recommendation**: Start new projects with the new MCP API and gradually migrate existing implementations to benefit from enhanced features and better framework integration.
416 -
417 -
418 -## Key Benefits & Use Cases
419 -
420 -### **Development & Testing**
421 -- **Isolated Environments**: Test different toolkit combinations without affecting production
422 -- **Scoped Access**: Limit tool access for security and testing purposes
423 -- **Framework Flexibility**: Works with any MCP-compatible client or framework
424 -
425 -### **Production Workflows**
426 -- **Multi-Service Integration**: Seamlessly combine tools from different services
427 -- **User-Specific Sessions**: Each user gets their own isolated session with appropriate permissions
428 -- **Authentication Management**: Fine-grained control over authentication per toolkit
429 -
430 -### **Framework Compatibility**
431 -- **Vercel AI**: Native integration with Vercel AI SDK
432 -- **Mastra**: Full support for Mastra agents and workflows
433 -- **OpenAI Agents**: Direct integration with OpenAI's agent framework
434 -- **LangChain**: Complete LangGraph and LangChain compatibility
435 -- **Custom Clients**: Works with any MCP-compatible client
436 -
437 -### **Enterprise Features**
438 -- **Session Management**: Track and manage multiple user sessions
439 -- **Resource Control**: Limit concurrent sessions and resource usage
440 -- **Audit Trail**: Full logging and monitoring of tool usage
441 -- **Security**: Isolated sessions prevent cross-user data access
442 -
443 -
444 -## Migration & Compatibility
445 -
446 -Both MCP and ToolRouter features are designed to complement existing Composio functionality:
447 -
448 -```typescript
449 -// Can be used alongside regular tool management
450 -const regularTools = await composio.tools.get({ toolkits: ['github'] });
451 -const mcpSession = await composio.experimental.toolRouter.createSession(userId, {
452 - toolkits: ['gmail', 'slack']
453 -});
454 -
455 -// Both approaches can coexist and serve different purposes
456 -```
457 -
458 -The experimental ToolRouter API provides a preview of advanced session management capabilities, while the MCP API offers production-ready Model Control Protocol support for modern AI frameworks.
459 -
460 -
461 -
462 -## Bug Fixes
463 -
464 -### **Fixed: ToolRouter Dependency Issue**
465 -
466 -**Python SDK (v0.8.19)**
467 -
468 -**Issue Fixed:**
469 -- **ToolRouter Functionality**: Fixed ToolRouter tests that were failing due to missing `tool_router` attribute in HttpClient
470 -- **Dependency Update**: Updated `composio-client` dependency from version 1.9.1 to 1.10.0+ to include ToolRouter functionality
471 -- **Version Compatibility**: Resolved compatibility issues between ToolRouter implementation and client library
472 -
473 -**Details:**
474 -ToolRouter functionality was briefly broken in versions 0.8.15 to 0.8.18 due to a dependency version mismatch. The `composio-client` library version 1.9.1 did not include the `tool_router` attribute, causing all ToolRouter integration tests to fail with `AttributeError: 'HttpClient' object has no attribute 'tool_router'`.
475 -
476 -This has been fixed in version 0.8.19 by:
477 -- Updating the `composio-client` dependency to version 1.10.0+
478 -- Ensuring all ToolRouter functionality is now available
479 -- All ToolRouter integration tests now pass successfully
480 -
481 -**Previous Issue:**
482 -```python
483 -# This would fail in versions 0.8.15-0.8.18
484 -session = composio.experimental.tool_router.create_session(user_id='test')
485 -# AttributeError: 'HttpClient' object has no attribute 'tool_router'
486 -```
487 -
488 -**Fixed in 0.8.19:**
489 -```python
490 -# This now works correctly
491 -session = composio.experimental.tool_router.create_session(user_id='test')
492 -# Returns: {'session_id': '...', 'url': '...'}
493 -```
494 -
495 -### **Fixed: Missing Descriptions in Auth Config Fields**
496 -
497 -**Python SDK (v0.8.17) & TypeScript SDK (v0.1.53)**
498 -
499 -**Issue Fixed:**
500 -- **Auth Config Connection Fields**: Added missing descriptions to toolkit auth configuration connection fields
501 -- **Auth Config Creation Fields**: Added missing descriptions to toolkit auth configuration creation fields
502 -- **Field Documentation**: Improved field documentation and help text for better developer experience
503 -
504 -**Details:**
505 -Previously, when developers were setting up auth configurations for toolkits, many fields lacked proper descriptions, making it difficult to understand what information was required. This fix ensures all auth config fields now include:
506 -
507 -- Clear, descriptive field labels
508 -- Helpful placeholder text where appropriate
509 -- Detailed explanations of field requirements
510 -
511 -This improvement affects all toolkits and makes the authentication setup process more intuitive and error-free.
fern/pages/src/changelog/10-22-25.md deleted
-48
@@ -1,48 +0,0 @@
1 -## Adds Version Checks for Tool Execution and Improved Execution Speed in TS SDK
2 -
3 -### Summary
4 -Added version validation for manual tool execution to prevent unexpected behavior when using `latest` toolkit versions. This ensures users explicitly specify toolkit versions when executing tools manually, while allowing flexibility through a skip flag.
5 -
6 -This release also eliminates a lot of redundant API calls made to check connected account during tool execution, effectively increasing the performance of tool execution.
7 -
8 -### Key Changes
9 -
10 -#### Python SDK (`python/`)
11 -- ✅ Added `ToolVersionRequiredError` exception with detailed error messages and fix suggestions
12 -- ✅ Added `dangerously_skip_version_check` parameter to `execute()` method
13 -- ✅ Modified `_execute_tool()` to validate version is not `latest` unless skip flag is set
14 -- ✅ Automatically passes `dangerously_skip_version_check=True` for agentic provider flows
15 -- ✅ Added comprehensive test coverage (19 test methods) in `test_tool_execution.py`
16 -
17 -#### TypeScript SDK (`ts/packages/core/`)
18 -- ✅ Added `ComposioToolVersionRequiredError` error class with possible fixes
19 -- ✅ Added `dangerouslySkipVersionCheck` parameter to execute flow
20 -- ✅ Modified tool execution to validate version before API calls
21 -- ✅ Updated execution type definitions in `tool.types.ts` and `modifiers.types.ts`
22 -- ✅ Updated test files with date-based version format (`20251201_xx`)
23 -- ✅ Improved tool execution by eliminating redundant API calls
24 -
25 -### Behavior
26 -**Before:** Tools could be executed with `latest` version, risking unexpected behavior on toolkit updates
27 -
28 -**After:** Manual execution requires specific version or explicit skip flag:
29 -```python
30 -# ❌ Raises ToolVersionRequiredError
31 -tools.execute("GITHUB_CREATE_ISSUE", {...})
32 -
33 -# ✅ Works - explicit version
34 -tools.execute("GITHUB_CREATE_ISSUE", {...}, version="20251201_01")
35 -
36 -# ✅ Works - configured toolkit versions
37 -tools = Tools(client, provider, toolkit_versions={"github": "20251201_01"})
38 -
39 -# ✅ Works - with skip flag (use cautiously)
40 -tools.execute("GITHUB_CREATE_ISSUE", {...}, dangerously_skip_version_check=True)
41 -```
42 -
43 -### Breaking Changes
44 -⚠️ Manual tool execution without version specification now throws an error. Users must either:
45 -1. Pass explicit version parameter
46 -2. Configure toolkit versions in SDK initialization
47 -3. Set environment variable `COMPOSIO_TOOLKIT_VERSION_<TOOLKIT_SLUG>`
48 -4. Use `dangerously_skip_version_check=True` flag
\ No newline at end of file
fern/pages/src/changelog/11-05-25.md deleted
-57
@@ -1,57 +0,0 @@
1 -# Enhanced MCP URL Security Requirements
2 -
3 -We're introducing improved security requirements for Model Context Protocol (MCP) URLs to ensure better isolation between user connections and prevent unauthorized access.
4 -
5 -## What's Changing?
6 -
7 -Starting today, **all new Composio projects** must include at least one of the following parameters in their MCP URLs:
8 -- `user_id` - Identifies the specific user
9 -- `connected_account_id` - Identifies the specific connected account
10 -
11 -## Why This Matters
12 -
13 -This change ensures that:
14 -- **User Isolation**: Each user's connections remain completely separate from others
15 -- **Enhanced Security**: Prevents potential cross-user data access scenarios
16 -- **Better Multi-Tenancy**: Enables safer multi-tenant application architectures
17 -- **Explicit Access Control**: Forces developers to explicitly specify which user or account context they're operating in
18 -
19 -## Impact on Existing Projects
20 -
21 -**For existing projects**: We understand the importance of backward compatibility. While we've sent email notifications to project owners about upgrading their MCP URLs, your existing integrations will continue to work until **January 15th, 2026**.
22 -
23 -**Important**: After January 15th, 2026, MCP URLs without `user_id` or `connected_account_id` query parameters will no longer be supported. Please ensure you update your MCP URLs before this date to avoid service disruption.
24 -
25 -**Note**: If your MCP URLs already include either `user_id` or `connected_account_id` query parameters, no action is required—you can safely ignore this notice.
26 -
27 -## Implementation Example
28 -
29 -**Before:**
30 -```
31 -https://platform.composio.dev/v3/mcp/{id}
32 -```
33 -
34 -**After (with user_id):**
35 -```
36 -https://platform.composio.dev/v3/mcp/{id}?user_id=user_123
37 -```
38 -
39 -**After (with connected_account_id):**
40 -```
41 -https://platform.composio.dev/v3/mcp/{id}?connected_account_id=ca_xyz
42 -```
43 -
44 -## Migration Guide
45 -
46 -If you're using an existing project and want to adopt this security enhancement:
47 -
48 -1. Review your current MCP URL configuration
49 -2. Add either `user_id` or `connected_account_id` parameter to your URLs
50 -3. Update your application code to pass the appropriate identifier
51 -4. Test the updated URLs in your development environment
52 -
53 -For more details on choosing the right user identifiers for your application, see our [User Management documentation](https://docs.composio.dev/docs/user-management).
54 -
55 -## Questions?
56 -
57 -If you have any questions about this security enhancement or need assistance with migration, please reach out to our support team or check our [MCP documentation](#).
\ No newline at end of file
fern/pages/src/changelog/11-10-25.md deleted
-125
@@ -1,125 +0,0 @@
1 -# Toolkit Version Support for Triggers
2 -
3 -### Summary
4 -Added toolkit version support to trigger operations (`create` and `getType`) in both Python and TypeScript SDKs. This allows users to explicitly specify which toolkit version to use when creating trigger instances and retrieving trigger type information, ensuring consistent behavior across different toolkit versions.
5 -
6 -Trigger operations now respect the global `toolkitVersions` configuration set during Composio initialization, providing better control over which trigger versions are used in your applications.
7 -
8 -### Key Changes
9 -
10 -#### TypeScript SDK (`ts/packages/core/`)
11 -- Added `toolkit_versions` parameter to `triggers.create()` method
12 - - Passes the global toolkit versions configuration when creating trigger instances
13 - - Defaults to `'latest'` when no version is specified
14 -- Modified `triggers.getType()` to respect global toolkit versions
15 - - Now accepts toolkit version configuration to fetch trigger types for specific versions
16 - - Improved error messages to include version-related fixes
17 -- Updated trigger type documentation with comprehensive examples
18 -- Added behavior documentation explaining version usage patterns
19 -
20 -#### Python SDK (`python/composio/core/models/`)
21 -- Added `toolkit_versions` parameter to `triggers.create()` method
22 - - Uses global toolkit version configuration when creating trigger instances
23 - - Converts `None` to `omit` for API compatibility
24 -- Modified `triggers.get_type()` to respect toolkit versions
25 - - Implemented custom method replacing direct client binding
26 - - Passes toolkit version configuration to API calls
27 -- Added comprehensive docstrings explaining version behavior
28 -
29 -### Behavior
30 -
31 -**Creating Triggers with Toolkit Versions:**
32 -
33 -```typescript
34 -// TypeScript - Configure versions at initialization
35 -const composio = new Composio({
36 - apiKey: 'your-api-key',
37 - toolkitVersions: {
38 - gmail: '12082025_00',
39 - github: '10082025_01'
40 - }
41 -});
42 -
43 -// Create trigger - uses version '12082025_00' for Gmail
44 -const trigger = await composio.triggers.create('user@example.com', 'GMAIL_NEW_MESSAGE', {
45 - connectedAccountId: 'ca_abc123',
46 - triggerConfig: {
47 - labelIds: 'INBOX',
48 - userId: 'me',
49 - interval: 60,
50 - },
51 -});
52 -```
53 -
54 -```python
55 -# Python - Configure versions at initialization
56 -composio = Composio(
57 - api_key="your-api-key",
58 - toolkit_versions={"gmail": "12082025_00", "github": "10082025_01"}
59 -)
60 -
61 -# Create trigger - uses version '12082025_00' for Gmail
62 -trigger = composio.triggers.create(
63 - slug="GMAIL_NEW_MESSAGE",
64 - user_id="user@example.com",
65 - trigger_config={"labelIds": "INBOX", "userId": "me", "interval": 60}
66 -)
67 -```
68 -
69 -**Retrieving Trigger Types with Specific Versions:**
70 -
71 -```typescript
72 -// TypeScript
73 -const composio = new Composio({
74 - apiKey: 'your-api-key',
75 - toolkitVersions: { github: '10082025_01' }
76 -});
77 -
78 -// Get trigger type for specific version
79 -const triggerType = await composio.triggers.getType('GITHUB_COMMIT_EVENT');
80 -// Returns trigger type for version '10082025_01'
81 -```
82 -
83 -```python
84 -# Python
85 -composio = Composio(
86 - api_key="your-api-key",
87 - toolkit_versions={"github": "10082025_01"}
88 -)
89 -
90 -# Get trigger type for specific version
91 -trigger_type = composio.triggers.get_type("GITHUB_COMMIT_EVENT")
92 -# Returns trigger type for version '10082025_01'
93 -```
94 -
95 -### Benefits
96 -
97 -- **Version Control**: Explicitly specify which toolkit version to use for triggers
98 -- **Consistency**: Ensure trigger behavior remains consistent across toolkit updates
99 -- **Testing**: Test trigger integrations with specific versions before updating
100 -- **Debugging**: Easier to debug issues by pinning to specific toolkit versions
101 -- **Production Safety**: Avoid unexpected changes from automatic version updates
102 -
103 -### Migration Guide
104 -
105 -This is a **non-breaking change**. Existing code will continue to work with default behavior:
106 -
107 -**Before (still works):**
108 -```typescript
109 -// Uses 'latest' version by default
110 -const trigger = await composio.triggers.create('user', 'GITHUB_COMMIT_EVENT', {...});
111 -```
112 -
113 -**After (recommended for production):**
114 -```typescript
115 -// Explicitly configure versions for better control
116 -const composio = new Composio({
117 - apiKey: 'your-api-key',
118 - toolkitVersions: { github: '10082025_01' }
119 -});
120 -
121 -const trigger = await composio.triggers.create('user', 'GITHUB_COMMIT_EVENT', {...});
122 -```
123 -
124 -For more details on toolkit versioning, see the [Toolkit Versioning documentation](/docs/toolkit-versioning).
125 -
fern/pages/src/changelog/11-13-25.md deleted
-34
@@ -1,34 +0,0 @@
1 -# Required API Key Authentication for MCP URLs
2 -
3 -We're strengthening the security of Model Context Protocol (MCP) URLs by making API key authentication mandatory for all requests.
4 -
5 -## What's Changing?
6 -
7 -Starting **December 15th, 2025**, **all new Composio projects** must include the `x-api-key` header when making requests to MCP URLs. This header authenticates your application and ensures secure communication with the Composio platform.
8 -
9 -## Why This Matters
10 -
11 -This change provides:
12 -- **Enhanced Authentication**: Ensures only authorized applications can access MCP endpoints
13 -- **Industry Best Practices**: Aligns with standard API security patterns
14 -
15 -## Impact on Existing Projects
16 -
17 -**For existing projects**: We value backward compatibility and understand the need for a smooth transition. Your existing MCP URLs will continue to work without the `x-api-key` header until **April 15th, 2026**.
18 -
19 -**Important**: After April 15th, 2026, all MCP URL requests without the `x-api-key` header will be rejected. Please ensure you update your applications before this date to avoid service disruption.
20 -
21 -**Note**: If you're already passing the `x-api-key` header in your MCP requests, no action is required—you're all set!
22 -
23 -## Migration Guide
24 -
25 -To adopt this security enhancement in your existing projects:
26 -
27 -1. **Locate Your API Key**: Find your API key in the Composio dashboard under Project Settings
28 -2. **Update Your Code**: Add the `x-api-key` header to all MCP URL requests
29 -3. **Test Thoroughly**: Verify the updated requests work in your development environment
30 -4. **Deploy**: Roll out the changes to your production environment
31 -
32 -## Questions?
33 -
34 -If you have any questions about this security enhancement or need assistance with migration, please reach out to our support team or check our [MCP documentation](https://docs.composio.dev/docs/mcp).
\ No newline at end of file
fern/pages/src/changelog/12-03-25.md deleted
-22
@@ -1,22 +0,0 @@
1 -# Connected Account Expiration for Incomplete Connections
2 -
3 -We're implementing automatic expiration for connected accounts that remain in incomplete states, helping maintain a cleaner and more efficient authentication system.
4 -
5 -## What's Changing?
6 -
7 -Connected accounts in `Initializing` and `Initiated` states will now automatically expire after **10 minutes**. This applies to connection attempts that were started but never completed.
8 -
9 -## Why This Matters
10 -
11 -This change provides:
12 -- **Better Resource Management**: Automatically cleans up incomplete connection attempts
13 -- **Improved System Hygiene**: Prevents accumulation of stale, unused connection records
14 -- **Enhanced User Experience**: Reduces clutter from abandoned authentication flows
15 -
16 -<Note>
17 -This is a **non-breaking change**. Your existing integrations and completed connections will continue to work as expected. This change only affects connection attempts that are never completed.
18 -</Note>
19 -
20 -## Questions?
21 -
22 -If you have any questions about this change, please reach out to our support team or check our [Connected Accounts documentation](https://docs.composio.dev/docs/connected-accounts).
fern/pages/src/changelog/12-09-25.md deleted
-35
@@ -1,35 +0,0 @@
1 -# Transition to Self-Managed Credentials for Select Applications
2 -
3 -<Note>
4 -This is a **non-breaking change**. Your existing integrations will continue to work as expected. This change only affects new integrations with the applications listed below.
5 -</Note>
6 -
7 -## What's Changing?
8 -
9 -Starting today, the following applications will require **your own developer credentials** instead of Composio-managed credentials:
10 -
11 -- **Auth0**
12 -- **Blackbaud**
13 -- **BoldSign**
14 -- **Deel**
15 -- **Front**
16 -- **GoToWebinar**
17 -- **PagerDuty**
18 -- **Pipedrive**
19 -- **Shopify**
20 -- **Strava**
21 -- **SurveyMonkey**
22 -- **Webex**
23 -
24 -## What You Need to Do
25 -
26 -To continue using these applications with Composio:
27 -
28 -1. **Create Developer Accounts**: Register for developer accounts on the platforms you need
29 -2. **Generate API Credentials**: Create OAuth apps following each platform's documentation
30 -3. **Configure in Composio**: Add your credentials to Composio using [custom auth configs](https://docs.composio.dev/docs/custom-auth-configs)
31 -4. **Test Your Integration**: Test your integration with the new credentials
32 -
33 -<Note>
34 -All other Composio applications continue to work with Composio-managed credentials. This change only affects the 12 applications listed above.
35 -</Note>
fern/pages/src/changelog/12-10-25-labels-deprecation.md deleted
-15
@@ -1,15 +0,0 @@
1 -# Removal of label query parameter from connected accounts API
2 -
3 -The `label` query parameter has been removed from the `GET /api/v3/connected_accounts` endpoint.
4 -
5 -## What's changing?
6 -
7 -The `label` query parameter is no longer supported when listing connected accounts. This parameter was previously accepted but had no functional behavior since label ingestion was removed in an earlier update.
8 -
9 -## Impact
10 -
11 -**None** - This is a cleanup change. The `label` query parameter was not performing any filtering since the underlying label ingestion functionality was already removed. If your code was passing this parameter, it was being silently ignored.
12 -
13 -## Migration
14 -
15 -No action required. If your code was passing the `label` query parameter, you can safely remove it from your API calls.
fern/pages/src/changelog/12-10-25-masking.md deleted
-22
@@ -1,22 +0,0 @@
1 -## Enhanced Security Masking for Sensitive Fields
2 -
3 -We've improved the security masking for `REDACTED` fields in the following APIs:
4 -
5 -- [Get Connected Account](https://docs.composio.dev/rest-api/connected-accounts/get-connected-accounts-by-nanoid)
6 -- [List Connected Accounts](https://docs.composio.dev/rest-api/connected-accounts/get-connected-accounts)
7 -
8 -**What's Changed:**
9 -Sensitive fields are now partially masked, revealing only the **first 4 characters** to help with debugging while maintaining security.
10 -
11 -**Example:**
12 -```
13 -Before: REDACTED
14 -After: abcd...
15 -```
16 -
17 -### Disabling Masking
18 -
19 -If you need to disable masking for your use case, you have two options:
20 -
21 -1. **Via UI:** Navigate to **Project Settings** → **Configuration** tab and update the masking settings
22 -2. **Via API:** Use the [Patch Project Config API](https://docs.composio.dev/rest-api/projects/patch-org-project-config)
\ No newline at end of file
fern/pages/src/changelog/12-10-25.md deleted
-97
@@ -1,97 +0,0 @@
1 -# Typed Responses Across Toolkits
2 -
3 -We've updated many toolkits so their outputs are now strongly typed objects instead of a generic `response_data` blob, meaning tools like Outlook, HubSpot, Notion, etc. now return well-shaped, documented fields you can rely on directly in your code and agents. These improvements apply to the latest toolkit versions—see our [toolkit versioning docs](https://docs.composio.dev/docs/toolkit-versioning) for how versions are managed.
4 -
5 -<Callout intent="warn">
6 -**Breaking Change for `latest` Version**
7 -
8 -If you're using the `latest` version and your code post-processes the old `response_data` structure, you'll need to update your code to work with the new flattened, typed response schemas.
9 -</Callout>
10 -
11 -## Why This Matters
12 -- Better developer experience for direct execute: clear fields and types
13 -- Improved agent performance: flatter output shapes with explicit fields reduce nesting and invalid params
14 -- Clearer docs and type safety: richer metadata for IDEs and autocomplete
15 -
16 -<Accordion title="Impacted Toolkits (57 total)">
17 -
18 -### Communication & Collaboration
19 -discordbot, microsoft_teams, slack, zoom
20 -
21 -### CRM & Sales
22 -apollo, attio, hubspot, instantly, intercom, kommo, salesforce
23 -
24 -### Productivity & Docs
25 -coda, confluence, googledocs, googletasks, notion, todoist
26 -
27 -### Marketing & Social Media
28 -facebook, instagram, klaviyo, linkedin, metaads, reddit, tiktok
29 -
30 -### E-commerce & Payments
31 -brex, quickbooks, ramp, shopify, square, stripe, xero
32 -
33 -### Project Management
34 -clickup, linear
35 -
36 -### Design & Creative
37 -canva, figma
38 -
39 -### Data & Analytics
40 -ahrefs, airtable, apify, exa, pplx, serpapi, tavily
41 -
42 -### Email & Calendar
43 -calendly, outlook
44 -
45 -### Storage & Files
46 -one_drive
47 -
48 -### Web Tools
49 -firecrawl, fireflies, google_maps, google_search_console
50 -
51 -### AI & Media
52 -elevenlabs, heygen, lmnt, mem0
53 -
54 -### Customer Support
55 -freshdesk, zendesk
56 -
57 -### Video & Content
58 -youtube
59 -
60 -</Accordion>
61 -
62 -## Before vs After
63 -**Previous (generic, version `20251202_00`):**
64 -```json
65 -{
66 - "data": {
67 - "response_data": { "...": "..." }
68 - },
69 - "successful": true
70 -}
71 -```
72 -
73 -**Now (typed example – Outlook List Messages, version `20251209_00`):**
74 -```json
75 -{
76 - "data": {
77 - "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users('me')/messages",
78 - "@odata.nextLink": "https://graph.microsoft.com/v1.0/me/messages?$skip=10",
79 - "value": [
80 - {
81 - "id": "abc123",
82 - "subject": "Hi there",
83 - "from": { "emailAddress": { "address": "a@b.com", "name": "Alice" } },
84 - "hasAttachments": true
85 - }
86 - ]
87 - },
88 - "successful": true
89 -}
90 -```
91 -
92 -For the exact field mapping per toolkit, open `platform.composio.dev` → Toolkits → List Messages (or the relevant tool).
93 -
94 -## Migration Notes
95 -- Breaking change for consumers on the `latest` version who post-process the old nested `response_data` shape: outputs are now flattened and explicitly typed.
96 -- New and modified fields include richer descriptions and examples; some legacy placeholders were removed.
97 -- Re-fetch schemas for your tool/version to see the typed definitions. Use the toolkit view in `platform.composio.dev` for authoritative field details.
\ No newline at end of file
fern/pages/src/changelog/12-15-25.md deleted
-281
@@ -1,281 +0,0 @@
1 -# Tool Router is Generally Available in TS and PY SDKs
2 -
3 -**Release Date:** December 15, 2025
4 -**Python SDK Version:** 0.10.1
5 -**TypeScript SDK Version:** 0.3.0
6 -
7 -## Major Features Added
8 -
9 -### 1. Tool Router - Stable Release
10 -**Status:** Moved from experimental to stable production feature
11 -
12 -The Tool Router is now a fully supported feature that enables creating isolated MCP (Model Context Protocol) sessions for users with scoped access to toolkits and tools.
13 -
14 -**Key Capabilities:**
15 -- Create isolated sessions with specific toolkit configurations
16 -- Manage authentication flows for users across multiple toolkits
17 -- Access tools via MCP-compatible server URL
18 -- Query toolkit connection states
19 -- Integrate with multiple AI frameworks (OpenAI, Anthropic, LangChain, LlamaIndex, CrewAI, Vercel AI SDK)
20 -
21 -**Changes:**
22 -- Removed experimental warnings and deprecated MCP functionality
23 -- Updated all examples and documentation to reflect stable API
24 -- Both Python and TypeScript SDKs now have full Tool Router support
25 -
26 -**Files Modified:**
27 -- `python/composio/core/models/tool_router.py` - Major refactoring
28 -- `ts/packages/core/src/models/ToolRouter.ts` - Enhanced implementation
29 -- All tool router examples updated across both SDKs
30 -
31 -### 2. Native Tool Execution Support for Tool Router
32 -
33 -**Python SDK:**
34 -- Added native tool execution capabilities directly through Tool Router sessions
35 -- Enhanced `ToolRouterSession` with improved tool execution methods
36 -- Better integration with provider-wrapped tools
37 -
38 -**TypeScript SDK:**
39 -- Added native tool support for Tool Router sessions
40 -- Improved type safety and error handling
41 -- Enhanced `session.tools()` method for framework-specific tool objects
42 -
43 -**Impact:**
44 -- Users can now execute tools directly through Tool Router sessions without additional setup
45 -- Improved performance and reduced complexity
46 -- Better error handling and debugging capabilities
47 -
48 -### 3. Webhook Verification Feature
49 -
50 -**New Method:** `composio.triggers.verifyWebhook()`
51 -
52 -Added comprehensive webhook verification functionality for secure webhook handling:
53 -
54 -**Python SDK:**
55 -- New `verify_webhook()` method in `Triggers` class
56 -- Support for signature verification
57 -- Enhanced error handling with new exception types
58 -
59 -**TypeScript SDK:**
60 -- New `verifyWebhook()` method in `Triggers` class
61 -- Type-safe webhook verification
62 -- Comprehensive test coverage (592+ test cases)
63 -
64 -**Use Cases:**
65 -- Secure webhook endpoint validation
66 -- Signature verification for incoming webhooks
67 -- Enhanced security for trigger-based workflows
68 -
69 -### 4. LangChain v1 Support (Python SDK)
70 -
71 -**Upgrade:** Ported LangChain provider to support LangChain v1
72 -
73 -- Updated LangChain provider to work with LangChain v1 APIs
74 -- Improved compatibility and performance
75 -- Updated dependencies and examples
76 -
77 -**Files Modified:**
78 -- `python/providers/langchain/` - Complete v1 port
79 -- Updated demo scripts and documentation
80 -
81 -### 5. CommonJS Support Fixes (TypeScript SDK)
82 -
83 -**Major Fix:** Fixed CommonJS usage of `@composio/core`
84 -
85 -**Changes:**
86 -- Switched bundler from `tsup` to `tsdown` for better CommonJS compatibility
87 -- Added new CommonJS example (`ts/examples/cjs/`)
88 -- Fixed compatibility issues with Node.js CommonJS environments
89 -- Updated package configuration and build process
90 -
91 -**Impact:**
92 -- Better support for Node.js projects using CommonJS
93 -- Improved compatibility with various build tools
94 -- Enhanced developer experience
95 -
96 -
97 -## Improvements & Enhancements
98 -
99 -### TypeScript SDK Improvements
100 -
101 -1. **Type Safety Enhancements**
102 - - Fixed Parameters type in `@composio/ts-builders` package
103 - - Improved type inference for Tool Router sessions
104 - - Enhanced error type definitions
105 -
106 -2. **Error Handling**
107 - - Added `options` parameter to `ComposioMultipleConnectedAccountsError` constructor
108 - - Fixed typo in deprecate decorator error message
109 - - Standardized error codes (using `SDKErrorCodes.NO_API_KEY_PROVIDED`)
110 -
111 -3. **Telemetry Improvements**
112 - - Fixed telemetry duration calculation (now calculated after method execution)
113 - - Improved performance tracking accuracy
114 -
115 -4. **Dependency Updates**
116 - - Updated `zod-to-json-schema` to 3.25.0 (supports zod/3)
117 - - Removed package override in `.pnpmfile.cjs`
118 - - Fixed version range for zod peerDependency
119 -
120 -### Python SDK Improvements
121 -
122 -1. **Bug Fixes**
123 - - Fixed KeyError: 'type' when SUPABASE_BETA_RUN_SQL_QUERY is used with Agents
124 - - Fixed typo in `auth_scheme.status` property
125 - - Improved error handling and validation
126 -
127 -2. **Documentation**
128 - - Added changelog entries for new features
129 - - Updated examples and usage guides
130 - - Improved API documentation
131 -
132 -3. **Testing**
133 - - Added comprehensive tests for Tool Router functionality
134 - - Enhanced test coverage for connected accounts
135 - - Improved test reliability
136 -
137 -## Removed Features & Deprecations
138 -
139 -### Removed Features
140 -
141 -1. **Deprecated MCP Functionality**
142 - - Removed deprecated MCP methods and classes
143 - - Cleaned up experimental MCP code
144 - - Simplified API surface
145 -
146 -
147 -## Security & Quality Improvements
148 -
149 -1. **Security Audits**
150 - - Added `pnpm audit --prod` checks
151 - - Automated security vulnerability scanning
152 - - Improved dependency management
153 -
154 -2. **Code Quality**
155 - - Enhanced linting and type checking
156 - - Improved test coverage
157 - - Better error handling
158 -
159 -3. **Documentation Security**
160 - - Added webhook verification documentation
161 - - Improved security best practices guides
162 - - Enhanced API security documentation
163 -
164 -
165 -## Migration Guide
166 -
167 -### For Tool Router Users
168 -
169 -If you were using the experimental Tool Router API:
170 -
171 -**Before (Experimental):**
172 -```python
173 -# Old experimental API
174 -composio.experimental.tool_router.create(...)
175 -```
176 -
177 -**After (Stable):**
178 -```python
179 -# New stable API
180 -composio.create(...)
181 -```
182 -
183 -### For CommonJS Users (TypeScript)
184 -
185 -The CommonJS support has been significantly improved. If you were experiencing issues:
186 -
187 -1. Update to latest version: `@composio/core@1.0.0`
188 -2. Check the new CommonJS example: `ts/examples/cjs/`
189 -3. No code changes required - improved compatibility out of the box
190 -
191 -### For LangChain Users (Python)
192 -
193 -If you're using the LangChain provider:
194 -
195 -1. Update to LangChain v1
196 -2. Update Composio SDK to latest version
197 -3. Check updated examples in `python/providers/langchain/`
198 -
199 -
200 -## Bug Fixes
201 -
202 -### Python SDK
203 -- Fixed KeyError when using SUPABASE_BETA_RUN_SQL_QUERY with Agents
204 -- Fixed typo in `auth_scheme.status` property
205 -- Improved error handling for connected accounts
206 -- Fixed array parsing in JSON schema conversion
207 -
208 -### TypeScript SDK
209 -- Fixed CommonJS compatibility issues
210 -- Fixed Parameters type in ts-builders
211 -- Fixed telemetry duration calculation
212 -- Fixed error message typos
213 -- Improved error handling for multiple connected accounts
214 -
215 -
216 -## Package Updates
217 -
218 -### Python Packages
219 -- All provider packages updated to v0.10.0
220 -- Core SDK: `composio==0.10.0`
221 -- LangChain provider: Updated for v1 compatibility
222 -
223 -### TypeScript Packages
224 -- Core SDK: `@composio/core@0.3.0`
225 -- All provider packages updated
226 -- Dependencies updated for better compatibility
227 -
228 -
229 -## Next Steps
230 -
231 -### Recommended Actions
232 -
233 -1. **Update Dependencies**
234 - ```bash
235 - # Python
236 - pip install --upgrade composio
237 -
238 - # TypeScript
239 - npm install @composio/core@latest
240 - ```
241 -
242 -2. **Review Breaking Changes**
243 - - Tool Router API changes (experimental → stable)
244 - - Removed deprecated MCP methods
245 - - Updated LangChain provider requirements
246 -
247 -3. **Test Your Integration**
248 - - Run your test suites
249 - - Verify Tool Router functionality
250 - - Check webhook verification if applicable
251 -
252 -4. **Update Documentation**
253 - - Review API changes
254 - - Update code examples
255 - - Check migration guides
256 -
257 -## Contributors
258 -
259 -Thank you to all contributors who made this release possible:
260 -
261 -- Musthaq Ahamad (@haxzie)
262 -- Alberto Schiabel (@jkomyno)
263 -- Sushmitha Mallesh (@Sushmithamallesh)
264 -
265 -## Resources
266 -
267 -- **Documentation:** https://docs.composio.dev
268 -- **GitHub Repository:** https://github.com/composiohq/composio
269 -- **Issue Tracker:** https://github.com/composiohq/composio/issues
270 -
271 -
272 -## Notes
273 -
274 -- This is a major release with significant new features and improvements
275 -- Tool Router is now production-ready and recommended for all new projects
276 -- Python SDK is approaching v0.10.0 stable release
277 -- TypeScript SDK continues to improve with better CommonJS support
278 -- All changes are backward compatible where possible, with clear migration paths
279 -
280 -**For questions or support, please reach out through our GitHub issues or Support channels.**
281 -
fern/pages/src/changelog/12-16-25.md deleted
-59
@@ -1,59 +0,0 @@
1 -# Deprecation of `is_local_toolkit` Field and Removal of `is_local` Query Parameter
2 -
3 -We're cleaning up the Toolkits API by deprecating the `is_local_toolkit` response field and removing the `is_local` query parameter filter.
4 -
5 -## What's Changing?
6 -
7 -### Response Field: `is_local_toolkit` (Deprecated)
8 -
9 -The `is_local_toolkit` field in toolkit API responses is now **deprecated**. This field was originally intended to indicate whether a toolkit was local to a specific project, but it is no longer meaningful as no toolkits use this classification.
10 -
11 -**Affected Endpoints:**
12 -- `GET /api/v3/toolkits` - List toolkits
13 -- `GET /api/v3/toolkits/{slug}` - Get single toolkit
14 -- `GET /api/v3/toolkits/multi` - Get multiple toolkits
15 -
16 -The field will continue to be returned in API responses for backward compatibility, but it will always return `false`. It is marked as `deprecated: true` in the OpenAPI specification.
17 -
18 -### Query Parameter: `is_local` (Removed)
19 -
20 -The `is_local` query parameter filter has been **removed** from the following endpoints:
21 -- `GET /api/v3/toolkits`
22 -- `GET /api/v3/toolkits/multi`
23 -
24 -This parameter was used to filter toolkits by their local status, but since no toolkits are classified as local, it served no practical purpose.
25 -
26 -## Impact on Your Code
27 -
28 -### If You're Using the `is_local` Query Parameter
29 -
30 -**Before:**
31 -```typescript
32 -// This will no longer work
33 -const toolkits = await fetch('/api/v3/toolkits?is_local=true');
34 -```
35 -
36 -**After:**
37 -```typescript
38 -// Simply remove the is_local parameter
39 -const toolkits = await fetch('/api/v3/toolkits');
40 -```
41 -
42 -### If You're Reading the `is_local_toolkit` Response Field
43 -
44 -The field will continue to be present in responses but will always return `false`. You can safely ignore this field or remove any logic that depends on it.
45 -
46 -**Before:**
47 -```typescript
48 -const toolkit = await composio.toolkits.get('github');
49 -if (toolkit.is_local_toolkit) {
50 - // This condition will never be true
51 - handleLocalToolkit(toolkit);
52 -}
53 -```
54 -
55 -**After:**
56 -```typescript
57 -const toolkit = await composio.toolkits.get('github');
58 -// Remove is_local_toolkit checks - they're no longer meaningful
59 -```
fern/pages/src/changelog/12-19-25.md deleted
-54
@@ -1,54 +0,0 @@
1 -# Toolkit Deprecation: Streamlining Our Platform
2 -
3 -## What's Changed
4 -
5 -We're deprecating **60 toolkits** that currently have no supported actions. These toolkits will be reactivated once we add functional actions to them, ensuring you only see integrations that are ready to use.
6 -
7 -## Deprecated Toolkits
8 -
9 -The following toolkits are now deprecated:
10 -
11 -- `ACCELO`, `ADOBE`, `AERO_WORKFLOW`, `AMAZON`, `APEX27`
12 -- `APPOINTO`, `APPSFLYER`, `ATLASSIAN`, `AUTH0`, `AXONAUT`
13 -- `BATTLENET`, `BOLDSIGN`, `BRAINTREE`, `BREEZY_HR`, `BREX_STAGING`
14 -- `BRIGHTPEARL`, `BROWSERHUB`, `CUSTOMER_IO`, `DEEL`, `DRIP_JOBS`
15 -- `EPIC_GAMES`, `FACTORIAL`, `FITBIT`, `FRONT`, `GO_TO_WEBINAR`
16 -- `GURU`, `HELCIM`, `HIGHLEVEL`, `ICIMS_TALENT_CLOUD`, `IDEA_SCALE`
17 -- `KEAP`, `LASTPASS`, `LEVER_SANDBOX`, `LEXOFFICE`, `MANY_CHAT`
18 -- `MBOUM`, `MICROSOFT_TENANT`, `MOXIE`, `ONCEHUB`, `POPTIN`
19 -- `PRECORO`, `PRINTNODE`, `QUALAROO`, `RAVENSEOTOOLS`, `RING_CENTRAL`
20 -- `RIPPLING`, `SAGE`, `SALESFORCE_MARKETING_CLOUD`, `SEISMIC`, `SMARTRECRUITERS`
21 -- `TAPFORM`, `TERMINUS`, `TIMEKIT`, `TWITCH`, `VENLY`
22 -- `VERO`, `VISME`, `WAVE_ACCOUNTING`, `WIZ`, `ZOHO_DESK`
23 -
24 -## Impact on Your Integration
25 -
26 -### API Behavior Changes
27 -
28 -**List Toolkits Endpoint**
29 -
30 -The [GET /toolkits](https://docs.composio.dev/rest-api/toolkits/get-toolkits) endpoint will now exclude deprecated toolkits by default.
31 -
32 -**Need to see deprecated toolkits?** Use the new `include_deprecated` query parameter.
33 -
34 -### Backward Compatibility
35 -
36 -**Your existing integrations are safe.** All other endpoints continue to work with deprecated toolkits:
37 -
38 -- ✅ Retrieve the toolkit details
39 -- ✅ Create auth configurations
40 -- ✅ Manage connected accounts
41 -- ✅ Configure MCP Servers
42 -
43 -This ensures zero breaking changes to your current implementations.
44 -
45 -## Why This Matters
46 -
47 -This change helps you:
48 -- **Focus on working integrations** - No clutter from non-functional toolkits
49 -- **Avoid integration attempts** with toolkits that have no actions
50 -- **Better developer experience** with a cleaner, more actionable toolkit list
51 -
52 -## Questions?
53 -
54 -If you have questions or need support with any deprecated toolkit, reach out to our team or check our [documentation](https://docs.composio.dev).
\ No newline at end of file
fern/pages/src/changelog/12-22-25.md deleted
-45
@@ -1,45 +0,0 @@
1 -# Toolkit Deprecation: Removing Empty Toolkits
2 -
3 -## What's Changed
4 -
5 -We're deprecating **15 toolkits** that currently have no supported actions. These toolkits will be reactivated once we add functional actions to them, ensuring you only see integrations that are ready to use.
6 -
7 -## Deprecated Toolkits
8 -
9 -The following toolkits are now deprecated:
10 -
11 -- `BREATHEHR`, `DIXA`, `EGNYTE`, `EXPENSIFY`, `FREEAGENT`
12 -- `GUSTO`, `NUTSHELL`, `OPENNUTRITION`, `OYSTERHR`, `RAKUTEN`
13 -- `SALESFLARE`, `TEAMLEADER`, `WALGREENS`, `WHOOP`, `WIX`
14 -
15 -## Impact on Your Integration
16 -
17 -### API Behavior Changes
18 -
19 -**List Toolkits Endpoint**
20 -
21 -The [GET /toolkits](https://docs.composio.dev/rest-api/toolkits/get-toolkits) endpoint will now exclude deprecated toolkits by default.
22 -
23 -**Need to see deprecated toolkits?** Use the `include_deprecated` query parameter.
24 -
25 -### Backward Compatibility
26 -
27 -**Your existing integrations are safe.** All other endpoints continue to work with deprecated toolkits:
28 -
29 -- Retrieve the toolkit details
30 -- Create auth configurations
31 -- Manage connected accounts
32 -- Configure MCP Servers
33 -
34 -This ensures zero breaking changes to your current implementations.
35 -
36 -## Why This Matters
37 -
38 -This change helps you:
39 -- **Focus on working integrations** - No clutter from non-functional toolkits
40 -- **Avoid integration attempts** with toolkits that have no actions
41 -- **Better developer experience** with a cleaner, more actionable toolkit list
42 -
43 -## Questions?
44 -
45 -If you have questions or need support with any deprecated toolkit, reach out to our team or check our [documentation](https://docs.composio.dev).
fern/pages/src/changelog/12-26-25.md deleted
-89
@@ -1,89 +0,0 @@
1 -# Authentication Updates Across Multiple Toolkits
2 -
3 -We've updated authentication configurations for several toolkits to improve security, fix issues, and support additional deployment options.
4 -
5 -## Summary
6 -
7 -| Toolkit | Change Type | Action Required |
8 -|-------------|-------------|-----------------|
9 -| Ashby | Deprecated | No |
10 -| Freshdesk | Deprecated | No |
11 -| Freshservice | Deprecated | No |
12 -| Make | Breaking | New auth config + user reconnect |
13 -| Mixpanel | Fix | No |
14 -| Recall AI | Breaking | New auth config + user reconnect |
15 -| Relevance AI | Breaking | New auth config + user reconnect |
16 -| SmartRecruiters | Breaking | New auth config + user reconnect |
17 -| Supabase | Improvement | No |
18 -| Trello | Deprecated | No |
19 -| ZoomInfo | Deprecated | No |
20 -
21 -## Breaking Changes
22 -
23 -These toolkits had incorrect or outdated authentication configurations that needed fixing. We verified that active usage for these toolkits is practically zero before proceeding with these changes.
24 -
25 -**Impact**: Existing connections will stop working. You'll need to create new auth configs and ask affected users to reconnect.
26 -
27 -### Make
28 -
29 -Replaced region-based configuration with full base URL input. Users now provide the complete Make instance URL (e.g., `https://us2.make.com` or `https://us1.make.celonis.com`) instead of just a region code.
30 -
31 -### Recall AI
32 -
33 -Updated from region-based to full base URL configuration. Fixed field descriptions and metadata. Updated categories to AI/Productivity/Communication and added proper documentation links.
34 -
35 -### Relevance AI
36 -
37 -Simplified authentication by removing deprecated Project ID field. Added conditional mapping for region codes to API subdomains (AU→f1db6c, EU→d7b62b, US→bcbe5a). Region field now defaults to US.
38 -
39 -### SmartRecruiters
40 -
41 -Fixed OAuth configuration with correct SmartRecruiters endpoints. Added proper default scopes for candidates, jobs, and users. Enabled PKCE and added refresh token support.
42 -
43 -## Deprecated (Still Working)
44 -
45 -These changes introduce new auth methods while keeping old ones functional:
46 -
47 -### Ashby
48 -
49 -Added new API Key authentication scheme with automatic base64 encoding and proper authorization headers.
50 -
51 -**No Action Required**: Old Basic Auth method is deprecated but continues to work. Existing connections are unaffected.
52 -
53 -### Freshdesk
54 -
55 -Added new API Key authentication scheme requiring subdomain and API key with automatic base64 encoding.
56 -
57 -**No Action Required**: Old Basic Auth method is deprecated but continues to work. Existing connections are unaffected.
58 -
59 -### Freshservice
60 -
61 -Added new API Key authentication scheme requiring subdomain and API key with automatic base64 encoding.
62 -
63 -**No Action Required**: Old Basic Auth method is deprecated but continues to work. Existing connections are unaffected.
64 -
65 -### Trello
66 -
67 -Marked Bearer Token authentication as deprecated in favor of OAuth authentication.
68 -
69 -**No Action Required**: Old Bearer auth continues to function. OAuth is recommended for new connections.
70 -
71 -### ZoomInfo
72 -
73 -Added new OAuth2 authentication scheme with comprehensive scopes for contacts, companies, audiences, scoops, news, and intent data. Deprecated the old JWT-based Basic authentication. Password field now properly marked as secret.
74 -
75 -**No Action Required**: Old JWT auth continues to function. New connections will use OAuth2.
76 -
77 -## Non-Breaking Improvements
78 -
79 -### Mixpanel
80 -
81 -Fixed region mapping logic for data residency. Added proper conditional evaluation to map regions to correct API hosts (EU, India, or Standard). Region field is now optional and defaults to Standard server. Service account secret now properly marked as secret.
82 -
83 -**No Action Required**: Existing connections continue to work without changes.
84 -
85 -### Supabase
86 -
87 -Changed `base_url` field type from `auth_config_field` to `connection_field` for both OAuth and API Key schemes. Updated base action logic to respect user-provided base URLs, enabling support for self-hosted Supabase instances.
88 -
89 -**No Action Required**: Existing connections continue to work. Self-hosted instances now supported.
\ No newline at end of file
fern/pages/src/changelog/12-29-25.md deleted
-108
@@ -1,108 +0,0 @@
1 -# Authentication & Configuration Updates Across Multiple Toolkits
2 -
3 -## Summary
4 -
5 -This release includes significant authentication and configuration improvements across 16+ toolkits. The changes standardize Base URL handling, modernize authentication methods, and fix various endpoint configurations to improve reliability and flexibility.
6 -
7 -| Toolkit | Change Type | Description |
8 -|---------|-------------|-------------|
9 -| **Make** | Breaking | Removed Region field, replaced with Base URL |
10 -| **Linear** | Improvement | Base URL is no longer configurable |
11 -| **Kibana** | Improvement | Removed default value for Base URL |
12 -| **Insightly** | Fix | Added default value for Pod field |
13 -| **HelloBar** | Deprecated | Deprecated bearer authentication |
14 -| **Gong** | Fix | Added default value for Base URL |
15 -| **FormSite** | Deprecated | Deprecated bearer auth, added API key authentication |
16 -| **DataScope** | Fix | Fixed Get Current User Endpoint |
17 -| **D2L Brightspace** | Fix | Updated Get Current User Endpoint |
18 -| **ClickUp** | Fix | Changed Base URL field type |
19 -| **Bubble** | Breaking | Fixed Base URL field, removed Subdomain |
20 -| **Brilliant Directories** | Fix | Implemented dynamic Base URL for user endpoint |
21 -| **Braintree** | Improvement | Updated to production defaults with dynamic endpoints |
22 -| **Auth0** | Improvement | Replaced hardcoded endpoint with dynamic tenant Base URL |
23 -
24 -## Breaking Changes
25 -
26 -We verified that active usage for these toolkits is practically zero before proceeding with these changes.
27 -
28 -### Make Toolkit
29 -- **Removed Region field** in favor of explicit Base URL configuration
30 -- Users must now provide the full Base URL instead of selecting a region
31 -- This change provides more flexibility for custom deployments and regional endpoints
32 -
33 -### Bubble Toolkit
34 -- **Removed Subdomain field** and restructured Base URL handling
35 -- Users must now provide the complete Base URL instead of just the Subdomain
36 -- This change standardizes URL configuration across all toolkits
37 -
38 -## Deprecated Features
39 -
40 -### HelloBar Toolkit
41 -- **Bearer authentication is now deprecated**
42 -- While still functional, users are encouraged to migrate to newer authentication methods
43 -- Support for bearer tokens will be removed in a future release
44 -
45 -### FormSite Toolkit
46 -- **Bearer authentication deprecated** in favor of API key authentication
47 -- New integrations should use API key authentication for improved security
48 -- Existing bearer token implementations will continue to work but should be migrated
49 -
50 -## Improvements & Fixes
51 -
52 -### Configuration Improvements
53 -
54 -#### Linear Toolkit
55 -- Base URL is no longer a configurable field
56 -- The toolkit now uses a fixed endpoint, simplifying the authentication process
57 -
58 -#### Kibana Toolkit
59 -- Removed the default value for Base URL, allowing for more flexible deployment configurations
60 -- Users can now specify custom Kibana instances without overriding defaults
61 -
62 -#### Gong Toolkit
63 -- Added a sensible default value for Base URL to simplify initial setup
64 -- New users can connect without manually configuring the endpoint
65 -
66 -#### Insightly Toolkit
67 -- Added default value for the Pod field to streamline configuration
68 -- Reduces setup complexity for standard deployments
69 -
70 -#### ClickUp Toolkit
71 -- Fixed the Base URL field type for proper validation and handling
72 -- Ensures consistent URL formatting across all operations
73 -
74 -### Dynamic Endpoint Updates
75 -
76 -#### Brilliant Directories Toolkit
77 -- Implemented dynamic Base URL resolution for the Get Current User Endpoint
78 -- Automatically adapts to different deployment environments
79 -
80 -#### Braintree Toolkit
81 -- Updated configuration to use production defaults
82 -- Implemented dynamic endpoint resolution for better environment handling
83 -- Improved reliability for production deployments
84 -
85 -#### Auth0 Toolkit
86 -- Replaced hardcoded endpoints with dynamic tenant-based URL resolution
87 -- Supports multi-tenant deployments without manual configuration
88 -- Automatically constructs the correct endpoint based on the tenant configuration
89 -
90 -### Endpoint Fixes
91 -
92 -#### DataScope Toolkit
93 -- Fixed the Get Current User Endpoint to use the correct API path
94 -- Resolves authentication verification issues
95 -
96 -#### D2L Brightspace Toolkit
97 -- Updated the Get Current User Endpoint to match the latest API specifications
98 -- Ensures proper user identification and session validation
99 -
100 -## Migration Guide
101 -
102 -For toolkits with breaking changes, please update your configurations as follows:
103 -
104 -1. **Make**: Replace Region with the full Base URL (e.g., `https://us-east-1.make.com`)
105 -2. **Bubble**: Replace Subdomain with the full Base URL (e.g., `https://myapp.bubbleapps.io`)
106 -
107 -For deprecated authentication methods:
108 -- **HelloBar & FormSite**: Generate new API keys from your account settings and update your authentication configuration
fern/pages/src/changelog/12-30-25-proxy-binary-data.md deleted
-88
@@ -1,88 +0,0 @@
1 -## Binary Data Support for Proxy Execute
2 -
3 -The `/api/v3/tools/execute/proxy` endpoint now supports binary data for both file uploads and downloads.
4 -
5 -### File Uploads (`binary_body`)
6 -
7 -To upload a file via the proxy, use the `binary_body` field in your request payload. This supports two approaches: specifying either a URL pointing to the file or providing the base64-encoded content directly.
8 -
9 -#### Upload File via URL
10 -
11 -```bash
12 -curl --location 'https://backend.composio.dev/api/v3/tools/execute/proxy' \
13 - --header 'accept: application/json' \
14 - --header 'x-api-key: <YOUR_API_KEY>' \
15 - --header 'Content-Type: application/json' \
16 - --data '{
17 - "endpoint": "/upload-endpoint",
18 - "method": "POST",
19 - "connected_account_id": "<CONNECTED_ACCOUNT_ID>",
20 - "binary_body": {
21 - "url": "{URL_TO_THE_FILE}"
22 - }
23 - }'
24 -```
25 -
26 -#### Upload File via Base64 Content
27 -
28 -Supported up to 4MB file size.
29 -
30 -```bash
31 -curl --location 'https://backend.composio.dev/api/v3/tools/execute/proxy' \
32 - --header 'accept: application/json' \
33 - --header 'x-api-key: <YOUR_API_KEY>' \
34 - --header 'Content-Type: application/json' \
35 - --data '{
36 - "endpoint": "/upload-endpoint",
37 - "method": "POST",
38 - "connected_account_id": "<CONNECTED_ACCOUNT_ID>",
39 - "binary_body": {
40 - "base64": "JVBERi0xLjQKJ...<base64_data>...",
41 - "content_type": "application/pdf"
42 - }
43 - }'
44 -```
45 -
46 -### File Downloads (`binary_data`)
47 -
48 -When the proxied request returns a binary response (for example, a PDF or image), the proxy automatically uploads the file to temporary storage, and you receive a signed URL in the `binary_data` field. This enables you to download large files securely.
49 -
50 -#### File Download Request
51 -
52 -```bash
53 -curl --location 'https://backend.composio.dev/api/v3/tools/execute/proxy' \
54 - --header 'accept: application/json' \
55 - --header 'x-api-key: <YOUR_API_KEY>' \
56 - --header 'Content-Type: application/json' \
57 - --data '{
58 - "endpoint": "{YOUR_ENDPOINT}",
59 - "method": "GET",
60 - "connected_account_id": "{YOUR_CONNECTED_ACCOUNT_ID}"
61 - }'
62 -```
63 -
64 -#### File Download Response
65 -
66 -```json
67 -{
68 - "data": {},
69 - "binary_data": {
70 - "url": "url to the file",
71 - "content_type": "content type of the file",
72 - "size": "size of the file",
73 - "expires_at": "expires at of the file"
74 - },
75 - "status": "status code of the response",
76 - "headers": "headers of the response"
77 -}
78 -```
79 -
80 -### Summary
81 -
82 -| Feature | Field | Description |
83 -|---------|-------|-------------|
84 -| File Upload via URL | `binary_body.url` | Provide a URL pointing to the file to upload |
85 -| File Upload via Base64 | `binary_body.base64` + `binary_body.content_type` | Provide base64-encoded content (up to 4MB) |
86 -| File Download | `binary_data` in response | Receive a signed URL to download binary responses |
87 -
88 -We'd love your feedback on the new proxy execute capabilities. If anything feels unclear or you have suggestions for improvement, please reach out.
fern/pages/src/changelog/12-30-25.md deleted
-148
@@ -1,148 +0,0 @@
1 -## Lookahead Announcement
2 -
3 -We're introducing **Webhook Payload V3** - a redesigned webhook structure that follows industry standards and provides better developer experience. This update affects how you receive trigger events via webhooks and Pusher.
4 -
5 -## What's Changing?
6 -
7 -### New Webhook Structure
8 -
9 -We're adopting the [Standard Webhooks specification](https://github.com/standard-webhooks/standard-webhooks/blob/main/spec/standard-webhooks.md) for better consistency and reliability.
10 -
11 -#### Headers
12 -A new header will identify the webhook version:
13 -```
14 -x-composio-webhook-version: V3
15 -```
16 -
17 -#### Payload Structure
18 -The payload structure is being reorganized to separate Composio metadata from trigger data:
19 -
20 -**Before (V2):**
21 -```json
22 -{
23 - "log_id": "log_TpxVOLXYnwXZ",
24 - "timestamp": "2025-12-23T13:06:07.695Z",
25 - "type": "gmail_new_gmail_message",
26 - "data": {
27 - "connection_id": "a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
28 - "connection_nano_id": "ca_xYz9AbCdEfGh",
29 - "trigger_nano_id": "ti_JZFoTyYKbzhB",
30 - "trigger_id": "7f8e9d0c-1b2a-3c4d-5e6f-7a8b9c0d1e2f",
31 - "user_id": "usr-demo-12a3b4c5...",
32 - // ... actual trigger data mixed with metadata
33 - }
34 -}
35 -```
36 -
37 -**After (V3):**
38 -```json
39 -{
40 - "id": "msg_a1b2c3d4-5e6f-7a8b-9c0d-1e2f3a4b5c6d",
41 - "timestamp": "2025-12-23T13:06:07.695Z",
42 - "type": "composio.trigger.message",
43 - "metadata": {
44 - "log_id": "log_TpxVOLXYnwXZ",
45 - "trigger_slug": "GMAIL_NEW_GMAIL_MESSAGE",
46 - "auth_config_id": "ac_aCYTppZ5RsRc",
47 - "connected_account_id": "ca_cATYssZ5RrSc",
48 - "trigger_id": "ti_JZFoTyYKbzhB",
49 - "user_id": "pg-test-86c9fc84..."
50 - },
51 - "data": {
52 - // Clean trigger data without Composio metadata
53 - }
54 -}
55 -```
56 -
57 -### Key Improvements
58 -
59 -1. **Metadata Separation**: Composio-specific fields (connection IDs, trigger IDs, user IDs) are now in a dedicated `metadata` object
60 -2. **Clean Data**: The `data` field now contains only the actual trigger payload without infrastructure metadata
61 -3. **Standardized Type Field**: The `type` field now follows a consistent format (`composio.trigger.message`) instead of trigger-specific names like `gmail_new_gmail_message`
62 -4. **Trigger Slug in Metadata**: The trigger slug (e.g., `GMAIL_NEW_GMAIL_MESSAGE`) is now available in `metadata.trigger_slug` for easy identification
63 -5. **Standards Compliance**: Follows Standard Webhooks specification for better interoperability
64 -6. **Consistent Structure**: Same payload structure for both webhooks and Pusher channels
65 -
66 -## Migration Guide
67 -
68 -### Updating Your Webhook Handlers
69 -
70 -If you're accessing Composio metadata fields, update your code:
71 -
72 -```python
73 -# Before (V2)
74 -trigger_type = payload["type"] # "gmail_new_gmail_message"
75 -connection_id = payload["data"]["connection_id"]
76 -trigger_id = payload["data"]["trigger_id"]
77 -message_text = payload["data"]["message_text"]
78 -
79 -# After (V3)
80 -trigger_type = payload["type"] # "composio.trigger.message"
81 -trigger_slug = payload["metadata"]["trigger_slug"] # "GMAIL_NEW_GMAIL_MESSAGE"
82 -connection_id = payload["metadata"]["connected_account_id"]
83 -trigger_id = payload["metadata"]["trigger_id"]
84 -message_text = payload["data"]["message_text"]
85 -```
86 -
87 -```typescript
88 -// Before (V2)
89 -const triggerSlug = payload.type; // "gmail_new_gmail_message"
90 -const connectionId = payload.data.connection_id;
91 -const triggerId = payload.data.trigger_id;
92 -const messageText = payload.data.message_text;
93 -
94 -// After (V3)
95 -const webhookType = payload.type; // "composio.trigger.message"
96 -const triggerSlug = payload.metadata.trigger_slug; // "GMAIL_NEW_GMAIL_MESSAGE"
97 -const connectionId = payload.metadata.connected_account_id;
98 -const triggerId = payload.metadata.trigger_id;
99 -const messageText = payload.data.message_text;
100 -```
101 -
102 -### Checking Webhook Version
103 -
104 -You can detect the webhook version from headers:
105 -
106 -```python
107 -webhook_version = headers.get("x-composio-webhook-version", "V2")
108 -if webhook_version == "V3":
109 - # Use new structure
110 - metadata = payload["metadata"]
111 -else:
112 - # Use old structure
113 - metadata = payload["data"]
114 -```
115 -
116 -## Rollout Timeline
117 -
118 -- **December 2025**: V3 released, opt-in via project settings
119 -- **February 15, 2026**: All new organizations will default to V3
120 -- **Existing organizations**: Continue using V2 by default, can opt-in to V3 anytime
121 -
122 -## How to Opt-In
123 -
124 -1. Go to your project settings in the Composio dashboard
125 -2. Navigate to the Webhooks section
126 -3. Select "Webhook Payload Version: V3"
127 -4. Update your webhook handlers to use the new structure
128 -5. Test thoroughly before enabling in production
129 -
130 -<Note>
131 -Organizations created **before February 15, 2026** will remain on V2 by default. You can switch to V3 at your convenience.
132 -
133 -Organizations created **on or after February 15, 2026** will use V3 by default.
134 -</Note>
135 -
136 -## Benefits
137 -
138 -- **Better DX**: Clear separation between metadata and actual trigger data
139 -- **Standards Compliance**: Follows industry-standard webhook specifications
140 -- **Consistency**: Same structure across webhooks and Pusher channels
141 -- **Future-Proof**: Built on established standards for long-term compatibility
142 -
143 -## Need Help?
144 -
145 -If you have questions about migrating to V3 or need assistance:
146 -- Join our [Discord community](https://discord.gg/composio)
147 -- Check our [documentation](https://docs.composio.dev)
148 -- Contact support at support@composio.dev
fern/pages/src/changelog/12-31-25.md deleted
-36
@@ -1,36 +0,0 @@
1 -## Deprecating `BEARER_TOKEN` auth scheme for 19 toolkits
2 -
3 -We’ve **deprecated** the `BEARER_TOKEN` auth scheme for the following **19 toolkits**:
4 -
5 -- `Airtable`
6 -- `Discord`
7 -- `Discordbot`
8 -- `Gmail`
9 -- `Google Classroom`
10 -- `Google Search Console`
11 -- `Google Calendar`
12 -- `Google Docs`
13 -- `Google Drive`
14 -- `Google Slides`
15 -- `Google Super`
16 -- `Instagram`
17 -- `Ntfy`
18 -- `Sapling AI`
19 -- `Slack`
20 -- `Slackbot`
21 -- `Tawk To`
22 -- `TikTok`
23 -- `Twitter`
24 -
25 -### Recommendation
26 -
27 -For these toolkits, we recommend using **alternative auth schemes** (for example, `OAUTH2`, `API_KEY`, or other toolkit-supported schemes) instead of `BEARER_TOKEN`.
28 -
29 -### Backward compatibility (explicit)
30 -
31 -This change is **fully backward compatible**:
32 -
33 -- **Existing** auth configs and connected accounts created with `BEARER_TOKEN` **will continue to function**.
34 -- **Creating new** auth configs and connected accounts with `BEARER_TOKEN` **will continue to work** (e.g., via API/SDK).
35 -- To discourage new usage, `BEARER_TOKEN` auth configs / connected accounts **will not be displayed in the UI** for these toolkits.
36 -
fern/pages/src/examples/chat_applications/vercel_chat.mdx deleted
-300
@@ -1,300 +0,0 @@
1 ----
2 -title: Full Stack Chat App
3 -subtitle: Build a chat interface where users can connect and use their own apps
4 -image: "https://og.composio.dev/api/og?title=Full%20Stack%20Chat%20App" # image for socials
5 -keywords: ''
6 -hide-nav-links: false
7 ----
8 -
9 -In this example, you will learn how to build a chatbot that:
10 -
11 -- Lets users connect their various apps to the chatbot using the Composio SDK.
12 -- Uses the Vercel provider in the Composio SDK to handle and execute tool calls from the LLM.
13 -
14 -This page gives a high-level overview of the Composio SDK and how it is used in the
15 -GitHub repository: [composiohq/chat](https://github.com/composiohq/chat). You can
16 -find the demo live [here](https://chat.composio.dev/).
17 -
18 -## Prerequisites
19 -
20 -Ensure you've followed the README.md in the [composiohq/chat](https://github.com/composiohq/chat)
21 -repository to set up the project locally.
22 -
23 -## Creating auth configs
24 -
25 -For all the apps you want to connect to the chatbot, you need to create their
26 -respective auth configs. Learn how to create auth configs [here](/docs/authenticating-tools#creating-an-auth-config).
27 -Once done, your auth configs will be available in the [Composio dashboard](https://app.composio.dev/integrations).
28 -
29 -<Frame>
30 - <img src="../../../../assets/images/examples/auth-configs.png" alt="Auth configs" />
31 -</Frame>
32 -
33 -### Save auth config IDs to environment variables
34 -
35 -For this project, the auth config IDs should be saved to the environment variables
36 -with the `NEXT_PUBLIC_` prefix.
37 -
38 -```bash .env.local
39 -NEXT_PUBLIC_GMAIL_AUTH_CONFIG_ID=ac_1234567890
40 -NEXT_PUBLIC_GITHUB_AUTH_CONFIG_ID=ac_1234567890
41 -```
42 -
43 -## Create a Composio client instance
44 -
45 -We create a Composio client instance for server-side operations like API routes,
46 -server components, etc.
47 -
48 -```typescript lib/service/composio.ts
49 -import { Composio } from '@composio/core';
50 -import { VercelProvider } from '@composio/vercel';
51 -
52 -const composio = new Composio({
53 - apiKey: process.env.COMPOSIO_API_KEY,
54 - provider: new VercelProvider(),
55 -});
56 -
57 -export default composio;
58 -```
59 -
60 -## Creating an API for fetching toolkits
61 -
62 -The Composio SDK is meant to be used only in server-side code. For client-side
63 -functionality, we create API endpoints in the `/app/api/` directory. In order to
64 -list the toolkits and their connection status, we create a Next.js API route to
65 -fetch the toolkits using Composio SDK.
66 -
67 -<Frame>
68 - <img src="../../../../assets/images/examples/toolkits.png" />
69 -</Frame>
70 -
71 -### 1. Listing connected accounts
72 -
73 -First, we fetch all connected accounts for a user and create a mapping of toolkit
74 -slugs to their connection IDs:
75 -
76 -```typescript app/api/composio/toolkits.ts
77 -export async function GET() {
78 - // ... auth logic ...
79 -
80 - // List connected accounts to get connection IDs for each toolkit
81 - const connectedAccounts = await composio.connectedAccounts.list({
82 - userIds: [session.user.id],
83 - });
84 -
85 - const connectedToolkitMap = new Map();
86 - connectedAccounts.items.forEach(account => {
87 - connectedToolkitMap.set(account.toolkit.slug.toUpperCase(), account.id);
88 - });
89 -
90 - // ... continue with toolkit fetching ...
91 -}
92 -```
93 -
94 -### 2. Fetching toolkit data and building response
95 -
96 -Next, we fetch toolkit information for each supported toolkit and combine it with the connection status:
97 -
98 -```typescript app/api/composio/toolkits.ts
99 -export async function GET() {
100 - // ... auth logic ...
101 - // ... connected accounts mapping ...
102 -
103 - const SUPPORTED_TOOLKITS = ['GMAIL', 'GOOGLECALENDAR', 'GITHUB', 'NOTION'];
104 -
105 - // Fetch toolkit data from slugs
106 - const toolkitPromises = SUPPORTED_TOOLKITS.map(async slug => {
107 - const toolkit = await composio.toolkits.get(slug);
108 - const connectionId = connectedToolkitMap.get(slug.toUpperCase());
109 -
110 - return {
111 - name: toolkit.name,
112 - slug: toolkit.slug,
113 - description: toolkit.meta?.description,
114 - logo: toolkit.meta?.logo,
115 - categories: toolkit.meta?.categories,
116 - isConnected: !!connectionId,
117 - connectionId: connectionId || undefined,
118 - };
119 - });
120 -
121 - const toolkits = await Promise.all(toolkitPromises);
122 - return NextResponse.json({ toolkits });
123 -}
124 -```
125 -
126 -## Managing connections
127 -
128 -Users need to connect and disconnect their accounts from the chatbot to enable tool usage. When users click "Connect" on a toolkit, we initiate an OAuth flow, and when they click "Disconnect", we remove their connection.
129 -
130 -### 1. Initiating a connection
131 -
132 -When a user wants to connect their account, we create a connection request that redirects them to the OAuth provider:
133 -
134 -<Frame>
135 - <img src="../../../../assets/images/examples/create-connection.png" />
136 -</Frame>
137 -
138 -```typescript app/api/connections/initiate/route.ts
139 -export async function POST(request: Request) {
140 - // ... auth and validation ...
141 -
142 - const { authConfigId } = requestBody;
143 -
144 - // Initiate connection with Composio
145 - const connectionRequest = await composio.connectedAccounts.initiate(
146 - session.user.id,
147 - authConfigId
148 - );
149 -
150 - return NextResponse.json({
151 - redirectUrl: connectionRequest.redirectUrl,
152 - connectionId: connectionRequest.id,
153 - });
154 -}
155 -```
156 -
157 -### 2. Checking connection status
158 -
159 -After initiating a connection, we need to wait for the OAuth flow to complete. We check the connection status to know when it's ready to use:
160 -
161 -<Frame>
162 - <img src="../../../../assets/images/examples/connection-status.png" />
163 -</Frame>
164 -
165 -```typescript app/api/connections/status/route.ts
166 -export async function GET(request: Request) {
167 - // ... auth and validation ...
168 -
169 - const connectionId = searchParams.get('connectionId');
170 -
171 - // Wait for connection to complete
172 - const connection = await composio.connectedAccounts.waitForConnection(connectionId);
173 -
174 - return NextResponse.json({
175 - id: connection.id,
176 - status: connection.status,
177 - authConfig: connection.authConfig,
178 - data: connection.data,
179 - });
180 -}
181 -```
182 -
183 -### 3. Deleting a connection
184 -
185 -When a user wants to disconnect their account, we remove the connection using the connection ID:
186 -
187 -```typescript app/api/connections/delete/route.ts
188 -export async function DELETE(request: Request) {
189 - // ... auth and validation ...
190 -
191 - const connectionId = searchParams.get('connectionId');
192 -
193 - // Delete the connection
194 - await composio.connectedAccounts.delete(connectionId);
195 -
196 - return NextResponse.json({
197 - success: true,
198 - message: 'Connection deleted successfully',
199 - });
200 -}
201 -```
202 -
203 -## Working with tools
204 -
205 -Once users have connected their accounts, we need to track which toolkits are enabled and fetch the corresponding tools for the LLM.
206 -
207 -### 1. Tracking enabled toolkits
208 -
209 -We keep track of which toolkits the user has enabled in the chat interface:
210 -
211 -```typescript components/chat.tsx
212 -const { ... } = useChat({
213 - // ... other config ...
214 - experimental_prepareRequestBody: (body) => {
215 - // Get current toolbar state
216 - const currentToolbarState = toolbarStateRef.current;
217 - const enabledToolkits = Array.from(
218 - currentToolbarState.enabledToolkitsWithStatus.entries(),
219 - ).map(([slug, isConnected]) => ({ slug, isConnected }));
220 -
221 - return {
222 - // ... other fields ...
223 - enabledToolkits,
224 - };
225 - },
226 - // ... other handlers ...
227 - });
228 -```
229 -
230 -### 2. Fetching tools for enabled toolkits
231 -
232 -We fetch Composio tools based on the enabled toolkit slugs:
233 -
234 -```typescript lib/ai/tools/composio.ts
235 -export async function getComposioTools(userId: string, toolkitSlugs: string[]) {
236 - // ... validation ...
237 -
238 - const tools = await composio.tools.get(userId, {
239 - toolkits: toolkitSlugs,
240 - });
241 - return tools || {};
242 -}
243 -```
244 -
245 -```typescript app/api/chat.ts
246 -export async function POST(request: Request) {
247 - // ... auth and parsing ...
248 -
249 - const toolkitSlugs = enabledToolkits?.map(t => t.slug) || [];
250 -
251 - const composioTools = await getComposioTools(session.user.id, toolkitSlugs);
252 -
253 - const result = streamText({
254 - // ... model config ...
255 - tools: {
256 - ...composioTools,
257 - },
258 - });
259 -}
260 -```
261 -
262 -## Bonus: Creating custom component to show tool calls
263 -
264 -By default, tool calls appear as raw JSON in the chat interface. To create a better user experience, we can build custom components that display tool calls with proper formatting and loading states.
265 -
266 -<Frame>
267 - <img src="../../../../assets/images/examples/custom-tool-component.png" />
268 -</Frame>
269 -
270 -You can find the `ToolCall` component at `components/tool-call.tsx`. Here's how to integrate it into your message rendering:
271 -
272 -```typescript components/messages.tsx
273 -if (type === 'tool-invocation') {
274 - const { toolInvocation } = part;
275 - const { toolName, toolCallId, state, args, result } = toolInvocation;
276 -
277 - if (state === 'call') {
278 - return (
279 - <ToolCall
280 - key={toolCallId}
281 - toolName={toolName}
282 - args={args}
283 - isLoading={true}
284 - />
285 - );
286 - }
287 -
288 - if (state === 'result') {
289 - return (
290 - <ToolCall
291 - key={toolCallId}
292 - toolName={toolName}
293 - args={args}
294 - result={result}
295 - isLoading={false}
296 - />
297 - );
298 - }
299 -}
300 -```
fern/pages/src/examples/fast-api.mdx deleted
-401
@@ -1,401 +0,0 @@
1 ----
2 -title: Basic FastAPI Server
3 -subtitle: "Build a simple Gmail agent with Composio and FastAPI"
4 -image: "https://og.composio.dev/api/og?title=Basic%20FastAPI%20Server" # image for socials
5 -keywords: "fastapi, composio, openai, gmail, agent"
6 -hide-nav-links: false
7 ----
8 -
9 -This cookbook will guide you through building agents equipped with tools using `Composio`, `OpenAI`, and `FastAPI`.
10 -
11 -## Prerequisites
12 -
13 -* Python 3.10+
14 -* [UV](https://docs.astral.sh/uv/getting-started/installation/)
15 -* Composio API key
16 -* OpenAI API key
17 -
18 -## Building an AI agent that can interact with `gmail` service
19 -
20 -First, let's start with building a simple AI agent with Composio tools that lets the agent interact with `gmail`.
21 -
22 -```python
23 -from openai import OpenAI
24 -from composio import Composio
25 -from composio_openai import OpenAIProvider
26 -import os
27 -
28 -def run_gmail_agent(
29 - composio_client: Composio[OpenAIProvider],
30 - openai_client: OpenAI,
31 - user_id: str, # Composio uses the User ID to store and access user-level authentication tokens.
32 - prompt: str,
33 -):
34 - """
35 - Run the Gmail agent using composio and openai clients.
36 - """
37 - # Step 1: Fetch the necessary Gmail tools list with Composio
38 - tools = composio_client.tools.get(
39 - user_id=user_id,
40 - tools=[
41 - "GMAIL_FETCH_EMAILS",
42 - "GMAIL_SEND_EMAIL",
43 - "GMAIL_CREATE_EMAIL_DRAFT"
44 - ]
45 - )
46 -
47 - # Step 2: Use OpenAI to generate a response based on the prompt and available tools
48 - response = openai_client.chat.completions.create(
49 - model="gpt-4.1",
50 - tools=tools,
51 - messages=[{"role": "user", "content": prompt}],
52 - )
53 -
54 - # Step 3: Handle tool calls with Composio and return the result
55 - result = composio_client.provider.handle_tool_calls(response=response, user_id=user_id)
56 - return result
57 -```
58 -
59 -<Note>
60 -This example demonstrates a basic agent without state management or agentic loops,
61 -suitable for simple one-step tasks. For complex multi-step workflows requiring
62 -memory and iterative reasoning, see our cookbooks with frameworks like LangChain,
63 -CrewAI, or AutoGen.
64 -</Note>
65 -
66 -To invoke this agent, authenticate your users with Composio's managed authentication service.
67 -
68 -## Authenticating users
69 -
70 -
71 -To authenticate your users with Composio you need an authentication config for the given app. In this case you need one for gmail.
72 -
73 -To create an authentication config for `gmail` you need `client_id` and `client_secret` from your [Google OAuth Console](https://developers.google.com/identity/protocols/oauth2). Once you have the credentials, use the following piece of code to set up authentication for `gmail`.
74 -
75 -```python
76 -from composio import Composio
77 -from composio_openai import OpenAIProvider
78 -
79 -def create_auth_config(composio_client: Composio[OpenAIProvider]):
80 - """
81 - Create a auth config for the gmail toolkit.
82 - """
83 - client_id = os.getenv("GMAIL_CLIENT_ID")
84 - client_secret = os.getenv("GMAIL_CLIENT_SECRET")
85 - if not client_id or not client_secret:
86 - raise ValueError("GMAIL_CLIENT_ID and GMAIL_CLIENT_SECRET must be set")
87 -
88 - return composio_client.auth_configs.create(
89 - toolkit="GMAIL",
90 - options={
91 - "name": "default_gmail_auth_config",
92 - "type": "use_custom_auth",
93 - "auth_scheme": "OAUTH2",
94 - "credentials": {
95 - "client_id": client_id,
96 - "client_secret": client_secret,
97 - },
98 - },
99 - )
100 -```
101 -
102 -This will create a Gmail authentication config to authenticate your app’s users. Ideally, create one authentication object per project, so check for an existing auth config before creating a new one.
103 -
104 -```python
105 -def fetch_auth_config(composio_client: Composio[OpenAIProvider]):
106 - """
107 - Fetch the auth config for a given user id.
108 - """
109 - auth_configs = composio_client.auth_configs.list()
110 - for auth_config in auth_configs.items:
111 - if auth_config.toolkit == "GMAIL":
112 - return auth_config
113 -
114 - return None
115 -```
116 -
117 -<Note>
118 -Composio platform provides composio managed authentication for some apps to
119 -fast-track your development, `gmail` being one of them. You can use these
120 -default auth configs for development, but for production, always use your
121 -own oauth app configuration.
122 -</Note>
123 -
124 -Once you have authentication management in place, we can start with connecting your users to your `gmail` app. Let's implement a function to connect users to your `gmail` app via composio.
125 -
126 -```python
127 -from fastapi import FastAPI
128 -
129 -# Function to initiate a connected account
130 -def create_connection(composio_client: Composio[OpenAIProvider], user_id: str):
131 - """
132 - Create a connection for a given user id and auth config id.
133 - """
134 - # Fetch or create the auth config for the gmail toolkit
135 - auth_config = fetch_auth_config(composio_client=composio_client)
136 - if not auth_config:
137 - auth_config = create_auth_config(composio_client=composio_client)
138 -
139 - # Create a connection for the user
140 - return composio_client.connected_accounts.initiate(
141 - user_id=user_id,
142 - auth_config_id=auth_config.id,
143 - )
144 -
145 -# Setup FastAPI
146 -app = FastAPI()
147 -
148 -# Connection initiation endpoint
149 -@app.post("/connection/create")
150 -def _create_connection(
151 - request: CreateConnectionRequest,
152 - composio_client: ComposioClient,
153 -) -> dict:
154 - """
155 - Create a connection for a given user id.
156 - """
157 - # For demonstration, using a default user_id. Replace with real user logic in production.
158 - user_id = "default"
159 -
160 - # Create a new connection for the user
161 - connection_request = create_connection(composio_client=composio_client, user_id=user_id)
162 - return {
163 - "connection_id": connection_request.id,
164 - "redirect_url": connection_request.redirect_url,
165 - }
166 -```
167 -
168 -Now, you can make a request to this endpoint on your client app, and your user will get a URL which they can use to authenticate.
169 -
170 -## Set Up FastAPI service
171 -
172 -We will use [`FastApi`](https://fastapi.tiangolo.com/) to build an HTTP service that authenticates your users and lets them interact with your agent. This guide will provide best practices for using composio client in production environments.
173 -
174 -### Setup dependencies
175 -
176 -FastAPI allows [dependency injection](https://fastapi.tiangolo.com/reference/dependencies/) to simplify the usage of SDK clients that must be singletons. We recommend using composio SDK client as singleton.
177 -
178 -```python
179 -import os
180 -import typing_extensions as te
181 -
182 -from composio import Composio
183 -from composio_openai import OpenAIProvider
184 -
185 -from fastapi import Depends
186 -
187 -_composio_client: Composio[OpenAIProvider] | None = None
188 -
189 -def provide_composio_client():
190 - """
191 - Provide a Composio client.
192 - """
193 - global _composio_client
194 - if _composio_client is None:
195 - _composio_client = Composio(provider=OpenAIProvider())
196 - return _composio_client
197 -
198 -
199 -ComposioClient = te.Annotated[Composio, Depends(provide_composio_client)]
200 -"""
201 -A Composio client dependency.
202 -"""
203 -```
204 -
205 -Check [dependencies](./simple_gmail_agent/server/dependencies.py) module for more details.
206 -
207 -### Invoke agent via FastAPI
208 -
209 -When invoking an agent, make sure you validate the `user_id`.
210 -
211 -```python
212 -def check_connected_account_exists(
213 - composio_client: Composio[OpenAIProvider],
214 - user_id: str,
215 -):
216 - """
217 - Check if a connected account exists for a given user id.
218 - """
219 - # Fetch all connected accounts for the user
220 - connected_accounts = composio_client.connected_accounts.list(
221 - user_ids=[user_id],
222 - toolkit_slugs=["GMAIL"],
223 - )
224 -
225 - # Check if there's an active connected account
226 - for account in connected_accounts.items:
227 - if account.status == "ACTIVE":
228 - return True
229 -
230 - # Ideally you should not have inactive accounts, but if you do, delete them.
231 - print(f"[warning] inactive account {account.id} found for user id: {user_id}")
232 - return False
233 -
234 -def validate_user_id(user_id: str, composio_client: ComposioClient):
235 - """
236 - Validate the user id, if no connected account is found, create a new connection.
237 - """
238 - if check_connected_account_exists(composio_client=composio_client, user_id=user_id):
239 - return user_id
240 -
241 - raise HTTPException(
242 - status_code=404, detail={"error": "No connected account found for the user id"}
243 - )
244 -
245 -# Endpoint: Run the Gmail agent for a given user id and prompt
246 -@app.post("/agent")
247 -def _run_gmail_agent(
248 - request: RunGmailAgentRequest,
249 - composio_client: ComposioClient,
250 - openai_client: OpenAIClient, # OpenAI client will be injected as dependency
251 -) -> List[ToolExecutionResponse]:
252 - """
253 - Run the Gmail agent for a given user id and prompt.
254 - """
255 - # For demonstration, using a default user_id. Replace with real user logic in production.
256 - user_id = "default"
257 -
258 - # Validate the user id before proceeding
259 - user_id = validate_user_id(user_id=user_id, composio_client=composio_client)
260 -
261 - # Run the Gmail agent using Composio and OpenAI
262 - result = run_gmail_agent(
263 - composio_client=composio_client,
264 - openai_client=openai_client,
265 - user_id=user_id,
266 - prompt=request.prompt,
267 - )
268 - return result
269 -```
270 -
271 -<Note>
272 -Check [server](./simple_gmail_agent/server/) module for service implementation
273 -</Note>
274 -
275 -## Putting everything together
276 -
277 -So far, we have created an agent with ability to interact with `gmail` using the `composio` SDK, functions to manage connected accounts for users and a FastAPI service. Now let's run the service.
278 -
279 -<Note>
280 -Before proceeding, check the [code](./simple_gmail_agent/server/api.py) for utility endpoints not discussed in the cookbook
281 -</Note>
282 -
283 -
284 -1. Clone the repository
285 - ```bash
286 - git clone git@github.com:composiohq/composio-fastapi
287 - cd composio-fastapi/
288 - ```
289 -2. Setup environment
290 - ```bash
291 - cp .env.example .env
292 - ```
293 -
294 - Fill the api keys
295 - ```dotenv
296 - COMPOSIO_API_KEY=
297 - OPENAI_API_KEY=
298 - ```
299 -
300 - Create the virtual env
301 - ```bash
302 - make env
303 - source .venv/bin/activate
304 - ```
305 -3. Run the HTTP server
306 - ```bash
307 - uvicorn simple_gmail_agent.server.api:create_app --factory
308 - ```
309 -## Testing the API with curl
310 -
311 -Assuming the server is running locally on `http://localhost:8000`.
312 -
313 -### Check if a connection exists
314 -```bash
315 -curl -X POST http://localhost:8000/connection/exists
316 -```
317 -
318 -### Create a connection
319 -Note: The body fields are required by the API schema, but are ignored internally in this example service.
320 -```bash
321 -curl -X POST http://localhost:8000/connection/create \
322 - -H "Content-Type: application/json" \
323 - -d '{
324 - "user_id": "default",
325 - "auth_config_id": "AUTH_CONFIG_ID_FOR_GMAIL_FROM_THE_COMPOSIO_DASHBOARD"
326 - }'
327 -```
328 -Response includes `connection_id` and `redirect_url`. Complete the OAuth flow at the `redirect_url`.
329 -
330 -### Check connection status
331 -Use the `connection_id` returned from the create step.
332 -```bash
333 -curl -X POST http://localhost:8000/connection/status \
334 - -H "Content-Type: application/json" \
335 - -d '{
336 - "user_id": "default",
337 - "connection_id": "CONNECTION_ID_FROM_CREATE_RESPONSE"
338 - }'
339 -```
340 -
341 -### Run the Gmail agent
342 -Requires an active connected account for the `default` user.
343 -```bash
344 -curl -X POST http://localhost:8000/agent \
345 - -H "Content-Type: application/json" \
346 - -d '{
347 - "user_id": "default",
348 - "prompt": "Summarize my latest unread emails from the last 24 hours."
349 - }'
350 -```
351 -
352 -### Fetch emails (direct action)
353 -```bash
354 -curl -X POST http://localhost:8000/actions/fetch_emails \
355 - -H "Content-Type: application/json" \
356 - -d '{
357 - "user_id": "default",
358 - "limit": 5
359 - }'
360 -```
361 -
362 -These examples are intended solely for testing purposes.
363 -
364 -## Using Composio for managed auth and tools
365 -
366 -Composio reduces boilerplate for building AI agents that access and use various apps. In this cookbook, to build Gmail integration without Composio, you would have to write code to
367 -
368 -- manage Gmail OAuth app
369 -- manage user connections
370 -- tools for your agents to interact with Gmail
371 -
372 -Using Composio simplifies all of the above to a few lines of code as shown in the cookbook.
373 -
374 -## Best practices
375 -
376 -**🎯 Effective Prompts**:
377 -- Be specific: "Send email to john@company.com about tomorrow's 2pm meeting" works better than "send email"
378 -- Include context: "Reply to Sarah's email about the budget with our approval"
379 -- Use natural language: The agent understands conversational requests
380 -
381 -**🔒 User Management**:
382 -- Use unique, consistent `user_id` values for each person
383 -- Each user maintains their own Gmail connection
384 -- User IDs can be email addresses, usernames, or any unique identifier
385 -
386 -
387 -## Troubleshooting
388 -
389 -**Connection Issues**:
390 -- Ensure your `.env` file has valid `COMPOSIO_API_KEY` and `OPENAI_API_KEY`
391 -- Check if the user has completed Gmail authorization.
392 -- Verify the user_id matches exactly between requests
393 -
394 -**API Errors**:
395 -- Check the server logs for detailed error messages
396 -- Ensure request payloads match the expected format
397 -- Visit `/docs` endpoint for API schema validation
398 -
399 -**Gmail API Limits**:
400 -- Gmail has rate limits; the agent will handle these gracefully
401 -- For high-volume usage, consider implementing request queuing
fern/pages/src/examples/hono.mdx deleted
-423
@@ -1,423 +0,0 @@
1 ----
2 -title: Basic Hono Server
3 -subtitle: Build a Gmail agent HTTP service with Hono
4 -image: "https://og.composio.dev/api/og?title=Basic%20Hono%20Server" # image for socials
5 -keywords: "hono, composio, openai, gmail, agent"
6 -hide-nav-links: false
7 -description: Build a simple Gmail agent with Composio and Hono.js
8 ----
9 -
10 -With Composio's managed authentication and tool calling, it's easy to build
11 -AI agents that interact with the real world while reducing boilerplate for
12 -setup and authentication management. This cookbook will guide you through
13 -building and serving agents using `Composio`, `OpenAI`, and `Hono.js`.
14 -
15 -## Prerequisites
16 -
17 -* Node.js 18.x or higher
18 -* npm or yarn package manager
19 -* Composio API key
20 -* OpenAI API key
21 -* Basic knowledge of OAuth
22 -* Understanding of building HTTP services (preferably using Hono.js)
23 -
24 -## Building an AI agent that can interact with `gmail` service
25 -
26 -First, let's start with building a simple AI agent embedded with tools from
27 -Composio that lets the agent interact with the `gmail` service.
28 -
29 -```typescript
30 -import { OpenAI } from 'openai';
31 -import { Composio } from '@composio/core';
32 -import { OpenAIProvider } from '@composio/openai';
33 -
34 -export async function runGmailAgent(
35 - composioClient: Composio<OpenAIProvider>,
36 - openaiClient: OpenAI,
37 - userId: string, // Composio uses the User ID to store and access user-level authentication tokens.
38 - prompt: string,
39 -): Promise<any[]> {
40 - // Step 1: Fetch the necessary Gmail tools list with Composio
41 - const tools = await composioClient.tools.get(
42 - userId,
43 - {
44 - tools: [
45 - "GMAIL_FETCH_EMAILS",
46 - "GMAIL_SEND_EMAIL",
47 - "GMAIL_CREATE_EMAIL_DRAFT"
48 - ]
49 - }
50 - );
51 -
52 - // Step 2: Use OpenAI to generate a response based on the prompt and available tools
53 - const response = await openaiClient.chat.completions.create({
54 - model: "gpt-4.1",
55 - tools,
56 - messages: [{ role: "user", content: prompt }],
57 - });
58 -
59 - // Step 3: Handle tool calls with Composio and return the result
60 - const result = await composioClient.provider.handleToolCalls(
61 - userId,
62 - response
63 - );
64 - return result;
65 -}
66 -```
67 -
68 -<Note>
69 - This is a simple agent without state management and agentic loop implementation,
70 - so the agent can't perform complicated tasks. If you want to understand how
71 - composio can be used with agentic loops, check other cookbooks with more
72 - agentic frameworks.
73 -</Note>
74 -
75 -To invoke this agent, authenticate your users with Composio's managed authentication service.
76 -
77 -## Authenticating users
78 -
79 -To authenticate your users with Composio you need an authentication config for the given app. In this case you need one for gmail.
80 -
81 -To create an authentication config for `gmail` you need `client_id` and `client_secret` from your [Google OAuth Console](https://developers.google.com/identity/protocols/oauth2). Once you have the credentials, use the following piece of code to set up authentication for `gmail`.
82 -
83 -```typescript
84 -import { Composio } from '@composio/core';
85 -import { OpenAIProvider } from '@composio/openai';
86 -
87 -export async function createAuthConfig(composioClient: Composio<OpenAIProvider>) {
88 - /**
89 - * Create a auth config for the gmail toolkit.
90 - */
91 - const clientId = process.env.GMAIL_CLIENT_ID;
92 - const clientSecret = process.env.GMAIL_CLIENT_SECRET;
93 - if (!clientId || !clientSecret) {
94 - throw new Error("GMAIL_CLIENT_ID and GMAIL_CLIENT_SECRET must be set");
95 - }
96 -
97 - return composioClient.authConfigs.create(
98 - "GMAIL",
99 - {
100 - "name": "default_gmail_auth_config",
101 - "type": "use_custom_auth",
102 - "authScheme": "OAUTH2",
103 - "credentials": {
104 - "clientId": clientId,
105 - "clientSecret": clientSecret,
106 - },
107 - },
108 - );
109 -}
110 -```
111 -
112 -This will create a Gmail authentication config to authenticate your app's users. Ideally, create one authentication object per project, so check for an existing auth config before creating a new one.
113 -
114 -```typescript
115 -export async function fetchAuthConfig(composioClient: Composio<OpenAIProvider>) {
116 - /**
117 - * Fetch the auth config for a given user id.
118 - */
119 - const authConfigs = await composioClient.authConfigs.list();
120 - for (const authConfig of authConfigs.items) {
121 - if (authConfig.toolkit.slug === "gmail") {
122 - return authConfig;
123 - }
124 - }
125 -
126 - return null;
127 -}
128 -```
129 -
130 -<Note>
131 - Composio platform provides composio managed authentication for some apps to
132 - fast-track your development, `gmail` being one of them. You can use these
133 - default auth configs for development, but for production, always use your
134 - own oauth app configuration.
135 -</Note>
136 -
137 -Once you have authentication management in place, we can start with connecting your users to your `gmail` app. Let's implement a function to connect users to your `gmail` app via composio.
138 -
139 -```typescript
140 -import { Hono } from 'hono';
141 -
142 -// Function to initiate a connected account
143 -export async function createConnection(composioClient: Composio<OpenAIProvider>, userId: string) {
144 - /**
145 - * Create a connection for a given user id and auth config id.
146 - */
147 - // Fetch or create the auth config for the gmail toolkit
148 - let authConfig = await fetchAuthConfig(composioClient);
149 - if (!authConfig) {
150 - authConfig = await createAuthConfig(composioClient);
151 - }
152 -
153 - // Create a connection for the user
154 - return composioClient.connectedAccounts.initiate(
155 - userId,
156 - authConfig.id,
157 - );
158 -}
159 -
160 -// Setup Hono
161 -const app = new Hono();
162 -
163 -// Connection initiation endpoint
164 -app.post("/connection/create", async (c) => {
165 - /**
166 - * Create a connection for a given user id.
167 - */
168 - // For demonstration, using a default user_id. Replace with real user logic in production.
169 - const userId = "default";
170 -
171 - // Create a new connection for the user
172 - const connectionRequest = await createConnection(composioClient, userId);
173 - return c.json({
174 - "connection_id": connectionRequest.id,
175 - "redirect_url": connectionRequest.redirectUrl,
176 - });
177 -});
178 -```
179 -
180 -Now, you can make a request to this endpoint on your client app, and your user will get a URL which they can use to authenticate.
181 -
182 -## Set Up Hono service
183 -
184 -We will use [`Hono.js`](https://hono.dev/) to build an HTTP service that authenticates your users and lets them interact with your agent. This guide will provide best practices for using composio client in production environments.
185 -
186 -### Setup dependencies
187 -
188 -Hono allows dependency injection patterns to simplify the usage of SDK clients that must be singletons. We recommend using composio SDK client as singleton.
189 -
190 -```typescript
191 -import { Composio } from '@composio/core';
192 -import { OpenAIProvider } from '@composio/openai';
193 -import { OpenAI } from 'openai';
194 -
195 -let _composioClient: Composio<OpenAIProvider> | null = null;
196 -
197 -export function provideComposioClient(): Composio<OpenAIProvider> {
198 - /**
199 - * Provide a Composio client.
200 - */
201 - if (_composioClient === null) {
202 - _composioClient = new Composio({
203 - provider: new OpenAIProvider()
204 - });
205 - }
206 - return _composioClient;
207 -}
208 -
209 -// A Composio client dependency.
210 -export type ComposioClient = Composio<OpenAIProvider>;
211 -```
212 -
213 -Check [config/composio.ts](./src/config/composio.ts) module for more details.
214 -
215 -### Invoke agent via Hono
216 -
217 -When invoking an agent, make sure you validate the `user_id`.
218 -
219 -```typescript
220 -export function checkConnectedAccountExists(
221 - composioClient: Composio<OpenAIProvider>,
222 - userId: string,
223 -): Promise<boolean> {
224 - /**
225 - * Check if a connected account exists for a given user id.
226 - */
227 - // Fetch all connected accounts for the user
228 - return composioClient.connectedAccounts.list({ userIds: [userId], toolkitSlugs: ["GMAIL"] }).then(connectedAccounts => {
229 -
230 - // Check if there's an active connected account
231 - for (const account of connectedAccounts.items) {
232 - if (account.status === "ACTIVE") {
233 - return true;
234 - }
235 -
236 - // Ideally you should not have inactive accounts, but if you do, delete them.
237 - console.log(`[warning] inactive account ${account.id} found for user id: ${userId}`);
238 - }
239 - return false;
240 - });
241 -}
242 -
243 -export async function validateUserId(userId: string, composioClient: ComposioClient): Promise<string> {
244 - /**
245 - * Validate the user id, if no connected account is found, create a new connection.
246 - */
247 - if (await checkConnectedAccountExists(composioClient, userId)) {
248 - return userId;
249 - }
250 -
251 - throw new Error("No connected account found for the user id");
252 -}
253 -
254 -// Endpoint: Run the Gmail agent for a given user id and prompt
255 -app.post("/agent", async (c) => {
256 - /**
257 - * Run the Gmail agent for a given user id and prompt.
258 - */
259 - const request = await c.req.json();
260 -
261 - // For demonstration, using a default user_id. Replace with real user logic in production.
262 - const userId = "default";
263 -
264 - // Validate the user id before proceeding
265 - await validateUserId(userId, composioClient);
266 -
267 - // Run the Gmail agent using Composio and OpenAI
268 - const result = await runGmailAgent(
269 - composioClient,
270 - openaiClient,
271 - userId,
272 - request.prompt,
273 - );
274 - return c.json(result);
275 -});
276 -```
277 -
278 -<Note>
279 - Check [src/api.ts](./src/api.ts) module for service implementation
280 -</Note>
281 -
282 -## Putting everything together
283 -
284 -So far, we have created an agent with ability to interact with `gmail` using the `composio` SDK, functions to manage connected accounts for users and a Hono service. Now let's run the service.
285 -
286 -<Note>
287 - Before proceeding, check the [code](./src/api.ts) for utility endpoints not discussed in the cookbook
288 -</Note>
289 -
290 -1. Clone the repository
291 - ```bash
292 - git clone git@github.com:composiohq/composio-hono
293 - cd composio-hono/
294 - ```
295 -2. Setup environment
296 -
297 - ```bash
298 - cp .env.example .env
299 - ```
300 -
301 - Fill the api keys
302 -
303 - ```dotenv
304 - COMPOSIO_API_KEY=
305 - OPENAI_API_KEY=
306 - ```
307 -
308 - Install dependencies
309 -
310 - ```bash
311 - npm install
312 - ```
313 -3. Run the HTTP server
314 - ```bash
315 - npm run dev
316 - ```
317 -
318 -## Testing the API with curl
319 -
320 -Assuming the server is running locally on `http://localhost:8000`.
321 -
322 -### Check if a connection exists
323 -
324 -```bash
325 -curl -X POST http://localhost:8000/connection/exists
326 -```
327 -
328 -### Create a connection
329 -
330 -Note: The body fields are required by the API schema, but are ignored internally in this example service.
331 -
332 -```bash
333 -curl -X POST http://localhost:8000/connection/create \
334 - -H "Content-Type: application/json" \
335 - -d '{
336 - "user_id": "default",
337 - "auth_config_id": "AUTH_CONFIG_ID_FOR_GMAIL_FROM_THE_COMPOSIO_DASHBOARD"
338 - }'
339 -```
340 -
341 -Response includes `connection_id` and `redirect_url`. Complete the OAuth flow at the `redirect_url`.
342 -
343 -### Check connection status
344 -
345 -Use the `connection_id` returned from the create step.
346 -
347 -```bash
348 -curl -X POST http://localhost:8000/connection/status \
349 - -H "Content-Type: application/json" \
350 - -d '{
351 - "user_id": "default",
352 - "connection_id": "CONNECTION_ID_FROM_CREATE_RESPONSE"
353 - }'
354 -```
355 -
356 -### Run the Gmail agent
357 -
358 -Requires an active connected account for the `default` user.
359 -
360 -```bash
361 -curl -X POST http://localhost:8000/agent \
362 - -H "Content-Type: application/json" \
363 - -d '{
364 - "user_id": "default",
365 - "prompt": "Summarize my latest unread emails from the last 24 hours."
366 - }'
367 -```
368 -
369 -### Fetch emails (direct action)
370 -
371 -```bash
372 -curl -X POST http://localhost:8000/actions/fetch_emails \
373 - -H "Content-Type: application/json" \
374 - -d '{
375 - "user_id": "default",
376 - "limit": 5
377 - }'
378 -```
379 -
380 -These examples are intended solely for testing purposes.
381 -
382 -## Using Composio for managed auth and tools
383 -
384 -Composio reduces boilerplate for building AI agents that access and use various apps. In this cookbook, to build Gmail integration without Composio, you would have to write code to
385 -
386 -* manage Gmail OAuth app
387 -* manage user connections
388 -* tools for your agents to interact with Gmail
389 -
390 -Using Composio simplifies all of the above to a few lines of code as shown in the cookbook.
391 -
392 -## Best practices
393 -
394 -**🎯 Effective Prompts**:
395 -
396 -* Be specific: "Send email to [john@company.com](mailto:john@company.com) about tomorrow's 2pm meeting" works better than "send email"
397 -* Include context: "Reply to Sarah's email about the budget with our approval"
398 -* Use natural language: The agent understands conversational requests
399 -
400 -**🔑 User Management**:
401 -
402 -* Use unique, consistent `user_id` values for each person
403 -* Each user maintains their own Gmail connection
404 -* User IDs can be email addresses, usernames, or any unique identifier
405 -
406 -## Troubleshooting
407 -
408 -**Connection Issues**:
409 -
410 -* Ensure your `.env` file has valid `COMPOSIO_API_KEY` and `OPENAI_API_KEY`
411 -* Check if the user has completed Gmail authorization.
412 -* Verify the user\_id matches exactly between requests
413 -
414 -**API Errors**:
415 -
416 -* Check the server logs for detailed error messages
417 -* Ensure request payloads match the expected format
418 -* Visit `/docs` endpoint for API schema validation
419 -
420 -**Gmail API Limits**:
421 -
422 -* Gmail has rate limits; the agent will handle these gracefully
423 -* For high-volume usage, consider implementing request queuing
\ No newline at end of file
fern/pages/src/examples/tool-generator/output.json deleted
-3335
@@ -1,3335 +0,0 @@
1 -[
2 - {
3 - "deprecated": {
4 - "available_versions": [
5 - "0_1",
6 - "latest",
7 - "latest:base"
8 - ],
9 - "display_name": "Modify email labels",
10 - "is_deprecated": false,
11 - "toolkit": {
12 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
13 - },
14 - "version": "0_1",
15 - "displayName": "Modify email labels"
16 - },
17 - "description": "Adds and/or removes specified gmail labels for a message; ensure `message id` and all `label ids` are valid (use 'listlabels' for custom label ids).",
18 - "input_parameters": {
19 - "properties": {
20 - "add_label_ids": {
21 - "default": [],
22 - "description": "Label IDs to add. For custom labels, obtain IDs via 'listLabels'. System labels (e.g., 'INBOX', 'SPAM') can also be used.",
23 - "examples": [
24 - "STARRED",
25 - "IMPORTANT",
26 - "Label_123"
27 - ],
28 - "items": {
29 - "type": "string"
30 - },
31 - "title": "Add Label Ids",
32 - "type": "array"
33 - },
34 - "message_id": {
35 - "description": "Immutable ID of the message to modify (e.g., from 'fetchEmails' or 'fetchMessagesByThreadId').",
36 - "examples": [
37 - "17f1b2b9c1b2a3d4"
38 - ],
39 - "title": "Message Id",
40 - "type": "string"
41 - },
42 - "remove_label_ids": {
43 - "default": [],
44 - "description": "Label IDs to remove. For custom labels, obtain IDs via 'listLabels'. System labels can also be used.",
45 - "examples": [
46 - "UNREAD",
47 - "Label_456"
48 - ],
49 - "items": {
50 - "type": "string"
51 - },
52 - "title": "Remove Label Ids",
53 - "type": "array"
54 - },
55 - "user_id": {
56 - "default": "me",
57 - "description": "User's email address or 'me' for the authenticated user.",
58 - "examples": [
59 - "me",
60 - "user@example.com"
61 - ],
62 - "title": "User Id",
63 - "type": "string"
64 - }
65 - },
66 - "required": [
67 - "message_id"
68 - ],
69 - "title": "AddLabelToEmailRequest",
70 - "type": "object"
71 - },
72 - "name": "Modify email labels",
73 - "no_auth": false,
74 - "output_parameters": {
75 - "properties": {
76 - "data": {
77 - "description": "Data from the action execution",
78 - "properties": {
79 - "response_data": {
80 - "description": "Full `Message` resource with updated labels.",
81 - "title": "Response Data",
82 - "type": "object"
83 - }
84 - },
85 - "required": [
86 - "response_data"
87 - ],
88 - "title": "Data",
89 - "type": "object"
90 - },
91 - "error": {
92 - "anyOf": [
93 - {
94 - "type": "string"
95 - },
96 - {
97 - "type": "null"
98 - }
99 - ],
100 - "default": null,
101 - "description": "Error if any occurred during the execution of the action",
102 - "title": "Error"
103 - },
104 - "successful": {
105 - "description": "Whether or not the action execution was successful or not",
106 - "title": "Successful",
107 - "type": "boolean"
108 - }
109 - },
110 - "required": [
111 - "data",
112 - "successful"
113 - ],
114 - "title": "AddLabelToEmailResponseWrapper",
115 - "type": "object"
116 - },
117 - "slug": "GMAIL_ADD_LABEL_TO_EMAIL",
118 - "tags": [
119 - "idempotentHint",
120 - "openWorldHint"
121 - ],
122 - "toolkit": {
123 - "name": "gmail",
124 - "slug": "gmail",
125 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
126 - },
127 - "available_versions": [
128 - "0_1",
129 - "latest",
130 - "latest:base"
131 - ],
132 - "version": "0_1",
133 - "scopes": [
134 - "https://mail.google.com/",
135 - "https://www.googleapis.com/auth/gmail.modify"
136 - ]
137 - },
138 - {
139 - "deprecated": {
140 - "available_versions": [
141 - "0_1",
142 - "latest",
143 - "latest:base"
144 - ],
145 - "display_name": "Create email draft",
146 - "is_deprecated": false,
147 - "toolkit": {
148 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
149 - },
150 - "version": "0_1",
151 - "displayName": "Create email draft"
152 - },
153 - "description": "Creates a gmail email draft, supporting to/cc/bcc, subject, plain/html body (ensure `is html=true` for html), attachments, and threading.",
154 - "input_parameters": {
155 - "properties": {
156 - "attachment": {
157 - "default": null,
158 - "description": "File to attach to the email.",
159 - "file_uploadable": true,
160 - "properties": {
161 - "mimetype": {
162 - "title": "Mimetype",
163 - "type": "string"
164 - },
165 - "name": {
166 - "title": "Name",
167 - "type": "string"
168 - },
169 - "s3key": {
170 - "title": "S3Key",
171 - "type": "string"
172 - }
173 - },
174 - "required": [
175 - "name",
176 - "mimetype",
177 - "s3key"
178 - ],
179 - "title": "FileUploadable",
180 - "type": "object"
181 - },
182 - "bcc": {
183 - "default": [],
184 - "description": "'Bcc' (blind carbon copy) recipient email addresses.",
185 - "examples": [
186 - "[\"bcc.recipient@example.com\"]"
187 - ],
188 - "items": {
189 - "type": "string"
190 - },
191 - "title": "Bcc",
192 - "type": "array"
193 - },
194 - "body": {
195 - "description": "Email body content (plain text or HTML); `is_html` must be True if HTML.",
196 - "examples": [
197 - "Hello Team,\n\nPlease find the attached report for your review.\n\nBest regards,\nYour Name",
198 - "<h1>Meeting Confirmation</h1><p>This email confirms our meeting scheduled for next Tuesday.</p>"
199 - ],
200 - "title": "Body",
201 - "type": "string"
202 - },
203 - "cc": {
204 - "default": [],
205 - "description": "'Cc' (carbon copy) recipient email addresses.",
206 - "examples": [
207 - "[\"cc.recipient1@example.com\", \"cc.recipient2@example.com\"]"
208 - ],
209 - "items": {
210 - "type": "string"
211 - },
212 - "title": "Cc",
213 - "type": "array"
214 - },
215 - "extra_recipients": {
216 - "default": [],
217 - "description": "Additional 'To' recipient email addresses.",
218 - "examples": [
219 - "[\"jane.doe@example.com\", \"another.recipient@example.com\"]"
220 - ],
221 - "items": {
222 - "type": "string"
223 - },
224 - "title": "Extra Recipients",
225 - "type": "array"
226 - },
227 - "is_html": {
228 - "default": false,
229 - "description": "Set to True if `body` is HTML, otherwise the action may fail.",
230 - "examples": [
231 - "True",
232 - "False"
233 - ],
234 - "title": "Is Html",
235 - "type": "boolean"
236 - },
237 - "recipient_email": {
238 - "description": "Primary recipient's email address.",
239 - "examples": [
240 - "john.doe@example.com"
241 - ],
242 - "title": "Recipient Email",
243 - "type": "string"
244 - },
245 - "subject": {
246 - "description": "Email subject line.",
247 - "examples": [
248 - "Project Update Q3",
249 - "Meeting Reminder"
250 - ],
251 - "title": "Subject",
252 - "type": "string"
253 - },
254 - "thread_id": {
255 - "default": null,
256 - "description": "ID of an existing Gmail thread to reply to; omit for new thread.",
257 - "examples": [
258 - "17f45ec49a9c3f1b"
259 - ],
260 - "title": "Thread Id",
261 - "type": "string"
262 - },
263 - "user_id": {
264 - "default": "me",
265 - "description": "User's email address or 'me' for the authenticated user.",
266 - "examples": [
267 - "me",
268 - "user@example.com"
269 - ],
270 - "title": "User Id",
271 - "type": "string"
272 - }
273 - },
274 - "required": [
275 - "recipient_email",
276 - "subject",
277 - "body"
278 - ],
279 - "title": "CreateEmailDraftRequest",
280 - "type": "object"
281 - },
282 - "name": "Create email draft",
283 - "no_auth": false,
284 - "output_parameters": {
285 - "properties": {
286 - "data": {
287 - "description": "Data from the action execution",
288 - "properties": {
289 - "response_data": {
290 - "default": null,
291 - "description": "Gmail API response with created draft details, including ID.",
292 - "title": "Response Data",
293 - "type": "object"
294 - }
295 - },
296 - "title": "Data",
297 - "type": "object"
298 - },
299 - "error": {
300 - "anyOf": [
301 - {
302 - "type": "string"
303 - },
304 - {
305 - "type": "null"
306 - }
307 - ],
308 - "default": null,
309 - "description": "Error if any occurred during the execution of the action",
310 - "title": "Error"
311 - },
312 - "successful": {
313 - "description": "Whether or not the action execution was successful or not",
314 - "title": "Successful",
315 - "type": "boolean"
316 - }
317 - },
318 - "required": [
319 - "data",
320 - "successful"
321 - ],
322 - "title": "CreateEmailDraftResponseWrapper",
323 - "type": "object"
324 - },
325 - "slug": "GMAIL_CREATE_EMAIL_DRAFT",
326 - "tags": [
327 - "openWorldHint"
328 - ],
329 - "toolkit": {
330 - "name": "gmail",
331 - "slug": "gmail",
332 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
333 - },
334 - "available_versions": [
335 - "0_1",
336 - "latest",
337 - "latest:base"
338 - ],
339 - "version": "0_1",
340 - "scopes": [
341 - "https://www.googleapis.com/auth/gmail.readonly",
342 - "https://www.googleapis.com/auth/gmail.send",
343 - "https://www.googleapis.com/auth/gmail.compose"
344 - ]
345 - },
346 - {
347 - "deprecated": {
348 - "available_versions": [
349 - "0_1",
350 - "latest",
351 - "latest:base"
352 - ],
353 - "display_name": "Create label",
354 - "is_deprecated": false,
355 - "toolkit": {
356 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
357 - },
358 - "version": "0_1",
359 - "displayName": "Create label"
360 - },
361 - "description": "Creates a new label with a unique name in the specified user's gmail account.",
362 - "input_parameters": {
363 - "properties": {
364 - "label_list_visibility": {
365 - "default": "labelShow",
366 - "description": "Controls how the label is displayed in the label list in the Gmail sidebar.",
367 - "examples": [
368 - "labelShow",
369 - "labelShowIfUnread",
370 - "labelHide"
371 - ],
372 - "title": "Label List Visibility",
373 - "type": "string"
374 - },
375 - "label_name": {
376 - "description": "The name for the new label.",
377 - "examples": [
378 - "Work",
379 - "Important Documents",
380 - "Receipts 2024"
381 - ],
382 - "title": "Label Name",
383 - "type": "string"
384 - },
385 - "message_list_visibility": {
386 - "default": "show",
387 - "description": "Controls how messages with this label are displayed in the message list.",
388 - "examples": [
389 - "show",
390 - "hide"
391 - ],
392 - "title": "Message List Visibility",
393 - "type": "string"
394 - },
395 - "user_id": {
396 - "default": "me",
397 - "description": "The email address of the user in whose account the label will be created.",
398 - "examples": [
399 - "me",
400 - "user@example.com"
401 - ],
402 - "title": "User Id",
403 - "type": "string"
404 - }
405 - },
406 - "required": [
407 - "label_name"
408 - ],
409 - "title": "CreateLabelRequest",
410 - "type": "object"
411 - },
412 - "name": "Create label",
413 - "no_auth": false,
414 - "output_parameters": {
415 - "properties": {
416 - "data": {
417 - "description": "Data from the action execution",
418 - "properties": {
419 - "response_data": {
420 - "description": "Full API response from Gmail for the created label.",
421 - "title": "Response Data",
422 - "type": "object"
423 - }
424 - },
425 - "required": [
426 - "response_data"
427 - ],
428 - "title": "Data",
429 - "type": "object"
430 - },
431 - "error": {
432 - "anyOf": [
433 - {
434 - "type": "string"
435 - },
436 - {
437 - "type": "null"
438 - }
439 - ],
440 - "default": null,
441 - "description": "Error if any occurred during the execution of the action",
442 - "title": "Error"
443 - },
444 - "successful": {
445 - "description": "Whether or not the action execution was successful or not",
446 - "title": "Successful",
447 - "type": "boolean"
448 - }
449 - },
450 - "required": [
451 - "data",
452 - "successful"
453 - ],
454 - "title": "CreateLabelResponseWrapper",
455 - "type": "object"
456 - },
457 - "slug": "GMAIL_CREATE_LABEL",
458 - "tags": [
459 - "openWorldHint"
460 - ],
461 - "toolkit": {
462 - "name": "gmail",
463 - "slug": "gmail",
464 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
465 - },
466 - "available_versions": [
467 - "0_1",
468 - "latest",
469 - "latest:base"
470 - ],
471 - "version": "0_1",
472 - "scopes": [
473 - "https://mail.google.com/",
474 - "https://www.googleapis.com/auth/gmail.modify",
475 - "https://www.googleapis.com/auth/gmail.readonly"
476 - ]
477 - },
478 - {
479 - "deprecated": {
480 - "available_versions": [
481 - "0_1",
482 - "latest",
483 - "latest:base"
484 - ],
485 - "display_name": "Delete Draft",
486 - "is_deprecated": false,
487 - "toolkit": {
488 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
489 - },
490 - "version": "0_1",
491 - "displayName": "Delete Draft"
492 - },
493 - "description": "Permanently deletes a specific gmail draft using its id; ensure the draft exists and the user has necessary permissions for the given `user id`.",
494 - "input_parameters": {
495 - "properties": {
496 - "draft_id": {
497 - "description": "Immutable ID of the draft to delete, typically obtained when the draft was created.",
498 - "examples": [
499 - "r-8388446164079304564"
500 - ],
501 - "title": "Draft Id",
502 - "type": "string"
503 - },
504 - "user_id": {
505 - "default": "me",
506 - "description": "User's email address or 'me' for the authenticated user; 'me' is recommended.",
507 - "examples": [
508 - "me",
509 - "user@example.com"
510 - ],
511 - "title": "User Id",
512 - "type": "string"
513 - }
514 - },
515 - "required": [
516 - "draft_id"
517 - ],
518 - "title": "DeleteDraftRequest",
519 - "type": "object"
520 - },
521 - "name": "Delete Draft",
522 - "no_auth": false,
523 - "output_parameters": {
524 - "properties": {
525 - "data": {
526 - "description": "Data from the action execution",
527 - "properties": {
528 - "success": {
529 - "description": "Indicates successful deletion; an exception is raised on error rather than returning false.",
530 - "title": "Success",
531 - "type": "boolean"
532 - }
533 - },
534 - "required": [
535 - "success"
536 - ],
537 - "title": "Data",
538 - "type": "object"
539 - },
540 - "error": {
541 - "anyOf": [
542 - {
543 - "type": "string"
544 - },
545 - {
546 - "type": "null"
547 - }
548 - ],
549 - "default": null,
550 - "description": "Error if any occurred during the execution of the action",
551 - "title": "Error"
552 - },
553 - "successful": {
554 - "description": "Whether or not the action execution was successful or not",
555 - "title": "Successful",
556 - "type": "boolean"
557 - }
558 - },
559 - "required": [
560 - "data",
561 - "successful"
562 - ],
563 - "title": "DeleteDraftResponseWrapper",
564 - "type": "object"
565 - },
566 - "slug": "GMAIL_DELETE_DRAFT",
567 - "tags": [
568 - "destructiveHint",
569 - "idempotentHint",
570 - "important",
571 - "openWorldHint"
572 - ],
573 - "toolkit": {
574 - "name": "gmail",
575 - "slug": "gmail",
576 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
577 - },
578 - "available_versions": [
579 - "0_1",
580 - "latest",
581 - "latest:base"
582 - ],
583 - "version": "0_1",
584 - "scopes": [
585 - "https://mail.google.com/"
586 - ]
587 - },
588 - {
589 - "deprecated": {
590 - "available_versions": [
591 - "0_1",
592 - "latest",
593 - "latest:base"
594 - ],
595 - "display_name": "Delete message",
596 - "is_deprecated": false,
597 - "toolkit": {
598 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
599 - },
600 - "version": "0_1",
601 - "displayName": "Delete message"
602 - },
603 - "description": "Permanently deletes a specific email message by its id from a gmail mailbox; for `user id`, use 'me' for the authenticated user or an email address to which the authenticated user has delegated access.",
604 - "input_parameters": {
605 - "properties": {
606 - "message_id": {
607 - "description": "Identifier of the email message to delete.",
608 - "examples": [
609 - "185120e4428ba8cf",
610 - "17a872b77b9e7a3b"
611 - ],
612 - "title": "Message Id",
613 - "type": "string"
614 - },
615 - "user_id": {
616 - "default": "me",
617 - "description": "User's email address. The special value 'me' refers to the authenticated user.",
618 - "examples": [
619 - "me",
620 - "user@example.com"
621 - ],
622 - "title": "User Id",
623 - "type": "string"
624 - }
625 - },
626 - "required": [
627 - "message_id"
628 - ],
629 - "title": "DeleteMessageRequest",
630 - "type": "object"
631 - },
632 - "name": "Delete message",
633 - "no_auth": false,
634 - "output_parameters": {
635 - "properties": {
636 - "data": {
637 - "description": "Data from the action execution",
638 - "properties": {
639 - "success": {
640 - "description": "True if the message was successfully deleted.",
641 - "title": "Success",
642 - "type": "boolean"
643 - }
644 - },
645 - "required": [
646 - "success"
647 - ],
648 - "title": "Data",
649 - "type": "object"
650 - },
651 - "error": {
652 - "anyOf": [
653 - {
654 - "type": "string"
655 - },
656 - {
657 - "type": "null"
658 - }
659 - ],
660 - "default": null,
661 - "description": "Error if any occurred during the execution of the action",
662 - "title": "Error"
663 - },
664 - "successful": {
665 - "description": "Whether or not the action execution was successful or not",
666 - "title": "Successful",
667 - "type": "boolean"
668 - }
669 - },
670 - "required": [
671 - "data",
672 - "successful"
673 - ],
674 - "title": "DeleteMessageResponseWrapper",
675 - "type": "object"
676 - },
677 - "slug": "GMAIL_DELETE_MESSAGE",
678 - "tags": [
679 - "destructiveHint",
680 - "important",
681 - "openWorldHint"
682 - ],
683 - "toolkit": {
684 - "name": "gmail",
685 - "slug": "gmail",
686 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
687 - },
688 - "available_versions": [
689 - "0_1",
690 - "latest",
691 - "latest:base"
692 - ],
693 - "version": "0_1",
694 - "scopes": [
695 - "https://www.googleapis.com/auth/gmail.readonly"
696 - ]
697 - },
698 - {
699 - "deprecated": {
700 - "available_versions": [
701 - "0_1",
702 - "latest",
703 - "latest:base"
704 - ],
705 - "display_name": "Fetch emails",
706 - "is_deprecated": false,
707 - "toolkit": {
708 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
709 - },
710 - "version": "0_1",
711 - "displayName": "Fetch emails"
712 - },
713 - "description": "Fetches a list of email messages from a gmail account, supporting filtering, pagination, and optional full content retrieval.",
714 - "input_parameters": {
715 - "properties": {
716 - "include_payload": {
717 - "default": true,
718 - "description": "Set to true to include full message payload (headers, body, attachments); false for metadata only.",
719 - "examples": [
720 - "True",
721 - "False"
722 - ],
723 - "title": "Include Payload",
724 - "type": "boolean"
725 - },
726 - "include_spam_trash": {
727 - "default": false,
728 - "description": "Set to true to include messages from 'SPAM' and 'TRASH'.",
729 - "examples": [
730 - "True",
731 - "False"
732 - ],
733 - "title": "Include Spam Trash",
734 - "type": "boolean"
735 - },
736 - "label_ids": {
737 - "description": "Filter by label IDs; only messages with all specified labels are returned. Common IDs: 'INBOX', 'SPAM', 'TRASH', 'UNREAD', 'STARRED', 'IMPORTANT', 'CATEGORY_PERSONAL', 'CATEGORY_SOCIAL', 'CATEGORY_PROMOTIONS', 'CATEGORY_UPDATES', 'CATEGORY_FORUMS'. Use 'listLabels' action for custom IDs.",
738 - "examples": [
739 - "['INBOX', 'UNREAD']",
740 - "['IMPORTANT']",
741 - "[]"
742 - ],
743 - "items": {
744 - "type": "string"
745 - },
746 - "title": "Label Ids",
747 - "type": "array"
748 - },
749 - "max_results": {
750 - "default": 1,
751 - "description": "Maximum number of messages to retrieve per page.",
752 - "examples": [
753 - "10",
754 - "100",
755 - "500"
756 - ],
757 - "maximum": 500,
758 - "minimum": 1,
759 - "title": "Max Results",
760 - "type": "integer"
761 - },
762 - "page_token": {
763 - "anyOf": [
764 - {
765 - "type": "string"
766 - },
767 - {
768 - "type": "null"
769 - }
770 - ],
771 - "default": null,
772 - "description": "Token for retrieving a specific page, obtained from a previous response's `nextPageToken`. Omit for the first page.",
773 - "title": "Page Token",
774 - "type": "string"
775 - },
776 - "query": {
777 - "anyOf": [
778 - {
779 - "type": "string"
780 - },
781 - {
782 - "type": "null"
783 - }
784 - ],
785 - "default": null,
786 - "description": "Gmail advanced search query (e.g., 'from:user subject:meeting'). Supports operators like 'from:', 'to:', 'subject:', 'label:', 'has:attachment', 'is:unread', 'after:YYYY/MM/DD', 'before:YYYY/MM/DD', AND/OR/NOT. Use quotes for exact phrases. Omit for no query filter.",
787 - "examples": [
788 - "from:john@example.com is:unread",
789 - "subject:meeting has:attachment",
790 - "after:2024/01/01 before:2024/02/01",
791 - "is:important OR is:starred",
792 - "label:work -label:spam"
793 - ],
794 - "title": "Query",
795 - "type": "string"
796 - },
797 - "user_id": {
798 - "default": "me",
799 - "description": "User's email address or 'me' for the authenticated user.",
800 - "examples": [
801 - "me",
802 - "user@example.com"
803 - ],
804 - "title": "User Id",
805 - "type": "string"
806 - }
807 - },
808 - "title": "FetchEmailsRequest",
809 - "type": "object"
810 - },
811 - "name": "Fetch emails",
812 - "no_auth": false,
813 - "output_parameters": {
814 - "properties": {
815 - "data": {
816 - "description": "Data from the action execution",
817 - "properties": {
818 - "messages": {
819 - "description": "List of retrieved email messages. Includes full content if `include_payload` was true, otherwise metadata.",
820 - "items": {
821 - "description": "This model represents the body a Gmail message.",
822 - "properties": {
823 - "attachmentList": {
824 - "anyOf": [
825 - {
826 - "items": {},
827 - "type": "array"
828 - },
829 - {
830 - "type": "null"
831 - }
832 - ],
833 - "description": "The list of attachments",
834 - "title": "Attachmentlist"
835 - },
836 - "labelIds": {
837 - "anyOf": [
838 - {
839 - "items": {},
840 - "type": "array"
841 - },
842 - {
843 - "type": "null"
844 - }
845 - ],
846 - "description": "The label IDs of the message",
847 - "title": "Labelids"
848 - },
849 - "messageId": {
850 - "anyOf": [
851 - {
852 - "type": "string"
853 - },
854 - {
855 - "type": "null"
856 - }
857 - ],
858 - "description": "The message ID of the message",
859 - "title": "Messageid"
860 - },
861 - "messageText": {
862 - "anyOf": [
863 - {
864 - "type": "string"
865 - },
866 - {
867 - "type": "null"
868 - }
869 - ],
870 - "description": "The text of the message",
871 - "title": "Messagetext"
872 - },
873 - "messageTimestamp": {
874 - "anyOf": [
875 - {
876 - "type": "string"
877 - },
878 - {
879 - "type": "null"
880 - }
881 - ],
882 - "description": "The timestamp of the message",
883 - "title": "Messagetimestamp"
884 - },
885 - "payload": {
886 - "anyOf": [
887 - {
888 - "type": "object"
889 - },
890 - {
891 - "type": "null"
892 - }
893 - ],
894 - "description": "The payload of the message",
895 - "title": "Payload"
896 - },
897 - "preview": {
898 - "anyOf": [
899 - {
900 - "type": "object"
901 - },
902 - {
903 - "type": "null"
904 - }
905 - ],
906 - "description": "The preview of the message",
907 - "title": "Preview"
908 - },
909 - "sender": {
910 - "anyOf": [
911 - {
912 - "type": "string"
913 - },
914 - {
915 - "type": "null"
916 - }
917 - ],
918 - "description": "The sender of the message",
919 - "title": "Sender"
920 - },
921 - "subject": {
922 - "anyOf": [
923 - {
924 - "type": "string"
925 - },
926 - {
927 - "type": "null"
928 - }
929 - ],
930 - "description": "The subject of the message",
931 - "title": "Subject"
932 - },
933 - "threadId": {
934 - "anyOf": [
935 - {
936 - "type": "string"
937 - },
938 - {
939 - "type": "null"
940 - }
941 - ],
942 - "description": "The thread ID of the message",
943 - "title": "Threadid"
944 - },
945 - "to": {
946 - "anyOf": [
947 - {
948 - "type": "string"
949 - },
950 - {
951 - "type": "null"
952 - }
953 - ],
954 - "description": "The recipient of the message",
955 - "title": "To"
956 - }
957 - },
958 - "title": "MessageBody",
959 - "type": "object"
960 - },
961 - "title": "Messages",
962 - "type": "array"
963 - },
964 - "nextPageToken": {
965 - "description": "Token for the next page of results; use in subsequent `page_token` request. Empty if no more results.",
966 - "title": "Next Page Token",
967 - "type": "string"
968 - },
969 - "resultSizeEstimate": {
970 - "description": "Estimated total messages matching the query (not just this page).",
971 - "title": "Result Size Estimate",
972 - "type": "integer"
973 - }
974 - },
975 - "required": [
976 - "nextPageToken",
977 - "resultSizeEstimate",
978 - "messages"
979 - ],
980 - "title": "Data",
981 - "type": "object"
982 - },
983 - "error": {
984 - "anyOf": [
985 - {
986 - "type": "string"
987 - },
988 - {
989 - "type": "null"
990 - }
991 - ],
992 - "default": null,
993 - "description": "Error if any occurred during the execution of the action",
994 - "title": "Error"
995 - },
996 - "successful": {
997 - "description": "Whether or not the action execution was successful or not",
998 - "title": "Successful",
999 - "type": "boolean"
1000 - }
1001 - },
1002 - "required": [
1003 - "data",
1004 - "successful"
1005 - ],
1006 - "title": "FetchEmailsResponseWrapper",
1007 - "type": "object"
1008 - },
1009 - "slug": "GMAIL_FETCH_EMAILS",
1010 - "tags": [
1011 - "important",
1012 - "openWorldHint",
1013 - "readOnlyHint"
1014 - ],
1015 - "toolkit": {
1016 - "name": "gmail",
1017 - "slug": "gmail",
1018 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
1019 - },
1020 - "available_versions": [
1021 - "0_1",
1022 - "latest",
1023 - "latest:base"
1024 - ],
1025 - "version": "0_1",
1026 - "scopes": [
1027 - "https://www.googleapis.com/auth/gmail.readonly",
1028 - "https://www.googleapis.com/auth/gmail.modify",
1029 - "https://www.googleapis.com/auth/gmail.metadata"
1030 - ]
1031 - },
1032 - {
1033 - "deprecated": {
1034 - "available_versions": [
1035 - "0_1",
1036 - "latest",
1037 - "latest:base"
1038 - ],
1039 - "display_name": "Fetch message by message ID",
1040 - "is_deprecated": false,
1041 - "toolkit": {
1042 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
1043 - },
1044 - "version": "0_1",
1045 - "displayName": "Fetch message by message ID"
1046 - },
1047 - "description": "Fetches a specific email message by its id, provided the `message id` exists and is accessible to the authenticated `user id`.",
1048 - "input_parameters": {
1049 - "properties": {
1050 - "format": {
1051 - "default": "full",
1052 - "description": "Format for message content: 'minimal' (ID/labels), 'full' (complete data), 'raw' (base64url string), 'metadata' (ID/labels/headers).",
1053 - "examples": [
1054 - "minimal",
1055 - "full",
1056 - "raw",
1057 - "metadata"
1058 - ],
1059 - "title": "Format",
1060 - "type": "string"
1061 - },
1062 - "message_id": {
1063 - "description": "Unique ID of the email message to retrieve, obtainable from actions like 'List Messages'.",
1064 - "examples": [
1065 - "xsdfe3264vrfw"
1066 - ],
1067 - "minLength": 1,
1068 - "title": "Message Id",
1069 - "type": "string"
1070 - },
1071 - "user_id": {
1072 - "default": "me",
1073 - "description": "User's email address or 'me' for the authenticated user.",
1074 - "examples": [
1075 - "user@example.com",
1076 - "me"
1077 - ],
1078 - "title": "User Id",
1079 - "type": "string"
1080 - }
1081 - },
1082 - "required": [
1083 - "message_id"
1084 - ],
1085 - "title": "FetchMessageByMessageIdRequest",
1086 - "type": "object"
1087 - },
1088 - "name": "Fetch message by message ID",
1089 - "no_auth": false,
1090 - "output_parameters": {
1091 - "properties": {
1092 - "data": {
1093 - "description": "Data from the action execution",
1094 - "properties": {
1095 - "attachmentList": {
1096 - "anyOf": [
1097 - {
1098 - "items": {},
1099 - "type": "array"
1100 - },
1101 - {
1102 - "type": "null"
1103 - }
1104 - ],
1105 - "description": "The list of attachments",
1106 - "title": "Attachment List"
1107 - },
1108 - "labelIds": {
1109 - "anyOf": [
1110 - {
1111 - "items": {},
1112 - "type": "array"
1113 - },
1114 - {
1115 - "type": "null"
1116 - }
1117 - ],
1118 - "description": "The label IDs of the message",
1119 - "title": "Label Ids"
1120 - },
1121 - "messageId": {
1122 - "anyOf": [
1123 - {
1124 - "type": "string"
1125 - },
1126 - {
1127 - "type": "null"
1128 - }
1129 - ],
1130 - "description": "The message ID of the message",
1131 - "title": "Message Id"
1132 - },
1133 - "messageText": {
1134 - "anyOf": [
1135 - {
1136 - "type": "string"
1137 - },
1138 - {
1139 - "type": "null"
1140 - }
1141 - ],
1142 - "description": "The text of the message",
1143 - "title": "Message Text"
1144 - },
1145 - "messageTimestamp": {
1146 - "anyOf": [
1147 - {
1148 - "type": "string"
1149 - },
1150 - {
1151 - "type": "null"
1152 - }
1153 - ],
1154 - "description": "The timestamp of the message",
1155 - "title": "Message Timestamp"
1156 - },
1157 - "payload": {
1158 - "anyOf": [
1159 - {
1160 - "type": "object"
1161 - },
1162 - {
1163 - "type": "null"
1164 - }
1165 - ],
1166 - "description": "The payload of the message",
1167 - "title": "Payload"
1168 - },
1169 - "preview": {
1170 - "anyOf": [
1171 - {
1172 - "type": "object"
1173 - },
1174 - {
1175 - "type": "null"
1176 - }
1177 - ],
1178 - "description": "The preview of the message",
1179 - "title": "Preview"
1180 - },
1181 - "sender": {
1182 - "anyOf": [
1183 - {
1184 - "type": "string"
1185 - },
1186 - {
1187 - "type": "null"
1188 - }
1189 - ],
1190 - "description": "The sender of the message",
1191 - "title": "Sender"
1192 - },
1193 - "subject": {
1194 - "anyOf": [
1195 - {
1196 - "type": "string"
1197 - },
1198 - {
1199 - "type": "null"
1200 - }
1201 - ],
1202 - "description": "The subject of the message",
1203 - "title": "Subject"
1204 - },
1205 - "threadId": {
1206 - "anyOf": [
1207 - {
1208 - "type": "string"
1209 - },
1210 - {
1211 - "type": "null"
1212 - }
1213 - ],
1214 - "description": "The thread ID of the message",
1215 - "title": "Thread Id"
1216 - },
1217 - "to": {
1218 - "anyOf": [
1219 - {
1220 - "type": "string"
1221 - },
1222 - {
1223 - "type": "null"
1224 - }
1225 - ],
1226 - "description": "The recipient of the message",
1227 - "title": "To"
1228 - }
1229 - },
1230 - "title": "Data",
1231 - "type": "object"
1232 - },
1233 - "error": {
1234 - "anyOf": [
1235 - {
1236 - "type": "string"
1237 - },
1238 - {
1239 - "type": "null"
1240 - }
1241 - ],
1242 - "default": null,
1243 - "description": "Error if any occurred during the execution of the action",
1244 - "title": "Error"
1245 - },
1246 - "successful": {
1247 - "description": "Whether or not the action execution was successful or not",
1248 - "title": "Successful",
1249 - "type": "boolean"
1250 - }
1251 - },
1252 - "required": [
1253 - "data",
1254 - "successful"
1255 - ],
1256 - "title": "FetchMessageByMessageIdResponseWrapper",
1257 - "type": "object"
1258 - },
1259 - "slug": "GMAIL_FETCH_MESSAGE_BY_MESSAGE_ID",
1260 - "tags": [
1261 - "readOnlyHint",
1262 - "openWorldHint"
1263 - ],
1264 - "toolkit": {
1265 - "name": "gmail",
1266 - "slug": "gmail",
1267 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
1268 - },
1269 - "available_versions": [
1270 - "0_1",
1271 - "latest",
1272 - "latest:base"
1273 - ],
1274 - "version": "0_1",
1275 - "scopes": [
1276 - "https://mail.google.com/",
1277 - "https://www.googleapis.com/auth/gmail.modify",
1278 - "https://www.googleapis.com/auth/gmail.readonly"
1279 - ]
1280 - },
1281 - {
1282 - "deprecated": {
1283 - "available_versions": [
1284 - "0_1",
1285 - "latest",
1286 - "latest:base"
1287 - ],
1288 - "display_name": "Fetch Message by Thread ID",
1289 - "is_deprecated": false,
1290 - "toolkit": {
1291 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
1292 - },
1293 - "version": "0_1",
1294 - "displayName": "Fetch Message by Thread ID"
1295 - },
1296 - "description": "Retrieves messages from a gmail thread using its `thread id`, where the thread must be accessible by the specified `user id`.",
1297 - "input_parameters": {
1298 - "properties": {
1299 - "page_token": {
1300 - "default": "",
1301 - "description": "Opaque page token for fetching a specific page of messages if results are paginated.",
1302 - "examples": [
1303 - "CiAKGhIKJdealEffectivelyPageToken"
1304 - ],
1305 - "title": "Page Token",
1306 - "type": "string"
1307 - },
1308 - "thread_id": {
1309 - "description": "Unique ID of the thread, obtainable from actions like 'listThreads' or 'fetchEmails'.",
1310 - "examples": [
1311 - "xsdfe3264vrfw"
1312 - ],
1313 - "title": "Thread Id",
1314 - "type": "string"
1315 - },
1316 - "user_id": {
1317 - "default": "me",
1318 - "description": "The email address of the user.",
1319 - "examples": [
1320 - "me",
1321 - "user@example.com"
1322 - ],
1323 - "title": "User Id",
1324 - "type": "string"
1325 - }
1326 - },
1327 - "required": [
1328 - "thread_id"
1329 - ],
1330 - "title": "FetchMessageByThreadIdRequest",
1331 - "type": "object"
1332 - },
1333 - "name": "Fetch Message by Thread ID",
1334 - "no_auth": false,
1335 - "output_parameters": {
1336 - "properties": {
1337 - "data": {
1338 - "description": "Data from the action execution",
1339 - "properties": {
1340 - "messages": {
1341 - "description": "Retrieved messages from the thread.",
1342 - "items": {
1343 - "description": "This model represents the body a Gmail message.",
1344 - "properties": {
1345 - "attachmentList": {
1346 - "anyOf": [
1347 - {
1348 - "items": {},
1349 - "type": "array"
1350 - },
1351 - {
1352 - "type": "null"
1353 - }
1354 - ],
1355 - "description": "The list of attachments",
1356 - "title": "Attachmentlist"
1357 - },
1358 - "labelIds": {
1359 - "anyOf": [
1360 - {
1361 - "items": {},
1362 - "type": "array"
1363 - },
1364 - {
1365 - "type": "null"
1366 - }
1367 - ],
1368 - "description": "The label IDs of the message",
1369 - "title": "Labelids"
1370 - },
1371 - "messageId": {
1372 - "anyOf": [
1373 - {
1374 - "type": "string"
1375 - },
1376 - {
1377 - "type": "null"
1378 - }
1379 - ],
1380 - "description": "The message ID of the message",
1381 - "title": "Messageid"
1382 - },
1383 - "messageText": {
1384 - "anyOf": [
1385 - {
1386 - "type": "string"
1387 - },
1388 - {
1389 - "type": "null"
1390 - }
1391 - ],
1392 - "description": "The text of the message",
1393 - "title": "Messagetext"
1394 - },
1395 - "messageTimestamp": {
1396 - "anyOf": [
1397 - {
1398 - "type": "string"
1399 - },
1400 - {
1401 - "type": "null"
1402 - }
1403 - ],
1404 - "description": "The timestamp of the message",
1405 - "title": "Messagetimestamp"
1406 - },
1407 - "payload": {
1408 - "anyOf": [
1409 - {
1410 - "type": "object"
1411 - },
1412 - {
1413 - "type": "null"
1414 - }
1415 - ],
1416 - "description": "The payload of the message",
1417 - "title": "Payload"
1418 - },
1419 - "preview": {
1420 - "anyOf": [
1421 - {
1422 - "type": "object"
1423 - },
1424 - {
1425 - "type": "null"
1426 - }
1427 - ],
1428 - "description": "The preview of the message",
1429 - "title": "Preview"
1430 - },
1431 - "sender": {
1432 - "anyOf": [
1433 - {
1434 - "type": "string"
1435 - },
1436 - {
1437 - "type": "null"
1438 - }
1439 - ],
1440 - "description": "The sender of the message",
1441 - "title": "Sender"
1442 - },
1443 - "subject": {
1444 - "anyOf": [
1445 - {
1446 - "type": "string"
1447 - },
1448 - {
1449 - "type": "null"
1450 - }
1451 - ],
1452 - "description": "The subject of the message",
1453 - "title": "Subject"
1454 - },
1455 - "threadId": {
1456 - "anyOf": [
1457 - {
1458 - "type": "string"
1459 - },
1460 - {
1461 - "type": "null"
1462 - }
1463 - ],
1464 - "description": "The thread ID of the message",
1465 - "title": "Threadid"
1466 - },
1467 - "to": {
1468 - "anyOf": [
1469 - {
1470 - "type": "string"
1471 - },
1472 - {
1473 - "type": "null"
1474 - }
1475 - ],
1476 - "description": "The recipient of the message",
1477 - "title": "To"
1478 - }
1479 - },
1480 - "title": "MessageBody",
1481 - "type": "object"
1482 - },
1483 - "title": "Messages",
1484 - "type": "array"
1485 - }
1486 - },
1487 - "required": [
1488 - "messages"
1489 - ],
1490 - "title": "Data",
1491 - "type": "object"
1492 - },
1493 - "error": {
1494 - "anyOf": [
1495 - {
1496 - "type": "string"
1497 - },
1498 - {
1499 - "type": "null"
1500 - }
1501 - ],
1502 - "default": null,
1503 - "description": "Error if any occurred during the execution of the action",
1504 - "title": "Error"
1505 - },
1506 - "successful": {
1507 - "description": "Whether or not the action execution was successful or not",
1508 - "title": "Successful",
1509 - "type": "boolean"
1510 - }
1511 - },
1512 - "required": [
1513 - "data",
1514 - "successful"
1515 - ],
1516 - "title": "FetchMessageByThreadIdResponseWrapper",
1517 - "type": "object"
1518 - },
1519 - "slug": "GMAIL_FETCH_MESSAGE_BY_THREAD_ID",
1520 - "tags": [
1521 - "readOnlyHint",
1522 - "openWorldHint"
1523 - ],
1524 - "toolkit": {
1525 - "name": "gmail",
1526 - "slug": "gmail",
1527 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
1528 - },
1529 - "available_versions": [
1530 - "0_1",
1531 - "latest",
1532 - "latest:base"
1533 - ],
1534 - "version": "0_1",
1535 - "scopes": [
1536 - "https://mail.google.com/",
1537 - "https://www.googleapis.com/auth/gmail.modify",
1538 - "https://www.googleapis.com/auth/gmail.readonly"
1539 - ]
1540 - },
1541 - {
1542 - "deprecated": {
1543 - "available_versions": [
1544 - "0_1",
1545 - "latest",
1546 - "latest:base"
1547 - ],
1548 - "display_name": "Get Gmail attachment",
1549 - "is_deprecated": false,
1550 - "toolkit": {
1551 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
1552 - },
1553 - "version": "0_1",
1554 - "displayName": "Get Gmail attachment"
1555 - },
1556 - "description": "Retrieves a specific attachment by id from a message in a user's gmail mailbox, requiring valid message and attachment ids.",
1557 - "input_parameters": {
1558 - "properties": {
1559 - "attachment_id": {
1560 - "description": "ID of the attachment to retrieve.",
1561 - "examples": [
1562 - "A_PART0.1_18exampleAttachmentId7f9"
1563 - ],
1564 - "title": "Attachment Id",
1565 - "type": "string"
1566 - },
1567 - "file_name": {
1568 - "description": "Desired filename for the downloaded attachment.",
1569 - "examples": [
1570 - "invoice.pdf",
1571 - "report.docx"
1572 - ],
1573 - "title": "File Name",
1574 - "type": "string"
1575 - },
1576 - "message_id": {
1577 - "description": "Immutable ID of the message containing the attachment.",
1578 - "examples": [
1579 - "18exampleMessageId7f9"
1580 - ],
1581 - "title": "Message Id",
1582 - "type": "string"
1583 - },
1584 - "user_id": {
1585 - "default": "me",
1586 - "description": "User's email address ('me' for authenticated user).",
1587 - "examples": [
1588 - "me",
1589 - "user@example.com"
1590 - ],
1591 - "title": "User Id",
1592 - "type": "string"
1593 - }
1594 - },
1595 - "required": [
1596 - "message_id",
1597 - "attachment_id",
1598 - "file_name"
1599 - ],
1600 - "title": "GetAttachmentRequest",
1601 - "type": "object"
1602 - },
1603 - "name": "Get Gmail attachment",
1604 - "no_auth": false,
1605 - "output_parameters": {
1606 - "properties": {
1607 - "data": {
1608 - "description": "Data from the action execution",
1609 - "properties": {
1610 - "file": {
1611 - "description": "Retrieved attachment, prepared for download.",
1612 - "file_downloadable": true,
1613 - "properties": {
1614 - "mimetype": {
1615 - "description": "Mime type of the file.",
1616 - "title": "Mimetype",
1617 - "type": "string"
1618 - },
1619 - "name": {
1620 - "description": "Name of the file",
1621 - "title": "Name",
1622 - "type": "string"
1623 - },
1624 - "s3url": {
1625 - "description": "URL of the file.",
1626 - "title": "S3Url",
1627 - "type": "string"
1628 - }
1629 - },
1630 - "required": [
1631 - "name",
1632 - "mimetype",
1633 - "s3url"
1634 - ],
1635 - "title": "File",
1636 - "type": "object"
1637 - }
1638 - },
1639 - "required": [
1640 - "file"
1641 - ],
1642 - "title": "Data",
1643 - "type": "object"
1644 - },
1645 - "error": {
1646 - "anyOf": [
1647 - {
1648 - "type": "string"
1649 - },
1650 - {
1651 - "type": "null"
1652 - }
1653 - ],
1654 - "default": null,
1655 - "description": "Error if any occurred during the execution of the action",
1656 - "title": "Error"
1657 - },
1658 - "successful": {
1659 - "description": "Whether or not the action execution was successful or not",
1660 - "title": "Successful",
1661 - "type": "boolean"
1662 - }
1663 - },
1664 - "required": [
1665 - "data",
1666 - "successful"
1667 - ],
1668 - "title": "GetAttachmentResponseWrapper",
1669 - "type": "object"
1670 - },
1671 - "slug": "GMAIL_GET_ATTACHMENT",
1672 - "tags": [
1673 - "readOnlyHint",
1674 - "openWorldHint"
1675 - ],
1676 - "toolkit": {
1677 - "name": "gmail",
1678 - "slug": "gmail",
1679 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
1680 - },
1681 - "available_versions": [
1682 - "0_1",
1683 - "latest",
1684 - "latest:base"
1685 - ],
1686 - "version": "0_1",
1687 - "scopes": [
1688 - "https://mail.google.com/",
1689 - "https://www.googleapis.com/auth/gmail.modify",
1690 - "https://www.googleapis.com/auth/gmail.readonly"
1691 - ]
1692 - },
1693 - {
1694 - "deprecated": {
1695 - "available_versions": [
1696 - "0_1",
1697 - "latest",
1698 - "latest:base"
1699 - ],
1700 - "display_name": "Get contacts",
1701 - "is_deprecated": false,
1702 - "toolkit": {
1703 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
1704 - },
1705 - "version": "0_1",
1706 - "displayName": "Get contacts"
1707 - },
1708 - "description": "Fetches contacts (connections) for the authenticated google account, allowing selection of specific data fields and pagination.",
1709 - "input_parameters": {
1710 - "properties": {
1711 - "page_token": {
1712 - "description": "Token to retrieve a specific page of results, obtained from 'nextPageToken' in a previous response.",
1713 - "title": "Page Token",
1714 - "type": "string"
1715 - },
1716 - "person_fields": {
1717 - "default": "emailAddresses,names,birthdays,genders",
1718 - "description": "Comma-separated person fields to retrieve for each contact (e.g., 'names,emailAddresses').",
1719 - "examples": [
1720 - "addresses",
1721 - "ageRanges",
1722 - "biographies",
1723 - "birthdays",
1724 - "coverPhotos",
1725 - "emailAddresses",
1726 - "events",
1727 - "genders",
1728 - "imClients",
1729 - "interests",
1730 - "locales",
1731 - "memberships",
1732 - "metadata",
1733 - "names",
1734 - "nicknames",
1735 - "occupations",
1736 - "organizations",
1737 - "phoneNumbers",
1738 - "photos",
1739 - "relations",
1740 - "residences",
1741 - "sipAddresses",
1742 - "skills",
1743 - "urls",
1744 - "userDefined"
1745 - ],
1746 - "title": "Person Fields",
1747 - "type": "string"
1748 - },
1749 - "resource_name": {
1750 - "default": "people/me",
1751 - "description": "Identifier for the person resource whose connections are listed; use 'people/me' for the authenticated user.",
1752 - "title": "Resource Name",
1753 - "type": "string"
1754 - }
1755 - },
1756 - "title": "GetContactsRequest",
1757 - "type": "object"
1758 - },
1759 - "name": "Get contacts",
1760 - "no_auth": false,
1761 - "output_parameters": {
1762 - "properties": {
1763 - "data": {
1764 - "description": "Data from the action execution",
1765 - "properties": {
1766 - "response_data": {
1767 - "description": "Raw JSON response from the Google People API, typically containing a list of 'connections' (contacts) with requested 'personFields' and potentially a 'nextPageToken'.",
1768 - "title": "Response Data",
1769 - "type": "object"
1770 - }
1771 - },
1772 - "required": [
1773 - "response_data"
1774 - ],
1775 - "title": "Data",
1776 - "type": "object"
1777 - },
1778 - "error": {
1779 - "anyOf": [
1780 - {
1781 - "type": "string"
1782 - },
1783 - {
1784 - "type": "null"
1785 - }
1786 - ],
1787 - "default": null,
1788 - "description": "Error if any occurred during the execution of the action",
1789 - "title": "Error"
1790 - },
1791 - "successful": {
1792 - "description": "Whether or not the action execution was successful or not",
1793 - "title": "Successful",
1794 - "type": "boolean"
1795 - }
1796 - },
1797 - "required": [
1798 - "data",
1799 - "successful"
1800 - ],
1801 - "title": "GetContactsResponseWrapper",
1802 - "type": "object"
1803 - },
1804 - "slug": "GMAIL_GET_CONTACTS",
1805 - "tags": [
1806 - "important",
1807 - "openWorldHint",
1808 - "readOnlyHint"
1809 - ],
1810 - "toolkit": {
1811 - "name": "gmail",
1812 - "slug": "gmail",
1813 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
1814 - },
1815 - "available_versions": [
1816 - "0_1",
1817 - "latest",
1818 - "latest:base"
1819 - ],
1820 - "version": "0_1",
1821 - "scopes": [
1822 - "https://www.googleapis.com/auth/contacts",
1823 - "https://www.googleapis.com/auth/contacts.readonly"
1824 - ]
1825 - },
1826 - {
1827 - "deprecated": {
1828 - "available_versions": [
1829 - "0_1",
1830 - "latest",
1831 - "latest:base"
1832 - ],
1833 - "display_name": "Get People",
1834 - "is_deprecated": false,
1835 - "toolkit": {
1836 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
1837 - },
1838 - "version": "0_1",
1839 - "displayName": "Get People"
1840 - },
1841 - "description": "Retrieves either a specific person's details (using `resource name`) or lists 'other contacts' (if `other contacts` is true), with `person fields` specifying the data to return.",
1842 - "input_parameters": {
1843 - "properties": {
1844 - "other_contacts": {
1845 - "default": false,
1846 - "description": "If true, retrieves 'Other Contacts' (people interacted with but not explicitly saved), ignoring `resource_name` and enabling pagination/sync. If false, retrieves information for the single person specified by `resource_name`.",
1847 - "title": "Other Contacts",
1848 - "type": "boolean"
1849 - },
1850 - "page_size": {
1851 - "default": 10,
1852 - "description": "The number of 'Other Contacts' to return per page. Applicable only when `other_contacts` is true.",
1853 - "maximum": 1000,
1854 - "minimum": 1,
1855 - "title": "Page Size",
1856 - "type": "integer"
1857 - },
1858 - "page_token": {
1859 - "default": "",
1860 - "description": "An opaque token from a previous response to retrieve the next page of 'Other Contacts' results. Applicable only when `other_contacts` is true and paginating.",
1861 - "title": "Page Token",
1862 - "type": "string"
1863 - },
1864 - "person_fields": {
1865 - "default": "emailAddresses,names,birthdays,genders",
1866 - "description": "A comma-separated field mask to restrict which fields on the person (or persons) are returned. Consult the Google People API documentation for a comprehensive list of valid fields.",
1867 - "examples": [
1868 - "names,emailAddresses",
1869 - "emailAddresses,names,birthdays,genders",
1870 - "addresses,phoneNumbers,metadata"
1871 - ],
1872 - "title": "Person Fields",
1873 - "type": "string"
1874 - },
1875 - "resource_name": {
1876 - "default": "people/me",
1877 - "description": "Resource name identifying the person for whom to retrieve information (like the authenticated user or a specific contact). Used only when `other_contacts` is false.",
1878 - "examples": [
1879 - "people/me",
1880 - "people/c12345678901234567890",
1881 - "people/102345678901234567890"
1882 - ],
1883 - "title": "Resource Name",
1884 - "type": "string"
1885 - },
1886 - "sync_token": {
1887 - "default": "",
1888 - "description": "A token from a previous 'Other Contacts' list call to retrieve only changes since the last sync; leave empty for an initial full sync. Applicable only when `other_contacts` is true.",
1889 - "title": "Sync Token",
1890 - "type": "string"
1891 - }
1892 - },
1893 - "title": "GetPeopleRequest",
1894 - "type": "object"
1895 - },
1896 - "name": "Get People",
1897 - "no_auth": false,
1898 - "output_parameters": {
1899 - "properties": {
1900 - "data": {
1901 - "description": "Data from the action execution",
1902 - "properties": {
1903 - "other_contacts": {
1904 - "default": {},
1905 - "description": "Contains the list of 'Other Contacts', potentially including tokens for pagination or future syncs. Populated when `other_contacts` is true.",
1906 - "title": "Other Contacts",
1907 - "type": "object"
1908 - },
1909 - "people_data": {
1910 - "default": {},
1911 - "description": "Contains the person's data as requested, populated when `other_contacts` is false and a single person is fetched.",
1912 - "title": "People Data",
1913 - "type": "object"
1914 - }
1915 - },
1916 - "title": "Data",
1917 - "type": "object"
1918 - },
1919 - "error": {
1920 - "anyOf": [
1921 - {
1922 - "type": "string"
1923 - },
1924 - {
1925 - "type": "null"
1926 - }
1927 - ],
1928 - "default": null,
1929 - "description": "Error if any occurred during the execution of the action",
1930 - "title": "Error"
1931 - },
1932 - "successful": {
1933 - "description": "Whether or not the action execution was successful or not",
1934 - "title": "Successful",
1935 - "type": "boolean"
1936 - }
1937 - },
1938 - "required": [
1939 - "data",
1940 - "successful"
1941 - ],
1942 - "title": "GetPeopleResponseWrapper",
1943 - "type": "object"
1944 - },
1945 - "slug": "GMAIL_GET_PEOPLE",
1946 - "tags": [
1947 - "readOnlyHint",
1948 - "openWorldHint"
1949 - ],
1950 - "toolkit": {
1951 - "name": "gmail",
1952 - "slug": "gmail",
1953 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
1954 - },
1955 - "available_versions": [
1956 - "0_1",
1957 - "latest",
1958 - "latest:base"
1959 - ],
1960 - "version": "0_1",
1961 - "scopes": [
1962 - "https://www.googleapis.com/auth/contacts.other.readonly",
1963 - "https://www.googleapis.com/auth/contacts.other"
1964 - ]
1965 - },
1966 - {
1967 - "deprecated": {
1968 - "available_versions": [
1969 - "0_1",
1970 - "latest",
1971 - "latest:base"
1972 - ],
1973 - "display_name": "Get Profile",
1974 - "is_deprecated": false,
1975 - "toolkit": {
1976 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
1977 - },
1978 - "version": "0_1",
1979 - "displayName": "Get Profile"
1980 - },
1981 - "description": "Retrieves key gmail profile information (email address, message/thread totals, history id) for a user.",
1982 - "input_parameters": {
1983 - "properties": {
1984 - "user_id": {
1985 - "default": "me",
1986 - "description": "The email address of the Gmail user whose profile is to be retrieved, or the special value 'me' to indicate the currently authenticated user.",
1987 - "examples": [
1988 - "user@example.com",
1989 - "me"
1990 - ],
1991 - "title": "User Id",
1992 - "type": "string"
1993 - }
1994 - },
1995 - "title": "GetProfileRequest",
1996 - "type": "object"
1997 - },
1998 - "name": "Get Profile",
1999 - "no_auth": false,
2000 - "output_parameters": {
2001 - "properties": {
2002 - "data": {
2003 - "description": "Data from the action execution",
2004 - "properties": {
2005 - "response_data": {
2006 - "description": "The user's Gmail profile information. Key fields typically include 'emailAddress' (primary email), 'messagesTotal' (total messages), 'threadsTotal' (total threads), and 'historyId' (mailbox history ID).",
2007 - "title": "Response Data",
2008 - "type": "object"
2009 - }
2010 - },
2011 - "required": [
2012 - "response_data"
2013 - ],
2014 - "title": "Data",
2015 - "type": "object"
2016 - },
2017 - "error": {
2018 - "anyOf": [
2019 - {
2020 - "type": "string"
2021 - },
2022 - {
2023 - "type": "null"
2024 - }
2025 - ],
2026 - "default": null,
2027 - "description": "Error if any occurred during the execution of the action",
2028 - "title": "Error"
2029 - },
2030 - "successful": {
2031 - "description": "Whether or not the action execution was successful or not",
2032 - "title": "Successful",
2033 - "type": "boolean"
2034 - }
2035 - },
2036 - "required": [
2037 - "data",
2038 - "successful"
2039 - ],
2040 - "title": "GetProfileResponseWrapper",
2041 - "type": "object"
2042 - },
2043 - "slug": "GMAIL_GET_PROFILE",
2044 - "tags": [
2045 - "readOnlyHint",
2046 - "openWorldHint"
2047 - ],
2048 - "toolkit": {
2049 - "name": "gmail",
2050 - "slug": "gmail",
2051 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
2052 - },
2053 - "available_versions": [
2054 - "0_1",
2055 - "latest",
2056 - "latest:base"
2057 - ],
2058 - "version": "0_1",
2059 - "scopes": []
2060 - },
2061 - {
2062 - "deprecated": {
2063 - "available_versions": [
2064 - "0_1",
2065 - "latest",
2066 - "latest:base"
2067 - ],
2068 - "display_name": "List drafts",
2069 - "is_deprecated": false,
2070 - "toolkit": {
2071 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
2072 - },
2073 - "version": "0_1",
2074 - "displayName": "List drafts"
2075 - },
2076 - "description": "Retrieves a paginated list of email drafts from a user's gmail account.",
2077 - "input_parameters": {
2078 - "properties": {
2079 - "max_results": {
2080 - "default": 1,
2081 - "description": "Maximum number of drafts to return per page.",
2082 - "examples": [
2083 - 10,
2084 - 100,
2085 - 500
2086 - ],
2087 - "maximum": 500,
2088 - "minimum": 1,
2089 - "title": "Max Results",
2090 - "type": "integer"
2091 - },
2092 - "page_token": {
2093 - "default": "",
2094 - "description": "Token from a previous response to retrieve a specific page of drafts.",
2095 - "examples": [
2096 - "CiaKJDhWSE5UURE9PSIsImMiOiJhYmMxMjMifQ=="
2097 - ],
2098 - "title": "Page Token",
2099 - "type": "string"
2100 - },
2101 - "user_id": {
2102 - "default": "me",
2103 - "description": "User's mailbox ID; use 'me' for the authenticated user.",
2104 - "examples": [
2105 - "me",
2106 - "user@example.com"
2107 - ],
2108 - "title": "User Id",
2109 - "type": "string"
2110 - }
2111 - },
2112 - "title": "ListDraftsRequest",
2113 - "type": "object"
2114 - },
2115 - "name": "List drafts",
2116 - "no_auth": false,
2117 - "output_parameters": {
2118 - "properties": {
2119 - "data": {
2120 - "description": "Data from the action execution",
2121 - "properties": {
2122 - "drafts": {
2123 - "description": "List of draft resources, each usually including draft 'id' and 'message' details.",
2124 - "items": {
2125 - "type": "object"
2126 - },
2127 - "title": "Drafts",
2128 - "type": "array"
2129 - },
2130 - "next_page_token": {
2131 - "anyOf": [
2132 - {
2133 - "type": "string"
2134 - },
2135 - {
2136 - "type": "null"
2137 - }
2138 - ],
2139 - "default": null,
2140 - "description": "Token for fetching the next page of drafts, if more are available.",
2141 - "title": "Next Page Token"
2142 - }
2143 - },
2144 - "required": [
2145 - "drafts"
2146 - ],
2147 - "title": "Data",
2148 - "type": "object"
2149 - },
2150 - "error": {
2151 - "anyOf": [
2152 - {
2153 - "type": "string"
2154 - },
2155 - {
2156 - "type": "null"
2157 - }
2158 - ],
2159 - "default": null,
2160 - "description": "Error if any occurred during the execution of the action",
2161 - "title": "Error"
2162 - },
2163 - "successful": {
2164 - "description": "Whether or not the action execution was successful or not",
2165 - "title": "Successful",
2166 - "type": "boolean"
2167 - }
2168 - },
2169 - "required": [
2170 - "data",
2171 - "successful"
2172 - ],
2173 - "title": "ListDraftsResponseWrapper",
2174 - "type": "object"
2175 - },
2176 - "slug": "GMAIL_LIST_DRAFTS",
2177 - "tags": [
2178 - "important",
2179 - "openWorldHint",
2180 - "readOnlyHint"
2181 - ],
2182 - "toolkit": {
2183 - "name": "gmail",
2184 - "slug": "gmail",
2185 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
2186 - },
2187 - "available_versions": [
2188 - "0_1",
2189 - "latest",
2190 - "latest:base"
2191 - ],
2192 - "version": "0_1",
2193 - "scopes": [
2194 - "https://mail.google.com/",
2195 - "https://www.googleapis.com/auth/gmail.modify",
2196 - "https://www.googleapis.com/auth/gmail.readonly"
2197 - ]
2198 - },
2199 - {
2200 - "deprecated": {
2201 - "available_versions": [
2202 - "0_1",
2203 - "latest",
2204 - "latest:base"
2205 - ],
2206 - "display_name": "List Gmail labels",
2207 - "is_deprecated": false,
2208 - "toolkit": {
2209 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
2210 - },
2211 - "version": "0_1",
2212 - "displayName": "List Gmail labels"
2213 - },
2214 - "description": "Retrieves a list of all system and user-created labels for the specified gmail account.",
2215 - "input_parameters": {
2216 - "properties": {
2217 - "user_id": {
2218 - "default": "me",
2219 - "description": "Identifies the Gmail account (owner's email or 'me' for authenticated user) for which labels will be listed.",
2220 - "examples": [
2221 - "me",
2222 - "user@example.com"
2223 - ],
2224 - "title": "User Id",
2225 - "type": "string"
2226 - }
2227 - },
2228 - "title": "ListLabelsRequest",
2229 - "type": "object"
2230 - },
2231 - "name": "List Gmail labels",
2232 - "no_auth": false,
2233 - "output_parameters": {
2234 - "properties": {
2235 - "data": {
2236 - "description": "Data from the action execution",
2237 - "properties": {
2238 - "labels": {
2239 - "description": "Retrieved label resources, each providing `id`, `name`, `type` ('system'/'user'), `messageListVisibility` (message list visibility), and `labelListVisibility` (label list visibility).",
2240 - "items": {},
2241 - "title": "Labels",
2242 - "type": "array"
2243 - }
2244 - },
2245 - "required": [
2246 - "labels"
2247 - ],
2248 - "title": "Data",
2249 - "type": "object"
2250 - },
2251 - "error": {
2252 - "anyOf": [
2253 - {
2254 - "type": "string"
2255 - },
2256 - {
2257 - "type": "null"
2258 - }
2259 - ],
2260 - "default": null,
2261 - "description": "Error if any occurred during the execution of the action",
2262 - "title": "Error"
2263 - },
2264 - "successful": {
2265 - "description": "Whether or not the action execution was successful or not",
2266 - "title": "Successful",
2267 - "type": "boolean"
2268 - }
2269 - },
2270 - "required": [
2271 - "data",
2272 - "successful"
2273 - ],
2274 - "title": "ListLabelsResponseWrapper",
2275 - "type": "object"
2276 - },
2277 - "slug": "GMAIL_LIST_LABELS",
2278 - "tags": [
2279 - "readOnlyHint",
2280 - "openWorldHint"
2281 - ],
2282 - "toolkit": {
2283 - "name": "gmail",
2284 - "slug": "gmail",
2285 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
2286 - },
2287 - "available_versions": [
2288 - "0_1",
2289 - "latest",
2290 - "latest:base"
2291 - ],
2292 - "version": "0_1",
2293 - "scopes": [
2294 - "https://www.googleapis.com/auth/gmail.labels"
2295 - ]
2296 - },
2297 - {
2298 - "deprecated": {
2299 - "available_versions": [
2300 - "0_1",
2301 - "latest",
2302 - "latest:base"
2303 - ],
2304 - "display_name": "List threads",
2305 - "is_deprecated": false,
2306 - "toolkit": {
2307 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
2308 - },
2309 - "version": "0_1",
2310 - "displayName": "List threads"
2311 - },
2312 - "description": "Retrieves a list of email threads from a gmail account, identified by `user id` (email address or 'me'), supporting filtering and pagination.",
2313 - "input_parameters": {
2314 - "properties": {
2315 - "max_results": {
2316 - "default": 10,
2317 - "description": "Maximum number of threads to return.",
2318 - "examples": [
2319 - "10",
2320 - "50",
2321 - "100"
2322 - ],
2323 - "maximum": 500,
2324 - "minimum": 1,
2325 - "title": "Max Results",
2326 - "type": "integer"
2327 - },
2328 - "page_token": {
2329 - "default": "",
2330 - "description": "Token from a previous response to retrieve a specific page of results; omit for the first page.",
2331 - "examples": [
2332 - "abcPageToken123"
2333 - ],
2334 - "title": "Page Token",
2335 - "type": "string"
2336 - },
2337 - "query": {
2338 - "default": "",
2339 - "description": "Filter for threads, using Gmail search query syntax (e.g., 'from:user@example.com is:unread').",
2340 - "examples": [
2341 - "is:unread",
2342 - "from:john.doe@example.com",
2343 - "subject:important"
2344 - ],
2345 - "title": "Query",
2346 - "type": "string"
2347 - },
2348 - "user_id": {
2349 - "default": "me",
2350 - "description": "The user's email address or 'me' to specify the authenticated Gmail account.",
2351 - "examples": [
2352 - "me",
2353 - "user@example.com"
2354 - ],
2355 - "title": "User Id",
2356 - "type": "string"
2357 - }
2358 - },
2359 - "title": "ListThreadsRequest",
2360 - "type": "object"
2361 - },
2362 - "name": "List threads",
2363 - "no_auth": false,
2364 - "output_parameters": {
2365 - "properties": {
2366 - "data": {
2367 - "description": "Data from the action execution",
2368 - "properties": {
2369 - "next_page_token": {
2370 - "default": null,
2371 - "description": "Token for the next page of results; if present, use as `page_token` in a subsequent request to fetch more threads.",
2372 - "title": "Next Page Token",
2373 - "type": "string"
2374 - },
2375 - "threads": {
2376 - "description": "List of email thread resources, each usually containing 'id', 'snippet', and 'historyId'.",
2377 - "items": {},
2378 - "title": "Threads",
2379 - "type": "array"
2380 - }
2381 - },
2382 - "required": [
2383 - "threads"
2384 - ],
2385 - "title": "Data",
2386 - "type": "object"
2387 - },
2388 - "error": {
2389 - "anyOf": [
2390 - {
2391 - "type": "string"
2392 - },
2393 - {
2394 - "type": "null"
2395 - }
2396 - ],
2397 - "default": null,
2398 - "description": "Error if any occurred during the execution of the action",
2399 - "title": "Error"
2400 - },
2401 - "successful": {
2402 - "description": "Whether or not the action execution was successful or not",
2403 - "title": "Successful",
2404 - "type": "boolean"
2405 - }
2406 - },
2407 - "required": [
2408 - "data",
2409 - "successful"
2410 - ],
2411 - "title": "ListThreadsResponseWrapper",
2412 - "type": "object"
2413 - },
2414 - "slug": "GMAIL_LIST_THREADS",
2415 - "tags": [
2416 - "readOnlyHint",
2417 - "openWorldHint"
2418 - ],
2419 - "toolkit": {
2420 - "name": "gmail",
2421 - "slug": "gmail",
2422 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
2423 - },
2424 - "available_versions": [
2425 - "0_1",
2426 - "latest",
2427 - "latest:base"
2428 - ],
2429 - "version": "0_1",
2430 - "scopes": [
2431 - "https://mail.google.com/",
2432 - "https://www.googleapis.com/auth/gmail.metadata",
2433 - "https://www.googleapis.com/auth/gmail.modify",
2434 - "https://www.googleapis.com/auth/gmail.readonly"
2435 - ]
2436 - },
2437 - {
2438 - "deprecated": {
2439 - "available_versions": [
2440 - "0_1",
2441 - "latest",
2442 - "latest:base"
2443 - ],
2444 - "display_name": "Modify thread labels",
2445 - "is_deprecated": false,
2446 - "toolkit": {
2447 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
2448 - },
2449 - "version": "0_1",
2450 - "displayName": "Modify thread labels"
2451 - },
2452 - "description": "Adds or removes specified existing label ids from a gmail thread, affecting all its messages; ensure the thread id is valid.",
2453 - "input_parameters": {
2454 - "properties": {
2455 - "add_label_ids": {
2456 - "default": [],
2457 - "description": "List of label IDs to add to the thread; these labels must exist.",
2458 - "examples": [
2459 - [
2460 - "STARRED",
2461 - "INBOX"
2462 - ]
2463 - ],
2464 - "items": {
2465 - "type": "string"
2466 - },
2467 - "title": "Add Label Ids",
2468 - "type": "array"
2469 - },
2470 - "remove_label_ids": {
2471 - "default": [],
2472 - "description": "List of label IDs to remove from the thread; these labels must exist.",
2473 - "examples": [
2474 - [
2475 - "IMPORTANT",
2476 - "CATEGORY_UPDATES"
2477 - ]
2478 - ],
2479 - "items": {
2480 - "type": "string"
2481 - },
2482 - "title": "Remove Label Ids",
2483 - "type": "array"
2484 - },
2485 - "thread_id": {
2486 - "description": "Immutable ID of the thread to modify.",
2487 - "examples": [
2488 - "18ea7715b619f09c"
2489 - ],
2490 - "title": "Thread Id",
2491 - "type": "string"
2492 - },
2493 - "user_id": {
2494 - "default": "me",
2495 - "description": "User's email address or 'me' for the authenticated user.",
2496 - "examples": [
2497 - "user@example.com",
2498 - "me"
2499 - ],
2500 - "title": "User Id",
2501 - "type": "string"
2502 - }
2503 - },
2504 - "required": [
2505 - "thread_id"
2506 - ],
2507 - "title": "ModifyThreadLabelsRequest",
2508 - "type": "object"
2509 - },
2510 - "name": "Modify thread labels",
2511 - "no_auth": false,
2512 - "output_parameters": {
2513 - "properties": {
2514 - "data": {
2515 - "description": "Data from the action execution",
2516 - "properties": {
2517 - "response_dict": {
2518 - "description": "Full Thread resource from the Gmail API as a dictionary, representing the thread's state after modification.",
2519 - "title": "Response Dict",
2520 - "type": "object"
2521 - },
2522 - "success": {
2523 - "description": "Indicates whether the labels were successfully modified on the thread.",
2524 - "title": "Success",
2525 - "type": "boolean"
2526 - }
2527 - },
2528 - "required": [
2529 - "success",
2530 - "response_dict"
2531 - ],
2532 - "title": "Data",
2533 - "type": "object"
2534 - },
2535 - "error": {
2536 - "anyOf": [
2537 - {
2538 - "type": "string"
2539 - },
2540 - {
2541 - "type": "null"
2542 - }
2543 - ],
2544 - "default": null,
2545 - "description": "Error if any occurred during the execution of the action",
2546 - "title": "Error"
2547 - },
2548 - "successful": {
2549 - "description": "Whether or not the action execution was successful or not",
2550 - "title": "Successful",
2551 - "type": "boolean"
2552 - }
2553 - },
2554 - "required": [
2555 - "data",
2556 - "successful"
2557 - ],
2558 - "title": "ModifyThreadLabelsResponseWrapper",
2559 - "type": "object"
2560 - },
2561 - "slug": "GMAIL_MODIFY_THREAD_LABELS",
2562 - "tags": [
2563 - "idempotentHint",
2564 - "openWorldHint"
2565 - ],
2566 - "toolkit": {
2567 - "name": "gmail",
2568 - "slug": "gmail",
2569 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
2570 - },
2571 - "available_versions": [
2572 - "0_1",
2573 - "latest",
2574 - "latest:base"
2575 - ],
2576 - "version": "0_1",
2577 - "scopes": [
2578 - "https://mail.google.com/",
2579 - "https://www.googleapis.com/auth/gmail.modify"
2580 - ]
2581 - },
2582 - {
2583 - "deprecated": {
2584 - "available_versions": [
2585 - "0_1",
2586 - "latest",
2587 - "latest:base"
2588 - ],
2589 - "display_name": "Move to Trash",
2590 - "is_deprecated": false,
2591 - "toolkit": {
2592 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
2593 - },
2594 - "version": "0_1",
2595 - "displayName": "Move to Trash"
2596 - },
2597 - "description": "Moves an existing, non-deleted email message to the trash for the specified user.",
2598 - "input_parameters": {
2599 - "properties": {
2600 - "message_id": {
2601 - "description": "Identifier of the email message to move to trash.",
2602 - "examples": [
2603 - "1875f42779f726f2"
2604 - ],
2605 - "title": "Message Id",
2606 - "type": "string"
2607 - },
2608 - "user_id": {
2609 - "default": "me",
2610 - "description": "User's email address or 'me' for the authenticated user.",
2611 - "examples": [
2612 - "user@example.com",
2613 - "me"
2614 - ],
2615 - "title": "User Id",
2616 - "type": "string"
2617 - }
2618 - },
2619 - "required": [
2620 - "message_id"
2621 - ],
2622 - "title": "MoveToTrashRequest",
2623 - "type": "object"
2624 - },
2625 - "name": "Move to Trash",
2626 - "no_auth": false,
2627 - "output_parameters": {
2628 - "properties": {
2629 - "data": {
2630 - "description": "Data from the action execution",
2631 - "properties": {
2632 - "email": {
2633 - "description": "The Message resource that was moved to trash, including ID, thread ID, and 'TRASH' in label IDs.",
2634 - "title": "Email",
2635 - "type": "object"
2636 - }
2637 - },
2638 - "required": [
2639 - "email"
2640 - ],
2641 - "title": "Data",
2642 - "type": "object"
2643 - },
2644 - "error": {
2645 - "anyOf": [
2646 - {
2647 - "type": "string"
2648 - },
2649 - {
2650 - "type": "null"
2651 - }
2652 - ],
2653 - "default": null,
2654 - "description": "Error if any occurred during the execution of the action",
2655 - "title": "Error"
2656 - },
2657 - "successful": {
2658 - "description": "Whether or not the action execution was successful or not",
2659 - "title": "Successful",
2660 - "type": "boolean"
2661 - }
2662 - },
2663 - "required": [
2664 - "data",
2665 - "successful"
2666 - ],
2667 - "title": "MoveToTrashResponseWrapper",
2668 - "type": "object"
2669 - },
2670 - "slug": "GMAIL_MOVE_TO_TRASH",
2671 - "tags": [
2672 - "destructiveHint",
2673 - "important",
2674 - "openWorldHint"
2675 - ],
2676 - "toolkit": {
2677 - "name": "gmail",
2678 - "slug": "gmail",
2679 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
2680 - },
2681 - "available_versions": [
2682 - "0_1",
2683 - "latest",
2684 - "latest:base"
2685 - ],
2686 - "version": "0_1",
2687 - "scopes": [
2688 - "https://mail.google.com/",
2689 - "https://www.googleapis.com/auth/gmail.modify"
2690 - ]
2691 - },
2692 - {
2693 - "deprecated": {
2694 - "available_versions": [
2695 - "0_1",
2696 - "latest",
2697 - "latest:base"
2698 - ],
2699 - "display_name": "Patch Label",
2700 - "is_deprecated": false,
2701 - "toolkit": {
2702 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
2703 - },
2704 - "version": "0_1",
2705 - "displayName": "Patch Label"
2706 - },
2707 - "description": "Patches the specified label.",
2708 - "input_parameters": {
2709 - "properties": {
2710 - "color": {
2711 - "anyOf": [
2712 - {
2713 - "properties": {
2714 - "backgroundColor": {
2715 - "anyOf": [
2716 - {
2717 - "type": "string"
2718 - },
2719 - {
2720 - "type": "null"
2721 - }
2722 - ],
2723 - "default": null,
2724 - "description": "The background color of the label, represented as a hex string. Example: #ffffff",
2725 - "examples": [
2726 - "#ffffff"
2727 - ],
2728 - "title": "Backgroundcolor"
2729 - },
2730 - "textColor": {
2731 - "anyOf": [
2732 - {
2733 - "type": "string"
2734 - },
2735 - {
2736 - "type": "null"
2737 - }
2738 - ],
2739 - "default": null,
2740 - "description": "The text color of the label, represented as a hex string. Example: #000000",
2741 - "examples": [
2742 - "#000000"
2743 - ],
2744 - "title": "Textcolor"
2745 - }
2746 - },
2747 - "title": "PatchLabelColor",
2748 - "type": "object"
2749 - },
2750 - {
2751 - "type": "null"
2752 - }
2753 - ],
2754 - "default": null,
2755 - "description": "The color to assign to the label. Color is only available for labels that have their `type` set to `user`.",
2756 - "title": "Color",
2757 - "type": "object"
2758 - },
2759 - "id": {
2760 - "description": "The ID of the label to update.",
2761 - "examples": [
2762 - "LABEL_123"
2763 - ],
2764 - "title": "Id",
2765 - "type": "string"
2766 - },
2767 - "labelListVisibility": {
2768 - "anyOf": [
2769 - {
2770 - "type": "string"
2771 - },
2772 - {
2773 - "type": "null"
2774 - }
2775 - ],
2776 - "default": null,
2777 - "description": "The visibility of the label in the label list in the Gmail web interface.",
2778 - "examples": [
2779 - "labelShow",
2780 - "labelShowIfUnread",
2781 - "labelHide"
2782 - ],
2783 - "title": "Label List Visibility",
2784 - "type": "string"
2785 - },
2786 - "messageListVisibility": {
2787 - "anyOf": [
2788 - {
2789 - "type": "string"
2790 - },
2791 - {
2792 - "type": "null"
2793 - }
2794 - ],
2795 - "default": null,
2796 - "description": "The visibility of messages with this label in the message list in the Gmail web interface.",
2797 - "examples": [
2798 - "show",
2799 - "hide"
2800 - ],
2801 - "title": "Message List Visibility",
2802 - "type": "string"
2803 - },
2804 - "name": {
2805 - "anyOf": [
2806 - {
2807 - "type": "string"
2808 - },
2809 - {
2810 - "type": "null"
2811 - }
2812 - ],
2813 - "default": null,
2814 - "description": "The display name of the label.",
2815 - "examples": [
2816 - "My Updated Label"
2817 - ],
2818 - "title": "Name",
2819 - "type": "string"
2820 - },
2821 - "userId": {
2822 - "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.",
2823 - "examples": [
2824 - "me",
2825 - "user@example.com"
2826 - ],
2827 - "title": "User Id",
2828 - "type": "string"
2829 - }
2830 - },
2831 - "required": [
2832 - "userId",
2833 - "id"
2834 - ],
2835 - "title": "PatchLabelRequest",
2836 - "type": "object"
2837 - },
2838 - "name": "Patch Label",
2839 - "no_auth": false,
2840 - "output_parameters": {
2841 - "properties": {
2842 - "data": {
2843 - "description": "Data from the action execution",
2844 - "properties": {
2845 - "color": {
2846 - "anyOf": [
2847 - {
2848 - "properties": {
2849 - "backgroundColor": {
2850 - "anyOf": [
2851 - {
2852 - "type": "string"
2853 - },
2854 - {
2855 - "type": "null"
2856 - }
2857 - ],
2858 - "default": null,
2859 - "description": "The background color of the label, represented as a hex string. Example: #ffffff",
2860 - "examples": [
2861 - "#ffffff"
2862 - ],
2863 - "title": "Backgroundcolor"
2864 - },
2865 - "textColor": {
2866 - "anyOf": [
2867 - {
2868 - "type": "string"
2869 - },
2870 - {
2871 - "type": "null"
2872 - }
2873 - ],
2874 - "default": null,
2875 - "description": "The text color of the label, represented as a hex string. Example: #000000",
2876 - "examples": [
2877 - "#000000"
2878 - ],
2879 - "title": "Textcolor"
2880 - }
2881 - },
2882 - "title": "PatchLabelColor",
2883 - "type": "object"
2884 - },
2885 - {
2886 - "type": "null"
2887 - }
2888 - ],
2889 - "default": null,
2890 - "description": "The color assigned to the label.",
2891 - "title": "Color"
2892 - },
2893 - "id": {
2894 - "description": "The immutable ID of the label.",
2895 - "title": "Id",
2896 - "type": "string"
2897 - },
2898 - "labelListVisibility": {
2899 - "anyOf": [
2900 - {
2901 - "type": "string"
2902 - },
2903 - {
2904 - "type": "null"
2905 - }
2906 - ],
2907 - "default": null,
2908 - "description": "The visibility of the label in the label list in the Gmail web interface.",
2909 - "title": "Label List Visibility"
2910 - },
2911 - "messageListVisibility": {
2912 - "anyOf": [
2913 - {
2914 - "type": "string"
2915 - },
2916 - {
2917 - "type": "null"
2918 - }
2919 - ],
2920 - "default": null,
2921 - "description": "The visibility of messages with this label in the message list in the Gmail web interface.",
2922 - "title": "Message List Visibility"
2923 - },
2924 - "messagesTotal": {
2925 - "anyOf": [
2926 - {
2927 - "type": "integer"
2928 - },
2929 - {
2930 - "type": "null"
2931 - }
2932 - ],
2933 - "default": null,
2934 - "description": "The total number of messages with this label.",
2935 - "title": "Messages Total"
2936 - },
2937 - "messagesUnread": {
2938 - "anyOf": [
2939 - {
2940 - "type": "integer"
2941 - },
2942 - {
2943 - "type": "null"
2944 - }
2945 - ],
2946 - "default": null,
2947 - "description": "The number of unread messages with this label.",
2948 - "title": "Messages Unread"
2949 - },
2950 - "name": {
2951 - "anyOf": [
2952 - {
2953 - "type": "string"
2954 - },
2955 - {
2956 - "type": "null"
2957 - }
2958 - ],
2959 - "default": null,
2960 - "description": "The display name of the label.",
2961 - "title": "Name"
2962 - },
2963 - "threadsTotal": {
2964 - "anyOf": [
2965 - {
2966 - "type": "integer"
2967 - },
2968 - {
2969 - "type": "null"
2970 - }
2971 - ],
2972 - "default": null,
2973 - "description": "The total number of threads with this label.",
2974 - "title": "Threads Total"
2975 - },
2976 - "threadsUnread": {
2977 - "anyOf": [
2978 - {
2979 - "type": "integer"
2980 - },
2981 - {
2982 - "type": "null"
2983 - }
2984 - ],
2985 - "default": null,
2986 - "description": "The number of unread threads with this label.",
2987 - "title": "Threads Unread"
2988 - },
2989 - "type": {
2990 - "anyOf": [
2991 - {
2992 - "type": "string"
2993 - },
2994 - {
2995 - "type": "null"
2996 - }
2997 - ],
2998 - "default": null,
2999 - "description": "The owner type for the label. User labels are created by the user and can be modified and deleted by the user and can be applied to any message or thread.",
3000 - "title": "Type"
3001 - }
3002 - },
3003 - "required": [
3004 - "id"
3005 - ],
3006 - "title": "Data",
3007 - "type": "object"
3008 - },
3009 - "error": {
3010 - "anyOf": [
3011 - {
3012 - "type": "string"
3013 - },
3014 - {
3015 - "type": "null"
3016 - }
3017 - ],
3018 - "default": null,
3019 - "description": "Error if any occurred during the execution of the action",
3020 - "title": "Error"
3021 - },
3022 - "successful": {
3023 - "description": "Whether or not the action execution was successful or not",
3024 - "title": "Successful",
3025 - "type": "boolean"
3026 - }
3027 - },
3028 - "required": [
3029 - "data",
3030 - "successful"
3031 - ],
3032 - "title": "LabelResponseWrapper",
3033 - "type": "object"
3034 - },
3035 - "slug": "GMAIL_PATCH_LABEL",
3036 - "tags": [
3037 - "idempotentHint",
3038 - "important",
3039 - "labels",
3040 - "openWorldHint"
3041 - ],
3042 - "toolkit": {
3043 - "name": "gmail",
3044 - "slug": "gmail",
3045 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
3046 - },
3047 - "available_versions": [
3048 - "0_1",
3049 - "latest",
3050 - "latest:base"
3051 - ],
3052 - "version": "0_1",
3053 - "scopes": []
3054 - },
3055 - {
3056 - "deprecated": {
3057 - "available_versions": [
3058 - "0_1",
3059 - "latest",
3060 - "latest:base"
3061 - ],
3062 - "display_name": "Remove label",
3063 - "is_deprecated": false,
3064 - "toolkit": {
3065 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
3066 - },
3067 - "version": "0_1",
3068 - "displayName": "Remove label"
3069 - },
3070 - "description": "Permanently deletes a specific, existing user-created gmail label by its id for a user; cannot delete system labels.",
3071 - "input_parameters": {
3072 - "properties": {
3073 - "label_id": {
3074 - "description": "ID of the user-created label to be permanently deleted; must exist and not be a system label.",
3075 - "examples": [
3076 - "Label_123",
3077 - "Label_xyz789"
3078 - ],
3079 - "title": "Label Id",
3080 - "type": "string"
3081 - },
3082 - "user_id": {
3083 - "default": "me",
3084 - "description": "User's email address or 'me' for the authenticated user.",
3085 - "examples": [
3086 - "me",
3087 - "user@example.com"
3088 - ],
3089 - "title": "User Id",
3090 - "type": "string"
3091 - }
3092 - },
3093 - "required": [
3094 - "label_id"
3095 - ],
3096 - "title": "RemoveLabelRequest",
3097 - "type": "object"
3098 - },
3099 - "name": "Remove label",
3100 - "no_auth": false,
3101 - "output_parameters": {
3102 - "properties": {
3103 - "data": {
3104 - "description": "Data from the action execution",
3105 - "properties": {
3106 - "success": {
3107 - "default": null,
3108 - "description": "True if the label deletion was successful (e.g., API returned 204 status).",
3109 - "title": "Success",
3110 - "type": "boolean"
3111 - }
3112 - },
3113 - "title": "Data",
3114 - "type": "object"
3115 - },
3116 - "error": {
3117 - "anyOf": [
3118 - {
3119 - "type": "string"
3120 - },
3121 - {
3122 - "type": "null"
3123 - }
3124 - ],
3125 - "default": null,
3126 - "description": "Error if any occurred during the execution of the action",
3127 - "title": "Error"
3128 - },
3129 - "successful": {
3130 - "description": "Whether or not the action execution was successful or not",
3131 - "title": "Successful",
3132 - "type": "boolean"
3133 - }
3134 - },
3135 - "required": [
3136 - "data",
3137 - "successful"
3138 - ],
3139 - "title": "RemoveLabelResponseWrapper",
3140 - "type": "object"
3141 - },
3142 - "slug": "GMAIL_REMOVE_LABEL",
3143 - "tags": [
3144 - "destructiveHint",
3145 - "openWorldHint"
3146 - ],
3147 - "toolkit": {
3148 - "name": "gmail",
3149 - "slug": "gmail",
3150 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
3151 - },
3152 - "available_versions": [
3153 - "0_1",
3154 - "latest",
3155 - "latest:base"
3156 - ],
3157 - "version": "0_1",
3158 - "scopes": [
3159 - "https://www.googleapis.com/auth/gmail.modify"
3160 - ]
3161 - },
3162 - {
3163 - "deprecated": {
3164 - "available_versions": [
3165 - "0_1",
3166 - "latest",
3167 - "latest:base"
3168 - ],
3169 - "display_name": "Reply to email thread",
3170 - "is_deprecated": false,
3171 - "toolkit": {
3172 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
3173 - },
3174 - "version": "0_1",
3175 - "displayName": "Reply to email thread"
3176 - },
3177 - "description": "Sends a reply within a specific gmail thread using the original thread's subject, requiring a valid `thread id` and correctly formatted email addresses.",
3178 - "input_parameters": {
3179 - "properties": {
3180 - "bcc": {
3181 - "default": [],
3182 - "description": "BCC recipients' email addresses (hidden from other recipients).",
3183 - "examples": [
3184 - "[\"bcc.recipient@example.com\"]"
3185 - ],
3186 - "items": {
3187 - "type": "string"
3188 - },
3189 - "title": "Bcc",
3190 - "type": "array"
3191 - },
3192 - "cc": {
3193 - "default": [],
3194 - "description": "CC recipients' email addresses.",
3195 - "examples": [
3196 - "[\"cc.recipient1@example.com\", \"cc.recipient2@example.com\"]"
3197 - ],
3198 - "items": {
3199 - "type": "string"
3200 - },
3201 - "title": "Cc",
3202 - "type": "array"
3203 - },
3204 - "extra_recipients": {
3205 - "default": [],
3206 - "description": "Additional 'To' recipients' email addresses.",
3207 - "examples": [
3208 - "[\"jane.doe@example.com\", \"another.person@example.com\"]"
3209 - ],
3210 - "items": {
3211 - "type": "string"
3212 - },
3213 - "title": "Extra Recipients",
3214 - "type": "array"
3215 - },
3216 - "is_html": {
3217 - "default": false,
3218 - "description": "Indicates if `message_body` is HTML; if True, body must be valid HTML, if False, body should not contain HTML tags.",
3219 - "examples": [
3220 - "True",
3221 - "False"
3222 - ],
3223 - "title": "Is Html",
3224 - "type": "boolean"
3225 - },
3226 - "message_body": {
3227 - "description": "Content of the reply message, either plain text or HTML.",
3228 - "examples": [
3229 - "Dear Sir, Nice talking to you. Yours respectfully, John"
3230 - ],
3231 - "title": "Message Body",
3232 - "type": "string"
3233 - },
3234 - "recipient_email": {
3235 - "description": "Primary recipient's email address.",
3236 - "examples": [
3237 - "john@doe.com"
3238 - ],
3239 - "title": "Recipient Email",
3240 - "type": "string"
3241 - },
3242 - "thread_id": {
3243 - "description": "Identifier of the Gmail thread for the reply.",
3244 - "examples": [
3245 - "x53r3vdevff"
3246 - ],
3247 - "title": "Thread Id",
3248 - "type": "string"
3249 - },
3250 - "user_id": {
3251 - "default": "me",
3252 - "description": "Identifier for the user sending the reply; 'me' refers to the authenticated user.",
3253 - "examples": [
3254 - "me",
3255 - "user@example.com"
3256 - ],
3257 - "title": "User Id",
3258 - "type": "string"
3259 - }
3260 - },
3261 - "required": [
3262 - "thread_id",
3263 - "message_body",
3264 - "recipient_email"
3265 - ],
3266 - "title": "ReplyToThreadRequest",
3267 - "type": "object"
3268 - },
3269 - "name": "Reply to email thread",
3270 - "no_auth": false,
3271 - "output_parameters": {
3272 - "properties": {
3273 - "data": {
3274 - "description": "Data from the action execution",
3275 - "properties": {
3276 - "response_data": {
3277 - "default": null,
3278 - "description": "Raw response data from the Gmail API after sending the reply, typically including the sent message's ID.",
3279 - "title": "Response Data",
3280 - "type": "object"
3281 - }
3282 - },
3283 - "title": "Data",
3284 - "type": "object"
3285 - },
3286 - "error": {
3287 - "anyOf": [
3288 - {
3289 - "type": "string"
3290 - },
3291 - {
3292 - "type": "null"
3293 - }
3294 - ],
3295 - "default": null,
3296 - "description": "Error if any occurred during the execution of the action",
3297 - "title": "Error"
3298 - },
3299 - "successful": {
3300 - "description": "Whether or not the action execution was successful or not",
3301 - "title": "Successful",
3302 - "type": "boolean"
3303 - }
3304 - },
3305 - "required": [
3306 - "data",
3307 - "successful"
3308 - ],
3309 - "title": "ReplyToThreadResponseWrapper",
3310 - "type": "object"
3311 - },
3312 - "slug": "GMAIL_REPLY_TO_THREAD",
3313 - "tags": [
3314 - "important",
3315 - "openWorldHint"
3316 - ],
3317 - "toolkit": {
3318 - "name": "gmail",
3319 - "slug": "gmail",
3320 - "logo": "https://cdn.jsdelivr.net/gh/ComposioHQ/open-logos@master/gmail.svg"
3321 - },
3322 - "available_versions": [
3323 - "0_1",
3324 - "latest",
3325 - "latest:base"
3326 - ],
3327 - "version": "0_1",
3328 - "scopes": [
3329 - "https://mail.google.com/",
3330 - "https://www.googleapis.com/auth/gmail.modify",
3331 - "https://www.googleapis.com/auth/gmail.compose",
3332 - "https://www.googleapis.com/auth/gmail.send"
3333 - ]
3334 - }
3335 -]
\ No newline at end of file
fern/pages/src/examples/tool-generator/tool-generator.mdx deleted
-99
@@ -1,99 +0,0 @@
1 ----
2 -title: Tool Type Generator
3 -image: "https://og.composio.dev/api/og?title=Tool%20Type%20Generator" # image for socials
4 -description: "An example that show you how to showcase auth scheme and action params for tools"
5 -keywords: "tool type generator, composio, sdk, tool calling"
6 -subtitle: "Build your own platform using raw tool definitions"
7 -hide-nav-links: true
8 ----
9 -
10 -This is a bit of a checky tutorial as it is dogfooding the `docs` tool generation process.
11 -
12 -To motivate this example clearly, in our tools section — we have details about let's say [`Github`](/tools/github) tool, that shows its auth scheme, actions and their params.
13 -
14 -Now why would anyone outside of Composio want to do this? Well if you are building a platform on top of Composio, perchance a Workflow builder like langflow. You would want to show some or all of this information to your users.
15 -
16 -This is a non standard use case, that we support and love users building on top of us but if this is uninteresting to you, you can skip this tutorial.
17 -
18 -## How does one build a tool type generator?
19 -
20 -In composio, we have two internal states for tools
21 -
22 -1. Raw tool definition
23 -2. Provider tool definition
24 -
25 -The raw tool definition is an generic input output schema definition that we internally for tools, we expose it for customers if they want to build on top of it but it is not the primary way tools are normally used.
26 -
27 -The provider tool definition, translates this raw tool definition to the specific schema of a provider (by default `openai`).
28 -
29 -For building something like this, we need to use the raw tool definition.
30 -
31 -
32 -## Getting the raw tool definition
33 -
34 -Of course, you need to initiate the `Composio` sdk first and use a `COMPOSIO_API_KEY` environment variable.
35 -
36 -
37 -<SnippetCode src="fern/generators/tool_doc_generator/main.py" path="tool_doc_generator/main.py" startLine={532} endLine={534} relativeHighlightStart={2} relativeHighlightEnd={2} wordWrap />
38 -
39 -
40 -Let us see an example output for a raw `GMAIL` toolkit, with all of its tools.
41 -
42 -this is just a taste but you can see the full output [here](https://github.com/composio-dev/composio/blob/next/fern/pages/src/examples/tool-generator/output.json).
43 -
44 -<SnippetCode src="./output.json" path="output.json" startLine={1} endLine={100} />
45 -
46 -```sh
47 -jq '.[0] | keys' pages/src/examples/tool-generator/output.json
48 -[
49 - "available_versions",
50 - "deprecated",
51 - "description",
52 - "input_parameters",
53 - "name",
54 - "no_auth",
55 - "output_parameters",
56 - "scopes",
57 - "slug",
58 - "tags",
59 - "toolkit",
60 - "version"
61 -]
62 -```
63 -
64 -There is a bunch of useful information here, around the `input_parameters` and `output_parameters` for this example but `scopes` is very valuable to know what permissions are required for this tool.
65 -
66 -Now from these `input_parameters` and `output_parameters` you can showcase the tool definitions.
67 -
68 -
69 -<SnippetCode src="fern/generators/tool_doc_generator/main.py" path="tool_doc_generator/main.py" startLine={346} endLine={355} />
70 -
71 -There is a bunch of other processing things happening here that are super generally relevant, so not going to call them out here that said there is another thing i want to showcase
72 -
73 -## Toolkit Information
74 -
75 -Toolkis are what we call apps or integrations, for us they are a collection of tools. `GMAIL` has `GMAIL_SEND_EMAIL` as a tool.
76 -
77 -Now for building something out like this, you might also want information about the toolkit itself.
78 -
79 -A toolkit has information like `categories` or `auth_schemes`
80 -
81 -<SnippetCode src="fern/generators/tool_doc_generator/main.py" path="tool_doc_generator/main.py" startLine={534} endLine={537} />
82 -
83 -`auth_schemes` here are `OAUTH2`, `API_KEY` or `BASIC_AUTH`, etc — essentially the types of how one could authenticate with the toolkit.
84 -
85 -<SnippetCode src="fern/generators/tool_doc_generator/main.py" path="tool_doc_generator/main.py" startLine={543} endLine={552} />
86 -
87 -Here is a way to parse the `auth_scheme` data
88 -
89 -
90 -these are `tuple` objects as they have different schema for specific conditions like `auth_config_creation` or `connected_account_initiation`
91 -
92 -they also have `required` and `optional` fields.
93 -
94 -the context here is there are some fields you need while creating an auth config and some you need while connecting an account. this separation is done by the `tuple` here
95 -
96 -<SnippetCode src="fern/generators/tool_doc_generator/main.py" path="tool_doc_generator/main.py" startLine={224} endLine={268} />
97 -
98 -
99 -This is a fairly minimal explanation for the amount of code, as most of it is not super related to composio but it will be a good example on seeing behind the scenes of how composio is working and how to leverage the platform further.
\ No newline at end of file
fern/pages/src/examples/utility_agents/gmail_labeler.mdx deleted
-384
@@ -1,384 +0,0 @@
1 ----
2 -title: Gmail Labeler
3 -subtitle: Build an agent that automatically labels incoming Gmail messages using triggers
4 -image: "https://og.composio.dev/api/og?title=Gmail%20Labeler" # image for socials
5 -description: Build an Gmail auto labeler agent with Composio and Langchain
6 -keywords: gmail labeler, utility agent, triggers
7 ----
8 -
9 -With Composio's managed authentication, tool calling and triggers, it's easy to
10 -build the AI agents that can interact and react the real world events reducing
11 -the boilerplate required to setup and manage the authentication. This cookbook
12 -will walk you through the process of building agents using `Composio`, `LangChain`.
13 -
14 -## Prerequisites
15 -
16 -* Python3.x
17 -* [UV](https://docs.astral.sh/uv/getting-started/installation/)
18 -* Composio API key
19 -* OpenAI API key
20 -* Understanding of building AI agents (Preferably with LangChain)
21 -
22 -## Build gmail agent to label your messages
23 -
24 -```python
25 -from composio import Composio
26 -from composio_langchain import LangchainProvider
27 -
28 -from langchain import hub
29 -from langchain.agents import AgentExecutor, create_openai_functions_agent
30 -from langchain_openai import ChatOpenAI
31 -
32 -
33 -def create_agent(user_id: str, composio_client: Composio[LangchainProvider]):
34 - """
35 - Create an agent for a given user id.
36 - """
37 - # Step 1: Get all the tools
38 - tools = composio_client.tools.get(
39 - user_id=user_id,
40 - tools=[
41 - "GMAIL_LIST_LABELS",
42 - "GMAIL_ADD_LABEL_TO_EMAIL",
43 - "GMAIL_CREATE_LABEL",
44 - ],
45 - )
46 -
47 - # Step 2: Pull relevant agent prompt.
48 - prompt = hub.pull("hwchase17/openai-functions-agent")
49 -
50 - # Step 3: Initialize chat model.
51 - openai_client = ChatOpenAI(model="gpt-5")
52 -
53 - # Step 4: Define agent
54 - return AgentExecutor(
55 - agent=create_openai_functions_agent(
56 - openai_client,
57 - tools,
58 - prompt,
59 - ),
60 - tools=tools,
61 - verbose=False,
62 - )
63 -```
64 -
65 -## Authenticating users
66 -
67 -To authenticate your users with Composio you need an auth config for the given
68 -app, In this case you need one for gmail. You can create and manage auth configs
69 -from the [dashboard](https://platform.composio.dev/?next_page=/auth-configs?create_auth_config=gmail).
70 -Composio platform provides composio managed authentication for some apps to help
71 -you fast-track your development, `gmail` being one of them. You can use these
72 -default auth configs for development, but for production you should always use
73 -your own oauth app configuration.
74 -
75 -Using dashboard is the preferred way of managing authentication configs, but if
76 -you want to do it manually you can follow the guide below
77 -
78 -<details>
79 -
80 -<summary>Click to expand</summary>
81 -
82 -To create an authentication config for `gmail` you need `client_id` and `client_secret`
83 -from your from your [Google OAuth Console](https://developers.google.com/identity/protocols/oauth2).
84 -Once you have the required credentials you can use the following piece of
85 -code to set up authentication for `gmail`.
86 -
87 -```python
88 -from composio import Composio
89 -from composio_langchain import LangchainProvider
90 -
91 -def create_auth_config(composio_client: Composio[OpenAIProvider]):
92 - """
93 - Create a auth config for the gmail toolkit.
94 - """
95 - client_id = os.getenv("GMAIL_CLIENT_ID")
96 - client_secret = os.getenv("GMAIL_CLIENT_SECRET")
97 - if not client_id or not client_secret:
98 - raise ValueError("GMAIL_CLIENT_ID and GMAIL_CLIENT_SECRET must be set")
99 -
100 - return composio_client.auth_configs.create(
101 - toolkit="gmail",
102 - options={
103 - "name": "default_gmail_auth_config",
104 - "type": "use_custom_auth",
105 - "auth_scheme": "OAUTH2",
106 - "credentials": {
107 - "client_id": client_id,
108 - "client_secret": client_secret,
109 - },
110 - },
111 - )
112 -```
113 -
114 -This will create an authentication config for `gmail` which you can use to
115 -authenticate your users for your app. Ideally you should just create one
116 -authentication object per project, so check for an existing auth config
117 -before you create a new one.
118 -
119 -```python
120 -def fetch_auth_config(composio_client: Composio[OpenAIProvider]):
121 - """
122 - Fetch the auth config for a given user id.
123 - """
124 - auth_configs = composio_client.auth_configs.list()
125 - for auth_config in auth_configs.items:
126 - if auth_config.toolkit == "gmail":
127 - return auth_config
128 -
129 - return None
130 -```
131 -</details>
132 -
133 -Once you have authentication management in place, we can start with connecting
134 -your users to your `gmail` app. Let's implement a function to connect the users
135 -to your `gmail` app via composio.
136 -
137 -```python
138 -# Function to initiate a connected account
139 -def create_connection(composio_client: Composio[OpenAIProvider], user_id: str):
140 - """
141 - Create a connection for a given user id and auth config id.
142 - """
143 - # Fetch or create the auth config for the gmail toolkit
144 - auth_config = fetch_auth_config(composio_client=composio_client)
145 - if not auth_config:
146 - auth_config = create_auth_config(composio_client=composio_client)
147 -
148 - # Create a connection for the user
149 - return composio_client.connected_accounts.initiate(
150 - user_id=user_id,
151 - auth_config_id=auth_config.id,
152 - )
153 -```
154 -
155 -Now, when creating tools for your agent always check if the user already has a
156 -connected account before creating a new one.
157 -
158 -```python
159 -def check_connected_account_exists(
160 - composio_client: Composio[LangchainProvider],
161 - user_id: str,
162 -):
163 - """
164 - Check if a connected account exists for a given user id.
165 - """
166 - # Fetch all connected accounts for the user
167 - connected_accounts = composio_client.connected_accounts.list(
168 - user_ids=[user_id],
169 - toolkit_slugs=["GMAIL"],
170 - )
171 -
172 - # Check if there's an active connected account
173 - for account in connected_accounts.items:
174 - if account.status == "ACTIVE":
175 - return True
176 -
177 - # Ideally you should not have inactive accounts, but if you do, you should delete them
178 - print(f"[warning] inactive account {account.id} found for user id: {user_id}")
179 - return False
180 -```
181 -
182 -
183 -## Creating Triggers
184 -
185 -You can use triggers to make your agents react to real world events. In this example,
186 -we will use triggers to invoke your agent everytime there's a new message in your
187 -gmail inbox.
188 -
189 -```python
190 -# Create a new trigger
191 -def create_trigger(
192 - composio_client: Composio[LangchainProvider],
193 - connected_account_id: str,
194 -) -> str:
195 - """
196 - Create a trigger.
197 - """
198 - response = composio_client.triggers.create(
199 - slug="GMAIL_NEW_GMAIL_MESSAGE",
200 - connected_account_id=connected_account_id,
201 - trigger_config={},
202 - )
203 - return response.trigger_id
204 -```
205 -
206 -When creating triggers, make sure there are no duplicate triggers. Use following
207 -code as reference for checking if trigger for given connected account exists or not.
208 -
209 -```python
210 -def check_trigger_exists(
211 - composio_client: Composio[LangchainProvider],
212 - connected_account_id: str,
213 -) -> t.Optional[str]:
214 - """
215 - Check if a trigger exists.
216 - """
217 - triggers = composio_client.triggers.list_active(
218 - trigger_names=["GMAIL_NEW_GMAIL_MESSAGE"],
219 - connected_account_ids=[connected_account_id],
220 - )
221 - for trigger in triggers.items:
222 - return trigger.id
223 - return None
224 -```
225 -
226 -
227 -Once trigger is created, you can listen to events using a trigger subscription.
228 -
229 -```python
230 -# Create subscription object
231 -trigger_subscription = composio_client.triggers.subscribe()
232 -
233 -# Register event handler
234 -@trigger_subscription.handle(
235 - trigger_id="<TRIGGER_ID>", # Filter out events that does not belong this trigger id
236 - trigger_slug="GMAIL_NEW_GMAIL_MESSAGE",
237 -)
238 -def handle_event(event: TriggerEvent):
239 - print("> Received email with subject: ", event["payload"]["subject"])
240 -
241 -# Wait for events
242 -trigger_subscription.wait_forever()
243 -```
244 -
245 -## Putting everything together
246 -
247 -Let's put together everything by making the agent react to new messages in your
248 -inbox.
249 -
250 -```python
251 -# Create a trigger subscription factory
252 -
253 -def create_trigger_subscription(
254 - composio_client: Composio[LangchainProvider],
255 - trigger_slug: str,
256 - trigger_id: str,
257 - agent: AgentExecutor,
258 -):
259 - """
260 - Create a trigger subscription for the given agent.
261 - """
262 - trigger_subscription = composio_client.triggers.subscribe()
263 -
264 - @trigger_subscription.handle(
265 - trigger_slug=trigger_slug,
266 - trigger_id=trigger_id,
267 - )
268 - def handle_event(event: TriggerEvent):
269 - print("> Received email with subject: ", event["payload"]["subject"])
270 - result = agent.invoke(
271 - input={
272 - "input": APPLY_NEW_LABEL.format( # Check `gmail_labeler/prompt.py`
273 - message_id=event["payload"]["id"],
274 - message_subject=event["payload"]["subject"],
275 - message_text=event["payload"]["message_text"],
276 - )
277 - }
278 - )
279 - print("> Result: ", result["output"])
280 -
281 - return trigger_subscription
282 -```
283 -
284 -Package everything as a single entry point.
285 -
286 -```python
287 -def run_agent(user_id: str):
288 - # Create composio client
289 - composio_client = Composio(provider=LangchainProvider())
290 -
291 - # Validate conected account
292 - connected_account_id = check_connected_account_exists(composio_client, user_id)
293 - if connected_account_id is None:
294 - connection_request = create_connection(composio_client, user_id)
295 - print(
296 - f"Authenticate with the following link: {connection_request.redirect_url}"
297 - )
298 - connection_request.wait_for_connection()
299 - connected_account_id = connection_request.id
300 -
301 - # Check if trigger exists, create if not
302 - trigger_id = check_trigger_exists(
303 - composio_client=composio_client,
304 - connected_account_id=connected_account_id,
305 - )
306 - if trigger_id is None:
307 - trigger_id = create_trigger(
308 - composio_client=composio_client,
309 - connected_account_id=connected_account_id,
310 - )
311 -
312 - # Create agent
313 - agent = create_agent(user_id=user_id, composio_client=composio_client)
314 -
315 - # Create trigger subscription
316 - trigger_subscription = create_trigger_subscription(
317 - composio_client=composio_client,
318 - trigger_slug=GMAIL_NEW_GMAIL_MESSAGE_TRIGGER,
319 - trigger_id=trigger_id,
320 - agent=agent,
321 - )
322 -
323 - # Wait forever
324 - print("Waiting for events...")
325 - trigger_subscription.wait_forever()
326 -```
327 -
328 -To test the above function as CLI, follow the steps below
329 -
330 -1. Clone the repository
331 - ```bash
332 - git clone git@github.com:composiohq/gmail-labeler
333 - cd gmail-labeler/
334 - ```
335 -2. Setup environment
336 - ```bash
337 - cp .env.example .env
338 - ```
339 -
340 - Fill the api keys
341 - ```dotenv
342 - COMPOSIO_API_KEY=
343 - OPENAI_API_KEY=
344 - ```
345 -
346 - Create the virtual env
347 - ```bash
348 - make env
349 - source .venv/bin/activate
350 - ```
351 -3. Run the agent
352 - ```bash
353 - python gmail_labeler --user-id "default"
354 - ```
355 -
356 -## Using Composio for managed auth and tools
357 -
358 -Composio reduces a lot of boilerplate for building AI agents with ability access and use a wide variety of apps. For example in this cookbook, to build `gmail` integration without composio you would have to write code to
359 -- manage `gmail` oauth app
360 -- manage user connections
361 -- tools for your agents to interact with `gmail`
362 -- Infra for listening to changes in your gmail inbox
363 -
364 -Using composio simplifies all of the above to a few lines of code as we've seen the cookbook.
365 -
366 -## Best practices
367 -
368 -**🔒 User Management**:
369 -
370 -- Use unique, consistent `user_id` values for each person
371 -- Each user maintains their own gmail connection
372 -- User IDs can be email addresses, usernames, or any unique identifier
373 -
374 -## Troubleshooting
375 -
376 -**Connection Issues**:
377 -- Ensure your `.env` file has valid `COMPOSIO_API_KEY` and `OPENAI_API_KEY`
378 -- Check that the user has completed `gmail` authorization
379 -- Verify the user_id matches exactly between requests
380 -
381 -**API Errors**:
382 -- Check the server logs for detailed error messages
383 -- Ensure request payloads match the expected format
384 -- Visit `/docs` endpoint for API schema validation
fern/pages/src/examples/utility_agents/slack_summariser.mdx deleted
-306
@@ -1,306 +0,0 @@
1 ----
2 -title: Slack summariser
3 -subtitle: Build an agent that summarizes Slack channel messages
4 -image: "https://og.composio.dev/api/og?title=Slack%20summariser" # image for socials
5 -description: Build a slack summarizer using Composio and Langchain
6 -keywords: slack, summariser, utility agent
7 ----
8 -
9 -With Composio's managed authentication and tool calling, it's easy to build the
10 -AI agents that can interact with the real world while reducing the boilerplate
11 -required to setup and manage the authentication. This cookbook will walk you through
12 -the process of building agents using `Composio`, `LangChain`.
13 -
14 -## Prerequisites
15 -
16 -* Python3.x
17 -* [UV](https://docs.astral.sh/uv/getting-started/installation/)
18 -* Composio API key
19 -* OpenAI API key
20 -* Understanding of building AI agents (Preferably with LangChain)
21 -
22 -## Build slack agent
23 -
24 -Let's start by building an agent that can interact with your slack workspace using Composio.
25 -
26 -```python
27 -from composio import Composio
28 -from composio_langchain import LangchainProvider
29 -
30 -from langchain import hub
31 -from langchain.agents import AgentExecutor, create_openai_functions_agent
32 -from langchain_openai import ChatOpenAI
33 -
34 -
35 -def create_agent(user_id: str, composio_client: Composio[LangchainProvider]):
36 - """
37 - Create an agent for a given user id.
38 - """
39 - # Step 1: Get all the tools
40 - tools = composio_client.tools.get(
41 - user_id=user_id,
42 - toolkits=["SLACK"],
43 - )
44 -
45 - # Step 2: Pull relevant agent prompt.
46 - prompt = hub.pull("hwchase17/openai-functions-agent")
47 -
48 - # Step 3: Initialize chat model.
49 - openai_client = ChatOpenAI(model="gpt-5")
50 -
51 - # Step 4: Define agent
52 - return AgentExecutor(
53 - agent=create_openai_functions_agent(
54 - openai_client,
55 - tools,
56 - prompt,
57 - ),
58 - tools=tools,
59 - verbose=True,
60 - )
61 -```
62 -
63 -
64 -## Authenticating users
65 -
66 -To authenticate your users with Composio you need an auth config for the given
67 -app, In this case you need one for slack. You can create and manage auth configs
68 -from the [dashboard](https://platform.composio.dev/?next_page=/auth-configs?create_auth_config=slack).
69 -
70 -Composio platform provides composio managed authentication for some apps to help
71 -you fast-track your development, `slack` being one of them. You can use these
72 -default auth configs for development, but for production you should always use
73 -your own oauth app configuration.
74 -
75 -Using dashboard is the preferred way of managing authentication configs, but if
76 -you want to do it manually you can follow the guide below
77 -
78 -<details>
79 -
80 -<summary>Click to expand</summary>
81 -
82 ----
83 -
84 -To create an authentication config for `slack` you need `client_id` and `client_secret`
85 -from your Slack [App](https://api.slack.com/apps). Once you have the required credentials
86 -you can use the following piece of code to set up authentication for `slack`.
87 -
88 -```python
89 -from composio import Composio
90 -from composio_langchain import LangchainProvider
91 -
92 -def create_auth_config(composio_client: Composio[OpenAIProvider]):
93 - """
94 - Create a auth config for the slack toolkit.
95 - """
96 - client_id = os.getenv("SLACK_CLIENT_ID")
97 - client_secret = os.getenv("SLACK_CLIENT_SECRET")
98 - if not client_id or not client_secret:
99 - raise ValueError("SLACK_CLIENT_ID and SLACK_CLIENT_SECRET must be set")
100 -
101 - return composio_client.auth_configs.create(
102 - toolkit="SLACK",
103 - options={
104 - "name": "default_slack_auth_config",
105 - "type": "use_custom_auth",
106 - "auth_scheme": "OAUTH2",
107 - "credentials": {
108 - "client_id": client_id,
109 - "client_secret": client_secret,
110 - },
111 - },
112 - )
113 -```
114 -
115 -This will create an authentication config for `slack` which you can use to
116 -authenticate your users for your app. Ideally you should just create one
117 -authentication object per project, so check for an existing auth config
118 -before you create a new one.
119 -
120 -```python
121 -def fetch_auth_config(composio_client: Composio[OpenAIProvider]):
122 - """
123 - Fetch the auth config for a given user id.
124 - """
125 - auth_configs = composio_client.auth_configs.list()
126 - for auth_config in auth_configs.items:
127 - if auth_config.toolkit == "SLACK":
128 - return auth_config
129 -
130 - return None
131 -```
132 -</details>
133 -
134 -Once you have authentication management in place, we can start with connecting
135 -your users to your `slack` app. Let's implement a function to connect the users
136 -to your `slack` app via composio.
137 -
138 -```python
139 -
140 -# Function to initiate a connected account
141 -def create_connection(composio_client: Composio[OpenAIProvider], user_id: str):
142 - """
143 - Create a connection for a given user id and auth config id.
144 - """
145 - # Fetch or create the auth config for the slack toolkit
146 - auth_config = fetch_auth_config(composio_client=composio_client)
147 - if not auth_config:
148 - auth_config = create_auth_config(composio_client=composio_client)
149 -
150 - # Create a connection for the user
151 - return composio_client.connected_accounts.initiate(
152 - user_id=user_id,
153 - auth_config_id=auth_config.id,
154 - )
155 -```
156 -
157 -Now, when creating tools for your agent always check if the user already has a
158 -connected account before creating a new one.
159 -
160 -```python
161 -def check_connected_account_exists(
162 - composio_client: Composio[LangchainProvider],
163 - user_id: str,
164 -):
165 - """
166 - Check if a connected account exists for a given user id.
167 - """
168 - # Fetch all connected accounts for the user
169 - connected_accounts = composio_client.connected_accounts.list(
170 - user_ids=[user_id],
171 - toolkit_slugs=["SLACK"],
172 - )
173 -
174 - # Check if there's an active connected account
175 - for account in connected_accounts.items:
176 - if account.status == "ACTIVE":
177 - return True
178 -
179 - # Ideally you should not have inactive accounts, but if you do, you should delete them
180 - print(f"[warning] inactive account {account.id} found for user id: {user_id}")
181 - return False
182 -```
183 -
184 -## Modifiers
185 -
186 -In the current setup, we are expanding too much unnecessary tokens because response
187 -from `SLACK_FETCH_CONVERSATION_HISTORY` tool call contains too much unnecessary
188 -information. This can be fixed using `after_execute` modifier. An after execute
189 -modifier is called after a tool execution is complete, here you can process
190 -and modify the response object to make it more easy to consume for your agent.
191 -
192 -```python
193 -from composio import after_execute
194 -from composio.types import ToolExecutionResponse
195 -
196 -
197 -@after_execute(tools=["SLACK_FETCH_CONVERSATION_HISTORY"])
198 -def clean_conversation_history(
199 - tool: str,
200 - toolkit: str,
201 - response: ToolExecutionResponse,
202 -) -> ToolExecutionResponse:
203 - """
204 - Clean the conversation history.
205 - """
206 - if not response["data"]["ok"]:
207 - return response
208 -
209 - try:
210 - response["data"]["messages"] = [
211 - {"user": message["user"], "text": message["text"]}
212 - for message in response["data"]["messages"]
213 - if message["type"] == "message"
214 - ]
215 - except KeyError:
216 - pass
217 -
218 - return response
219 -```
220 -
221 -To register modifiers, include them in the `composio.tools.get` call.
222 -
223 -```python
224 -tools = composio_client.tools.get(
225 - user_id=user_id,
226 - toolkits=[SLACK_TOOLKIT],
227 - modifiers=[clean_conversation_history],
228 -)
229 -```
230 -
231 -## Putting everything together
232 -
233 -So far, we have created an agent with ability to interact with your `slack`
234 -workspace using the `composio` SDK, functions to manage connected accounts
235 -for users and a simple agent runner. Let's package this as a CLI tool.
236 -
237 -```python
238 -def run_agent(user_id: str, prompt: str):
239 - composio_client = Composio(provider=LangchainProvider())
240 - if not check_connected_account_exists(composio_client, user_id):
241 - connection_request = create_connection(composio_client, user_id)
242 - print(
243 - f"Authenticate with the following link: {connection_request.redirect_url}"
244 - )
245 - connection_request.wait_for_connection()
246 -
247 - agent = create_agent(user_id, composio_client)
248 - agent.invoke({"input": prompt})
249 -```
250 -
251 -To test the above function as CLI, follow the steps below
252 -
253 -1. Clone the repository
254 - ```bash
255 - git clone git@github.com:composiohq/slack-summarizer
256 - cd slack-summarizer/
257 - ```
258 -2. Setup environment
259 - ```bash
260 - cp .env.example .env
261 - ```
262 -
263 - Fill the api keys
264 - ```dotenv
265 - COMPOSIO_API_KEY=
266 - OPENAI_API_KEY=
267 - ```
268 -
269 - Create the virtual env
270 - ```bash
271 - make env
272 - source .venv/bin/activate
273 - ```
274 -3. Run the agent
275 - ```bash
276 - python slack_summariser --user-id "default" --prompt "summarise last 5 messages from #general channel"
277 - ```
278 -
279 -## Using Composio for managed auth and tools
280 -
281 -Composio reduces a lot of boilerplate for building AI agents with ability access and use a wide variety of apps. For example in this cookbook, to build `slack` integration without composio you would have to write code to
282 -- manage `slack` oauth app
283 -- manage user connections
284 -- tools for your agents to interact with `slack`
285 -
286 -Using composio simplifies all of the above to a few lines of code as we've seen the cookbook.
287 -
288 -## Best practices
289 -
290 -**🔒 User Management**:
291 -
292 -- Use unique, consistent `user_id` values for each person
293 -- Each user maintains their own slack connection
294 -- User IDs can be email addresses, usernames, or any unique identifier
295 -
296 -## Troubleshooting
297 -
298 -**Connection Issues**:
299 -- Ensure your `.env` file has valid `COMPOSIO_API_KEY` and `OPENAI_API_KEY`
300 -- Check that the user has completed `slack` authorization
301 -- Verify the user_id matches exactly between requests
302 -
303 -**API Errors**:
304 -- Check the server logs for detailed error messages
305 -- Ensure request payloads match the expected format
306 -- Visit `/docs` endpoint for API schema validation
fern/pages/src/examples/utility_agents/supabase_sql_agent.mdx deleted
-257
@@ -1,257 +0,0 @@
1 ----
2 -title: Supabase SQL Agent
3 -subtitle: Build an agent that executes SQL queries on Supabase using natural language
4 -image: "https://og.composio.dev/api/og?title=Supabase%20SQL%20Agent" # image for socials
5 -description: Build a Supabase SQL Agent with Composio and LlamaIndex.
6 -keywords: supabase, sql, agent, utility agent, llama-index
7 ----
8 -
9 -With Composio's managed authentication and tool calling, it's easy to build
10 -AI agents that interact with the real world while reducing boilerplate for
11 -setup and authentication management. This guide will walk you through using
12 -the Supabase CLI agent built with `Composio` and `LlamaIndex`.
13 -
14 -
15 -## Requirements
16 -
17 -* Python 3.10+
18 -* [UV](https://docs.astral.sh/uv/getting-started/installation/) (recommended) or pip
19 -* Composio API key
20 -* OpenAI API key
21 -* Understanding of building AI agents (Preferably with LlamaIndex)
22 -
23 -## Build an agent to perform Supabase tasks
24 -
25 -```python
26 -from composio import Composio
27 -from composio_llamaindex import LlamaIndexProvider
28 -
29 -from llama_index.llms.openai import OpenAI
30 -from llama_index.core.agent.workflow import FunctionAgent
31 -from llama_index.core.workflow import Context
32 -
33 -
34 -def create_agent(user_id: str, composio_client: Composio[LlamaIndexProvider]):
35 - """
36 - Create a function agent that can perform Supabase tasks.
37 - """
38 -
39 - # Setup client
40 - llm = OpenAI(model="gpt-5")
41 -
42 - # Get All the tools
43 - tools = composio_client.tools.get(
44 - user_id=user_id,
45 - tools=[
46 - "SUPABASE_LIST_ALL_PROJECTS",
47 - "SUPABASE_BETA_RUN_SQL_QUERY",
48 - ],
49 - )
50 -
51 - agent = FunctionAgent(
52 - tools=tools,
53 - llm=llm,
54 - system_prompt=(
55 - "You are a helpful assistant that can help with supabase queries."
56 - ),
57 - )
58 -
59 - # Since this is a continuosly running agent, we need to maintain state across
60 - # different user messages
61 - ctx = Context(workflow=agent)
62 - return agent, ctx
63 -```
64 -
65 -This agent can convert your natural language queries to SQL queries and execute
66 -them on supabase for you. For you agent to be able to execute queries, you need
67 -to authenticate the agent for supabase.
68 -
69 -
70 -## Authenticating users
71 -
72 -To authenticate your users with Composio you need an auth config for the given
73 -app, In this case you need one for supabase. You can create and manage auth configs
74 -from the [dashboard](https://platform.composio.dev/?next_page=/auth-configs?create_auth_config=supabase).
75 -Composio platform provides composio managed authentication for some apps to help
76 -you fast-track your development, `supabase` being one of them. You can use these
77 -default auth configs for development, but for production you should always use
78 -your own oauth app configuration.
79 -
80 -Using dashboard is the preferred way of managing authentication configs, but if
81 -you want to do it manually you can follow the guide below
82 -
83 -<details>
84 -
85 -<summary>Click to expand</summary>
86 -
87 ----
88 -
89 -To create an authentication config for `supabase` you need `client_id` and `client_secret`
90 -from your from your [Google OAuth Console](https://developers.google.com/identity/protocols/oauth2).
91 -Once you have the required credentials you can use the following piece of
92 -code to set up authentication for `supabase`.
93 -
94 -```python
95 -from composio import Composio
96 -from composio_langchain import LangchainProvider
97 -
98 -def create_auth_config(composio_client: Composio[OpenAIProvider]):
99 - """
100 - Create a auth config for the supabase toolkit.
101 - """
102 - client_id = os.getenv("SUPABASE_CLIENT_ID")
103 - client_secret = os.getenv("SUPABASE_CLIENT_SECRET")
104 - if not client_id or not client_secret:
105 - raise ValueError("SUPABASE_CLIENT_ID and SUPABASE_CLIENT_SECRET must be set")
106 -
107 - return composio_client.auth_configs.create(
108 - toolkit="supabase",
109 - options={
110 - "name": "default_supabase_auth_config",
111 - "type": "use_custom_auth",
112 - "auth_scheme": "OAUTH2",
113 - "credentials": {
114 - "client_id": client_id,
115 - "client_secret": client_secret,
116 - },
117 - },
118 - )
119 -```
120 -
121 -This will create an authentication config for `supabase` which you can use to
122 -authenticate your users for your app. Ideally you should just create one
123 -authentication object per project, so check for an existing auth config
124 -before you create a new one.
125 -
126 -```python
127 -def fetch_auth_config(composio_client: Composio[OpenAIProvider]):
128 - """
129 - Fetch the auth config for a given user id.
130 - """
131 - auth_configs = composio_client.auth_configs.list()
132 - for auth_config in auth_configs.items:
133 - if auth_config.toolkit == "supabase":
134 - return auth_config
135 -
136 - return None
137 -```
138 -</details>
139 -
140 -Once you have authentication management in place, we can start with connecting
141 -your users to your `supabase` app. Let's implement a function to connect the users
142 -to your `supabase` app via composio.
143 -
144 -```python
145 -# Function to initiate a connected account
146 -def create_connection(composio_client: Composio[OpenAIProvider], user_id: str):
147 - """
148 - Create a connection for a given user id and auth config id.
149 - """
150 - # Fetch or create the auth config for the supabase toolkit
151 - auth_config = fetch_auth_config(composio_client=composio_client)
152 - if not auth_config:
153 - auth_config = create_auth_config(composio_client=composio_client)
154 -
155 - # Create a connection for the user
156 - return composio_client.connected_accounts.initiate(
157 - user_id=user_id,
158 - auth_config_id=auth_config.id,
159 - )
160 -```
161 -
162 -Now, when creating tools for your agent always check if the user already has a
163 -connected account before creating a new one.
164 -
165 -```python
166 -def check_connected_account_exists(
167 - composio_client: Composio[LangchainProvider],
168 - user_id: str,
169 -):
170 - """
171 - Check if a connected account exists for a given user id.
172 - """
173 - # Fetch all connected accounts for the user
174 - connected_accounts = composio_client.connected_accounts.list(
175 - user_ids=[user_id],
176 - toolkit_slugs=["SUPABASE"],
177 - )
178 -
179 - # Check if there's an active connected account
180 - for account in connected_accounts.items:
181 - if account.status == "ACTIVE":
182 - return True
183 -
184 - # Ideally you should not have inactive accounts, but if you do, you should delete them
185 - print(f"[warning] inactive account {account.id} found for user id: {user_id}")
186 - return False
187 -```
188 -
189 -
190 -## Create a chat loop
191 -
192 -```python
193 -async def run_loop(user_id: str):
194 - # Initialize composio client.
195 - composio_client = Composio(provider=LlamaIndexProvider())
196 -
197 - # Setup connection if required
198 - if not check_connected_account_exists(
199 - composio_client=composio_client,
200 - user_id=user_id,
201 - ):
202 - connection_request = create_connection(
203 - composio_client=composio_client,
204 - user_id=user_id,
205 - )
206 - print(
207 - f"Authenticate with the following link: {connection_request.redirect_url}"
208 - )
209 -
210 - # Create agent
211 - agent, ctx = create_agent(
212 - user_id=user_id,
213 - composio_client=composio_client,
214 - )
215 -
216 - # Run a simple REPL loop
217 - while True:
218 - user_input = input("user > ")
219 - if user_input.lower() == "exit":
220 - break
221 -
222 - result = await agent.run(user_msg=user_input, ctx=ctx)
223 - print("agent > ", result)
224 - print("Exiting...")
225 -```
226 -
227 -## Using Composio for managed auth and tools
228 -
229 -Composio reduces a lot of boilerplate for building AI agents with ability access
230 -and use a wide variety of apps. For example in this cookbook, to build `supabase`
231 -integration without composio you would have to write code to
232 -
233 -- manage `supabase` oauth app
234 -- manage user connections
235 -- tools for your agents to interact with `supabase`
236 -
237 -Using composio simplifies all of the above to a few lines of code as we've seen the cookbook.
238 -
239 -## Best practices
240 -
241 -**🔒 User Management**:
242 -
243 -- Use unique, consistent `user_id` values for each person
244 -- Each user maintains their own supabase connection
245 -- User IDs can be email addresses, usernames, or any unique identifier
246 -
247 -## Troubleshooting
248 -
249 -**Connection Issues**:
250 -- Ensure your `.env` file has valid `COMPOSIO_API_KEY` and `OPENAI_API_KEY`
251 -- Check that the user has completed `supabase` authorization
252 -- Verify the user_id matches exactly between requests
253 -
254 -**API Errors**:
255 -- Check the server logs for detailed error messages
256 -- Ensure request payloads match the expected format
257 -- Visit `/docs` endpoint for API schema validation
fern/pages/src/get-started/dev-setup.mdx deleted
-85
@@ -1,85 +0,0 @@
1 ----
2 -title: IDE and Agent Setup
3 -subtitle: 'Setup your AI IDE and agent to help you ship faster with Composio'
4 -slug: /docs/dev-setup
5 -image: "https://og.composio.dev/api/og?title=IDE%20and%20Agent%20Setup" # image for socials
6 -keywords: ''
7 -hide-nav-links: false
8 ----
9 -
10 -This comprehensive guide explains how to set up your IDE and coding agents to help you ship faster with Composio. We'll cover optimal configurations for popular editors and AI coding assistants.
11 -
12 -<Tip>
13 -For LLMs: Use [llms.txt](https://docs.composio.dev/llms.txt) to index our documentation
14 -</Tip>
15 -
16 -## Cursor
17 -Cursor is an AI-powered code editor that can significantly accelerate your development with Composio. Here's how to set it up optimally.
18 -
19 -### Index Documentation
20 -Cursor can index documentation, making it easy to ask questions about Composio and get contextual answers while coding.
21 -
22 -<Frame>
23 - <img src="../../../assets/images/index-docs.png" alt="Index docs" />
24 -</Frame>
25 -
26 -### To index Composio documentation:
27 -
28 -1. Open Cursor Settings (Shift + Cmd/Ctrl + J)
29 -2. Navigate to "Features" → "Codebase indexing"
30 -3. Add the Composio documentation URLs:
31 -
32 -- https://docs.composio.dev
33 -- https://github.com/ComposioHQ/composio (for source code reference)
34 -
35 -Once indexed, you can ask questions directly in the chat!
36 -<Frame>
37 - <img src="../../../assets/images/ask-index-docs.png" alt="Index docs question" />
38 -</Frame>
39 -
40 -
41 -### Optimize Cursor with Custom Rules
42 -To get the best experience building with Composio, add custom instructions to Cursor's AI system. This helps the AI understand Composio's patterns and best practices.
43 -
44 -<Frame>
45 - <img src="../../../assets/images/cursor-settings.png" alt="Cursor settings" />
46 -</Frame>
47 -
48 -**To add custom rules:**
49 -
50 -1. Open Cursor Settings (Shift + Cmd/Ctrl + J)
51 -2. Go to "General" → "Rules for AI"
52 -3. Add the appropriate prompt below based on your language
53 -
54 -```md
55 -Below is a list of Composio documentation. Use your web and fetch capabilities to read the documentation you need.
56 -[Composio Documentation](https://docs.composio.dev)
57 -
58 -For AI agents and LLMs, we also provide a structured documentation index at:
59 -[LLMs Text Documentation](https://docs.composio.dev/llms.txt)
60 -
61 -- [Quickstart](https://docs.composio.dev/docs/quickstart.mdx): Add authenticated tool-calling to any LLM agent in three steps.
62 -- [Configuration](https://docs.composio.dev/docs/configuration.mdx)
63 -- [Providers](https://docs.composio.dev/docs/providers.mdx)
64 -- [Executing Tools](https://docs.composio.dev/docs/executing-tools.mdx): Learn how to execute Composio's tools with different providers and frameworks
65 -- [Authenticating Tools](https://docs.composio.dev/docs/authenticating-tools.mdx): Learn how to authenticate tools
66 -- [Fetching and Filtering Tools](https://docs.composio.dev/docs/fetching-tools.mdx): Learn how to fetch and filter Composio's tools and toolkits
67 -- [Modifying tool schemas](https://docs.composio.dev/docs/modifying-tool-schemas): Learn how to use schema modifiers to transform tool schemas before they are seen by agents.
68 -- [Modifying tool inputs](https://docs.composio.dev/docs/modifying-tool-inputs): Learn how to use before execution modifiers to modify tool arguments before execution.
69 -- [Modifying tool outputs](https://docs.composio.dev/docs/modifying-tool-outputs): Learn how to use after execution modifiers to transform tool results after execution.
70 -- [Creating custom tools](https://docs.composio.dev/docs/custom-tools.mdx): Learn how to extend Composio's toolkits with your own tools
71 -- [Custom Auth Configs](https://docs.composio.dev/docs/custom-auth-configs.mdx): Guide to using customizing auth configs for a toolkit
72 -- [Programmatic Auth Configs](https://docs.composio.dev/docs/programmatic-auth-configs.mdx): Guide to creating auth configs programmatically
73 -- [Custom Auth Parameters](https://docs.composio.dev/docs/custom-auth-params.mdx): Guide to injecting custom credentials in headers or parameters for a toolkit
74 -- [Using Triggers](https://docs.composio.dev/docs/using-triggers.mdx): Send payloads to your system based on external events
75 -- [OpenAI Providers](https://docs.composio.dev/providers/openai.mdx)
76 -- [Anthropic Provider](https://docs.composio.dev/providers/anthropic.mdx)
77 -- [LangGraph Provider](https://docs.composio.dev/providers/langgraph.mdx)
78 -- [CrewAI Provider](https://docs.composio.dev/providers/crewai.mdx)
79 -- [Vercel AI SDK Provider](https://docs.composio.dev/providers/vercel.mdx)
80 -- [Google ADK Provider](https://docs.composio.dev/providers/google-adk.mdx)
81 -- [OpenAI Agents Provider](https://docs.composio.dev/providers/openai-agents.mdx)
82 -- [Mastra Provider](https://docs.composio.dev/providers/mastra.mdx)
83 -- [Custom Providers](https://docs.composio.dev/toolsets/custom.mdx)
84 -
85 -```
fern/pages/src/get-started/providers.mdx deleted
-277
@@ -1,277 +0,0 @@
1 ----
2 -title: Providers
3 -subtitle: Use Composio with any AI framework
4 -image: "https://og.composio.dev/api/og?title=Providers" # image for socials
5 -keywords: ''
6 -hide-nav-links: false
7 ----
8 -
9 -Providers in Composio act as bridges between your AI models and external tools. They transform Composio's tools into formats that different AI frameworks can understand and use, making it possible to integrate with any AI framework seamlessly.
10 -
11 -## What are Providers?
12 -Think of providers as translators. Different AI frameworks (like OpenAI, Anthropic Claude, or LangChain) expect tools to be formatted in their specific way. Instead of manually converting Composio tools for each framework, providers handle this transformation automatically.
13 -
14 -For example:
15 -- OpenAI expects tools in a specific JSON schema format with type: "function"
16 -- Anthropic Claude expects tools with an input_schema structure
17 -- LangChain expects tools as callable functions with specific parameters
18 -
19 -Providers ensure that Composio tools work correctly with your chosen AI platform without you having to worry about the technical details.
20 -
21 -
22 -## Using Providers
23 -Here's how you can generate text with various providers using Composio SDK:
24 -
25 -### Default Provider (OpenAI)
26 -If you don't specify a provider, Composio uses the OpenAI provider by default:
27 -<CodeGroup>
28 -```python Python
29 -from openai import OpenAI
30 -from composio import Composio
31 -
32 -# Initialize tools.
33 -openai_client = OpenAI()
34 -composio = Composio(api_key="your-composio-api-key")
35 -
36 -# Define task.
37 -task = "Star a repo composiohq/composio on GitHub"
38 -
39 -# Get GitHub tools that are pre-configured
40 -tools = composio.tools.get(user_id="default", toolkits=["GITHUB"])
41 -
42 -# Get response from the LLM
43 -response = openai_client.chat.completions.create(
44 - model="gpt-4o-mini",
45 - tools=tools,
46 - messages=[
47 - {"role": "system", "content": "You are a helpful assistant."},
48 - {"role": "user", "content": task},
49 - ],
50 -)
51 -print(response)
52 -
53 -# Execute the function calls.
54 -result = composio.provider.handle_tool_calls(response=response, user_id="default")
55 -print(result)
56 -
57 -
58 -```
59 -```typescript TypeScript
60 -import { Composio } from '@composio/core';
61 -
62 -// Uses OpenAI provider automatically
63 -const composio = new Composio({
64 - apiKey: 'your-composio-api-key'
65 -});
66 -
67 -// Get tools formatted for OpenAI
68 -const tools = await composio.tools.get('default', {
69 - toolkits: ['github']
70 -});
71 -
72 -// Use with OpenAI
73 -const completion = await openai.chat.completions.create({
74 - model: 'gpt-4',
75 - messages: [
76 - { role: 'system', content: 'You are a helpful assistant.' },
77 - { role: 'user', content: 'Star the repo composiohq/composio on GitHub' },
78 - ],
79 - tools: tools // Already formatted for OpenAI
80 -});
81 -
82 -// Execute the function calls.
83 -const result = await composio.provider.handleToolCalls("user@example.com", completion)
84 -console.log(result)
85 -
86 -```
87 -</CodeGroup>
88 -
89 -### Using a Different Provider
90 -Different providers may require additional packages:
91 -
92 -
93 -<CodeGroup>
94 -```shell Python
95 -# Core SDK (includes OpenAI provider)
96 -pip install composio==0.8.0
97 -
98 -# Additional providers
99 -pip install composio_anthropic==0.8.0
100 -pip install composio_google==0.8.0
101 -pip install composio_langchain==0.8.0
102 -pip install composio_crewai==0.8.0
103 -```
104 -```shell Typescript
105 -# Core SDK (includes OpenAI provider)
106 -npm install @composio/core
107 -
108 -# Additional providers
109 -npm install @composio/anthropic
110 -npm install @composio/google
111 -npm install @composio/langchain
112 -npm install @composio/vercel
113 -```
114 -</CodeGroup>
115 -
116 -To use a different provider, specify it when initializing Composio:
117 -
118 -<Tabs>
119 -<Tab title="OpenAI (Default)">
120 -OpenAI is a completion provider. You can use it to generate text, function calls.
121 -<CodeGroup>
122 -```python Python
123 -from composio import Composio
124 -from composio_openai import OpenAIProvider
125 -
126 -composio = Composio(provider=OpenAIProvider())
127 -```
128 -```typescript TypeScript
129 -import { Composio } from "@composio/core";
130 -import { OpenAIProvider } from "@composio/openai";
131 -
132 -const composio = new Composio({ provider: new OpenAIProvider() });
133 -
134 -```
135 -
136 -</CodeGroup>
137 -</Tab>
138 -<Tab title="Anthropic">
139 -Anthropic is a completion provider. You can use it to generate text, function calls.
140 -<CodeGroup>
141 -```python Python
142 -from composio import Composio
143 -from composio_anthropic import AnthropicProvider
144 -
145 -composio = Composio(provider=AnthropicProvider())
146 -```
147 -```typescript TypeScript
148 -import { Composio } from "@composio/core";
149 -import { AnthropicProvider } from "@composio/anthropic";
150 -import { Anthropic } from "@anthropic-ai/sdk";
151 -
152 -const composio = new Composio({ provider: new AnthropicProvider() });
153 -
154 -```
155 -</CodeGroup>
156 -</Tab>
157 -<Tab title="Vercel AI SDK">
158 -```typescript TypeScript
159 -import { Composio } from "@composio/core";
160 -import { VercelProvider } from "@composio/vercel";
161 -
162 -const composio = new Composio({
163 - apiKey: process.env.COMPOSIO_API_KEY,
164 - provider: new VercelProvider(),
165 -});
166 -
167 -```
168 -</Tab>
169 -<Tab title="Mastra">
170 -```typescript TypeScript
171 -import { MastraProvider } from '@composio/mastra';
172 -import { Agent } from '@mastra/core/agent';
173 -import { Composio } from '@composio/core';
174 -
175 -const composio = new Composio({
176 - apiKey: process.env.COMPOSIO_API_KEY,
177 - provider: new MastraProvider(),
178 -});
179 -
180 -```
181 -
182 -</Tab>
183 -<Tab title="OpenAI Agents">
184 -```python Python
185 -import asyncio
186 -
187 -from agents import Agent, Runner
188 -
189 -from composio import Composio
190 -from composio_openai_agents import OpenAIAgentsProvider
191 -
192 -# Initialize Composio toolset
193 -composio = Composio(provider=OpenAIAgentsProvider())
194 -```
195 -</Tab>
196 -</Tabs>
197 -
198 -
199 -## Supported Providers
200 -Composio supports two different types of providers based on the type of AI framework you are using:
201 -
202 -### Non-Agentic Providers
203 -These providers work with AI platforms that use chat completion APIs, where you control the tool execution flow. The AI model analyzes your conversation and suggests which tools to use, but your code decides when and how to execute them.
204 -With chat completion APIs, the typical flow is:
205 -
206 -1. You send a message to the AI model along with available tools
207 -2. The AI responds with either a text message or a request to use specific tools
208 -3. If tools are requested, you execute them and send the results back to continue the conversation
209 -
210 -<CardGroup cols={3}>
211 - <Card
212 - title="OpenAI Provider"
213 - icon={<img src="../../../assets/images/openai-logo.svg" width="24" height="24" />}
214 - href="/providers/openai"
215 - >
216 - Integrate with OpenAI's tool calling and agents.
217 - </Card>
218 - <Card
219 - title="Anthropic Provider"
220 - icon={<img src="../../../assets/images/anthropic-logo.svg" width="24" height="24" />}
221 - href="/providers/anthropic"
222 - >
223 - Use Anthropic's Claude models with Composio tools.
224 - </Card>
225 - <Card
226 - title="Gemini Provider"
227 - icon={<img src="../../../assets/images/google-logo.svg" width="24" height="24" />}
228 - href="/providers/google"
229 - >
230 - Integrate with Google's Gemini models.
231 - </Card>
232 -</CardGroup>
233 -
234 -### Agentic Providers
235 -These providers work with AI frameworks that can execute tools autonomously. The AI agent can decide to run tools on its own without your direct intervention.
236 -
237 -<CardGroup cols={3}>
238 - <Card
239 - title="LangChain Provider"
240 - icon={<img src="../../../assets/images/langgraph-logo.svg"/>}
241 - href="/providers/langchain"
242 - >
243 - Add tools to LangChain agent flows.
244 - </Card>
245 - <Card
246 - title="CrewAI Provider"
247 - icon="fa-light fa-people-group"
248 - href="/providers/crewai"
249 - >
250 - Enable tool calling in CrewAI multi-agent systems.
251 - </Card>
252 - <Card
253 - title="Vercel AI SDK Provider"
254 - icon={<img src="../../../assets/images/vercel-logo.svg" width="24" height="24" />}
255 - href="/providers/vercel"
256 - >
257 - Use Composio tools with Vercel's AI SDK.
258 - </Card>
259 - <Card
260 - title="OpenAI Agents Provider"
261 - icon="fa-light fa-user-astronaut"
262 - href="/providers/openai-agents"
263 - >
264 - Add tools to OpenAI's new Agents API.
265 - </Card>
266 - <Card
267 - title="Mastra Provider"
268 - icon="fa-light fa-cubes"
269 - href="/providers/mastra"
270 - >
271 - Use Composio tools with Mastra agent framework.
272 - </Card>
273 -</CardGroup>
274 -
275 -<Tip title="Custom Providers" icon="fa-light fa-puzzle">
276 -Using a framework not yet supported by Composio? Create a custom provider in [TypeScript](/providers/custom/typescript) or [Python](/providers/custom/python)!
277 -</Tip>
fern/pages/src/get-started/quickstart.mdx deleted
-117
@@ -1,117 +0,0 @@
1 ----
2 -title: Quickstart
3 -image: "https://og.composio.dev/api/og?title=Quickstart" # image for socials
4 -description: "Add authenticated tool-calling to any LLM agent in three steps."
5 -keywords: ""
6 -subtitle: "Add composio tools to your AI agents"
7 -hide-nav-links: false
8 ----
9 -
10 -This guide walks you through **authenticated tool calling**—the foundation of how Composio connects your AI agents to real-world actions.
11 -
12 -You'll learn how to:
13 -1. **Discover and add tools** relevant to your use case (e.g., Slack, GitHub, Notion) to your AI agent
14 -2. **Authenticate tools** securely on behalf of a specific user, with fine-grained access control
15 -3. **Enable your LLM** (like OpenAI, Claude, or LangChain) to invoke these tools reliably using structured tool call formats
16 -
17 -## Prerequisites
18 -
19 -Before you begin, ensure you have:
20 -
21 -1. **A Composio account** - [Sign up here](https://platform.composio.dev) if you haven't already
22 -2. **Python 3.10+** or **Node.js 18+** installed on your system
23 -3. **Your API key** - Get it from the [developer dashboard](https://platform.composio.dev?next_page=/settings) and set it as an environment variable:
24 -
25 -```bash
26 -export COMPOSIO_API_KEY=your_api_key
27 -```
28 -
29 -## Install the SDK
30 -First, install the Composio SDK for your preferred language:
31 -
32 -<CodeGroup>
33 -```bash title="Python" for="python"
34 -pip install composio
35 -```
36 -```bash title="TypeScript" for="typescript"
37 -npm install @composio/core
38 -```
39 -</CodeGroup>
40 -
41 -## Authorize Tools & Run Them with an Agent
42 -Composio supports multiple LLM providers. Here’s how to use Composio with some of the most popular ones:
43 -<Tabs>
44 -<Tab title="OpenAI Agent(Python)">
45 -Install the OpenAI Agents provider!
46 -
47 -**Installation**
48 -```bash
49 -pip install composio openai-agents composio-openai-agents
50 -```
51 -
52 -<SnippetCode
53 - src="fern/snippets/get-started/python/quickstart.py"
54 - startLine={1}
55 - endLine={46}
56 -/>
57 -</Tab>
58 -<Tab title="Anthropic (TypeScript)">
59 -Install the Composio Anthropic provider
60 -
61 -**Installation**
62 -```bash
63 -npm i @composio/core @composio/anthropic
64 -npm i @anthropic-ai/sdk
65 -```
66 -
67 -<SnippetCode
68 - src="fern/snippets/get-started/typescript/quickstart.ts"
69 - startLine={1}
70 - endLine={57}
71 -/>
72 -
73 -</Tab>
74 -<Tab title="Vercel AI SDK (Typescript)">
75 -Install the Composio Vercel Provider
76 -
77 -**Installation**
78 -```bash
79 -npm i @composio/core @composio/vercel
80 -npm i ai @ai-sdk/openai
81 -```
82 -
83 -<SnippetCode
84 - src="fern/snippets/get-started/typescript/vercel-quickstart.ts"
85 - startLine={1}
86 - endLine={43}
87 -/>
88 -
89 -</Tab>
90 -</Tabs>
91 -
92 -<Note title="What just happened?">
93 -You just:
94 -1. Authorized a user account with Composio
95 -2. Passed those tool permissions into an LLM framework
96 -3. Let the LLM securely call real tools on the user’s behalf
97 -
98 -All OAuth flows and tool execution were automatically handled by Composio.
99 -</Note>
100 -
101 -
102 -## Next steps
103 -
104 -<CardGroup cols={2}>
105 - <Card title="Use Providers" icon="fa-light fa-plug" href="/providers/openai">
106 - Learn how to use Composio with various agent SDK and frameworks.
107 - </Card>
108 - <Card title="Work with tools" icon="fa-light fa-toolbox" href="/docs/executing-tools">
109 - Learn how to work with tools and tool calling on a deeper level with Composio.
110 - </Card>
111 - <Card title="Manage authentication" icon="fa-light fa-key" href="/docs/custom-auth-configs">
112 - Authorize tools for multiple users.
113 - </Card>
114 - <Card title="Triggers" icon="fa-light fa-bolt" href="/docs/using-triggers">
115 - Listen for external events to trigger actions in your agents
116 - </Card>
117 -</CardGroup>
\ No newline at end of file
fern/pages/src/get-started/welcome.mdx deleted
-106
@@ -1,106 +0,0 @@
1 ----
2 -title: Welcome to Composio
3 -subtitle: Composio is the simplest way to connect AI agents to external tools and services.
4 -image: "https://og.composio.dev/api/og?title=Welcome%20to%20Composio"
5 -keywords: ''
6 -hide-nav-links: false
7 ----
8 -
9 -<Launch>Tool Router is now out of beta. Go check it out!</Launch>
10 -<Card icon="fa-light fa-sparkles" title="Tool Router" href="/tool-router/overview" >
11 - Single MCP server and Tool that can search, authenticate, and execute across all Composio tools
12 -</Card>
13 -
14 -<CardGroup cols={2}>
15 - <Card
16 - icon="fa-light fa-key"
17 - title="Managed authentication"
18 - href="/docs/authenticating-tools"
19 - >
20 - Handle OAuth, API keys, and custom auth flows automatically
21 - </Card>
22 -
23 - <Card
24 - icon="fa-light fa-wrench"
25 - title="Tool execution"
26 - href="/docs/executing-tools"
27 - >
28 - Execute actions across 500+ toolkits with support for most AI frameworks
29 - </Card>
30 -
31 - <Card
32 - icon="fa-light fa-database"
33 - title="MCP server"
34 - href="/docs/mcp-quickstart"
35 - >
36 - Hosted MCP servers for all 500+ toolkits.
37 - </Card>
38 -
39 - <Card
40 - icon="fa-light fa-bolt"
41 - title="Triggers"
42 - href="/docs/using-triggers"
43 - >
44 - Subscribe to external events and trigger workflows automatically
45 - </Card>
46 -</CardGroup>
47 -
48 -***
49 -
50 -## Get started
51 -
52 -<CardGroup cols={2}>
53 - <Card icon="fa-light fa-rocket" title="Quickstart" href="/docs/quickstart">
54 - Build your first agent
55 - </Card>
56 -
57 - <Card icon="fa-light fa-code" title="Providers" href="/docs/providers">
58 - Integrate with OpenAI, Anthropic, Vercel AI SDK, and more
59 - </Card>
60 -</CardGroup>
61 -
62 -<Tabs>
63 -<Tab title="Python">
64 -<div style={{position: 'relative', paddingBottom: '56.25%', height: 0, overflow: 'hidden', marginBottom: '20px', marginTop: '20px'}}>
65 - <iframe
66 - style={{position: 'absolute', top: 0, left: 0, width: '100%', height: '100%'}}
67 - src="https://www.youtube.com/embed/wkqlR8322F4"
68 - title="Composio Python Quickstart"
69 - frameBorder="0"
70 - allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
71 - allowFullScreen
72 - ></iframe>
73 -</div>
74 -</Tab>
75 -<Tab title="TypeScript">
76 -<div style={{position: 'relative', paddingBottom: '56.25%', height: 0, overflow: 'hidden', marginBottom: '20px', marginTop: '20px'}}>
77 - <iframe
78 - style={{position: 'absolute', top: 0, left: 0, width: '100%', height: '100%'}}
79 - src="https://www.youtube.com/embed/ZRGb4xGl-kc"
80 - title="Composio TypeScript Quickstart"
81 - frameBorder="0"
82 - allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
83 - allowFullScreen
84 - ></iframe>
85 -</div>
86 -</Tab>
87 -</Tabs>
88 -
89 -***
90 -
91 -## Why Composio?
92 -
93 -Composio is the fastest way to enable your AI agents to take real-world actions—without dealing with individual API integrations, authentication flows, or complex tool formatting.
94 -
95 -- **Access 500+ toolkits** out of the box across popular apps like Slack, GitHub, Notion, and more. [Browse toolkits →](/toolkits/introduction)
96 -- **Enforce strict access and data controls** with [fine-grained permissions](/docs/authenticating-tools) for each tool and user.
97 -- **Trigger agents and workflows** using [external events](/docs/using-triggers) (e.g., new message in Slack, new issue in GitHub).
98 -- **Use MCP servers** for all 500+ toolkits, compatible with any [MCP client](/docs/mcp-quickstart).
99 -- **Search, plan and authenticate** across all tools with [Tool Router](/tool-router/overview).
100 -- **Integrate seamlessly** with frameworks like [OpenAI](/providers/openai), [Anthropic](/providers/anthropic), [LangChain](/providers/langchain), [Vercel AI SDK](/providers/vercel), and more.
101 -
102 -***
103 -
104 -## Community
105 -
106 -Join our [Discord](https://discord.gg/composio) community!
\ No newline at end of file
fern/pages/src/mcp/providers.mdx deleted
-43
@@ -1,43 +0,0 @@
1 ----
2 -title: Provider integrations
3 -image: "https://og.composio.dev/api/og?title=Provider%20integrations" # image for socials
4 -subtitle: Connect MCP servers to AI frameworks
5 ----
6 -
7 -Integrate your MCP servers with popular AI SDKs and frameworks.
8 -
9 -<Note>
10 -Composio MCP servers only support Streamable HTTP transport.
11 -</Note>
12 -
13 -## Anthropic SDK
14 -
15 -Use MCP servers with the Anthropic Claude API.
16 -
17 -<CodeGroup>
18 -<CodeGroupItem title="Python">
19 -<SnippetCode src="fern/snippets/mcp/python/anthropic-provider.py" />
20 -</CodeGroupItem>
21 -<CodeGroupItem title="TypeScript">
22 -<SnippetCode src="fern/snippets/mcp/typescript/anthropic-provider.ts" />
23 -</CodeGroupItem>
24 -</CodeGroup>
25 -
26 -## OpenAI SDK
27 -
28 -Integrate MCP servers with OpenAI GPT models.
29 -
30 -<CodeGroup>
31 -<CodeGroupItem title="Python">
32 -<SnippetCode src="fern/snippets/mcp/python/openai-provider.py" />
33 -</CodeGroupItem>
34 -<CodeGroupItem title="TypeScript">
35 -<SnippetCode src="fern/snippets/mcp/typescript/openai-provider.ts" />
36 -</CodeGroupItem>
37 -</CodeGroup>
38 -
39 -## Mastra
40 -
41 -Use MCP servers with Mastra framework.
42 -
43 -<SnippetCode src="fern/snippets/mcp/typescript/mastra-provider.ts" />
\ No newline at end of file
fern/pages/src/mcp/quickstart.mdx deleted
-96
@@ -1,96 +0,0 @@
1 ----
2 -title: MCP quickstart
3 -image: "https://og.composio.dev/api/og?title=MCP%20quickstart" # image for socials
4 -subtitle: Create your first MCP server
5 ----
6 -[Model Context Protocol](https://modelcontextprotocol.io/introduction) (MCP) is an open-source standard for connecting AI applications to external tools. All the 500+ tools available in Composio are also available as MCP servers.
7 -
8 -Composio lets you create MCP servers that handle authentication (OAuth, API keys), generate unique URLs for each user, and control which tools are exposed. You can combine multiple toolkits in a single server.
9 -
10 -<Note>
11 -Composio MCP servers only support Streamable HTTP transport.
12 -</Note>
13 -
14 -## Install the SDK
15 -First, install the Composio SDK for your preferred language:
16 -
17 -<CodeGroup>
18 -```bash title="Python" for="python"
19 -pip install composio
20 -```
21 -```bash title="TypeScript" for="typescript"
22 -npm install @composio/core
23 -```
24 -</CodeGroup>
25 -
26 -## Create an MCP server
27 -
28 -<Steps>
29 - <Step title="Initialize Composio">
30 - <CodeGroup>
31 - <SnippetCode src="fern/snippets/mcp/python/quickstart.py" title="Python" startLine={1} endLine={4} />
32 - <SnippetCode src="fern/snippets/mcp/typescript/quickstart.ts" title="TypeScript" startLine={1} endLine={6} />
33 - </CodeGroup>
34 - </Step>
35 -
36 - <Step title="Create server configuration">
37 - <Warning>
38 - **Before you begin:** [Create an auth configuration](/docs/authenticating-tools#creating-an-auth-config) for your toolkit.
39 - </Warning>
40 -
41 - Create an MCP server with your auth config. You can also set list of specific tools to enable across all toolkits
42 -
43 - <CodeGroup>
44 - <SnippetCode src="fern/snippets/mcp/python/quickstart.py" title="Python" startLine={6} endLine={22} />
45 - <SnippetCode src="fern/snippets/mcp/typescript/quickstart.ts" title="TypeScript" startLine={8} endLine={23} />
46 - </CodeGroup>
47 -
48 - <Note>
49 - **Alternative:** You can also create and manage MCP configs directly from the [Composio dashboard → MCP Configs](https://platform.composio.dev?next_page=/mcp-configs).
50 - </Note>
51 -
52 - </Step>
53 -
54 - <Step title="Generate user URLs">
55 - <Warning>
56 - **Before generating URLs:** Users must authenticate with the toolkits configured in your MCP server. See [hosted authentication](/docs/authenticating-tools#hosted-authentication-connect-link) for how to connect user accounts.
57 - </Warning>
58 -
59 - Get server URLs for your users to connect:
60 -
61 - <CodeGroup>
62 - <SnippetCode src="fern/snippets/mcp/python/quickstart.py" title="Python" startLine={24} endLine={28} />
63 - <SnippetCode src="fern/snippets/mcp/typescript/quickstart.ts" title="TypeScript" startLine={25} endLine={29} />
64 - </CodeGroup>
65 -
66 - <Note>
67 - If users haven't authenticated, the MCP server will still generate a URL but tools requiring authentication won't work until the user connects their accounts.
68 - </Note>
69 - </Step>
70 -
71 - <Step title="Use with AI providers">
72 - Use the MCP server URL with your AI provider:
73 -
74 - <CodeGroup>
75 - <SnippetCode src="fern/snippets/mcp/python/openai-client.py" title="OpenAI (Python)" />
76 - <SnippetCode src="fern/snippets/mcp/python/anthropic-client.py" title="Anthropic (Python)" />
77 - <SnippetCode src="fern/snippets/mcp/typescript/mastra-client.ts" title="Mastra (TypeScript)" />
78 - </CodeGroup>
79 -
80 - </Step>
81 -</Steps>
82 -
83 -## Next steps
84 -
85 -<Cards>
86 - <Card title="Server management" href="/docs/mcp-server-management" icon="fa-light fa-server">
87 - Create and manage MCP servers
88 - </Card>
89 - <Card title="Providers" href="/docs/mcp-providers" icon="fa-light fa-code">
90 - Use with Anthropic, OpenAI, and other frameworks
91 - </Card>
92 -</Cards>
93 -
94 -<Tip>
95 -Need help? Join our [Discord](https://discord.com/invite/composio) or [raise an issue on GitHub](https://github.com/ComposioHQ/composio/issues/new?labels=bug).
96 -</Tip>
\ No newline at end of file
fern/pages/src/mcp/server-management.mdx deleted
-286
@@ -1,286 +0,0 @@
1 ----
2 -title: Server management
3 -image: "https://og.composio.dev/api/og?title=Server%20management" # image for socials
4 -subtitle: Create, update, and manage MCP servers
5 ----
6 -
7 -This guide covers all server management operations for MCP servers.
8 -
9 -## Create a server
10 -
11 -<CodeGroup>
12 -<CodeGroupItem title="Python">
13 -```python
14 -server = composio.mcp.create(
15 - name="my-gmail-server",
16 - toolkits=[{
17 - "toolkit": "gmail",
18 - "auth_config": "ac_xyz123"
19 - }],
20 - allowed_tools=["GMAIL_FETCH_EMAILS", "GMAIL_SEND_EMAIL"]
21 -)
22 -
23 -print(f"Created server: {server.id}")
24 -```
25 -</CodeGroupItem>
26 -<CodeGroupItem title="TypeScript">
27 -```typescript
28 -const server = await composio.mcp.create(
29 - "my-gmail-server",
30 - {
31 - toolkits: [
32 - {
33 - authConfigId: "ac_xyz123",
34 - toolkit: "gmail"
35 - }
36 - ],
37 - allowedTools: ["GMAIL_FETCH_EMAILS", "GMAIL_SEND_EMAIL"],
38 - manuallyManageConnections: false
39 - }
40 -);
41 -
42 -console.log(`Created server: ${server.id}`);
43 -```
44 -</CodeGroupItem>
45 -</CodeGroup>
46 -
47 -## List servers
48 -
49 -Find and filter your MCP servers.
50 -
51 -<CodeGroup>
52 -<CodeGroupItem title="Python">
53 -```python
54 -# List all servers
55 -servers = composio.mcp.list()
56 -print(f"Found {len(servers['items'])} servers")
57 -
58 -# Filter by toolkit
59 -gmail_servers = composio.mcp.list(
60 - toolkits="gmail",
61 - limit=20
62 -)
63 -
64 -# Filter by name
65 -production_servers = composio.mcp.list(
66 - name="production"
67 -)
68 -```
69 -</CodeGroupItem>
70 -<CodeGroupItem title="TypeScript">
71 -```typescript
72 -// List all servers
73 -const servers = await composio.mcp.list({
74 - limit: 10,
75 - page: 1,
76 - authConfigs: [],
77 - toolkits: []
78 -});
79 -console.log(`Found ${servers.items.length} servers`);
80 -
81 -// Filter by toolkit
82 -const gmailServers = await composio.mcp.list({
83 - limit: 20,
84 - page: 1,
85 - authConfigs: [],
86 - toolkits: ["gmail"]
87 -});
88 -
89 -// Filter by name
90 -const productionServers = await composio.mcp.list({
91 - limit: 10,
92 - page: 1,
93 - authConfigs: [],
94 - toolkits: [],
95 - name: "production"
96 -});
97 -```
98 -</CodeGroupItem>
99 -</CodeGroup>
100 -
101 -## Get server details
102 -
103 -<CodeGroup>
104 -<CodeGroupItem title="Python">
105 -```python
106 -# Get by ID
107 -server = composio.mcp.get("mcp_server_id")
108 -print(f"Server name: {server.name}")
109 -print(f"Toolkits: {server.toolkits}")
110 -```
111 -</CodeGroupItem>
112 -<CodeGroupItem title="TypeScript">
113 -```typescript
114 -// Get by ID
115 -const server = await composio.mcp.get("mcp_server_id");
116 -
117 -console.log(`Server: ${server.name}`);
118 -console.log(`Toolkits: ${server.toolkits}`);
119 -```
120 -</CodeGroupItem>
121 -</CodeGroup>
122 -
123 -## Update a server
124 -
125 -Modify server configuration, tools, or auth configs.
126 -
127 -<CodeGroup>
128 -<CodeGroupItem title="Python">
129 -```python
130 -updated = composio.mcp.update(
131 - server_id="mcp_server_id",
132 - name="updated-name",
133 - allowed_tools=["GMAIL_FETCH_EMAILS", "GMAIL_SEARCH_EMAILS"]
134 -)
135 -```
136 -</CodeGroupItem>
137 -<CodeGroupItem title="TypeScript">
138 -```typescript
139 -const updated = await composio.mcp.update(
140 - "mcp_server_id",
141 - {
142 - name: "updated-name",
143 - toolkits: [
144 - {
145 - toolkit: "gmail",
146 - authConfigId: "ac_new_config"
147 - }
148 - ],
149 - allowedTools: ["GMAIL_FETCH_EMAILS", "GMAIL_SEARCH_EMAILS"],
150 - manuallyManageConnections: false
151 - }
152 -);
153 -
154 -console.log(updated);
155 -```
156 -</CodeGroupItem>
157 -</CodeGroup>
158 -
159 -## Delete a server
160 -
161 -<CodeGroup>
162 -<CodeGroupItem title="Python">
163 -```python
164 -result = composio.mcp.delete("mcp_server_id")
165 -if result['deleted']:
166 - print("Server deleted successfully")
167 -```
168 -</CodeGroupItem>
169 -<CodeGroupItem title="TypeScript">
170 -```typescript
171 -const result = await composio.mcp.delete("mcp_server_id");
172 -if (result.deleted) {
173 - console.log("Server deleted successfully");
174 -}
175 -```
176 -</CodeGroupItem>
177 -</CodeGroup>
178 -
179 -## Multi-toolkit servers
180 -
181 -Combine multiple services in a single MCP server.
182 -
183 -<CodeGroup>
184 -<CodeGroupItem title="Python">
185 -```python
186 -server = composio.mcp.create(
187 - name="productivity-suite",
188 - toolkits=[
189 - {"toolkit": "gmail", "auth_config": "ac_gmail"},
190 - {"toolkit": "slack", "auth_config": "ac_slack"},
191 - {"toolkit": "github", "auth_config": "ac_github"}
192 - ],
193 - allowed_tools=[
194 - "GMAIL_FETCH_EMAILS",
195 - "SLACK_SEND_MESSAGE",
196 - "GITHUB_CREATE_ISSUE"
197 - ]
198 -)
199 -```
200 -</CodeGroupItem>
201 -<CodeGroupItem title="TypeScript">
202 -```typescript
203 -const server = await composio.mcp.create(
204 - "productivity-suite",
205 - {
206 - toolkits: [
207 - {
208 - authConfigId: "ac_gmail",
209 - toolkit: "gmail"
210 - },
211 - {
212 - authConfigId: "ac_slack",
213 - toolkit: "slack"
214 - },
215 - {
216 - authConfigId: "ac_github",
217 - toolkit: "github"
218 - }
219 - ],
220 - allowedTools: [
221 - "GMAIL_FETCH_EMAILS",
222 - "SLACK_SEND_MESSAGE",
223 - "GITHUB_CREATE_ISSUE"
224 - ],
225 - manuallyManageConnections: false
226 - }
227 -);
228 -```
229 -</CodeGroupItem>
230 -</CodeGroup>
231 -
232 -## Generate user URLs
233 -
234 -After creating a server, generate unique URLs for each user.
235 -
236 -<CodeGroup>
237 -<CodeGroupItem title="Python">
238 -```python
239 -# Generate instance for user
240 -instance = server.generate("user@example.com")
241 -
242 -print(f"URL: {instance['url']}")
243 -print(f"Tools: {instance['allowed_tools']}")
244 -
245 -# Chat-based authentication is enabled by default
246 -# Set manually_manage_connections=True to disable it:
247 -instance_manual = server.generate(
248 - "user@example.com",
249 - manually_manage_connections=True
250 -)
251 -```
252 -</CodeGroupItem>
253 -<CodeGroupItem title="TypeScript">
254 -```typescript
255 -// Generate instance for user
256 -const instance = await server.generate("user@example.com");
257 -
258 -console.log("URL:", instance.url);
259 -console.log("Tools:", instance.allowedTools);
260 -
261 -// Chat-based authentication is enabled by default
262 -// Set manuallyManageConnections: true to disable it:
263 -const instanceManual = await composio.mcp.generate(
264 - "user@example.com",
265 - server.id,
266 - { manuallyManageConnections: true }
267 -);
268 -```
269 -</CodeGroupItem>
270 -</CodeGroup>
271 -
272 -<Note>
273 -**Chat-based authentication:**
274 -- **TypeScript**: Enabled by default (set `manuallyManageConnections=false` or omit it)
275 -- **Python**: Enabled by default (set `manually_manage_connections=False` or omit it)
276 -
277 -When enabled, the agent can authenticate users dynamically during conversation if they're missing required connections. Set `manuallyManageConnections=true` (TypeScript) or `manually_manage_connections=True` (Python) to disable it.
278 -</Note>
279 -
280 -## Best practices
281 -
282 -- **Use descriptive names** - Makes servers easy to find
283 -- **Limit tools appropriately** - Only include necessary tools
284 -- **Reuse servers** - Don't create duplicates for same configuration
285 -- **Store server IDs** - Keep track of created server IDs
286 -
fern/pages/src/migration-guide/index.mdx deleted
-23
@@ -1,23 +0,0 @@
1 ----
2 -title: Migration guides
3 -subtitle: Guides for migrating to newer versions of Composio
4 -image: "https://og.composio.dev/api/og?title=Migration%20guides"
5 -keywords: "migration, upgrade, sdk, versioning"
6 -hide-nav-links: false
7 ----
8 -
9 -## Available migration guides
10 -
11 -<AccordionGroup>
12 - <Accordion title="New SDK migration">
13 - Migrate from the old Composio SDK to the new new SDK, including breaking changes, new features, and updated APIs.
14 -
15 - [View SDK migration guide →](/docs/migration-guide/new-sdk)
16 - </Accordion>
17 -
18 - <Accordion title="Toolkit versioning migration">
19 - Migrate to use the toolkit versioning system.
20 -
21 - [View versioning migration guide →](/docs/migration-guide/toolkit-versioning)
22 - </Accordion>
23 -</AccordionGroup>
\ No newline at end of file
fern/pages/src/migration-guide/new-sdk.mdx deleted
-675
@@ -1,675 +0,0 @@
1 ----
2 -title: Our next generation SDKs
3 -subtitle: Learn more about Composio's next generation SDKs and how to migrate
4 -image: "https://og.composio.dev/api/og?title=New%20SDK%20migration"
5 -keywords: 'sdk, migration, upgrade'
6 -hide-nav-links: false
7 ----
8 -
9 -In the last few months, we have experienced very rapid growth in usage of our platform. As such, our team has been working hard to radically improve the performance and developer experience of our platform.
10 -
11 -A lot of these changes have happened in the background, but we are excited to finally share our new SDKs with you that complement our new infra.
12 -
13 -The new API features improved usability, enhanced stability, and better scalability. The SDKs built on top of it simplify the developer experience, making it easier than ever to build useful agents.
14 -
15 -## What's new?
16 -
17 -A lot of the changes are on the infra side, but from the SDK point of view, here is what you can expect:
18 -- Faster and more reliable tool execution
19 -- A simpler but more opinionated SDK
20 -- Much more intuitive and consistent naming conventions
21 -- A vastly improved TypeScript SDK that is meaningfully more type-safe and has full feature parity with the Python SDK
22 -
23 -There aren't too many new flashy features here (yet) mainly because we wanted to get the bones right — but we feel we have a solid foundation to ship incredible new experiences on top very quickly.
24 -
25 -
26 -## State of the new SDK and what is happening with the old SDKs?
27 -
28 -Currently, the new SDKs are in a preview release. These new SDKs come almost fully formed, we do not expect many breaking changes to them but are releasing them in a preview state to get feedback and make necessary changes before locking them in.
29 -
30 -As we lock the new SDKs in place, we will deprecate support for the old SDKs. They will continue to work for the foreseeable future but are no longer actively maintained. We will continue to push security updates and fix any critical bugs but will not support any new functionality in them.
31 -
32 -We urge you to upgrade to the new SDKs as soon as possible.
33 -
34 -
35 -## Nomenclature
36 -
37 -We have updated several key terms in the SDK and API to improve clarity and consistency. The following table summarizes these changes:
38 -
39 -| Previous Term | Current Term | Definition |
40 -|---------------|--------------------|--------------------------------------------------------------------------|
41 -| Actions | Tools | Individual operations or capabilities that can be performed by an LLM agent |
42 -| Apps | Toolkits | A collection of tools grouped under a single application |
43 -| Integration | Auth Config | Configuration containing developer credentials and application-level settings such as scopes and API endpoints. Scoped to a toolkit. |
44 -| Connection | Connected accounts | User-linked accounts associated with a toolkit |
45 -| Entity ID | User ID | The identifier of the user performing the action (UUID or email) |
46 -| Trigger | Trigger | An event that can be subscribed to |
47 -| Toolsets | Providers | LLM or agent framework that can be used with Composio to create agents |
48 -
49 -## Switch to nano IDs from UUIDs
50 -
51 -We have transitioned from UUIDs to nano IDs throughout the platform for the following reasons:
52 -
53 -- **Improved readability**: UUIDs are lengthy and difficult to read
54 -- **Better usability**: Easier to copy with a single double-click
55 -- **Better organization**: Nano IDs allow us to distinguish between different resource types through prefixes
56 -
57 -| Feature | Nano ID Prefix | Example |
58 -|-------------------|----------------|--------------------|
59 -| Connected Account | `ca_` | `ca_8x9w2l3k5m` |
60 -| Auth Config | `ac_` | `ac_1234567890` |
61 -| Trigger | `ti_` | `ti_So9EQf8XnAcy` |
62 -
63 -> **Note:** Nano IDs are short, unique, and prefixed to indicate the resource type.
64 -
65 -
66 -
67 -## SDK Changes
68 -
69 -Upgrade to the latest SDK version using the appropriate package manager:
70 -
71 -<CodeGroup>
72 -```python Python
73 -pip install -U composio
74 -```
75 -```typescript TypeScript
76 -npm install @composio/core
77 -```
78 -</CodeGroup>
79 -
80 -Both SDKs now implement proper namespacing for each concept.
81 -
82 -### User ID scoping
83 -
84 -The concept of `entity_id` has been expanded and renamed to `user_id`.
85 -
86 -All operations are now scoped to a user ID, including:
87 -- Fetching tools
88 -- Initiating connections
89 -- Executing tools
90 -- Managing triggers
91 -
92 -This change provides explicit specification of the user for whom the action is being performed. When a user may have multiple accounts (such as work and personal Gmail connections), you can use the more specific connected account ID.
93 -
94 -### Replacing ToolSets with [Providers](/docs/providers)
95 -
96 -We have deprecated "toolsets" in favor of "providers". This change allows Composio to provide deeper standardization for tool implementation across different frameworks.
97 -
98 -Previously, you needed to import and use a framework-specific `ComposioToolSet` class:
99 -
100 -<CodeGroup>
101 -<SnippetCode
102 - src="fern/snippets/migration/old_tools.py"
103 - startLine={1}
104 - endLine={3}
105 - title="Python (previous)"
106 -/>
107 -
108 -<SnippetCode
109 - src="fern/snippets/migration/old_tools.ts"
110 - startLine={1}
111 - endLine={3}
112 - title="TypeScript (previous)"
113 -/>
114 -</CodeGroup>
115 -
116 -The SDK structure is now framework-agnostic and includes the OpenAI provider out of the box:
117 -
118 -<CodeGroup>
119 -<SnippetCode
120 - src="fern/snippets/migration/providers.py"
121 - startLine={1}
122 - endLine={12}
123 - title="Python (current)"
124 -/>
125 -
126 -<SnippetCode
127 - src="fern/snippets/migration/providers.ts"
128 - startLine={1}
129 - endLine={12}
130 - title="TypeScript (current)"
131 -/>
132 -</CodeGroup>
133 -
134 -You can now use the same tools across any framework with our unified interface, or create custom toolsets for frameworks we don't yet support.
135 -
136 -Read more about [providers in our documentation](/docs/providers) and explore the [complete list of available providers](/providers/openai).
137 -
138 -### Fetching and filtering tools
139 -
140 -Previously, you could filter tools by:
141 -- Apps
142 -- Action names (tool names)
143 -- Tags
144 -
145 -You could also specify an `important` flag to retrieve the most important tools:
146 -
147 -<CodeGroup>
148 -<SnippetCode
149 - src="fern/snippets/migration/old_tools.py"
150 - startLine={1}
151 - endLine={11}
152 - title="Python (previous)"
153 -/>
154 -<SnippetCode
155 - src="fern/snippets/migration/old_tools.ts"
156 - startLine={1}
157 - endLine={11}
158 - title="TypeScript (previous)"
159 -/>
160 -</CodeGroup>
161 -
162 -You can now filter tools by:
163 -- Toolkits
164 -- Tool slugs
165 -- Limit parameter
166 -- Search query
167 -
168 -The `important` flag has been removed. Instead, tools are returned in order of importance by default:
169 -
170 -<Note>Since `user_id` is now explicitly required, the `check_connected_accounts` flag is no longer necessary.</Note>
171 -
172 -<CodeGroup>
173 -<SnippetCode
174 - src="fern/snippets/migration/new_tools.py"
175 - startLine={1}
176 - endLine={17}
177 - title="Python (current)"
178 -/>
179 -
180 -<SnippetCode
181 - src="fern/snippets/migration/new_tools.ts"
182 - startLine={1}
183 - endLine={25}
184 - title="TypeScript (current)"
185 -/>
186 -</CodeGroup>
187 -
188 -### Fetching raw tool data
189 -
190 -To examine the raw schema definition of a tool for understanding input/output parameters or building custom logic around tool definitions, use the following methods:
191 -
192 -<CodeGroup>
193 -<SnippetCode
194 - src="fern/snippets/tool-calling/python/raw_tools.py"
195 - startLine={1}
196 - endLine={11}
197 - title="Python (current)"
198 -/>
199 -
200 -<SnippetCode
201 - src="fern/snippets/tool-calling/typescript/raw_tools.ts"
202 - startLine={1}
203 - endLine={11}
204 - title="TypeScript (current)"
205 -/>
206 -</CodeGroup>
207 -
208 -### Executing tools
209 -
210 -Tool execution remains largely unchanged, with `user_id` now explicitly required.
211 -
212 -For agentic frameworks, the tool object returned from `tools.get` is now the respective framework's native tool object. Tool call execution is handled by the agentic framework itself.
213 -
214 -<Note>
215 -For non-agentic frameworks, Composio provides a helper function to execute tool calls.
216 -</Note>
217 -
218 -<CodeGroup>
219 -<SnippetCode
220 - src="fern/snippets/migration/new_execute_tools.py"
221 - startLine={1}
222 - endLine={17}
223 - title="Python v3"
224 - highlightStart={16}
225 - highlightEnd={16}
226 -/>
227 -
228 -<SnippetCode
229 - src="fern/snippets/migration/new_execute_tools.ts"
230 - startLine={1}
231 - endLine={30}
232 - title="TypeScript v3"
233 - highlightStart={27}
234 - highlightEnd={27}
235 -/>
236 -</CodeGroup>
237 -
238 -For more information on executing tools for different frameworks, see [Replacing ToolSets with Providers](#replacing-toolsets-with-providers).
239 -
240 -### Tool Modifiers (formerly Tool Processors)
241 -
242 -Tool processors have been renamed to *tool modifiers* and now provide an improved developer experience. The implementation is now available in TypeScript too! (previously Python-only).
243 -
244 -<SnippetCode
245 - src="fern/snippets/migration/old_tool_modifiers.py"
246 - startLine={1}
247 - endLine={23}
248 - title="Python (previous)"
249 -/>
250 -
251 -| Previous | Current |
252 -|-------------------|-------------------------|
253 -| `pre` processor | `beforeExecute` modifier |
254 -| `post` processor | `afterExecute` modifier |
255 -| `schema` processor| `schema` modifier |
256 -
257 -The modifiers now leverage language-specific features to provide a more natural developer experience.
258 -
259 -While tool processors could previously be applied during SDK initialization, tool fetching, and tool execution, we have restructured them as follows:
260 -- **Chat Completion providers**: Modifiers are specified and applied during tool execution
261 -- **Agentic frameworks**: Modifiers are specified and applied during tool fetching
262 -
263 -#### [Schema Modifiers](/docs/modifying-tool-schemas)
264 -
265 -The following example demonstrates schema modifier usage, applicable across all providers:
266 -
267 -<CodeGroup>
268 -```python Python (current)
269 -from composio import Composio, schema_modifier
270 -from composio.types import Tool
271 -
272 -user_id = "your@email.com"
273 -
274 -@schema_modifier(tools=["HACKERNEWS_GET_LATEST_POSTS"])
275 -def modify_schema(
276 - tool: str,
277 - toolkit: str,
278 - schema: Tool,
279 -) -> Tool:
280 - _ = schema.input_parameters["properties"].pop("page", None)
281 - schema.input_parameters["required"] = ["size"]
282 - return schema
283 -
284 -tools = composio.tools.get(
285 - user_id=user_id,
286 - tools=["HACKERNEWS_GET_LATEST_POSTS", "HACKERNEWS_GET_USER"],
287 - modifiers=[
288 - modify_schema,
289 - ]
290 -)
291 -```
292 -<SnippetCode
293 - src="fern/snippets/migration/tool_modifiers.ts"
294 - startLine={1}
295 - endLine={26}
296 - title="TypeScript (current)"
297 -/>
298 -</CodeGroup>
299 -
300 -#### [Before Modifiers](/docs/modifying-tool-inputs)
301 -
302 -The following example shows creating and using a before modifier for a Chat Completion provider. For agentic frameworks, view the [complete before modifier documentation](/docs/modifying-tool-inputs):
303 -
304 -<CodeGroup>
305 -```python Python (current)
306 -@before_execute(tools=["HACKERNEWS_GET_LATEST_POSTS"])
307 -def before_execute_modifier(
308 - tool: str,
309 - toolkit: str,
310 - params: ToolExecuteParams,
311 -) -> ToolExecuteParams:
312 - params["arguments"]["size"] = 1
313 - return params
314 -
315 -
316 -# Get tools
317 -tools = composio.tools.get(user_id=user_id, slug="HACKERNEWS_GET_LATEST_POSTS")
318 -```
319 -<SnippetCode
320 - src="fern/snippets/migration/tool_modifiers.ts"
321 - startLine={53}
322 - endLine={68}
323 - title="TypeScript (current)"
324 -/>
325 -</CodeGroup>
326 -
327 -#### [After Modifiers](/docs/modifying-tool-outputs)
328 -
329 -The following example shows creating and using an after modifier for a Chat Completion provider. For agentic frameworks, view the [complete after modifier documentation](/docs/modifying-tool-outputs):
330 -
331 -<CodeGroup>
332 -
333 -```python Python (current)
334 -@after_execute(tools=["HACKERNEWS_GET_USER"])
335 -def after_execute_modifier(
336 - tool: str,
337 - toolkit: str,
338 - response: ToolExecutionResponse,
339 -) -> ToolExecutionResponse:
340 - return {
341 - **response,
342 - "data": {
343 - "karma": response["data"]["karma"],
344 - },
345 - }
346 -
347 -tools = composio.tools.get(user_id=user_id, slug="HACKERNEWS_GET_USER")
348 -```
349 -<SnippetCode
350 - src="fern/snippets/migration/tool_modifiers.ts"
351 - startLine={69}
352 - endLine={90}
353 - title="TypeScript (current)"
354 -/>
355 -</CodeGroup>
356 -
357 -### Custom Tools
358 -
359 -The SDK continues to support custom tools. [Creating tools from your methods](/docs/custom-tools#creating-a-custom-tool) remains possible. We recommend reviewing the [detailed custom tools documentation](/docs/custom-tools#creating-a-custom-tool) for more information.
360 -
361 -Due to changes in the SDK architecture, creating custom tools that use Composio's managed authentication has been modified. In the previous SDK, you could create a custom tool as follows:
362 -
363 -<CodeGroup>
364 -<SnippetCode
365 - src="fern/snippets/migration/old_custom_tools.py"
366 - startLine={1}
367 - endLine={39}
368 - highlightStart={14}
369 - highlightEnd={17}
370 - title="Python (previous)"
371 -/>
372 -
373 -<SnippetCode
374 - src="fern/snippets/migration/old_custom_tools.ts"
375 - startLine={1}
376 - endLine={39}
377 - highlightStart={16}
378 - highlightEnd={20}
379 - title="TypeScript (previous)"
380 -/>
381 -</CodeGroup>
382 -
383 -The *execute tool request* method handles injection of the appropriate base URL and authentication credentials for the tool:
384 -
385 -<CodeGroup>
386 -<SnippetCode
387 - src="fern/snippets/migration/new_custom_tools.py"
388 - startLine={1}
389 - endLine={39}
390 - highlightStart={22}
391 - highlightEnd={22}
392 - title="Python (current)"
393 -/>
394 -
395 -<SnippetCode
396 - src="fern/snippets/migration/new_custom_tools.ts"
397 - startLine={1}
398 - endLine={39}
399 - highlightStart={17}
400 - highlightEnd={17}
401 - title="TypeScript (current)"
402 -/>
403 -</CodeGroup>
404 -
405 -For more information, including executing custom tools and defining custom headers and query parameters, refer to the [Custom Tools](/docs/custom-tools) documentation.
406 -
407 -### Auth configs (formerly integrations)
408 -
409 -Integrations are now called *auth configs*. While the terminology has changed, the underlying concept remains the same.
410 -
411 -Auth configs store the configuration required for authentication with a given toolkit, including OAuth developer credentials, configurable base URLs, and scopes.
412 -
413 -Auth configs now use nano IDs instead of UUIDs:
414 -
415 -| Previous (UUID) Example | Current (Nano ID) Example |
416 -| :----------------------------------- | :------------------------ |
417 -| `b7a9c1e2-3f4d-4a6b-8c2e-1d2f3a4b5c6d` | `ac_8x9w2l3k5m` |
418 -
419 -We recommend storing auth config nano IDs in your database for connecting users to the appropriate auth configuration.
420 -
421 -For most use cases, you will create auth configs through the dashboard, and this process remains unchanged. Read more about [creating auth configs](/docs/authenticating-tools#creating-an-auth-config) and [customizing auth configs](/docs/custom-auth-configs).
422 -
423 -Creating auth configs programmatically in the previous SDK:
424 -
425 -<CodeGroup>
426 -<SnippetCode
427 - src="fern/snippets/migration/old_auth_config.py"
428 - startLine={1}
429 - endLine={15}
430 - title="Python (previous)"
431 -/>
432 -<SnippetCode
433 - src="fern/snippets/migration/old_auth_config.ts"
434 - startLine={1}
435 - endLine={15}
436 - title="TypeScript (previous)"
437 -/>
438 -</CodeGroup>
439 -
440 -Creating auth configs programmatically in the current SDK:
441 -
442 -<CodeGroup>
443 -<SnippetCode
444 - src="fern/snippets/migration/new_auth_config.py"
445 - startLine={1}
446 - endLine={15}
447 - title="Python (current)"
448 -/>
449 -<SnippetCode
450 - src="fern/snippets/migration/new_auth_config.ts"
451 - startLine={1}
452 - endLine={15}
453 - title="TypeScript (current)"
454 -/>
455 -</CodeGroup>
456 -
457 -For using custom authentication credentials, refer to the [Programmatic Auth Configs](/docs/programmatic-auth-configs) documentation.
458 -
459 -<Note>The callback URL for creating custom OAuth configs is now `https://backend.composio.dev/api/v3/toolkits/auth/callback`. The previous URL was `https://backend.composio.dev/api/v1/auth-apps/add`.</Note>
460 -
461 -### Connected accounts / User IDs
462 -
463 -The primary change in connected accounts and user IDs is that user IDs are now a more prominent concept compared to entities in previous versions.
464 -
465 -We have simplified the process of connecting a user to a toolkit. Instead of multiple methods and parameters for initiating a connection, both the SDK and API now require only a `user_id` and `auth_config_id` to initiate a connection.
466 -
467 -This approach is more explicit and works well with the ability for developers to have multiple auth configs for a given toolkit.
468 -
469 -Connected accounts now use nano IDs instead of UUIDs:
470 -
471 -| Previous (UUID) Example | Current (Nano ID) Example |
472 -| :----------------------------------- | :------------------------ |
473 -| `b7a9c1e2-3f4d-4a6b-8c2e-1d2f3a4b5c6d` | `ca_8x9w2l3k5m` |
474 -
475 -Previously, you might have initiated a connection like this:
476 -
477 -<CodeGroup>
478 -<SnippetCode
479 - src="fern/snippets/migration/old_connected_acc.py"
480 - startLine={1}
481 - endLine={30}
482 - highlightStart={11}
483 - highlightEnd={16}
484 - title="Python (previous)"
485 -/>
486 -<SnippetCode
487 - src="fern/snippets/migration/old_connected_acc.ts"
488 - startLine={1}
489 - endLine={30}
490 - highlightStart={8}
491 - highlightEnd={13}
492 - title="TypeScript (previous)"
493 -/>
494 -</CodeGroup>
495 -
496 -The current process for initiating a connection is as follows:
497 -
498 -<CodeGroup>
499 -<SnippetCode
500 - src="fern/snippets/migration/new_connected_acc.py"
501 - startLine={1}
502 - endLine={15}
503 - highlightStart={8}
504 - highlightEnd={11}
505 - title="Python (current)"
506 -/>
507 -<SnippetCode
508 - src="fern/snippets/migration/new_connected_acc.ts"
509 - startLine={1}
510 - endLine={15}
511 - highlightStart={8}
512 - highlightEnd={11}
513 - title="TypeScript (current)"
514 -/>
515 -</CodeGroup>
516 -
517 -### Triggers
518 -
519 -Composio continues to support listening to application events using triggers through WebSockets and webhooks.
520 -
521 -#### Creating triggers
522 -
523 -The process for creating triggers and specifying their configuration has been redesigned for improved clarity and intuitiveness.
524 -
525 -Some triggers require configuration, such as repository names for GitHub triggers or channel names for Slack triggers. The process usually follows the pattern of fetching the trigger type and then creating the trigger with the appropriate configuration.
526 -
527 -<CodeGroup>
528 -<SnippetCode
529 - src="fern/snippets/migration/new_triggers.py"
530 - startLine={1}
531 - endLine={33}
532 - title="Python (current)"
533 -/>
534 -<SnippetCode
535 - src="fern/snippets/migration/new_triggers.ts"
536 - startLine={1}
537 - endLine={35}
538 - title="TypeScript (current)"
539 -/>
540 -</CodeGroup>
541 -
542 -#### Enabling/Disabling triggers
543 -
544 -You can enable or disable triggers through either the SDK or the dashboard. The dashboard process remains unchanged.
545 -
546 -Managing triggers with the SDK:
547 -
548 -<CodeGroup>
549 - ```python Python maxLines=60 wordWrap
550 - # Disable a trigger instance
551 - disabled_instance = composio.triggers.disable(trigger_id="ti_abcd123")
552 - print(disabled_instance)
553 - ```
554 - ```typescript TypeScript maxLines=60 wordWrap
555 - await composio.triggers.disable("ti_abcd123");
556 - ```
557 -</CodeGroup>
558 -
559 -If needed, the trigger can be enabled again.
560 -
561 -<CodeGroup>
562 - ```python Python maxLines=60 wordWrap
563 - # Enable a trigger instance
564 - enabled_instance = composio.triggers.enable(trigger_id="ti_abcd123")
565 - print(enabled_instance)
566 - ```
567 - ```typescript TypeScript maxLines=60 wordWrap
568 - await composio.triggers.enable("ti_abcd123");
569 - ```
570 -</CodeGroup>
571 -
572 -#### Listening to triggers
573 -
574 -We recommend listening to triggers through webhooks. The following are example routes for Next.js and FastAPI.
575 -
576 -For development, you can also [listen to triggers through the SDK](/docs/using-triggers#subscribing-to-triggers-using-the-sdk-for-development).
577 -
578 -<CodeGroup>
579 -<SnippetCode
580 - src="fern/snippets/triggers/python/trigger-webhook.py"
581 - title="app/route.py (FastAPI)"
582 -/>
583 -<SnippetCode
584 - src="fern/snippets/triggers/typescript/trigger-webhook.ts"
585 - title="app/api/webhook/route.ts (Next.js)"
586 -/>
587 -</CodeGroup>
588 -
589 -## 🚧 Coming Soon
590 -
591 -### Local tools
592 -
593 -Previously, the Python SDK included *[local tools](https://github.com/ComposioHQ/composio/tree/master/python/composio/tools/local)*. These were tools defined within the SDK and consisted of local shell and code-related tools such as "clipboard", "sqltool", and "shelltool".
594 -
595 -This feature is currently in development for both Python and TypeScript SDKs, with newly created tools built for improved agent accuracy.
596 -
597 -{/* ### Generated types
598 -
599 -In the previous Python SDK, you could generate types for tools using the CLI:
600 -
601 -```bash
602 -composio apps generate-types
603 -```
604 -
605 -This provided app slugs and tool slugs with IntelliSense support:
606 -
607 -```python Python (previous)
608 -from composio_openai import ComposioToolSet, App, Action
609 -
610 -print(App.GITHUB)
611 -print(Action.GITHUB_CREATE_ISSUE)
612 -``` */}
613 -
614 -This feature is currently in development for both Python and TypeScript SDKs.
615 -
616 -## API Endpoints
617 -
618 -The following table lists important API endpoints that have changed. You can use this reference to quickly find the new v3 API endpoint for migration:
619 -
620 -<Note>This list is not exhaustive. Please refer to the [API Reference](/api-reference) for the complete list of endpoints.</Note>
621 -
622 -### Toolkits (formerly Apps)
623 -
624 -| Previous Endpoint | Current Endpoint |
625 -| :--- | :--- |
626 -| [`GET /api/v1/apps`](https://docs.composio.dev/api-reference/api-reference/apps/get-apps) | [`GET /api/v3/toolkits`](https://docs.composio.dev/api-reference/toolkits/get-toolkits) |
627 -| [`GET /api/v1/apps/list/categories`](https://docs.composio.dev/api-reference/api-reference/apps/list-app-categories) | [`GET /api/v3/toolkits/categories`](https://docs.composio.dev/api-reference/toolkits/get-toolkits-categories) |
628 -| [`GET /api/v1/apps/{appName}`](https://docs.composio.dev/api-reference/api-reference/apps/get-app) | [`GET /api/v3/toolkits/{slug}`](https://docs.composio.dev/api-reference/toolkits/get-toolkits-by-slug) |
629 -
630 -### Tools (formerly Actions)
631 -
632 -| Previous Endpoint | Current Endpoint |
633 -| :--- | :--- |
634 -| [`GET /api/v2/actions`](https://docs.composio.dev/api-reference/api-reference/actions/list-actions-minimal-v-2) | [`GET /api/v3/tools`](https://docs.composio.dev/api-reference/tools/get-tools) |
635 -| [`GET /api/v2/actions/list/enums`](https://docs.composio.dev/api-reference/api-reference/actions/list-action-enums) | [`GET /api/v3/tools/enum`](https://docs.composio.dev/api-reference/tools/get-tools-enum) |
636 -| [`GET /api/v2/actions/{actionId}`](https://docs.composio.dev/api-reference/api-reference/actions/get-action-v-2) | [`GET /api/v3/tools/{tool_slug}`](https://docs.composio.dev/api-reference/tools/get-tools-by-tool-slug) |
637 -| [`POST /api/v2/actions/{actionId}/execute`](https://docs.composio.dev/api-reference/api-reference/actions/execute-action-v-2) | [`POST /api/v3/tools/execute/{tool_slug}`](https://docs.composio.dev/api-reference/tools/post-tools-execute-by-tool-slug)|
638 -| [`POST /api/v2/actions/{actionId}/execute/get.inputs`](https://docs.composio.dev/api-reference/api-reference/actions/get-action-inputs-v-2)| [`POST /api/v3/tools/execute/{tool_slug}/input`](https://docs.composio.dev/api-reference/tools/post-tools-execute-by-tool-slug-input)|
639 -| [`POST /api/v2/actions/proxy`](https://docs.composio.dev/api-reference/api-reference/actions/execute-action-proxy-v-2) | [`POST /api/v3/tools/execute/proxy`](https://docs.composio.dev/api-reference/tools/post-tools-execute-proxy)|
640 -
641 -### Auth Configs (formerly Integrations/Connectors)
642 -
643 -| Previous Endpoint | Current Endpoint |
644 -| :--- | :--- |
645 -| [`GET /api/v1/integrations`](https://docs.composio.dev/api-reference/api-reference/integrations/list-all-connectors) | [`GET /api/v3/auth_configs`](https://docs.composio.dev/api-reference/auth-configs/get-auth-configs) |
646 -| [`POST /api/v1/integrations`](https://docs.composio.dev/api-reference/api-reference/integrations/create-connector) | [`POST /api/v3/auth_configs`](https://docs.composio.dev/api-reference/auth-configs/post-auth-configs) |
647 -| [`GET /api/v1/integrations/{integrationId}`](https://docs.composio.dev/api-reference/api-reference/integrations/get-connector-info) | [`GET /api/v3/auth_configs/{nanoid}`](https://docs.composio.dev/api-reference/auth-configs/get-auth-configs-by-nanoid) |
648 -| [`PATCH /api/v1/integrations/{integrationId}`](https://docs.composio.dev/api-reference/api-reference/integrations/modify-connector) | [`PATCH /api/v3/auth_configs/{nanoid}`](https://docs.composio.dev/api-reference/auth-configs/patch-auth-configs-by-nanoid) |
649 -| [`DELETE /api/v1/integrations/{integrationId}`](https://docs.composio.dev/api-reference/api-reference/integrations/delete-connector) | [`DELETE /api/v3/auth_configs/{nanoid}`](https://docs.composio.dev/api-reference/auth-configs/delete-auth-configs-by-nanoid) |
650 -| [`POST /api/v2/integrations/create`](https://docs.composio.dev/api-reference/api-reference/integrations-v-2/create-connector-v-2) | [`POST /api/v3/auth_configs`](https://docs.composio.dev/api-reference/auth-configs/post-auth-configs) |
651 -
652 -### Connected Accounts (formerly Connections)
653 -
654 -| Previous Endpoint | Current Endpoint |
655 -| :--- | :--- |
656 -| [`GET /api/v1/connectedAccounts`](https://docs.composio.dev/api-reference/api-reference/connections/get-connections) | [`GET /api/v3/connected_accounts`](https://docs.composio.dev/api-reference/connected-accounts/get-connected-accounts) |
657 -| [`POST /api/v1/connectedAccounts`](https://docs.composio.dev/api-reference/api-reference/connections/initiate-connection) | [`POST /api/v3/connected_accounts`](https://docs.composio.dev/api-reference/connected-accounts/post-connected-accounts) |
658 -| [`POST /api/v2/connectedAccounts/initiateConnection`](https://docs.composio.dev/api-reference/api-reference/connectionsv-2/initiate-connection-v-2)| [`POST /api/v3/connected_accounts`](https://docs.composio.dev/api-reference/connected-accounts/post-connected-accounts) |
659 -| [`GET /api/v1/connectedAccounts/{connectedAccountId}`](https://docs.composio.dev/api-reference/api-reference/connections/get-connection)| [`GET /api/v3/connected_accounts/{nanoid}`](https://docs.composio.dev/api-reference/connected-accounts/get-connected-accounts-by-nanoid)|
660 -| [`DELETE /api/v1/connectedAccounts/{connectedAccountId}`](https://docs.composio.dev/api-reference/api-reference/connections/delete-connection)| [`DELETE /api/v3/connected_accounts/{nanoid}`](https://docs.composio.dev/api-reference/connected-accounts/delete-connected-accounts-by-nanoid) |
661 -| [`POST /api/v1/connectedAccounts/{connectedAccountId}/disable`](https://docs.composio.dev/api-reference/api-reference/connections/disable-connection)| [`PATCH /api/v3/connected_accounts/{nanoId}/status`](https://docs.composio.dev/api-reference/connected-accounts/patch-connected-accounts-by-nano-id-status)|
662 -| [`POST /api/v1/connectedAccounts/{connectedAccountId}/enable`](https://docs.composio.dev/api-reference/api-reference/connections/enable-connection) | [`PATCH /api/v3/connected_accounts/{nanoId}/status`](https://docs.composio.dev/api-reference/connected-accounts/patch-connected-accounts-by-nano-id-status)|
663 -| [`POST /api/v1/connectedAccounts/{connectedAccountId}/reinitiate`](https://docs.composio.dev/api-reference/api-reference/connections/reinitiate-connection)| [`POST /api/v3/connected_accounts/{nanoid}/refresh`](https://docs.composio.dev/api-reference/connected-accounts/post-connected-accounts-by-nanoid-refresh)|
664 -
665 -### Triggers
666 -
667 -| Previous Endpoint | Current Endpoint |
668 -| :--- | :--- |
669 -| [`GET /api/v1/triggers`](https://docs.composio.dev/api-reference/api-reference/triggers/list-triggers) | [`GET /api/v3/triggers_types`](https://docs.composio.dev/api-reference/triggers/get-triggers-types) |
670 -| [`GET /api/v1/triggers/list/enums`](https://docs.composio.dev/api-reference/api-reference/triggers/list-trigger-enums) | [`GET /api/v3/triggers_types/list/enum`](https://docs.composio.dev/api-reference/triggers/get-triggers-types-list-enum)|
671 -| [`GET /api/v2/triggers/{triggerName}`](https://docs.composio.dev/api-reference/api-reference/triggers/get-trigger-info-v-2) | [`GET /api/v3/triggers_types/{slug}`](https://docs.composio.dev/api-reference/triggers/get-triggers-types-by-slug)|
672 -| [`GET /api/v1/triggers/active_triggers`](https://docs.composio.dev/api-reference/api-reference/triggers/get-active-triggers)| [`GET /api/v3/trigger_instances/active`](https://docs.composio.dev/api-reference/triggers/get-trigger-instances-active)|
673 -| [`POST /api/v1/triggers/enable/{connectedAccountId}/{triggerName}`](https://docs.composio.dev/api-reference/api-reference/triggers/enable-trigger)| [`POST /api/v3/trigger_instances/{slug}/upsert`](https://docs.composio.dev/api-reference/triggers/post-trigger-instances-by-slug-upsert)|
674 -| [`DELETE /api/v1/triggers/instance/{triggerInstanceId}`](https://docs.composio.dev/api-reference/api-reference/triggers/delete-trigger)| [`DELETE /api/v3/trigger_instances/manage/{triggerId}`](https://docs.composio.dev/api-reference/triggers/delete-trigger-instances-manage-by-trigger-id)|
675 -| [`PATCH /api/v1/triggers/instance/{triggerId}/status`](https://docs.composio.dev/api-reference/api-reference/triggers/switch-trigger-instance-status)| [`PATCH /api/v3/trigger_instances/manage/{triggerId}`](https://docs.composio.dev/api-reference/triggers/patch-trigger-instances-manage-by-trigger-id)|
fern/pages/src/migration-guide/toolkit-versioning.mdx deleted
-115
@@ -1,115 +0,0 @@
1 ----
2 -title: Toolkit versioning migration
3 -subtitle: Migrate to the new toolkit versioning system
4 -image: "https://og.composio.dev/api/og?title=Toolkit%20versioning%20migration"
5 -keywords: "toolkit versioning, migration"
6 -hide-nav-links: false
7 ----
8 -
9 -Starting with Python SDK v0.9.0 and TypeScript SDK v0.2.0, manual tool execution requires explicit version specification. This is a breaking change from earlier versions where toolkit versioning was optional.
10 -
11 -## Breaking change
12 -
13 -Manual tool execution now requires explicit version specification. The `tools.execute()` method will fail without a version.
14 -
15 -### Before (will fail)
16 -
17 -<CodeGroup>
18 -```python Python
19 -# Raises ToolVersionRequiredError
20 -result = composio.tools.execute(
21 - "GITHUB_CREATE_ISSUE",
22 - {"user_id": "user-123", "arguments": {...}}
23 -)
24 -```
25 -
26 -```typescript TypeScript
27 -// Throws ComposioToolVersionRequiredError
28 -const result = await composio.tools.execute({
29 - toolSlug: "GITHUB_CREATE_ISSUE",
30 - userId: "user-123",
31 - arguments: {...}
32 -});
33 -```
34 -</CodeGroup>
35 -
36 -### After (required)
37 -
38 -Choose one of three migration strategies:
39 -
40 -#### Option 1: Configure version at SDK level
41 -
42 -<CodeGroup>
43 -<SnippetCode
44 - src="fern/snippets/tool-calling/python/versioning-sdk-init.py"
45 - title="Python"
46 -/>
47 -<SnippetCode
48 - src="fern/snippets/tool-calling/typescript/versioning-sdk-init.ts"
49 - title="TypeScript"
50 -/>
51 -</CodeGroup>
52 -
53 -#### Option 2: Pass version with each execution
54 -
55 -<CodeGroup>
56 -<SnippetCode
57 - src="fern/snippets/tool-calling/python/versioning-per-execution.py"
58 - startLine={6}
59 - endLine={15}
60 - title="Python"
61 -/>
62 -<SnippetCode
63 - src="fern/snippets/tool-calling/typescript/versioning-per-execution.ts"
64 - startLine={6}
65 - endLine={14}
66 - title="TypeScript"
67 -/>
68 -</CodeGroup>
69 -
70 -#### Option 3: Use environment variables
71 -
72 -```bash
73 -export COMPOSIO_TOOLKIT_VERSION_GITHUB="20251027_00"
74 -```
75 -
76 -## Migration checklist
77 -
78 -1. **Audit your code**: Find all `tools.execute()` calls in your codebase
79 -2. **Choose a strategy**: Select one of the three options above based on your needs
80 -3. **Test thoroughly**: Verify tools work correctly with pinned versions
81 -4. **Deploy gradually**: Roll out changes incrementally to minimize risk
82 -
83 -## Temporary workaround
84 -
85 -During migration, you can temporarily skip version checks (not recommended for production):
86 -
87 -<CodeGroup>
88 -```python Python
89 -result = composio.tools.execute(
90 - "GITHUB_CREATE_ISSUE",
91 - {
92 - "user_id": "user-123",
93 - "arguments": {...}
94 - },
95 - dangerously_skip_version_check=True
96 -)
97 -```
98 -
99 -```typescript TypeScript
100 -const result = await composio.tools.execute({
101 - toolSlug: "GITHUB_CREATE_ISSUE",
102 - userId: "user-123",
103 - arguments: {...},
104 - dangerouslySkipVersionCheck: true
105 -});
106 -```
107 -</CodeGroup>
108 -
109 -<Warning>
110 -The `dangerouslySkipVersionCheck` flag is only for migration or debugging. Never use in production.
111 -</Warning>
112 -
113 -## Next steps
114 -
115 -For complete documentation on toolkit versioning, including best practices and advanced configuration, see [Toolkit versioning](/docs/toolkit-versioning).
\ No newline at end of file
fern/pages/src/providers/anthropic.mdx deleted
-108
@@ -1,108 +0,0 @@
1 ----
2 -title: Anthropic Provider
3 -subtitle: Use Composio tools with Claude
4 -slug: /providers/anthropic
5 -image: "https://og.composio.dev/api/og?title=Anthropic%20Provider" # image for socials
6 -keywords: ""
7 -hide-nav-links: false
8 ----
9 -
10 -
11 -The Anthropic Provider transforms Composio tools into a format compatible with Anthropic's function calling capabilities through its Messages API.
12 -
13 -## Setup
14 -The Anthropic provider can be installed for both SDKs.
15 -
16 -<CodeGroup>
17 -```bash title="Python" for="python" maxLines=60 wordWrap
18 -pip install composio composio-anthropic
19 -```
20 -
21 -```bash title="TypeScript" for="typescript" maxLines=60 wordWrap
22 -npm install @composio/anthropic @anthropic-ai/sdk
23 -```
24 -</CodeGroup>
25 -
26 -You can specify the provider in the constructor. The constructor also takes in an optional `cacheTools` parameter.
27 -
28 -<CodeGroup>
29 -```python Python maxLines=60 wordWrap
30 -import anthropic
31 -
32 -from composio import Composio
33 -from composio_anthropic import AnthropicProvider
34 -
35 -# Initialize tools.
36 -anthropic_client = anthropic.Anthropic()
37 -composio = Composio(provider=AnthropicProvider())
38 -```
39 -
40 -```typescript TypeScript maxLines=60 wordWrap {5}
41 -import { Composio } from "@composio/core";
42 -import { AnthropicProvider } from "@composio/anthropic";
43 -import Anthropic from '@anthropic-ai/sdk';
44 -
45 -const composio = new Composio({
46 - provider: new AnthropicProvider({
47 - cacheTools: false, // default
48 - }),
49 -});
50 -
51 -const anthropic = new Anthropic();
52 -```
53 -</CodeGroup>
54 -
55 -## Usage
56 -
57 -<CodeGroup>
58 -```python Python maxLines=60 wordWrap
59 -# Define your user ID
60 -user_id = "your-user-id"
61 -
62 -# Get GitHub tool for listing stargazers
63 -tools = composio.tools.get(user_id=user_id, tools=["GITHUB_LIST_STARGAZERS"])
64 -
65 -# Get response from the LLM
66 -response = anthropic_client.messages.create(
67 - model="claude-sonnet-4-5",
68 - max_tokens=1024,
69 - tools=tools,
70 - messages=[
71 - {"role": "user", "content": "List my github stargazers. for the repo composiohq/composio"},
72 - ],
73 -)
74 -
75 -# Execute the function calls.
76 -result = composio.provider.handle_tool_calls(user_id=user_id, response=response)
77 -print(result)
78 -```
79 -
80 -```typescript TypeScript maxLines=60 wordWrap
81 -const userId = "your-user-id";
82 -const tools = await composio.tools.get(userId, {
83 - tools: ["GITHUB_LIST_STARGAZERS"]
84 -})
85 -
86 -const msg = await anthropic.messages.create({
87 - model: "claude-sonnet-4-5",
88 - messages: [
89 - {
90 - role: "user",
91 - content: "List my github stargazers. for the repo composiohq/composio",
92 - },
93 - ],
94 - tools: tools,
95 - max_tokens: 1000,
96 -});
97 -
98 -const res = await composio.provider.handleToolCalls(userId, msg);
99 -
100 -console.log(res[0].content);
101 -```
102 -</CodeGroup>
103 -
104 -
105 -## Modifiers
106 -Modifiers are functions that can be used to intercept and optionally modify the schema, the tool call request and the response from the tool call.
107 -
108 -Anthropic provider modifiers are the standard framework modifiers. Read more here: [Modifying tool schemas](/docs/modifying-tool-schemas).
\ No newline at end of file
fern/pages/src/providers/crewai.mdx deleted
-64
@@ -1,64 +0,0 @@
1 ----
2 -title: CrewAI Provider
3 -subtitle: Use Composio tools with CrewAI agents
4 -slug: /providers/crewai
5 -image: "https://og.composio.dev/api/og?title=CrewAI%20Provider" # image for socials
6 -keywords: ""
7 -hide-nav-links: false
8 ----
9 -
10 -## CrewAI Provider
11 -
12 -The CrewAI Provider formats the Composio tools into an object compatible with CrewAI's tool calling capabilities. Agents and LLM workflows built with this can call and execute the Composio tools.
13 -
14 -## Setup
15 -
16 -The CrewAI provider is available for only the Python SDK.
17 -
18 -```python Python maxLines=60 wordWrap
19 -pip install composio_crewai==0.8.0
20 -```
21 -
22 -## Usage
23 -
24 -```python Python maxLines=60 wordWrap
25 -from crewai import Agent, Crew, Task
26 -from langchain_openai import ChatOpenAI
27 -
28 -from composio import Composio
29 -from composio_crewai import CrewAIProvider
30 -
31 -# Initialize tools.
32 -openai_client = ChatOpenAI()
33 -composio = Composio(provider=CrewAIProvider())
34 -
35 -# Get All the tools
36 -tools = composio.tools.get(user_id="default", toolkits=["GITHUB"])
37 -
38 -# Define agent
39 -crewai_agent = Agent(
40 - role="Github Agent",
41 - goal="""You take action on Github using Github APIs""",
42 - backstory=(
43 - "You are AI agent that is responsible for taking actions on Github "
44 - "on users' behalf. You need to take action on Github using Github APIs"
45 - ),
46 - verbose=True,
47 - tools=tools,
48 - llm=openai_client,
49 -)
50 -
51 -# Define task
52 -task = Task(
53 - description=(
54 - "Star a repo composiohq/composio on GitHub, if the action is successful "
55 - "include Action executed successfully"
56 - ),
57 - agent=crewai_agent,
58 - expected_output="if the star happened",
59 -)
60 -
61 -my_crew = Crew(agents=[crewai_agent], tasks=[task])
62 -result = my_crew.kickoff()
63 -print(result)
64 -```
\ No newline at end of file
fern/pages/src/providers/google-adk.mdx deleted
-20
@@ -1,20 +0,0 @@
1 ----
2 -title: Google ADK Provider
3 -subtitle: Use Composio with Google's ADK
4 -slug: /providers/google-adk
5 -image: "https://og.composio.dev/api/og?title=Google%20ADK%20Provider" # image for socials
6 -keywords: ""
7 -hide-nav-links: false
8 ----
9 -
10 -- [ ] Pending on Python SDK
11 -
12 -## Google ADK Provider
13 -
14 -The Google ADK Provider formats the Composio tools into an object compatible with Google's ADK capabilities. Agents and LLM workflows built with this can call and execute the Composio tools.
15 -
16 -## Setup
17 -
18 -```typescript TypeScript maxLines=60 wordWrap
19 -
20 -```
\ No newline at end of file
fern/pages/src/providers/google.mdx deleted
-58
@@ -1,58 +0,0 @@
1 ----
2 -title: Google Gen AI Provider
3 -subtitle: Use Composio with Gemini through the Google Gen AI SDK
4 -slug: /providers/google
5 -image: "https://og.composio.dev/api/og?title=Google%20Gen%20AI%20Provider" # image for socials
6 -keywords: ""
7 -hide-nav-links: false
8 ----
9 -The Google provider transforms Composio tools into a format compatible with Gemini's function calling capabilities through it's API
10 -
11 -## Setup
12 -The Google Gen AI SDK and theprovider can only be installed for the Python SDK.
13 -
14 -<CodeGroup>
15 -
16 -```bash title="python" for="python"
17 -pip install google-genai composio_google
18 -```
19 -```bash title="typescript" for="typescript"
20 -npm install @google/genai
21 -npm i @composio/core @composio/gemini
22 -```
23 -
24 -</CodeGroup>
25 -
26 -<CodeGroup>
27 -<SnippetCode
28 - src="fern/snippets/providers/python/google.py"
29 - startLine={1}
30 - endLine={9}
31 -/>
32 -<SnippetCode
33 - src="fern/snippets/providers/typescript/google.ts"
34 - startLine={1}
35 - endLine={12}
36 -/>
37 -</CodeGroup>
38 -
39 -## Usage
40 -<CodeGroup>
41 -<SnippetCode
42 - src="fern/snippets/providers/python/google.py"
43 - startLine={10}
44 - endLine={21}
45 -/>
46 -<SnippetCode
47 - src="fern/snippets/providers/typescript/google.ts"
48 - startLine={14}
49 - endLine={39}
50 -/>
51 -</CodeGroup>
52 -
53 -## Modifiers
54 -Modifiers are functions that can be used to intercept and optionally **modify** the schema, the tool call request and the response from the tool call.
55 -
56 -OpenAI provider modifiers are the standard framework modifiers.
57 -Read more here: [Modifying tool schemas](/docs/modifying-tool-schemas)
58 -
fern/pages/src/providers/langchain.mdx deleted
-33
@@ -1,33 +0,0 @@
1 ----
2 -title: LangChain Provider
3 -subtitle: Use Composio tools with LangChain
4 -slug: /providers/langchain
5 -image: "https://og.composio.dev/api/og?title=LangChain%20Provider" # image for socials
6 -keywords: ""
7 -hide-nav-links: false
8 ----
9 -
10 -The LangChain Provider transforms Composio tools into a format compatible with LangChain's function calling capabilities.
11 -
12 -## Setup
13 -<CodeGroup>
14 -```bash title="Python" for="python"
15 -pip install composio_langchain==0.8.0 langchain
16 -```
17 -```bash title="TypeScript" for="typescript"
18 -npm install @composio/langchain
19 -```
20 -</CodeGroup>
21 -
22 -## Usage
23 -
24 -<CodeGroup>
25 -<SnippetCode
26 - src="fern/snippets/providers/python/langchain-provider.py"
27 - title="Python"
28 -/>
29 -<SnippetCode
30 - src="fern/snippets/providers/typescript/langchain.ts"
31 - title="TypeScript"
32 -/>
33 -</CodeGroup>
\ No newline at end of file
fern/pages/src/providers/llamaindex.mdx deleted
-44
@@ -1,44 +0,0 @@
1 ----
2 -title: LlamaIndex Provider
3 -subtitle: Use Composio tools with LlamaIndex
4 -slug: /providers/llamaindex
5 -image: "https://og.composio.dev/api/og?title=LlamaIndex%20Provider" # image for socials
6 -keywords: ""
7 -hide-nav-links: false
8 ----
9 -
10 -The LlamaIndex Provider transforms Composio tools into a format compatible with LlamaIndex's function calling capabilities.
11 -
12 -## Setup
13 -<CodeGroup>
14 -```bash title="Python" for="python"
15 -pip install composio_llamaindex==0.8.0 llama-index
16 -```
17 -```bash title="TypeScript" for="typescript"
18 -npm install @composio/llamaindex @llamaindex/openai @llamaindex/workflow
19 -```
20 -</CodeGroup>
21 -
22 -## Usage
23 -
24 -<CodeGroup>
25 -<SnippetCode
26 - src="fern/snippets/providers/python/llamaindex-provider.py"
27 - title="Python"
28 -/>
29 -<SnippetCode
30 - src="fern/snippets/providers/typescript/llamaindex-provider.ts"
31 - title="TypeScript"
32 -/>
33 -</CodeGroup>
34 -
35 -## Advanced Usage
36 -
37 -### Streaming Agent with Multiple Toolkits
38 -
39 -<CodeGroup>
40 -<SnippetCode
41 - src="fern/snippets/providers/typescript/llamaindex-streaming.ts"
42 - title="TypeScript"
43 -/>
44 -</CodeGroup>
\ No newline at end of file
fern/pages/src/providers/mastra.mdx deleted
-66
@@ -1,66 +0,0 @@
1 ----
2 -title: Mastra Provider
3 -subtitle: Use Composio with Mastra's TypeScript framework
4 -slug: /providers/mastra
5 -image: "https://og.composio.dev/api/og?title=Mastra%20Provider" # image for socials
6 -keywords: ""
7 -hide-nav-links: false
8 ----
9 -
10 -Mastra is a TypeScript native framework for building agents with tools and MCPs. It expects tools to be in the following format:
11 -- Inputs: What information the tool needs to run (defined with an `inputSchema`, often using Zod).
12 -- Outputs: The structure of the data the tool returns (defined with an `outputSchema`).
13 -- Execution Logic: The code that performs the tool's action.
14 -- Description: Text that helps the agent understand what the tool does and when to use it.
15 -
16 -More documentation [here](https://mastra.ai/en/docs/tools-mcp/overview#creating-tools)
17 -
18 -The Mastra provider formats the Composio tools into this format along with the execution logic so that agents can call and execute the Composio tools.
19 -
20 -## Setup
21 -
22 -```typescript TypeScript maxLines=60 wordWrap
23 -npm install @composio/mastra
24 -```
25 -
26 -You can specify the provider in the constructor.
27 -
28 -```typescript TypeScript maxLines=60 wordWrap
29 -import { Composio } from "@composio/core";
30 -import { MastraProvider } from "@composio/mastra";
31 -import { Agent } from "@mastra/core/agent";
32 -import { openai } from "@ai-sdk/openai";
33 -
34 -const composio = new Composio({
35 - provider: new MastraProvider(),
36 -});
37 -```
38 -
39 -## Usage
40 -
41 -The tools are passed to the agent as a parameter.
42 -
43 -```typescript TypeScript maxLines=60 wordWrap
44 -const userId = "john doe";
45 -
46 -const tools = await composio.tools.get(
47 - userId,
48 - {
49 - toolkits: ["SUPABASE"],
50 - }
51 -);
52 -
53 -const agent = new Agent({
54 - name: "Supabase Agent",
55 - instructions: "You think therefore you are.",
56 - model: openai("gpt-4.1"),
57 - tools: tools,
58 -});
59 -
60 -const { text } = await agent.generate([
61 - { role: "user", content: "Tell me about my Supabase project" },
62 -]);
63 -
64 -console.log("\n🤖 Agent Response:\n");
65 -console.log(text);
66 -```
\ No newline at end of file
fern/pages/src/providers/openai-agents.mdx deleted
-47
@@ -1,47 +0,0 @@
1 ----
2 -title: OpenAI Agents Provider
3 -subtitle: Use Composio with OpenAI's Agents SDK
4 -slug: /providers/openai-agents
5 -image: "https://og.composio.dev/api/og?title=OpenAI%20Agents%20Provider" # image for socials
6 -keywords: ""
7 -hide-nav-links: false
8 ----
9 -
10 -## OpenAI Agents Provider
11 -
12 -The OpenAI Agents Provider is a provider that formats the Composio tools into an object compatible with OpenAI's Agents API.
13 -
14 -OpenAI Agents SDK is different from the OpenAI SDK. It helps build agentic AI apps in a lightweight, easy-to-use package with very few abstractions.
15 -
16 -<Tabs>
17 - <Tab title="Python">
18 - ### Setup
19 -
20 - ```bash
21 - pip install composio openai-agents composio-openai-agents
22 - ```
23 -
24 - ### Usage
25 -
26 - <SnippetCode
27 - src="fern/snippets/providers/python/openai-agents.py"
28 - startLine={1}
29 - endLine={26}
30 - />
31 - </Tab>
32 - <Tab title="TypeScript">
33 - ### Setup
34 -
35 - ```bash
36 - npm install @composio/core @openai/agents @composio/openai-agents
37 - ```
38 -
39 - ### Usage
40 -
41 - <SnippetCode
42 - src="fern/snippets/providers/typescript/openai-agents.ts"
43 - startLine={1}
44 - endLine={33}
45 - />
46 - </Tab>
47 -</Tabs>
fern/pages/src/providers/openai.mdx deleted
-78
@@ -1,78 +0,0 @@
1 ----
2 -title: OpenAI Providers
3 -subtitle: Use Composio with OpenAI's Responses and Chat Completion APIs
4 -slug: /providers/openai
5 -image: "https://og.composio.dev/api/og?title=OpenAI%20Providers" # image for socials
6 -keywords: ""
7 -hide-nav-links: false
8 ----
9 -
10 -The OpenAI Provider is the default provider for the Composio SDK. It transforms Composio tools into a format compatible with OpenAI's function calling capabilities through both the Responses and Chat Completion APIs.
11 -
12 -## Setup
13 -By default, the OpenAI Provider is installed when you install the Composio SDK. You can also install it manually:
14 -
15 -<CodeGroup>
16 -```bash title="Python" for="python"
17 -pip install composio_openai
18 -```
19 -```bash title="TypeScript" for="typescript"
20 -npm install @composio/openai
21 -```
22 -</CodeGroup>
23 -
24 -## Responses API
25 -The Responses API is the recommended way to build more agentic flows with the OpenAI API.
26 -Read more about it in the [OpenAI documentation](https://platform.openai.com/docs/api-reference/responses)
27 -
28 -<Note>
29 -Before executing any tools that require authentication (like Gmail), you'll need to:
30 -1. [Create an Auth Configuration](/docs/authenticating-tools#creating-an-auth-config) for your integration
31 -2. [Set up a Connected Account](/docs/authenticating-tools#connecting-an-account) for the user.
32 -</Note>
33 -
34 -<CodeGroup>
35 -<SnippetCode
36 - src="fern/snippets/providers/python/openai-responses-provider.py"
37 - startLine={1}
38 - endLine={39}
39 -/>
40 -<SnippetCode
41 - src="fern/snippets/providers/typescript/openairesponses.ts"
42 - startLine={1}
43 - endLine={38}
44 -/>
45 -
46 -</CodeGroup>
47 -
48 -## Chat Completion API
49 -The Chat Completion API generates a model response from a list of messages. Read more about it in the [OpenAI documentation](https://platform.openai.com/docs/api-reference/chat).
50 -The OpenAI Chat Provider is the default provider used by Composio SDK, but you can also explicitly initialise it.
51 -
52 -<Note>
53 -Before executing any tools that require authentication (like Gmail), you'll need to:
54 -1. [Create an Auth Configuration](/docs/authenticating-tools#creating-an-auth-config) for your integration
55 -2. [Set up a Connected Account](/docs/authenticating-tools#connecting-an-account) for the user.
56 -
57 -</Note>
58 -<CodeGroup>
59 -<SnippetCode
60 - src="fern/snippets/providers/python/openai-provider.py"
61 - startLine={1}
62 - endLine={25}
63 -/>
64 -<SnippetCode
65 - src="fern/snippets/providers/typescript/openai.ts"
66 - startLine={1}
67 - endLine={40}
68 -/>
69 -
70 -</CodeGroup>
71 -
72 -
73 -## Modifiers
74 -Modifiers are functions that can be used to intercept and optionally **modify** the schema, the tool call request and the response from the tool call.
75 -
76 -OpenAI provider modifiers are the standard framework modifiers.
77 -Read more here: [Modifying tool schemas](/docs/modifying-tool-schemas)
78 -
fern/pages/src/providers/py-custom.mdx deleted
-447
@@ -1,447 +0,0 @@
1 ----
2 -title: Python Custom Provider
3 -subtitle: Learn how to create custom providers for any AI framework in Python
4 -image: "https://og.composio.dev/api/og?title=Python%20Custom%20Provider" # image for socials
5 -keywords: ""
6 -hide-nav-links: false
7 ----
8 -
9 -This guide shows how to create custom providers for the Composio Python SDK. Custom providers enable integration with different AI frameworks and platforms.
10 -
11 -## Provider architecture
12 -
13 -The Composio SDK uses a provider architecture to adapt tools for different AI frameworks. The provider handles:
14 -
15 -1. **Tool format transformation**: Converting Composio tools into formats compatible with specific AI platforms
16 -2. **Platform-specific integration**: Providing helper methods for seamless integration
17 -
18 -## Types of providers
19 -
20 -There are two types of providers:
21 -
22 -1. **Non-agentic providers**: Transform tools for platforms that don't have their own agency (e.g., OpenAI, Anthropic)
23 -2. **Agentic providers**: Transform tools for platforms that have their own agency (e.g., LangChain, CrewAI)
24 -
25 -## Provider class hierarchy
26 -
27 -```
28 -BaseProvider (Abstract)
29 -├── NonAgenticProvider (Abstract)
30 -│ └── OpenAIProvider (Concrete)
31 -│ └── AnthropicProvider (Concrete)
32 -│ └── [Your Custom Non-Agentic Provider] (Concrete)
33 -└── AgenticProvider (Abstract)
34 - └── LangchainProvider (Concrete)
35 - └── [Your Custom Agentic Provider] (Concrete)
36 -```
37 -
38 -## Quick start
39 -
40 -The fastest way to create a new provider is using the provider scaffolding script:
41 -
42 -```bash
43 -# Create a non-agentic provider
44 -make create-provider name=myprovider
45 -
46 -# Create an agentic provider
47 -make create-provider name=myagent agentic=true
48 -
49 -# Create provider with custom output directory
50 -make create-provider name=myprovider output=/path/to/custom/dir
51 -
52 -# Combine options
53 -make create-provider name=myagent agentic=true output=/my/custom/path
54 -```
55 -
56 -This will create a new provider in the specified directory (default: `python/providers/<provider-name>/`) with:
57 -- Complete package structure with `pyproject.toml`
58 -- Provider implementation template
59 -- Demo script
60 -- README with usage examples
61 -- Type annotations and proper inheritance
62 -
63 -<Tip>
64 -The scaffolding script creates a fully functional provider template. You just need to implement the tool transformation logic specific to your platform. You can maintain your provider implementation in your own repository.
65 -</Tip>
66 -
67 -### Generated structure
68 -
69 -The create-provider script generates the following structure:
70 -
71 -```
72 -python/providers/<provider-name>/
73 -├── README.md # Documentation and usage examples
74 -├── pyproject.toml # Project configuration
75 -├── setup.py # Setup script for pip compatibility
76 -├── <provider-name>_demo.py # Demo script showing usage
77 -└── composio_<provider-name>/ # Package directory
78 - ├── __init__.py # Package initialization
79 - ├── provider.py # Provider implementation
80 - └── py.typed # PEP 561 type marker
81 -```
82 -
83 -After generation, you can:
84 -1. Navigate to the provider directory: `cd python/providers/<provider-name>`
85 -2. Install in development mode: `uv pip install -e .`
86 -3. Implement your provider logic in `composio_<provider-name>/provider.py`
87 -4. Test with the demo script: `python <provider-name>_demo.py`
88 -
89 -## Creating a non-agentic provider
90 -
91 -Non-agentic providers inherit from the `NonAgenticProvider` abstract class:
92 -
93 -```python
94 -from typing import List, Optional, Sequence, TypeAlias
95 -from composio.core.provider import NonAgenticProvider
96 -from composio.types import Tool, Modifiers, ToolExecutionResponse
97 -
98 -# Define your tool format
99 -class MyAITool:
100 - def __init__(self, name: str, description: str, parameters: dict):
101 - self.name = name
102 - self.description = description
103 - self.parameters = parameters
104 -
105 -# Define your tool collection format
106 -MyAIToolCollection: TypeAlias = List[MyAITool]
107 -
108 -# Create your provider
109 -class MyAIProvider(NonAgenticProvider[MyAITool, MyAIToolCollection], name="my-ai-platform"):
110 - """Custom provider for My AI Platform"""
111 -
112 - def wrap_tool(self, tool: Tool) -> MyAITool:
113 - """Transform a single tool to platform format"""
114 - return MyAITool(
115 - name=tool.slug,
116 - description=tool.description or "",
117 - parameters={
118 - "type": "object",
119 - "properties": tool.input_parameters.get("properties", {}),
120 - "required": tool.input_parameters.get("required", [])
121 - }
122 - )
123 -
124 - def wrap_tools(self, tools: Sequence[Tool]) -> MyAIToolCollection:
125 - """Transform a collection of tools"""
126 - return [self.wrap_tool(tool) for tool in tools]
127 -
128 - # Optional: Custom helper methods for your AI platform
129 - def execute_my_ai_tool_call(
130 - self,
131 - user_id: str,
132 - tool_call: dict,
133 - modifiers: Optional[Modifiers] = None
134 - ) -> ToolExecutionResponse:
135 - """Execute a tool call in your platform's format
136 -
137 - Example usage:
138 - result = my_provider.execute_my_ai_tool_call(
139 - user_id="default",
140 - tool_call={"name": "GITHUB_STAR_REPO", "arguments": {"owner": "composiohq", "repo": "composio"}}
141 - )
142 - """
143 - # Use the built-in execute_tool method
144 - return self.execute_tool(
145 - slug=tool_call["name"],
146 - arguments=tool_call["arguments"],
147 - modifiers=modifiers,
148 - user_id=user_id
149 - )
150 -```
151 -
152 -## Creating an agentic provider
153 -
154 -Agentic providers inherit from the `AgenticProvider` abstract class:
155 -
156 -```python
157 -from typing import Callable, Dict, List, Sequence
158 -from composio.core.provider import AgenticProvider, AgenticProviderExecuteFn
159 -from composio.types import Tool
160 -from my_provider import AgentTool
161 -
162 -# Import the Tool/Function class that represents a callable tool for your framework
163 -# Optionally define your custom tool format below
164 -# class AgentTool:
165 -# def __init__(self, name: str, description: str, execute: Callable, schema: dict):
166 -# self.name = name
167 -# self.description = description
168 -# self.execute = execute
169 -# self.schema = schema
170 -
171 -# Define your tool collection format (typically a List)
172 -AgentToolCollection: TypeAlias = List[AgentTool]
173 -
174 -# Create your provider
175 -class MyAgentProvider(AgenticProvider[AgentTool, List[AgentTool]], name="my-agent-platform"):
176 - """Custom provider for My Agent Platform"""
177 -
178 - def wrap_tool(self, tool: Tool, execute_tool: AgenticProviderExecuteFn) -> AgentTool:
179 - """Transform a single tool with execute function"""
180 - def execute_wrapper(**kwargs) -> Dict:
181 - result = execute_tool(tool.slug, kwargs)
182 - if not result.get("successful", False):
183 - raise Exception(result.get("error", "Tool execution failed"))
184 - return result.get("data", {})
185 -
186 - return AgentTool(
187 - name=tool.slug,
188 - description=tool.description or "",
189 - execute=execute_wrapper,
190 - schema=tool.input_parameters
191 - )
192 -
193 - def wrap_tools(
194 - self,
195 - tools: Sequence[Tool],
196 - execute_tool: AgenticProviderExecuteFn
197 - ) -> AgentToolCollection:
198 - """Transform a collection of tools with execute function"""
199 - return [self.wrap_tool(tool, execute_tool) for tool in tools]
200 -```
201 -
202 -## Using your custom provider
203 -
204 -After creating your provider, use it with the Composio SDK:
205 -
206 -### Non-agentic provider example
207 -
208 -```python
209 -from composio import Composio
210 -from composio_myai import MyAIProvider
211 -from myai import MyAIClient # Your AI platform's client
212 -
213 -# Initialize tools
214 -myai_client = MyAIClient()
215 -composio = Composio(provider=MyAIProvider())
216 -
217 -# Define task
218 -task = "Star a repo composiohq/composio on GitHub"
219 -
220 -# Get GitHub tools that are pre-configured
221 -tools = composio.tools.get(user_id="default", toolkits=["GITHUB"])
222 -
223 -# Get response from your AI platform (example)
224 -response = myai_client.chat.completions.create(
225 - model="your-model",
226 - tools=tools, # These are in your platform's format
227 - messages=[
228 - {"role": "system", "content": "You are a helpful assistant."},
229 - {"role": "user", "content": task},
230 - ],
231 -)
232 -print(response)
233 -
234 -# Execute the function calls
235 -result = composio.provider.handle_tool_calls(response=response, user_id="default")
236 -print(result)
237 -```
238 -
239 -### Agentic provider example
240 -
241 -```python
242 -import asyncio
243 -from agents import Agent, Runner
244 -from composio_myagent import MyAgentProvider
245 -from composio import Composio
246 -
247 -# Initialize Composio toolset
248 -composio = Composio(provider=MyAgentProvider())
249 -
250 -# Get all the tools
251 -tools = composio.tools.get(
252 - user_id="default",
253 - tools=["GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER"],
254 -)
255 -
256 -# Create an agent with the tools
257 -agent = Agent(
258 - name="GitHub Agent",
259 - instructions="You are a helpful assistant that helps users with GitHub tasks.",
260 - tools=tools,
261 -)
262 -
263 -# Run the agent
264 -async def main():
265 - result = await Runner.run(
266 - starting_agent=agent,
267 - input=(
268 - "Star the repository composiohq/composio on GitHub. If done "
269 - "successfully, respond with 'Action executed successfully'"
270 - ),
271 - )
272 - print(result.final_output)
273 -
274 -asyncio.run(main())
275 -```
276 -
277 -
278 -## Example: Anthropic Claude provider
279 -
280 -Here's a complete example for Anthropic's Claude:
281 -
282 -```python
283 -import typing as t
284 -
285 -from anthropic.types.beta.beta_tool_use_block import BetaToolUseBlock
286 -from anthropic.types.message import Message as ToolsBetaMessage
287 -from anthropic.types.tool_param import ToolParam
288 -from anthropic.types.tool_use_block import ToolUseBlock
289 -
290 -from composio.core.provider import NonAgenticProvider
291 -from composio.types import Modifiers, Tool, ToolExecutionResponse
292 -
293 -
294 -class AnthropicProvider(
295 - NonAgenticProvider[ToolParam, list[ToolParam]],
296 - name="anthropic",
297 -):
298 - """Composio toolset for Anthropic Claude platform."""
299 -
300 - def wrap_tool(self, tool: Tool) -> ToolParam:
301 - return ToolParam(
302 - input_schema=tool.input_parameters,
303 - name=tool.slug,
304 - description=tool.description,
305 - )
306 -
307 - def wrap_tools(self, tools: t.Sequence[Tool]) -> list[ToolParam]:
308 - return [self.wrap_tool(tool) for tool in tools]
309 -
310 - def execute_tool_call(
311 - self,
312 - user_id: str,
313 - tool_call: ToolUseBlock,
314 - modifiers: t.Optional[Modifiers] = None,
315 - ) -> ToolExecutionResponse:
316 - """Execute a tool call.
317 -
318 - :param user_id: User ID to use for executing function calls.
319 - :param tool_call: Tool call metadata.
320 - :param modifiers: Modifiers to use for executing function calls.
321 - :return: Object containing output data from the tool call.
322 - """
323 - return self.execute_tool(
324 - slug=tool_call.name,
325 - arguments=t.cast(t.Dict, tool_call.input),
326 - modifiers=modifiers,
327 - user_id=user_id,
328 - )
329 -
330 - def handle_tool_calls(
331 - self,
332 - user_id: str,
333 - response: t.Union[dict, ToolsBetaMessage],
334 - modifiers: t.Optional[Modifiers] = None,
335 - ) -> t.List[ToolExecutionResponse]:
336 - """Handle tool calls from Anthropic Claude chat completion object.
337 -
338 - :param response: Chat completion object from
339 - `anthropic.Anthropic.beta.tools.messages.create` function call.
340 - :param user_id: User ID to use for executing function calls.
341 - :param modifiers: Modifiers to use for executing function calls.
342 - :return: A list of output objects from the tool calls.
343 - """
344 - if isinstance(response, dict):
345 - response = ToolsBetaMessage(**response)
346 -
347 - outputs = []
348 - for content in response.content:
349 - if isinstance(content, (ToolUseBlock, BetaToolUseBlock)):
350 - outputs.append(
351 - self.execute_tool_call(
352 - user_id=user_id,
353 - tool_call=content,
354 - modifiers=modifiers,
355 - )
356 - )
357 - return outputs
358 -```
359 -
360 -## Example: OpenAI Agents provider
361 -
362 -Here's an example for OpenAI Agents framework:
363 -
364 -```python
365 -import asyncio
366 -import json
367 -import typing as t
368 -
369 -import pydantic
370 -from agents import FunctionTool
371 -
372 -from composio.core.provider import AgenticProvider, AgenticProviderExecuteFn
373 -from composio.types import Tool
374 -from composio.utils.pydantic import parse_pydantic_error
375 -
376 -
377 -class OpenAIAgentsProvider(
378 - AgenticProvider[FunctionTool, list[FunctionTool]],
379 - name="openai_agents",
380 -):
381 - """Provider for OpenAI Agents framework"""
382 -
383 - def wrap_tool(
384 - self,
385 - tool: Tool,
386 - execute_tool: AgenticProviderExecuteFn,
387 - ) -> FunctionTool:
388 - """Wrap a tool as a FunctionTool"""
389 -
390 - # Create an async wrapper for the tool execution
391 - async def execute_tool_wrapper(_ctx, payload):
392 - """Execute Composio action with the given arguments"""
393 - try:
394 - return json.dumps(
395 - obj=(
396 - await asyncio.to_thread( # Running in thread since execute_tool is not async
397 - execute_tool,
398 - slug=tool.slug,
399 - arguments=json.loads(payload) if payload else {},
400 - )
401 - )
402 - )
403 - except pydantic.ValidationError as e:
404 - return json.dumps({
405 - "successful": False,
406 - "error": parse_pydantic_error(e),
407 - "data": None,
408 - })
409 - except Exception as e:
410 - return json.dumps({
411 - "successful": False,
412 - "error": str(e),
413 - "data": None,
414 - })
415 -
416 - # Ensure the schema has additionalProperties set to false
417 - modified_schema = tool.input_parameters.copy()
418 - modified_schema["additionalProperties"] = False
419 -
420 - # Create a FunctionTool with the appropriate schema
421 - return FunctionTool(
422 - name=tool.slug,
423 - description=tool.description,
424 - params_json_schema=modified_schema,
425 - on_invoke_tool=execute_tool_wrapper,
426 - strict_json_schema=False, # Composio tools already have optimal schemas
427 - )
428 -
429 - def wrap_tools(
430 - self,
431 - tools: t.Sequence[Tool],
432 - execute_tool: AgenticProviderExecuteFn,
433 - ) -> list[FunctionTool]:
434 - """Wrap multiple tools for OpenAI Agents"""
435 - return [self.wrap_tool(tool, execute_tool) for tool in tools]
436 -```
437 -
438 -## Best practices
439 -
440 -1. **Keep providers focused**: Each provider should integrate with one specific platform
441 -2. **Handle errors gracefully**: Catch and transform errors from tool execution
442 -3. **Follow platform conventions**: Adopt naming and structural conventions of the target platform
443 -4. **Use type annotations**: Leverage Python's typing system for better IDE support and documentation
444 -5. **Cache transformed tools**: Store transformed tools when appropriate to improve performance
445 -6. **Add helper methods**: Provide convenient methods for common platform-specific operations
446 -7. **Document your provider**: Include docstrings and usage examples
447 -8. **Set meaningful provider names**: Use the name parameter for telemetry and debugging
\ No newline at end of file
fern/pages/src/providers/ts-custom.mdx deleted
-484
@@ -1,484 +0,0 @@
1 ----
2 -title: TypeScript Custom Provider
3 -subtitle: Learn how to create custom providers for any AI platform in TypeScript
4 -image: "https://og.composio.dev/api/og?title=TypeScript%20Custom%20Provider" # image for socials
5 -keywords: ""
6 -hide-nav-links: false
7 ----
8 -
9 -This guide provides a comprehensive walkthrough of creating custom providers for the Composio TypeScript SDK, enabling integration with different AI frameworks and platforms.
10 -
11 -## Provider Architecture
12 -
13 -The Composio SDK uses a provider architecture to adapt tools for different AI frameworks. The provider handles:
14 -
15 -1. **Tool Format Transformation**: Converting Composio tools into formats compatible with specific AI platforms
16 -2. **Tool Execution**: Managing the flow of tool execution and results
17 -3. **Platform-Specific Integration**: Providing helper methods for seamless integration
18 -
19 -## Types of Providers
20 -
21 -There are two types of providers:
22 -
23 -1. **Non-Agentic Providers**: Transform tools for platforms that don't have their own agency (e.g., OpenAI)
24 -2. **Agentic Providers**: Transform tools for platforms that have their own agency (e.g., LangChain, AutoGPT)
25 -
26 -## Provider Class Hierarchy
27 -
28 -```
29 -BaseProvider (Abstract)
30 -├── BaseNonAgenticProvider (Abstract)
31 -│ └── OpenAIProvider (Concrete)
32 -│ └── [Your Custom Non-Agentic Provider] (Concrete)
33 -└── BaseAgenticProvider (Abstract)
34 - └── [Your Custom Agentic Provider] (Concrete)
35 -```
36 -
37 -## Creating a Non-Agentic Provider
38 -
39 -Non-agentic providers implement the `BaseNonAgenticProvider` abstract class:
40 -
41 -```typescript
42 -import { BaseNonAgenticProvider, Tool } from '@composio/core';
43 -
44 -// Define your tool format
45 -interface MyAITool {
46 - name: string;
47 - description: string;
48 - parameters: {
49 - type: string;
50 - properties: Record<string, unknown>;
51 - required?: string[];
52 - };
53 -}
54 -
55 -// Define your tool collection format
56 -type MyAIToolCollection = MyAITool[];
57 -
58 -// Create your provider
59 -export class MyAIProvider extends BaseNonAgenticProvider<MyAIToolCollection, MyAITool> {
60 - // Required: Unique provider name for telemetry
61 - readonly name = 'my-ai-platform';
62 -
63 - // Required: Method to transform a single tool
64 - override wrapTool(tool: Tool): MyAITool {
65 - return {
66 - name: tool.slug,
67 - description: tool.description || '',
68 - parameters: {
69 - type: 'object',
70 - properties: tool.inputParameters?.properties || {},
71 - required: tool.inputParameters?.required || [],
72 - },
73 - };
74 - }
75 -
76 - // Required: Method to transform a collection of tools
77 - override wrapTools(tools: Tool[]): MyAIToolCollection {
78 - return tools.map(tool => this.wrapTool(tool));
79 - }
80 -
81 - // Optional: Custom helper methods for your AI platform
82 - async executeMyAIToolCall(
83 - userId: string,
84 - toolCall: {
85 - name: string;
86 - arguments: Record<string, unknown>;
87 - }
88 - ): Promise<string> {
89 - // Use the built-in executeTool method
90 - const result = await this.executeTool(toolCall.name, {
91 - userId,
92 - arguments: toolCall.arguments,
93 - });
94 -
95 - return JSON.stringify(result.data);
96 - }
97 -}
98 -```
99 -
100 -## Creating an Agentic Provider
101 -
102 -Agentic providers implement the `BaseAgenticProvider` abstract class:
103 -
104 -```typescript
105 -import { BaseAgenticProvider, Tool, ExecuteToolFn } from '@composio/core';
106 -
107 -// Define your tool format
108 -interface AgentTool {
109 - name: string;
110 - description: string;
111 - execute: (args: Record<string, unknown>) => Promise<unknown>;
112 - schema: Record<string, unknown>;
113 -}
114 -
115 -// Define your tool collection format
116 -interface AgentToolkit {
117 - tools: AgentTool[];
118 - createAgent: (config: Record<string, unknown>) => unknown;
119 -}
120 -
121 -// Create your provider
122 -export class MyAgentProvider extends BaseAgenticProvider<AgentToolkit, AgentTool> {
123 - // Required: Unique provider name for telemetry
124 - readonly name = 'my-agent-platform';
125 -
126 - // Required: Method to transform a single tool with execute function
127 - override wrapTool(tool: Tool, executeToolFn: ExecuteToolFn): AgentTool {
128 - return {
129 - name: tool.slug,
130 - description: tool.description || '',
131 - schema: tool.inputParameters || {},
132 - execute: async (args: Record<string, unknown>) => {
133 - const result = await executeToolFn(tool.slug, args);
134 - if (!result.successful) {
135 - throw new Error(result.error || 'Tool execution failed');
136 - }
137 - return result.data;
138 - },
139 - };
140 - }
141 -
142 - // Required: Method to transform a collection of tools with execute function
143 - override wrapTools(tools: Tool[], executeToolFn: ExecuteToolFn): AgentToolkit {
144 - const agentTools = tools.map(tool => this.wrapTool(tool, executeToolFn));
145 -
146 - return {
147 - tools: agentTools,
148 - createAgent: config => {
149 - // Create an agent using the tools
150 - return {
151 - run: async (prompt: string) => {
152 - // Implementation depends on your agent framework
153 - console.log(`Running agent with prompt: ${prompt}`);
154 - // The agent would use the tools.execute method to run tools
155 - },
156 - };
157 - },
158 - };
159 - }
160 -
161 - // Optional: Custom helper methods for your agent platform
162 - async runAgent(agentToolkit: AgentToolkit, prompt: string): Promise<unknown> {
163 - const agent = agentToolkit.createAgent({});
164 - return await agent.run(prompt);
165 - }
166 -}
167 -```
168 -
169 -## Using Your Custom Provider
170 -
171 -After creating your provider, use it with the Composio SDK:
172 -
173 -```typescript
174 -import { Composio } from '@composio/core';
175 -import { MyAIProvider } from './my-ai-provider';
176 -
177 -// Create your provider instance
178 -const myProvider = new MyAIProvider();
179 -
180 -// Initialize Composio with your provider
181 -const composio = new Composio({
182 - apiKey: 'your-composio-api-key',
183 - provider: myProvider,
184 -});
185 -
186 -// Get tools - they will be transformed by your provider
187 -const tools = await composio.tools.get('default', {
188 - toolkits: ['github'],
189 -});
190 -
191 -// Use the tools with your AI platform
192 -console.log(tools); // These will be in your custom format
193 -```
194 -
195 -## Provider State and Context
196 -
197 -Your provider can maintain state and context:
198 -
199 -```typescript
200 -export class StatefulProvider extends BaseNonAgenticProvider<ToolCollection, Tool> {
201 - readonly name = 'stateful-provider';
202 -
203 - // Provider state
204 - private requestCount = 0;
205 - private toolCache = new Map<string, any>();
206 - private config: ProviderConfig;
207 -
208 - constructor(config: ProviderConfig) {
209 - super();
210 - this.config = config;
211 - }
212 -
213 - override wrapTool(tool: Tool): ProviderTool {
214 - this.requestCount++;
215 -
216 - // Use the provider state/config
217 - const enhancedTool = {
218 - // Transform the tool
219 - name: this.config.useUpperCase ? tool.slug.toUpperCase() : tool.slug,
220 - description: tool.description,
221 - schema: tool.inputParameters,
222 - };
223 -
224 - // Cache the transformed tool
225 - this.toolCache.set(tool.slug, enhancedTool);
226 -
227 - return enhancedTool;
228 - }
229 -
230 - override wrapTools(tools: Tool[]): ProviderToolCollection {
231 - return tools.map(tool => this.wrapTool(tool));
232 - }
233 -
234 - // Custom methods that use provider state
235 - getRequestCount(): number {
236 - return this.requestCount;
237 - }
238 -
239 - getCachedTool(slug: string): ProviderTool | undefined {
240 - return this.toolCache.get(slug);
241 - }
242 -}
243 -```
244 -
245 -## Advanced: Provider Composition
246 -
247 -You can compose functionality by extending existing providers:
248 -
249 -```typescript
250 -import { OpenAIProvider } from '@composio/openai';
251 -
252 -// Extend the OpenAI provider with custom functionality
253 -export class EnhancedOpenAIProvider extends OpenAIProvider {
254 - // Add properties
255 - private analytics = {
256 - toolCalls: 0,
257 - errors: 0,
258 - };
259 -
260 - // Override methods to add functionality
261 - override async executeToolCall(userId, tool, options, modifiers) {
262 - this.analytics.toolCalls++;
263 -
264 - try {
265 - // Call the parent implementation
266 - const result = await super.executeToolCall(userId, tool, options, modifiers);
267 - return result;
268 - } catch (error) {
269 - this.analytics.errors++;
270 - throw error;
271 - }
272 - }
273 -
274 - // Add new methods
275 - getAnalytics() {
276 - return this.analytics;
277 - }
278 -
279 - async executeWithRetry(userId, tool, options, modifiers, maxRetries = 3) {
280 - let attempts = 0;
281 - let lastError;
282 -
283 - while (attempts < maxRetries) {
284 - try {
285 - return await this.executeToolCall(userId, tool, options, modifiers);
286 - } catch (error) {
287 - lastError = error;
288 - attempts++;
289 - await new Promise(resolve => setTimeout(resolve, 1000 * attempts));
290 - }
291 - }
292 -
293 - throw lastError;
294 - }
295 -}
296 -```
297 -
298 -## Example: Anthropic Claude Provider
299 -
300 -Here's a more complete example for Anthropic's Claude:
301 -
302 -```typescript
303 -import { BaseNonAgenticProvider, Tool } from '@composio/core';
304 -import Anthropic from '@anthropic-ai/sdk';
305 -
306 -interface ClaudeTool {
307 - name: string;
308 - description: string;
309 - input_schema: {
310 - type: string;
311 - properties: Record<string, unknown>;
312 - required?: string[];
313 - };
314 -}
315 -
316 -type ClaudeToolCollection = ClaudeTool[];
317 -
318 -export class ClaudeProvider extends BaseNonAgenticProvider<ClaudeToolCollection, ClaudeTool> {
319 - readonly name = 'claude';
320 - private client: Anthropic;
321 -
322 - constructor(apiKey: string) {
323 - super();
324 - this.client = new Anthropic({
325 - apiKey,
326 - });
327 - }
328 -
329 - override wrapTool(tool: Tool): ClaudeTool {
330 - return {
331 - name: tool.slug,
332 - description: tool.description || '',
333 - input_schema: {
334 - type: 'object',
335 - properties: tool.inputParameters?.properties || {},
336 - required: tool.inputParameters?.required || [],
337 - },
338 - };
339 - }
340 -
341 - override wrapTools(tools: Tool[]): ClaudeToolCollection {
342 - return tools.map(tool => this.wrapTool(tool));
343 - }
344 -
345 - // Helper method to create a Claude message with tools
346 - async createMessage(prompt: string, tools: ClaudeToolCollection, userId: string) {
347 - const response = await this.client.messages.create({
348 - model: 'claude-3-opus-20240229',
349 - max_tokens: 1024,
350 - system: 'You are a helpful assistant with access to tools.',
351 - messages: [{ role: 'user', content: prompt }],
352 - tools,
353 - });
354 -
355 - // Process tool calls if any
356 - if (
357 - response.content.some(
358 - content => content.type === 'tool_use' && 'name' in content && 'input' in content
359 - )
360 - ) {
361 - const toolResponses = await Promise.all(
362 - response.content
363 - .filter(content => content.type === 'tool_use')
364 - .map(async (content: any) => {
365 - const result = await this.executeTool(content.name, {
366 - userId,
367 - arguments: content.input,
368 - });
369 -
370 - return {
371 - type: 'tool_result',
372 - tool_use_id: content.id,
373 - content: JSON.stringify(result.data),
374 - };
375 - })
376 - );
377 -
378 - // Continue the conversation with tool results
379 - const followupResponse = await this.client.messages.create({
380 - model: 'claude-3-opus-20240229',
381 - max_tokens: 1024,
382 - system: 'You are a helpful assistant with access to tools.',
383 - messages: [
384 - { role: 'user', content: prompt },
385 - { role: 'assistant', content: response.content },
386 - { role: 'user', content: toolResponses },
387 - ],
388 - tools,
389 - });
390 -
391 - return followupResponse;
392 - }
393 -
394 - return response;
395 - }
396 -}
397 -```
398 -
399 -## Example: LangChain Provider
400 -
401 -Here's an example for LangChain:
402 -
403 -```typescript
404 -import { BaseAgenticProvider, Tool, ExecuteToolFn } from '@composio/core';
405 -import { DynamicTool } from 'langchain/tools';
406 -import { ChatOpenAI } from 'langchain/chat_models/openai';
407 -import { initializeAgentExecutorWithOptions } from 'langchain/agents';
408 -
409 -interface LangChainTool extends DynamicTool {
410 - name: string;
411 - description: string;
412 - func: (input: Record<string, unknown>) => Promise<string>;
413 -}
414 -
415 -interface LangChainToolkit {
416 - tools: LangChainTool[];
417 - createExecutor: (options: { model: string }) => Promise<any>;
418 -}
419 -
420 -export class LangChainProvider extends BaseAgenticProvider<LangChainToolkit, LangChainTool> {
421 - readonly name = 'langchain';
422 -
423 - override wrapTool(tool: Tool, executeToolFn: ExecuteToolFn): LangChainTool {
424 - return new DynamicTool({
425 - name: tool.slug,
426 - description: tool.description || '',
427 - func: async (input: string) => {
428 - try {
429 - // Parse input from string to object
430 - const args = typeof input === 'string' ? JSON.parse(input) : input;
431 -
432 - // Execute the tool
433 - const result = await executeToolFn(tool.slug, args);
434 -
435 - if (!result.successful) {
436 - throw new Error(result.error || 'Tool execution failed');
437 - }
438 -
439 - // Return the result
440 - return JSON.stringify(result.data);
441 - } catch (error) {
442 - return `Error: ${error.message}`;
443 - }
444 - },
445 - }) as LangChainTool;
446 - }
447 -
448 - override wrapTools(tools: Tool[], executeToolFn: ExecuteToolFn): LangChainToolkit {
449 - const langchainTools = tools.map(tool => this.wrapTool(tool, executeToolFn));
450 -
451 - return {
452 - tools: langchainTools,
453 - createExecutor: async ({ model }) => {
454 - const llm = new ChatOpenAI({
455 - modelName: model || 'gpt-4',
456 - temperature: 0,
457 - });
458 -
459 - return await initializeAgentExecutorWithOptions(langchainTools, llm, {
460 - agentType: 'chat-zero-shot-react-description',
461 - verbose: true,
462 - });
463 - },
464 - };
465 - }
466 -
467 - // Helper method to run the agent
468 - async runAgent(toolkit: LangChainToolkit, prompt: string, model = 'gpt-4'): Promise<string> {
469 - const executor = await toolkit.createExecutor({ model });
470 - const result = await executor.call({ input: prompt });
471 - return result.output;
472 - }
473 -}
474 -```
475 -
476 -## Best Practices
477 -
478 -1. **Keep providers focused**: Each provider should integrate with one specific platform
479 -2. **Handle errors gracefully**: Catch and transform errors from tool execution
480 -3. **Follow platform conventions**: Adopt naming and structural conventions of the target platform
481 -4. **Optimize for performance**: Cache transformed tools when possible
482 -5. **Add helper methods**: Provide convenient methods for common platform-specific operations
483 -6. **Provide clear documentation**: Document your provider's unique features and usage
484 -7. **Use telemetry**: Set a meaningful provider name for telemetry insights
fern/pages/src/providers/vercel.mdx deleted
-56
@@ -1,56 +0,0 @@
1 ----
2 -title: Vercel AI SDK Provider
3 -subtitle: Use Composio with Vercel AI SDK
4 -slug: /providers/vercel
5 -image: "https://og.composio.dev/api/og?title=Vercel%20AI%20SDK%20Provider" # image for socials
6 -keywords: ''
7 -hide-nav-links: false
8 ----
9 -
10 -Vercel AI SDK allows you to configure an optional async `execute` function that the framework uses to execute the tool calls.
11 -
12 -The Vercel provider for Composio formats the Composio tools and adds this `execute` function to the tool calls.
13 -
14 -## Setup
15 -
16 -Vercel AI SDK and the provider are only available for the TypeScript SDK.
17 -
18 -```typescript TypeScript maxLines=60 wordWrap
19 -npm install @composio/vercel
20 -```
21 -
22 -You can specify and import the provider in the constructor.
23 -
24 -```typescript TypeScript maxLines=60 wordWrap
25 -import { Composio } from '@composio/core';
26 -import { VercelProvider } from '@composio/vercel';
27 -import { generateText } from 'ai';
28 -import { openai } from "@ai-sdk/openai";
29 -
30 -const composio = new Composio({
31 - provider: new VercelProvider(),
32 -});
33 -```
34 -
35 -## Usage
36 -
37 -```typescript TypeScript maxLines=60 wordWrap
38 -// create an auth config for gmail
39 -// then create a connected account with an external user id that identifies the user
40 -const externalUserId = "your-external-user-id";
41 -const tools = await composio.tools.get(externalUserId, "GMAIL_SEND_EMAIL");
42 -
43 -// env: OPENAI_API_KEY
44 -const { text } = await generateText({
45 - model: openai("gpt-5"),
46 - messages: [
47 - {
48 - role: "user",
49 - content: `Send an email to soham.g@composio.dev with the subject 'Hello from composio 👋🏻' and the body 'Congratulations on sending your first email using AI Agents and Composio!'`,
50 - },
51 - ],
52 - tools,
53 -});
54 -
55 -console.log("Email sent successfully!", { text });
56 -```
fern/pages/src/resources/cli.mdx deleted
-137
@@ -1,137 +0,0 @@
1 ----
2 -title: CLI
3 -subtitle: Generate type definitions and manage authentication
4 -image: "https://og.composio.dev/api/og?title=Composio%20CLI"
5 -keywords: 'composio cli, command line, type generation, composio generate, typescript types, python types'
6 -slug: /docs/cli
7 -hide-nav-links: false
8 ----
9 -
10 -The Composio CLI helps you generate type-safe code and manage your Composio workspace.
11 -
12 -## Installation
13 -
14 -Install the Composio CLI using the installation script:
15 -
16 -```bash
17 -curl -fsSL https://composio.dev/install | bash
18 -```
19 -
20 -Or using wget:
21 -```bash
22 -wget -qO- https://composio.dev/install | bash
23 -```
24 -
25 -## Authentication
26 -
27 -Manage your Composio authentication directly from the terminal.
28 -
29 -### Login
30 -
31 -Authenticate with your Composio account:
32 -
33 -```bash
34 -composio login
35 -```
36 -
37 -This opens your browser to complete authentication and stores your API key locally.
38 -
39 -To authenticate without opening a browser (useful for SSH/remote sessions):
40 -
41 -```bash
42 -composio login --no-browser
43 -```
44 -
45 -This displays a URL to manually open in your browser.
46 -
47 -### Check authentication status
48 -
49 -Verify your current authentication:
50 -
51 -```bash
52 -composio whoami
53 -```
54 -
55 -This displays your current API key or indicates if you're not authenticated.
56 -
57 -### Logout
58 -
59 -Remove stored authentication:
60 -
61 -```bash
62 -composio logout
63 -```
64 -
65 -## Generate type definitions
66 -
67 -Generate TypeScript or Python type definitions for all Composio tools. These types provide type safety when using direct tool execution (`composio.tools.execute()`), helping you pass the correct parameters and catch errors early.
68 -
69 -### Auto-detect and generate
70 -
71 -The CLI auto-detects your project language.
72 -In your project directory:
73 -
74 -```bash
75 -composio generate
76 -```
77 -
78 -For TypeScript projects only, include individual tool types:
79 -```bash
80 -composio generate --type-tools
81 -```
82 -
83 -The CLI automatically:
84 -- Detects your project type (Python or TypeScript)
85 -- Generates appropriate type definitions
86 -
87 -### Specify output directory
88 -
89 -```bash
90 -composio generate --output-dir ./my-types
91 -```
92 -
93 -### Language-specific commands
94 -
95 -For explicit control, use language-specific commands:
96 -
97 -<Tabs>
98 - <Tab title="TypeScript">
99 - Basic generation:
100 - ```bash
101 - composio ts generate
102 - ```
103 -
104 - Generate as single file:
105 - ```bash
106 - composio ts generate --compact
107 - ```
108 -
109 - Include individual tool types:
110 - ```bash
111 - composio ts generate --type-tools
112 - ```
113 -
114 - Generate both .ts and .js files:
115 - ```bash
116 - composio ts generate --transpiled
117 - ```
118 -
119 - Custom output directory:
120 - ```bash
121 - composio ts generate --output-dir ./my-types
122 - ```
123 - </Tab>
124 - <Tab title="Python">
125 - Basic generation:
126 - ```bash
127 - composio py generate
128 - ```
129 -
130 - Custom output directory:
131 - ```bash
132 - composio py generate --output-dir ./my_types
133 - ```
134 - </Tab>
135 -</Tabs>
136 -
137 -
fern/pages/src/resources/debugging-info.mdx deleted
-51
@@ -1,51 +0,0 @@
1 ----
2 -title: Debugging Info
3 -image: "https://og.composio.dev/api/og?title=Debugging%20Info"
4 -keywords: 'debugging, troubleshooting, project id, org id'
5 -subtitle: 'Share your debugging info with Composio team for faster issue resolution'
6 -hide-nav-links: false
7 ----
8 -
9 -Your debugging info is tied to your project and it helps us trace what happened and debug the issue faster.
10 -
11 -## Finding Your Debugging Info
12 -
13 -Navigate to your project settings to find your debugging information:
14 -
15 -<Frame>
16 - <img src="../../../assets/images/debugging-info/project-settings.jpeg" alt="Project Settings Debugging Info" />
17 -</Frame>
18 -
19 -<Frame>
20 - <img src="../../../assets/images/debugging-info/debugging-info.png" alt="Debugging Info Location" />
21 -</Frame>
22 -
23 -## What to Share
24 -
25 -When reaching out for support, share these identifiers:
26 -
27 -```
28 -@project_id: pr_xxxxxxxxxxxxx
29 -@org_id: ok_xxxxxxxxxxxxx
30 -@org_member_email: your-email@example.com
31 -```
32 -
33 -The identifiers with `pr_` (project) and `ok_` (organization) prefixes let us quickly check your logs inside our internal tracing tools, helping us resolve issues faster.
34 -
35 -## Getting Help
36 -
37 -<CardGroup cols={2}>
38 - <Card title="Join Discord" icon="fa-brands fa-discord" href="https://discord.gg/composio">
39 - Get basic support from the community and Composio team
40 - </Card>
41 - <Card title="GitHub Discussions" icon="fa-brands fa-github" href="https://github.com/ComposioHQ/composio/discussions">
42 - Request new tools and share feedback
43 - </Card>
44 - <Card title="File an Issue" icon="fa-light fa-bug" href="https://github.com/ComposioHQ/composio/issues">
45 - Report SDK issues and bugs
46 - </Card>
47 - <Card title="Contact Support" icon="fa-light fa-envelope" href="mailto:support@composio.dev">
48 - Reach out for dedicated support channels on Growth and Enterprise plans
49 - </Card>
50 -</CardGroup>
51 -
fern/pages/src/resources/migration-guide.mdx deleted
-675
@@ -1,675 +0,0 @@
1 ----
2 -title: Our next generation SDKs
3 -subtitle: Learn more about Composio's next generation SDKs and how to migrate
4 -image: "https://og.composio.dev/api/og?title=Our%20next%20generation%20SDKs" # image for socials
5 -keywords: ''
6 -hide-nav-links: true
7 ----
8 -
9 -In the last few months, we have experienced very rapid growth in usage of our platform. As such, our team has been working hard to radically improve the performance and developer experience of our platform.
10 -
11 -A lot of these changes have happened in the background, but we are excited to finally share our new SDKs with you that complement our new infra.
12 -
13 -The new API features improved usability, enhanced stability, and better scalability. The SDKs built on top of it simplify the developer experience, making it easier than ever to build useful agents.
14 -
15 -## What's new?
16 -
17 -A lot of the changes are on the infra side, but from the SDK point of view, here is what you can expect:
18 -- Faster and more reliable tool execution
19 -- A simpler but more opinionated SDK
20 -- Much more intuitive and consistent naming conventions
21 -- A vastly improved TypeScript SDK that is meaningfully more type-safe and has full feature parity with the Python SDK
22 -
23 -There aren't too many new flashy features here (yet) mainly because we wanted to get the bones right — but we feel we have a solid foundation to ship incredible new experiences on top very quickly.
24 -
25 -
26 -## State of the new SDK and what is happening with the old SDKs?
27 -
28 -Currently, the new SDKs are in a preview release. These new SDKs come almost fully formed, we do not expect many breaking changes to them but are releasing them in a preview state to get feedback and make necessary changes before locking them in.
29 -
30 -As we lock the new SDKs in place, we will deprecate support for the old SDKs. They will continue to work for the foreseeable future but are no longer actively maintained. We will continue to push security updates and fix any critical bugs but will not support any new functionality in them.
31 -
32 -We urge you to upgrade to the new SDKs as soon as possible.
33 -
34 -
35 -## Nomenclature
36 -
37 -We have updated several key terms in the SDK and API to improve clarity and consistency. The following table summarizes these changes:
38 -
39 -| Previous Term | Current Term | Definition |
40 -|---------------|--------------------|--------------------------------------------------------------------------|
41 -| Actions | Tools | Individual operations or capabilities that can be performed by an LLM agent |
42 -| Apps | Toolkits | A collection of tools grouped under a single application |
43 -| Integration | Auth Config | Configuration containing developer credentials and application-level settings such as scopes and API endpoints. Scoped to a toolkit. |
44 -| Connection | Connected accounts | User-linked accounts associated with a toolkit |
45 -| Entity ID | User ID | The identifier of the user performing the action (UUID or email) |
46 -| Trigger | Trigger | An event that can be subscribed to |
47 -| Toolsets | Providers | LLM or agent framework that can be used with Composio to create agents |
48 -
49 -## Switch to nano IDs from UUIDs
50 -
51 -We have transitioned from UUIDs to nano IDs throughout the platform for the following reasons:
52 -
53 -- **Improved readability**: UUIDs are lengthy and difficult to read
54 -- **Better usability**: Easier to copy with a single double-click
55 -- **Better organization**: Nano IDs allow us to distinguish between different resource types through prefixes
56 -
57 -| Feature | Nano ID Prefix | Example |
58 -|-------------------|----------------|--------------------|
59 -| Connected Account | `ca_` | `ca_8x9w2l3k5m` |
60 -| Auth Config | `ac_` | `ac_1234567890` |
61 -| Trigger | `ti_` | `ti_So9EQf8XnAcy` |
62 -
63 -> **Note:** Nano IDs are short, unique, and prefixed to indicate the resource type.
64 -
65 -
66 -
67 -## SDK Changes
68 -
69 -Upgrade to the latest SDK version using the appropriate package manager:
70 -
71 -<CodeGroup>
72 -```python Python
73 -pip install -U composio
74 -```
75 -```typescript TypeScript
76 -npm install @composio/core
77 -```
78 -</CodeGroup>
79 -
80 -Both SDKs now implement proper namespacing for each concept.
81 -
82 -### User ID scoping
83 -
84 -The concept of `entity_id` has been expanded and renamed to `user_id`.
85 -
86 -All operations are now scoped to a user ID, including:
87 -- Fetching tools
88 -- Initiating connections
89 -- Executing tools
90 -- Managing triggers
91 -
92 -This change provides explicit specification of the user for whom the action is being performed. When a user may have multiple accounts (such as work and personal Gmail connections), you can use the more specific connected account ID.
93 -
94 -### Replacing ToolSets with [Providers](/docs/providers)
95 -
96 -We have deprecated "toolsets" in favor of "providers". This change allows Composio to provide deeper standardization for tool implementation across different frameworks.
97 -
98 -Previously, you needed to import and use a framework-specific `ComposioToolSet` class:
99 -
100 -<CodeGroup>
101 -<SnippetCode
102 - src="fern/snippets/migration/old_tools.py"
103 - startLine={1}
104 - endLine={3}
105 - title="Python (previous)"
106 -/>
107 -
108 -<SnippetCode
109 - src="fern/snippets/migration/old_tools.ts"
110 - startLine={1}
111 - endLine={3}
112 - title="TypeScript (previous)"
113 -/>
114 -</CodeGroup>
115 -
116 -The SDK structure is now framework-agnostic and includes the OpenAI provider out of the box:
117 -
118 -<CodeGroup>
119 -<SnippetCode
120 - src="fern/snippets/migration/providers.py"
121 - startLine={1}
122 - endLine={12}
123 - title="Python (current)"
124 -/>
125 -
126 -<SnippetCode
127 - src="fern/snippets/migration/providers.ts"
128 - startLine={1}
129 - endLine={12}
130 - title="TypeScript (current)"
131 -/>
132 -</CodeGroup>
133 -
134 -You can now use the same tools across any framework with our unified interface, or create custom toolsets for frameworks we don't yet support.
135 -
136 -Read more about [providers in our documentation](/docs/providers) and explore the [complete list of available providers](/providers/openai).
137 -
138 -### Fetching and filtering tools
139 -
140 -Previously, you could filter tools by:
141 -- Apps
142 -- Action names (tool names)
143 -- Tags
144 -
145 -You could also specify an `important` flag to retrieve the most important tools:
146 -
147 -<CodeGroup>
148 -<SnippetCode
149 - src="fern/snippets/migration/old_tools.py"
150 - startLine={1}
151 - endLine={11}
152 - title="Python (previous)"
153 -/>
154 -<SnippetCode
155 - src="fern/snippets/migration/old_tools.ts"
156 - startLine={1}
157 - endLine={11}
158 - title="TypeScript (previous)"
159 -/>
160 -</CodeGroup>
161 -
162 -You can now filter tools by:
163 -- Toolkits
164 -- Tool slugs
165 -- Limit parameter
166 -- Search query
167 -
168 -The `important` flag has been removed. Instead, tools are returned in order of importance by default:
169 -
170 -<Note>Since `user_id` is now explicitly required, the `check_connected_accounts` flag is no longer necessary.</Note>
171 -
172 -<CodeGroup>
173 -<SnippetCode
174 - src="fern/snippets/migration/new_tools.py"
175 - startLine={1}
176 - endLine={17}
177 - title="Python (current)"
178 -/>
179 -
180 -<SnippetCode
181 - src="fern/snippets/migration/new_tools.ts"
182 - startLine={1}
183 - endLine={25}
184 - title="TypeScript (current)"
185 -/>
186 -</CodeGroup>
187 -
188 -### Fetching raw tool data
189 -
190 -To examine the raw schema definition of a tool for understanding input/output parameters or building custom logic around tool definitions, use the following methods:
191 -
192 -<CodeGroup>
193 -<SnippetCode
194 - src="fern/snippets/tool-calling/python/raw_tools.py"
195 - startLine={1}
196 - endLine={11}
197 - title="Python (current)"
198 -/>
199 -
200 -<SnippetCode
201 - src="fern/snippets/tool-calling/typescript/raw_tools.ts"
202 - startLine={1}
203 - endLine={11}
204 - title="TypeScript (current)"
205 -/>
206 -</CodeGroup>
207 -
208 -### Executing tools
209 -
210 -Tool execution remains largely unchanged, with `user_id` now explicitly required.
211 -
212 -For agentic frameworks, the tool object returned from `tools.get` is now the respective framework's native tool object. Tool call execution is handled by the agentic framework itself.
213 -
214 -<Note>
215 -For non-agentic frameworks, Composio provides a helper function to execute tool calls.
216 -</Note>
217 -
218 -<CodeGroup>
219 -<SnippetCode
220 - src="fern/snippets/migration/new_execute_tools.py"
221 - startLine={1}
222 - endLine={17}
223 - title="Python v3"
224 - highlightStart={16}
225 - highlightEnd={16}
226 -/>
227 -
228 -<SnippetCode
229 - src="fern/snippets/migration/new_execute_tools.ts"
230 - startLine={1}
231 - endLine={30}
232 - title="TypeScript v3"
233 - highlightStart={27}
234 - highlightEnd={27}
235 -/>
236 -</CodeGroup>
237 -
238 -For more information on executing tools for different frameworks, see [Replacing ToolSets with Providers](#replacing-toolsets-with-providers).
239 -
240 -### Tool Modifiers (formerly Tool Processors)
241 -
242 -Tool processors have been renamed to *tool modifiers* and now provide an improved developer experience. The implementation is now available in TypeScript too! (previously Python-only).
243 -
244 -<SnippetCode
245 - src="fern/snippets/migration/old_tool_modifiers.py"
246 - startLine={1}
247 - endLine={23}
248 - title="Python (previous)"
249 -/>
250 -
251 -| Previous | Current |
252 -|-------------------|-------------------------|
253 -| `pre` processor | `beforeExecute` modifier |
254 -| `post` processor | `afterExecute` modifier |
255 -| `schema` processor| `schema` modifier |
256 -
257 -The modifiers now leverage language-specific features to provide a more natural developer experience.
258 -
259 -While tool processors could previously be applied during SDK initialization, tool fetching, and tool execution, we have restructured them as follows:
260 -- **Chat Completion providers**: Modifiers are specified and applied during tool execution
261 -- **Agentic frameworks**: Modifiers are specified and applied during tool fetching
262 -
263 -#### [Schema Modifiers](/docs/modifying-tool-schemas)
264 -
265 -The following example demonstrates schema modifier usage, applicable across all providers:
266 -
267 -<CodeGroup>
268 -```python Python (current)
269 -from composio import Composio, schema_modifier
270 -from composio.types import Tool
271 -
272 -user_id = "your@email.com"
273 -
274 -@schema_modifier(tools=["HACKERNEWS_GET_LATEST_POSTS"])
275 -def modify_schema(
276 - tool: str,
277 - toolkit: str,
278 - schema: Tool,
279 -) -> Tool:
280 - _ = schema.input_parameters["properties"].pop("page", None)
281 - schema.input_parameters["required"] = ["size"]
282 - return schema
283 -
284 -tools = composio.tools.get(
285 - user_id=user_id,
286 - tools=["HACKERNEWS_GET_LATEST_POSTS", "HACKERNEWS_GET_USER"],
287 - modifiers=[
288 - modify_schema,
289 - ]
290 -)
291 -```
292 -<SnippetCode
293 - src="fern/snippets/migration/tool_modifiers.ts"
294 - startLine={1}
295 - endLine={26}
296 - title="TypeScript (current)"
297 -/>
298 -</CodeGroup>
299 -
300 -#### [Before Modifiers](/docs/modifying-tool-inputs)
301 -
302 -The following example shows creating and using a before modifier for a Chat Completion provider. For agentic frameworks, view the [complete before modifier documentation](/docs/modifying-tool-inputs):
303 -
304 -<CodeGroup>
305 -```python Python (current)
306 -@before_execute(tools=["HACKERNEWS_GET_LATEST_POSTS"])
307 -def before_execute_modifier(
308 - tool: str,
309 - toolkit: str,
310 - params: ToolExecuteParams,
311 -) -> ToolExecuteParams:
312 - params["arguments"]["size"] = 1
313 - return params
314 -
315 -
316 -# Get tools
317 -tools = composio.tools.get(user_id=user_id, slug="HACKERNEWS_GET_LATEST_POSTS")
318 -```
319 -<SnippetCode
320 - src="fern/snippets/migration/tool_modifiers.ts"
321 - startLine={53}
322 - endLine={68}
323 - title="TypeScript (current)"
324 -/>
325 -</CodeGroup>
326 -
327 -#### [After Modifiers](/docs/modifying-tool-outputs)
328 -
329 -The following example shows creating and using an after modifier for a Chat Completion provider. For agentic frameworks, view the [complete after modifier documentation](/docs/modifying-tool-outputs):
330 -
331 -<CodeGroup>
332 -
333 -```python Python (current)
334 -@after_execute(tools=["HACKERNEWS_GET_USER"])
335 -def after_execute_modifier(
336 - tool: str,
337 - toolkit: str,
338 - response: ToolExecutionResponse,
339 -) -> ToolExecutionResponse:
340 - return {
341 - **response,
342 - "data": {
343 - "karma": response["data"]["karma"],
344 - },
345 - }
346 -
347 -tools = composio.tools.get(user_id=user_id, slug="HACKERNEWS_GET_USER")
348 -```
349 -<SnippetCode
350 - src="fern/snippets/migration/tool_modifiers.ts"
351 - startLine={69}
352 - endLine={90}
353 - title="TypeScript (current)"
354 -/>
355 -</CodeGroup>
356 -
357 -### Custom Tools
358 -
359 -The SDK continues to support custom tools. [Creating tools from your methods](/docs/custom-tools#creating-a-custom-tool) remains possible. We recommend reviewing the [detailed custom tools documentation](/docs/custom-tools#creating-a-custom-tool) for more information.
360 -
361 -Due to changes in the SDK architecture, creating custom tools that use Composio's managed authentication has been modified. In the previous SDK, you could create a custom tool as follows:
362 -
363 -<CodeGroup>
364 -<SnippetCode
365 - src="fern/snippets/migration/old_custom_tools.py"
366 - startLine={1}
367 - endLine={39}
368 - highlightStart={14}
369 - highlightEnd={17}
370 - title="Python (previous)"
371 -/>
372 -
373 -<SnippetCode
374 - src="fern/snippets/migration/old_custom_tools.ts"
375 - startLine={1}
376 - endLine={39}
377 - highlightStart={16}
378 - highlightEnd={20}
379 - title="TypeScript (previous)"
380 -/>
381 -</CodeGroup>
382 -
383 -The *execute tool request* method handles injection of the appropriate base URL and authentication credentials for the tool:
384 -
385 -<CodeGroup>
386 -<SnippetCode
387 - src="fern/snippets/migration/new_custom_tools.py"
388 - startLine={1}
389 - endLine={39}
390 - highlightStart={22}
391 - highlightEnd={22}
392 - title="Python (current)"
393 -/>
394 -
395 -<SnippetCode
396 - src="fern/snippets/migration/new_custom_tools.ts"
397 - startLine={1}
398 - endLine={39}
399 - highlightStart={17}
400 - highlightEnd={17}
401 - title="TypeScript (current)"
402 -/>
403 -</CodeGroup>
404 -
405 -For more information, including executing custom tools and defining custom headers and query parameters, refer to the [Custom Tools](/docs/custom-tools) documentation.
406 -
407 -### Auth configs (formerly integrations)
408 -
409 -Integrations are now called *auth configs*. While the terminology has changed, the underlying concept remains the same.
410 -
411 -Auth configs store the configuration required for authentication with a given toolkit, including OAuth developer credentials, configurable base URLs, and scopes.
412 -
413 -Auth configs now use nano IDs instead of UUIDs:
414 -
415 -| Previous (UUID) Example | Current (Nano ID) Example |
416 -| :----------------------------------- | :------------------------ |
417 -| `b7a9c1e2-3f4d-4a6b-8c2e-1d2f3a4b5c6d` | `ac_8x9w2l3k5m` |
418 -
419 -We recommend storing auth config nano IDs in your database for connecting users to the appropriate auth configuration.
420 -
421 -For most use cases, you will create auth configs through the dashboard, and this process remains unchanged. Read more about [creating auth configs](/docs/authenticating-tools#creating-an-auth-config) and [customizing auth configs](/docs/custom-auth-configs).
422 -
423 -Creating auth configs programmatically in the previous SDK:
424 -
425 -<CodeGroup>
426 -<SnippetCode
427 - src="fern/snippets/migration/old_auth_config.py"
428 - startLine={1}
429 - endLine={15}
430 - title="Python (previous)"
431 -/>
432 -<SnippetCode
433 - src="fern/snippets/migration/old_auth_config.ts"
434 - startLine={1}
435 - endLine={15}
436 - title="TypeScript (previous)"
437 -/>
438 -</CodeGroup>
439 -
440 -Creating auth configs programmatically in the current SDK:
441 -
442 -<CodeGroup>
443 -<SnippetCode
444 - src="fern/snippets/migration/new_auth_config.py"
445 - startLine={1}
446 - endLine={15}
447 - title="Python (current)"
448 -/>
449 -<SnippetCode
450 - src="fern/snippets/migration/new_auth_config.ts"
451 - startLine={1}
452 - endLine={15}
453 - title="TypeScript (current)"
454 -/>
455 -</CodeGroup>
456 -
457 -For using custom authentication credentials, refer to the [Programmatic Auth Configs](/docs/programmatic-auth-configs) documentation.
458 -
459 -<Note>The callback URL for creating custom OAuth configs is now `https://backend.composio.dev/api/v3/toolkits/auth/callback`. The previous URL was `https://backend.composio.dev/api/v1/auth-apps/add`.</Note>
460 -
461 -### Connected accounts / User IDs
462 -
463 -The primary change in connected accounts and user IDs is that user IDs are now a more prominent concept compared to entities in previous versions.
464 -
465 -We have simplified the process of connecting a user to a toolkit. Instead of multiple methods and parameters for initiating a connection, both the SDK and API now require only a `user_id` and `auth_config_id` to initiate a connection.
466 -
467 -This approach is more explicit and works well with the ability for developers to have multiple auth configs for a given toolkit.
468 -
469 -Connected accounts now use nano IDs instead of UUIDs:
470 -
471 -| Previous (UUID) Example | Current (Nano ID) Example |
472 -| :----------------------------------- | :------------------------ |
473 -| `b7a9c1e2-3f4d-4a6b-8c2e-1d2f3a4b5c6d` | `ca_8x9w2l3k5m` |
474 -
475 -Previously, you might have initiated a connection like this:
476 -
477 -<CodeGroup>
478 -<SnippetCode
479 - src="fern/snippets/migration/old_connected_acc.py"
480 - startLine={1}
481 - endLine={30}
482 - highlightStart={11}
483 - highlightEnd={16}
484 - title="Python (previous)"
485 -/>
486 -<SnippetCode
487 - src="fern/snippets/migration/old_connected_acc.ts"
488 - startLine={1}
489 - endLine={30}
490 - highlightStart={8}
491 - highlightEnd={13}
492 - title="TypeScript (previous)"
493 -/>
494 -</CodeGroup>
495 -
496 -The current process for initiating a connection is as follows:
497 -
498 -<CodeGroup>
499 -<SnippetCode
500 - src="fern/snippets/migration/new_connected_acc.py"
501 - startLine={1}
502 - endLine={15}
503 - highlightStart={8}
504 - highlightEnd={11}
505 - title="Python (current)"
506 -/>
507 -<SnippetCode
508 - src="fern/snippets/migration/new_connected_acc.ts"
509 - startLine={1}
510 - endLine={15}
511 - highlightStart={8}
512 - highlightEnd={11}
513 - title="TypeScript (current)"
514 -/>
515 -</CodeGroup>
516 -
517 -### Triggers
518 -
519 -Composio continues to support listening to application events using triggers through WebSockets and webhooks.
520 -
521 -#### Creating triggers
522 -
523 -The process for creating triggers and specifying their configuration has been redesigned for improved clarity and intuitiveness.
524 -
525 -Some triggers require configuration, such as repository names for GitHub triggers or channel names for Slack triggers. The process usually follows the pattern of fetching the trigger type and then creating the trigger with the appropriate configuration.
526 -
527 -<CodeGroup>
528 -<SnippetCode
529 - src="fern/snippets/migration/new_triggers.py"
530 - startLine={1}
531 - endLine={33}
532 - title="Python (current)"
533 -/>
534 -<SnippetCode
535 - src="fern/snippets/migration/new_triggers.ts"
536 - startLine={1}
537 - endLine={35}
538 - title="TypeScript (current)"
539 -/>
540 -</CodeGroup>
541 -
542 -#### Enabling/Disabling triggers
543 -
544 -You can enable or disable triggers through either the SDK or the dashboard. The dashboard process remains unchanged.
545 -
546 -Managing triggers with the SDK:
547 -
548 -<CodeGroup>
549 - ```python Python maxLines=60 wordWrap
550 - # Disable a trigger instance
551 - disabled_instance = composio.triggers.disable(trigger_id="ti_abcd123")
552 - print(disabled_instance)
553 - ```
554 - ```typescript TypeScript maxLines=60 wordWrap
555 - await composio.triggers.disable("ti_abcd123");
556 - ```
557 -</CodeGroup>
558 -
559 -If needed, the trigger can be enabled again.
560 -
561 -<CodeGroup>
562 - ```python Python maxLines=60 wordWrap
563 - # Enable a trigger instance
564 - enabled_instance = composio.triggers.enable(trigger_id="ti_abcd123")
565 - print(enabled_instance)
566 - ```
567 - ```typescript TypeScript maxLines=60 wordWrap
568 - await composio.triggers.enable("ti_abcd123");
569 - ```
570 -</CodeGroup>
571 -
572 -#### Listening to triggers
573 -
574 -We recommend listening to triggers through webhooks. The following are example routes for Next.js and FastAPI.
575 -
576 -For development, you can also [listen to triggers through the SDK](/docs/using-triggers#subscribing-to-triggers-using-the-sdk-for-development).
577 -
578 -<CodeGroup>
579 -<SnippetCode
580 - src="fern/snippets/triggers/python/trigger-webhook.py"
581 - title="app/route.py (FastAPI)"
582 -/>
583 -<SnippetCode
584 - src="fern/snippets/triggers/typescript/trigger-webhook.ts"
585 - title="app/api/webhook/route.ts (Next.js)"
586 -/>
587 -</CodeGroup>
588 -
589 -## 🚧 Coming Soon
590 -
591 -### Local tools
592 -
593 -Previously, the Python SDK included *[local tools](https://github.com/ComposioHQ/composio/tree/master/python/composio/tools/local)*. These were tools defined within the SDK and consisted of local shell and code-related tools such as "clipboard", "sqltool", and "shelltool".
594 -
595 -This feature is currently in development for both Python and TypeScript SDKs, with newly created tools built for improved agent accuracy.
596 -
597 -{/* ### Generated types
598 -
599 -In the previous Python SDK, you could generate types for tools using the CLI:
600 -
601 -```bash
602 -composio apps generate-types
603 -```
604 -
605 -This provided app slugs and tool slugs with IntelliSense support:
606 -
607 -```python Python (previous)
608 -from composio_openai import ComposioToolSet, App, Action
609 -
610 -print(App.GITHUB)
611 -print(Action.GITHUB_CREATE_ISSUE)
612 -``` */}
613 -
614 -This feature is currently in development for both Python and TypeScript SDKs.
615 -
616 -## API Endpoints
617 -
618 -The following table lists important API endpoints that have changed. You can use this reference to quickly find the new v3 API endpoint for migration:
619 -
620 -<Note>This list is not exhaustive. Please refer to the [API Reference](/api-reference) for the complete list of endpoints.</Note>
621 -
622 -### Toolkits (formerly Apps)
623 -
624 -| Previous Endpoint | Current Endpoint |
625 -| :--- | :--- |
626 -| [`GET /api/v1/apps`](https://docs.composio.dev/api-reference/api-reference/apps/get-apps) | [`GET /api/v3/toolkits`](https://docs.composio.dev/api-reference/toolkits/get-toolkits) |
627 -| [`GET /api/v1/apps/list/categories`](https://docs.composio.dev/api-reference/api-reference/apps/list-app-categories) | [`GET /api/v3/toolkits/categories`](https://docs.composio.dev/api-reference/toolkits/get-toolkits-categories) |
628 -| [`GET /api/v1/apps/{appName}`](https://docs.composio.dev/api-reference/api-reference/apps/get-app) | [`GET /api/v3/toolkits/{slug}`](https://docs.composio.dev/api-reference/toolkits/get-toolkits-by-slug) |
629 -
630 -### Tools (formerly Actions)
631 -
632 -| Previous Endpoint | Current Endpoint |
633 -| :--- | :--- |
634 -| [`GET /api/v2/actions`](https://docs.composio.dev/api-reference/api-reference/actions/list-actions-minimal-v-2) | [`GET /api/v3/tools`](https://docs.composio.dev/api-reference/tools/get-tools) |
635 -| [`GET /api/v2/actions/list/enums`](https://docs.composio.dev/api-reference/api-reference/actions/list-action-enums) | [`GET /api/v3/tools/enum`](https://docs.composio.dev/api-reference/tools/get-tools-enum) |
636 -| [`GET /api/v2/actions/{actionId}`](https://docs.composio.dev/api-reference/api-reference/actions/get-action-v-2) | [`GET /api/v3/tools/{tool_slug}`](https://docs.composio.dev/api-reference/tools/get-tools-by-tool-slug) |
637 -| [`POST /api/v2/actions/{actionId}/execute`](https://docs.composio.dev/api-reference/api-reference/actions/execute-action-v-2) | [`POST /api/v3/tools/execute/{tool_slug}`](https://docs.composio.dev/api-reference/tools/post-tools-execute-by-tool-slug)|
638 -| [`POST /api/v2/actions/{actionId}/execute/get.inputs`](https://docs.composio.dev/api-reference/api-reference/actions/get-action-inputs-v-2)| [`POST /api/v3/tools/execute/{tool_slug}/input`](https://docs.composio.dev/api-reference/tools/post-tools-execute-by-tool-slug-input)|
639 -| [`POST /api/v2/actions/proxy`](https://docs.composio.dev/api-reference/api-reference/actions/execute-action-proxy-v-2) | [`POST /api/v3/tools/execute/proxy`](https://docs.composio.dev/api-reference/tools/post-tools-execute-proxy)|
640 -
641 -### Auth Configs (formerly Integrations/Connectors)
642 -
643 -| Previous Endpoint | Current Endpoint |
644 -| :--- | :--- |
645 -| [`GET /api/v1/integrations`](https://docs.composio.dev/api-reference/api-reference/integrations/list-all-connectors) | [`GET /api/v3/auth_configs`](https://docs.composio.dev/api-reference/auth-configs/get-auth-configs) |
646 -| [`POST /api/v1/integrations`](https://docs.composio.dev/api-reference/api-reference/integrations/create-connector) | [`POST /api/v3/auth_configs`](https://docs.composio.dev/api-reference/auth-configs/post-auth-configs) |
647 -| [`GET /api/v1/integrations/{integrationId}`](https://docs.composio.dev/api-reference/api-reference/integrations/get-connector-info) | [`GET /api/v3/auth_configs/{nanoid}`](https://docs.composio.dev/api-reference/auth-configs/get-auth-configs-by-nanoid) |
648 -| [`PATCH /api/v1/integrations/{integrationId}`](https://docs.composio.dev/api-reference/api-reference/integrations/modify-connector) | [`PATCH /api/v3/auth_configs/{nanoid}`](https://docs.composio.dev/api-reference/auth-configs/patch-auth-configs-by-nanoid) |
649 -| [`DELETE /api/v1/integrations/{integrationId}`](https://docs.composio.dev/api-reference/api-reference/integrations/delete-connector) | [`DELETE /api/v3/auth_configs/{nanoid}`](https://docs.composio.dev/api-reference/auth-configs/delete-auth-configs-by-nanoid) |
650 -| [`POST /api/v2/integrations/create`](https://docs.composio.dev/api-reference/api-reference/integrations-v-2/create-connector-v-2) | [`POST /api/v3/auth_configs`](https://docs.composio.dev/api-reference/auth-configs/post-auth-configs) |
651 -
652 -### Connected Accounts (formerly Connections)
653 -
654 -| Previous Endpoint | Current Endpoint |
655 -| :--- | :--- |
656 -| [`GET /api/v1/connectedAccounts`](https://docs.composio.dev/api-reference/api-reference/connections/get-connections) | [`GET /api/v3/connected_accounts`](https://docs.composio.dev/api-reference/connected-accounts/get-connected-accounts) |
657 -| [`POST /api/v1/connectedAccounts`](https://docs.composio.dev/api-reference/api-reference/connections/initiate-connection) | [`POST /api/v3/connected_accounts`](https://docs.composio.dev/api-reference/connected-accounts/post-connected-accounts) |
658 -| [`POST /api/v2/connectedAccounts/initiateConnection`](https://docs.composio.dev/api-reference/api-reference/connectionsv-2/initiate-connection-v-2)| [`POST /api/v3/connected_accounts`](https://docs.composio.dev/api-reference/connected-accounts/post-connected-accounts) |
659 -| [`GET /api/v1/connectedAccounts/{connectedAccountId}`](https://docs.composio.dev/api-reference/api-reference/connections/get-connection)| [`GET /api/v3/connected_accounts/{nanoid}`](https://docs.composio.dev/api-reference/connected-accounts/get-connected-accounts-by-nanoid)|
660 -| [`DELETE /api/v1/connectedAccounts/{connectedAccountId}`](https://docs.composio.dev/api-reference/api-reference/connections/delete-connection)| [`DELETE /api/v3/connected_accounts/{nanoid}`](https://docs.composio.dev/api-reference/connected-accounts/delete-connected-accounts-by-nanoid) |
661 -| [`POST /api/v1/connectedAccounts/{connectedAccountId}/disable`](https://docs.composio.dev/api-reference/api-reference/connections/disable-connection)| [`PATCH /api/v3/connected_accounts/{nanoId}/status`](https://docs.composio.dev/api-reference/connected-accounts/patch-connected-accounts-by-nano-id-status)|
662 -| [`POST /api/v1/connectedAccounts/{connectedAccountId}/enable`](https://docs.composio.dev/api-reference/api-reference/connections/enable-connection) | [`PATCH /api/v3/connected_accounts/{nanoId}/status`](https://docs.composio.dev/api-reference/connected-accounts/patch-connected-accounts-by-nano-id-status)|
663 -| [`POST /api/v1/connectedAccounts/{connectedAccountId}/reinitiate`](https://docs.composio.dev/api-reference/api-reference/connections/reinitiate-connection)| [`POST /api/v3/connected_accounts/{nanoid}/refresh`](https://docs.composio.dev/api-reference/connected-accounts/post-connected-accounts-by-nanoid-refresh)|
664 -
665 -### Triggers
666 -
667 -| Previous Endpoint | Current Endpoint |
668 -| :--- | :--- |
669 -| [`GET /api/v1/triggers`](https://docs.composio.dev/api-reference/api-reference/triggers/list-triggers) | [`GET /api/v3/triggers_types`](https://docs.composio.dev/api-reference/triggers/get-triggers-types) |
670 -| [`GET /api/v1/triggers/list/enums`](https://docs.composio.dev/api-reference/api-reference/triggers/list-trigger-enums) | [`GET /api/v3/triggers_types/list/enum`](https://docs.composio.dev/api-reference/triggers/get-triggers-types-list-enum)|
671 -| [`GET /api/v2/triggers/{triggerName}`](https://docs.composio.dev/api-reference/api-reference/triggers/get-trigger-info-v-2) | [`GET /api/v3/triggers_types/{slug}`](https://docs.composio.dev/api-reference/triggers/get-triggers-types-by-slug)|
672 -| [`GET /api/v1/triggers/active_triggers`](https://docs.composio.dev/api-reference/api-reference/triggers/get-active-triggers)| [`GET /api/v3/trigger_instances/active`](https://docs.composio.dev/api-reference/triggers/get-trigger-instances-active)|
673 -| [`POST /api/v1/triggers/enable/{connectedAccountId}/{triggerName}`](https://docs.composio.dev/api-reference/api-reference/triggers/enable-trigger)| [`POST /api/v3/trigger_instances/{slug}/upsert`](https://docs.composio.dev/api-reference/triggers/post-trigger-instances-by-slug-upsert)|
674 -| [`DELETE /api/v1/triggers/instance/{triggerInstanceId}`](https://docs.composio.dev/api-reference/api-reference/triggers/delete-trigger)| [`DELETE /api/v3/trigger_instances/manage/{triggerId}`](https://docs.composio.dev/api-reference/triggers/delete-trigger-instances-manage-by-trigger-id)|
675 -| [`PATCH /api/v1/triggers/instance/{triggerId}/status`](https://docs.composio.dev/api-reference/api-reference/triggers/switch-trigger-instance-status)| [`PATCH /api/v3/trigger_instances/manage/{triggerId}`](https://docs.composio.dev/api-reference/triggers/patch-trigger-instances-manage-by-trigger-id)|
fern/pages/src/resources/troubleshooting/api.mdx deleted
-21
@@ -1,21 +0,0 @@
1 ----
2 -title: API
3 -subtitle: Troubleshooting API issues
4 -image: "https://og.composio.dev/api/og?title=API%20Troubleshooting"
5 -keywords: 'api, rest, troubleshooting, curl, debugging'
6 -hide-nav-links: true
7 ----
8 -
9 -## Reporting API issues
10 -
11 -When reporting API issues to support, provide the following:
12 -
13 -- **cURL command**: Include the exact cURL to reproduce the issue
14 -- **Request ID**: Add `x-request-id: <uuid>` header to your request and share the UUID (generate at [uuidgenerator.net](https://www.uuidgenerator.net/))
15 -- **Error details**: Share the complete error message
16 -- **Reproduction steps**: Include any steps needed to reproduce the issue
17 -
18 -## Getting help
19 -
20 -- **Email**: support@composio.dev
21 -- **Discord**: [#support-form](https://discord.com/channels/1170785031560646836/1268871288156323901)
\ No newline at end of file
fern/pages/src/resources/troubleshooting/authentication.mdx deleted
-46
@@ -1,46 +0,0 @@
1 ----
2 -title: Authentication
3 -subtitle: Troubleshooting authentication issues
4 -image: "https://og.composio.dev/api/og?title=Authentication%20Troubleshooting"
5 -keywords: 'authentication, oauth, connections, scopes, troubleshooting, redacted, mask secrets, mask connected account secrets'
6 -hide-nav-links: true
7 ----
8 -
9 -## Using Composio's default OAuth app
10 -
11 -When using our default OAuth configuration:
12 -
13 -- **Don't add additional scopes** - They may not be approved in our OAuth app
14 -- Use only the pre-configured scopes provided
15 -
16 -## Using custom OAuth apps
17 -
18 -Ensure your OAuth app is configured correctly:
19 -
20 -- **Redirect URL**: Must match exactly what's configured in your OAuth provider
21 -- **Scopes**: Auth config scopes must match your OAuth app configuration
22 -- **Credentials**: Verify client ID and secret are correct
23 -
24 -For setup guides by toolkit: [OAuth Configuration Guides](https://composio.dev/oauth)
25 -
26 -## Common authentication issues
27 -
28 -- **Invalid redirect URI**: Check the callback URL matches exactly
29 -- **Scope mismatch**: Ensure requested scopes are configured in both auth config and OAuth app
30 -- **Expired tokens**: Try refreshing the connection
31 -- **Rate limits**: Some providers limit authentication attempts
32 -- **Credentials showing as `REDACTED`**: The "Mask Connected Account Secrets" setting is enabled on your account, which redacts all sensitive credential data. Navigate to **Settings → Project Settings → Project Configuration** and disable "Mask Connected Account Secrets" to view actual values
33 -
34 -## Reporting authentication issues
35 -
36 -When reporting to support, provide:
37 -
38 -- **Error message**: Complete error details and screenshots
39 -- **Auth config ID**: The `authConfigId` being used
40 -- **Connected account ID**: If a connection was already created
41 -- **OAuth provider**: Which service you're trying to connect
42 -
43 -## Getting help
44 -
45 -- **Email**: support@composio.dev
46 -- **Discord**: [#support-form](https://discord.com/channels/1170785031560646836/1268871288156323901)
\ No newline at end of file
fern/pages/src/resources/troubleshooting/cli.mdx deleted
-94
@@ -1,94 +0,0 @@
1 ----
2 -title: CLI
3 -subtitle: Troubleshooting CLI issues
4 -image: "https://og.composio.dev/api/og?title=CLI%20Troubleshooting"
5 -keywords: 'cli, command line, troubleshooting, installation, authentication'
6 -hide-nav-links: true
7 ----
8 -
9 -## Command not found
10 -
11 -Verify the CLI is installed and in your PATH:
12 -
13 -```bash
14 -which composio
15 -```
16 -
17 -If not found, reinstall:
18 -
19 -```bash
20 -curl -fsSL https://composio.dev/install | bash
21 -```
22 -
23 -Or add to PATH:
24 -
25 -```bash
26 -echo 'export PATH="$HOME/.composio:$PATH"' >> ~/.bashrc && source ~/.bashrc
27 -```
28 -
29 -## Authentication errors
30 -
31 -Check current authentication:
32 -
33 -```bash
34 -composio whoami
35 -```
36 -
37 -Re-authenticate if needed:
38 -
39 -```bash
40 -composio logout
41 -composio login
42 -```
43 -
44 -For CI/CD, use environment variable:
45 -
46 -```bash
47 -export COMPOSIO_API_KEY="your-api-key"
48 -```
49 -
50 -## Type generation issues
51 -
52 -### Project type not detected
53 -
54 -Use language-specific commands:
55 -
56 -```bash
57 -composio ts generate # TypeScript
58 -composio py generate # Python
59 -```
60 -
61 -### Output directory missing
62 -
63 -Specify output directory explicitly:
64 -
65 -```bash
66 -composio generate --output-dir ./my-types
67 -```
68 -
69 -## Debug CLI issues
70 -
71 -Enable debug logging:
72 -
73 -```bash
74 -composio --log-level debug [command]
75 -```
76 -
77 -Check version compatibility:
78 -
79 -```bash
80 -composio version
81 -```
82 -
83 -## Common issues
84 -
85 -- **API key not found**: Run `composio login`
86 -- **Project type detection fails**: Use language-specific commands or ensure you're in project root
87 -- **Network timeout**: Check internet connection and proxy settings
88 -- **Permission denied**: Check directory write permissions
89 -
90 -## Getting help
91 -
92 -- **Email**: support@composio.dev
93 -- **Discord**: [#support-form](https://discord.com/channels/1170785031560646836/1268871288156323901)
94 -- **GitHub**: [Create an issue](https://github.com/ComposioHQ/composio/issues/new?labels=bug)
\ No newline at end of file
fern/pages/src/resources/troubleshooting/dashboard.mdx deleted
-23
@@ -1,23 +0,0 @@
1 ----
2 -title: Dashboard
3 -subtitle: Troubleshooting dashboard issues
4 -image: "https://og.composio.dev/api/og?title=Dashboard%20Troubleshooting"
5 -keywords: 'dashboard, platform, UI, troubleshooting, debugging'
6 -hide-nav-links: true
7 ----
8 -
9 -## Reporting dashboard issues
10 -
11 -When reporting dashboard issues to support, provide:
12 -
13 -- **Screenshot or recording**: Visual evidence of the issue
14 -- **Error details**: Complete error message shown in the UI
15 -- **Network logs**: Check browser DevTools for failing API calls and share:
16 - - Error message
17 - - Request ID (`x-request-id` header)
18 - - Failed endpoint URL
19 -
20 -## Getting help
21 -
22 -- **Email**: support@composio.dev
23 -- **Discord**: [#support-form](https://discord.com/channels/1170785031560646836/1268871288156323901)
\ No newline at end of file
fern/pages/src/resources/troubleshooting/mcp.mdx deleted
-51
@@ -1,51 +0,0 @@
1 ----
2 -title: MCP
3 -subtitle: Troubleshooting MCP server issues
4 -image: "https://og.composio.dev/api/og?title=MCP%20Troubleshooting"
5 -keywords: 'mcp, model context protocol, server, troubleshooting, debugging'
6 -hide-nav-links: true
7 ----
8 -
9 -## Connected account not found error
10 -
11 -This error occurs when MCP cannot find a valid connected account for authentication:
12 -
13 -- **Specify an account**: Provide either `connected_account_id` or `user_id` in your MCP configuration
14 -- **Default behavior**: Without specification, MCP uses `user_id=default`. If multiple connections exist with the same user_id, the most recent is used
15 -- **Verification checklist**:
16 - - Account status is `ACTIVE` (not deleted)
17 - - Account belongs to the same auth config used to create the MCP server
18 -
19 -Learn more: [MCP Developer Guide](/docs/mcp-developers#client-applications-connect-to-the-server)
20 -
21 -## Getting 404 errors
22 -
23 -Verify your URL format matches one of these patterns:
24 -
25 -- `https://mcp.composio.dev/composio/server/<UUID>/mcp`
26 -- `https://apollo-<randomID>-composio.vercel.app/v3/mcp/<UUID>`
27 -- `https://apollo.composio.dev/v3/mcp/<UUID>`
28 -
29 -## Testing and debugging
30 -
31 -If experiencing issues, test your MCP server with:
32 -
33 -- [Postman MCP Requests](https://learning.postman.com/docs/postman-ai-developer-tools/mcp-requests/create/)
34 -- [MCP Inspector](https://modelcontextprotocol.io/docs/tools/inspector)
35 -
36 -This helps identify whether the issue is with your MCP client or the server.
37 -
38 -## Reporting MCP issues
39 -
40 -When reporting to support, provide:
41 -
42 -- **Error message**: Complete error details
43 -- **MCP server URL**: The exact URL you're connecting to
44 -- **Testing results**: Whether issue reproduces in MCP Inspector/Postman or only in specific client
45 -- **Connected account ID**: If facing connection issues
46 -- **Reproduction steps**: Clear steps to reproduce the issue
47 -
48 -## Getting help
49 -
50 -- **Email**: support@composio.dev
51 -- **Discord**: [#support-form](https://discord.com/channels/1170785031560646836/1268871288156323901)
\ No newline at end of file
fern/pages/src/resources/troubleshooting/overview.mdx deleted
-58
@@ -1,58 +0,0 @@
1 ----
2 -title: Troubleshooting
3 -subtitle: Common issues and quick links
4 -image: "https://og.composio.dev/api/og?title=Troubleshooting"
5 -keywords: 'troubleshooting, errors, issues, debugging, problems'
6 -hide-nav-links: true
7 ----
8 -
9 -This section is designed to help you quickly identify and resolve common issues encountered with the Composio.
10 -
11 -Some quick links:
12 -<Card
13 - title="Report issues"
14 - icon="fa-light fa-bug"
15 - href="https://github.com/ComposioHQ/composio/issues/new?labels=bug"
16 ->
17 - Found a bug? Please create a Github issue!
18 -</Card>
19 -
20 -<Card
21 - title="Ask AI"
22 - icon="fa-light fa-brain"
23 - href="https://deepwiki.com/ComposioHQ/composio"
24 ->
25 - Try to use Ask AI in the docs or deepwiki to get the fastes responses on features, types, and best practices.
26 -</Card>
27 -
28 -<Card
29 - title="Feature requests"
30 - icon="fa-light fa-sparkles"
31 - href="https://github.com/ComposioHQ/composio/issues/new?labels=enhancement"
32 ->
33 - Have an idea for improving Composio? Share your feature suggestions with us and we will prioritise your requests
34 -</Card>
35 -
36 -<Card
37 - title="Ask the community"
38 - icon="fa-light fa-comments"
39 - href="https://github.com/ComposioHQ/composio/discussions"
40 ->
41 - Join our GitHub discussions to get help from the community
42 -</Card>
43 -
44 -<Card
45 - title="Discord community"
46 - icon="fa-brands fa-discord"
47 - href="https://discord.com/channels/1170785031560646836/1268871288156323901"
48 ->
49 - Post support queries on our discord channel or reachout to support@composio.dev
50 -</Card>
51 -
52 -<Card
53 - title="Migration guides"
54 - icon="fa-light fa-book"
55 - href="/docs/migration"
56 ->
57 - Check out our migration guides to help you upgrade to the latest version.
58 -</Card>
\ No newline at end of file
fern/pages/src/resources/troubleshooting/sdks.mdx deleted
-50
@@ -1,50 +0,0 @@
1 ----
2 -title: SDKs
3 -subtitle: Troubleshooting SDK issues
4 -image: "https://og.composio.dev/api/og?title=SDK%20Troubleshooting"
5 -keywords: 'sdk, python, typescript, troubleshooting, debugging'
6 -hide-nav-links: true
7 ----
8 -
9 -## Debug network issues
10 -
11 -Enable debug logging to see API calls and identify if issues are SDK or API related. Look for the `x-request-id` in logs to share with support.
12 -
13 -<CodeGroup>
14 -```python Python
15 -# Set environment variable
16 -COMPOSIO_LOGGING_LEVEL=debug
17 -```
18 -```typescript TypeScript
19 -// Set environment variable
20 -COMPOSIO_LOG_LEVEL=debug
21 -```
22 -</CodeGroup>
23 -
24 -## Check SDK version
25 -
26 -Ensure you're using the latest version:
27 -
28 -<CodeGroup>
29 -```bash Python
30 -pip install --upgrade composio
31 -```
32 -```bash TypeScript
33 -npm install @composio/core@latest
34 -```
35 -</CodeGroup>
36 -
37 -Check current version:
38 -- Python: [PyPI](https://pypi.org/project/composio/)
39 -- TypeScript: [npm](https://www.npmjs.com/package/@composio/core)
40 -
41 -## Common issues
42 -
43 -- **Type errors or parameter confusion**: Search [DeepWiki](https://deepwiki.com/ComposioHQ/composio) or use the Ask AI assistant
44 -- **Tool-specific issues**: Check the [specific tool's documentation](/toolkits/introduction)
45 -- **Bug reporting**: Create a [GitHub issue](https://github.com/ComposioHQ/composio/issues/new?labels=bug) with debug logs and reproduction steps
46 -
47 -## Getting help
48 -
49 -- **Email**: support@composio.dev
50 -- **Discord**: [#support-form](https://discord.com/channels/1170785031560646836/1268871288156323901)
\ No newline at end of file
fern/pages/src/resources/troubleshooting/tools.mdx deleted
-55
@@ -1,55 +0,0 @@
1 ----
2 -title: Tools & Toolkits
3 -subtitle: Troubleshooting tool execution issues
4 -image: "https://og.composio.dev/api/og?title=Tools%20Troubleshooting"
5 -keywords: 'tools, toolkits, execution, permissions, troubleshooting'
6 -hide-nav-links: true
7 ----
8 -
9 -## Tool execution failures (401/403 errors)
10 -
11 -Authentication and permission errors typically occur due to:
12 -
13 -### Missing scopes
14 -
15 -Check if your connection has the required scopes using this API:
16 -
17 -```bash
18 -curl --location 'https://backend.composio.dev/api/v3/tools/get_scopes_required' \
19 ---header 'x-api-key: YOUR_COMPOSIO_API_KEY' \
20 ---header 'Content-Type: application/json' \
21 ---data '{
22 - "tools": [
23 - "SLACK_SENDS_A_MESSAGE_TO_A_SLACK_CHANNEL",
24 - "SLACK_CREATE_A_REMINDER"
25 - ]
26 -}'
27 -```
28 -
29 -### Insufficient permissions
30 -
31 -Verify the connected account has necessary permissions:
32 -
33 -- **Admin requirements**: Some tools require admin-level access
34 -- **Paid accounts**: Certain toolkits need paid subscriptions
35 - - Example: MS Teams requires Microsoft 365 account + Azure AD tenant
36 -
37 -## Tool not working
38 -
39 -- Check [tool-specific documentation](/toolkits/introduction) for requirements
40 -- Verify the connected account is active and properly authenticated
41 -- Test with the latest SDK version
42 -
43 -## Reporting tool issues
44 -
45 -When reporting to support, provide:
46 -
47 -- **Error message**: Complete error details
48 -- **Log ID**: From the error response
49 -- **Tool name**: Exact tool slug being executed
50 -- **Connected account ID**: Account used for execution
51 -
52 -## Getting help
53 -
54 -- **Email**: support@composio.dev
55 -- **Discord**: [#support-form](https://discord.com/channels/1170785031560646836/1268871288156323901)
\ No newline at end of file
fern/pages/src/resources/troubleshooting/triggers.mdx deleted
-36
@@ -1,36 +0,0 @@
1 ----
2 -title: Triggers
3 -subtitle: Troubleshooting trigger issues
4 -image: "https://og.composio.dev/api/og?title=Triggers%20Troubleshooting"
5 -keywords: 'triggers, webhooks, events, troubleshooting, debugging'
6 -hide-nav-links: true
7 ----
8 -
9 -## Unable to create trigger
10 -
11 -Check the error message - the account might not have sufficient permissions or required scopes.
12 -
13 -## Type errors with trigger payloads
14 -
15 -Having issues with trigger payload types? Search [DeepWiki](https://deepwiki.com/ComposioHQ/composio) or use the Ask AI assistant for type definitions and examples.
16 -
17 -## Not receiving trigger payloads
18 -
19 -Even if the action occurred (email received, Jira issue created, etc.), there may be delays:
20 -
21 -- **Gmail triggers**: Uses polling with minimum 1-minute frequency - expect delays of up to a minute
22 -- **Other services**: May have their own polling intervals or webhook delivery delays
23 -
24 -## Reporting trigger issues
25 -
26 -When reporting to support, provide:
27 -
28 -- **Error message**: Complete error details
29 -- **Connected account**: The account ID used for creating the trigger
30 -- **cURL command**: To reproduce the issue
31 -- **Reproduction steps**: Any additional steps needed
32 -
33 -## Getting help
34 -
35 -- **Email**: support@composio.dev
36 -- **Discord**: [#support-form](https://discord.com/channels/1170785031560646836/1268871288156323901)
\ No newline at end of file
fern/pages/src/tool-router/authentication.mdx deleted
-70
@@ -1,70 +0,0 @@
1 ----
2 -title: Authentication
3 -image: "https://og.composio.dev/api/og?title=Authentication"
4 -description: "Understand how Tool Router handles user authentication to toolkits"
5 -keywords: "authentication, tool router, oauth, api key, connected accounts"
6 -hide-nav-links: false
7 ----
8 -
9 -Tool Router handles authentication through [Connect Links](/docs/authenticating-tools#hosted-authentication-connect-link), hosted pages where users complete OAuth or enter credentials.
10 -
11 -## In-chat authentication
12 -
13 -By default, when a tool requires authentication, the agent prompts the user with a Connect Link. The user authenticates and confirms in chat. The agent handles OAuth flows, token refresh, and credential management automatically.
14 -
15 -Here's what this looks like in a conversation:
16 -
17 -```
18 -You: Star the composio repo on GitHub
19 -
20 -Agent: I need you to connect your GitHub account first.
21 - Please click here to authorize: https://connect.composio.dev/link/ln_abc123
22 -
23 -You: Done
24 -
25 -Agent: Done! I've starred ComposioHQ/composio.
26 -```
27 -
28 -This flow works well for chat applications where users interact directly with the agent. See [Using in-chat authentication](/tool-router/using-in-chat-authentication).
29 -
30 -## Manual authentication
31 -
32 -For apps that manage auth outside of chat, use `session.authorize()` to generate Connect Links programmatically:
33 -
34 -<CodeGroup>
35 -```python
36 -connection_request = session.authorize("github")
37 -print(connection_request.redirect_url)
38 -# https://connect.composio.dev/link/ln_abc123
39 -```
40 -```typescript
41 -const connectionRequest = await session.authorize("github");
42 -console.log(connectionRequest.redirectUrl);
43 -// https://connect.composio.dev/link/ln_abc123
44 -```
45 -</CodeGroup>
46 -
47 -Use this when you want users to connect accounts during onboarding, or when building a custom connections page. See [Manually authenticating users](/tool-router/manually-authenticating-users) for a detailed guide.
48 -
49 -## How Tool Router manages auth configs
50 -
51 -When executing a tool, Tool Router needs an auth config to find or create a connected account. It handles this automatically:
52 -
53 -1. Uses your `authConfigs` override if provided
54 -2. Otherwise, reuses an auth config it previously created for this toolkit
55 -3. If none exists, creates one using Composio managed auth
56 -
57 -You don't need to create auth configs manually for most toolkits.
58 -
59 -## Supported auth methods
60 -
61 -Tool Router supports **Composio managed OAuth** (GitHub, Gmail, Slack, and most toolkits) and **API key auth** (users enter their own keys via Connect Link).
62 -
63 -<Note>
64 -Toolkits without Composio managed auth require a custom auth config. See [Using custom auth configs](/tool-router/using-custom-auth-configs).
65 -</Note>
66 -
67 -## White-labeling
68 -
69 -Show your own branding on OAuth consent screens by creating your own OAuth app. See [White-labeling authentication](/tool-router/white-labeling-authentication).
70 -
fern/pages/src/tool-router/managing-multiple-accounts.mdx deleted
-123
@@ -1,123 +0,0 @@
1 ----
2 -title: Managing multiple accounts
3 -image: "https://og.composio.dev/api/og?title=Managing%20Multiple%20Accounts"
4 -description: "Handle users with multiple accounts for the same toolkit"
5 -keywords: "tool router, multiple accounts, connected accounts, account selection"
6 ----
7 -
8 -Users can connect multiple accounts for the same toolkit (e.g., personal and work Gmail accounts). This is useful when users need to manage different email accounts, GitHub organizations, or separate work and personal contexts. This guide explains how to connect, select, and manage multiple accounts.
9 -
10 -## Default account behavior
11 -
12 -When multiple accounts are connected for the same toolkit:
13 -- Each session can only use **one account per toolkit** at a time
14 -- Tool Router uses the **most recently connected account** by default
15 -- You can override this by explicitly selecting an account
16 -- Each account maintains its own authentication and permissions
17 -
18 -## Connecting multiple accounts
19 -
20 -Call `session.authorize()` multiple times for the same toolkit. Each authorization creates a separate connected account with its own ID. The most recently connected account becomes the active one for that session. New sessions will also use the most recent account unless you [explicitly select a different one](#selecting-a-specific-account-for-a-session).
21 -
22 -<CodeGroup>
23 -```python
24 -session = composio.create(user_id="user_123")
25 -
26 -# Connect first account (work)
27 -work_auth = session.authorize("gmail")
28 -print(f"Connect work Gmail: {work_auth.redirect_url}")
29 -work_connection = work_auth.wait_for_connection()
30 -print(f"Work account connected: {work_connection.id}")
31 -
32 -# Connect second account (personal)
33 -personal_auth = session.authorize("gmail")
34 -print(f"Connect personal Gmail: {personal_auth.redirect_url}")
35 -personal_connection = personal_auth.wait_for_connection()
36 -print(f"Personal account connected: {personal_connection.id}")
37 -```
38 -```typescript
39 -const session = await composio.create("user_123");
40 -
41 -// Connect first account (work)
42 -const workAuth = await session.authorize("gmail");
43 -console.log(`Connect work Gmail: ${workAuth.redirectUrl}`);
44 -const workConnection = await workAuth.waitForConnection();
45 -console.log(`Work account connected: ${workConnection.id}`);
46 -
47 -// Connect second account (personal)
48 -const personalAuth = await session.authorize("gmail");
49 -console.log(`Connect personal Gmail: ${personalAuth.redirectUrl}`);
50 -const personalConnection = await personalAuth.waitForConnection();
51 -console.log(`Personal account connected: ${personalConnection.id}`);
52 -```
53 -</CodeGroup>
54 -
55 -<Note>
56 -Store the account IDs returned after connection to explicitly select accounts later.
57 -</Note>
58 -
59 -## Selecting a specific account for a session
60 -
61 -Each Tool Router session can only use one account per toolkit at a time. To use a specific account in a session, pass it in the session config:
62 -
63 -<CodeGroup>
64 -```python
65 -# This session will use a specific Gmail account
66 -session = composio.create(
67 - user_id="user_123",
68 - connected_accounts={
69 - "gmail": "ca_specific_account_id", # Connected account ID
70 - },
71 -)
72 -
73 -# To switch accounts, create a new session with a different account ID
74 -session2 = composio.create(
75 - user_id="user_123",
76 - connected_accounts={
77 - "gmail": "ca_different_account_id", # Different account
78 - },
79 -)
80 -```
81 -```typescript
82 -// This session will use a specific Gmail account
83 -const session = await composio.create("user_123", {
84 - connectedAccounts: {
85 - gmail: "ca_specific_account_id", // Connected account ID
86 - },
87 -});
88 -
89 -// To switch accounts, create a new session with a different account ID
90 -const session2 = await composio.create("user_123", {
91 - connectedAccounts: {
92 - gmail: "ca_different_account_id", // Different account
93 - },
94 -});
95 -```
96 -</CodeGroup>
97 -
98 -## Listing all user accounts
99 -
100 -To list all accounts a user has connected (not just the active one), see [List accounts](/docs/connected-accounts#list-accounts).
101 -
102 -## Viewing session's active account
103 -
104 -Use `session.toolkits()` to see which account is currently active in the session:
105 -
106 -<CodeGroup>
107 -```python
108 -toolkits = session.toolkits()
109 -
110 -for toolkit in toolkits.items:
111 - if toolkit.connection.connected_account:
112 - print(f"{toolkit.name}: {toolkit.connection.connected_account.id}")
113 -```
114 -```typescript
115 -const toolkits = await session.toolkits();
116 -
117 -for (const toolkit of toolkits.items) {
118 - if (toolkit.connection.connectedAccount) {
119 - console.log(`${toolkit.name}: ${toolkit.connection.connectedAccount.id}`);
120 - }
121 -}
122 -```
123 -</CodeGroup>
fern/pages/src/tool-router/manually-authenticating-users.mdx deleted
-93
@@ -1,93 +0,0 @@
1 ----
2 -title: Manually authenticating users
3 -image: "https://og.composio.dev/api/og?title=Manually%20Authenticating%20Users"
4 -description: "Authenticate users to toolkits outside of chat"
5 -keywords: "tool router, authentication, manual, authorize, toolkits"
6 ----
7 -
8 -Manual authentication lets you connect users to toolkits outside of the chat flow. Use this when you want to:
9 -- Pre-authenticate users before they start chatting
10 -- Build a custom connections UI in your app
11 -
12 -## Authorize a toolkit
13 -
14 -Use `session.authorize()` to generate a [Connect Link](/docs/authenticating-tools#hosted-authentication-connect-link) URL, redirect the user, and wait for them to complete:
15 -
16 -<CodeGroup>
17 -```python
18 -session = composio.create(user_id="user_123")
19 -
20 -connection_request = session.authorize("gmail")
21 -
22 -print(connection_request.redirect_url)
23 -# https://connect.composio.dev/link/ln_abc123
24 -
25 -connected_account = connection_request.wait_for_connection(60000)
26 -print(f"Connected: {connected_account.id}")
27 -```
28 -```typescript
29 -const session = await composio.create("user_123");
30 -
31 -const connectionRequest = await session.authorize("gmail");
32 -
33 -console.log(connectionRequest.redirectUrl);
34 -// https://connect.composio.dev/link/ln_abc123
35 -
36 -const connectedAccount = await connectionRequest.waitForConnection(60000);
37 -console.log(`Connected: ${connectedAccount.id}`);
38 -```
39 -</CodeGroup>
40 -
41 -Redirect the user to the redirect URL. After they authenticate, they'll return to your callback URL. The connection request polls until the user completes authentication (default timeout: 60 seconds).
42 -
43 -<Note>
44 -If the user closes the Connect Link without completing auth, the connection remains in `INITIATED` status until it expires.
45 -</Note>
46 -
47 -## Check connection status
48 -
49 -Use `session.toolkits()` to see all toolkits in the session and their connection status:
50 -
51 -<CodeGroup>
52 -```python
53 -toolkits = session.toolkits()
54 -
55 -for toolkit in toolkits.items:
56 - status = toolkit.connection.connected_account.id if toolkit.connection.is_active else "Not connected"
57 - print(f"{toolkit.name}: {status}")
58 -```
59 -```typescript
60 -const toolkits = await session.toolkits();
61 -
62 -toolkits.items.forEach((toolkit) => {
63 - console.log(`${toolkit.name}: ${toolkit.connection.connectedAccount?.id ?? "Not connected"}`);
64 -});
65 -```
66 -</CodeGroup>
67 -
68 -## Disabling in-chat auth
69 -
70 -By default, Tool Router includes the `COMPOSIO_MANAGE_CONNECTIONS` meta-tool that prompts users to authenticate during chat. To disable this and handle auth entirely in your UI:
71 -
72 -<CodeGroup>
73 -```python
74 -session = composio.create(
75 - user_id="user_123",
76 - manage_connections=False,
77 -)
78 -```
79 -```typescript
80 -const session = await composio.create("user_123", {
81 - manageConnections: false,
82 -});
83 -```
84 -</CodeGroup>
85 -
86 -## Putting it together
87 -
88 -A common pattern is to verify all required connections before starting the agent:
89 -
90 -<CodeGroup>
91 -<SnippetCode src="fern/snippets/tool-router/python/manual-auth.py" title="Python" />
92 -<SnippetCode src="fern/snippets/tool-router/typescript/manual-auth.ts" title="TypeScript" />
93 -</CodeGroup>
fern/pages/src/tool-router/migration/tool-router-beta-to-stable.mdx deleted
-86
@@ -1,86 +0,0 @@
1 ----
2 -title: Migration from the beta release version
3 -subtitle: Migrate from Tool Router beta to the stable version
4 -image: "https://og.composio.dev/api/og?title=Tool%20Router%20Migration"
5 -keywords: "tool router migration"
6 -hide-nav-links: false
7 ----
8 -The stable version includes improved session management, multiple configuring options, and enhanced authentication capabilities.
9 -
10 -## The basics
11 -
12 -<Steps>
13 - <Step title="Upgrade composio package">
14 - Upgrade to the latest stable version:
15 - <CodeGroup>
16 - ```bash title="Python" for="python"
17 - pip install --upgrade composio
18 - ```
19 - ```bash title="TypeScript" for="typescript"
20 - npm install @composio/core@latest
21 - ```
22 - </CodeGroup>
23 - </Step>
24 - <Step title="Update session creation">
25 - <CodeGroup>
26 - ```python title="Python" for="python"
27 - # Beta (before)
28 - session = composio.experimental.tool_router.create_session(
29 - user_id="user@example.com"
30 - )
31 -
32 - # Stable (after)
33 - session = composio.create(
34 - user_id="user@example.com"
35 - )
36 - ```
37 - ```typescript title="TypeScript" for="typescript"
38 - // Beta (before)
39 - const session = await composio.experimental.toolRouter.createSession('user_123');
40 -
41 - // Stable (after)
42 - const session = await composio.create('user_123');
43 - ```
44 - </CodeGroup>
45 - </Step>
46 - <Step title="Moving users (optional)">
47 - If you have existing users on tool router and you don't want them to authenticate again:
48 - - Tool Router will auto-detect auth configs and connected accounts it created(from the beta version).
49 - - If you have custom auth configs (not created by Tool Router):
50 - - Search for the Auth config for that connected account. See [Connected Accounts](/docs/connected-accounts) to fetch existing accounts programmatically.
51 - - While creating a session configure to use this Auth config.
52 - - You need to repeat this for each toolkit you want to enable for that session.
53 - <CodeGroup>
54 - ```python title="Python" for="python"
55 - session = composio.create(
56 - user_id="user_123",
57 - auth_configs={
58 - "github": "ac_your_github_config",
59 - "slack": "ac_your_slack_config"
60 - }
61 - )
62 - ```
63 - ```typescript title="TypeScript" for="typescript"
64 - const session = await composio.create('user_123',
65 - {
66 - authConfigs: {
67 - github: "ac_your_github_config",
68 - slack: "ac_your_slack_config",
69 - },
70 - }
71 - );
72 - ```
73 - </CodeGroup>
74 - </Step>
75 - <Step title="Explore new capabilities">
76 - Check out these new features available in the stable version:
77 -
78 - - **[Native tools](/tool-router/using-as-a-native-tool)**: Use Tool Router with any AI framework
79 - - **Better [session](/tool-router/users-and-sessions) and [auth](/tool-router/authentication) config**
80 - - **[Multi-account support](/tool-router/managing-multiple-accounts)**: Manage multiple accounts per user seamlessly
81 - - **[Manual authentication](/tool-router/manually-authenticating-users)**: Control when and how users authenticate
82 - - **[Custom auth](/tool-router/using-custom-auth-configs)**: Support for toolkits that don't have composio managed auth
83 - - **[White labeling](/tool-router/white-labeling-authentication)**: Customize authentication screens with your branding
84 - </Step>
85 -</Steps>
86 -
fern/pages/src/tool-router/overview.mdx deleted
-24
@@ -1,24 +0,0 @@
1 ----
2 -title: Tool Router
3 -image: "https://og.composio.dev/api/og?title=Tool%20Router"
4 -description: "Give your AI agent access to thousands of tools through a unified interface"
5 -keywords: "tool router"
6 ----
7 -
8 -Tool Router is a unified interface that lets an agent **search**, **plan**, **authenticate**, and **execute** actions across thousands of Composio tools.
9 -
10 -Consider an agent that works across Gmail, Notion, Slack, Google Drive, and hundreds of other apps. The challenges:
11 -
12 -- **Search**: Identifying the right tool for the task
13 -- **Context Management**: Managing context for complex queries with large responses
14 -- **Authentication**: Handling authentication across all of them
15 -
16 -Tool Router exposes a set of meta-tools that handle all this complexity including search to discover the right tools, and a workbench to process results without flooding context.
17 -
18 -This is what powers complex agentic products like [Rube](https://rube.app).
19 -
20 -## Quick links
21 -
22 -- [Quickstart](/tool-router/quickstart): Build your first AI agent with Tool Router.
23 -- [Using with MCP clients](/tool-router/using-with-mcp-clients): Guides on how to use Tool Router MCP with popular MCP clients.
24 -- [Using as a native tool](/tool-router/using-as-a-native-tool): Guide on how to use Tool Router as a native tool with any AI framework.
fern/pages/src/tool-router/quick-start-deprecated.mdx deleted
-238
@@ -1,238 +0,0 @@
1 ----
2 -title: Tool Router Quick Start
3 -image: "https://og.composio.dev/api/og?title=Tool%20Router%20Quick%20Start" # image for socials
4 -keywords: ''
5 -subtitle: 'Learn how to use tool router to route tool calls to the correct tool.'
6 -hide-nav-links: false
7 ----
8 -
9 -<Launch>
10 -Tool Router is now out of beta and available with powerful new capabilities!
11 -
12 -[Check out the updated documentation →](/tool-router/overview)
13 -</Launch>
14 -
15 -Tool Router automatically discovers, authenticates, and executes the right tools for any task. It's an experimental feature that handles the entire workflow—from finding relevant tools across 500+ integrations to managing authentication and parallel execution.
16 -
17 -This is what powers complex agentic products like [Rube](https://rube.app).
18 -
19 -## Quick start
20 -
21 -<Steps toc={true}>
22 - <Step title="Install SDKs">
23 - Install the Composio SDK and OpenAI Agents SDK:
24 -
25 - <CodeGroup>
26 -
27 - ```bash Python
28 - pip install composio_openai_agents openai-agents
29 - ```
30 -
31 - ```bash TypeScript
32 - pnpm install @composio/core @composio/openai-agents @openai/agents
33 - ```
34 -
35 - </CodeGroup>
36 -
37 - Get your Composio API key from [settings](https://platform.composio.dev/?next_page=/settings) and set it as an environment variable:
38 -
39 - ```bash
40 - export COMPOSIO_API_KEY="your-api-key"
41 - ```
42 - </Step>
43 -
44 - <Step title="Create Tool Router session">
45 - Initialize Composio and create a session for your user:
46 -
47 - <Tip icon="info">
48 - **Authentication is handled automatically**
49 -
50 - Tool Router provides auth URLs when needed. For production, consider [pre-configuring authentication](/docs/authenticating-tools).
51 - </Tip>
52 -
53 - <CodeGroup>
54 -
55 - <SnippetCode
56 - src="fern/snippets/tool-router/python/quickstart.py"
57 - startLine={1}
58 - endLine={16}
59 - title="Python"
60 - />
61 -
62 - <SnippetCode
63 - src="fern/snippets/tool-router/typescript/quickstart.ts"
64 - startLine={1}
65 - endLine={18}
66 - title="TypeScript"
67 - />
68 -
69 - </CodeGroup>
70 -
71 - This generates a secure MCP endpoint URL that your AI agent will use to access Tool Router.
72 -
73 - <Tip icon="info">
74 - **What are sessions?**
75 -
76 - Sessions are designed for security. Each presigned URL contains user authentication credentials and should never be stored long-term or exposed to the client. Generate a new URL for each conversation.
77 - </Tip>
78 - </Step>
79 -
80 - <Step title="Set up your agent">
81 - Configure an OpenAI agent with the Tool Router MCP endpoint:
82 -
83 - <CodeGroup>
84 -
85 - <SnippetCode
86 - src="fern/snippets/tool-router/python/quickstart.py"
87 - startLine={17}
88 - endLine={33}
89 - title="Python"
90 - />
91 -
92 - <SnippetCode
93 - src="fern/snippets/tool-router/typescript/quickstart.ts"
94 - startLine={20}
95 - endLine={30}
96 - title="TypeScript"
97 - />
98 -
99 - </CodeGroup>
100 - </Step>
101 -
102 - <Step title="Run your agent">
103 - Execute the agent with a task:
104 -
105 - <CodeGroup>
106 -
107 - <SnippetCode
108 - src="fern/snippets/tool-router/python/quickstart.py"
109 - startLine={34}
110 - endLine={42}
111 - title="Python"
112 - />
113 -
114 - <SnippetCode
115 - src="fern/snippets/tool-router/typescript/quickstart.ts"
116 - startLine={32}
117 - endLine={41}
118 - title="TypeScript"
119 - />
120 -
121 - </CodeGroup>
122 - </Step>
123 -</Steps>
124 -
125 -
126 -## How Tool Router works
127 -
128 -The Tool Router executes a three-phase workflow:
129 -
130 -**1. Discovery**
131 -Searches across all available tools to find ones matching your task. Returns relevant toolkits with their descriptions, schemas, and connection status.
132 -
133 -**2. Authentication**
134 -Checks if the user has an active connection to the required toolkit. If not, creates an auth config and returns a connection URL using [Auth Link](/docs/authenticating-tools#hosted-authentication-connect-link). The user completes authentication through this link.
135 -
136 -**3. Execution**
137 -Loads authenticated tools into context and executes them. Supports parallel execution across multiple tools for efficiency.
138 -
139 -These phases are orchestrated through a set of meta tools, which handle search, planning, connection management, execution, and remote workbench.
140 -
141 -<Warning>
142 -**Experimental Feature**
143 -
144 -Tool Router is under active development. The meta tools, their schemas, parameters, and behaviors are subject to change as we iterate and improve the functionality. We recommend not using these tools individually.
145 -</Warning>
146 -
147 -## Works with any MCP client
148 -
149 -The session URL you created is a standard MCP endpoint. Use it with any framework that supports MCP:
150 -
151 -<Info>
152 -Tool Router uses Streamable HTTP transport for MCP communication. Make sure your MCP client supports HTTP transport (most do).
153 -</Info>
154 -
155 -<CardGroup cols={2}>
156 - <Card
157 - title="Vercel AI SDK"
158 - icon={<img src="../../../assets/images/vercel-logo.svg" width="24" height="24" />}
159 - href="https://ai-sdk.dev/cookbook/next/mcp-tools#mcp-tools"
160 - >
161 - Use experimental_createMCPClient with StreamableHTTPClientTransport to integrate with Next.js apps
162 - </Card>
163 - <Card
164 - title="Claude"
165 - icon={<img src="../../../assets/images/anthropic-logo.svg" width="24" height="24" />}
166 - href="https://docs.claude.com/en/docs/agents-and-tools/remote-mcp-servers"
167 - >
168 - Connect remote MCP servers through Anthropic's MCP connector API
169 - </Card>
170 - <Card
171 - title="LangChain"
172 - icon={<img src="../../../assets/images/langgraph-logo.svg" width="24" height="24" />}
173 - href="https://docs.langchain.com/oss/python/langchain/mcp"
174 - >
175 - Load Tool Router tools using langchain_mcp_adapters for Python workflows
176 - </Card>
177 -</CardGroup>
178 -
179 -<Note>
180 -The necessary scaffolding will be integrated into existing provider abstractions before Tool Router is generally available.
181 -</Note>
182 -
183 -## Customization
184 -
185 -### Restricting toolkits
186 -
187 -Control which toolkits are available by specifying them during session creation. This limits which apps your users can access.
188 -
189 -<CodeGroup>
190 -```python
191 -session = composio.experimental.tool_router.create_session(
192 - user_id="user@example.com",
193 - toolkits=["github", "slack", "gmail"]
194 -)
195 -```
196 -
197 -```typescript
198 -const session = await composio.experimental.toolRouter.createSession(
199 - "user@example.com",
200 - {
201 - toolkits: ["github", "slack", "gmail"]
202 - }
203 -);
204 -```
205 -</CodeGroup>
206 -
207 -
208 -### Manual connection management
209 -
210 -For advanced use cases, you can manually manage connections:
211 -
212 -<CodeGroup>
213 -```python
214 -session = composio.experimental.tool_router.create_session(
215 - user_id="user@example.com",
216 - toolkits=[{"toolkit": "gmail", "auth_config_id": "ac_nnn"}],
217 - manually_manage_connections=True
218 -)
219 -```
220 -
221 -```typescript
222 -const session = await composio.experimental.toolRouter.createSession(
223 - "user@example.com",
224 - {
225 - toolkits: [{ toolkit: 'gmail', authConfigId: 'ac_nnn' }],
226 - manuallyManageConnections: true
227 - }
228 -);
229 -```
230 -</CodeGroup>
231 -
232 -When you pass the auth config ID, you can use regular Composio functions to connect accounts and check authentication status.
233 -
234 -## Feedback
235 -
236 -This is still very experimental and work in progress, and you can expect the contracts to change and improve as we iterate on this. That said, we would love to hear your feedback on this.
237 -
238 -Give us feedback on this GitHub discussion [here](https://github.com/ComposioHQ/composio/discussions/2011).
\ No newline at end of file
fern/pages/src/tool-router/quickstart.mdx deleted
-210
@@ -1,210 +0,0 @@
1 ----
2 -title: Quickstart
3 -image: "https://og.composio.dev/api/og?title=Tool%20Router%20Quickstart"
4 -description: "Build an AI agent with access to 1000+ tools"
5 -keywords: "tool router quickstart, quickstart"
6 -hide-nav-links: false
7 ----
8 -
9 -Choose how you want to integrate Tool Router:
10 -
11 -<AccordionGroup>
12 -<Accordion title="Using Tool Router MCP">
13 -
14 -<Tabs>
15 -<Tab title="Claude Agent SDK">
16 -
17 -<Steps>
18 -<Step title="Install">
19 -<CodeGroup>
20 -```bash title="Python" for="python"
21 -pip install python-dotenv composio claude-agent-sdk
22 -```
23 -```bash title="TypeScript" for="typescript"
24 -npm install dotenv @composio/core @anthropic-ai/claude-agent-sdk
25 -```
26 -</CodeGroup>
27 -</Step>
28 -
29 -<Step title="Create session and run agent">
30 -[Sessions](/tool-router/users-and-sessions) are ephemeral, user-scoped and manage connections and tools for that user.
31 -
32 -<Info>
33 -- Set `COMPOSIO_API_KEY` environment variable with your API key from [Settings](https://platform.composio.dev/?next_page=/settings).
34 -- Set `ANTHROPIC_API_KEY` environment variable with your [Anthropic API key](https://platform.claude.com/settings/keys).
35 -- `userId` is your user's unique identifier. See [User Management](/docs/user-management) for details.
36 -</Info>
37 -
38 -When the agent needs authentication, it will prompt the user with a link to connect their account. If you want to customise the authentication flow and have more control over the user experience, see [Manual Authentication](/tool-router/manually-authenticating-users).
39 -
40 -<CodeGroup>
41 -<SnippetCode src="fern/snippets/tool-router/python/quickstart-mcp-claude.py" title="Python" for="python" />
42 -<SnippetCode src="fern/snippets/tool-router/typescript/quickstart-mcp-claude.ts" title="TypeScript" for="typescript" />
43 -</CodeGroup>
44 -</Step>
45 -</Steps>
46 -
47 -</Tab>
48 -
49 -<Tab title="OpenAI Agents SDK">
50 -
51 -<Steps>
52 -<Step title="Install">
53 -<CodeGroup>
54 -```bash title="Python" for="python"
55 -pip install python-dotenv composio openai-agents
56 -```
57 -```bash title="TypeScript" for="typescript"
58 -npm install dotenv @composio/core @openai/agents zod@3
59 -```
60 -</CodeGroup>
61 -</Step>
62 -
63 -<Step title="Create session and run agent">
64 -[Sessions](/tool-router/users-and-sessions) are ephemeral, user-scoped and manage connections and tools for that user.
65 -
66 -<Info>
67 -- Set `COMPOSIO_API_KEY` environment variable with your API key from [Settings](https://platform.composio.dev/?next_page=/settings).
68 -- Set `OPENAI_API_KEY` environment variable with your [OpenAI API key](https://platform.openai.com/api-keys).
69 -- `userId` is your user's unique identifier. See [User Management](/docs/user-management) for details.
70 -</Info>
71 -
72 -When the agent needs authentication, it will prompt the user with a link to connect their account. If you want to customise the authentication flow and have more control over the user experience, see [Manual Authentication](/tool-router/manually-authenticating-users).
73 -
74 -<CodeGroup>
75 -<SnippetCode src="fern/snippets/tool-router/python/quickstart-mcp-openai.py" title="Python" for="python" />
76 -<SnippetCode src="fern/snippets/tool-router/typescript/quickstart-mcp-openai.ts" title="TypeScript" for="typescript" />
77 -</CodeGroup>
78 -
79 -</Step>
80 -</Steps>
81 -
82 -</Tab>
83 -
84 -<Tab title="Vercel AI SDK">
85 -
86 -<Steps>
87 -<Step title="Install Composio SDK">
88 -```bash
89 -npm install dotenv @composio/core ai @ai-sdk/anthropic @ai-sdk/mcp
90 -```
91 -</Step>
92 -
93 -<Step title="Create session and run agent">
94 -[Sessions](/tool-router/users-and-sessions) are ephemeral, user-scoped and manage connections and tools for that user.
95 -
96 -<Info>
97 -- Set `COMPOSIO_API_KEY` environment variable with your API key from [Settings](https://platform.composio.dev/?next_page=/settings).
98 -- Set `ANTHROPIC_API_KEY` environment variable with your [Anthropic API key](https://platform.claude.com/settings/keys).
99 -- `userId` is your user's unique identifier. See [User Management](/docs/user-management) for details.
100 -</Info>
101 -
102 -When the agent needs authentication, it will prompt the user with a link to connect their account. If you want to customise the authentication flow and have more control over the user experience, see [Manual Authentication](/tool-router/manually-authenticating-users).
103 -
104 -<SnippetCode src="fern/snippets/tool-router/typescript/quickstart-mcp-vercel.ts" />
105 -</Step>
106 -</Steps>
107 -
108 -</Tab>
109 -</Tabs>
110 -
111 -### What just happened?
112 -
113 -When you run this agent, Tool Router:
114 -1. **Creates an MCP server** with your session configuration
115 -2. **Searches** for the right tools based on your request
116 -3. **Handles authentication** if needed
117 -4. **Executes tools** and uses a workbench for processing large responses
118 -
119 -</Accordion>
120 -
121 -<Accordion title="Using Tool router as a native tool">
122 -
123 -<Tabs>
124 -<Tab title="OpenAI">
125 -
126 -<Steps>
127 -<Step title="Install">
128 -<CodeGroup>
129 -```bash title="Python" for="python"
130 -pip install python-dotenv composio composio-openai-agents openai-agents
131 -```
132 -```bash title="TypeScript" for="typescript"
133 -npm install @composio/core @composio/openai-agents @openai/agents
134 -```
135 -</CodeGroup>
136 -</Step>
137 -
138 -<Step title="Create session and use as native tool">
139 -Tool Router can be added as a single native tool to your agent. This provides a meta-tool that handles search, authentication, and execution across all 1000+ Composio tools.
140 -
141 -<Info>
142 -- Set `COMPOSIO_API_KEY` environment variable with your API key from [Settings](https://platform.composio.dev/?next_page=/settings).
143 -- Set `OPENAI_API_KEY` environment variable with your [OpenAI API key](https://platform.openai.com/api-keys).
144 -- `userId` is your user's unique identifier. See [User Management](/docs/user-management) for details.
145 -</Info>
146 -
147 -<CodeGroup>
148 -<SnippetCode src="fern/snippets/tool-router/python/quickstart-native-openai.py" title="Python" for="python" />
149 -<SnippetCode src="fern/snippets/tool-router/typescript/quickstart-native-openai.ts" title="TypeScript" for="typescript" />
150 -</CodeGroup>
151 -</Step>
152 -</Steps>
153 -
154 -</Tab>
155 -
156 -<Tab title="Vercel AI SDK">
157 -
158 -<Steps>
159 -<Step title="Install">
160 -```bash title="TypeScript"
161 -npm install @composio/core @composio/vercel ai @ai-sdk/anthropic
162 -```
163 -</Step>
164 -
165 -<Step title="Create session and use as native tool">
166 -Tool Router can be added as a single native tool to your agent. This provides a meta-tool that handles search, authentication, and execution across all 1000+ Composio tools.
167 -
168 -<Info>
169 -- Set `COMPOSIO_API_KEY` environment variable with your API key from [Settings](https://platform.composio.dev/?next_page=/settings).
170 -- Set `ANTHROPIC_API_KEY` environment variable with your [Anthropic API key](https://console.anthropic.com/settings/keys).
171 -- `userId` is your user's unique identifier. See [User Management](/docs/user-management) for details.
172 -</Info>
173 -
174 -<SnippetCode src="fern/snippets/tool-router/typescript/quickstart-native-vercel.ts" title="TypeScript" />
175 -</Step>
176 -</Steps>
177 -
178 -</Tab>
179 -</Tabs>
180 -
181 -### What just happened?
182 -
183 -When you run this agent, Tool Router:
184 -1. **Provides a single tool** to your agent framework
185 -2. **Interprets requests** and **searches** for the right tools internally
186 -3. **Handles authentication** if needed
187 -4. **Executes tools** and uses a workbench for processing large responses
188 -
189 -</Accordion>
190 -</AccordionGroup>
191 -
192 -## Next steps
193 -
194 -<CardGroup cols={2}>
195 - <Card title="Session management" href="/tool-router/users-and-sessions">
196 - Learn about users, sessions, and how they work.
197 - </Card>
198 - <Card title="Tools and toolkits" href="/tool-router/tools-and-toolkits">
199 - Learn about tools, toolkits, and how to configure them.
200 - </Card>
201 - <Card title="Manual authentication" href="/tool-router/manually-authenticating-users">
202 - Customise the authentication flow for your users.
203 - </Card>
204 - <Card title="Using MCP" href="/tool-router/using-with-mcp-clients">
205 - Connect Tool Router to any MCP-compatible client.
206 - </Card>
207 - <Card title="Using as a native tool" href="/tool-router/using-as-a-native-tool">
208 - Use Tool Router as a native tool with any AI framework.
209 - </Card>
210 -</CardGroup>
fern/pages/src/tool-router/tools-and-toolkits.mdx deleted
-73
@@ -1,73 +0,0 @@
1 ----
2 -title: Tools and toolkits
3 -image: "https://og.composio.dev/api/og?title=Tools%20and%20Toolkits"
4 -description: "Access 800+ integrations through Tool Router"
5 -keywords: "tool router, tools, toolkits, integrations, composio"
6 ----
7 -
8 -Tool Router gives your agent access to most Composio toolkits by default. For details on configuring which toolkits are available in a session, see [Users and sessions](/tool-router/users-and-sessions#enabling-toolkits).
9 -
10 -## Toolkits and tools
11 -
12 -A **toolkit** is a collection of related tools for a service and a **tool** is an individual action your agent can execute.
13 -
14 -| Toolkit | Tools |
15 -|---------|-------|
16 -| `github` | `GITHUB_CREATE_A_COMMIT`, `GITHUB_ACTIVITY_LIST_STARGAZERS_FOR_REPO`, `GITHUB_SEARCH_REPO_S`, ... |
17 -| `gmail` | `GMAIL_SEND_EMAIL`, `GMAIL_FETCH_EMAILS`, `GMAIL_CREATE_EMAIL_DRAFT`, ... |
18 -| `linear` | `LINEAR_CREATE_LINEAR_ISSUE`, `LINEAR_UPDATE_ISSUE`, `LINEAR_CREATE_LINEAR_LABEL`, ... |
19 -
20 -## Available toolkits
21 -
22 -Browse all available toolkits in the [Composio platform](https://platform.composio.dev) under "All Toolkits". Each toolkit page shows its tools (with input and output parameters) and authentication methods supported for that toolkit.
23 -
24 -You can also list toolkits programmatically:
25 -
26 -<CodeGroup>
27 -```python Python
28 -# Returns top 20 toolkits by default
29 -toolkits = composio.toolkits.get()
30 -
31 -for toolkit in toolkits:
32 - print(toolkit.name)
33 -```
34 -
35 -```typescript TypeScript
36 -// Returns top 20 toolkits by default
37 -const toolkits = await composio.toolkits.get();
38 -
39 -for (const toolkit of toolkits) {
40 - console.log(toolkit.name);
41 -}
42 -```
43 -</CodeGroup>
44 -
45 -For details on browsing tools within toolkits and inspecting schemas, see [Fetching tools and schemas](/docs/fetching-tools).
46 -
47 -<Note>
48 -Some toolkits require you to provide your own credentials. See [Using custom auth configs](/tool-router/using-custom-auth-configs).
49 -</Note>
50 -
51 -<Tip>
52 -Need a toolkit that doesn't exist? [Request it here](https://request.composio.dev/boards/tool-requests).
53 -</Tip>
54 -
55 -
56 -## Default session behavior
57 -
58 -When you create a session, all toolkits are available:
59 -
60 -<CodeGroup>
61 -```python
62 -session = composio.create(user_id="user_123")
63 -```
64 -```typescript
65 -const session = await composio.create("user_123");
66 -```
67 -</CodeGroup>
68 -
69 -Your agent can search and use tools from any toolkit. To restrict or configure which toolkits are available, see [Users and sessions](/tool-router/users-and-sessions#enabling-toolkits).
70 -
71 -<Tip>
72 -Triggers can be used alongside Tool Router to respond to events in connected apps. See [Using triggers](/docs/tools-and-triggers/using-triggers) for setup instructions.
73 -</Tip>
fern/pages/src/tool-router/users-and-sessions.mdx deleted
-230
@@ -1,230 +0,0 @@
1 ----
2 -title: Users and sessions
3 -image: "https://og.composio.dev/api/og?title=Users%20and%20Sessions"
4 -description: "Understand how Tool Router scopes tools and connections per user"
5 -keywords: "sessions, users, tool router, configuration"
6 -hide-nav-links: false
7 ----
8 -
9 -A **user ID** is an identifier from your system (database ID, UUID, or any unique string) that scopes connected accounts and tool access to a specific user. User IDs can represent individuals, teams, or organizations. See [User Management](/docs/user-management) for patterns.
10 -
11 -A **session** is an ephemeral configuration that combines:
12 -- Which user's connected accounts to use
13 -- Which toolkits are available
14 -- Which auth configs to use
15 -
16 -Tool Router's meta-tools are the same for everyone. The session determines the context they operate within.
17 -
18 -## Creating a session
19 -
20 -<CodeGroup>
21 -```python Python
22 -session = composio.create(user_id="user_123")
23 -```
24 -
25 -```typescript TypeScript
26 -const session = await composio.create("user_123");
27 -```
28 -</CodeGroup>
29 -
30 -### Enabling toolkits
31 -
32 -Restrict the session to specific toolkits:
33 -
34 -<CodeGroup>
35 -```python Python
36 -# Using array format
37 -session = composio.create(
38 - user_id="user_123",
39 - toolkits=["github", "gmail", "slack"]
40 -)
41 -
42 -# Using object format with enable key
43 -session = composio.create(
44 - user_id="user_123",
45 - toolkits={"enable": ["github", "gmail", "slack"]}
46 -)
47 -```
48 -
49 -```typescript TypeScript
50 -// Using array format
51 -const session = await composio.create("user_123", {
52 - toolkits: ["github", "gmail", "slack"],
53 -});
54 -
55 -// Using object format with enable key
56 -const session = await composio.create("user_123", {
57 - toolkits: { enable: ["github", "gmail", "slack"] },
58 -});
59 -```
60 -</CodeGroup>
61 -
62 -### Disabling toolkits
63 -
64 -Keep all toolkits enabled except specific ones:
65 -
66 -<CodeGroup>
67 -```python Python
68 -session = composio.create(
69 - user_id="user_123",
70 - toolkits={"disable": ["exa", "firecrawl"]}
71 -)
72 -```
73 -
74 -```typescript TypeScript
75 -const session = await composio.create("user_123", {
76 - toolkits: { disable: ["exa", "firecrawl"] },
77 -});
78 -```
79 -</CodeGroup>
80 -
81 -### Custom auth configs
82 -
83 -Use your own OAuth credentials instead of Composio's defaults:
84 -
85 -<CodeGroup>
86 -```python Python
87 -session = composio.create(
88 - user_id="user_123",
89 - auth_configs={
90 - "github": "ac_your_github_config",
91 - "slack": "ac_your_slack_config"
92 - }
93 -)
94 -```
95 -
96 -```typescript TypeScript
97 -const session = await composio.create("user_123", {
98 - authConfigs: {
99 - github: "ac_your_github_config",
100 - slack: "ac_your_slack_config",
101 - },
102 -});
103 -```
104 -</CodeGroup>
105 -
106 -See [White-labeling authentication](/tool-router/white-labeling-authentication) for branding, or [Using custom auth configs](/tool-router/using-custom-auth-configs) for toolkits that require your own credentials.
107 -
108 -## Connected accounts
109 -
110 -Connected accounts are stored in Composio and persist across sessions. When a user connects their GitHub account in one session, it remains available in future sessions. Sessions configure *which* connections to use, but don't own the connections themselves.
111 -
112 -### Account selection
113 -
114 -If a user has multiple connected accounts for the same toolkit, you can specify which one to use:
115 -
116 -<CodeGroup>
117 -```python Python
118 -session = composio.create(
119 - user_id="user_123",
120 - connected_accounts={
121 - "gmail": "ca_work_gmail",
122 - "github": "ca_personal_github"
123 - }
124 -)
125 -```
126 -
127 -```typescript TypeScript
128 -const session = await composio.create("user_123", {
129 - connectedAccounts: {
130 - gmail: "ca_work_gmail",
131 - github: "ca_personal_github",
132 - },
133 -});
134 -```
135 -</CodeGroup>
136 -
137 -### Precedence
138 -
139 -When executing a tool, Tool Router selects the connected account in this order:
140 -
141 -1. `connectedAccounts` override if provided in session config
142 -2. `authConfigs` override - finds or creates connection on that config
143 -3. Auth config previously created by Tool Router for this toolkit
144 -4. Creates new auth config using Composio managed auth (tagged as Tool Router created)
145 -5. Error if no Composio managed auth scheme exists for the toolkit
146 -
147 -If a user has multiple connected accounts for a toolkit, the most recently connected one is used.
148 -
149 -## Session methods
150 -
151 -### mcp
152 -
153 -Get the MCP server URL to use with any MCP-compatible client.
154 -
155 -<CodeGroup>
156 -```python Python
157 -mcp_url = session.mcp.url
158 -```
159 -
160 -```typescript TypeScript
161 -const { mcp } = session;
162 -console.log(mcp.url);
163 -```
164 -</CodeGroup>
165 -
166 -For framework examples, see [Using with MCP clients](/tool-router/using-with-mcp-clients) or [Using as a native tool](/tool-router/using-as-a-native-tool).
167 -
168 -### tools()
169 -
170 -Get native tools from the session for use with AI frameworks.
171 -
172 -<CodeGroup>
173 -```python Python
174 -tools = session.tools()
175 -```
176 -
177 -```typescript TypeScript
178 -const tools = await session.tools();
179 -```
180 -</CodeGroup>
181 -
182 -### authorize()
183 -
184 -Manually authenticate a user to a toolkit outside of the chat flow.
185 -
186 -<CodeGroup>
187 -```python Python
188 -connection_request = session.authorize("github")
189 -
190 -print(connection_request.redirect_url)
191 -
192 -connected_account = connection_request.wait_for_connection()
193 -```
194 -
195 -```typescript TypeScript
196 -const connectionRequest = await session.authorize("github", {
197 - callbackUrl: "https://myapp.com/callback",
198 -});
199 -
200 -console.log(connectionRequest.redirectUrl);
201 -
202 -const connectedAccount = await connectionRequest.waitForConnection();
203 -```
204 -</CodeGroup>
205 -
206 -For more details, see [Manually authenticating users](/tool-router/manually-authenticating-users).
207 -
208 -### toolkits()
209 -
210 -List available toolkits and their connection status. You can use this to build a UI showing which apps are connected.
211 -
212 -<CodeGroup>
213 -```python Python
214 -toolkits = session.toolkits()
215 -
216 -for toolkit in toolkits.items:
217 - status = toolkit.connection.connected_account.id if toolkit.connection.is_active else "Not connected"
218 - print(f"{toolkit.name}: {status}")
219 -```
220 -
221 -```typescript TypeScript
222 -const toolkits = await session.toolkits();
223 -
224 -toolkits.items.forEach((toolkit) => {
225 - console.log(`${toolkit.name}: ${toolkit.connection.connectedAccount?.id ?? "Not connected"}`);
226 -});
227 -```
228 -</CodeGroup>
229 -
230 -Returns the first 20 toolkits by default.
fern/pages/src/tool-router/using-as-a-native-tool.mdx deleted
-77
@@ -1,77 +0,0 @@
1 ----
2 -title: Using as a native tool
3 -image: "https://og.composio.dev/api/og?title=Using%20as%20a%20Native%20Tool"
4 -description: "Use Tool Router as a native tool with any AI framework"
5 -keywords: "native tool, tool router, meta-tool"
6 ----
7 -
8 -Tool Router can be used as a single native tool with any AI framework. The tool handles search, authentication, and execution internally.
9 -
10 -## Examples for popular frameworks
11 -
12 -Jump to examples for:
13 -- [OpenAI](#openai) - Python, TypeScript
14 -- [Vercel AI SDK](#vercel-ai-sdk) - TypeScript
15 -
16 -## OpenAI
17 -
18 -### Installation
19 -
20 -<CodeGroup>
21 -```bash title="Python" for="python"
22 -pip install python-dotenv composio composio-openai-agents openai-agents
23 -```
24 -```bash title="TypeScript" for="typescript"
25 -npm install @composio/core @composio/openai-agents @openai/agents
26 -```
27 -</CodeGroup>
28 -
29 -### Usage
30 -
31 -Create a Tool Router session and use it as a native tool with OpenAI Agents SDK:
32 -
33 -<Info>
34 -- Set your `COMPOSIO_API_KEY` environment variable with your API key from [Settings](https://platform.composio.dev/?next_page=/settings).
35 -- Set your `OPENAI_API_KEY` environment variable with your [OpenAI API key](https://platform.openai.com/api-keys).
36 -</Info>
37 -
38 -<CodeGroup>
39 -<SnippetCode src="fern/snippets/tool-router/python/native-tools-openai.py" title="Python" />
40 -<SnippetCode src="fern/snippets/tool-router/typescript/native-tools-openai.ts" title="TypeScript" />
41 -</CodeGroup>
42 -
43 -## Vercel AI SDK
44 -
45 -### Installation
46 -
47 -```bash
48 -npm install @composio/core @composio/vercel ai @ai-sdk/anthropic
49 -```
50 -
51 -### Usage
52 -
53 -Create a Tool Router session and use it as a native tool with Vercel AI SDK:
54 -
55 -<Info>
56 -- Set your `COMPOSIO_API_KEY` environment variable with your API key from [Settings](https://platform.composio.dev/?next_page=/settings).
57 -- Set your `ANTHROPIC_API_KEY` environment variable with your [Anthropic API key](https://console.anthropic.com/settings/keys).
58 -</Info>
59 -
60 -<SnippetCode src="fern/snippets/tool-router/typescript/native-tools-vercel.ts" />
61 -
62 -## Next steps
63 -
64 -<CardGroup cols={2}>
65 - <Card title="Quickstart" href="/tool-router/quickstart">
66 - See both MCP and native tool in action
67 - </Card>
68 - <Card title="Using with MCP" href="/tool-router/using-with-mcp-clients">
69 - Use Tool Router with MCP-compatible clients
70 - </Card>
71 - <Card title="Authentication" href="/tool-router/authentication">
72 - Learn about authentication options
73 - </Card>
74 - <Card title="Session management" href="/tool-router/users-and-sessions">
75 - Configure sessions for your users
76 - </Card>
77 -</CardGroup>
\ No newline at end of file
fern/pages/src/tool-router/using-custom-auth-configs.mdx deleted
-53
@@ -1,53 +0,0 @@
1 ----
2 -title: Using custom auth configs
3 -image: "https://og.composio.dev/api/og?title=Using%20Custom%20Auth%20Configs"
4 -description: "Set up auth configs for toolkits without Composio managed authentication"
5 -keywords: "tool router, auth config, custom credentials, oauth"
6 ----
7 -
8 -Some toolkits don't have Composio managed authentication and require you to provide your own credentials. When Tool Router tries to use these toolkits, it will throw an error asking you to create an auth config.
9 -
10 -<Steps>
11 -<Step title="Check if a toolkit needs custom credentials">
12 -In the [Composio platform](https://platform.composio.dev), go to "All Toolkits" and select the toolkit. If it shows no Composio managed auth schemes, you'll need to create an auth config.
13 -</Step>
14 -
15 -<Step title="Create an auth config">
16 -1. Go to **Authentication management** in the [dashboard](https://app.composio.dev)
17 -2. Click **Create Auth Config**
18 -3. Select the toolkit
19 -4. Choose the auth scheme (OAuth2, API Key, etc.)
20 -5. Enter your credentials (client ID, client secret, API key, etc.)
21 -6. Click **Create**
22 -
23 -Copy the auth config ID (e.g., `ac_1234abcd`).
24 -
25 -<Tip>
26 -For detailed instructions on getting credentials for specific toolkits, see [Custom auth configs](/docs/authentication/custom-auth-configs).
27 -</Tip>
28 -</Step>
29 -
30 -<Step title="Use in Tool Router">
31 -Pass your auth config ID when creating a session:
32 -
33 -<CodeGroup>
34 -```python
35 -session = composio.create(
36 - user_id="user_123",
37 - auth_configs={
38 - "posthog": "ac_your_posthog_config"
39 - }
40 -)
41 -```
42 -```typescript
43 -const session = await composio.create("user_123", {
44 - authConfigs: {
45 - posthog: "ac_your_posthog_config",
46 - },
47 -});
48 -```
49 -</CodeGroup>
50 -
51 -Tool Router will now use your auth config when users connect to this toolkit.
52 -</Step>
53 -</Steps>
fern/pages/src/tool-router/using-in-chat-authentication.mdx deleted
-72
@@ -1,72 +0,0 @@
1 ----
2 -title: Using In-chat authentication
3 -image: "https://og.composio.dev/api/og?title=Using%20In-chat%20Authentication"
4 -description: "Let your agent prompt users to connect accounts during conversation"
5 -keywords: "tool router, authentication, in-chat, MANAGE_CONNECTIONS"
6 ----
7 -
8 -In-chat authentication lets your agent prompt users to connect accounts during chat. When a tool requires authentication, the agent returns a Connect Link URL. The user authenticates, confirms in chat, and the agent retries.
9 -
10 -## How it works
11 -
12 -1. Agent searches for tools via the `COMPOSIO_SEARCH_TOOLS` meta-tool
13 -2. The `COMPOSIO_MANAGE_CONNECTIONS` meta-tool checks connection status, returns Connect Link URL if needed
14 -3. User authenticates, confirms in chat, agent continues
15 -
16 -## Configuration
17 -
18 -By just creating a session with default configs, you are enabling in-chat auth. The `manage_connections` parameter defaults to `True`, which includes the `COMPOSIO_MANAGE_CONNECTIONS` meta-tool automatically:
19 -
20 -<CodeGroup>
21 -```python
22 -session = composio.create(user_id="user_123")
23 -```
24 -```typescript
25 -const session = await composio.create("user_123");
26 -```
27 -</CodeGroup>
28 -
29 -### Custom callback URL
30 -
31 -Redirect users back to your chat page after they complete authentication:
32 -
33 -<CodeGroup>
34 -```python
35 -session = composio.create(
36 - user_id="user_123",
37 - manage_connections={
38 - "callback_url": "https://yourapp.com/chat"
39 - },
40 -)
41 -```
42 -```typescript
43 -const session = await composio.create("user_123", {
44 - manageConnections: {
45 - callbackUri: "https://yourapp.com/chat",
46 - },
47 -});
48 -```
49 -</CodeGroup>
50 -
51 -## Examples
52 -
53 -<CodeGroup>
54 -<SnippetCode src="fern/snippets/tool-router/python/quickstart-native-openai.py" title="Python" />
55 -<SnippetCode src="fern/snippets/tool-router/typescript/quickstart-native-openai.ts" title="TypeScript" />
56 -</CodeGroup>
57 -
58 -What this looks like when you run the code:
59 -
60 -```
61 -Assistant: What would you like me to do today? Type 'exit' to end the conversation.
62 -
63 -> Star the composio repo on GitHub
64 -Assistant: I need you to connect your GitHub account first.
65 -Please click here to authorize: https://connect.composio.dev/link/ln_abc123
66 -
67 -> Done
68 -
69 -Assistant: Done! I've starred ComposioHQ/composio.
70 -```
71 -
72 -To manage authentication outside of chat, see [Manually authenticating users](/tool-router/manually-authenticating-users).
fern/pages/src/tool-router/using-with-mcp-clients.mdx deleted
-88
@@ -1,88 +0,0 @@
1 ----
2 -title: Using with MCP clients
3 -image: "https://og.composio.dev/api/og?title=Using%20with%20MCP%20Clients"
4 -description: "Use Tool Router as an MCP server with any MCP client"
5 -keywords: "tool router, mcp, model context protocol, claude agent sdk, vercel ai"
6 ----
7 -
8 -Every Tool Router session provides a unique MCP server URL. This URL exposes the exact session you created - with the specific user, toolkits, and auth configs you configured. Any MCP client that supports HTTP transport can connect using just the URL and your API key.
9 -
10 -## Examples for popular frameworks
11 -
12 -Jump to examples for:
13 -- [Claude Agent SDK](#claude-agent-sdk) - Python, TypeScript
14 -- [OpenAI Agents SDK](#openai-agents-sdk) - Python, TypeScript
15 -- [Vercel AI SDK](#vercel-ai-sdk) - TypeScript
16 -
17 -## Claude Agent SDK
18 -
19 -### Installation
20 -
21 -<CodeGroup>
22 -```bash title="Python" for="python"
23 -pip install python-dotenv composio claude-agent-sdk
24 -```
25 -```bash title="TypeScript" for="typescript"
26 -npm install dotenv @composio/core @anthropic-ai/claude-agent-sdk
27 -```
28 -</CodeGroup>
29 -
30 -### Usage
31 -
32 -Create a Tool Router session and execute tasks with Claude:
33 -
34 -<Info>
35 -- Set your `COMPOSIO_API_KEY` environment variable with your API key from [Settings](https://platform.composio.dev/?next_page=/settings).
36 -- Set your `ANTHROPIC_API_KEY` environment variable with your [Anthropic API key](https://platform.claude.com/settings/keys).
37 -</Info>
38 -
39 -<CodeGroup>
40 -<SnippetCode src="fern/snippets/tool-router/python/mcp-claude.py" title="Python" for="python" />
41 -<SnippetCode src="fern/snippets/tool-router/typescript/mcp-claude.ts" title="TypeScript" for="typescript" />
42 -</CodeGroup>
43 -
44 -## OpenAI Agents SDK
45 -
46 -### Installation
47 -
48 -<CodeGroup>
49 -```bash title="Python" for="python"
50 -pip install python-dotenv composio openai-agents
51 -```
52 -```bash title="TypeScript" for="typescript"
53 -npm install dotenv @composio/core @openai/agents zod@3
54 -```
55 -</CodeGroup>
56 -
57 -### Usage
58 -
59 -Create a Tool Router session and execute tasks with OpenAI agents:
60 -
61 -<Info>
62 -- Set `COMPOSIO_API_KEY` environment variable with your API key from [Settings](https://platform.composio.dev/?next_page=/settings).
63 -- Set `OPENAI_API_KEY` environment variable with your [OpenAI API key](https://platform.openai.com/api-keys).
64 -</Info>
65 -
66 -<CodeGroup>
67 -<SnippetCode src="fern/snippets/tool-router/python/mcp-openai.py" title="Python" for="python" />
68 -<SnippetCode src="fern/snippets/tool-router/typescript/mcp-openai.ts" title="TypeScript" for="typescript" />
69 -</CodeGroup>
70 -
71 -## Vercel AI SDK
72 -
73 -### Installation
74 -
75 -```bash
76 -npm install dotenv @composio/core ai @ai-sdk/anthropic @ai-sdk/mcp
77 -```
78 -
79 -### Usage
80 -
81 -Use Tool Router with Vercel AI SDK's `generateText` for single completions:
82 -
83 -<Info>
84 -- Set `COMPOSIO_API_KEY` environment variable with your API key from [Settings](https://platform.composio.dev/?next_page=/settings).
85 -- Set `ANTHROPIC_API_KEY` environment variable with your [Anthropic API key](https://platform.claude.com/settings/keys).
86 -</Info>
87 -
88 -<SnippetCode src="fern/snippets/tool-router/typescript/mcp-vercel.ts" />
\ No newline at end of file
fern/pages/src/tool-router/white-labeling-authentication.mdx deleted
-145
@@ -1,145 +0,0 @@
1 ----
2 -title: White-labeling authentication
3 -image: "https://og.composio.dev/api/og?title=White-labeling%20Authentication"
4 -description: "Use your own OAuth apps and branded auth screens"
5 -keywords: "tool router, white-label, oauth, custom auth, branding"
6 ----
7 -
8 -White-labeling lets you use your own OAuth apps instead of Composio's. Users will see your app name on consent screens instead of "Composio".
9 -
10 -By default, OAuth screens show Composio's branding:
11 -
12 -<Frame>
13 - <img src="../../../assets/images/oauth-composio-branding.png" />
14 -</Frame>
15 -
16 -With white-labeling, they'll see your app name and logo.
17 -
18 -<Steps>
19 -<Step title="Create an OAuth app">
20 -Create a developer app in the toolkit's developer portal. You'll need the client ID and client secret. Set the callback URL to:
21 -
22 -```
23 -https://backend.composio.dev/api/v3/toolkits/auth/callback
24 -```
25 -
26 -<Tip>
27 -For step-by-step guides on creating OAuth apps for some toolkits, see [composio.dev/auth](https://composio.dev/auth).
28 -</Tip>
29 -</Step>
30 -
31 -<Step title="Create auth config">
32 -Create an auth config in the [Composio dashboard](https://app.composio.dev):
33 -
34 -1. Go to **Authentication management** → **Create Auth Config**
35 -2. Select the toolkit (e.g., GitHub)
36 -3. Choose **OAuth2** scheme
37 -4. Enter your **Client ID** and **Client Secret**
38 -5. Select the scopes you need
39 -6. Click **Create**
40 -
41 -Copy the auth config ID (e.g., `ac_1234abcd`).
42 -
43 -<Tip>
44 -For detailed instructions with screenshots, see [Custom auth configs](/docs/authentication/custom-auth-configs).
45 -</Tip>
46 -</Step>
47 -
48 -<Step title="Use in Tool Router">
49 -Pass your auth config ID in the session:
50 -
51 -<CodeGroup>
52 -```python
53 -session = composio.create(
54 - user_id="user_123",
55 - auth_configs={
56 - "github": "ac_your_github_config"
57 - },
58 -)
59 -```
60 -```typescript
61 -const session = await composio.create("user_123", {
62 - authConfigs: {
63 - github: "ac_your_github_config",
64 - },
65 -});
66 -```
67 -</CodeGroup>
68 -
69 -When users connect GitHub, they'll see your OAuth app's name and logo on the consent screen.
70 -</Step>
71 -</Steps>
72 -
73 -## Mixing custom and Composio-managed auth
74 -
75 -You can white-label some toolkits while using Composio's managed credentials for others:
76 -
77 -<CodeGroup>
78 -```python
79 -session = composio.create(
80 - user_id="user_123",
81 - auth_configs={
82 - "github": "ac_your_github_config",
83 - "slack": "ac_your_slack_config",
84 - # gmail, linear, etc. use Composio managed auth
85 - },
86 -)
87 -```
88 -```typescript
89 -const session = await composio.create("user_123", {
90 - authConfigs: {
91 - github: "ac_your_github_config",
92 - slack: "ac_your_slack_config",
93 - // gmail, linear, etc. use Composio managed auth
94 - },
95 -});
96 -```
97 -</CodeGroup>
98 -
99 -## Custom redirect domain
100 -
101 -When users authenticate, they briefly see `backend.composio.dev` in their browser URL. Composio needs to receive the OAuth callback to capture and store the authentication tokens.
102 -
103 -If you need to hide this URL (for enterprise compliance or complete white-labeling), you can proxy the redirect through your own domain:
104 -
105 -1. Set your OAuth app's redirect URI to your domain:
106 -```
107 -https://yourdomain.com/api/composio-redirect
108 -```
109 -
110 -2. Create an endpoint that forwards the OAuth callback to Composio:
111 -
112 -<CodeGroup>
113 -```python
114 -from fastapi import FastAPI, Request
115 -from fastapi.responses import RedirectResponse
116 -
117 -app = FastAPI()
118 -
119 -@app.get("/api/composio-redirect")
120 -def composio_redirect(request: Request):
121 - # Forward all OAuth parameters to Composio
122 - composio_url = "https://backend.composio.dev/api/v3/toolkits/auth/callback"
123 - return RedirectResponse(url=f"{composio_url}?{request.url.query}")
124 -```
125 -```typescript
126 -// pages/api/composio-redirect.ts (Next.js)
127 -import type { NextApiRequest, NextApiResponse } from "next";
128 -
129 -export default function handler(req: NextApiRequest, res: NextApiResponse) {
130 - // Forward all OAuth parameters to Composio
131 - const composioUrl = "https://backend.composio.dev/api/v3/toolkits/auth/callback";
132 - const params = new URLSearchParams(req.query as Record<string, string>);
133 - res.redirect(302, `${composioUrl}?${params.toString()}`);
134 -}
135 -```
136 -</CodeGroup>
137 -
138 -3. Update your auth config in the Composio dashboard to use your custom redirect URI:
139 -
140 -<Frame caption="Enter your custom redirect URI in the auth config" background="subtle">
141 - <img src="../../../assets/images/tool-router/auth-config-custom-redirect.png" style={{ maxHeight: '400px', width: 'auto', display: 'block', margin: '0 auto' }} />
142 -</Frame>
143 -
144 -This makes the OAuth flow go through your domain first, then to Composio for token storage.
145 -
fern/pages/src/tools-and-triggers/after-execution-modifiers.mdx deleted
-188
@@ -1,188 +0,0 @@
1 ----
2 -title: After Execution Modifiers
3 -image: "https://og.composio.dev/api/og?title=After%20Execution%20Modifiers" # image for socials
4 -keywords: ''
5 -subtitle: 'Transform tool results after execution'
6 -hide-nav-links: false
7 ----
8 -
9 -After execution modifiers are part of Composio SDK's powerful middleware capabilities that allow you to customize and extend the behavior of tools.
10 -
11 -## After Execution Modifiers
12 -
13 -These modifiers are called after the tool is executed by the LLM. This allows you to modify the _result_ of the tool before it is returned to the agent.
14 -
15 -**Useful for:**
16 -
17 -- Modifying or truncating the output of the tool.
18 -- Converting the output to a different format before returning it to the agent.
19 -
20 -<Frame>
21 - <img src="../../../assets/images/after-execute.png" alt="After Execution Modifier" />
22 -</Frame>
23 -
24 -<Note>
25 - Below we use the `afterExecute` modifier to truncate the output of the `HACKERNEWS_GET_USER`
26 - tool and only return the karma of the user.
27 -</Note>
28 -
29 -<Tabs>
30 -<Tab title="With Chat Completions">
31 -Since completion providers don't have a function execution step -- Composio will execute the tool call directly.
32 -
33 -Hence, the modifier is configured on the `tools.execute` method.
34 -
35 -<CodeGroup>
36 -```python Python maxLines=60 wordWrap
37 -from composio import Composio, after_execute
38 -from composio.types import ToolExecutionResponse
39 -
40 -@after_execute(tools=["HACKERNEWS_GET_USER"])
41 -def after_execute_modifier(
42 - tool: str,
43 - toolkit: str,
44 - response: ToolExecutionResponse,
45 -) -> ToolExecutionResponse:
46 - return {
47 - **response,
48 - "data": {
49 - "karma": response["data"]["karma"],
50 - },
51 - }
52 -
53 -tools = composio.tools.get(user_id=user_id, slug="HACKERNEWS_GET_USER")
54 -# Get response from the LLM
55 -response = openai_client.chat.completions.create(
56 - model="gpt-4o-mini",
57 - tools=tools,
58 - messages=messages,
59 -)
60 -print(response)
61 -
62 -# Execute the function calls.
63 -result = composio.provider.handle_tool_calls(
64 - response=response,
65 - user_id="default",
66 - modifiers=[
67 - after_execute_modifier,
68 - ]
69 -)
70 -print(result)
71 -```
72 -```typescript TypeScript maxLines=60 wordWrap
73 -const response = await openai.chat.completions.create({
74 - model: "gpt-4o-mini",
75 - messages,
76 - tools,
77 - tool_choice: "auto",
78 -});
79 -
80 -const { tool_calls } = response.choices[0].message;
81 -console.log(tool_calls);
82 -
83 -if (tool_calls) {
84 - const {
85 - function: { arguments: toolArgs },
86 - } = tool_calls[0];
87 -
88 - const result = await composio.tools.execute(
89 - "HACKERNEWS_GET_USER",
90 - {
91 - userId,
92 - arguments: JSON.parse(toolArgs),
93 - },
94 - {
95 - afterExecute: ({ toolSlug, toolkitSlug, result }) => {
96 - if (toolSlug === "HACKERNEWS_GET_USER") {
97 - const { data } = result;
98 - const { karma } = data.response_data as { karma: number };
99 - return {
100 - ...result,
101 - data: { karma },
102 - };
103 - }
104 - return result;
105 - },
106 - }
107 - );
108 - console.log(JSON.stringify(result, null, 2));
109 -}
110 -
111 -```
112 -
113 -</CodeGroup>
114 -</Tab>
115 -
116 -<Tab title="With Agentic Frameworks">
117 -Agentic providers have a function execution step.
118 -The modifier is configured on the `tools.get` method which modifies the execution logic within the framework!
119 -<CodeGroup>
120 -```python Python (CrewAI) maxLines=60 wordWrap
121 -from composio import Composio, after_execute
122 -from composio.types import ToolExecutionResponse
123 -from composio_crewai import CrewAIProvider
124 -
125 -composio = Composio(provider=CrewAIProvider())
126 -
127 -@after_execute(tools=["HACKERNEWS_GET_USER"])
128 -def after_execute_modifier(
129 - tool: str,
130 - toolkit: str,
131 - response: ToolExecutionResponse,
132 -) -> ToolExecutionResponse:
133 - return {
134 - **response,
135 - "data": {
136 - "karma": response["data"]["karma"],
137 - },
138 - }
139 -
140 -
141 -tools = composio.tools.get(
142 - user_id="default",
143 - slug="HACKERNEWS_GET_USER",
144 - modifiers=[
145 - after_execute_modifier,
146 - ]
147 -)
148 -```
149 -```typescript TypeScript (Vercel) maxLines=60 wordWrap {24-27}
150 -import { Composio } from "@composio/core";
151 -import { VercelProvider } from "@composio/vercel";
152 -import { generateText } from "ai";
153 -import { openai } from "@ai-sdk/openai";
154 -import { v4 as uuidv4 } from "uuid";
155 -
156 -const composio = new Composio({
157 - apiKey: process.env.COMPOSIO_API_KEY,
158 - provider: new VercelProvider(),
159 -});
160 -
161 -const userId = uuidv4(); // The user's ID.
162 -
163 -const agenticTools = await composio.tools.get(
164 - userId,
165 - {
166 - tools: ["HACKERNEWS_GET_USER"],
167 - },
168 - {
169 - afterExecute: ({ toolSlug, toolkitSlug, result }) => {
170 - if (toolSlug === "HACKERNEWS_GET_USER") {
171 - const {
172 - data: { response_data: { karma } = {} } = {},
173 - } = result;
174 - return {
175 - ...result,
176 - data: { karma },
177 - };
178 - }
179 - return result;
180 - },
181 - }
182 -);
183 -
184 -```
185 -
186 -</CodeGroup>
187 -</Tab>
188 -</Tabs>
fern/pages/src/tools-and-triggers/authenticating-tools.mdx deleted
-423
@@ -1,423 +0,0 @@
1 ----
2 -title: Authenticating Tools
3 -image: "https://og.composio.dev/api/og?title=Authenticating%20Tools" # image for socials
4 -keywords: 'auth config, authentication, oauth, api key, user authentication'
5 -subtitle: 'Create auth configs and connect user accounts'
6 -hide-nav-links: false
7 ----
8 -
9 -The first step in authenticating your Users is to create an **Auth Config**. Every toolkit has its own _authentication method_ such as **OAuth**, **API key**, **Basic Auth**, or custom schemes.
10 -
11 -An **Auth Config** is a _blueprint_ that defines how authentication works for a toolkit across all your users. It defines:
12 -
13 -1. **Authentication method** - _OAuth2_, _Bearer token_, _API key_, or _Basic Auth_
14 -2. **Scopes** - _what actions your tools can perform_
15 -3. **Credentials** - _whether you'll use your own app credentials or Composio's managed auth_
16 -
17 -<Frame>
18 - <img src="../../../assets/images/executingtools.png" alt="Composio introduction image" />
19 -</Frame>
20 -
21 -## Creating an auth config
22 -
23 -### Using the Dashboard
24 -
25 -<Steps>
26 - <Step title="**Selecting a toolkit**">
27 - Navigate to <a target="_blank"href="https://platform.composio.dev?next_page=%2Fauth-configs"target="_blank">Auth Configs</a> tab in your dashboard and click "**Create Auth Config**". Find and select the toolkit you want to integrate (e.g., **Gmail**, **Slack**, **GitHub**).
28 - </Step>
29 - <Step title="**Selecting the Authentication method**">
30 - Each toolkit supports different authentication methods such as **OAuth**, **API Key**, **Bearer
31 - Token**. Select from the available options for your toolkit.
32 - </Step>
33 - <Step title="**Configure scopes**">
34 - Depending on your authentication method, you may need to configure scopes:
35 - - **OAuth2**: Configure scopes for what data and actions your integration can access.
36 - - **API Key/Bearer Token**: Permissions are typically fixed based on the key's access level.
37 - </Step>
38 - <Step title="**Authentication Management**">
39 - **For OAuth toolkits:**
40 - - **Development/Testing**: Use Composio's managed authentication (no setup required)
41 - - **Production**: Generate your own OAuth credentials from the toolkit's developer portal
42 -
43 - **For custom authentication schemes:**
44 -
45 - You must provide your own credentials regardless of environment.
46 -
47 - <Tip>
48 - Want to remove Composio branding from OAuth screens? See [Custom Auth Configs](/docs/custom-auth-configs#white-labeling-the-oauth-consent-screen) for white-labeling options.
49 - </Tip>
50 - </Step>
51 - <Step title="**You are all set!**">
52 - Click "**Create Auth Configuration**" button and you have completed your first step! Now you can
53 - move ahead to authenticating your users by [Connecting an Account](#connecting-an-account).
54 - </Step>
55 -</Steps>
56 -
57 -<Note title="Auth configs are reusable">
58 - Auth configs contain your developer credentials and app-level settings (*scopes*, *authentication
59 - method*, etc.). Once created, you can reuse the same auth config for all your users.
60 -</Note>
61 -
62 -### When to create multiple auth configs?
63 -
64 -You should create multiple auth configs for the same toolkit when you need:
65 -
66 -- **Different authentication methods** - One OAuth config and one API key config
67 -- **Different scopes** - Separate configs for read-only vs full access
68 -- **Different OAuth apps** - Using separate client credentials for different environments
69 -- **Different permission levels** - Limiting actions for specific use cases
70 -
71 -<CardGroup cols={2}>
72 -<Card title="Programmatic creation" href="/docs/programmatic-auth-configs" icon="fa-light fa-code">
73 - For managing auth configs across multiple projects, you can create them programmatically via the
74 - API
75 -</Card>
76 -<Card title="Production white-labeling" href="/docs/custom-auth-configs#white-labeling-the-oauth-consent-screen" icon="fa-light fa-palette">
77 - Remove Composio branding from OAuth screens for a fully white-labeled authentication experience
78 -</Card>
79 -</CardGroup>
80 -
81 -## Connecting an account
82 -
83 -With an auth config created, you're ready to authenticate your users!
84 -
85 -You can either use [**Connect Link**](#hosted-authentication-connect-link) for a hosted authentication flow, or use [**Direct SDK Integration**](#direct-sdk-integration).
86 -
87 -<Note>
88 -User authentication requires a User ID - a unique identifier that groups connected accounts together. Learn more about [User Management](/docs/user-management) to understand how to structure User IDs for your application.
89 -</Note>
90 -
91 -**Choose the section below that matches your toolkit's authentication method:**
92 -
93 -### Hosted Authentication (Connect Link)
94 -
95 -Redirect users to a Composio-hosted URL that handles the entire authentication process—OAuth flows, API key collection, or custom fields like subdomain. You can specify a callback URL to control where users return after authentication.
96 -
97 -<Frame caption="Connect Link authentication screen">
98 - <img
99 - src="../../../assets/images/auth-screen-example.png"
100 - alt="Composio authentication screen showing Gmail connection"
101 - style={{ maxWidth: '350px', maxHeight: '400px', width: 'auto', height: 'auto', margin: '0 auto', display: 'block' }}
102 - />
103 -</Frame>
104 -
105 -<CodeGroup>
106 -<SnippetCode
107 - src="fern/snippets/authentication/python/connect-link.py"
108 - title="Python"
109 - startLine={1}
110 - endLine={22}
111 - highlightStart={11}
112 - highlightEnd={15}
113 -/>
114 -
115 -<SnippetCode
116 - src="fern/snippets/authentication/typescript/connect-link.ts"
117 - title="TypeScript"
118 - startLine={1}
119 - endLine={19}
120 - highlightStart={11}
121 - highlightEnd={13}
122 -/>
123 -</CodeGroup>
124 -
125 -#### Customizing Connect Link
126 -
127 -By default, users will see a Composio-branded authentication experience when connecting their accounts. To customize this interface with your application's branding:
128 -
129 -1. Navigate to your Project Settings and select [Auth Screen](https://platform.composio.dev?next_page=/settings/auth-screen)
130 -2. Configure your **Logo** and **App Title**
131 -
132 -These settings will apply to all authentication flows using Connect Link, providing a white-labeled experience that maintains your brand identity throughout the authentication process.
133 -
134 -<Note>
135 -For complete white-labeling including OAuth consent screens (removing Composio's domain), see [Custom Auth Configs - White-labeling](/docs/custom-auth-configs#white-labeling-the-oauth-consent-screen).
136 -</Note>
137 -
138 -
139 -
140 -### Direct SDK Integration
141 -
142 -**Choose the section below that matches your toolkit's authentication method:**
143 -
144 -#### OAuth Connections
145 -
146 -For OAuth flows, you'll redirect users to complete authorization. You can specify a callback URL to control
147 -where users return after authentication:
148 -
149 -<CodeGroup>
150 -```python Python {11-16}
151 -from composio import Composio
152 -
153 -composio = Composio(api_key="YOUR_COMPOSIO_API_KEY")
154 -
155 -# Use the "AUTH CONFIG ID" from your dashboard
156 -auth_config_id = "your_auth_config_id"
157 -
158 -# Use a unique identifier for each user in your application
159 -user_id = "user-1349-129-12"
160 -
161 -connection_request = composio.connected_accounts.initiate(
162 - user_id=user_id,
163 - auth_config_id=auth_config_id,
164 - config={"auth_scheme": "OAUTH2"},
165 - callback_url="https://www.yourapp.com/callback"
166 -)
167 -print(f"Redirect URL: {connection_request.redirect_url}")
168 -
169 -connected_account = connection_request.wait_for_connection()
170 -
171 -# Alternative: if you only have the connection request ID
172 -# connected_account = composio.connected_accounts.wait_for_connection(
173 -# connection_request.id)
174 -# Recommended when the connection_request object is no longer available
175 -
176 -print(f"Connection established: {connected_account.id}")
177 -
178 -````
179 -
180 -```typescript {10-16}
181 -import { Composio } from '@composio/core';
182 -
183 -const composio = new Composio({apiKey: "YOUR_COMPOSIO_API_KEY"});
184 -
185 -// Use the "AUTH CONFIG ID" from your dashboard
186 -const authConfigId = 'your_auth_config_id';
187 -// Use a unique identifier for each user in your application
188 -const userId = 'user_4567';
189 -
190 -const connRequest = await composio.connectedAccounts.initiate(
191 - userId,
192 - authConfigId,
193 - {
194 - callbackUrl: 'https://www.yourapp.com/callback',
195 - }
196 -);
197 -console.log(`Redirect URL: ${connRequest.redirectUrl}`);
198 -
199 -const connectedAccount = await connRequest.waitForConnection();
200 -
201 -// Alternative: if you only have the connection request ID
202 -// const connectedAccount = await composio.connectedAccounts
203 -// .waitForConnection(connRequest.id);
204 -// Recommended when the connRequest object is no longer available
205 -
206 -console.log(`Connection established: ${connectedAccount.id}`);
207 -````
208 -
209 -</CodeGroup>
210 -
211 -#### Services with Additional Parameters
212 -
213 -Some services like Zendesk require additional parameters such as `subdomain`:
214 -
215 -<CodeGroup>
216 -```python
217 -# For Zendesk - include subdomain
218 -connection_request = composio.connected_accounts.initiate(
219 - user_id=user_id,
220 - auth_config_id=auth_config_id,
221 - config=auth_scheme.oauth2(subdomain="mycompany") # For mycompany.zendesk.com
222 -)
223 -```
224 -
225 -```typescript
226 -import { AuthScheme } from '@composio/core';
227 -// For Zendesk - include subdomain
228 -const connRequest = await composio.connectedAccounts.initiate(userId, authConfigId, {
229 - config: AuthScheme.OAuth2({
230 - subdomain: 'mycompany',
231 - }),
232 -});
233 -```
234 -
235 -</CodeGroup>
236 -
237 -#### API Key Connections
238 -
239 -For API key authentication, you can either _collect API keys from each user_ or _use your own API key_ for all users. Popular Toolkits that use API Keys include Stripe, Perplexity etc.
240 -
241 -Here is how to initiate the flow:
242 -
243 -<CodeGroup>
244 -```python {16-22}
245 -from composio import Composio
246 -
247 -composio = Composio(api_key="your_api_key")
248 -
249 -# Use the "AUTH CONFIG ID" from your dashboard
250 -auth_config_id = "your_auth_config_id"
251 -
252 -# Use a unique identifier for each user in your application
253 -user_id = "user_12323"
254 -
255 -# API key provided by the user (collected from your app's UI)
256 -# or use your own key
257 -user_api_key = "user_api_key_here"
258 -
259 -connection_request = composio.connected_accounts.initiate(
260 - user_id=user_id,
261 - auth_config_id=auth_config_id,
262 - config={
263 - "auth_scheme": "API_KEY", "val": {"api_key": user_api_key}
264 - }
265 -)
266 -
267 -print(f"Connection established: {connection_request.id}")
268 -
269 -````
270 -
271 -```typescript {12-16}
272 -import { Composio, AuthScheme } from '@composio/core';
273 -
274 -const composio = new Composio({ apiKey: 'your_api_key' });
275 -
276 -// Use the "AUTH CONFIG ID" from your dashboard
277 -const authConfigId = 'your_auth_config_id';
278 -// Use a unique identifier for each user in your application
279 -const userId = 'user12345678';
280 -// API key provided by the user (collected from your app's UI)
281 -const userApiKey = 'user_api_key_here';
282 -
283 -const connectionRequest = await composio.connectedAccounts.initiate(userId, authConfigId, {
284 - config: AuthScheme.APIKey({
285 - api_key: userApiKey,
286 - }),
287 -});
288 -
289 -console.log(`Connection established: ${connectionRequest.id}`);
290 -````
291 -
292 -</CodeGroup>
293 -
294 -## Fetching the required `config` parameters for an Auth Config
295 -
296 -When working with any toolkits, you can **inspect an auth config** to understand its _authentication requirements_ and _expected parameters_.
297 -
298 -Here is how you would fetch the authentication method and input fields:
299 -
300 -<CodeGroup>
301 -```python {9}
302 -from composio import Composio
303 -
304 -composio = Composio(api_key="your_api_key")
305 -
306 -# Use the "AUTH CONFIG ID" from your dashboard
307 -auth_config_id = "your_auth_config_id"
308 -
309 -# Fetch the auth configuration details
310 -auth_config = composio.auth_configs.get(auth_config_id)
311 -
312 -# Check what authentication method this config uses
313 -print(f"Authentication method: {auth_config.auth_scheme}")
314 -
315 -# See what input fields are required
316 -print(f"Required fields: {auth_config.expected_input_fields}")
317 -
318 -````
319 -
320 -```typescript {9}
321 -import { Composio } from '@composio/core';
322 -
323 -const composio = new Composio({ apiKey: 'your_api_key' });
324 -
325 -// Use the "AUTH CONFIG ID" from your dashboard
326 -const authConfigId = 'your_auth_config_id';
327 -
328 -// Fetch the auth configuration details
329 -const authConfig = await composio.authConfigs.get(authConfigId);
330 -
331 -console.log(`Authentication method: ${authConfig.authScheme}`);
332 -console.log(`Required fields:`, authConfig.expectedInputFields);
333 -````
334 -
335 -</CodeGroup>
336 -
337 -## Other Authentication Methods
338 -
339 -Composio also supports a wide range of other auth schemas:
340 -
341 -**Bearer Token** - Similar to API keys, provide the user's bearer token directly when creating the connection.
342 -
343 -**Basic Auth** - Provide username and password credentials for services that use HTTP Basic Authentication.
344 -
345 -**Custom Schemes** - Some toolkits use their own custom authentication methods. Follow the toolkit-specific requirements for such cases.
346 -
347 -<Note title="Fetching auth config">
348 - For any of these methods, [fetch the config
349 - parameter](#fetching-the-required-config-parameters-for-an-auth-config) to determine the exact
350 - fields required. Every toolkit has its own requirements, and understanding these is essential for
351 - successfully creating connections.
352 -</Note>
353 -
354 -Learn how to [Manage connected accounts](/docs/connected-accounts) after users authenticate.
355 -
356 -## Connection Statuses
357 -
358 -After creating a connection, it will have one of the following statuses that indicates its current state:
359 -
360 -| Status | Description |
361 -|--------|-------------|
362 -| **ACTIVE** | Connection is established and working. You can execute tools with this connection. |
363 -| **INACTIVE** | Connection is temporarily disabled. Re-enable it to use the connection again. |
364 -| **PENDING** | Connection is being processed. Wait for it to become active. |
365 -| **INITIATED** | Connection request has started but not yet completed. User may still need to complete authentication. |
366 -| **EXPIRED** | Connection credentials have expired. Composio automatically attempts to refresh credentials before marking as expired. Re-authenticate to restore access. |
367 -| **FAILED** | Connection attempt failed. Check error details and try creating a new connection. |
368 -
369 -<Note>
370 -When credentials expire for OAuth connections, Composio automatically attempts to refresh them using the refresh token. The connection is only marked as **EXPIRED** after multiple refresh attempts have failed.
371 -</Note>
372 -
373 -### Waiting for Connection Establishment
374 -
375 -The `waitForConnection` method allows you to poll for a connection to become active after initiating authentication. This is useful when you need to ensure a connection is ready before proceeding.
376 -
377 -<CodeGroup>
378 -<SnippetCode
379 - src="fern/snippets/authentication/python/connect-link.py"
380 - title="Python"
381 - startLine={20}
382 - endLine={29}
383 -/>
384 -
385 -<SnippetCode
386 - src="fern/snippets/authentication/typescript/connect-link.ts"
387 - title="TypeScript"
388 - startLine={17}
389 - endLine={26}
390 -/>
391 -</CodeGroup>
392 -
393 -The method continuously polls the Composio API until the connection:
394 -- Becomes **ACTIVE** (returns the connected account)
395 -- Enters a terminal state like **FAILED** or **EXPIRED** (throws an error)
396 -- Exceeds the specified timeout (throws a timeout error)
397 -
398 -### Checking Connection Status
399 -
400 -You can check the status of a connected account programmatically:
401 -
402 -<CodeGroup>
403 -<SnippetCode
404 - src="fern/snippets/tool-calling/python/checking-connection-status.py"
405 - title="Python"
406 - startLine={5}
407 - endLine={16}
408 -/>
409 -<SnippetCode
410 - src="fern/snippets/tool-calling/typescript/checking-connection-status.ts"
411 - title="Typescript"
412 - startLine={5}
413 - endLine={17}
414 -/>
415 -</CodeGroup>
416 -
417 -<Note>
418 -Only connections with **ACTIVE** status can be used to execute tools. If a connection is in any other state, you'll need to take appropriate action (re-authenticate, wait for processing, etc.) before using it.
419 -</Note>
420 -
421 -## Next Step
422 -
423 -With authentication set up, you can now fetch and execute tools. See [Executing Tools](/docs/executing-tools) to get started.
fern/pages/src/tools-and-triggers/before-execution-modifiers.mdx deleted
-193
@@ -1,193 +0,0 @@
1 ----
2 -title: Before Execution Modifiers
3 -image: "https://og.composio.dev/api/og?title=Before%20Execution%20Modifiers" # image for socials
4 -keywords: ''
5 -subtitle: 'Modify tool arguments before execution'
6 -hide-nav-links: false
7 ----
8 -
9 -Before execution modifiers are part of Composio SDK's powerful middleware capabilities that allow you to customize and extend the behavior of tools.
10 -
11 -## Before Execution Modifiers
12 -
13 -These modifiers are called before the tool is executed by the LLM. This allows you to modify the _arguments_ called by the LLM before they are executed by Composio.
14 -
15 -**Useful for:**
16 -
17 -- Injecting an argument into the tool execution.
18 -- Overriding the arguments emitted by the LLM.
19 -
20 -<Frame>
21 - <img src="../../../assets/images/before-execute.png" alt="Before Execution Modifier" />
22 -</Frame>
23 -
24 -<Note>
25 - Below we use the `beforeExecute` modifier to modify the number of posts returned by the
26 - `HACKERNEWS_GET_LATEST_POSTS` tool.
27 -</Note>
28 -
29 -<Tabs>
30 -<Tab title="With Chat Completions">
31 -Since completion providers don't have a function execution step -- Composio will execute the tool call directly.
32 -
33 -Hence, the modifier is configured on the `tools.execute` method.
34 -
35 -<CodeGroup>
36 -```python Python maxLines=60 wordWrap
37 -from openai import OpenAI
38 -from composio import Composio, before_execute
39 -from composio.types import ToolExecuteParams
40 -
41 -composio = Composio()
42 -openai_client = OpenAI()
43 -user_id = "user@email.com"
44 -
45 -@before_execute(tools=["HACKERNEWS_GET_LATEST_POSTS"])
46 -def before_execute_modifier(
47 - tool: str,
48 - toolkit: str,
49 - params: ToolExecuteParams,
50 -) -> ToolExecuteParams:
51 - params["arguments"]["size"] = 1
52 - return params
53 -
54 -
55 -# Get tools
56 -tools = composio.tools.get(user_id=user_id, slug="HACKERNEWS_GET_LATEST_POSTS")
57 -
58 -# Get response from the LLM
59 -response = openai_client.chat.completions.create(
60 - model="gpt-4o-mini",
61 - tools=tools,
62 - messages=[{"role": "user", "content": "Fetch latest posts from hackernews"}],
63 -)
64 -print(response)
65 -
66 -# Execute the function calls.
67 -result = composio.provider.handle_tool_calls(
68 - response=response,
69 - user_id="default",
70 - modifiers=[
71 - before_execute_modifier,
72 - ],
73 -)
74 -print(result)
75 -```
76 -```typescript TypeScript maxLines=60 wordWrap {11, 20-28}
77 -const response = await openai.chat.completions.create({
78 - model: "gpt-4o-mini",
79 - messages,
80 - tools,
81 - tool_choice: "auto",
82 -});
83 -
84 -const { tool_calls } = response.choices[0].message;
85 -console.log(tool_calls);
86 -
87 -if (tool_calls) {
88 - const {
89 - function: { arguments: toolArgs },
90 - } = tool_calls[0];
91 -
92 - const result = await composio.tools.execute(
93 - "HACKERNEWS_GET_LATEST_POSTS",
94 - {
95 - userId,
96 - arguments: JSON.parse(toolArgs),
97 - },
98 - {
99 - beforeExecute: ({ toolSlug, toolkitSlug, params }) => {
100 - if (toolSlug === "HACKERNEWS_GET_LATEST_POSTS") {
101 - params.arguments.size = 1;
102 - }
103 - console.log(params);
104 - return params;
105 - },
106 - }
107 - );
108 - console.log(JSON.stringify(result, null, 2));
109 -}
110 -
111 -```
112 -
113 -</CodeGroup>
114 -</Tab>
115 -
116 -<Tab title="With Agentic Frameworks">
117 -Agentic providers have a function execution step.
118 -The modifier is configured on the `tools.get` method which modifies the execution logic within the framework!
119 -
120 -<CodeGroup>
121 -```python Python (CrewAI) maxLines=60 wordWrap
122 -from composio import Composio, before_execute
123 -from composio.types import ToolExecuteParams
124 -from composio_crewai import CrewAIProvider
125 -
126 -composio = Composio(provider=CrewAIProvider())
127 -
128 -@before_execute(tools=["LINEAR_CREATE_LINEAR_ISSUE"])
129 -def modify_linear_project_id(
130 - tool: str,
131 - toolkit: str,
132 - params: ToolExecuteParams,
133 -) -> ToolExecuteParams:
134 - params["arguments"]["project_id"] = "1234567890"
135 - return params
136 -
137 -tools = composio.tools.get(
138 - user_id="default",
139 - tools=[
140 - "HACKERNEWS_GET_LATEST_POSTS",
141 - "HACKERNEWS_GET_USER",
142 - "LINEAR_CREATE_LINEAR_ISSUE",
143 - ],
144 - modifiers=[
145 - modify_linear_project_id,
146 - ]
147 -)
148 -```
149 -```typescript TypeScript (Mastra) maxLines=60 wordWrap {22-26}
150 -import { Composio } from "@composio/core";
151 -import { MastraProvider } from "@composio/mastra";
152 -import { Agent } from "@mastra/core/agent";
153 -
154 -const composio = new Composio({
155 - apiKey: process.env.COMPOSIO_API_KEY,
156 - provider: new MastraProvider(),
157 -});
158 -
159 -const userId = "user@acme.com"; // The user's ID.
160 -
161 -const agenticTools = await composio.tools.get(
162 - userId,
163 - {
164 - tools: [
165 - "HACKERNEWS_GET_LATEST_POSTS",
166 - "HACKERNEWS_GET_USER",
167 - "LINEAR_CREATE_LINEAR_ISSUE",
168 - ],
169 - },
170 - {
171 - beforeExecute: ({toolSlug, toolkitSlug, params}) => {
172 - if (toolSlug === "LINEAR_CREATE_LINEAR_ISSUE") {
173 - params.arguments.project_id = "1234567890";
174 - }
175 - return params;
176 - },
177 - }
178 -);
179 -
180 -const { text } = await generateText({
181 - model: openai("gpt-4o-mini"),
182 - messages: [
183 - { role: "user", content: "Create an issue to `sid` to add RLS" },
184 - ],
185 - tools: agenticTools,
186 - maxSteps: 5,
187 -});
188 -
189 -```
190 -
191 -</CodeGroup>
192 -</Tab>
193 -</Tabs>
fern/pages/src/tools-and-triggers/custom-tools.mdx deleted
-330
@@ -1,330 +0,0 @@
1 ----
2 -title: Creating custom tools
3 -image: "https://og.composio.dev/api/og?title=Creating%20custom%20tools" # image for socials
4 -keywords: ''
5 -subtitle: "Learn how to extend Composio's toolkits with your own tools"
6 -hide-nav-links: false
7 ----
8 -
9 -Custom tools allow you to create your own tools that can be used with Composio.
10 -
11 -1. Standalone tools - Simple tools that don't require any authentication
12 -2. Toolkit-based tools - Tools that require authentication and can use toolkit credentials
13 -
14 -## Creating a Custom Tool
15 -
16 -### Standalone Tool
17 -
18 -A standalone tool is the simplest form of custom tool. It only requires input parameters and an execute function:
19 -
20 -<CodeGroup>
21 -```python Python maxLines=60 wordWrap
22 -from pydantic import BaseModel, Field
23 -
24 -from composio import Composio
25 -from composio.types import ExecuteRequestFn
26 -
27 -composio = Composio()
28 -
29 -
30 -class AddTwoNumbersInput(BaseModel):
31 - a: int = Field(
32 - ...,
33 - description="The first number to add",
34 - )
35 - b: int = Field(
36 - ...,
37 - description="The second number to add",
38 - )
39 -
40 -# function name will be used as slug
41 -@composio.tools.custom_tool
42 -def add_two_numbers(request: AddTwoNumbersInput) -> int:
43 - """Add two numbers."""
44 - return request.a + request.b
45 -```
46 -```typescript TypeScript maxLines=60 wordWrap
47 -const tool = await composio.tools.createCustomTool({
48 - slug: 'CALCULATE_SQUARE',
49 - name: 'Calculate Square',
50 - description: 'Calculates the square of a number',
51 - inputParams: z.object({
52 - number: z.number().describe('The number to calculate the square of'),
53 - }),
54 - execute: async input => {
55 - const { number } = input;
56 - return {
57 - data: { result: number * number },
58 - error: null,
59 - successful: true,
60 - };
61 - },
62 -});
63 -```
64 -</CodeGroup>
65 -
66 -### Toolkit-based Tool
67 -
68 -A toolkit-based tool has access to two ways of making authenticated requests:
69 -
70 -1. Using `executeToolRequest` - The recommended way to make authenticated requests to the toolkit's API endpoints. Composio automatically handles credential injection and baseURL resolution:
71 -
72 -<CodeGroup>
73 -```python Python maxLines=60 wordWrap
74 -class GetIssueInfoInput(BaseModel):
75 - issue_number: int = Field(
76 - ...,
77 - description="The number of the issue to get information about",
78 - )
79 -
80 -# function name will be used as slug
81 -@composio.tools.custom_tool(toolkit="github")
82 -def get_issue_info(
83 - request: GetIssueInfoInput,
84 - execute_request: ExecuteRequestFn,
85 - auth_credentials: dict,
86 -) -> dict:
87 - """Get information about a GitHub issue."""
88 - response = execute_request(
89 - endpoint=f"/repos/composiohq/composio/issues/{request.issue_number}",
90 - method="GET",
91 - parameters=[
92 - {
93 - "name": "Accept",
94 - "value": "application/vnd.github.v3+json",
95 - "type": "header",
96 - },
97 - {
98 - "name": "Authorization",
99 - "value": f"Bearer {auth_credentials['access_token']}",
100 - "type": "header",
101 - },
102 - ],
103 - )
104 - return {"data": response.data}
105 -```
106 -```typescript TypeScript maxLines=60 wordWrap
107 -const tool = await composio.tools.createCustomTool({
108 - slug: 'GITHUB_STAR_COMPOSIOHQ_REPOSITORY',
109 - name: 'Github star composio repositories',
110 - toolkitSlug: 'github',
111 - description: 'Star any specified repo of `composiohq` user',
112 - inputParams: z.object({
113 - repository: z.string().describe('The repository to star'),
114 - page: z.number().optional().describe('Pagination page number'),
115 - customHeader: z.string().optional().describe('Custom header'),
116 - }),
117 - execute: async (input, connectionConfig, executeToolRequest) => {
118 - // This method makes authenticated requests to the relevant API
119 - // You can use relative paths!
120 - // Composio will automatically inject the baseURL
121 - const result = await executeToolRequest({
122 - endpoint: `/user/starred/composiohq/${input.repository}`,
123 - method: 'PUT',
124 - body: {},
125 - // Add custom headers or query parameters
126 - parameters: [
127 - // Add query parameters
128 - {
129 - name: 'page',
130 - value: input.page?.toString() || '1',
131 - in: 'query',
132 - },
133 - // Add custom headers
134 - {
135 - name: 'x-custom-header',
136 - value: input.customHeader || 'default-value',
137 - in: 'header',
138 - },
139 - ],
140 - });
141 - return result;
142 - },
143 -});
144 -```
145 -
146 -</CodeGroup>
147 -
148 -2. Using `connectionConfig` - For making direct API calls when needed:
149 -
150 -<CodeGroup>
151 -```python Python maxLines=60 wordWrap
152 -import requests
153 -
154 -@composio.tools.custom_tool(toolkit="github")
155 -def get_issue_info_direct(
156 - request: GetIssueInfoInput,
157 - execute_request: ExecuteRequestFn,
158 - auth_credentials: dict,
159 -) -> dict:
160 - """Get information about a GitHub issue."""
161 - response = requests.get(
162 - f"https://api.github.com/repos/composiohq/composio/issues/{request.issue_number}",
163 - headers={
164 - "Accept": "application/vnd.github.v3+json",
165 - "Authorization": f"Bearer {auth_credentials['access_token']}",
166 - },
167 - )
168 - return {"data": response.json()}
169 -```
170 -```typescript TypeScript maxLines=60 wordWrap
171 -const tool = await composio.tools.createCustomTool({
172 - slug: 'GITHUB_DIRECT_API',
173 - name: 'Direct GitHub API Call',
174 - description: 'Makes direct calls to GitHub API',
175 - toolkitSlug: 'github',
176 - inputParams: z.object({
177 - repo: z.string().describe('Repository name'),
178 - }),
179 - execute: async (input, connectionConfig, executeToolRequest) => {
180 - // Use connectionConfig for direct API calls
181 - const result = await fetch(`https://api.github.com/repos/${input.repo}`, {
182 - headers: {
183 - Authorization: `Bearer ${connectionConfig.access_token}`,
184 - },
185 - });
186 -
187 - return {
188 - data: await result.json(),
189 - error: null,
190 - successful: true,
191 - };
192 -
193 -},
194 -});
195 -
196 -```
197 -</CodeGroup>
198 -
199 -### Using Custom Headers and Query Parameters
200 -
201 -You can add custom headers and query parameters to your toolkit-based tools using the `parameters` option in `executeToolRequest`:
202 -
203 -<CodeGroup>
204 -```python Python maxLines=60 wordWrap
205 -@composio.tools.custom_tool(toolkit="github")
206 -def get_issue_info(
207 - request: GetIssueInfoInput,
208 - execute_request: ExecuteRequestFn,
209 - auth_credentials: dict,
210 -) -> dict:
211 - """Get information about a GitHub issue."""
212 - response = execute_request(
213 - endpoint=f"/repos/composiohq/composio/issues/{request.issue_number}",
214 - method="GET",
215 - parameters=[
216 - {
217 - "name": "Accept",
218 - "value": "application/vnd.github.v3+json",
219 - "type": "header",
220 - },
221 - {
222 - "name": "Authorization",
223 - "value": f"Bearer {auth_credentials['access_token']}",
224 - "type": "header",
225 - },
226 - {
227 - "name": 'X-Custom-Header',
228 - "value": 'custom-value',
229 - "type": 'header',
230 - },
231 - ],
232 - )
233 - return {"data": response.data}
234 -```
235 -```typescript TypeScript maxLines=60
236 -const tool = await composio.tools.createCustomTool({
237 - slug: 'GITHUB_SEARCH_REPOSITORIES',
238 - name: 'Search GitHub Repositories',
239 - description: 'Search for repositories with custom parameters',
240 - toolkitSlug: 'github',
241 - inputParams: z.object({
242 - query: z.string().describe('Search query'),
243 - perPage: z.number().optional().describe('Results per page'),
244 - acceptType: z.string().optional().describe('Custom accept header'),
245 - }),
246 - execute: async (input, connectionConfig, executeToolRequest) => {
247 - const result = await executeToolRequest({
248 - endpoint: '/search/repositories',
249 - method: 'GET',
250 - parameters: [
251 - // Add query parameters for pagination
252 - {
253 - name: 'q',
254 - value: input.query,
255 - in: 'query',
256 - },
257 - {
258 - name: 'per_page',
259 - value: (input.perPage || 30).toString(),
260 - in: 'query',
261 - },
262 - // Add custom headers
263 - {
264 - name: 'Accept',
265 - value: input.acceptType || 'application/vnd.github.v3+json',
266 - in: 'header',
267 - },
268 - {
269 - name: 'X-Custom-Header',
270 - value: 'custom-value',
271 - in: 'header',
272 - },
273 - ],
274 - });
275 - return result;
276 - },
277 -});
278 -```
279 -</CodeGroup>
280 -
281 -## Executing Custom Tools
282 -
283 -You can execute custom tools just like any other tool:
284 -
285 -<CodeGroup>
286 -```python Python maxLines=60 wordWrap
287 -response = composio.tools.execute(
288 - user_id="default",
289 - slug="TOOL_SLUG", # For the tool above you can use `get_issue_info.slug`
290 - arguments={"issue_number": 1},
291 -)
292 -```
293 -```typescript TypeScript maxLines=60 wordWrap
294 -const result = await composio.tools.execute('TOOL_SLUG', {
295 - arguments: {
296 - // Tool input parameters
297 - },
298 - userId: 'user-id',
299 - connectedAccountId: 'optional-account-id', // Required for toolkit-based tools
300 -});
301 -```
302 -</CodeGroup>
303 -
304 -## Best Practices
305 -
306 -1. Use descriptive names and slugs for your tools
307 -2. Always provide descriptions for input parameters using `describe()`
308 -3. Handle errors gracefully in your execute function
309 -4. For toolkit-based tools:
310 - - Prefer `executeToolRequest` over direct API calls when possible
311 - - Use relative paths with `executeToolRequest` - Composio will automatically inject the correct baseURL
312 - - Use the `parameters` option to add custom headers or query parameters:
313 - ```typescript
314 - parameters: [
315 - { name: 'page', value: '1', in: 'query' }, // Adds ?page=1 to URL
316 - { name: 'x-custom', value: 'value', in: 'header' }, // Adds header
317 - ];
318 - ```
319 - - Remember that `executeToolRequest` can only call tools from the same toolkit
320 - - Use `executeToolRequest` to leverage Composio's automatic credential handling
321 - - Only use `connectionConfig` when you need to make direct API calls or interact with different services
322 -5. Chain multiple toolkit operations using `executeToolRequest` for better maintainability
323 -
324 -## Limitations
325 -
326 -1. Custom tools are stored in memory and are not persisted
327 -2. They need to be recreated when the application restarts
328 -3. Toolkit-based tools require a valid connected account with the specified toolkit
329 -4. `executeToolRequest` can only execute tools from the same toolkit that the custom tool belongs to
330 -5. Each toolkit-based tool can only use one connected account at a time
fern/pages/src/tools-and-triggers/executing-tools.mdx deleted
-174
@@ -1,174 +0,0 @@
1 ----
2 -title: Executing Tools
3 -image: "https://og.composio.dev/api/og?title=Executing%20Tools" # image for socials
4 -keywords: ''
5 -subtitle: "Learn how to execute Composio's tools with different providers and frameworks"
6 -hide-nav-links: false
7 ----
8 -
9 -LLMs on their own can only do generation. Tool calling changes that by letting them interact with external services. Instead of just drafting an email, the model can call `GMAIL_SEND_EMAIL` to actually send it. The tool's results feed back to the LLM, closing the loop so it can decide, _act,_ observe, and adapt.
10 -
11 -In Composio, every **tool** is a single API action—fully described with schema, parameters, and return type. Tools live inside **toolkits** like _Gmail, Slack, or GitHub_, and Composio handles authentication and user scoping.
12 -
13 -<Tip icon="fa-light fa-info">
14 - **User Scoping**: All tools are scoped to a specific user - that's why every example includes a
15 - `user_id`. Learn how to structure User IDs in [User Management](./user-management). Each user must authenticate with their respective services (Gmail, Calendar, etc.) - see [Authentication](./authenticating-tools)
16 -</Tip>
17 -
18 -## Using Chat Completions
19 -
20 -Use the Composio SDK with providers like OpenAI, Anthropic, and Google AI. To learn how to set-up these providers, see [Providers](/providers/openai).
21 -
22 -<CodeGroup>
23 - <SnippetCode
24 - src="fern/snippets/tool-calling/python/exec-tool-completions.py"
25 - title="Python (OpenAI)"
26 - highlightStart={32}
27 - highlightEnd={33}
28 - />
29 - <SnippetCode
30 - src="fern/snippets/tool-calling/typescript/exec-tool-completions.ts"
31 - title="TypeScript (Anthropic)"
32 - highlightStart={37}
33 - highlightEnd={38}
34 - />
35 -</CodeGroup>
36 -
37 -## Using Agentic Frameworks
38 -
39 -Agentic frameworks automatically handle the tool execution loop.
40 -Composio provides support for frameworks like this by making sure the tools are formatted into the correct objects for the agentic framework to execute.
41 -
42 -<CodeGroup>
43 - <SnippetCode
44 - src="fern/snippets/tool-calling/python/exec-tool-agentic.py"
45 - title="Python (OpenAI Agents SDK)"
46 - highlightStart={19}
47 - highlightEnd={23}
48 - />
49 - <SnippetCode
50 - src="fern/snippets/tool-calling/typescript/exec-tool-agentic.ts"
51 - title="TypeScript (Vercel AI SDK)"
52 - highlightStart={22}
53 - highlightEnd={31}
54 - />
55 -</CodeGroup>
56 -
57 -## Direct Tool execution
58 -
59 -In case you just want to call a tool without using any framework or LLM provider, you can use the `execute` method directly.
60 -
61 -<Tip icon="fa-light fa-lightbulb">
62 - **Finding tool parameters and types:**
63 -
64 - **Platform UI**: [Auth Configs](https://platform.composio.dev?next_page=/auth-configs) → Select your toolkit → Tools & Triggers → Select the tool to see its required and optional parameters
65 -
66 - **CLI**: For python and typescript projects, run `composio generate` to generate types. [Learn more →](/docs/cli#generate-type-definitions)
67 -</Tip>
68 -
69 -<CodeGroup>
70 - <SnippetCode
71 - src="fern/snippets/tool-calling/python/direct-tool-call.py"
72 - title="Python"
73 - />
74 - <SnippetCode
75 - src="fern/snippets/tool-calling/typescript/direct-tool-call.ts"
76 - title="TypeScript"
77 - />
78 -</CodeGroup>
79 -
80 -<Note>
81 -The examples above configure toolkit versions at SDK initialization. You can also pass versions per-execution or use environment variables. See [toolkit versioning](/docs/toolkit-versioning) for all configuration options.
82 -</Note>
83 -
84 -### Proxy Execute -- Manually calling toolkit APIs
85 -
86 -You can proxy requests to any supported toolkit API and let Composio inject the **authentication state**. This is useful when you need an API endpoint that isn't available as a predefined tool.
87 -
88 -The `endpoint` can be a relative path or absolute URL. Composio uses the `connected_account_id` to determine the toolkit and resolve relative paths against the appropriate base URL.
89 -
90 -<CodeGroup>
91 - <SnippetCode
92 - src="fern/snippets/tool-calling/python/proxy-tool.py"
93 - title="Python"
94 - startLine={5}
95 - highlightStart={9}
96 - highlightEnd={9}
97 - />
98 - <SnippetCode
99 - src="fern/snippets/tool-calling/typescript/proxy-tool.ts"
100 - title="TypeScript"
101 - startLine={5}
102 - highlightStart={9}
103 - highlightEnd={9}
104 -/>
105 -
106 -</CodeGroup>
107 -
108 -<Tip icon="fa-light fa-info">
109 - Need an API that isn't supported by any Composio toolkit, or want to extend an existing one? Learn
110 - how to [create custom tools](/docs/custom-tools).
111 -</Tip>
112 -
113 -## Automatic File Handling
114 -
115 -Composio handles file operations automatically. Pass file paths to tools that need them, and get local file paths back from tools that return files.
116 -
117 -### File Upload
118 -
119 -Pass local file paths, URLs, or File objects to tools that accept files:
120 -
121 -<CodeGroup>
122 - <SnippetCode
123 - src="fern/snippets/tool-calling/python/file-upload.py"
124 - title="Python"
125 - startLine={7}
126 - />
127 - <SnippetCode
128 - src="fern/snippets/tool-calling/typescript/file-upload.ts"
129 - title="TypeScript"
130 - startLine={8}
131 - />
132 -</CodeGroup>
133 -
134 -### File Download
135 -
136 -When tools return files, Composio downloads them to the local directory and provides file path in the response:
137 -When tools return files, Composio downloads them to the local directory and provides the file path in the response:
138 -
139 -<CodeGroup>
140 - <SnippetCode
141 - src="fern/snippets/tool-calling/python/file-download.py"
142 - title="Python"
143 - startLine={4}
144 - />
145 - <SnippetCode
146 - src="fern/snippets/tool-calling/typescript/file-download.ts"
147 - title="TypeScript"
148 - startLine={4}
149 - />
150 -
151 -</CodeGroup>
152 -
153 -### Disabling Auto File Handling
154 -
155 -You can disable automatic file handling when initializing the TypeScript SDK. When disabled, handle file uploads and downloads manually using `files.upload` and `files.download`:
156 -
157 -<CodeGroup>
158 -```typescript TypeScript maxLines=60 wordWrap
159 -const composio = new Composio({
160 - apiKey: process.env.COMPOSIO_API_KEY,
161 - autoUploadDownloadFiles: false
162 -});
163 -
164 -// Now you need to handle files manually using composio.files API
165 -const fileData = await composio.files.upload({
166 -filePath: path.join(\_\_dirname, 'document.pdf'),
167 -toolSlug: 'GOOGLEDRIVE_UPLOAD_FILE',
168 -toolkitSlug: 'googledrive'
169 -});
170 -
171 -```
172 -</CodeGroup>
173 -
174 -```
fern/pages/src/tools-and-triggers/fetching-tools.mdx deleted
-137
@@ -1,137 +0,0 @@
1 ----
2 -title: Fetching tools and schemas
3 -image: "https://og.composio.dev/api/og?title=Fetching%20tools%20and%20schemas" # image for socials
4 -keywords: "fetch tool, filter tool, tool schema, tool types, inspect schema, raw tools"
5 -subtitle: "Fetch and filter tools, and inspect schemas"
6 -hide-nav-links: false
7 ----
8 -
9 -Fetch specific tools, filter by permissions or search, and inspect schemas for type information. Tools are automatically formatted for your provider.
10 -
11 -## Basic usage
12 -
13 -<CodeGroup>
14 -<SnippetCode
15 - src="fern/snippets/tool-calling/python/fetching-tools.py"
16 - title="Python"
17 - startLine={6}
18 - endLine={9}
19 -/>
20 -<SnippetCode
21 - src="fern/snippets/tool-calling/typescript/fetching-tools.ts"
22 - title="TypeScript"
23 - startLine={6}
24 - endLine={8}
25 -/>
26 -</CodeGroup>
27 -
28 -Returns top 20 tools by default. Tools require a `user_id` because they're scoped to authenticated accounts. See [User management](./user-management) and [Authentication](./authenticating-tools).
29 -
30 -## Tool schemas
31 -
32 -Inspect tool parameters and types without a user_id:
33 -
34 -<CodeGroup>
35 -<SnippetCode
36 - src="fern/snippets/tool-calling/python/fetching-tools.py"
37 - title="Python"
38 - startLine={66}
39 - endLine={66}
40 -/>
41 -<SnippetCode
42 - src="fern/snippets/tool-calling/typescript/fetching-tools.ts"
43 - title="TypeScript"
44 - startLine={60}
45 - endLine={60}
46 -/>
47 -</CodeGroup>
48 -
49 -Generate type-safe code for direct SDK execution with [`composio generate`](/docs/cli#generate-type-definitions). This creates TypeScript or Python types from tool schemas.
50 -
51 -<Tip>
52 -View tool parameters and schemas visually in the [Composio platform](https://platform.composio.dev). Navigate to any toolkit and select a tool to see its input/output parameters.
53 -</Tip>
54 -
55 -## Filtering tools
56 -
57 -### By toolkit
58 -
59 -Get tools from specific apps. Returns top 20 tools by default.
60 -
61 -<CodeGroup>
62 -<SnippetCode
63 - src="fern/snippets/tool-calling/python/fetching-tools.py"
64 - title="Python"
65 - startLine={12}
66 - endLine={23}
67 -/>
68 -<SnippetCode
69 - src="fern/snippets/tool-calling/typescript/fetching-tools.ts"
70 - title="TypeScript"
71 - startLine={11}
72 - endLine={21}
73 -/>
74 -</CodeGroup>
75 -
76 -
77 -### By name
78 -
79 -Fetch specific tools when you know their names.
80 -
81 -<CodeGroup>
82 -<SnippetCode
83 - src="fern/snippets/tool-calling/python/fetching-tools.py"
84 - title="Python"
85 - startLine={25}
86 - endLine={34}
87 -/>
88 -<SnippetCode
89 - src="fern/snippets/tool-calling/typescript/fetching-tools.ts"
90 - title="TypeScript"
91 - startLine={23}
92 - endLine={31}
93 -/>
94 -</CodeGroup>
95 -
96 -
97 -### By scopes
98 -
99 -Filter OAuth tools by permission level. Only works with a single toolkit.
100 -
101 -<CodeGroup>
102 -<SnippetCode
103 - src="fern/snippets/tool-calling/python/fetching-tools.py"
104 - title="Python"
105 - startLine={36}
106 - endLine={41}
107 -/>
108 -<SnippetCode
109 - src="fern/snippets/tool-calling/typescript/fetching-tools.ts"
110 - title="TypeScript"
111 - startLine={33}
112 - endLine={37}
113 -/>
114 -</CodeGroup>
115 -
116 -### By search (experimental)
117 -
118 -Find tools semantically.
119 -
120 -<CodeGroup>
121 -<SnippetCode
122 - src="fern/snippets/tool-calling/python/fetching-tools.py"
123 - title="Python"
124 - startLine={43}
125 - endLine={65}
126 -/>
127 -<SnippetCode
128 - src="fern/snippets/tool-calling/typescript/fetching-tools.ts"
129 - title="TypeScript"
130 - startLine={39}
131 - endLine={59}
132 -/>
133 -</CodeGroup>
134 -
135 -<Tip>
136 -Use specific toolkit versions in production to prevent breaking changes. See [toolkit versioning](./toolkit-versioning).
137 -</Tip>
\ No newline at end of file
fern/pages/src/tools-and-triggers/schema-modifiers.mdx deleted
-223
@@ -1,223 +0,0 @@
1 ----
2 -title: Schema Modifiers
3 -image: "https://og.composio.dev/api/og?title=Schema%20Modifiers" # image for socials
4 -keywords: ''
5 -subtitle: 'Customize how tools appear to agents'
6 -hide-nav-links: false
7 ----
8 -
9 -Schema modifiers are part of Composio SDK's powerful middleware capabilities that allow you to customize and extend the behavior of tools.
10 -
11 -## Schema Modifiers
12 -
13 -Schema modifiers transform a tool's schema before the tool is seen by an agent.
14 -
15 -<Frame>
16 - <img src="../../../assets/images/schema-modifier.png" alt="Schema Modifier" />
17 -</Frame>
18 -**Useful for:**
19 -- Modifying or rewriting the tool description to better fit your use case.
20 -- Adding arguments to the tool. For example, adding a `thought` argument to the tool to prompt the agent to explain the reasoning.
21 -- Hiding arguments from the tool. In cases where the argument is irrelevant to the tool.
22 -- Adding extra arguments to the tool schema for custom use cases or execution.
23 -- Adding default values to tool arguments.
24 -
25 -<Note>
26 - Below we modify the schema of the `HACKERNEWS_GET_LATEST_POSTS` to make the `size` argument
27 - required and remove the `page` argument.
28 -</Note>
29 -
30 -<CodeGroup>
31 -```python Python maxLines=60 wordWrap
32 -from composio import Composio, schema_modifier
33 -from composio.types import Tool
34 -
35 -user_id = "your@email.com"
36 -
37 -@schema_modifier(tools=["HACKERNEWS_GET_LATEST_POSTS"])
38 -def modify_schema(
39 - tool: str,
40 - toolkit: str,
41 - schema: Tool,
42 -) -> Tool:
43 - _ = schema.input_parameters["properties"].pop("page", None)
44 - schema.input_parameters["required"] = ["size"]
45 - return schema
46 -
47 -tools = composio.tools.get(
48 - user_id=user_id,
49 - tools=["HACKERNEWS_GET_LATEST_POSTS", "HACKERNEWS_GET_USER"],
50 - modifiers=[
51 - modify_schema,
52 - ]
53 -)
54 -```
55 -```typescript TypeScript maxLines=60 wordWrap
56 -const userId = "your@email.com";
57 -
58 -const tools = await composio.tools.get(
59 - userId,
60 - {
61 - tools: ["HACKERNEWS_GET_LATEST_POSTS", "HACKERNEWS_GET_USER"],
62 - },
63 - {
64 - modifySchema: ({ toolSlug, toolkitSlug, schema }) => {
65 - if (toolSlug === "HACKERNEWS_GET_LATEST_POSTS") {
66 - const { inputParameters } = schema;
67 - if (inputParameters?.properties) {
68 - delete inputParameters.properties["page"];
69 - }
70 - inputParameters.required = ["size"];
71 - }
72 - return schema;
73 - },
74 - }
75 -);
76 -
77 -console.log(JSON.stringify(tools, null, 2));
78 -
79 -```
80 -
81 -</CodeGroup>
82 -
83 -In using the above modified tool schema, the `page` argument is removed and the `size` argument is required.
84 -
85 -You can test this out by viewing the tool call response in the LLM too!
86 -
87 -<Accordion title="Schema modified tool call">
88 -<CodeGroup>
89 -
90 -```python Python maxLines=60 wordWrap
91 -
92 -from openai import OpenAI
93 -from composio import Composio, schema_modifier
94 -from composio.types import Tool
95 -from composio_openai import OpenAIProvider
96 -
97 -
98 -@schema_modifier(tools=["HACKERNEWS_GET_LATEST_POSTS"])
99 -def modify_schema(
100 - tool: str,
101 - toolkit: str,
102 - schema: Tool,
103 -) -> Tool:
104 - _ = schema.input_parameters["properties"].pop("page", None)
105 - schema.input_parameters["required"] = ["size"]
106 - return schema
107 -
108 -# Initialize tools.
109 -openai_client = OpenAI()
110 -composio = Composio(provider=OpenAIProvider())
111 -
112 -# Define task.
113 -task = "Get the latest posts from Hacker News"
114 -
115 -# Get GitHub tools that are pre-configured
116 -tools = composio.tools.get(
117 - user_id="default",
118 - tools=['HACKERNEWS_GET_LATEST_POSTS', 'HACKERNEWS_GET_USER'],
119 - modifiers=[
120 - modify_schema,
121 - ],
122 -)
123 -
124 -# Get response from the LLM
125 -response = openai_client.chat.completions.create(
126 - model="gpt-4o-mini",
127 - tools=tools,
128 - messages=[
129 - {"role": "system", "content": "You are a helpful assistant."},
130 - {"role": "user", "content": task},
131 - ],
132 -)
133 -print(response)
134 -
135 -# Execute the function calls.
136 -result = composio.provider.handle_tool_calls(response=response, user_id="default")
137 -print(result)
138 -```
139 -
140 -```typescript TypeScript maxLines=60 wordWrap
141 -import { Composio } from '@composio/core';
142 -import { OpenAI } from 'openai';
143 -
144 -const composio = new Composio({
145 - apiKey: process.env.COMPOSIO_API_KEY,
146 -});
147 -const openai = new OpenAI();
148 -
149 -const userId = 'your@email.com';
150 -
151 -const tools = await composio.tools.get(
152 - userId,
153 - {
154 - tools: ['HACKERNEWS_GET_LATEST_POSTS', 'HACKERNEWS_GET_USER'],
155 - },
156 - {
157 - modifySchema: ({ toolSlug, toolkitSlug, schema }) => {
158 - if (toolSlug === 'HACKERNEWS_GET_LATEST_POSTS') {
159 - const { inputParameters } = schema;
160 - if (inputParameters?.properties) {
161 - delete inputParameters.properties['page'];
162 - }
163 - inputParameters.required = ['size'];
164 - }
165 - return schema;
166 - },
167 - }
168 -);
169 -
170 -console.log(JSON.stringify(tools, null, 2));
171 -
172 -const response = await openai.chat.completions.create({
173 - model: 'gpt-4o-mini',
174 - messages: [
175 - {
176 - role: 'system',
177 - content: 'You are a helpful assistant that can help with tasks.',
178 - },
179 - { role: 'user', content: 'Get the latest posts from Hacker News' },
180 - ],
181 - tools: tools,
182 - tool_choice: 'auto',
183 -});
184 -
185 -console.log(response.choices[0].message.tool_calls);
186 -```
187 -
188 -</CodeGroup>
189 -</Accordion>
190 -
191 -
192 -## Example: Modifying the tool description
193 -
194 -Sometimes you need to provide additional context to help the agent understand how to use a tool correctly. This example demonstrates modifying the description of the `GITHUB_LIST_REPOSITORY_ISSUES` tool to specify a default repository when none is provided.
195 -
196 -<Note>
197 -This approach is particularly useful when you want to guide the agent's behavior without changing the tool's underlying functionality.
198 -</Note>
199 -
200 -In this example:
201 -- We append additional instructions to the tool's description
202 -- The modified description tells the agent to use `composiohq/composio` as the default repository
203 -- This helps prevent errors when the agent forgets to specify a repository parameter
204 -
205 -<CodeGroup>
206 -<SnippetCode
207 - src="fern/snippets/modifiers/python/description.py"
208 - title="Python"
209 - startLine={1}
210 - endLine={27}
211 - highlightStart={13}
212 - highlightEnd={20}
213 -/>
214 -<SnippetCode
215 - src="fern/snippets/modifiers/typescript/description.ts"
216 - title="TypeScript"
217 - startLine={1}
218 - endLine={31}
219 - highlightStart={13}
220 - highlightEnd={18}
221 -/>
222 -
223 -</CodeGroup>
fern/pages/src/tools-and-triggers/toolkit-versioning.mdx deleted
-97
@@ -1,97 +0,0 @@
1 ----
2 -title: Toolkit versioning
3 -image: "https://og.composio.dev/api/og?title=Toolkit%20versioning"
4 -keywords: "toolkit versioning, tool version, version pinning, stable tools"
5 -subtitle: "Pin specific tool versions for consistent behavior in production"
6 -hide-nav-links: false
7 ----
8 -
9 -Toolkit versioning ensures your tools behave consistently across deployments. You can pin specific versions in production, test new releases in development, and roll back when needed.
10 -
11 -<Note>
12 -Starting from Python SDK v0.9.0 and TypeScript SDK v0.2.0, specifying versions is required for manual tool execution.
13 -</Note>
14 -
15 -## Configuration methods
16 -
17 -Configure toolkit versions using one of three methods:
18 -
19 -### SDK initialization
20 -
21 -<CodeGroup>
22 -<SnippetCode
23 - src="fern/snippets/tool-calling/python/versioning-sdk-init.py"
24 - title="Python"
25 -/>
26 -<SnippetCode
27 - src="fern/snippets/tool-calling/typescript/versioning-sdk-init.ts"
28 - title="TypeScript"
29 -/>
30 -</CodeGroup>
31 -
32 -### Environment variables
33 -
34 -```bash
35 -# Set versions for specific toolkits
36 -export COMPOSIO_TOOLKIT_VERSION_GITHUB="20251027_00"
37 -export COMPOSIO_TOOLKIT_VERSION_SLACK="20251027_00"
38 -export COMPOSIO_TOOLKIT_VERSION_GMAIL="20251027_00"
39 -```
40 -
41 -### Per-execution override
42 -
43 -<CodeGroup>
44 -<SnippetCode
45 - src="fern/snippets/tool-calling/python/versioning-per-execution.py"
46 - title="Python"
47 -/>
48 -<SnippetCode
49 - src="fern/snippets/tool-calling/typescript/versioning-per-execution.ts"
50 - title="TypeScript"
51 -/>
52 -</CodeGroup>
53 -
54 -## Version format
55 -
56 -Versions follow the format `YYYYMMDD_NN`:
57 -- `YYYYMMDD`: Release date
58 -- `NN`: Sequential release number
59 -
60 -```python
61 -# Production
62 -toolkit_versions = {"github": "20251027_00"}
63 -
64 -# Development
65 -toolkit_versions = {"github": "latest"}
66 -```
67 -
68 -<Warning>
69 -Never use `latest` in production. It can introduce breaking changes.
70 -</Warning>
71 -
72 -## Version resolution order
73 -
74 -1. Per-execution version (highest priority)
75 -2. SDK initialization version
76 -3. Environment variable (toolkit-specific)
77 -
78 -## Managing versions
79 -
80 -Check available versions using:
81 -
82 -<CodeGroup>
83 -<SnippetCode
84 - src="fern/snippets/tool-calling/python/versioning-manage.py"
85 - startLine={5}
86 - endLine={11}
87 - title="Python"
88 -/>
89 -<SnippetCode
90 - src="fern/snippets/tool-calling/typescript/versioning-manage.ts"
91 - startLine={5}
92 - endLine={12}
93 - title="TypeScript"
94 -/>
95 -</CodeGroup>
96 -
97 -
fern/pages/src/tools-and-triggers/using-triggers.mdx deleted
-262
@@ -1,262 +0,0 @@
1 ----
2 -title: Using Triggers
3 -subtitle: Send payloads to your AI agents or systems based on events in apps.
4 -image: "https://og.composio.dev/api/og?title=Using%20Triggers" # image for socials
5 -keywords: 'triggers, webhooks, websockets, events, active triggers, trigger types, verify triggers'
6 -hide-nav-links: true
7 ----
8 -
9 -When **events** occur in connected apps (like new Slack messages or GitHub commits), triggers automatically send the event data to your application.
10 -
11 -Each event is delivered as a **structured payload** to your webhook endpoint (via webhooks or WebSockets), enabling your applications or AI agents to respond proactively.
12 -
13 -<Frame caption="Triggers through Composio" background="subtle">
14 - ![Triggers Overview](../../../assets/images/triggers.png)
15 -</Frame>
16 -
17 -<Tip title="Prerequisites">
18 - Before proceeding, ensure you've created an [auth
19 - config](/docs/authenticating-tools#creating-an-auth-config) and [established a
20 - connection](/docs/authenticating-tools#oauth-connections) to an app (e.g., Slack, GitHub).
21 - Triggers are scoped to specific users - learn about [User Management](/docs/user-management) for guidance on structuring User IDs.
22 -</Tip>
23 -
24 -## Creating a trigger
25 -
26 -You can create triggers using either the Composio dashboard or programmatically via the SDK.
27 -
28 -### Using dashboard
29 -To create triggers through the **dashboard**:
30 -
31 -- Navigate to the <a href="https://platform.composio.dev?next_page=%2Fauth-configs" target="_blank">Auth Configs</a> page
32 -- Select the auth config
33 -- Click "Add Trigger" and navigate to "Active Triggers" tab to fetch the trigger ID.
34 - <video
35 - src="../../../assets/videos/enabling-triggers.mp4"
36 - width="854"
37 - height="480"
38 - autoplay
39 - loop
40 - playsinline
41 - controls
42 - ></video>
43 -
44 -Some triggers require additional configuration. The dashboard will prompt you for any required fields during setup.
45 -
46 -<Frame caption="Example: Gmail trigger configuration" background="subtle">
47 - <img
48 - src="../../../assets/images/trigger-config.png"
49 - alt="Trigger configuration example"
50 - style={{ maxHeight: '400px', width: 'auto', display: 'block', margin: '0 auto' }}
51 - />
52 -</Frame>
53 -
54 -### Using SDK
55 -Create triggers programmatically by providing the trigger type and any required configuration. The trigger instance will be created using the toolkit version configured during Composio initialization (defaults to `'latest'`).
56 -
57 -<CodeGroup>
58 -<SnippetCode
59 - src="fern/snippets/triggers/python/triggers.py"
60 - title="Python"
61 - startLine={1}
62 - endLine={18}
63 - highlightStart={12}
64 - highlightEnd={16}
65 -/>
66 -
67 -<SnippetCode
68 - src="fern/snippets/triggers/typescript/triggers.ts"
69 - startLine={1}
70 - endLine={22}
71 - highlightStart={12}
72 - highlightEnd={21}
73 - title="TypeScript"
74 -/>
75 -</CodeGroup>
76 -
77 -<Note>
78 -To use a specific toolkit version when creating triggers, configure `toolkitVersions` during initialization. See [Toolkit Versioning](/docs/toolkit-versioning) for more details.
79 -</Note>
80 -
81 -
82 -## Subscribing to triggers
83 -
84 -### Webhooks
85 -
86 -The recommended way to subscribe to triggers is through webhooks. Configure your webhook URL in the [Event & Trigger settings](https://platform.composio.dev?next_page=/settings/webhook).
87 -
88 -Use a publicly accessible URL where Composio can send event payloads. This endpoint should be able to process incoming POST requests containing the trigger data.
89 -
90 -<Tip>
91 - **Local development:** Use [ngrok](https://ngrok.com) or [webhook.site](https://webhook.site) to
92 - expose your local server to the internet for testing.
93 -</Tip>
94 -
95 -Webhook payloads contain:
96 -- `type`: The trigger type identifier
97 -- `data`: The actual event data
98 -- `timestamp`: When the event occurred
99 -- `log_id`: Unique identifier for this event
100 -
101 -Below are examples of webhook handlers for FastAPI and Next.js applications:
102 -
103 -<CodeGroup>
104 -<SnippetCode
105 - src="fern/snippets/triggers/python/trigger-webhook.py"
106 - title="Python (FastAPI)"
107 - startLine={34}
108 - endLine={47}
109 -/>
110 -
111 -<SnippetCode
112 - src="fern/snippets/triggers/typescript/trigger-webhook.ts"
113 - title="TypeScript (Next.js)"
114 - startLine={39}
115 - endLine={57}
116 -/>
117 -</CodeGroup>
118 -
119 -### Verifying webhook signatures
120 -
121 -Composio signs all webhook requests so you can verify they're authentic. Each webhook includes these headers:
122 -
123 -- `webhook-signature`: HMAC signature in format `v1,<base64_signature>`
124 -- `webhook-id`: Unique message identifier
125 -- `webhook-timestamp`: Unix timestamp when the webhook was sent
126 -
127 -To enable verification:
128 -
129 -1. Obtain your webhook secret from the [Composio dashboard](https://platform.composio.dev?next_page=/settings/webhook) under Project Settings → Webhook.
130 -2. Set it as the `COMPOSIO_WEBHOOK_SECRET` environment variable
131 -3. Use the verification function in your webhook handler:
132 -
133 -<CodeGroup>
134 -<SnippetCode
135 - src="fern/snippets/triggers/python/trigger-webhook.py"
136 - title="Python"
137 - startLine={10}
138 - endLine={32}
139 -/>
140 -
141 -<SnippetCode
142 - src="fern/snippets/triggers/typescript/trigger-webhook.ts"
143 - title="TypeScript"
144 - startLine={12}
145 - endLine={37}
146 -/>
147 -</CodeGroup>
148 -
149 -The signature is calculated as:
150 -```
151 -signing_string = "{webhook-id}.{webhook-timestamp}.{raw_body}"
152 -signature = HMAC-SHA256(signing_string, secret)
153 -```
154 -
155 -### Prototyping with trigger subscriptions
156 -
157 -During development, you can subscribe to triggers directly through the SDK without setting up webhooks.
158 -
159 -You can subscribe to **multiple** trigger events by **configuring the filters**. When you specify multiple filters, ALL of them must match for the trigger to be subscribed to.
160 -
161 -<CodeGroup>
162 - <SnippetCode src="fern/snippets/triggers/python/trigger-subscription.py" title="Python" />
163 - <SnippetCode src="fern/snippets/triggers/typescript/trigger-subscription.ts" title="Typescript" />
164 -</CodeGroup>
165 -
166 -## Trigger payload types
167 -
168 -To see what data you'll receive in your webhook handler, inspect the trigger's payload:
169 -
170 -<CodeGroup>
171 -```python Python maxLines=60 wordWrap
172 -# Get trigger type to inspect payload structure
173 -trigger = composio.triggers.get_type(slug="GITHUB_COMMIT_EVENT")
174 -print(trigger.payload)
175 -```
176 -
177 -```typescript TypeScript maxLines=60 wordWrap
178 -// Get trigger type to inspect payload structure
179 -const triggerType = await composio.triggers.getType('GITHUB_COMMIT_EVENT');
180 -
181 -console.log(triggerType.payload);
182 -```
183 -
184 -</CodeGroup>
185 -
186 -### Type-safe trigger handling (TypeScript)
187 -
188 -For better type safety and developer experience in TypeScript, you can define specific payload types and use the `TriggerEvent<T>` interface:
189 -
190 -<CodeGroup>
191 -<SnippetCode
192 - src="fern/snippets/triggers/typescript/trigger-types.ts"
193 - title="Type-safe trigger subscription"
194 - startLine={3}
195 - endLine={26}
196 -/>
197 -
198 -<SnippetCode
199 - src="fern/snippets/triggers/typescript/trigger-webhook.ts"
200 - title="Type-safe webhook handling"
201 - startLine={3}
202 - endLine={18}
203 -/>
204 -</CodeGroup>
205 -
206 -This approach provides:
207 -
208 -- **IntelliSense support** for trigger payload fields
209 -- **Compile-time error checking** for typos and invalid field access
210 -- **Better documentation** through TypeScript types
211 -- **Improved maintainability** of trigger handling code
212 -
213 -## Managing triggers
214 -
215 -### Enable/disable triggers
216 -
217 -You can pause triggers temporarily without deleting them.
218 -
219 -<Tabs>
220 -<Tab title="Dashboard">
221 -1. Go to the [Auth Config](https://platform.composio.dev?next_page=/auth-configs) page
222 -2. Select your auth config
223 -3. Navigate to "Active Triggers"
224 -4. Disable/Enable the trigger
225 -
226 -<Frame caption="Enable/disable triggers" background="subtle">
227 - <img
228 - src="../../../assets/images/trigger-enable-disable.png"
229 - alt="Enable/disable triggers"
230 - width="400px"
231 - height="auto"
232 - />
233 -</Frame>
234 -</Tab>
235 -
236 -<Tab title="SDK">
237 -<CodeGroup>
238 -```python Python
239 -# Disable a trigger
240 -composio.triggers.disable(trigger_id="ti_abcd123")
241 -
242 -# Re-enable when needed
243 -
244 -composio.triggers.enable(trigger_id="ti_abcd123")
245 -
246 -````
247 -``` typescript TypeScript
248 -// Disable a trigger
249 -await composio.triggers.disable('ti_abcd123');
250 -
251 -// Re-enable when needed
252 -await composio.triggers.enable('ti_abcd123');
253 -
254 -````
255 -
256 -</CodeGroup>
257 -</Tab>
258 -</Tabs>
259 -
260 -## Troubleshooting
261 -
262 -View detailed trigger logs and debug issues on the [Composio dashboard](https://platform.composio.dev?next_page=/logs/triggers).
\ No newline at end of file
fern/pyproject.toml deleted
-59
@@ -1,59 +0,0 @@
1 -[project]
2 -name = "fern"
3 -version = "0.1.0"
4 -description = "Documentation generators for Composio"
5 -readme = "README.md"
6 -requires-python = ">=3.12"
7 -dependencies = [
8 - "python-dotenv>=1.1.0",
9 - "inflection>=0.5.1",
10 - "click>=8.1.7",
11 - "ruamel-yaml>=0.18.10",
12 - "typing-extensions>=4.13.0",
13 - "composio-client==1.27.0",
14 - "openai>=1.79.0",
15 - "composio==1.0.0rc5",
16 - # Dependencies for SDK doc generation
17 - "tqdm>=4.62.0",
18 - "pyyaml>=6.0",
19 - "GitPython>=3.1.0",
20 - "packaging>=20.0",
21 - "nbformat>=5.0.0",
22 - "composio-langchain",
23 - "composio-openai",
24 - "composio-gemini",
25 -]
26 -
27 -[tool.ruff]
28 -line-length = 100
29 -target-version = "py312"
30 -
31 -[tool.black]
32 -line-length = 100
33 -target-version = ["py312"]
34 -
35 -
36 -
37 -
38 -[build-system]
39 -requires = ["hatchling"]
40 -build-backend = "hatchling.build"
41 -
42 -[tool.hatch.build.targets.wheel]
43 -packages = ["generators"]
44 -
45 -[tool.uv.sources]
46 -composio-openai-agents = { workspace = true }
47 -composio-gemini = { workspace = true }
48 -composio = { workspace = true }
49 -
50 -[dependency-groups]
51 -dev = [
52 - "composio==1.0.0rc6",
53 - "composio-gemini",
54 - "composio-langchain",
55 - "composio-openai-agents",
56 - "google-genai>=1.20.0",
57 - "langchain>=0.3.25",
58 - "openai-agents>=0.0.19",
59 -]
fern/scripts/add_og_imgs.py deleted
-213
@@ -1,213 +0,0 @@
1 -#!/usr/bin/env python3
2 -"""
3 -Script to update image properties in MDX frontmatter for social media previews.
4 -
5 -This script processes all MDX files in the fern/pages directory and adds or updates
6 -the 'image' property in the frontmatter with a URL that generates social media
7 -preview images based on the page title.
8 -
9 -Usage:
10 - python scripts/update_mdx_images.py [--dry-run] [--verbose]
11 -
12 -Options:
13 - --dry-run Show what would be changed without making actual changes
14 - --verbose Show detailed output for all processed files
15 -"""
16 -
17 -import argparse
18 -import os
19 -import re
20 -import sys
21 -from pathlib import Path
22 -from urllib.parse import quote
23 -
24 -
25 -def extract_title_from_frontmatter(frontmatter):
26 - """Extract the title from frontmatter string."""
27 - # Handle different title formats:
28 - # title: Simple Title
29 - # title: "Quoted Title"
30 - # title: 'Single Quoted Title'
31 - title_patterns = [
32 - r"^title:\s*[\"']([^\"']+)[\"']\s*$", # Quoted titles
33 - r"^title:\s*([^#\n]+?)(?:\s*#.*)?$", # Unquoted titles (with optional comments)
34 - ]
35 -
36 - for pattern in title_patterns:
37 - match = re.search(pattern, frontmatter, re.MULTILINE)
38 - if match:
39 - return match.group(1).strip()
40 -
41 - return None
42 -
43 -
44 -def has_frontmatter(content):
45 - """Check if content has valid frontmatter."""
46 - return content.startswith("---") and content.count("---") >= 2
47 -
48 -
49 -def update_mdx_image(file_path, dry_run=False, verbose=False):
50 - """
51 - Update the image property in MDX frontmatter based on the title.
52 -
53 - Args:
54 - file_path: Path to the MDX file
55 - dry_run: If True, don't actually modify files
56 - verbose: If True, show detailed output
57 -
58 - Returns:
59 - dict: Result information with keys 'updated', 'message', 'title'
60 - """
61 - try:
62 - with open(file_path, "r", encoding="utf-8") as f:
63 - content = f.read()
64 - except Exception as e:
65 - return {"updated": False, "message": f"Error reading file: {e}", "title": None}
66 -
67 - # Check if file has frontmatter
68 - if not has_frontmatter(content):
69 - return {"updated": False, "message": "No frontmatter found", "title": None}
70 -
71 - # Split frontmatter and content
72 - parts = content.split("---", 2)
73 - if len(parts) < 3:
74 - return {"updated": False, "message": "Invalid frontmatter format", "title": None}
75 -
76 - frontmatter = parts[1]
77 - body = parts[2]
78 -
79 - # Extract title from frontmatter
80 - title = extract_title_from_frontmatter(frontmatter)
81 - if not title:
82 - return {"updated": False, "message": "No title found in frontmatter", "title": None}
83 -
84 - # Create the image URL
85 - encoded_title = quote(title)
86 - image_url = f'"https://og.composio.dev/api/og?title={encoded_title}"'
87 -
88 - # Check if image property already exists
89 - image_pattern = r"^image:\s*.*$"
90 - image_match = re.search(image_pattern, frontmatter, re.MULTILINE)
91 -
92 - if image_match:
93 - return {
94 - "updated": False,
95 - "message": "Image property already present, skipping",
96 - "title": title,
97 - }
98 - else:
99 - # Add image property after title
100 - title_pattern = r"^title:\s*.*$"
101 - title_match = re.search(title_pattern, frontmatter, re.MULTILINE)
102 -
103 - if not title_match:
104 - return {
105 - "updated": False,
106 - "message": "Could not find title line to insert image after",
107 - "title": title,
108 - }
109 -
110 - title_line = title_match.group(0)
111 - new_image_line = f"image: {image_url} # image for socials"
112 - new_frontmatter = frontmatter.replace(title_line, f"{title_line}\n{new_image_line}")
113 - action = "Added new"
114 -
115 - # Don't write if dry run
116 - if dry_run:
117 - return {"updated": True, "message": f"{action} image property (DRY RUN)", "title": title}
118 -
119 - # Reconstruct the file content
120 - new_content = f"---{new_frontmatter}---{body}"
121 -
122 - # Write back to file
123 - try:
124 - with open(file_path, "w", encoding="utf-8") as f:
125 - f.write(new_content)
126 -
127 - return {"updated": True, "message": f"{action} image property", "title": title}
128 - except Exception as e:
129 - return {"updated": False, "message": f"Error writing file: {e}", "title": title}
130 -
131 -
132 -def main():
133 - """Process all MDX files in fern/pages directory."""
134 - parser = argparse.ArgumentParser(
135 - description="Update image properties in MDX frontmatter for social media previews"
136 - )
137 - parser.add_argument(
138 - "--dry-run",
139 - action="store_true",
140 - help="Show what would be changed without making actual changes",
141 - )
142 - parser.add_argument(
143 - "--verbose", action="store_true", help="Show detailed output for all processed files"
144 - )
145 -
146 - args = parser.parse_args()
147 -
148 - # Determine the pages directory relative to script location
149 - script_dir = Path(__file__).parent
150 - pages_dir = script_dir.parent / "pages"
151 -
152 - if not pages_dir.exists():
153 - print(f"Error: Pages directory not found at {pages_dir}")
154 - print("Make sure to run this script from the fern directory")
155 - sys.exit(1)
156 -
157 - # Find all MDX files
158 - mdx_files = list(pages_dir.rglob("*.mdx"))
159 -
160 - if not mdx_files:
161 - print("No MDX files found in pages directory")
162 - return
163 -
164 - print(f"Found {len(mdx_files)} MDX files")
165 - if args.dry_run:
166 - print("🔍 DRY RUN MODE - No files will be modified")
167 - print()
168 -
169 - # Process files
170 - updated_count = 0
171 - skipped_count = 0
172 - error_count = 0
173 -
174 - for mdx_file in sorted(mdx_files):
175 - rel_path = mdx_file.relative_to(pages_dir)
176 -
177 - try:
178 - result = update_mdx_image(mdx_file, dry_run=args.dry_run, verbose=args.verbose)
179 -
180 - if result["updated"]:
181 - updated_count += 1
182 - status = "✅" if not args.dry_run else "🔄"
183 - print(f"{status} {rel_path}")
184 - if args.verbose or args.dry_run:
185 - print(f" Title: {result['title']}")
186 - print(f" Action: {result['message']}")
187 - else:
188 - skipped_count += 1
189 - if args.verbose:
190 - print(f"⏭️ {rel_path}")
191 - print(f" Reason: {result['message']}")
192 - if result["title"]:
193 - print(f" Title: {result['title']}")
194 -
195 - except Exception as e:
196 - error_count += 1
197 - print(f"❌ {rel_path}")
198 - print(f" Error: {e}")
199 -
200 - # Summary
201 - print(f"\n📊 Summary:")
202 - print(f" Total files: {len(mdx_files)}")
203 - print(f" Updated: {updated_count}")
204 - print(f" Skipped: {skipped_count}")
205 - if error_count > 0:
206 - print(f" Errors: {error_count}")
207 -
208 - if args.dry_run and updated_count > 0:
209 - print(f"\n💡 Run without --dry-run to apply {updated_count} changes")
210 -
211 -
212 -if __name__ == "__main__":
213 - main()
fern/scripts/build-llms-txt.ts deleted
-261
@@ -1,261 +0,0 @@
1 -#!/usr/bin/env bun
2 -/* eslint-disable no-console */
3 -
4 -import fs from 'fs';
5 -import path from 'path';
6 -import yaml from 'yaml';
7 -
8 -const FERN_DIR = path.join(import.meta.dir, '..');
9 -const DOCS_YML_PATH = path.join(FERN_DIR, 'docs.yml');
10 -const LLMS_TXT_PATH = path.join(FERN_DIR, 'llms-txt-worker', 'public', 'llms.txt');
11 -
12 -interface DocsConfig {
13 - title: string;
14 - navigation: Array<{
15 - tab: string;
16 - layout?: LayoutItem[];
17 - }>;
18 - tabs?: {
19 - [key: string]: {
20 - 'display-name': string;
21 - 'skip-slug'?: boolean;
22 - };
23 - };
24 -}
25 -
26 -interface LayoutItem {
27 - section?: string;
28 - contents?: ContentItem[];
29 - page?: string;
30 - path?: string;
31 - slug?: string;
32 -}
33 -
34 -interface ContentItem {
35 - page?: string;
36 - path?: string;
37 - slug?: string;
38 - section?: string;
39 - contents?: ContentItem[];
40 -}
41 -
42 -interface LlmsEntry {
43 - title: string;
44 - url: string;
45 - description?: string;
46 - parentSection?: string; // for prefixing nested items
47 -}
48 -
49 -function extractFrontmatter(mdxPath: string): { title?: string; description?: string } {
50 - try {
51 - const fullPath = path.join(FERN_DIR, mdxPath);
52 - if (!fs.existsSync(fullPath)) {
53 - return {};
54 - }
55 -
56 - const content = fs.readFileSync(fullPath, 'utf8');
57 - const frontmatterMatch = content.match(/^---\s*\n([\s\S]*?)\n---/);
58 -
59 - if (!frontmatterMatch) {
60 - return {};
61 - }
62 -
63 - const frontmatter = frontmatterMatch[1];
64 -
65 - // Extract title from frontmatter
66 - const titleMatch = frontmatter.match(/title:\s*["']?(.+?)["']?\s*$/m);
67 - const title = titleMatch ? titleMatch[1].trim() : undefined;
68 -
69 - // Extract subtitle (used as description in llms.txt)
70 - const descMatch = frontmatter.match(/subtitle:\s*["']?(.+?)["']?\s*$/m);
71 - const description = descMatch ? descMatch[1].trim() : undefined;
72 -
73 - return { title, description };
74 - } catch (error) {
75 - return {};
76 - }
77 -}
78 -
79 -function buildUrl(item: ContentItem, tabSlug: string, parentSlug?: string): string {
80 - const BASE_URL = 'https://docs.composio.dev';
81 -
82 - if (item.slug) {
83 - const urlParts = [tabSlug, parentSlug, item.slug].filter(Boolean);
84 - return `${BASE_URL}/${urlParts.join('/')}`;
85 - }
86 -
87 - if (item.path) {
88 - const urlPath = item.path
89 - .replace(/^pages\/(dist|src)\//, '')
90 - .replace(/^pages\//, '')
91 - .replace(/\.(mdx?|md)$/, '');
92 - return `${BASE_URL}/${urlPath}`;
93 - }
94 -
95 - console.warn(`No slug or path for: ${item.page}`);
96 - return BASE_URL;
97 -}
98 -
99 -function processItem(
100 - item: ContentItem,
101 - tabSlug: string,
102 - parentSlug?: string,
103 - parentSection?: string
104 -): LlmsEntry | null {
105 - if (!item.page || !item.path) return null;
106 -
107 - const url = buildUrl(item, tabSlug, parentSlug);
108 - const frontmatter = extractFrontmatter(item.path);
109 -
110 - return {
111 - title: frontmatter.title || item.page,
112 - url,
113 - description: frontmatter.description,
114 - parentSection,
115 - };
116 -}
117 -
118 -function processContentItems(
119 - items: ContentItem[],
120 - tabSlug: string,
121 - parentSlug?: string,
122 - parentSection?: string
123 -): LlmsEntry[] {
124 - const entries: LlmsEntry[] = [];
125 -
126 - for (const item of items) {
127 - const entry = processItem(item, tabSlug, parentSlug, parentSection);
128 - if (entry) {
129 - entries.push(entry);
130 - }
131 -
132 - if (item.contents) {
133 - const nestedSlug = item.slug
134 - ? (parentSlug ? `${parentSlug}/${item.slug}` : item.slug)
135 - : parentSlug;
136 -
137 - // pass section name to children for prefixing
138 - const nestedEntries = processContentItems(
139 - item.contents,
140 - tabSlug,
141 - nestedSlug,
142 - item.section ?? parentSection
143 - );
144 - entries.push(...nestedEntries);
145 - }
146 - }
147 -
148 - return entries;
149 -}
150 -
151 -function getSectionName(tab: string, layoutItem: LayoutItem, tabDisplayName: string): string {
152 - if (tab === 'docs' && layoutItem.section) {
153 - return layoutItem.section;
154 - }
155 - return tabDisplayName;
156 -}
157 -
158 -function processNavigation(config: DocsConfig): Array<[string, LlmsEntry[]]> {
159 - const sections = new Map<string, LlmsEntry[]>();
160 -
161 - for (const navItem of config.navigation) {
162 - if (!navItem.layout) continue;
163 -
164 - const tab = navItem.tab;
165 - const tabConfig = config.tabs?.[tab];
166 - const skipSlug = tabConfig?.['skip-slug'] || false;
167 - const tabSlug = skipSlug ? '' : tab;
168 - const tabDisplayName = tabConfig?.['display-name'] || tab;
169 -
170 - for (const layoutItem of navItem.layout) {
171 - const sectionName = getSectionName(tab, layoutItem, tabDisplayName);
172 - const sectionEntries: LlmsEntry[] = [];
173 -
174 - // direct page
175 - if (layoutItem.page && layoutItem.path && layoutItem.slug) {
176 - const entry = processItem(layoutItem as ContentItem, tabSlug);
177 - if (entry) {
178 - sectionEntries.push(entry);
179 - }
180 - }
181 -
182 - // nested contents
183 - if (layoutItem.contents) {
184 - const entries = processContentItems(
185 - layoutItem.contents,
186 - tabSlug,
187 - layoutItem.slug,
188 - undefined // no parent section for top-level
189 - );
190 - sectionEntries.push(...entries);
191 - }
192 -
193 - if (sectionEntries.length > 0) {
194 - const existing = sections.get(sectionName) || [];
195 - sections.set(sectionName, [...existing, ...sectionEntries]);
196 - }
197 - }
198 - }
199 -
200 - return Array.from(sections.entries());
201 -}
202 -
203 -function formatEntry(entry: LlmsEntry): string {
204 - const displayTitle = entry.parentSection
205 - ? `${entry.parentSection}: ${entry.title}`
206 - : entry.title;
207 -
208 - const link = `[${displayTitle}](${entry.url})`;
209 - return entry.description
210 - ? `- ${link}: ${entry.description}`
211 - : `- ${link}`;
212 -}
213 -
214 -function generateLlmsTxt(sections: Array<[string, LlmsEntry[]]>): string {
215 - let content = '# Composio\n\n';
216 - content += '> Composio is a platform that connects AI agents to 500+ external tools and services through managed authentication, tool execution, and triggers. It simplifies integrating AI agents with SaaS applications, developer tools, and custom APIs.\n\n';
217 - content += 'Composio provides managed OAuth and API key authentication, tool execution across multiple AI frameworks (OpenAI, Anthropic, LangChain, CrewAI, etc.), MCP server support, and webhooks/triggers for real-time agent actions.\n';
218 -
219 - for (const [sectionName, entries] of sections) {
220 - content += `\n## ${sectionName}\n`;
221 -
222 - if (sectionName === 'Toolkits') {
223 - content += '- [Tools JSON](https://docs.composio.dev/robots-only/tools.json): Machine-readable JSON with all 700+ toolkit slugs, descriptions, and tool names\n';
224 - } else {
225 - for (const entry of entries) {
226 - content += formatEntry(entry) + '\n';
227 - }
228 - }
229 - }
230 -
231 - return content;
232 -}
233 -
234 -async function main(): Promise<void> {
235 - console.log('Building llms.txt...');
236 -
237 - try {
238 - const docsYmlContent = fs.readFileSync(DOCS_YML_PATH, 'utf8');
239 - const config = yaml.parse(docsYmlContent) as DocsConfig;
240 - const sections = processNavigation(config);
241 -
242 - const totalEntries = sections.reduce((total, [_, entries]) => total + entries.length, 0);
243 - console.log(`Found ${totalEntries} pages across ${sections.length} sections`);
244 -
245 - const llmsTxtContent = generateLlmsTxt(sections);
246 - fs.writeFileSync(LLMS_TXT_PATH, llmsTxtContent);
247 -
248 - console.log(`Generated ${LLMS_TXT_PATH}`);
249 - } catch (error) {
250 - console.error('Error:', error);
251 - process.exit(1);
252 - }
253 -}
254 -
255 -// @ts-ignore - bun-specific
256 -if (import.meta.main) {
257 - main().catch(error => {
258 - console.error('Fatal error:', error);
259 - process.exit(1);
260 - });
261 -}
\ No newline at end of file
fern/scripts/build-snippets.ts deleted
-586
@@ -1,586 +0,0 @@
1 -#!/usr/bin/env bun
2 -/* eslint-disable no-console */
3 -
4 -import fs, { watch } from 'fs';
5 -import path from 'path';
6 -
7 -// Use default directories (no positional args for folder names)
8 -const DOCS_SRC_DIR = path.join(import.meta.dir, '../pages/src');
9 -const PAGES_DIST_DIR = path.join(import.meta.dir, '../pages/dist');
10 -const PROJECT_ROOT = path.join(import.meta.dir, '../..');
11 -
12 -// Custom error class for SnippetCode errors
13 -class SnippetCodeError extends Error {
14 - constructor(message: string) {
15 - super(message);
16 - this.name = 'SnippetCodeError';
17 - }
18 -}
19 -
20 -// Type for parsed GitHub URL
21 -interface ParsedGitHubUrl {
22 - owner: string;
23 - repo: string;
24 - branch: string;
25 - filePath: string;
26 - startLine?: number;
27 - endLine?: number;
28 -}
29 -
30 -interface SnippetCodeProps {
31 - src?: string;
32 - githubUrl?: string;
33 - startLine?: number;
34 - endLine?: number;
35 - highlightStart?: number;
36 - highlightEnd?: number;
37 - title?: string;
38 - language?: string;
39 - wordWrap?: boolean;
40 - relativeHighlightStart?: number;
41 - relativeHighlightEnd?: number;
42 - path?: string;
43 - vars?: Record<string, string>;
44 -}
45 -
46 -// Parse GitHub URL and extract components
47 -function parseGitHubUrl(url: string): ParsedGitHubUrl {
48 - try {
49 - // Validate URL format
50 - const githubRegex = /^https:\/\/github\.com\/([^\/]+)\/([^\/]+)\/blob\/([^\/]+)\/(.+?)(?:#L(\d+)(?:-L(\d+))?)?$/;
51 - const match = url.match(githubRegex);
52 -
53 - if (!match) {
54 - throw new SnippetCodeError(
55 - `Invalid GitHub URL format. Expected: https://github.com/owner/repo/blob/branch/path/to/file.ext#L1-L10\nReceived: ${url}`
56 - );
57 - }
58 -
59 - const [, owner, repo, branch, filePath, startLineStr, endLineStr] = match;
60 -
61 - return {
62 - owner,
63 - repo,
64 - branch,
65 - filePath,
66 - startLine: startLineStr ? parseInt(startLineStr, 10) : undefined,
67 - endLine: endLineStr ? parseInt(endLineStr, 10) : startLineStr ? parseInt(startLineStr, 10) : undefined
68 - };
69 - } catch (error) {
70 - if (error instanceof SnippetCodeError) {
71 - throw error;
72 - }
73 - throw new SnippetCodeError(`Failed to parse GitHub URL: ${error.message}`);
74 - }
75 -}
76 -
77 -// Cache for GitHub content to avoid repeated fetches
78 -const githubContentCache = new Map<string, { content?: string; error?: string }>();
79 -
80 -// Fetch content from GitHub with error handling
81 -async function fetchGitHubContent(parsedUrl: ParsedGitHubUrl): Promise<{ content?: string; error?: string }> {
82 - const cacheKey = `${parsedUrl.owner}/${parsedUrl.repo}/${parsedUrl.branch}/${parsedUrl.filePath}`;
83 -
84 - // Check cache first
85 - if (githubContentCache.has(cacheKey)) {
86 - return githubContentCache.get(cacheKey)!;
87 - }
88 -
89 - try {
90 - const rawUrl = `https://raw.githubusercontent.com/${parsedUrl.owner}/${parsedUrl.repo}/${parsedUrl.branch}/${parsedUrl.filePath}`;
91 -
92 - // Create abort controller for timeout
93 - const controller = new AbortController();
94 - const timeoutId = setTimeout(() => controller.abort(), 10000); // 10 second timeout
95 -
96 - const response = await fetch(rawUrl, { signal: controller.signal });
97 - clearTimeout(timeoutId);
98 -
99 - if (!response.ok) {
100 - let error: string;
101 - if (response.status === 404) {
102 - error = `File not found: ${parsedUrl.filePath} in ${parsedUrl.owner}/${parsedUrl.repo}@${parsedUrl.branch}`;
103 - } else {
104 - error = `GitHub API error: ${response.status} ${response.statusText}`;
105 - }
106 - const result = { error };
107 - githubContentCache.set(cacheKey, result);
108 - return result;
109 - }
110 -
111 - const content = await response.text();
112 - const result = { content };
113 - githubContentCache.set(cacheKey, result);
114 - return result;
115 - } catch (error: any) {
116 - let errorMessage: string;
117 - if (error.name === 'AbortError') {
118 - errorMessage = `Timeout fetching from GitHub: ${parsedUrl.owner}/${parsedUrl.repo}/${parsedUrl.filePath}`;
119 - } else if (error.message.includes('fetch')) {
120 - errorMessage = `Network error fetching from GitHub: ${error.message}`;
121 - } else {
122 - errorMessage = `Error fetching from GitHub: ${error.message}`;
123 - }
124 - const result = { error: errorMessage };
125 - githubContentCache.set(cacheKey, result);
126 - return result;
127 - }
128 -}
129 -
130 -// Extract lines from content
131 -function extractLinesFromContent(content: string, startLine?: number, endLine?: number): string {
132 - const lines = content.split('\n');
133 - const start = startLine ? startLine - 1 : 0;
134 - const end = endLine ? endLine : Math.min(lines.length, 100); // Default to first 100 lines
135 -
136 - return lines.slice(start, end).join('\n');
137 -}
138 -
139 -function ensureDistDir() {
140 - // Remove existing dist directory to ensure clean build
141 -
142 - // Create fresh dist directory
143 - fs.mkdirSync(PAGES_DIST_DIR, { recursive: true });
144 -}
145 -
146 -// Replace template variables in content
147 -function replaceTemplateVariables(content: string, vars: Record<string, string> = {}): string {
148 - // Replace {{variable}} patterns with their values
149 - return content.replace(/\{\{(\w+)(?:\|(\w+)(?::([^}]+))?)?\}\}/g, (match, varName, transform, defaultValue) => {
150 - let value = vars[varName];
151 -
152 - // Use default value if variable not found
153 - if (value === undefined || value === null) {
154 - if (defaultValue !== undefined) {
155 - value = defaultValue.replace(/^["']|["']$/g, ''); // Remove quotes from default value
156 - } else {
157 - return match; // Keep original placeholder if no value and no default
158 - }
159 - }
160 -
161 - // Apply transformations
162 - if (transform) {
163 - switch (transform.toLowerCase()) {
164 - case 'lower':
165 - value = value.toLowerCase();
166 - break;
167 - case 'upper':
168 - value = value.toUpperCase();
169 - break;
170 - case 'title':
171 - value = value.charAt(0).toUpperCase() + value.slice(1).toLowerCase();
172 - break;
173 - }
174 - }
175 -
176 - return value;
177 - });
178 -}
179 -
180 -function getLanguageFromPath(filePath: string): { syntax: string; displayName: string } {
181 - const extension = filePath.split('.').pop()?.toLowerCase();
182 - const languageMap: Record<string, { syntax: string; displayName: string }> = {
183 - py: { syntax: 'python', displayName: 'Python' },
184 - js: { syntax: 'javascript', displayName: 'JavaScript' },
185 - ts: { syntax: 'typescript', displayName: 'TypeScript' },
186 - tsx: { syntax: 'typescript', displayName: 'TypeScript' },
187 - jsx: { syntax: 'javascript', displayName: 'JavaScript' },
188 - java: { syntax: 'java', displayName: 'Java' },
189 - cpp: { syntax: 'cpp', displayName: 'C++' },
190 - c: { syntax: 'c', displayName: 'C' },
191 - go: { syntax: 'go', displayName: 'Go' },
192 - rs: { syntax: 'rust', displayName: 'Rust' },
193 - php: { syntax: 'php', displayName: 'PHP' },
194 - rb: { syntax: 'ruby', displayName: 'Ruby' },
195 - swift: { syntax: 'swift', displayName: 'Swift' },
196 - kt: { syntax: 'kotlin', displayName: 'Kotlin' },
197 - scala: { syntax: 'scala', displayName: 'Scala' },
198 - sh: { syntax: 'bash', displayName: 'Bash' },
199 - yml: { syntax: 'yaml', displayName: 'YAML' },
200 - yaml: { syntax: 'yaml', displayName: 'YAML' },
201 - json: { syntax: 'json', displayName: 'JSON' },
202 - xml: { syntax: 'xml', displayName: 'XML' },
203 - html: { syntax: 'html', displayName: 'HTML' },
204 - css: { syntax: 'css', displayName: 'CSS' },
205 - scss: { syntax: 'scss', displayName: 'SCSS' },
206 - sql: { syntax: 'sql', displayName: 'SQL' },
207 - };
208 - return languageMap[extension || ''] || { syntax: 'text', displayName: 'Text' };
209 -}
210 -
211 -function readFileLines(
212 - filePath: string,
213 - contextDir: string,
214 - startLine?: number,
215 - endLine?: number
216 -): string {
217 - try {
218 - let fullPath: string;
219 -
220 - // If the path starts with './' or '../', resolve it relative to the context directory
221 - if (filePath.startsWith('./') || filePath.startsWith('../')) {
222 - fullPath = path.resolve(contextDir, filePath);
223 - } else if (filePath.startsWith('fern/')) {
224 - // For paths starting with 'fern/', we need to find the actual fern directory
225 - // The MDX file might be in tools/, pages/dist/, etc., but we want to resolve
226 - // relative to the actual fern directory
227 -
228 - // Try multiple possible locations for the fern directory
229 - const possiblePaths = [
230 - path.resolve(PROJECT_ROOT, '..', filePath), // composio1/fern/...
231 - path.resolve(PROJECT_ROOT, filePath), // Already in fern/...
232 - path.resolve(contextDir, '..', '..', filePath), // Relative to context
233 - ];
234 -
235 - // Find the first path that exists
236 - for (const possiblePath of possiblePaths) {
237 - if (fs.existsSync(possiblePath)) {
238 - fullPath = possiblePath;
239 - break;
240 - }
241 - }
242 -
243 - if (!fullPath) {
244 - // If none found, use the most likely path
245 - fullPath = path.resolve(PROJECT_ROOT, '..', filePath);
246 - }
247 - } else {
248 - // Otherwise, resolve it relative to the project root
249 - fullPath = path.resolve(PROJECT_ROOT, filePath);
250 - }
251 -
252 - const content = fs.readFileSync(fullPath, 'utf8');
253 - const lines = content.split('\n');
254 -
255 - const start = startLine ? startLine - 1 : 0;
256 - const end = endLine ? endLine : lines.length;
257 -
258 - return lines.slice(start, end).join('\n');
259 - } catch (error) {
260 - console.warn(`⚠️ Failed to read file: ${filePath} (resolved to: ${fullPath})`, error);
261 - return `// File not found: ${filePath}`;
262 - }
263 -}
264 -
265 -function generateHighlightString(
266 - startLine: number,
267 - highlightStart?: number,
268 - highlightEnd?: number
269 -): string {
270 - if (!highlightStart || !highlightEnd) return '';
271 -
272 - // Convert to relative line numbers (relative to the excerpt)
273 - const relativeStart = highlightStart - startLine + 1;
274 - const relativeEnd = highlightEnd - startLine + 1;
275 -
276 - if (relativeStart === relativeEnd) {
277 - return `{${relativeStart}}`;
278 - }
279 - return `{${relativeStart}-${relativeEnd}}`;
280 -}
281 -
282 -async function parseSnippetCodeTags(content: string, contextDir: string): Promise<string> {
283 - const exampleCodeRegex = /<SnippetCode\s+([^>]*?)(?:\s*\/?>|>\s*<\/SnippetCode>)/g;
284 - const matches: Array<{ match: string; propsString: string }> = [];
285 -
286 - let match;
287 - while ((match = exampleCodeRegex.exec(content)) !== null) {
288 - matches.push({ match: match[0], propsString: match[1] });
289 - }
290 -
291 - let result = content;
292 -
293 - for (const { match, propsString } of matches) {
294 - const replacement = await (async () => {
295 - // Parse props from the tag
296 - const props: Partial<SnippetCodeProps> = {};
297 -
298 - // Extract src
299 - const srcMatch = propsString.match(/src=["']([^"']+)["']/);
300 - if (srcMatch) props.src = srcMatch[1];
301 -
302 - // Extract githubUrl
303 - const githubUrlMatch = propsString.match(/githubUrl=["']([^"']+)["']/);
304 - if (githubUrlMatch) props.githubUrl = githubUrlMatch[1];
305 -
306 - // Extract other numeric props (handle both JSX {1} and quoted "1" syntax)
307 - const startLineMatch = propsString.match(/startLine=(?:["'](\d+)["']|{(\d+)})/);
308 - if (startLineMatch) props.startLine = parseInt(startLineMatch[1] || startLineMatch[2]);
309 -
310 - const endLineMatch = propsString.match(/endLine=(?:["'](\d+)["']|{(\d+)})/);
311 - if (endLineMatch) props.endLine = parseInt(endLineMatch[1] || endLineMatch[2]);
312 -
313 - const highlightStartMatch = propsString.match(/highlightStart=(?:["'](\d+)["']|{(\d+)})/);
314 - if (highlightStartMatch)
315 - props.highlightStart = parseInt(highlightStartMatch[1] || highlightStartMatch[2]);
316 -
317 - const highlightEndMatch = propsString.match(/highlightEnd=(?:["'](\d+)["']|{(\d+)})/);
318 - if (highlightEndMatch)
319 - props.highlightEnd = parseInt(highlightEndMatch[1] || highlightEndMatch[2]);
320 -
321 - // Extract string props
322 - const titleMatch = propsString.match(/title=["']([^"']+)["']/);
323 - if (titleMatch) props.title = titleMatch[1];
324 -
325 - const pathMatch = propsString.match(/path=["']([^"']+)["']/);
326 - if (pathMatch) props.path = pathMatch[1];
327 -
328 - const languageMatch = propsString.match(/language=["']([^"']+)["']/);
329 - if (languageMatch) props.language = languageMatch[1];
330 -
331 - const relativeHighlightStartMatch = propsString.match(
332 - /relativeHighlightStart=(?:["'](\d+)["']|{(\d+)})/
333 - );
334 - if (relativeHighlightStartMatch)
335 - props.relativeHighlightStart = parseInt(
336 - relativeHighlightStartMatch[1] || relativeHighlightStartMatch[2]
337 - );
338 -
339 - const relativeHighlightEndMatch = propsString.match(
340 - /relativeHighlightEnd=(?:["'](\d+)["']|{(\d+)})/
341 - );
342 - if (relativeHighlightEndMatch)
343 - props.relativeHighlightEnd = parseInt(
344 - relativeHighlightEndMatch[1] || relativeHighlightEndMatch[2]
345 - );
346 -
347 - // Extract vars object prop
348 - const varsMatch = propsString.match(/vars=\{({[^}]*})\}/);
349 - if (varsMatch) {
350 - try {
351 - // Parse the vars object - need to handle JSX syntax
352 - const varsString = varsMatch[1];
353 - // Convert JSX object syntax to JSON
354 - const jsonString = varsString
355 - .replace(/(\w+):/g, '"$1":') // Add quotes around keys
356 - .replace(/:\s*"([^"]+)"/g, ':"$1"') // Ensure values are quoted
357 - .replace(/:\s*'([^']+)'/g, ':"$1"'); // Convert single quotes to double
358 - props.vars = JSON.parse(`{${jsonString}}`);
359 - } catch (error) {
360 - console.warn(`⚠️ Failed to parse vars prop: ${varsMatch[1]}`);
361 - }
362 - }
363 -
364 - // Extract wordWrap boolean prop
365 - const wordWrapMatch = propsString.match(/wordWrap=(?:["']?(true|false)["']?|{(true|false)})/);
366 - if (wordWrapMatch) {
367 - props.wordWrap = (wordWrapMatch[1] || wordWrapMatch[2]) === 'true';
368 - } else if (propsString.includes('wordWrap')) {
369 - // Handle case where wordWrap is specified without a value (defaults to true)
370 - props.wordWrap = true;
371 - }
372 -
373 - // Validate that either src or githubUrl is provided
374 - if (!props.src && !props.githubUrl) {
375 - const errorMessage = 'SnippetCode tag missing both src and githubUrl attributes';
376 - console.warn(`⚠️ ${errorMessage}:`, match);
377 - return `\`\`\`error\n${errorMessage}\n\nProps: ${JSON.stringify(props, null, 2)}\n\nFix the issue above and rebuild.\n\`\`\``;
378 - }
379 -
380 - let codeContent: string;
381 - let filePath: string;
382 - let langInfo: { syntax: string; displayName: string };
383 -
384 - try {
385 - if (props.githubUrl) {
386 - // Handle GitHub URL
387 - const parsedUrl = parseGitHubUrl(props.githubUrl);
388 -
389 - // Fetch content from GitHub
390 - const fetchResult = await fetchGitHubContent(parsedUrl);
391 -
392 - if (fetchResult.error) {
393 - console.error(`❌ SnippetCode Error: ${fetchResult.error}`);
394 - return `\`\`\`error\nSnippetCode Error: ${fetchResult.error}\n\nProps: ${JSON.stringify(props, null, 2)}\n\nFix the issue above and rebuild.\n\`\`\``;
395 - }
396 -
397 - // Extract lines based on URL or manual overrides
398 - const startLine = props.startLine || parsedUrl.startLine || 1;
399 - const endLine = props.endLine || parsedUrl.endLine || 100;
400 -
401 - codeContent = extractLinesFromContent(fetchResult.content!, startLine, endLine);
402 - filePath = parsedUrl.filePath;
403 - langInfo = getLanguageFromPath(filePath);
404 - } else {
405 - // Handle local file
406 - codeContent = readFileLines(props.src!, contextDir, props.startLine, props.endLine);
407 - filePath = props.src!;
408 - langInfo = getLanguageFromPath(filePath);
409 - }
410 -
411 - // Apply variable replacements if vars are provided
412 - if (props.vars && Object.keys(props.vars).length > 0) {
413 - codeContent = replaceTemplateVariables(codeContent, props.vars);
414 - }
415 - } catch (error) {
416 - const errorMessage = error instanceof SnippetCodeError ? error.message : `Unexpected error: ${error.message}`;
417 - console.error(`❌ SnippetCode Error: ${errorMessage}`);
418 - return `\`\`\`error\nSnippetCode Error: ${errorMessage}\n\nProps: ${JSON.stringify(props, null, 2)}\n\nFix the issue above and rebuild.\n\`\`\``;
419 - }
420 -
421 - const syntax = props.language || langInfo.syntax;
422 - const displayName = langInfo.displayName;
423 -
424 - // Generate highlight string if needed
425 - let highlightString = '';
426 - if (props.relativeHighlightStart && props.relativeHighlightEnd) {
427 - // Use relative highlights directly
428 - if (props.relativeHighlightStart === props.relativeHighlightEnd) {
429 - highlightString = `{${props.relativeHighlightStart}}`;
430 - } else {
431 - highlightString = `{${props.relativeHighlightStart}-${props.relativeHighlightEnd}}`;
432 - }
433 - } else if (props.highlightStart && props.highlightEnd) {
434 - // Use absolute highlights and convert to relative
435 - highlightString = generateHighlightString(
436 - props.startLine || 1,
437 - props.highlightStart,
438 - props.highlightEnd
439 - );
440 - }
441 -
442 - // Use title priority: explicit title > path > implicit title (displayName)
443 - const title = props.title || props.path || displayName;
444 - const titleComment = ` title="${title}"`;
445 -
446 - // Create the code block with syntax, display name, and maxLines
447 - const codeBlock = `\`\`\`${syntax} ${displayName}${highlightString ? ` ${highlightString}` : ''}${titleComment} maxLines=40 ${props.wordWrap ? 'wordWrap' : ''}\n${codeContent}\n\`\`\``;
448 -
449 - return codeBlock;
450 - })();
451 -
452 - result = result.replace(match, replacement);
453 - }
454 -
455 - return result;
456 -}
457 -
458 -async function processFile(srcPath: string, distPath: string) {
459 - try {
460 - const content = fs.readFileSync(srcPath, 'utf8');
461 - const contextDir = path.dirname(srcPath);
462 - const processedContent = await parseSnippetCodeTags(content, contextDir);
463 -
464 - // Ensure the directory exists
465 - const distDir = path.dirname(distPath);
466 - if (!fs.existsSync(distDir)) {
467 - fs.mkdirSync(distDir, { recursive: true });
468 - }
469 -
470 - fs.writeFileSync(distPath, processedContent);
471 - console.log(
472 - `✅ Processed: ${path.relative(DOCS_SRC_DIR, srcPath)} -> ${path.relative(PAGES_DIST_DIR, distPath)}`
473 - );
474 - } catch (error) {
475 - console.error(`❌ Error processing ${srcPath}:`, error);
476 - }
477 -}
478 -
479 -function isMarkdownFile(filename: string): boolean {
480 - return filename.endsWith('.mdx') || filename.endsWith('.md');
481 -}
482 -
483 -async function processAllFiles() {
484 - console.log('🔄 Processing all .mdx and .md files...');
485 -
486 - async function processDirectory(srcDir: string) {
487 - const entries = fs.readdirSync(srcDir, { withFileTypes: true });
488 - const promises: Promise<void>[] = [];
489 -
490 - for (const entry of entries) {
491 - const srcPath = path.join(srcDir, entry.name);
492 -
493 - if (entry.isDirectory()) {
494 - // Skip dist directory to avoid infinite loops
495 - if (entry.name === 'dist') continue;
496 - promises.push(processDirectory(srcPath));
497 - } else if (entry.isFile() && isMarkdownFile(entry.name)) {
498 - // Calculate the relative path from the source directory
499 - const relativePath = path.relative(DOCS_SRC_DIR, srcPath);
500 -
501 - // Always preserve directory structure
502 - const distPath = path.join(PAGES_DIST_DIR, relativePath);
503 -
504 - promises.push(processFile(srcPath, distPath));
505 - }
506 - }
507 -
508 - await Promise.all(promises);
509 - }
510 -
511 - await processDirectory(DOCS_SRC_DIR);
512 - console.log('✅ All files processed');
513 -}
514 -
515 -// Watch for changes and reprocess
516 -function startWatchMode() {
517 - console.log('👀 Watching for changes...');
518 -
519 - const watcher = watch(DOCS_SRC_DIR, { recursive: true }, (eventType, filename) => {
520 - if (!filename) return;
521 - if (!isMarkdownFile(filename)) return;
522 -
523 - const srcPath = path.join(DOCS_SRC_DIR, filename);
524 -
525 - // Always preserve directory structure
526 - const distPath = path.join(PAGES_DIST_DIR, filename);
527 -
528 - if (eventType === 'change' && fs.existsSync(srcPath)) {
529 - console.log(`🔄 File changed: ${filename}`);
530 - processFile(srcPath, distPath).catch(error => {
531 - console.error(`❌ Error processing ${filename}:`, error);
532 - });
533 - }
534 - });
535 -
536 - // Also watch source files that might be referenced
537 - const sourceWatcher = watch(PROJECT_ROOT, { recursive: true }, (eventType, filename) => {
538 - if (!filename) return;
539 - if (filename.includes('node_modules')) return;
540 - if (filename.includes('.git')) return;
541 - if (filename.includes('fern/pages')) return; // Skip pages (output) files
542 - if (filename.includes('fern/scripts')) return; // Skip the script itself
543 -
544 - // If a source file changes, reprocess all .mdx and .md files since we don't know which ones reference it
545 - if (
546 - eventType === 'change' &&
547 - (filename.endsWith('.ts') || filename.endsWith('.js') || filename.endsWith('.py'))
548 - ) {
549 - console.log(`🔄 Source file changed: ${filename}, reprocessing all .mdx and .md files...`);
550 - processAllFiles();
551 - }
552 - });
553 -
554 - // Cleanup on exit
555 - process.on('SIGINT', () => {
556 - console.log('\n👋 Stopping watchers...');
557 - watcher.close();
558 - sourceWatcher.close();
559 - process.exit(0);
560 - });
561 -}
562 -
563 -// Main function
564 -async function main() {
565 - console.log('🚀 Starting SnippetCode processor...');
566 - console.log(`Source: ${DOCS_SRC_DIR}`);
567 - console.log(`Dist: ${PAGES_DIST_DIR}`);
568 -
569 - ensureDistDir();
570 - await processAllFiles();
571 -
572 - // Check if we should run in watch mode
573 - const isWatchMode = process.argv.includes('--watch') || process.argv.includes('-w');
574 -
575 - if (isWatchMode) {
576 - startWatchMode();
577 - } else {
578 - console.log('✅ Processing complete. Use --watch flag to enable watch mode.');
579 - }
580 -}
581 -
582 -// Run the main function directly
583 -main().catch(error => {
584 - console.error('❌ Fatal error:', error);
585 - process.exit(1);
586 -});
\ No newline at end of file
fern/scripts/build-tools-json.ts deleted
-119
@@ -1,119 +0,0 @@
1 -#!/usr/bin/env bun
2 -/* eslint-disable no-console */
3 -
4 -import fs from 'fs';
5 -import path from 'path';
6 -
7 -const FERN_DIR = path.join(import.meta.dir, '..');
8 -const TOOLKITS_DIR = path.join(FERN_DIR, 'toolkits');
9 -const TOOLS_JSON_PATH = path.join(
10 - FERN_DIR,
11 - 'llms-txt-worker',
12 - 'public',
13 - 'robots-only',
14 - 'tools.json'
15 -);
16 -
17 -interface ToolkitInfo {
18 - slug: string;
19 - description: string;
20 - tools: string[];
21 -}
22 -
23 -interface ToolsData {
24 - toolkitNames: string[];
25 - [key: string]: string[] | ToolkitInfo;
26 -}
27 -
28 -function parseToolkitMdx(toolMdxPath: string): ToolkitInfo | null {
29 - try {
30 - const fullPath = path.join(TOOLKITS_DIR, toolMdxPath);
31 - if (!fs.existsSync(fullPath)) {
32 - return null;
33 - }
34 -
35 - const content = fs.readFileSync(fullPath, 'utf8');
36 -
37 - const frontmatterMatch = content.match(/^---\s*\n([\s\S]*?)\n---/);
38 - if (!frontmatterMatch) return null;
39 -
40 - const frontmatter = frontmatterMatch[1];
41 - const titleMatch = frontmatter.match(/title:\s*["']?(.+?)["']?\s*$/m);
42 - if (!titleMatch) return null;
43 -
44 - const slugMatch = content.match(/\*\*SLUG\*\*:\s*`([^`]+)`/);
45 - if (!slugMatch) return null;
46 -
47 - const descriptionMatch = content.match(/### Description\s*\n(.+?)(?:\n|$)/);
48 - const description = descriptionMatch ? descriptionMatch[1].trim() : '';
49 -
50 - const toolNames: string[] = [];
51 - const accordionMatches = content.matchAll(/<Accordion title="([^"]+)">/g);
52 -
53 - for (const match of accordionMatches) {
54 - const toolName = match[1];
55 - if (toolName.startsWith(slugMatch[1] + '_')) {
56 - toolNames.push(toolName);
57 - }
58 - }
59 -
60 - return {
61 - slug: slugMatch[1],
62 - description,
63 - tools: toolNames,
64 - };
65 - } catch (error) {
66 - console.warn(`Error parsing ${toolMdxPath}:`, error);
67 - return null;
68 - }
69 -}
70 -
71 -function buildToolsData(): ToolsData {
72 - const toolsData: ToolsData = { toolkitNames: [] };
73 -
74 - if (!fs.existsSync(TOOLKITS_DIR)) {
75 - console.error(`Toolkits directory not found: ${TOOLKITS_DIR}`);
76 - return toolsData;
77 - }
78 -
79 - const files = fs.readdirSync(TOOLKITS_DIR);
80 - const mdxFiles = files.filter(file => file.endsWith('.mdx'));
81 - console.log(`Found ${mdxFiles.length} MDX files`);
82 -
83 - for (const file of mdxFiles) {
84 - const toolkitInfo = parseToolkitMdx(file);
85 - if (toolkitInfo) {
86 - toolsData.toolkitNames.push(toolkitInfo.slug);
87 - toolsData[toolkitInfo.slug] = toolkitInfo;
88 - console.log(` ${toolkitInfo.slug}: ${toolkitInfo.tools.length} tools`);
89 - }
90 - }
91 -
92 - toolsData.toolkitNames.sort();
93 - return toolsData;
94 -}
95 -
96 -function main() {
97 - console.log('Building tools.json...');
98 - try {
99 - const toolsData = buildToolsData();
100 -
101 - console.log(`\nSummary:`);
102 - console.log(` Total toolkits: ${toolsData.toolkitNames.length}`);
103 -
104 - let totalTools = 0;
105 - for (const name of toolsData.toolkitNames) {
106 - const toolkit = toolsData[name] as ToolkitInfo;
107 - totalTools += toolkit.tools.length;
108 - }
109 - console.log(` Total tools: ${totalTools}`);
110 -
111 - fs.writeFileSync(TOOLS_JSON_PATH, JSON.stringify(toolsData, null, 2));
112 - console.log(`\nGenerated ${TOOLS_JSON_PATH}`);
113 - } catch (error) {
114 - console.error('Error:', error);
115 - process.exit(1);
116 - }
117 -}
118 -
119 -main();
\ No newline at end of file
fern/scripts/doc-new.ts deleted
-287
@@ -1,287 +0,0 @@
1 -#!/usr/bin/env bun
2 -
3 -import fs from 'fs';
4 -import path from 'path';
5 -import { parseArgs } from 'util';
6 -import readline from 'readline';
7 -
8 -const PAGES_SRC_DIR = path.join(import.meta.dir, '../pages/src');
9 -const SNIPPETS_DIR = path.join(import.meta.dir, '../snippets');
10 -
11 -const FEATURES = [
12 - 'get-started',
13 - 'tool-calling',
14 - 'authentication',
15 - 'triggers',
16 - 'providers',
17 - 'examples',
18 - 'migration',
19 - 'mcp',
20 -];
21 -
22 -const DOC_TYPES = ['guide', 'example', 'provider', 'reference'];
23 -
24 -const DOC_TEMPLATES: Record<string, (name: string) => string> = {
25 - guide: (name: string) => `---
26 -title: ${name.split('-').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(' ')}
27 -description: ""
28 -keywords: ""
29 -subtitle: ""
30 -hide-nav-links: false
31 ----
32 -
33 -## Introduction
34 -
35 -[Add your introduction here]
36 -
37 -## Getting Started
38 -
39 -[Add getting started content]
40 -
41 -## Examples
42 -
43 -[Add examples here]
44 -
45 -## Next Steps
46 -
47 -[Add next steps]
48 -`,
49 - example: (name: string) => `---
50 -title: ${name.split('-').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(' ')}
51 -description: ""
52 -keywords: ""
53 -subtitle: ""
54 -hide-nav-links: true
55 ----
56 -
57 -This example demonstrates...
58 -
59 -## Prerequisites
60 -
61 -- [List prerequisites]
62 -
63 -## Implementation
64 -
65 -[Add implementation details]
66 -
67 -## Running the Example
68 -
69 -[Add instructions]
70 -
71 -## Next Steps
72 -
73 -[Add next steps]
74 -`,
75 - provider: (name: string) => `---
76 -title: ${name.split('-').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(' ')} Provider
77 -slug: /providers/${name}
78 -image: "https://og.composio.dev/api/og?title=${encodeURIComponent(name.split('-').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(' '))}%20Provider"
79 -keywords: ""
80 -hide-nav-links: false
81 ----
82 -
83 -The ${name.split('-').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(' ')} Provider transforms Composio tools into a format compatible with ${name.split('-').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(' ')}'s function calling capabilities.
84 -
85 -## Setup
86 -
87 -<CodeGroup>
88 -\`\`\`typescript TypeScript
89 -npm install @composio/${name}
90 -\`\`\`
91 -\`\`\`python Python
92 -pip install composio[${name}]
93 -\`\`\`
94 -</CodeGroup>
95 -
96 -## Usage
97 -
98 -<Tabs>
99 -<Tab title="TypeScript">
100 -<SnippetCode
101 - src="fern/snippets/providers/typescript/${name}.ts"
102 - title="${name}-provider.ts"
103 -/>
104 -</Tab>
105 -<Tab title="Python">
106 -<SnippetCode
107 - src="fern/snippets/providers/python/${name}.py"
108 - title="${name}-provider.py"
109 -/>
110 -</Tab>
111 -</Tabs>
112 -`,
113 - reference: (name: string) => `---
114 -title: ${name.split('-').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(' ')}
115 -description: ""
116 -keywords: ""
117 -subtitle: ""
118 -hide-nav-links: false
119 ----
120 -
121 -## Overview
122 -
123 -[Add overview]
124 -
125 -## API Reference
126 -
127 -[Add API reference]
128 -
129 -## Examples
130 -
131 -[Add examples]
132 -`,
133 -};
134 -
135 -const rl = readline.createInterface({
136 - input: process.stdin,
137 - output: process.stdout,
138 -});
139 -
140 -function question(prompt: string): Promise<string> {
141 - return new Promise((resolve) => {
142 - rl.question(prompt, resolve);
143 - });
144 -}
145 -
146 -function validateFeature(feature: string): boolean {
147 - return FEATURES.includes(feature);
148 -}
149 -
150 -function validateDocType(type: string): boolean {
151 - return DOC_TYPES.includes(type);
152 -}
153 -
154 -async function createDoc(feature: string, name: string, type: string) {
155 - if (!validateFeature(feature)) {
156 - console.error(`❌ Invalid feature: ${feature}`);
157 - console.log(`Valid features: ${FEATURES.join(', ')}`);
158 - process.exit(1);
159 - }
160 -
161 - if (!validateDocType(type)) {
162 - console.error(`❌ Invalid type: ${type}`);
163 - console.log(`Valid types: ${DOC_TYPES.join(', ')}`);
164 - process.exit(1);
165 - }
166 -
167 - const featureDir = path.join(PAGES_SRC_DIR, feature);
168 - const fileName = `${name}.mdx`;
169 - const filePath = path.join(featureDir, fileName);
170 -
171 - // Create directory if it doesn't exist
172 - if (!fs.existsSync(featureDir)) {
173 - fs.mkdirSync(featureDir, { recursive: true });
174 - console.log(`📁 Created directory: ${path.relative(PAGES_SRC_DIR, featureDir)}`);
175 - }
176 -
177 - // Check if file already exists
178 - if (fs.existsSync(filePath)) {
179 - console.error(`❌ File already exists: ${path.relative(PAGES_SRC_DIR, filePath)}`);
180 - process.exit(1);
181 - }
182 -
183 - // Write the template
184 - const template = DOC_TEMPLATES[type];
185 - fs.writeFileSync(filePath, template(name));
186 - console.log(`✅ Created doc: ${path.relative(PAGES_SRC_DIR, filePath)}`);
187 -
188 - // Ask about creating snippet files
189 - if (type === 'provider' || type === 'example') {
190 - const createSnippets = await question('\n📝 Create matching snippet files? (y/n): ');
191 - if (createSnippets.toLowerCase() === 'y') {
192 - await createMatchingSnippets(feature, name);
193 - }
194 - }
195 -
196 - // Show navigation update suggestion
197 - console.log(`\n📋 To add this to navigation, update fern/docs.yml:`);
198 - console.log(` - page: ${name.split('-').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(' ')}`);
199 - console.log(` path: pages/dist/${feature}/${fileName}`);
200 - if (type === 'provider') {
201 - console.log(` slug: ${name}`);
202 - }
203 -
204 - rl.close();
205 -}
206 -
207 -async function createMatchingSnippets(feature: string, name: string) {
208 - const languages = ['python', 'typescript'];
209 - const extensions = { python: 'py', typescript: 'ts' };
210 -
211 - for (const lang of languages) {
212 - const snippetFeatureDir = path.join(SNIPPETS_DIR, feature, lang);
213 - const snippetFileName = `${name}.${extensions[lang]}`;
214 - const snippetFilePath = path.join(snippetFeatureDir, snippetFileName);
215 -
216 - // Create directory if it doesn't exist
217 - if (!fs.existsSync(snippetFeatureDir)) {
218 - fs.mkdirSync(snippetFeatureDir, { recursive: true });
219 - }
220 -
221 - // Skip if file exists
222 - if (fs.existsSync(snippetFilePath)) {
223 - console.log(`⚠️ Snippet already exists: ${path.relative(SNIPPETS_DIR, snippetFilePath)}`);
224 - continue;
225 - }
226 -
227 - // Create snippet with boilerplate
228 - const boilerplate = lang === 'python'
229 - ? `from composio import Composio\n\n# Initialize Composio client\ncomposio = Composio()\n\n# TODO: Add ${name} provider example\n`
230 - : `import { Composio } from '@composio/core';\n\n// Initialize Composio client\nconst composio = new Composio();\n\n// TODO: Add ${name} provider example\n`;
231 -
232 - fs.writeFileSync(snippetFilePath, boilerplate);
233 - console.log(`✅ Created snippet: ${path.relative(SNIPPETS_DIR, snippetFilePath)}`);
234 - }
235 -}
236 -
237 -function showHelp() {
238 - console.log(`
239 -Usage: pnpm doc:new --feature=<feature> --name=<name> --type=<type>
240 -
241 -Options:
242 - --feature The feature category (required)
243 - Valid values: ${FEATURES.join(', ')}
244 -
245 - --name The name of the doc file (required)
246 - Will be saved as <name>.mdx
247 -
248 - --type The type of documentation (required)
249 - Valid values: ${DOC_TYPES.join(', ')}
250 -
251 - --help Show this help message
252 -
253 -Examples:
254 - pnpm doc:new --feature=providers --name=gemini --type=provider
255 - pnpm doc:new --feature=examples --name=calendar-sync --type=example
256 - pnpm doc:new --feature=authentication --name=oauth-flow --type=guide
257 -`);
258 -}
259 -
260 -async function main() {
261 - const { values } = parseArgs({
262 - args: process.argv.slice(2),
263 - options: {
264 - feature: { type: 'string' },
265 - name: { type: 'string' },
266 - type: { type: 'string' },
267 - help: { type: 'boolean' },
268 - },
269 - });
270 -
271 - if (values.help) {
272 - showHelp();
273 - process.exit(0);
274 - }
275 -
276 - const { feature, name, type } = values;
277 -
278 - if (!feature || !name || !type) {
279 - console.error('❌ Missing required arguments');
280 - showHelp();
281 - process.exit(1);
282 - }
283 -
284 - await createDoc(feature, name, type);
285 -}
286 -
287 -main();
\ No newline at end of file
fern/scripts/examples-dev.ts deleted
-286
@@ -1,286 +0,0 @@
1 -#!/usr/bin/env bun
2 -/* eslint-disable no-console */
3 -
4 -import fs from 'fs';
5 -import path from 'path';
6 -import { watch } from 'fs';
7 -
8 -const EXAMPLES_SRC_DIR = path.join(import.meta.dir, '../pages/examples');
9 -const EXAMPLES_DIST_DIR = path.join(import.meta.dir, '../pages/examples/dist');
10 -const PROJECT_ROOT = path.join(import.meta.dir, '../..');
11 -
12 -interface ExampleCodeProps {
13 - src: string;
14 - startLine?: number;
15 - endLine?: number;
16 - highlightStart?: number;
17 - highlightEnd?: number;
18 - title?: string;
19 - language?: string;
20 -}
21 -
22 -// Ensure dist directory exists
23 -function ensureDistDir() {
24 - if (!fs.existsSync(EXAMPLES_DIST_DIR)) {
25 - fs.mkdirSync(EXAMPLES_DIST_DIR, { recursive: true });
26 - }
27 -}
28 -
29 -// Get language from file extension
30 -function getLanguageFromPath(filePath: string): string {
31 - const extension = filePath.split('.').pop()?.toLowerCase();
32 - const languageMap: Record<string, string> = {
33 - py: 'python',
34 - js: 'javascript',
35 - ts: 'typescript',
36 - tsx: 'typescript',
37 - jsx: 'javascript',
38 - java: 'java',
39 - cpp: 'cpp',
40 - c: 'c',
41 - go: 'go',
42 - rs: 'rust',
43 - php: 'php',
44 - rb: 'ruby',
45 - swift: 'swift',
46 - kt: 'kotlin',
47 - scala: 'scala',
48 - sh: 'bash',
49 - yml: 'yaml',
50 - yaml: 'yaml',
51 - json: 'json',
52 - xml: 'xml',
53 - html: 'html',
54 - css: 'css',
55 - scss: 'scss',
56 - sql: 'sql',
57 - };
58 - return languageMap[extension || ''] || 'text';
59 -}
60 -
61 -// Read and extract lines from a file
62 -function readFileLines(filePath: string, startLine?: number, endLine?: number): string {
63 - try {
64 - const fullPath = path.resolve(PROJECT_ROOT, filePath);
65 - const content = fs.readFileSync(fullPath, 'utf8');
66 - const lines = content.split('\n');
67 -
68 - const start = startLine ? startLine - 1 : 0;
69 - const end = endLine ? endLine : lines.length;
70 -
71 - return lines.slice(start, end).join('\n');
72 - } catch (error) {
73 - console.warn(`⚠️ Failed to read file: ${filePath}`, error);
74 - return `// File not found: ${filePath}`;
75 - }
76 -}
77 -
78 -// Generate highlight string for Fern
79 -function generateHighlightString(
80 - startLine: number,
81 - highlightStart?: number,
82 - highlightEnd?: number
83 -): string {
84 - if (!highlightStart || !highlightEnd) return '';
85 -
86 - // Convert to relative line numbers (relative to the excerpt)
87 - const relativeStart = highlightStart - startLine + 1;
88 - const relativeEnd = highlightEnd - startLine + 1;
89 -
90 - if (relativeStart === relativeEnd) {
91 - return `{${relativeStart}}`;
92 - }
93 - return `{${relativeStart}-${relativeEnd}}`;
94 -}
95 -
96 -// Parse ExampleCode tags and replace with actual code blocks
97 -function parseExampleCodeTags(content: string): string {
98 - const exampleCodeRegex = /<ExampleCode\s+([^>]*?)(?:\s*\/?>|>\s*<\/ExampleCode>)/g;
99 -
100 - return content.replace(exampleCodeRegex, (match, propsString) => {
101 - // Parse props from the tag
102 - const props: Partial<ExampleCodeProps> = {};
103 -
104 - // Extract src
105 - const srcMatch = propsString.match(/src=["']([^"']+)["']/);
106 - if (srcMatch) props.src = srcMatch[1];
107 -
108 - // Extract other numeric props (handle both JSX {1} and quoted "1" syntax)
109 - const startLineMatch = propsString.match(/startLine=(?:["'](\d+)["']|{(\d+)})/);
110 - if (startLineMatch) props.startLine = parseInt(startLineMatch[1] || startLineMatch[2]);
111 -
112 - const endLineMatch = propsString.match(/endLine=(?:["'](\d+)["']|{(\d+)})/);
113 - if (endLineMatch) props.endLine = parseInt(endLineMatch[1] || endLineMatch[2]);
114 -
115 - const highlightStartMatch = propsString.match(/highlightStart=(?:["'](\d+)["']|{(\d+)})/);
116 - if (highlightStartMatch)
117 - props.highlightStart = parseInt(highlightStartMatch[1] || highlightStartMatch[2]);
118 -
119 - const highlightEndMatch = propsString.match(/highlightEnd=(?:["'](\d+)["']|{(\d+)})/);
120 - if (highlightEndMatch)
121 - props.highlightEnd = parseInt(highlightEndMatch[1] || highlightEndMatch[2]);
122 -
123 - // Extract string props
124 - const titleMatch = propsString.match(/title=["']([^"']+)["']/);
125 - if (titleMatch) props.title = titleMatch[1];
126 -
127 - const languageMatch = propsString.match(/language=["']([^"']+)["']/);
128 - if (languageMatch) props.language = languageMatch[1];
129 -
130 - if (!props.src) {
131 - console.warn('⚠️ ExampleCode tag missing src attribute:', match);
132 - return '```\n// Error: ExampleCode tag missing src attribute\n```';
133 - }
134 -
135 - // Read the file content
136 - const codeContent = readFileLines(props.src, props.startLine, props.endLine);
137 - const language = props.language || getLanguageFromPath(props.src);
138 -
139 - // Generate highlight string if needed
140 - const highlightString =
141 - props.highlightStart && props.highlightEnd
142 - ? generateHighlightString(props.startLine || 1, props.highlightStart, props.highlightEnd)
143 - : '';
144 -
145 - // Generate the title comment
146 - const titleComment = props.title ? ` title="${props.title}"` : '';
147 -
148 - // Create the code block
149 - const codeBlock = `\`\`\`${language}${highlightString ? ` ${highlightString}` : ''}${titleComment}\n${codeContent}\n\`\`\``;
150 -
151 - return codeBlock;
152 - });
153 -}
154 -
155 -// Process a single .mdx file
156 -function processFile(srcPath: string, distPath: string) {
157 - try {
158 - const content = fs.readFileSync(srcPath, 'utf8');
159 - const processedContent = parseExampleCodeTags(content);
160 -
161 - // Ensure the directory exists
162 - const distDir = path.dirname(distPath);
163 - if (!fs.existsSync(distDir)) {
164 - fs.mkdirSync(distDir, { recursive: true });
165 - }
166 -
167 - fs.writeFileSync(distPath, processedContent);
168 - console.log(
169 - `✅ Processed: ${path.relative(EXAMPLES_SRC_DIR, srcPath)} -> ${path.relative(EXAMPLES_DIST_DIR, distPath)}`
170 - );
171 - } catch (error) {
172 - console.error(`❌ Error processing ${srcPath}:`, error);
173 - }
174 -}
175 -
176 -// Process all .mdx files in the source directory
177 -function processAllFiles() {
178 - console.log('🔄 Processing all .mdx files...');
179 -
180 - function processDirectory(srcDir: string) {
181 - const entries = fs.readdirSync(srcDir, { withFileTypes: true });
182 -
183 - for (const entry of entries) {
184 - const srcPath = path.join(srcDir, entry.name);
185 -
186 - if (entry.isDirectory()) {
187 - // Skip dist directory to avoid infinite loops
188 - if (entry.name === 'dist') continue;
189 - processDirectory(srcPath);
190 - } else if (entry.isFile() && entry.name.endsWith('.mdx')) {
191 - // Calculate the relative path from the source directory
192 - const relativePath = path.relative(EXAMPLES_SRC_DIR, srcPath);
193 -
194 - // Remove 'src/' prefix if it exists and create dist path
195 - const cleanRelativePath = relativePath.startsWith('src/')
196 - ? relativePath.substring(4) // Remove 'src/' prefix
197 - : relativePath;
198 -
199 - const distPath = path.join(EXAMPLES_DIST_DIR, cleanRelativePath);
200 - processFile(srcPath, distPath);
201 - }
202 - }
203 - }
204 -
205 - processDirectory(EXAMPLES_SRC_DIR);
206 - console.log('✅ All files processed');
207 -}
208 -
209 -// Watch for changes and reprocess
210 -function startWatchMode() {
211 - console.log('👀 Watching for changes...');
212 -
213 - const watcher = watch(EXAMPLES_SRC_DIR, { recursive: true }, (eventType, filename) => {
214 - if (!filename) return;
215 - if (!filename.endsWith('.mdx')) return;
216 -
217 - // Skip dist files completely - they should never trigger processing
218 - if (filename.includes('dist/') || filename.includes('dist\\')) {
219 - return;
220 - }
221 -
222 - // Only process files in src/ subdirectory
223 - if (!filename.startsWith('src/') && !filename.startsWith('src\\')) {
224 - return;
225 - }
226 -
227 - const srcPath = path.join(EXAMPLES_SRC_DIR, filename);
228 -
229 - // Remove 'src/' prefix and create dist path
230 - const cleanFilename = filename.substring(4); // Remove 'src/' prefix
231 - const distPath = path.join(EXAMPLES_DIST_DIR, cleanFilename);
232 -
233 - if (eventType === 'change' && fs.existsSync(srcPath)) {
234 - console.log(`🔄 File changed: ${filename}`);
235 - processFile(srcPath, distPath);
236 - }
237 - });
238 -
239 - // Also watch source files that might be referenced
240 - const sourceWatcher = watch(PROJECT_ROOT, { recursive: true }, (eventType, filename) => {
241 - if (!filename) return;
242 - if (filename.includes('node_modules')) return;
243 - if (filename.includes('.git')) return;
244 - if (filename.includes('fern/pages/examples/dist')) return; // Skip dist files
245 - if (filename.includes('fern/scripts')) return; // Skip the script itself
246 -
247 - // If a source file changes, reprocess all .mdx files since we don't know which ones reference it
248 - if (
249 - eventType === 'change' &&
250 - (filename.endsWith('.ts') || filename.endsWith('.js') || filename.endsWith('.py'))
251 - ) {
252 - console.log(`🔄 Source file changed: ${filename}, reprocessing all .mdx files...`);
253 - processAllFiles();
254 - }
255 - });
256 -
257 - // Cleanup on exit
258 - process.on('SIGINT', () => {
259 - console.log('\n👋 Stopping watchers...');
260 - watcher.close();
261 - sourceWatcher.close();
262 - process.exit(0);
263 - });
264 -}
265 -
266 -// Main function
267 -function main() {
268 - console.log('🚀 Starting ExampleCode processor...');
269 -
270 - ensureDistDir();
271 - processAllFiles();
272 -
273 - // Check if we should run in watch mode
274 - const isWatchMode = process.argv.includes('--watch') || process.argv.includes('-w');
275 -
276 - if (isWatchMode) {
277 - startWatchMode();
278 - } else {
279 - console.log('✅ Processing complete. Use --watch flag to enable watch mode.');
280 - }
281 -}
282 -
283 -// Run if this is the main module
284 -if (import.meta.main) {
285 - main();
286 -}
fern/scripts/manage-tool-docs.py deleted
-185
@@ -1,185 +0,0 @@
1 -#!/usr/bin/env python3
2 -"""
3 -Script to comment/uncomment tool docs in docs.yml, leaving only the introduction.
4 -Uses ruamel.yaml to properly parse and modify the YAML structure.
5 -"""
6 -
7 -import argparse
8 -from pathlib import Path
9 -from ruamel.yaml import YAML
10 -from ruamel.yaml.comments import CommentedMap, CommentedSeq
11 -import io
12 -
13 -
14 -def process_tool_docs(file_path: Path, action: str) -> None:
15 - """
16 - Process the docs.yml file to comment or uncomment tool docs.
17 -
18 - Args:
19 - file_path: Path to the docs.yml file
20 - action: Either 'comment' or 'uncomment'
21 - """
22 - yaml = YAML()
23 - yaml.preserve_quotes = True
24 - yaml.width = 4096 # Prevent line wrapping
25 - yaml.indent(mapping=2, sequence=2, offset=0)
26 -
27 - # Read the file content
28 - with open(file_path, 'r') as f:
29 - content = f.read()
30 -
31 - if action == 'uncomment':
32 - # First, uncomment any commented lines in the toolkits section
33 - lines = content.split('\n')
34 - new_lines = []
35 - in_tools_section = False
36 -
37 - for i, line in enumerate(lines):
38 - # Check if we're entering the toolkits tab
39 - if '- tab: toolkits' in line:
40 - in_tools_section = True
41 - # Check if we're leaving the toolkits tab
42 - elif in_tools_section and line.strip().startswith('- tab:'):
43 - in_tools_section = False
44 -
45 - # Uncomment lines in toolkits section
46 - if in_tools_section and line.strip().startswith('#') and ('- page:' in line or 'path:' in line):
47 - # Remove comment while preserving indentation
48 - uncommented = line.replace('# ', '', 1) if '# ' in line else line.replace('#', '', 1)
49 - new_lines.append(uncommented)
50 - else:
51 - new_lines.append(line)
52 -
53 - content = '\n'.join(new_lines)
54 -
55 - # Parse the YAML
56 - data = yaml.load(content)
57 -
58 - # Find the navigation section
59 - if 'navigation' not in data:
60 - print("Error: No navigation section found in docs.yml")
61 - return
62 -
63 - # Find the toolkits tab
64 - tools_tab = None
65 - for tab in data['navigation']:
66 - if isinstance(tab, CommentedMap) and tab.get('tab') == 'toolkits':
67 - tools_tab = tab
68 - break
69 -
70 - if not tools_tab:
71 - print("Error: No toolkits tab found in navigation")
72 - return
73 -
74 - # Find the toolkits section within the toolkits tab
75 - if 'layout' not in tools_tab:
76 - print("Error: No layout found in toolkits tab")
77 - return
78 -
79 - tools_section = None
80 - for section in tools_tab['layout']:
81 - if isinstance(section, CommentedMap) and section.get('section') == 'Toolkits':
82 - tools_section = section
83 - break
84 -
85 - if not tools_section or 'contents' not in tools_section:
86 - print("Error: No contents found in Toolkits section")
87 - return
88 -
89 - if action == 'comment':
90 - # Write the data to a string first
91 - stream = io.StringIO()
92 - yaml.dump(data, stream)
93 - content = stream.getvalue()
94 -
95 - # Now manually comment out toolkits after the 1st one (introduction)
96 - lines = content.split('\n')
97 - new_lines = []
98 - in_tools_section = False
99 - tool_count = 0
100 - i = 0
101 -
102 - while i < len(lines):
103 - line = lines[i]
104 -
105 - # Check if we're entering the toolkits section
106 - if '- section: Toolkits' in line and 'toolkits' in '\n'.join(lines[max(0, i-10):i]):
107 - in_tools_section = True
108 - new_lines.append(line)
109 - i += 1
110 - continue
111 -
112 - # Check if we're leaving the tools section
113 - if in_tools_section and line.strip().startswith('- tab:'):
114 - in_tools_section = False
115 - tool_count = 0
116 -
117 - # Count and process tool entries
118 - if in_tools_section and '- page:' in line and line.strip().startswith('- page:'):
119 - tool_count += 1
120 - if tool_count > 1: # Skip only the introduction
121 - # Comment out this line and the next one (path line)
122 - indent = len(line) - len(line.lstrip())
123 - new_lines.append(' ' * indent + '# ' + line.lstrip())
124 - # Also comment the next line if it's a path line
125 - if i + 1 < len(lines) and 'path:' in lines[i + 1]:
126 - i += 1
127 - line = lines[i]
128 - indent = len(line) - len(line.lstrip())
129 - new_lines.append(' ' * indent + '# ' + line.lstrip())
130 - else:
131 - new_lines.append(line)
132 - else:
133 - new_lines.append(line)
134 -
135 - i += 1
136 -
137 - # Write the commented version
138 - with open(file_path, 'w') as f:
139 - f.write('\n'.join(new_lines))
140 - else:
141 - # For uncomment, just write the parsed data back
142 - with open(file_path, 'w') as f:
143 - yaml.dump(data, f)
144 -
145 - print(f"Successfully {action}ed tool docs in {file_path}")
146 - if action == 'comment':
147 - print("Left uncommented: Introduction only")
148 - else:
149 - print("All tool docs are now uncommented")
150 -
151 -
152 -def main():
153 - parser = argparse.ArgumentParser(
154 - description='Comment or uncomment tool docs in docs.yml using ruamel.yaml'
155 - )
156 - parser.add_argument(
157 - 'action',
158 - choices=['comment', 'uncomment'],
159 - help='Action to perform: comment or uncomment tool docs'
160 - )
161 - parser.add_argument(
162 - '--file',
163 - type=Path,
164 - default=Path(__file__).parent.parent / 'docs.yml',
165 - help='Path to docs.yml file (default: ../docs.yml relative to script)'
166 - )
167 -
168 - args = parser.parse_args()
169 -
170 - if not args.file.exists():
171 - print(f"Error: File {args.file} does not exist")
172 - return 1
173 -
174 - try:
175 - process_tool_docs(args.file, args.action)
176 - return 0
177 - except Exception as e:
178 - print(f"Error processing file: {e}")
179 - import traceback
180 - traceback.print_exc()
181 - return 1
182 -
183 -
184 -if __name__ == '__main__':
185 - exit(main())
fern/scripts/pull-openapi-spec.sh deleted
-65
@@ -1,65 +0,0 @@
1 -#!/bin/bash
2 -
3 -# Exit on any error
4 -set -e
5 -
6 -OPENAPI_URL="https://backend.composio.dev/api/v3/openapi.json"
7 -OPENAPI_MCP_URL="https://mcp.composio.dev/openapi.json"
8 -
9 -# Get the directory where the script is located, works in both CI and local environments
10 -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}" 2>/dev/null || dirname "$0")" && pwd)"
11 -FERN_DIR="$(dirname "$SCRIPT_DIR")"
12 -API_DIR="$FERN_DIR/apis"
13 -OUTPUT_FILE="$API_DIR/openapi.json"
14 -# OUTPUT_V3_FILE="$API_DIR/openapi-v3.json"
15 -OUTPUT_MCP_FILE="$API_DIR/openapi-mcp.json"
16 -
17 -# Debug information
18 -echo "Script directory: $SCRIPT_DIR"
19 -echo "Fern directory: $FERN_DIR"
20 -echo "API directory: $API_DIR"
21 -
22 -# Create API directory if it doesn't exist
23 -mkdir -p "$API_DIR"
24 -
25 -echo "Pulling latest OpenAPI specification from $OPENAPI_URL"
26 -
27 -# Use curl to fetch the OpenAPI specification directly to output file
28 -if curl -f -o "$OUTPUT_FILE" "$OPENAPI_URL"; then
29 - echo "Successfully downloaded OpenAPI specification to $OUTPUT_FILE"
30 -else
31 - echo "Failed to download OpenAPI specification"
32 - exit 1
33 -fi
34 -
35 -# Validate that the file exists and is not empty
36 -if [ -s "$OUTPUT_FILE" ]; then
37 - echo "Verified OpenAPI specification file exists and is not empty"
38 -else
39 - echo "Error: OpenAPI specification file is empty or does not exist"
40 - exit 1
41 -fi
42 -
43 -# Fetch the MCP OpenAPI specification directly to output file
44 -echo "Pulling latest MCP OpenAPI specification from $OPENAPI_MCP_URL"
45 -if curl -f -o "$OUTPUT_MCP_FILE" "$OPENAPI_MCP_URL"; then
46 - echo "Successfully downloaded MCP OpenAPI specification to $OUTPUT_MCP_FILE"
47 -else
48 - echo "Failed to download MCP OpenAPI specification"
49 - exit 1
50 -fi
51 -
52 -# Validate that the MCP file exists and is not empty
53 -if [ -s "$OUTPUT_MCP_FILE" ]; then
54 - echo "Verified MCP OpenAPI specification file exists and is not empty"
55 -else
56 - echo "Error: MCP OpenAPI specification file is empty or does not exist"
57 - exit 1
58 -fi
59 -
60 -# For debugging
61 -ls -la "$API_DIR"
62 -echo "FERN_DIR=$FERN_DIR"
63 -echo "API_DIR=$API_DIR"
64 -
65 -echo "OpenAPI specifications successfully updated"
fern/scripts/snippet-new.ts deleted
-140
@@ -1,140 +0,0 @@
1 -#!/usr/bin/env bun
2 -
3 -import fs from 'fs';
4 -import path from 'path';
5 -import { parseArgs } from 'util';
6 -
7 -const SNIPPETS_DIR = path.join(import.meta.dir, '../snippets');
8 -
9 -const FEATURES = [
10 - 'get-started',
11 - 'tool-calling',
12 - 'authentication',
13 - 'triggers',
14 - 'providers',
15 - 'examples',
16 - 'migration',
17 - 'mcp',
18 -];
19 -
20 -const LANGUAGES = ['python', 'typescript'];
21 -
22 -const LANGUAGE_EXTENSIONS: Record<string, string> = {
23 - python: 'py',
24 - typescript: 'ts',
25 -};
26 -
27 -const LANGUAGE_BOILERPLATES: Record<string, string> = {
28 - python: `from composio import Composio
29 -
30 -# Initialize Composio client
31 -composio = Composio()
32 -
33 -# TODO: Add your code here
34 -`,
35 - typescript: `import { Composio } from '@composio/core';
36 -
37 -// Initialize Composio client
38 -const composio = new Composio();
39 -
40 -// TODO: Add your code here
41 -`,
42 -};
43 -
44 -function validateFeature(feature: string): boolean {
45 - return FEATURES.includes(feature);
46 -}
47 -
48 -function validateLanguage(lang: string): boolean {
49 - return LANGUAGES.includes(lang);
50 -}
51 -
52 -function createSnippet(feature: string, name: string, lang: string) {
53 - if (!validateFeature(feature)) {
54 - console.error(`❌ Invalid feature: ${feature}`);
55 - console.log(`Valid features: ${FEATURES.join(', ')}`);
56 - process.exit(1);
57 - }
58 -
59 - if (!validateLanguage(lang)) {
60 - console.error(`❌ Invalid language: ${lang}`);
61 - console.log(`Valid languages: ${LANGUAGES.join(', ')}`);
62 - process.exit(1);
63 - }
64 -
65 - const extension = LANGUAGE_EXTENSIONS[lang];
66 - const boilerplate = LANGUAGE_BOILERPLATES[lang];
67 -
68 - const featureDir = path.join(SNIPPETS_DIR, feature, lang);
69 - const fileName = `${name}.${extension}`;
70 - const filePath = path.join(featureDir, fileName);
71 -
72 - // Create directory if it doesn't exist
73 - if (!fs.existsSync(featureDir)) {
74 - fs.mkdirSync(featureDir, { recursive: true });
75 - console.log(`📁 Created directory: ${path.relative(SNIPPETS_DIR, featureDir)}`);
76 - }
77 -
78 - // Check if file already exists
79 - if (fs.existsSync(filePath)) {
80 - console.error(`❌ File already exists: ${path.relative(SNIPPETS_DIR, filePath)}`);
81 - process.exit(1);
82 - }
83 -
84 - // Write the boilerplate
85 - fs.writeFileSync(filePath, boilerplate);
86 - console.log(`✅ Created snippet: ${path.relative(SNIPPETS_DIR, filePath)}`);
87 - console.log(`\nYou can now reference this snippet in your docs with:`);
88 - console.log(`<SnippetCode src="fern/snippets/${feature}/${lang}/${fileName}" />`);
89 -}
90 -
91 -function showHelp() {
92 - console.log(`
93 -Usage: pnpm snippet:new --feature=<feature> --name=<name> --lang=<language>
94 -
95 -Options:
96 - --feature The feature category (required)
97 - Valid values: ${FEATURES.join(', ')}
98 -
99 - --name The name of the snippet file (required)
100 - Will be saved as <name>.<extension>
101 -
102 - --lang The programming language (required)
103 - Valid values: ${LANGUAGES.join(', ')}
104 -
105 - --help Show this help message
106 -
107 -Examples:
108 - pnpm snippet:new --feature=providers --name=anthropic --lang=python
109 - pnpm snippet:new --feature=triggers --name=slack-events --lang=typescript
110 -`);
111 -}
112 -
113 -function main() {
114 - const { values } = parseArgs({
115 - args: process.argv.slice(2),
116 - options: {
117 - feature: { type: 'string' },
118 - name: { type: 'string' },
119 - lang: { type: 'string' },
120 - help: { type: 'boolean' },
121 - },
122 - });
123 -
124 - if (values.help) {
125 - showHelp();
126 - process.exit(0);
127 - }
128 -
129 - const { feature, name, lang } = values;
130 -
131 - if (!feature || !name || !lang) {
132 - console.error('❌ Missing required arguments');
133 - showHelp();
134 - process.exit(1);
135 - }
136 -
137 - createSnippet(feature, name, lang);
138 -}
139 -
140 -main();
\ No newline at end of file
fern/snippets/authentication/python/auth-config.py deleted
-14
@@ -1,14 +0,0 @@
1 -from composio import Composio
2 -
3 -composio = Composio()
4 -
5 -# Use custom auth
6 -auth_config = composio.auth_configs.create(
7 - toolkit="perplexityai",
8 - options={
9 - "type": "use_custom_auth",
10 - "auth_scheme": "API_KEY",
11 - "credentials": {}
12 - },
13 -)
14 -print(auth_config)
fern/snippets/authentication/python/connect-link.py deleted
-29
@@ -1,29 +0,0 @@
1 -from composio import Composio
2 -
3 -composio = Composio(api_key="your_api_key")
4 -
5 -# Use the "AUTH CONFIG ID" from your dashboard
6 -auth_config_id = "your_auth_config_id"
7 -
8 -# Use a unique identifier for each user in your application
9 -user_id = 'user-1349-129-12'
10 -
11 -connection_request = composio.connected_accounts.link(
12 - user_id=user_id,
13 - auth_config_id=auth_config_id,
14 - callback_url='https://your-app.com/callback'
15 -)
16 -
17 -redirect_url = connection_request.redirect_url
18 -print(f"Visit: {redirect_url} to authenticate your account")
19 -
20 -# Wait for the connection to be established
21 -connected_account = connection_request.wait_for_connection()
22 -print(connected_account.id)
23 -
24 -# Alternative: Wait with custom timeout
25 -# connected_account = connection_request.wait_for_connection(120) # 2 minute timeout
26 -
27 -# Alternative: If you only have the connection request ID (e.g., stored in database)
28 -# connection_id = connection_request.id # You can store this ID in your database
29 -# connected_account = composio.connected_accounts.wait_for_connection(connection_id, 60)
\ No newline at end of file
fern/snippets/authentication/python/connected-accounts-management.py deleted
-103
@@ -1,103 +0,0 @@
1 -from composio import Composio
2 -
3 -composio = Composio(api_key="YOUR_COMPOSIO_API_KEY")
4 -
5 -# Define variables
6 -user_id = "user-123"
7 -auth_config_id = "auth-config-id"
8 -connected_account_id = "conn_abc123"
9 -
10 -# --- Listing Connected Accounts ---
11 -
12 -# List all accounts for a user
13 -accounts = composio.connected_accounts.list(
14 - user_ids=[user_id]
15 -)
16 -
17 -# Filter by status
18 -active_accounts = composio.connected_accounts.list(
19 - user_ids=[user_id],
20 - statuses=["ACTIVE"]
21 -)
22 -
23 -# --- Retrieving a Specific Account ---
24 -
25 -account = composio.connected_accounts.get(connected_account_id)
26 -
27 -print(f"Status: {account.status}")
28 -print(f"Toolkit: {account.toolkit.slug}")
29 -
30 -# --- Using Account Credentials ---
31 -
32 -# Get the connected account's authentication state
33 -if account.state:
34 - # The state contains the auth scheme and credentials
35 - auth_scheme = account.state.auth_scheme
36 - credentials = account.state.val
37 -
38 - print(f"Auth scheme: {auth_scheme}")
39 - print(f"Credentials: {credentials}")
40 -
41 -# --- Refreshing Credentials ---
42 -
43 -try:
44 - refreshed = composio.connected_accounts.refresh(connected_account_id)
45 - print(f"Redirect URL: {refreshed.redirect_url}")
46 -
47 - # Wait for the connection to be established
48 - composio.connected_accounts.wait_for_connection(refreshed.id)
49 -except Exception as e:
50 - print(f"Failed to refresh tokens: {e}")
51 -
52 -# --- Enabling and Disabling Accounts ---
53 -
54 -# Disable an account
55 -disabled = composio.connected_accounts.disable(connected_account_id)
56 -print(f"Account disabled status: {disabled.success}")
57 -
58 -# Re-enable when needed
59 -enabled = composio.connected_accounts.enable(connected_account_id)
60 -print(f"Account enabled status: {enabled.success}")
61 -
62 -# --- Deleting Accounts ---
63 -
64 -# Delete a connected account
65 -composio.connected_accounts.delete(connected_account_id)
66 -print("Account deleted successfully")
67 -
68 -# --- Managing Multiple Accounts ---
69 -
70 -# First account
71 -try:
72 - first_account = composio.connected_accounts.initiate(
73 - user_id=user_id,
74 - auth_config_id=auth_config_id
75 - )
76 - print(f"First account redirect URL: {first_account.redirect_url}")
77 - connected_first_account = first_account.wait_for_connection()
78 - print(f"First account status: {connected_first_account.status}")
79 -except Exception as e:
80 - print(f"Error initiating first account: {e}")
81 -
82 -# Second account - must explicitly allow multiple
83 -try:
84 - second_account = composio.connected_accounts.initiate(
85 - user_id=user_id,
86 - auth_config_id=auth_config_id,
87 - allow_multiple=True # Required for additional accounts
88 - )
89 - print(f"Second account redirect URL: {second_account.redirect_url}")
90 - connected_second_account = second_account.wait_for_connection()
91 - print(f"Second account status: {connected_second_account.status}")
92 -except Exception as e:
93 - print(f"Error initiating second account: {e}")
94 -
95 -# Execute tool with a specific connected account
96 -result = composio.tools.execute(
97 - "GMAIL_GET_PROFILE",
98 - user_id=user_id,
99 - connected_account_id=connected_account_id, # Specify which account to use
100 - version="20251111_00",
101 - arguments={}
102 -)
103 -print(f"Tool executed: {result}")
\ No newline at end of file
fern/snippets/authentication/python/define-scopes.py deleted
-17
@@ -1,17 +0,0 @@
1 -from composio import Composio
2 -
3 -composio = Composio()
4 -
5 -response = composio.auth_configs.create(
6 - toolkit="HUBSPOT",
7 - options={
8 - "name": "HubspotConfig",
9 - "authScheme": "OAUTH2",
10 - "type": "use_composio_managed_auth",
11 - "credentials": {
12 - "scopes": "sales-email-read,tickets"
13 - }
14 - }
15 -)
16 -
17 -print(response.id)
\ No newline at end of file
fern/snippets/authentication/typescript/auth-config.ts deleted
-12
@@ -1,12 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -
3 -const composio = new Composio();
4 -
5 -const authConfig = await composio.authConfigs.create('PERPLEXITYAI', {
6 - name: 'Perplexity AI',
7 - type: 'use_custom_auth',
8 - credentials: {},
9 - authScheme: 'API_KEY',
10 -});
11 -
12 -console.log(authConfig);
fern/snippets/authentication/typescript/connect-link.ts deleted
-26
@@ -1,26 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -
3 -const composio = new Composio({apiKey: "your_api_key"});
4 -
5 -// Use the "AUTH CONFIG ID" from your dashboard
6 -const authConfigId = 'your_auth_config_id';
7 -
8 -// Use a unique identifier for each user in your application
9 -const userId = 'user-1349-129-12';
10 -
11 -const connectionRequest = await composio.connectedAccounts.link(userId, authConfigId, {
12 - callbackUrl: 'https://your-app.com/callback'
13 -});
14 -const redirectUrl = connectionRequest.redirectUrl;
15 -console.log(`Visit: ${redirectUrl} to authenticate your account`);
16 -
17 -// Wait for the connection to be established
18 -const connectedAccount = await connectionRequest.waitForConnection();
19 -console.log(connectedAccount.id);
20 -
21 -// Alternative: Wait with custom timeout
22 -// const connectedAccount = await connectionRequest.waitForConnection(120000); // 2 minutes
23 -
24 -// Alternative: If you only have the connection request ID (e.g., stored in database)
25 -// const connectionId = connectionRequest.id; // You can store this ID in your database
26 -// const connectedAccount = await composio.connectedAccounts.waitForConnection(connectionId, 60000);
\ No newline at end of file
fern/snippets/authentication/typescript/connected-accounts-management.ts deleted
-108
@@ -1,108 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -
3 -const composio = new Composio({ apiKey: 'YOUR_COMPOSIO_API_KEY' });
4 -
5 -// Define variables
6 -const userId = 'user-123';
7 -const authConfigId = 'auth-config-id';
8 -const connectedAccountId = 'conn_abc123';
9 -
10 -// --- Listing Connected Accounts ---
11 -
12 -// List all accounts for a user
13 -const accounts = await composio.connectedAccounts.list({
14 - userIds: [userId]
15 -});
16 -
17 -// Filter by status
18 -const activeAccounts = await composio.connectedAccounts.list({
19 - userIds: [userId],
20 - statuses: ['ACTIVE']
21 -});
22 -
23 -// --- Retrieving a Specific Account ---
24 -
25 -const account = await composio.connectedAccounts.get(connectedAccountId);
26 -
27 -console.log('Status:', account.status);
28 -console.log('Toolkit:', account.toolkit.slug);
29 -
30 -// --- Using Account Credentials ---
31 -
32 -// Get the connected account's authentication state
33 -if (account.state) {
34 - // The state contains the auth scheme and credentials
35 - const authScheme = account.state.authScheme;
36 - const credentials = account.state.val;
37 -
38 - console.log('Auth scheme:', authScheme);
39 - console.log('Credentials:', credentials);
40 -}
41 -
42 -// --- Refreshing Credentials ---
43 -
44 -try {
45 - const refreshed = await composio.connectedAccounts.refresh(connectedAccountId);
46 - console.log('Redirect URL:', refreshed.redirect_url);
47 -
48 - // Wait for the connection to be established
49 - await composio.connectedAccounts.waitForConnection(refreshed.id);
50 -} catch (error) {
51 - console.error('Failed to refresh tokens:', error);
52 -}
53 -
54 -// --- Enabling and Disabling Accounts ---
55 -
56 -// Disable an account
57 -const disabled = await composio.connectedAccounts.disable(connectedAccountId);
58 -console.log('Account disabled status:', disabled.success);
59 -
60 -// Re-enable when needed
61 -const enabled = await composio.connectedAccounts.enable(connectedAccountId);
62 -console.log('Account enabled status:', enabled.success);
63 -
64 -// --- Deleting Accounts ---
65 -
66 -// Delete a connected account
67 -await composio.connectedAccounts.delete(connectedAccountId);
68 -console.log('Account deleted successfully');
69 -
70 -// --- Managing Multiple Accounts ---
71 -
72 -// First account
73 -try {
74 - const firstAccount = await composio.connectedAccounts.initiate(
75 - userId,
76 - authConfigId
77 - );
78 - console.log('First account redirect URL:', firstAccount.redirectUrl);
79 - const connectedFirstAccount = await firstAccount.waitForConnection();
80 - console.log('First account status:', connectedFirstAccount.status);
81 -} catch (error) {
82 - console.error('Error initiating first account:', error);
83 -}
84 -
85 -// Second account - must explicitly allow multiple
86 -try {
87 - const secondAccount = await composio.connectedAccounts.initiate(
88 - userId,
89 - authConfigId,
90 - {
91 - allowMultiple: true // Required for additional accounts
92 - }
93 - );
94 - console.log('Second account redirect URL:', secondAccount.redirectUrl);
95 - const connectedSecondAccount = await secondAccount.waitForConnection();
96 - console.log('Second account status:', connectedSecondAccount.status);
97 -} catch (error) {
98 - console.error('Error initiating second account:', error);
99 -}
100 -
101 -// Execute tool with a specific connected account
102 -const result = await composio.tools.execute('GMAIL_GET_PROFILE', {
103 - userId: userId,
104 - connectedAccountId: connectedAccountId, // Specify which account to use
105 - version: '20251111_00',
106 - arguments: {}
107 -});
108 -console.log('Tool executed:', result);
\ No newline at end of file
fern/snippets/authentication/typescript/define-scopes.ts deleted
-13
@@ -1,13 +0,0 @@
1 -import { Composio } from "@composio/core";
2 -
3 -const composio = new Composio();
4 -
5 -const authConfig = await composio.authConfigs.create("HUBSPOT", {
6 - name: "HubspotConfig",
7 - type: "use_composio_managed_auth",
8 - credentials: {
9 - scopes: "sales-email-read,tickets",
10 - },
11 -});
12 -
13 -console.log(authConfig);
\ No newline at end of file
fern/snippets/get-started/python/quickstart-openai-agents.py deleted
-45
@@ -1,45 +0,0 @@
1 -import asyncio
2 -
3 -from agents import Agent, Runner
4 -
5 -from composio import Composio
6 -from composio_openai_agents import OpenAIAgentsProvider
7 -
8 -# Initialize Composio toolset
9 -user_id = "user@email.com"
10 -composio = Composio(provider=OpenAIAgentsProvider(), api_key="your-composio-api-key")
11 -
12 -# Initialize connection request
13 -connection_request = composio.toolkits.authorize(user_id=user_id, toolkit="github")
14 -print(f"🔗 Visit the URL to authorize:\n👉 {connection_request.redirect_url}")
15 -
16 -# wait for the connection to be active
17 -connection_request.wait_for_connection()
18 -
19 -# Get all the tools
20 -tools = composio.tools.get(
21 - user_id=user_id,
22 - tools=["GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER"],
23 -)
24 -
25 -# Create an agent with the tools
26 -agent = Agent(
27 - name="GitHub Agent",
28 - instructions="You are a helpful assistant that helps users with GitHub tasks.",
29 - tools=tools,
30 -)
31 -
32 -
33 -# Run the agent
34 -async def main():
35 - result = await Runner.run(
36 - starting_agent=agent,
37 - input=(
38 - "Star the repository composiohq/composio on GitHub. If done "
39 - "successfully, respond with 'Action executed successfully'"
40 - ),
41 - )
42 - print(result.final_output)
43 -
44 -
45 -asyncio.run(main())
fern/snippets/get-started/python/quickstart.py deleted
-46
@@ -1,46 +0,0 @@
1 -import asyncio
2 -from composio import Composio
3 -from agents import Agent, Runner
4 -from composio_openai_agents import OpenAIAgentsProvider
5 -
6 -composio = Composio(api_key="your-api-key", provider=OpenAIAgentsProvider())
7 -
8 -# Id of the user in your system
9 -externalUserId = "pg-test-6dadae77-9ae1-40ca-8e2e-ba2d1ad9ebc4"
10 -
11 -# Create an auth config for gmail from the dashboard or programmatically
12 -auth_config_id = "your-auth-config-id"
13 -connection_request = composio.connected_accounts.link(
14 - user_id=externalUserId,
15 - auth_config_id=auth_config_id,
16 -)
17 -
18 -# Redirect user to the OAuth flow
19 -redirect_url = connection_request.redirect_url
20 -
21 -print(
22 - f"Please authorize the app by visiting this URL: {redirect_url}"
23 -) # Print the redirect url to the user
24 -
25 -# Wait for the connection to be established
26 -connected_account = connection_request.wait_for_connection()
27 -print(
28 - f"Connection established successfully! Connected account id: {connected_account.id}"
29 -)
30 -
31 -# Get Gmail tools that are pre-configured
32 -tools = composio.tools.get(user_id=externalUserId, tools=["GMAIL_SEND_EMAIL"])
33 -
34 -agent = Agent(
35 - name="Email Manager", instructions="You are a helpful assistant", tools=tools
36 -)
37 -
38 -# Run the agent
39 -async def main():
40 - result = await Runner.run(
41 - starting_agent=agent,
42 - input="Send an email to soham.g@composio.dev with the subject 'Hello from composio 👋🏻' and the body 'Congratulations on sending your first email using AI Agents and Composio!'",
43 - )
44 - print(result.final_output)
45 -
46 -asyncio.run(main())
\ No newline at end of file
fern/snippets/get-started/typescript/quickstart.ts deleted
-57
@@ -1,57 +0,0 @@
1 -import { Composio } from "@composio/core";
2 -import { AnthropicProvider } from "@composio/anthropic";
3 -import Anthropic from "@anthropic-ai/sdk";
4 -
5 -// env: ANTHROPIC_API_KEY
6 -const anthropic = new Anthropic();
7 -
8 -const composio = new Composio({
9 - apiKey: "your-api-key",
10 - provider: new AnthropicProvider(),
11 - toolkitVersions: {
12 - "gmail": "20251111_00",
13 - }
14 -});
15 -
16 -// Id of the user in your system
17 -const externalUserId = "pg-test-6dadae77-9ae1-40ca-8e2e-ba2d1ad9ebc4";
18 -
19 -// Create an auth config for gmail from the dashboard or programmatically
20 -const authConfigId = "your-auth-config-id";
21 -
22 -const connectionRequest = await composio.connectedAccounts.link(
23 - externalUserId,
24 - authConfigId
25 -);
26 -
27 -// redirect the user to the OAuth flow
28 -const redirectUrl = connectionRequest.redirectUrl;
29 -console.log(`Please authorize the app by visiting this URL: ${redirectUrl}`);
30 -
31 -// wait for connection to be established
32 -const connectedAccount = await connectionRequest.waitForConnection();
33 -console.log(
34 -`Connection established successfully! Connected account id: ${connectedAccount.id}`
35 -);
36 -
37 -// Fetch tools for your user and execute
38 -const tools = await composio.tools.get(externalUserId, {
39 - tools: ["GMAIL_SEND_EMAIL"],
40 -});
41 -
42 -console.log(tools);
43 -const msg = await anthropic.messages.create({
44 - model: "claude-sonnet-4-5",
45 - messages: [
46 - {
47 - role: "user",
48 - content: `Send an email to soham.g@composio.dev with the subject 'Hello from composio 👋🏻' and the body 'Congratulations on sending your first email using AI Agents and Composio!'`,
49 - },
50 - ],
51 - tools: tools,
52 - max_tokens: 1000,
53 -});
54 -
55 -
56 -const res = await composio.provider.handleToolCalls(externalUserId, msg);
57 -console.log("Email sent successfully!");
fern/snippets/get-started/typescript/vercel-quickstart.ts deleted
-43
@@ -1,43 +0,0 @@
1 -import { Composio } from "@composio/core";
2 -import { VercelProvider } from "@composio/vercel";
3 -import { generateText } from "ai";
4 -import { openai } from "@ai-sdk/openai";
5 -
6 -const composio = new Composio({
7 - apiKey: "your-api-key",
8 - provider: new VercelProvider(),
9 -});
10 -
11 -// Id of the user in your system
12 -const externalUserId = "pg-test-6dadae77-9ae1-40ca-8e2e-ba2d1ac9ebc4";
13 -
14 -// Create an auth config for gmail from the dashboard or programmatically
15 -const authConfigId = "your-auth-config-id";
16 -
17 -const connectionRequest = await composio.connectedAccounts.link(
18 - externalUserId,
19 - authConfigId
20 -);
21 -
22 -// redirect the user to the OAuth flow
23 -const redirectUrl = connectionRequest.redirectUrl;
24 -console.log(`Please authorize the app by visiting this URL: ${redirectUrl}`);
25 -
26 -// wait for connection to be established
27 -const connectedAccount = await connectionRequest.waitForConnection();
28 -
29 -const tools = await composio.tools.get(externalUserId, "GMAIL_SEND_EMAIL");
30 -
31 -// env: OPENAI_API_KEY
32 -const { text } = await generateText({
33 - model: openai("gpt-5"),
34 - messages: [
35 - {
36 - role: "user",
37 - content: `Send an email to soham.g@composio.dev with the subject 'Hello from composio 👋🏻' and the body 'Congratulations on sending your first email using AI Agents and Composio!'`,
38 - },
39 - ],
40 - tools: tools // cast to `any` to fix type mismatch
41 -});
42 -
43 -console.log("Email sent successfully!", { text });
\ No newline at end of file
fern/snippets/mcp/python/anthropic-client.py deleted
-26
@@ -1,26 +0,0 @@
1 -from anthropic import Anthropic
2 -
3 -# Initialize Anthropic client
4 -client = Anthropic(api_key="your-anthropic-api-key")
5 -
6 -# Use the MCP server URL you generated
7 -mcp_server_url = "https://backend.composio.dev/v3/mcp/YOUR_SERVER_ID?include_composio_helper_actions=true&user_id=YOUR_USER_ID"
8 -
9 -# Use MCP with Anthropic (beta feature)
10 -response = client.beta.messages.create(
11 - model="claude-sonnet-4-5",
12 - system="You are a helpful assistant with access to various tools through MCP. Use these tools to help the user. Do not ask for confirmation before using the tools.",
13 - max_tokens=1000,
14 - messages=[{
15 - "role": "user",
16 - "content": "What meetings do I have tomorrow? Also check if I have any urgent emails"
17 - }],
18 - mcp_servers=[{
19 - "type": "url",
20 - "url": mcp_server_url,
21 - "name": "composio-gmail-calendar-mcp-server"
22 - }],
23 - betas=["mcp-client-2025-04-04"] # Enable MCP beta
24 -)
25 -
26 -print(response.content)
\ No newline at end of file
fern/snippets/mcp/python/anthropic-provider.py deleted
-38
@@ -1,38 +0,0 @@
1 -from anthropic import Anthropic
2 -from composio import Composio
3 -
4 -# Initialize clients
5 -composio = Composio()
6 -anthropic = Anthropic(api_key="your-anthropic-api-key")
7 -
8 -# Create MCP server with GitHub and Linear tools
9 -server = composio.mcp.create(
10 - name="dev-workflow-server",
11 - toolkits=[
12 - {"toolkit": "github", "auth_config": "ac_github_id"},
13 - {"toolkit": "linear", "auth_config": "ac_linear_id"}
14 - ],
15 - allowed_tools=["GITHUB_LIST_PRS", "GITHUB_CREATE_COMMENT", "LINEAR_CREATE_ISSUE"]
16 -)
17 -
18 -# Generate MCP instance for user
19 -instance = server.generate("user@example.com")
20 -
21 -# Use MCP with Anthropic to manage development workflow
22 -response = anthropic.beta.messages.create(
23 - model="claude-sonnet-4-5",
24 - system="You are a helpful assistant with access to GitHub and Linear tools. Use these tools to help manage development workflows. Do not ask for confirmation before using the tools.",
25 - max_tokens=1000,
26 - messages=[{
27 - "role": "user",
28 - "content": "Check my GitHub PRs for review comments, create Linear tasks for any requested changes, and update the PR descriptions with task links"
29 - }],
30 - mcp_servers=[{
31 - "type": "url",
32 - "url": instance['url'],
33 - "name": "composio-mcp-server"
34 - }],
35 - betas=["mcp-client-2025-04-04"] # Enable MCP beta
36 -)
37 -
38 -print(response.content)
\ No newline at end of file
fern/snippets/mcp/python/openai-client.py deleted
-24
@@ -1,24 +0,0 @@
1 -from openai import OpenAI
2 -
3 -# Initialize OpenAI client
4 -client = OpenAI(api_key="your-openai-api-key")
5 -
6 -# Use the MCP server URL you generated
7 -mcp_server_url = "https://backend.composio.dev/v3/mcp/YOUR_SERVER_ID?include_composio_helper_actions=true&user_id=YOUR_USER_ID"
8 -
9 -# Use MCP with OpenAI Responses API
10 -response = client.responses.create(
11 - model="gpt-5",
12 - tools=[
13 - {
14 - "type": "mcp",
15 - "server_label": "composio-server",
16 - "server_description": "Composio MCP server for Gmail and Calendar integrations",
17 - "server_url": mcp_server_url,
18 - "require_approval": "never",
19 - },
20 - ],
21 - input="What meetings do I have tomorrow? Also check if I have any urgent emails",
22 -)
23 -
24 -print("OpenAI MCP Response:", response.output_text)
\ No newline at end of file
fern/snippets/mcp/python/openai-provider.py deleted
-36
@@ -1,36 +0,0 @@
1 -from openai import OpenAI
2 -from composio import Composio
3 -
4 -# Initialize clients
5 -composio = Composio()
6 -openai = OpenAI(api_key="your-openai-api-key")
7 -
8 -# Create MCP server with Google Sheets and Notion tools
9 -server = composio.mcp.create(
10 - name="data-docs-server",
11 - toolkits=[
12 - {"toolkit": "googlesheets", "auth_config": "ac_sheets_id"},
13 - {"toolkit": "notion", "auth_config": "ac_notion_id"}
14 - ],
15 - allowed_tools=["GOOGLESHEETS_GET_DATA", "GOOGLESHEETS_UPDATE_DATA", "NOTION_CREATE_PAGE"]
16 -)
17 -
18 -# Generate MCP instance for user
19 -instance = server.generate("user@example.com")
20 -
21 -# Use MCP with OpenAI for data management
22 -response = openai.responses.create(
23 - model="gpt-5",
24 - tools=[
25 - {
26 - "type": "mcp",
27 - "server_label": "composio-server",
28 - "server_description": "Composio MCP server with Google Sheets and Notion integrations",
29 - "server_url": instance['url'],
30 - "require_approval": "never",
31 - },
32 - ],
33 - input="Export the Q4 metrics from Google Sheets and create a comprehensive Notion page with charts and analysis",
34 -)
35 -
36 -print("OpenAI MCP Response:", response.output_text)
\ No newline at end of file
fern/snippets/mcp/python/quickstart.py deleted
-28
@@ -1,28 +0,0 @@
1 -from composio import Composio
2 -
3 -# Initialize Composio
4 -composio = Composio(api_key="YOUR_API_KEY")
5 -
6 -# Create MCP server with multiple toolkits
7 -server = composio.mcp.create(
8 - name="mcp-config-73840", # Pick a unique name for your MCP server
9 - toolkits=[
10 - {
11 - "toolkit": "gmail",
12 - "auth_config": "ac_xyz123" # Your Gmail auth config ID
13 - },
14 - {
15 - "toolkit": "googlecalendar",
16 - "auth_config": "ac_abc456" # Your Google Calendar auth config ID
17 - }
18 - ],
19 - allowed_tools=["GMAIL_FETCH_EMAILS", "GMAIL_SEND_EMAIL", "GOOGLECALENDAR_EVENTS_LIST"]
20 -)
21 -
22 -print(f"Server created: {server.id}")
23 -print(server.id)
24 -
25 -# Generate server instance for user
26 -instance = composio.mcp.generate(user_id="user-73840", mcp_config_id=server.id) # Use the user ID for which you created the connected account
27 -
28 -print(f"MCP Server URL: {instance['url']}")
\ No newline at end of file
fern/snippets/mcp/typescript/anthropic-provider.ts deleted
-41
@@ -1,41 +0,0 @@
1 -import Anthropic from '@anthropic-ai/sdk';
2 -import { Composio } from '@composio/core';
3 -
4 -// Initialize clients
5 -const composio = new Composio();
6 -const anthropic = new Anthropic({
7 - apiKey: process.env.ANTHROPIC_API_KEY,
8 -});
9 -
10 -// Create MCP server with Google Sheets tools
11 -const server = await composio.mcp.create(
12 - "analytics-server",
13 - {
14 - toolkits: [
15 - { toolkit: "googlesheets", authConfigId: "ac_sheets_id" }
16 - ],
17 - allowedTools: ["GOOGLESHEETS_GET_DATA", "GOOGLESHEETS_UPDATE_DATA", "GOOGLESHEETS_CREATE_SHEET"]
18 - }
19 -);
20 -
21 -// Generate MCP instance for user
22 -const instance = await server.generate("user@example.com");
23 -
24 -// Use MCP with Anthropic for spreadsheet operations
25 -const response = await anthropic.beta.messages.create({
26 - model: "claude-sonnet-4-5",
27 - system: "You are a helpful assistant with access to Google Sheets tools. Use these tools to analyze and manage spreadsheet data. Do not ask for confirmation before using the tools.",
28 - max_tokens: 1000,
29 - messages: [{
30 - role: "user",
31 - content: "Analyze the sales data in my Google Sheets 'Q4 Revenue' spreadsheet, calculate month-over-month growth, and add a new summary sheet with visualizations"
32 - }],
33 - mcp_servers: [{
34 - type: "url",
35 - url: instance.url,
36 - name: "composio-mcp-server"
37 - }],
38 - betas: ["mcp-client-2025-04-04"] // Enable MCP beta
39 -});
40 -
41 -console.log(response.content);
\ No newline at end of file
fern/snippets/mcp/typescript/mastra-client.ts deleted
-26
@@ -1,26 +0,0 @@
1 -import { MCPClient } from "@mastra/mcp";
2 -import { openai } from "@ai-sdk/openai";
3 -import { Agent } from "@mastra/core/agent";
4 -
5 -// Use the MCP server URL you generated
6 -const MCP_URL = "https://backend.composio.dev/v3/mcp/YOUR_SERVER_ID?include_composio_helper_actions=true&user_id=YOUR_USER_ID";
7 -
8 -export const client = new MCPClient({
9 - id: "docs-mcp-client",
10 - servers: {
11 - composio: { url: new URL(MCP_URL) },
12 - }
13 -});
14 -
15 -export const agent = new Agent({
16 - name: "Assistant",
17 - description: "Helpful AI with MCP tools",
18 - instructions: "Use the MCP tools to answer.",
19 - model: openai("gpt-4-turbo"),
20 - tools: await client.getTools()
21 -});
22 -
23 -(async () => {
24 - const res = await agent.generate("What meetings do I have tomorrow? Also check if I have any urgent emails");
25 - console.log(res.text);
26 -})();
\ No newline at end of file
fern/snippets/mcp/typescript/mastra-provider.ts deleted
-52
@@ -1,52 +0,0 @@
1 -import { MCPClient } from "@mastra/mcp";
2 -import { openai } from "@ai-sdk/openai";
3 -import { Agent } from "@mastra/core/agent";
4 -import { Composio } from "@composio/core";
5 -
6 -// Initialize Composio
7 -const composio = new Composio();
8 -
9 -// Create MCP server with GitHub, Linear, and Notion tools
10 -const server = await composio.mcp.create(
11 - "dev-automation-server",
12 - {
13 - toolkits: [
14 - { toolkit: "github", authConfigId: "ac_github_id" },
15 - { toolkit: "linear", authConfigId: "ac_linear_id" },
16 - { toolkit: "notion", authConfigId: "ac_notion_id" }
17 - ],
18 - allowedTools: [
19 - "GITHUB_LIST_ISSUES", "GITHUB_CREATE_ISSUE",
20 - "LINEAR_CREATE_ISSUE", "LINEAR_UPDATE_ISSUE",
21 - "NOTION_CREATE_PAGE", "NOTION_UPDATE_PAGE"
22 - ]
23 - }
24 -);
25 -
26 -// Generate MCP instance for user
27 -const instance = await server.generate("user@example.com");
28 -
29 -// Create MCP client with Composio server
30 -export const mcpClient = new MCPClient({
31 - id: "composio-mcp-client",
32 - servers: {
33 - composio: { url: new URL(instance.url) },
34 - }
35 -});
36 -
37 -// Create a development workflow agent
38 -export const devAgent = new Agent({
39 - name: "Dev Assistant",
40 - description: "AI assistant for development workflow automation",
41 - instructions: "Help manage GitHub repos, Linear issues, and Notion documentation.",
42 - model: openai("gpt-4-turbo"),
43 - tools: await mcpClient.getTools()
44 -});
45 -
46 -// Example: Automate development workflow
47 -(async () => {
48 - const response = await devAgent.generate(
49 - "Review open GitHub issues, create Linear tasks for bugs labeled 'priority', and update the Notion roadmap page"
50 - );
51 - console.log(response.text);
52 -})();
\ No newline at end of file
fern/snippets/mcp/typescript/openai-provider.ts deleted
-40
@@ -1,40 +0,0 @@
1 -import OpenAI from 'openai';
2 -import { Composio } from '@composio/core';
3 -
4 -// Initialize clients
5 -const composio = new Composio();
6 -const openai = new OpenAI({
7 - apiKey: process.env.OPENAI_API_KEY,
8 -});
9 -
10 -// Create MCP server with Linear and Notion tools
11 -const server = await composio.mcp.create(
12 - "project-docs-server",
13 - {
14 - toolkits: [
15 - { toolkit: "linear", authConfigId: "ac_linear_id" },
16 - { toolkit: "notion", authConfigId: "ac_notion_id" }
17 - ],
18 - allowedTools: ["LINEAR_LIST_ISSUES", "LINEAR_GET_ISSUE", "NOTION_CREATE_PAGE"]
19 - }
20 -);
21 -
22 -// Generate MCP instance for user
23 -const instance = await server.generate("user@example.com");
24 -
25 -// Use MCP with OpenAI for project documentation
26 -const response = await openai.responses.create({
27 - model: "gpt-5",
28 - tools: [
29 - {
30 - type: "mcp",
31 - server_label: "composio-server",
32 - server_description: "Composio MCP server with Linear and Notion integrations",
33 - server_url: instance.url,
34 - require_approval: "never",
35 - },
36 - ],
37 - input: "Find all completed Linear issues from this sprint and create a Notion page documenting the release notes",
38 -});
39 -
40 -console.log("OpenAI MCP Response:", response.output_text);
\ No newline at end of file
fern/snippets/mcp/typescript/quickstart.ts deleted
-29
@@ -1,29 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -
3 -// Initialize Composio
4 -const composio = new Composio({
5 - apiKey: process.env.COMPOSIO_API_KEY
6 -});
7 -
8 -// Create MCP server with multiple toolkits
9 -const server = await composio.mcp.create("mcp-config-73840", { // Pick a unique name for your MCP server
10 - toolkits: [
11 - {
12 - authConfigId: "ac_xyz123", // Your Gmail auth config ID
13 - toolkit: "gmail"
14 - },
15 - {
16 - authConfigId: "ac_abc456", // Your Google Calendar auth config ID
17 - toolkit: "googlecalendar"
18 - }
19 - ],
20 - allowedTools: ["GMAIL_FETCH_EMAILS", "GMAIL_SEND_EMAIL", "GOOGLECALENDAR_EVENTS_LIST"]
21 -});
22 -
23 -console.log(`Server created: ${server.id}`);
24 -console.log(server.id);
25 -
26 -// Generate server instance for user
27 -const instance = await composio.mcp.generate("user-73840", server.id); // Use the user ID for which you created the connected account
28 -
29 -console.log("MCP Server URL:", instance.url);
\ No newline at end of file
fern/snippets/migration/new_auth_config.py deleted
-19
@@ -1,19 +0,0 @@
1 -from composio import Composio
2 -
3 -composio = Composio()
4 -
5 -# Use composio managed auth
6 -auth_config = composio.auth_configs.create(
7 - toolkit="notion",
8 - options={
9 - "type": "use_composio_managed_auth",
10 - # "type": "use_custom_auth",
11 - # "auth_scheme": "OAUTH2",
12 - # "credentials": {
13 - # "client_id": "1234567890",
14 - # "client_secret": "1234567890",
15 - # "oauth_redirect_uri": "https://backend.composio.dev/api/v3/toolkits/auth/callback",
16 - # },
17 - },
18 -)
19 -print(auth_config)
fern/snippets/migration/new_auth_config.ts deleted
-16
@@ -1,16 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -
3 -const composio = new Composio();
4 -
5 -const authConfig = await composio.authConfigs.create('LINEAR', {
6 - name: 'Linear',
7 - type: 'use_composio_managed_auth',
8 - // type: "use_custom_auth",
9 - // credentials: {
10 - // client_id: "1234567890",
11 - // client_secret: "1234567890",
12 - // oauth_redirect_uri: "https://backend.composio.dev/api/v3/toolkits/auth/callback",
13 - // },
14 -});
15 -
16 -console.log(authConfig);
fern/snippets/migration/new_connected_acc.py deleted
-16
@@ -1,16 +0,0 @@
1 -from composio import Composio
2 -
3 -linear_auth_config_id = "ac_1234"
4 -user_id = "user@email.com"
5 -composio = Composio()
6 -
7 -# Create a new connected account
8 -connection_request = composio.connected_accounts.initiate(
9 - user_id=user_id,
10 - auth_config_id=linear_auth_config_id,
11 -)
12 -print(connection_request.redirect_url)
13 -
14 -# Wait for the connection to be established
15 -connected_account = connection_request.wait_for_connection()
16 -print(connected_account)
fern/snippets/migration/new_connected_acc.ts deleted
-18
@@ -1,18 +0,0 @@
1 -import { Composio } from "@composio/core";
2 -
3 -const composio = new Composio();
4 -const linearAuthConfigId = "ac_1234";
5 -const userId = "user@email.com";
6 -
7 -// Initiate the OAuth connection request
8 -const connRequest = await composio.connectedAccounts.initiate(userId, linearAuthConfigId);
9 -
10 -const { redirectUrl, id } = connRequest;
11 -console.log(redirectUrl);
12 -
13 -// Wait for the connection to be established
14 -await connRequest.waitForConnection();
15 -
16 -// If you only have the connection request ID, you can also wait using:
17 -await composio.connectedAccounts.waitForConnection(id);
18 -
fern/snippets/migration/new_custom_tools.py deleted
-38
@@ -1,38 +0,0 @@
1 -from pydantic import BaseModel, Field
2 -from composio import Composio
3 -from composio.core.models.custom_tools import ExecuteRequestFn
4 -
5 -
6 -composio = Composio()
7 -
8 -class GetIssueInfoInput(BaseModel):
9 - issue_number: int = Field(
10 - ...,
11 - description="The number of the issue to get information about",
12 - )
13 -
14 -# function name will be used as slug
15 -@composio.tools.custom_tool(toolkit="github")
16 -def get_issue_info(
17 - request: GetIssueInfoInput,
18 - execute_request: ExecuteRequestFn,
19 - auth_credentials: dict,
20 -) -> dict:
21 - """Get information about a GitHub issue."""
22 - response = execute_request(
23 - endpoint=f"/repos/composiohq/composio/issues/{request.issue_number}",
24 - method="GET",
25 - parameters=[
26 - {
27 - "name": "Accept",
28 - "value": "application/vnd.github.v3+json",
29 - "type": "header",
30 - },
31 - {
32 - "name": "Authorization",
33 - "value": f"Bearer {auth_credentials['access_token']}",
34 - "type": "header",
35 - },
36 - ],
37 - )
38 - return {"data": response.data}
fern/snippets/migration/new_custom_tools.ts deleted
-37
@@ -1,37 +0,0 @@
1 -import { Composio } from "@composio/core";
2 -import z from "zod";
3 -
4 -const composio = new Composio();
5 -
6 -const tool = await composio.tools.createCustomTool({
7 - slug: 'GITHUB_STAR_COMPOSIOHQ_REPOSITORY',
8 - name: 'Github star composio repositories',
9 - toolkitSlug: 'github',
10 - description: 'Star any specificied repo of `composiohq` user',
11 - inputParams: z.object({
12 - repository: z.string().describe('The repository to star'),
13 - page: z.number().optional().describe('Pagination page number'),
14 - customHeader: z.string().optional().describe('Custom header'),
15 - }),
16 - execute: async (input, connectionConfig, executeToolRequest) => {
17 - const result = await executeToolRequest({
18 - endpoint: `/user/starred/composiohq/${input.repository}`,
19 - method: 'PUT',
20 - body: {},
21 - parameters: [
22 - {
23 - name: 'page',
24 - value: input.page?.toString() || '1',
25 - in: 'query',
26 - },
27 - {
28 - name: 'x-custom-header',
29 - value: input.customHeader || 'default-value',
30 - in: 'header',
31 - },
32 - ],
33 - });
34 - return result;
35 - },
36 - });
37 -
\ No newline at end of file
fern/snippets/migration/new_execute_tools.py deleted
-15
@@ -1,15 +0,0 @@
1 -from composio import Composio
2 -from openai import OpenAI
3 -
4 -openai_client = OpenAI()
5 -composio = Composio()
6 -
7 -tools = composio.tools.get(user_id="user@acme.com", tools=["GITHUB_GET_THE_ZEN_OF_GITHUB"])
8 -response = openai_client.chat.completions.create(
9 - model="gpt-4.1",
10 - messages=[{"role": "user", "content": "gimme some zen."}],
11 - tools=tools,
12 -)
13 -
14 -result = composio.provider.handle_tool_calls(user_id="user@acme.com", response=response)
15 -print(result)
fern/snippets/migration/new_execute_tools.ts deleted
-28
@@ -1,28 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -import { AnthropicProvider } from '@composio/anthropic';
3 -import Anthropic from '@anthropic-ai/sdk';
4 -
5 -const anthropic = new Anthropic();
6 -const composio = new Composio({
7 - provider: new AnthropicProvider(),
8 -});
9 -
10 -const userId = 'user@example.com';
11 -const tools = await composio.tools.get(userId, {
12 - toolkits: ['GMAIL'],
13 -});
14 -
15 -const msg = await anthropic.messages.create({
16 - model: 'claude-3-7-sonnet-latest',
17 - tools: tools,
18 - messages: [
19 - {
20 - role: 'user',
21 - content: "Say hi to 'soham@composio.dev'",
22 - },
23 - ],
24 - max_tokens: 1024,
25 -});
26 -
27 -const result = await composio.provider.handleToolCalls(userId, msg);
28 -console.log('✅ Tool results:', result);
fern/snippets/migration/new_tools.py deleted
-16
@@ -1,16 +0,0 @@
1 -from composio import Composio
2 -
3 -composio = Composio()
4 -
5 -user_id = "user@acme.org"
6 -
7 -tools_1 = composio.tools.get(user_id=user_id, toolkits=["GITHUB", "LINEAR"])
8 -
9 -tools_2 = composio.tools.get(user_id=user_id, toolkits=["SLACK"], limit=5) # Default limit=20
10 -
11 -tools_3 = composio.tools.get(
12 - user_id=user_id,
13 - tools=["GITHUB_CREATE_AN_ISSUE", "GITHUB_CREATE_AN_ISSUE_COMMENT", "GITHUB_CREATE_A_COMMIT"],
14 -)
15 -
16 -tools_4 = composio.tools.get(user_id="john", search="hackernews posts")
fern/snippets/migration/new_tools.ts deleted
-22
@@ -1,22 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -
3 -const userId = 'user@acme.org';
4 -
5 -const composio = new Composio();
6 -
7 -const tools_1 = await composio.tools.get(userId, {
8 - toolkits: ['GITHUB', 'LINEAR'],
9 -});
10 -
11 -const tools_2 = await composio.tools.get(userId, {
12 - toolkits: ['GITHUB'],
13 - limit: 5, // Default limit=20
14 -});
15 -
16 -const tools_3 = await composio.tools.get(userId, {
17 - tools: ['GITHUB_CREATE_AN_ISSUE', 'GITHUB_CREATE_AN_ISSUE_COMMENT', 'GITHUB_CREATE_A_COMMIT'],
18 -});
19 -
20 -const tools_4 = await composio.tools.get(userId, {
21 - search: 'hackernews posts',
22 -});
fern/snippets/migration/new_triggers.py deleted
-36
@@ -1,36 +0,0 @@
1 -from composio import Composio
2 -
3 -composio = Composio()
4 -
5 -user_id = "user@example.com"
6 -trigger_config = composio.triggers.get_type("GITHUB_COMMIT_EVENT")
7 -print(trigger_config.config)
8 -### Trigger Config
9 -# {
10 -# "properties": {
11 -# "owner": {
12 -# "description": "Owner of the repository",
13 -# "title": "Owner",
14 -# "type": "string"
15 -# },
16 -# "repo": {
17 -# "description": "Repository name",
18 -# "title": "Repo",
19 -# "type": "string"
20 -# }
21 -# },
22 -# "required": ["owner", "repo"],
23 -# "title": "WebhookConfigSchema",
24 -# "type": "object"
25 -
26 -trigger = composio.triggers.create(
27 - slug="GITHUB_COMMIT_EVENT",
28 - user_id=user_id,
29 - trigger_config={"repo": "composiohq", "owner": "composio"},
30 -)
31 -print(trigger)
32 -
33 -
34 -# Managing triggers
35 -
36 -composio.triggers.enable(id="ti_abcd123")
\ No newline at end of file
fern/snippets/migration/new_triggers.ts deleted
-35
@@ -1,35 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -
3 -const composio = new Composio();
4 -
5 -const userId = 'user@acme.com';
6 -// Fetch the trigger details
7 -const triggerType = await composio.triggers.getType('GITHUB_COMMIT_EVENT');
8 -console.log(JSON.stringify(triggerType.config, null, 2));
9 -/*--- Trigger config ---
10 -{
11 - "properties": {
12 - "owner": {
13 - "description": "Owner of the repository",
14 - "title": "Owner",
15 - "type": "string"
16 - },
17 - "repo": {
18 - "description": "Repository name",
19 - "title": "Repo",
20 - "type": "string"
21 - }
22 - },
23 - "required": ["owner", "repo"],
24 - "title": "WebhookConfigSchema",
25 - "type": "object"
26 -}
27 -*/
28 -
29 -const createResponse = await composio.triggers.create(userId, 'GITHUB_COMMIT_EVENT', {
30 - triggerConfig: {
31 - owner: 'composiohq',
32 - repo: 'composio',
33 - },
34 -});
35 -console.log(createResponse);
\ No newline at end of file
fern/snippets/migration/old_auth_config.py deleted
-16
@@ -1,16 +0,0 @@
1 -from composio_openai import App, ComposioToolSet
2 -
3 -toolset = ComposioToolSet()
4 -
5 -integration = toolset.create_integration(
6 - app=App.GITHUB,
7 - auth_mode="OAUTH2",
8 - use_composio_oauth_app=True,
9 - # For use_composio_oauth_app=False, you can provide your own OAuth app credentials here
10 - # auth_config={
11 - # "client_id": "123456",
12 - # "client_secret": "123456"
13 - # }
14 -
15 -)
16 -print(integration.id)
\ No newline at end of file
fern/snippets/migration/old_auth_config.ts deleted
-18
@@ -1,18 +0,0 @@
1 -import { OpenAIToolSet } from "composio-core";
2 -
3 -const composioToolset = new OpenAIToolSet();
4 -
5 -const integration = await composioToolset.integrations.create({
6 - name: "gmail_integration",
7 - appUniqueKey: "gmail",
8 - forceNewIntegration: true,
9 - useComposioAuth: false,
10 - // For useComposioAuth: false, you can provide your own OAuth app credentials here
11 - // authScheme: "OAUTH2",
12 - // authConfig: {
13 - // clientId: "123456",
14 - // clientSecret: "123456"
15 - // }
16 -})
17 -
18 -console.log(integration.id)
fern/snippets/migration/old_connected_acc.py deleted
-26
@@ -1,26 +0,0 @@
1 -from composio_openai import ComposioToolSet
2 -
3 -toolset = ComposioToolSet()
4 -user_id = "your_user_unique_id"
5 -google_integration_id = "0000-0000"
6 -
7 -entity = toolset.get_entity(id=user_id)
8 -
9 -try:
10 - print(f"Initiating OAuth connection for entity {entity.id}...")
11 - connection_request = toolset.initiate_connection(
12 - integration_id=google_integration_id,
13 - entity_id=user_id,
14 - # Optionally add: redirect_url="https://yourapp.com/final-destination"
15 - # if you want user sent somewhere specific *after* Composio finishes.
16 - )
17 -
18 - # Check if a redirect URL was provided (expected for OAuth)
19 - if connection_request.redirectUrl:
20 - print(f"Received redirect URL: {connection_request.redirectUrl}")
21 - else:
22 - print("Error: Expected a redirectUrl for OAuth flow but didn't receive one.")
23 -
24 -
25 -except Exception as e:
26 - print(f"Error initiating connection: {e}")
fern/snippets/migration/old_connected_acc.ts deleted
-22
@@ -1,22 +0,0 @@
1 -import { OpenAIToolSet } from "composio-core";
2 -
3 -const toolset = new OpenAIToolSet();
4 -const userId = "your_user_unique_id";
5 -const googleIntegrationId = "0000-0000";
6 -
7 -console.log(`Initiating OAuth connection for entity ${userId}...`);
8 -const connectionRequest = await toolset.connectedAccounts.initiate({
9 - integrationId: googleIntegrationId,
10 - entityId: userId,
11 - // Optionally add: redirectUri: "https://yourapp.com/final-destination"
12 - // if you want user sent somewhere specific *after* Composio finishes.
13 -});
14 -
15 -// Check if a redirect URL was provided (expected for OAuth)
16 -if (connectionRequest?.redirectUrl) {
17 - console.log(`Received redirect URL: ${connectionRequest.redirectUrl}`);
18 - // Proceed to Step 2: Redirect the user
19 - // Return or pass connectionRequest to the next stage
20 -} else {
21 - console.error("Error: Expected a redirectUrl for OAuth flow but didn't receive one.");
22 -}
fern/snippets/migration/old_custom_tools.py deleted
-19
@@ -1,19 +0,0 @@
1 -# Python Example using execute_request
2 -from composio import action, ComposioToolSet
3 -import typing as t
4 -
5 -toolset = ComposioToolSet()
6 -
7 -@action(toolname="github") # Associate with GitHub app for auth
8 -def get_github_repo_topics(
9 - owner: t.Annotated[str, "Repository owner username"],
10 - repo: t.Annotated[str, "Repository name"],
11 - execute_request: t.Callable # Injected by Composio
12 -) -> dict:
13 - """Gets the topics associated with a specific GitHub repository."""
14 - response_data = execute_request(
15 - endpoint=f"/repos/{owner}/{repo}/topics", # API path relative to base URL
16 - method="GET"
17 - )
18 - if isinstance(response_data, dict):
19 - return {"topics": response_data.get("names", [])}
\ No newline at end of file
fern/snippets/migration/old_custom_tools.ts deleted
-25
@@ -1,25 +0,0 @@
1 -import { OpenAIToolSet, type ActionExecutionResDto } from "composio-core";
2 -import { z } from "zod";
3 -
4 -const toolset = new OpenAIToolSet();
5 -
6 -await toolset.createAction({
7 - actionName: "get_github_repo_topics",
8 - toolName: "github",
9 - description: "Gets the topics associated with a specific GitHub repository.",
10 - inputParams: z.object({
11 - owner: z.string().describe("Repository owner username"),
12 - repo: z.string().describe("Repository name"),
13 - }),
14 - callback: async (inputParams, _authCredentials, executeRequest): Promise<ActionExecutionResDto> => {
15 - const { owner, repo } = inputParams as { owner: string, repo: string };
16 - const response = await executeRequest({
17 - endpoint: `/repos/${owner}/${repo}/topics`,
18 - method: "GET",
19 - parameters: [],
20 - });
21 -
22 - const topics = (response as any)?.names ?? [];
23 - return { successful: true, data: { topics: topics } };
24 - }
25 -});
\ No newline at end of file
fern/snippets/migration/old_tool_modifiers.py deleted
-22
@@ -1,22 +0,0 @@
1 -from composio_openai import ComposioToolSet, Action
2 -
3 -toolset = ComposioToolSet()
4 -
5 -
6 -def my_schema_processor(schema: dict) -> dict: ...
7 -def my_preprocessor(inputs: dict) -> dict: ...
8 -def my_postprocessor(result: dict) -> dict: ...
9 -
10 -
11 -# Get tools with the modified schema
12 -processed_tools = toolset.get_tools(
13 - actions=[Action.GMAIL_SEND_EMAIL],
14 - processors={
15 - # Applied BEFORE the LLM sees the schema
16 - "schema": {Action.SOME_ACTION: my_schema_processor},
17 - # Applied BEFORE the tool executes
18 - "pre": {Action.SOME_ACTION: my_preprocessor},
19 - # Applied AFTER the tool executes, BEFORE the result is returned
20 - "post": {Action.SOME_ACTION: my_postprocessor},
21 - },
22 -)
\ No newline at end of file
fern/snippets/migration/old_tools.py deleted
-21
@@ -1,21 +0,0 @@
1 -from composio_openai import ComposioToolSet, Action, App
2 -from openai import OpenAI
3 -
4 -toolset = ComposioToolSet()
5 -client = OpenAI()
6 -
7 -tools = toolset.get_tools(
8 - actions=[Action.GITHUB_GET_THE_AUTHENTICATED_USER], check_connected_accounts=True
9 -)
10 -
11 -tools = toolset.get_tools(apps=[App.GITHUB, App.LINEAR, App.SLACK], check_connected_accounts=True)
12 -
13 -messages = [...]
14 -response = client.chat.completions.create(
15 - model="gpt-4o-mini",
16 - messages=messages,
17 - tools=tools,
18 -)
19 -
20 -result = toolset.handle_tool_calls(response)
21 -print(result)
fern/snippets/migration/old_tools.ts deleted
-8
@@ -1,8 +0,0 @@
1 -import { OpenAIToolSet } from 'composio-core';
2 -
3 -const toolset = new OpenAIToolSet();
4 -
5 -const tools_1 = await toolset.getTools({ apps: ['GITHUB'] });
6 -const tools_2 = await toolset.getTools({
7 - actions: ['GITHUB_GET_THE_AUTHENTICATED_USER', 'LINEAR_CREATE_LINEAR_ISSUE'],
8 -});
fern/snippets/migration/providers.py deleted
-11
@@ -1,11 +0,0 @@
1 -from composio import Composio
2 -# from composio_langchain import LangchainProvider
3 -
4 -composio = Composio()
5 -# composio = Composio(provider=LangchainProvider())
6 -
7 -tools = composio.tools.get(
8 - user_id="0001",
9 - tools=["LINEAR_CREATE_LINEAR_ISSUE", "GITHUB_CREATE_COMMIT"]
10 -)
11 -# tools returned is formatted for the provider. by default, OpenAI.
fern/snippets/migration/providers.ts deleted
-12
@@ -1,12 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -// import { VercelProvider } from '@composio/vercel';
3 -
4 -const composio = new Composio({
5 - // provider: new VercelProvider(),
6 -});
7 -// Can specify other providers too, like OpenAI, Anthropic, Vercel AI SDK.
8 -
9 -const tools = await composio.tools.get('user@example.com', {
10 - tools: ['LINEAR_CREATE_LINEAR_ISSUE', 'GITHUB_CREATE_COMMIT'],
11 -});
12 -// tools returned is formatted for the provider. by default, OpenAI.
\ No newline at end of file
fern/snippets/migration/pyproject.toml deleted
-9
@@ -1,9 +0,0 @@
1 -[project]
2 -name = "migration"
3 -version = "0.1.0"
4 -description = "Add your description here"
5 -readme = "README.md"
6 -requires-python = ">=3.12"
7 -dependencies = [
8 - "composio",
9 -]
fern/snippets/migration/tool_modifiers.ts deleted
-91
@@ -1,91 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -import { OpenAI } from 'openai';
3 -
4 -const userId = 'your@email.com';
5 -const composio = new Composio();
6 -
7 -// Schema modifier to delete the `page` argument from the `HACKERNEWS_GET_LATEST_POSTS` tool
8 -const tools = await composio.tools.get(
9 - userId,
10 - {
11 - tools: ['HACKERNEWS_GET_LATEST_POSTS', 'HACKERNEWS_GET_USER'],
12 - },
13 - {
14 - modifySchema: ({ toolSlug, toolkitSlug, schema }) => {
15 - if (toolSlug === 'HACKERNEWS_GET_LATEST_POSTS') {
16 - const { inputParameters } = schema;
17 - if (inputParameters?.properties) {
18 - delete inputParameters.properties['page'];
19 - }
20 - inputParameters.required = ['size'];
21 - }
22 - return schema;
23 - },
24 - }
25 -);
26 -
27 -console.log(JSON.stringify(tools, null, 2));
28 -
29 -const openai = new OpenAI();
30 -
31 -const messages = [
32 - {
33 - role: 'user',
34 - content: 'What are the latest posts on Hacker News?',
35 - },
36 -];
37 -
38 -const response = await openai.chat.completions.create({
39 - model: 'gpt-4o-mini',
40 - messages,
41 - tools,
42 - tool_choice: 'auto',
43 -});
44 -
45 -const { tool_calls } = response.choices[0].message;
46 -console.log(tool_calls);
47 -
48 -if (tool_calls) {
49 - const {
50 - function: { arguments: toolArgs },
51 - } = tool_calls[0];
52 -
53 - const result_1 = await composio.tools.execute(
54 - 'HACKERNEWS_GET_LATEST_POSTS',
55 - {
56 - userId,
57 - arguments: JSON.parse(toolArgs),
58 - },
59 - {
60 - beforeExecute: ({ toolSlug, toolkitSlug, params }) => {
61 - if (toolSlug === 'HACKERNEWS_GET_LATEST_POSTS') {
62 - params.arguments.size = 1;
63 - }
64 - console.log(params);
65 - return params;
66 - },
67 - }
68 - );
69 - const result_2 = await composio.tools.execute(
70 - 'HACKERNEWS_GET_USER',
71 - {
72 - userId,
73 - arguments: JSON.parse(toolArgs),
74 - },
75 - {
76 - afterExecute: ({ toolSlug, toolkitSlug, result }) => {
77 - if (toolSlug === 'HACKERNEWS_GET_USER') {
78 - const { data } = result;
79 - const { karma } = data.response_data as { karma: number };
80 - return {
81 - ...result,
82 - data: { karma },
83 - };
84 - }
85 - return result;
86 - },
87 - }
88 - );
89 -
90 - console.log(JSON.stringify(result, null, 2));
91 -}
fern/snippets/modifiers/python/description.py deleted
-43
@@ -1,43 +0,0 @@
1 -from composio import Composio, schema_modifier
2 -from composio.types import Tool
3 -from composio_google import GoogleProvider
4 -from google import genai
5 -from google.genai import types
6 -from uuid import uuid4
7 -
8 -composio = Composio(provider=GoogleProvider())
9 -client = genai.Client()
10 -user_id = uuid4() # User ID from DB/App
11 -
12 -
13 -@schema_modifier(tools=["GITHUB_LIST_REPOSITORY_ISSUES"])
14 -def append_repository(
15 - tool: str,
16 - toolkit: str,
17 - schema: Tool,
18 -) -> Tool:
19 - schema.description += " When not specified, use the `composiohq/composio` repository"
20 - return schema
21 -
22 -
23 -tools = composio.tools.get(
24 - user_id=user_id, tools=["GITHUB_LIST_REPOSITORY_ISSUES"], modifiers=[append_repository]
25 -)
26 -
27 -print(tools)
28 -
29 -model = "gemini-2.5-pro"
30 -config = types.GenerateContentConfig(
31 - temperature=1.5,
32 - system_instruction="You're a GitHub Taskmaster. Help me with managing my GitHub",
33 - max_output_tokens=65536,
34 - top_p=0.95,
35 - tools=tools,
36 -)
37 -
38 -
39 -response = client.models.generate_content(
40 - model=model, config=config, contents=["What are some issues on my GitHub repo?"]
41 -)
42 -
43 -print(response.text)
fern/snippets/modifiers/typescript/description.ts deleted
-44
@@ -1,44 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -import { generateText } from 'ai';
3 -import { anthropic } from '@ai-sdk/anthropic';
4 -import { VercelProvider } from '@composio/vercel';
5 -import { v4 as uuidv4 } from 'uuid';
6 -
7 -const userId = uuidv4(); // The user's ID.
8 -const composio = new Composio({
9 - apiKey: process.env.COMPOSIO_API_KEY,
10 - provider: new VercelProvider(),
11 -});
12 -
13 -const addDescription = ({ toolSlug, toolkitSlug, schema }) => {
14 - if (toolSlug === 'GITHUB_LIST_REPOSITORY_ISSUES') {
15 - schema.description += 'If not specified, use the `composiohq/composio` repository';
16 - }
17 - return schema;
18 -};
19 -
20 -const tools = await composio.tools.get(
21 - userId,
22 - {
23 - tools: ['GITHUB_LIST_REPOSITORY_ISSUES'],
24 - },
25 - {
26 - modifySchema: addDescription,
27 - }
28 -);
29 -
30 -console.log(tools);
31 -
32 -// const { text } = await generateText({
33 -// model: anthropic('claude-4-sonnet'),
34 -// messages: [
35 -// {
36 -// role: 'user',
37 -// content: 'What are some issues on my GitHub repo?',
38 -// },
39 -// ],
40 -// tools,
41 -// maxSteps: 3,
42 -// });
43 -
44 -// console.log(text);
fern/snippets/providers/python/google.py deleted
-20
@@ -1,20 +0,0 @@
1 -from composio import Composio
2 -from composio_gemini import GeminiProvider
3 -from google import genai
4 -from google.genai import types
5 -
6 -# Create composio client
7 -composio = Composio(provider=GeminiProvider())
8 -# Create google client
9 -client = genai.Client()
10 -
11 -user_id = "0000-1111-2222"
12 -tools = composio.tools.get(user_id, tools=["COMPOSIO_SEARCH_DUCK_DUCK_GO_SEARCH"])
13 -
14 -# Create genai client config
15 -config = types.GenerateContentConfig(tools=tools)
16 -
17 -# # Use the chat interface.
18 -chat = client.chats.create(model="gemini-2.0-flash", config=config)
19 -response = chat.send_message("search about the latest info on windsurf acquisition.")
20 -print(response.text)
fern/snippets/providers/python/langchain-provider.py deleted
-26
@@ -1,26 +0,0 @@
1 -from composio import Composio
2 -from composio_langchain import LangchainProvider
3 -from langchain import hub # type: ignore
4 -from langchain.agents import AgentExecutor, create_openai_functions_agent
5 -from langchain_openai import ChatOpenAI
6 -
7 -# Pull relevant agent model.
8 -prompt = hub.pull("hwchase17/openai-functions-agent")
9 -
10 -# Initialize tools.
11 -openai_client = ChatOpenAI(model="gpt-5")
12 -
13 -composio = Composio(provider=LangchainProvider())
14 -
15 -# Get All the tools
16 -tools = composio.tools.get(user_id="default", toolkits=["GITHUB"])
17 -
18 -# Define task
19 -task = "Star a repo composiohq/composio on GitHub"
20 -
21 -# Define agent
22 -agent = create_openai_functions_agent(openai_client, tools, prompt)
23 -agent_executor = AgentExecutor(agent=agent, tools=tools, verbose=True)
24 -
25 -# Execute using agent_executor
26 -agent_executor.invoke({"input": task})
fern/snippets/providers/python/llamaindex-provider.py deleted
-36
@@ -1,36 +0,0 @@
1 -import asyncio
2 -import dotenv
3 -from composio_llamaindex import LlamaIndexProvider
4 -from llama_index.core.agent.workflow import FunctionAgent
5 -from llama_index.llms.openai import OpenAI
6 -
7 -from composio import Composio
8 -
9 -# Load environment variables from .env
10 -dotenv.load_dotenv()
11 -
12 -# Setup client
13 -llm = OpenAI(model="gpt-5")
14 -composio = Composio(provider=LlamaIndexProvider())
15 -
16 -tools = composio.tools.get(
17 - user_id="user@acme.com",
18 - tools=["GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER"],
19 -)
20 -
21 -workflow = FunctionAgent(
22 - tools=tools,
23 - llm=llm,
24 - system_prompt="You are an agent that performs github actions.",
25 -)
26 -
27 -
28 -async def main():
29 - result = await workflow.run(
30 - user_msg="Hello! I would like to star a repo composiohq/composio on GitHub"
31 - )
32 - print(result)
33 -
34 -
35 -if __name__ == "__main__":
36 - asyncio.run(main())
\ No newline at end of file
fern/snippets/providers/python/openai-agents.py deleted
-26
@@ -1,26 +0,0 @@
1 -import asyncio
2 -from composio import Composio
3 -from agents import Agent, Runner
4 -from composio_openai_agents import OpenAIAgentsProvider
5 -
6 -composio = Composio(api_key="your-api-key", provider=OpenAIAgentsProvider())
7 -
8 -# Create a connected account for the user for the gmail toolkit and replace with your own user id
9 -externalUserId = "your-user-id"
10 -
11 -# Get Gmail tools that are pre-configured
12 -tools = composio.tools.get(user_id=externalUserId, tools=["GMAIL_SEND_EMAIL"])
13 -
14 -agent = Agent(
15 - name="Email Manager", instructions="You are a helpful assistant", tools=tools
16 -)
17 -
18 -# Run the agent
19 -async def main():
20 - result = await Runner.run(
21 - starting_agent=agent,
22 - input="Send an email to soham.g@composio.dev with the subject 'Hello from composio 👋🏻' and the body 'Congratulations on sending your first email using AI Agents and Composio!'",
23 - )
24 - print(result.final_output)
25 -
26 -asyncio.run(main())
\ No newline at end of file
fern/snippets/providers/python/openai-provider.py deleted
-25
@@ -1,25 +0,0 @@
1 -from openai import OpenAI
2 -from composio import Composio
3 -from composio_openai import OpenAIProvider
4 -
5 -# Initialize Composio client with OpenAI Provider
6 -composio = Composio(provider=OpenAIProvider())
7 -openai = OpenAI()
8 -
9 -# Make sure to create an auth config and a connected account for the user with gmail toolkit
10 -# Make sure to replace "your-user-id" with the actual user ID
11 -user_id = "your-user-id"
12 -
13 -tools = composio.tools.get(user_id=user_id, tools=["GMAIL_SEND_EMAIL"])
14 -
15 -response = openai.chat.completions.create(
16 - model="gpt-5",
17 - tools=tools,
18 - messages=[
19 - {"role": "user", "content": "Send an email to soham.g@composio.dev with the subject 'Running OpenAI Provider snippet' and body 'Hello from the code snippet in openai docs'"},
20 - ],
21 -)
22 -
23 -# Execute the function calls
24 -result = composio.provider.handle_tool_calls(response=response, user_id=user_id)
25 -print(result)
fern/snippets/providers/python/openai-responses-provider.py deleted
-28
@@ -1,28 +0,0 @@
1 -from openai import OpenAI
2 -from composio import Composio
3 -from composio_openai import OpenAIResponsesProvider
4 -
5 -# Initialize Composio client with OpenAI Provider
6 -composio = Composio(provider=OpenAIResponsesProvider())
7 -openai = OpenAI()
8 -
9 -# Make sure to create an auth config and a connected account for the user with gmail toolkit
10 -# Make sure to replace "your-user-id" with the actual user ID
11 -user_id = "your-user-id"
12 -
13 -tools = composio.tools.get(user_id=user_id, tools=["GMAIL_SEND_EMAIL"])
14 -
15 -response = openai.responses.create(
16 - model="gpt-5",
17 - tools=tools,
18 - input=[
19 - {
20 - "role": "user",
21 - "content": "Send an email to soham.g@composio.dev with the subject 'Running OpenAI Provider snippet' and body 'Hello from the code snippet in openai docs'"
22 - }
23 - ]
24 -)
25 -
26 -# Execute the function calls
27 -result = composio.provider.handle_tool_calls(response=response, user_id=user_id)
28 -print(result)
fern/snippets/providers/typescript/google.ts deleted
-39
@@ -1,39 +0,0 @@
1 -import {Composio} from '@composio/core';
2 -import {GoogleProvider} from '@composio/google'
3 -import {GoogleGenAI} from '@google/genai'
4 -
5 -const composio = new Composio({
6 - apiKey: "your-composio-api-key",
7 - provider: new GoogleProvider()
8 -})
9 -
10 -const ai = new GoogleGenAI({
11 - apiKey: "your-gemini-api-key"
12 -})
13 -
14 -// Use a unique identifier for each user in your application
15 -const user_id = "your-external-user-id"
16 -
17 -// Get tools - this returns already wrapped tools when using GoogleProvider
18 -const tools = await composio.tools.get(user_id, 'HACKERNEWS_GET_USER')
19 -
20 -const response = await ai.models.generateContent({
21 - model: 'gemini-2.0-flash-001',
22 - contents: "Search for the user 'pg's",
23 - config: {
24 - tools: [{ functionDeclarations: tools }],
25 - },
26 -});
27 -
28 -if (response.functionCalls && response.functionCalls.length > 0) {
29 - console.log(`Calling tool ${response.functionCalls[0].name}`);
30 - const functionCall = {
31 - name: response.functionCalls[0].name || '',
32 - args: response.functionCalls[0].args || {},
33 - };
34 - const result = await composio.provider.executeToolCall(user_id, functionCall);
35 - console.log(`Result: ${result}`);
36 -} else {
37 - console.log('No function calls in the response');
38 - console.log(response.text);
39 -}
\ No newline at end of file
fern/snippets/providers/typescript/langchain.ts deleted
-71
@@ -1,71 +0,0 @@
1 -import { ChatOpenAI } from '@langchain/openai';
2 -import { HumanMessage, AIMessage } from '@langchain/core/messages';
3 -import { ToolNode } from '@langchain/langgraph/prebuilt';
4 -import { StateGraph, MessagesAnnotation } from '@langchain/langgraph';
5 -import { Composio } from '@composio/core';
6 -import { LangchainProvider } from '@composio/langchain';
7 -// initiate composio
8 -const composio = new Composio({
9 - apiKey: process.env.COMPOSIO_API_KEY,
10 - provider: new LangchainProvider(),
11 -});
12 -
13 -// fetch the tool
14 -console.log(`🔄 Fetching the tool...`);
15 -const tools = await composio.tools.get('default', 'HACKERNEWS_GET_USER');
16 -
17 -// Define the tools for the agent to use
18 -const toolNode = new ToolNode(tools);
19 -
20 -// Create a model and give it access to the tools
21 -const model = new ChatOpenAI({
22 - model: 'gpt-4o-mini',
23 - temperature: 0,
24 -}).bindTools(tools);
25 -
26 -// Define the function that determines whether to continue or not
27 -function shouldContinue({ messages }: typeof MessagesAnnotation.State) {
28 - const lastMessage = messages[messages.length - 1] as AIMessage;
29 -
30 - // If the LLM makes a tool call, then we route to the "tools" node
31 - if (lastMessage.tool_calls?.length) {
32 - return 'tools';
33 - }
34 - // Otherwise, we stop (reply to the user) using the special "__end__" node
35 - return '__end__';
36 -}
37 -
38 -// Define the function that calls the model
39 -async function callModel(state: typeof MessagesAnnotation.State) {
40 - console.log(`🔄 Calling the model...`);
41 - const response = await model.invoke(state.messages);
42 -
43 - // We return a list, because this will get added to the existing list
44 - return { messages: [response] };
45 -}
46 -
47 -// Define a new graph
48 -const workflow = new StateGraph(MessagesAnnotation)
49 - .addNode('agent', callModel)
50 - .addEdge('__start__', 'agent') // __start__ is a special name for the entrypoint
51 - .addNode('tools', toolNode)
52 - .addEdge('tools', 'agent')
53 - .addConditionalEdges('agent', shouldContinue);
54 -
55 -// Finally, we compile it into a LangChain Runnable.
56 -const app = workflow.compile();
57 -
58 -// Use the agent
59 -const finalState = await app.invoke({
60 - messages: [new HumanMessage('Find the details of the user `pg` on HackerNews')],
61 -});
62 -console.log(`✅ Message recieved from the model`);
63 -console.log(finalState.messages[finalState.messages.length - 1].content);
64 -
65 -const nextState = await app.invoke({
66 - // Including the messages from the previous run gives the LLM context.
67 - // This way it knows we're asking about the weather in NY
68 - messages: [...finalState.messages, new HumanMessage('what about haxzie')],
69 -});
70 -console.log(`✅ Message recieved from the model`);
71 -console.log(nextState.messages[nextState.messages.length - 1].content);
fern/snippets/providers/typescript/llamaindex-provider.ts deleted
-36
@@ -1,36 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -import { LlamaindexProvider } from '@composio/llamaindex';
3 -import { openai } from '@llamaindex/openai';
4 -import { agent } from '@llamaindex/workflow';
5 -import 'dotenv/config';
6 -
7 -// Initialize Composio with LlamaIndex provider
8 -const composio = new Composio({
9 - apiKey: process.env.COMPOSIO_API_KEY,
10 - provider: new LlamaindexProvider(),
11 -});
12 -
13 -async function main() {
14 - // Get tools
15 - const tools = await composio.tools.get('user@acme.com', {
16 - tools: ['GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER'],
17 - });
18 -
19 - // Create LlamaIndex agent with Composio tools
20 - const githubAgent = agent({
21 - name: 'GitHub Agent',
22 - description: 'An agent that performs GitHub actions',
23 - llm: openai({ model: 'gpt-4o-mini' }),
24 - systemPrompt: 'You are an agent that performs github actions.',
25 - tools,
26 - });
27 -
28 - // Run the agent
29 - const result = await githubAgent.run(
30 - 'Hello! I would like to star a repo composiohq/composio on GitHub'
31 - );
32 -
33 - console.log(result);
34 -}
35 -
36 -main().catch(console.error);
fern/snippets/providers/typescript/llamaindex-streaming.ts deleted
-53
@@ -1,53 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -import { LlamaindexProvider } from '@composio/llamaindex';
3 -import { openai } from '@llamaindex/openai';
4 -import { agent, agentStreamEvent } from '@llamaindex/workflow';
5 -import 'dotenv/config';
6 -
7 -const composio = new Composio({
8 - apiKey: process.env.COMPOSIO_API_KEY,
9 - provider: new LlamaindexProvider(),
10 -});
11 -
12 -async function streamingExample() {
13 - // Get tools from multiple toolkits with execution modifiers
14 - const tools = await composio.tools.get(
15 - 'default',
16 - {
17 - toolkits: ['gmail', 'googlecalendar', 'slack'],
18 - limit: 20,
19 - },
20 - {
21 - beforeExecute: ({ toolSlug, params }) => {
22 - console.log(`🔄 Executing ${toolSlug} with:`, params);
23 - return params;
24 - },
25 - afterExecute: ({ toolSlug, result }) => {
26 - console.log(`✅ ${toolSlug} completed:`, result);
27 - return result;
28 - },
29 - }
30 - );
31 -
32 - // Create streaming agent
33 - const assistantAgent = agent({
34 - name: 'Personal Assistant',
35 - description: 'A helpful personal assistant',
36 - llm: openai({ model: 'gpt-4o-mini' }),
37 - systemPrompt: 'You are a helpful personal assistant that can manage emails, calendar events, and slack messages.',
38 - tools,
39 - });
40 -
41 - // Stream the response
42 - const stream = await assistantAgent.runStream(
43 - 'Schedule a meeting for tomorrow at 2 PM and send a slack message about it'
44 - );
45 -
46 - for await (const event of stream) {
47 - if (agentStreamEvent.include(event)) {
48 - process.stdout.write(event.data.delta);
49 - }
50 - }
51 -}
52 -
53 -streamingExample().catch(console.error);
fern/snippets/providers/typescript/openai-agents.ts deleted
-33
@@ -1,33 +0,0 @@
1 -import { Composio } from "@composio/core";
2 -import { Agent, run } from "@openai/agents";
3 -import { OpenAIAgentsProvider } from "@composio/openai-agents";
4 -
5 -// add OPENAI_API_KEY in your .env file
6 -const composio = new Composio({
7 - apiKey: "your-api-key",
8 - provider: new OpenAIAgentsProvider(),
9 -});
10 -
11 -// Create a connected account for the user for the gmail toolkit and replace with your own user id
12 -const externalUserId = "your-user-id";
13 -
14 -// Fetch tools for GMAIL toolkit on behalf of the user
15 -const tools = await composio.tools.get(externalUserId, {
16 - tools: ["GMAIL_SEND_EMAIL"],
17 - });
18 -
19 -const agent = new Agent({
20 - name: "Email Manager",
21 - tools: tools,
22 -});
23 -
24 -console.log(`Running agent...`);
25 -const result = await run(
26 - agent,
27 - "Send an email to soham.g@composio.dev with the subject 'Hello from composio' and the body 'Congratulations on sending your first email using AI Agents and Composio!'"
28 -);
29 -
30 -console.log(`Received response from agent`);
31 -if (result.finalOutput) {
32 - console.log(JSON.stringify(result.finalOutput, null, 2));
33 -}
\ No newline at end of file
fern/snippets/providers/typescript/openai.ts deleted
-39
@@ -1,39 +0,0 @@
1 -import OpenAI from 'openai';
2 -import { Composio } from '@composio/core';
3 -import { OpenAIProvider } from '@composio/openai';
4 -
5 -// Initialize Composio client with OpenAI Provider
6 -const composio = new Composio({
7 - provider: new OpenAIProvider(),
8 -});
9 -
10 -const openai = new OpenAI();
11 -
12 -// Make sure to create an auth config and a connected account for the user with gmail toolkit
13 -// Make sure to replace "your-user-id" with the actual user ID
14 -const userId = "your-user-id";
15 -
16 -async function main() {
17 - try {
18 - const tools = await composio.tools.get(userId, {tools: ["GMAIL_SEND_EMAIL"]});
19 -
20 - const response = await openai.chat.completions.create({
21 - model: "gpt-5",
22 - tools: tools,
23 - messages: [
24 - {
25 - role: "user",
26 - content: "Send an email to soham.g@composio.dev with the subject 'Running OpenAI Provider snippet' and body 'Hello from the code snippet in openai docs'"
27 - },
28 - ],
29 - });
30 -
31 - // Execute the function calls
32 - const result = await composio.provider.handleToolCalls(userId, response);
33 - console.log(result);
34 - } catch (error) {
35 - console.error('Error:', error);
36 - }
37 -}
38 -
39 -main();
fern/snippets/providers/typescript/openairesponses.ts deleted
-38
@@ -1,38 +0,0 @@
1 -import OpenAI from 'openai';
2 -import { Composio } from '@composio/core';
3 -import { OpenAIResponsesProvider } from '@composio/openai';
4 -
5 -// Initialize Composio client with OpenAI Provider
6 -const composio = new Composio({
7 - provider: new OpenAIResponsesProvider(),
8 -});
9 -const openai = new OpenAI({});
10 -
11 -// Make sure to create an auth config and a connected account for the user with gmail toolkit
12 -// Make sure to replace "your-user-id" with the actual user ID
13 -const userId = "your-user-id";
14 -
15 -async function main() {
16 - try {
17 - const tools = await composio.tools.get(userId, {tools: ["GMAIL_SEND_EMAIL"]});
18 -
19 - const response = await openai.responses.create({
20 - model: "gpt-5",
21 - tools: tools,
22 - input: [
23 - {
24 - role: "user",
25 - content: "Send an email to soham.g@composio.dev with the subject 'Running OpenAI Provider snippet' and body 'Hello from the code snippet in openai docs'"
26 - },
27 - ],
28 - });
29 -
30 - // Execute the function calls
31 - const result = await composio.provider.handleToolCalls(userId, response.output);
32 - console.log(result);
33 - } catch (error) {
34 - console.error('Error:', error);
35 - }
36 -}
37 -
38 -main();
fern/snippets/tool-calling/python/checking-connection-status.py deleted
-16
@@ -1,16 +0,0 @@
1 -from composio import Composio
2 -
3 -composio = Composio(api_key="your_api_key")
4 -
5 -# Get a specific connected account
6 -connected_account = composio.connected_accounts.get("your_connected_account_id")
7 -print(f"Status: {connected_account.status}")
8 -
9 -# Filter connections by user_id, auth_config_id, and status (only active accounts)
10 -filtered_connections = composio.connected_accounts.list(
11 - user_ids=["user_123"],
12 - auth_config_ids=["your_auth_config_id"],
13 - statuses=["ACTIVE"]
14 -)
15 -for connection in filtered_connections.items:
16 - print(f"{connection.id}: {connection.status}")
fern/snippets/tool-calling/python/direct-tool-call.py deleted
-16
@@ -1,16 +0,0 @@
1 -from composio import Composio
2 -
3 -user_id = "user-k7334"
4 -# Configure toolkit versions at SDK level
5 -composio = Composio(
6 - api_key="your_composio_key",
7 - toolkit_versions={"github": "20251027_00"}
8 -)
9 -
10 -# Find available arguments for any tool in the Composio dashboard
11 -result = composio.tools.execute(
12 - "GITHUB_LIST_STARGAZERS",
13 - user_id=user_id,
14 - arguments={"owner": "ComposioHQ", "repo": "composio", "page": 1, "per_page": 5}
15 -)
16 -print(result)
\ No newline at end of file
fern/snippets/tool-calling/python/exec-tool-agentic.py deleted
-33
@@ -1,33 +0,0 @@
1 -import asyncio
2 -from agents import Agent, Runner
3 -from composio import Composio
4 -from composio_openai_agents import OpenAIAgentsProvider
5 -
6 -# Use a unique identifier for each user in your application
7 -user_id = "user-k7334"
8 -
9 -# Initialize Composio toolset
10 -composio = Composio(provider=OpenAIAgentsProvider(), api_key="your_composio_api_key")
11 -
12 -# Get all tools for the user
13 -tools = composio.tools.get(
14 - user_id=user_id,
15 - toolkits=["COMPOSIO_SEARCH"],
16 -)
17 -
18 -# Create an agent with the tools
19 -agent = Agent(
20 - name="Deep Researcher",
21 - instructions="You are an investigative journalist.",
22 - tools=tools,
23 -)
24 -
25 -async def main():
26 - result = await Runner.run(
27 - starting_agent=agent,
28 - input=("Do a thorough DEEP research on Golden Gate Bridge"),
29 - )
30 - print(result.final_output)
31 -
32 -# Run the agent
33 -asyncio.run(main())
fern/snippets/tool-calling/python/exec-tool-completions.py deleted
-34
@@ -1,34 +0,0 @@
1 -from composio import Composio
2 -from composio_openai import OpenAIProvider
3 -from openai import OpenAI
4 -from datetime import datetime
5 -
6 -# Use a unique identifier for each user in your application
7 -user_id = "user-k7334"
8 -
9 -# Create composio client
10 -composio = Composio(provider=OpenAIProvider(), api_key="your_composio_api_key")
11 -
12 -# Create openai client
13 -openai = OpenAI()
14 -
15 -# Get calendar tools for this user
16 -tools = composio.tools.get(
17 - user_id=user_id,
18 - tools=["GOOGLECALENDAR_EVENTS_LIST"]
19 -)
20 -
21 -# Ask the LLM to check calendar
22 -result = openai.chat.completions.create(
23 - model="gpt-4o-mini",
24 - tools=tools,
25 - messages=[
26 - {"role": "system", "content": "You are a helpful assistant."},
27 - {"role": "user", "content": f"What's on my calendar for the next 7 days. Its {datetime.now().strftime("%Y-%m-%d")} today.",}
28 - ]
29 -)
30 -
31 -
32 -# Handle tool calls
33 -result = composio.provider.handle_tool_calls(user_id=user_id, response=result)
34 -print(result)
\ No newline at end of file
fern/snippets/tool-calling/python/fetching-tools.py deleted
-66
@@ -1,66 +0,0 @@
1 -from composio import Composio
2 -
3 -composio = Composio()
4 -user_id = "uuid-1234-5678-9012"
5 -
6 -tools = composio.tools.get(
7 - user_id,
8 - toolkits=["GITHUB"]
9 -)
10 -
11 -# Fetch with limit for a specific user
12 -tools = composio.tools.get(
13 - user_id,
14 - toolkits=["GITHUB"],
15 - limit=5 # Get top 5 tools
16 -)
17 -
18 -# Same filter but without user_id (for schemas)
19 -raw_tools = composio.tools.get_raw_composio_tools(
20 - toolkits=["GITHUB"],
21 - limit=5
22 -)
23 -
24 -# Fetch specific tools by name
25 -tools = composio.tools.get(
26 - user_id,
27 - tools=["GITHUB_CREATE_ISSUE", "GITHUB_CREATE_PULL_REQUEST"]
28 -)
29 -
30 -# Get schemas without user_id
31 -raw_tools = composio.tools.get_raw_composio_tools(
32 - tools=["GITHUB_CREATE_ISSUE", "GITHUB_CREATE_PULL_REQUEST"]
33 -)
34 -
35 -# Filter by OAuth scopes (single toolkit only)
36 -tools = composio.tools.get(
37 - user_id,
38 - toolkits=["GITHUB"],
39 - scopes=["write:org"]
40 -)
41 -
42 -# Search tools semantically
43 -tools = composio.tools.get(
44 - user_id,
45 - search="create calendar event"
46 -)
47 -
48 -# Search schemas without user_id
49 -raw_tools = composio.tools.get_raw_composio_tools(
50 - search="create calendar event"
51 -)
52 -
53 -# Search within a specific toolkit
54 -tools = composio.tools.get(
55 - user_id,
56 - search="issues",
57 - toolkits=["GITHUB"],
58 -)
59 -
60 -# Search toolkit schemas without user_id
61 -raw_tools = composio.tools.get_raw_composio_tools(
62 - search="issues",
63 - toolkits=["GITHUB"]
64 -)
65 -
66 -tool = composio.tools.get_raw_composio_tool_by_slug("GMAIL_SEND_EMAIL")
\ No newline at end of file
fern/snippets/tool-calling/python/file-download.py deleted
-15
@@ -1,15 +0,0 @@
1 -from composio import Composio
2 -
3 -
4 -composio = Composio(
5 - api_key="your_composio_key", file_download_dir="./downloads"
6 -) # Optional: Specify the directory to download files to
7 -
8 -result = composio.tools.execute(
9 - "GOOGLEDRIVE_DOWNLOAD_FILE",
10 - user_id="user-1235***",
11 - arguments={"file_id": "your_file_id"},
12 -)
13 -
14 -# Result includes local file path
15 -print(result)
fern/snippets/tool-calling/python/file-upload.py deleted
-14
@@ -1,14 +0,0 @@
1 -import os
2 -
3 -from composio import Composio
4 -
5 -composio = Composio(api_key="your_composio_key")
6 -
7 -# Upload a local file to Google Drive
8 -result = composio.tools.execute(
9 - slug="GOOGLEDRIVE_UPLOAD_FILE",
10 - user_id="user-1235***",
11 - arguments={"file_to_upload": os.path.join(os.getcwd(), "document.pdf")}, # Local file path
12 -)
13 -
14 -print(result) # Print Google Drive file details
fern/snippets/tool-calling/python/proxy-tool.py deleted
-19
@@ -1,19 +0,0 @@
1 -from composio import Composio
2 -
3 -composio = Composio(api_key="your_composio_key")
4 -
5 -# Send a proxy request to the endpoint
6 -response = composio.tools.proxy(
7 - endpoint="/repos/composiohq/composio/issues/1",
8 - method="GET",
9 - connected_account_id="ca_jI6********", # use connected account for github
10 - parameters=[
11 - {
12 - "name": "Accept",
13 - "value": "application/vnd.github.v3+json",
14 - "type": "header",
15 - },
16 - ],
17 -)
18 -
19 -print(response)
fern/snippets/tool-calling/python/raw_tools.py deleted
-7
@@ -1,7 +0,0 @@
1 -from composio import Composio
2 -
3 -composio = Composio()
4 -
5 -tool = composio.tools.get_raw_composio_tool_by_slug("HACKERNEWS_GET_LATEST_POSTS")
6 -
7 -print(tool.model_dump_json())
fern/snippets/tool-calling/python/versioning-manage.py deleted
-11
@@ -1,11 +0,0 @@
1 -from composio import Composio
2 -
3 -composio = Composio(api_key="YOUR_API_KEY")
4 -
5 -# Get toolkit information including available versions
6 -toolkit = composio.toolkits.get(slug="github")
7 -
8 -# Extract and print version information
9 -print(f"Toolkit: {toolkit.name}")
10 -print(f"Current Version: {toolkit.meta.version}")
11 -print(f"Available Versions: {toolkit.meta.available_versions}")
\ No newline at end of file
fern/snippets/tool-calling/python/versioning-per-execution.py deleted
-15
@@ -1,15 +0,0 @@
1 -from composio import Composio
2 -
3 -composio = Composio(api_key="YOUR_API_KEY")
4 -
5 -# Specify version directly in execute call
6 -result = composio.tools.execute(
7 - "GITHUB_LIST_STARGAZERS",
8 - arguments={
9 - "owner": "ComposioHQ",
10 - "repo": "composio"
11 - },
12 - user_id="user-k7334",
13 - version="20251027_00" # Override version for this execution
14 -)
15 -print(result)
\ No newline at end of file
fern/snippets/tool-calling/python/versioning-sdk-init.py deleted
-11
@@ -1,11 +0,0 @@
1 -from composio import Composio
2 -
3 -# Pin specific versions for each toolkit
4 -composio = Composio(
5 - api_key="YOUR_API_KEY",
6 - toolkit_versions={
7 - "github": "20251027_00",
8 - "slack": "20251027_00",
9 - "gmail": "20251027_00"
10 - }
11 -)
\ No newline at end of file
fern/snippets/tool-calling/typescript/checking-connection-status.ts deleted
-17
@@ -1,17 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -
3 -const composio = new Composio({ apiKey: 'your_api_key' });
4 -
5 -// Get a specific connected account by its nanoid
6 -const connectedAccount = await composio.connectedAccounts.get('your_connected_account_id');
7 -console.log(`Status: ${connectedAccount.status}`);
8 -
9 -// Filter connections by user_id, auth_config_id, and status (only active accounts)
10 -const filteredConnections = await composio.connectedAccounts.list({
11 - userIds: ['user_123'],
12 - authConfigIds: ['your_auth_config_id'],
13 - statuses: ['ACTIVE']
14 -});
15 -filteredConnections.items.forEach(connection => {
16 - console.log(`${connection.id}: ${connection.status}`);
17 -});
fern/snippets/tool-calling/typescript/direct-tool-call.ts deleted
-20
@@ -1,20 +0,0 @@
1 -import { Composio } from "@composio/core";
2 -
3 -const userId = "user-k7334";
4 -// Configure toolkit versions at SDK level
5 -const composio = new Composio({
6 - apiKey: "your_composio_key",
7 - toolkitVersions: { github: "20251027_00" }
8 -});
9 -
10 -// Find available arguments for any tool in the Composio dashboard
11 -const result = await composio.tools.execute("GITHUB_LIST_STARGAZERS", {
12 - userId,
13 - arguments: {
14 - "owner": "ComposioHQ",
15 - "repo": "composio",
16 - "page": 1,
17 - "per_page": 5
18 - },
19 -});
20 -console.log('GitHub stargazers:', JSON.stringify(result, null, 2));
\ No newline at end of file
fern/snippets/tool-calling/typescript/exec-tool-agentic.ts deleted
-33
@@ -1,33 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -import { generateText } from 'ai';
3 -import { anthropic } from '@ai-sdk/anthropic';
4 -import { VercelProvider } from '@composio/vercel';
5 -
6 -// Use a unique identifier for each user in your application
7 -const userId = 'user-k7334';
8 -
9 -// Initialize Composio toolset
10 -const composio = new Composio({
11 - apiKey: process.env.COMPOSIO_API_KEY,
12 - provider: new VercelProvider(),
13 -});
14 -
15 -// Get all tools for the user
16 -const tools = await composio.tools.get(userId, {
17 - toolkits: ['HACKERNEWS_GET_LATEST_POSTS'],
18 - limit: 10,
19 -});
20 -
21 -// Generate a deep research on hackernews
22 -const { text } = await generateText({
23 - model: anthropic('claude-sonnet-4-20250514'),
24 - messages: [
25 - {
26 - role: 'user',
27 - content: 'Do a thorough DEEP research on the top articles on Hacker News about Composio',
28 - },
29 - ],
30 - tools,
31 -});
32 -
33 -console.log(text);
fern/snippets/tool-calling/typescript/exec-tool-completions.ts deleted
-39
@@ -1,39 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -import { AnthropicProvider } from '@composio/anthropic';
3 -import { Anthropic } from '@anthropic-ai/sdk';
4 -
5 -// Use a unique identifier for each user in your application
6 -const userId = 'user-k7334';
7 -
8 -// Create anthropic client
9 -const anthropic = new Anthropic();
10 -
11 -// Create Composio client
12 -const composio = new Composio({
13 - apiKey: "your-composio-api-key",
14 - provider: new AnthropicProvider(),
15 -});
16 -
17 -// Get calendar tools for this user
18 -const tools = await composio.tools.get(userId, {
19 - tools: ['GOOGLECALENDAR_EVENTS_LIST'],
20 -});
21 -
22 -const today = new Date();
23 -
24 -// Ask the LLM to check calendar
25 -const msg = await anthropic.messages.create({
26 - model: 'claude-sonnet-4-20250514',
27 - tools: tools,
28 - messages: [
29 - {
30 - role: 'user',
31 - content: `What's on my calendar for the next 7 days starting today:${today.toLocaleDateString()}?`,
32 - },
33 - ],
34 - max_tokens: 1024,
35 -});
36 -
37 -// Handle tool calls
38 -const result = await composio.provider.handleToolCalls(userId, msg);
39 -console.log('Results:', JSON.stringify(result, null, 2));
fern/snippets/tool-calling/typescript/fetching-tools.ts deleted
-60
@@ -1,60 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -
3 -const composio = new Composio();
4 -const userId = "uuid-1234-5678-9012";
5 -
6 -const tools = await composio.tools.get(userId, {
7 - toolkits: ["GITHUB"]
8 -});
9 -
10 -// Fetch with limit for a specific user
11 -const limitedTools = await composio.tools.get(userId, {
12 - toolkits: ["GITHUB"],
13 - limit: 5 // Get top 5 tools
14 -});
15 -
16 -// Same filter but without userId (for schemas)
17 -const rawTools = await composio.tools.getRawComposioTools({
18 - toolkits: ["GITHUB"],
19 - limit: 5
20 -});
21 -
22 -// Fetch specific tools by name
23 -const specificTools = await composio.tools.get(userId, {
24 - tools: ["GITHUB_LIST_STARGAZERS", "GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER"]
25 -});
26 -
27 -// Get schemas without userId
28 -const specificRawTools = await composio.tools.getRawComposioTools({
29 - tools: ["GITHUB_LIST_STARGAZERS", "GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER"]
30 -});
31 -
32 -// Filter by OAuth scopes (single toolkit only)
33 -const scopedTools = await composio.tools.get(userId, {
34 - toolkits: ["GITHUB"],
35 - scopes: ["write:org"]
36 -});
37 -
38 -// Search tools semantically
39 -const searchResults = await composio.tools.get(userId, {
40 - search: "create google calendar event"
41 -});
42 -
43 -// Search schemas without userId
44 -const searchRawTools = await composio.tools.getRawComposioTools({
45 - search: "create google calendar event"
46 -});
47 -
48 -// Search within a specific toolkit
49 -const toolkitSearch = await composio.tools.get(userId, {
50 - search: "star a repository",
51 - toolkits: ["GITHUB"]
52 -});
53 -
54 -// Search toolkit schemas without userId
55 -const toolkitSearchRaw = await composio.tools.getRawComposioTools({
56 - search: "star a repository",
57 - toolkits: ["GITHUB"]
58 -});
59 -
60 -const tool = await composio.tools.getRawComposioToolBySlug("GMAIL_SEND_EMAIL");
\ No newline at end of file
fern/snippets/tool-calling/typescript/file-download.ts deleted
-13
@@ -1,13 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -const composio = new Composio({apiKey: 'your-composio-api-key'});
3 -
4 -// Download a file from Google Drive
5 -const result = await composio.tools.execute('GOOGLEDRIVE_DOWNLOAD_FILE', {
6 - userId: 'user-1235***',
7 - arguments: {
8 - file_id: 'your-file-id'
9 - }
10 - });
11 -
12 -// Result includes local file path
13 -console.log(result);
\ No newline at end of file
fern/snippets/tool-calling/typescript/file-upload.ts deleted
-16
@@ -1,16 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -import path from 'path';
3 -
4 -const composio = new Composio({
5 - apiKey: 'your-composio-api-key'
6 -});
7 -
8 -// Upload a local file to Google Drive
9 -const result = await composio.tools.execute('GOOGLEDRIVE_UPLOAD_FILE', {
10 - userId: 'user-4235***',
11 - arguments: {
12 - file_to_upload: path.join(__dirname, 'document.pdf') // Local file path
13 - }
14 -});
15 -
16 -console.log(result.data); // Contains Google Drive file details
fern/snippets/tool-calling/typescript/proxy-tool.ts deleted
-20
@@ -1,20 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -
3 -const composio = new Composio({apiKey: "your_composio_key"});
4 -
5 -// Send a proxy request to the endpoint
6 -const { data } = await composio.tools.proxyExecute({
7 - endpoint:'/repos/composiohq/composio/issues/1',
8 - method: 'GET',
9 - connectedAccountId: 'ca_jI*****', // use connected account for github
10 - parameters:[
11 - {
12 - "name": "Accept",
13 - "value": "application/vnd.github.v3+json",
14 - "in": "header",
15 - },
16 - ],
17 -});
18 -
19 -console.log(data);
20 -
\ No newline at end of file
fern/snippets/tool-calling/typescript/raw_tools.ts deleted
-7
@@ -1,7 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -
3 -const composio = new Composio();
4 -
5 -const tool = await composio.tools.getRawComposioToolBySlug('GITHUB_GET_OCTOCAT');
6 -
7 -console.log(JSON.stringify(tool, null, 2));
fern/snippets/tool-calling/typescript/versioning-manage.ts deleted
-12
@@ -1,12 +0,0 @@
1 -import { Composio } from "@composio/core";
2 -
3 -const composio = new Composio({ apiKey: "YOUR_API_KEY" });
4 -
5 -// Get toolkit information including available versions
6 -const toolkit = await composio.toolkits.get("github");
7 -
8 -// Extract and print version information
9 -console.log("Toolkit:", toolkit.name);
10 -console.log("Current Version:", toolkit.meta.version);
11 -console.log("Available Versions:", toolkit.meta.availableVersions);
12 -console.log("Latest Version:", toolkit.meta.availableVersions[0]); // First one is usually the latest
\ No newline at end of file
fern/snippets/tool-calling/typescript/versioning-per-execution.ts deleted
-14
@@ -1,14 +0,0 @@
1 -import { Composio } from "@composio/core";
2 -
3 -const composio = new Composio({ apiKey: "YOUR_API_KEY" });
4 -
5 -// Specify version directly in execute call
6 -const result = await composio.tools.execute("GITHUB_LIST_STARGAZERS", {
7 - userId: "user-k7334",
8 - arguments: {
9 - owner: "ComposioHQ",
10 - repo: "composio"
11 - },
12 - version: "20251027_00" // Override version for this execution
13 -});
14 -console.log(result);
\ No newline at end of file
fern/snippets/tool-calling/typescript/versioning-sdk-init.ts deleted
-11
@@ -1,11 +0,0 @@
1 -import { Composio } from "@composio/core";
2 -
3 -// Pin specific versions for each toolkit
4 -const composio = new Composio({
5 - apiKey: "YOUR_API_KEY",
6 - toolkitVersions: {
7 - github: "20251027_00",
8 - slack: "20251027_00",
9 - gmail: "20251027_00"
10 - }
11 -});
\ No newline at end of file
fern/snippets/tool-router/python/manual-auth.py deleted
-25
@@ -1,25 +0,0 @@
1 -from composio import Composio
2 -
3 -composio = Composio(api_key="your-api-key")
4 -
5 -required_toolkits = ["gmail", "github"]
6 -
7 -session = composio.create(
8 - user_id="user_123",
9 - manage_connections=False, # Disable in-chat auth prompts
10 -)
11 -
12 -toolkits = session.toolkits()
13 -
14 -connected = {t.slug for t in toolkits.items if t.connection.is_active}
15 -pending = [slug for slug in required_toolkits if slug not in connected]
16 -
17 -print(f"Connected: {connected}")
18 -print(f"Pending: {pending}")
19 -
20 -for slug in pending:
21 - connection_request = session.authorize(slug)
22 - print(f"Connect {slug}: {connection_request.redirect_url}")
23 - connection_request.wait_for_connection()
24 -
25 -print(f"All toolkits connected! MCP URL: {session.mcp.url}")
fern/snippets/tool-router/python/mcp-claude.py deleted
-69
@@ -1,69 +0,0 @@
1 -import asyncio
2 -from dotenv import load_dotenv
3 -from claude_agent_sdk.client import ClaudeSDKClient
4 -from claude_agent_sdk.types import (
5 - ClaudeAgentOptions,
6 - AssistantMessage,
7 - TextBlock,
8 - ToolUseBlock,
9 -)
10 -from composio import Composio
11 -
12 -load_dotenv()
13 -
14 -# Initialize Composio (API key from env var COMPOSIO_API_KEY or pass explicitly)
15 -composio = Composio()
16 -
17 -# Unique identifier of the user
18 -user_id = "user_123"
19 -# Create a tool router session for the user
20 -session = composio.create(user_id=user_id)
21 -
22 -# Configure Claude with Composio MCP server
23 -options = ClaudeAgentOptions(
24 - system_prompt=(
25 - "You are a helpful assistant with access to external tools. "
26 - "Always use the available tools to complete user requests."
27 - ),
28 - mcp_servers={
29 - "composio": {
30 - "type": "http",
31 - "url": session.mcp.url,
32 - "headers": session.mcp.headers, # Authentication headers for the Composio MCP server
33 - }
34 - },
35 - permission_mode="bypassPermissions", # Auto-approve tools (demo only)
36 -)
37 -
38 -async def main():
39 - print("""
40 -What task would you like me to help you with?
41 -I can use tools like Gmail, GitHub, Linear, Notion, and more.
42 -(Type 'exit' to exit)
43 -Example tasks:
44 - • 'Summarize my emails from today'
45 - • 'List all open issues on the composio github repository and create a notion page with the issues'
46 -""")
47 -
48 - async with ClaudeSDKClient(options) as client:
49 - # Multi-turn conversation with agentic tool calling
50 - while True:
51 - user_input = input("\nYou: ").strip()
52 - if user_input.lower() == "exit":
53 - break
54 -
55 - print("\nClaude: ", end="", flush=True)
56 - try:
57 - await client.query(user_input)
58 - async for msg in client.receive_response():
59 - if isinstance(msg, AssistantMessage):
60 - for block in msg.content:
61 - if isinstance(block, ToolUseBlock):
62 - print(f"\n[Using tool: {block.name}]", end="")
63 - elif isinstance(block, TextBlock):
64 - print(block.text, end="", flush=True)
65 - except Exception as e:
66 - print(f"\n[Error]: {e}")
67 -
68 -if __name__ == "__main__":
69 - asyncio.run(main())
\ No newline at end of file
fern/snippets/tool-router/python/mcp-openai.py deleted
-45
@@ -1,45 +0,0 @@
1 -from dotenv import load_dotenv
2 -from composio import Composio
3 -from agents import Agent, Runner, HostedMCPTool
4 -
5 -load_dotenv()
6 -
7 -# Initialize Composio (API key from env var COMPOSIO_API_KEY)
8 -composio = Composio()
9 -# Unique identifier of the user
10 -user_id = "user_123"
11 -
12 -# Create a Tool Router session for the user
13 -session = composio.create(user_id=user_id)
14 -
15 -# Configure OpenAI agent with Composio MCP server
16 -agent = Agent(
17 - name="Personal Assistant",
18 - instructions="You are a helpful personal assistant. Use Composio tools to take action.",
19 - model="gpt-5.2",
20 - tools=[
21 - HostedMCPTool(
22 - tool_config={
23 - "type": "mcp",
24 - "server_label": "composio",
25 - "server_url": session.mcp.url,
26 - "require_approval": "never",
27 - "headers": session.mcp.headers,
28 - }
29 - )
30 - ],
31 -)
32 -
33 -# Execute the task
34 -print("Fetching GitHub issues from the Composio repository @ComposioHQ/composio...\n")
35 -try:
36 - result = Runner.run_sync(
37 - starting_agent=agent,
38 - input="Fetch all the open GitHub issues on the composio repository and group them by bugs/features/docs.",
39 - )
40 - print(result.final_output)
41 -except Exception as e:
42 - print(f"[Error]: {e}")
43 -
44 -print("\n\n---")
45 -print("Tip: If prompted to authenticate, complete the auth flow and run again.")
\ No newline at end of file
fern/snippets/tool-router/python/native-tools-openai.py deleted
-54
@@ -1,54 +0,0 @@
1 -from dotenv import load_dotenv
2 -from composio import Composio
3 -from agents import Agent, Runner, SQLiteSession
4 -from composio_openai_agents import OpenAIAgentsProvider
5 -
6 -load_dotenv()
7 -
8 -# Initialize Composio with OpenAI Agents provider (API key from env var COMPOSIO_API_KEY)
9 -composio = Composio(provider=OpenAIAgentsProvider())
10 -
11 -# Unique identifier of the user
12 -user_id = "user_123"
13 -
14 -# Create a session and get native tools for the user
15 -session = composio.create(user_id=user_id)
16 -tools = session.tools()
17 -
18 -# Configure OpenAI agent with Composio tools
19 -agent = Agent(
20 - name="Personal Assistant",
21 - instructions="You are a helpful personal assistant. Use Composio tools to take action.",
22 - model="gpt-5.2",
23 - tools=tools,
24 -)
25 -
26 -# Memory for multi-turn conversation
27 -memory = SQLiteSession("conversation")
28 -
29 -# Execute an initial task
30 -print("Fetching GitHub issues from the Composio repository...\n")
31 -try:
32 - result = Runner.run_sync(
33 - starting_agent=agent,
34 - input="Fetch all the open GitHub issues on the @ComposioHQ/composio repository and group them by bugs/features/docs.",
35 - session=memory,
36 - )
37 - print(f"{result.final_output}\n")
38 -except Exception as e:
39 - print(f"[Error]: {e}")
40 -
41 -# Continue with interactive conversation
42 -print("\nWhat else would you like me to do? (Type 'exit' to exit)")
43 -
44 -while True:
45 - user_input = input("You: ").strip()
46 - if user_input.lower() == "exit":
47 - break
48 -
49 - print("Assistant: ", end="", flush=True)
50 - try:
51 - result = Runner.run_sync(starting_agent=agent, input=user_input, session=memory)
52 - print(f"{result.final_output}\n")
53 - except Exception as e:
54 - print(f"\n[Error]: {e}")
\ No newline at end of file
fern/snippets/tool-router/python/quickstart-mcp-claude.py deleted
-73
@@ -1,73 +0,0 @@
1 -import asyncio
2 -from dotenv import load_dotenv
3 -from claude_agent_sdk.client import ClaudeSDKClient
4 -from claude_agent_sdk.types import (
5 - ClaudeAgentOptions,
6 - AssistantMessage,
7 - TextBlock,
8 - ToolUseBlock,
9 -)
10 -from composio import Composio
11 -
12 -load_dotenv()
13 -
14 -# Initialize Composio (API key from env var COMPOSIO_API_KEY)
15 -composio = Composio()
16 -
17 -# Unique identifier of the user
18 -user_id = "user_123"
19 -
20 -# Create a tool router session for the user
21 -session = composio.create(user_id=user_id)
22 -
23 -# Configure Claude with Composio MCP server
24 -options = ClaudeAgentOptions(
25 - system_prompt=(
26 - "You are a helpful assistant with access to external tools. "
27 - "Always use the available tools to complete user requests."
28 - ),
29 - mcp_servers={
30 - "composio": {
31 - "type": "http",
32 - "url": session.mcp.url,
33 - "headers": session.mcp.headers,
34 - }
35 - },
36 - permission_mode="bypassPermissions",
37 -)
38 -
39 -
40 -async def main():
41 - print("""
42 -What task would you like me to help you with?
43 -I can use tools like Gmail, GitHub, Linear, Notion, and more.
44 -(Type 'exit' to exit)
45 -Example tasks:
46 - • 'Summarize my emails from today'
47 - • 'List all open issues on the composio github repository and create a notion page with the issues'
48 -""")
49 -
50 - async with ClaudeSDKClient(options) as client:
51 - # Multi-turn conversation with agentic tool calling
52 - while True:
53 - user_input = input("You: ").strip()
54 - if user_input.lower() == "exit":
55 - break
56 -
57 - print("\nClaude: ", end="", flush=True)
58 - try:
59 - await client.query(user_input)
60 - async for msg in client.receive_response():
61 - if isinstance(msg, AssistantMessage):
62 - for block in msg.content:
63 - if isinstance(block, ToolUseBlock):
64 - print(f"\n[Using tool: {block.name}]", end="")
65 - elif isinstance(block, TextBlock):
66 - print(block.text, end="", flush=True)
67 - print()
68 - except Exception as e:
69 - print(f"\n[Error]: {e}")
70 -
71 -
72 -if __name__ == "__main__":
73 - asyncio.run(main())
\ No newline at end of file
fern/snippets/tool-router/python/quickstart-mcp-openai.py deleted
-56
@@ -1,56 +0,0 @@
1 -from dotenv import load_dotenv
2 -from composio import Composio
3 -from agents import Agent, Runner, HostedMCPTool, SQLiteSession
4 -
5 -load_dotenv()
6 -
7 -# Initialize Composio (API key from env var COMPOSIO_API_KEY)
8 -composio = Composio()
9 -
10 -# Unique identifier of the user
11 -user_id = "user_123"
12 -
13 -# Create a Tool Router session for the user
14 -session = composio.create(user_id=user_id)
15 -
16 -# Configure OpenAI agent with Composio MCP server
17 -agent = Agent(
18 - name="Personal Assistant",
19 - instructions="You are a helpful personal assistant. Use Composio tools to take action.",
20 - model="gpt-5.2",
21 - tools=[
22 - HostedMCPTool(
23 - tool_config={
24 - "type": "mcp",
25 - "server_label": "composio",
26 - "server_url": session.mcp.url,
27 - "require_approval": "never",
28 - "headers": session.mcp.headers,
29 - }
30 - )
31 - ],
32 -)
33 -
34 -# Memory for multi-turn conversation
35 -memory = SQLiteSession(user_id)
36 -
37 -print("""
38 -What task would you like me to help you with?
39 -I can use tools like Gmail, GitHub, Linear, Notion, and more.
40 -(Type 'exit' to exit)
41 -Example tasks:
42 - • 'Summarize my emails from today'
43 - • 'List all open issues on the composio github repository'
44 -""")
45 -
46 -while True:
47 - user_input = input("You: ").strip()
48 - if user_input.lower() == "exit":
49 - break
50 -
51 - print("Assistant: ", end="", flush=True)
52 - try:
53 - result = Runner.run_sync(starting_agent=agent, input=user_input, session=memory)
54 - print(f"{result.final_output}\n")
55 - except Exception as e:
56 - print(f"\n[Error]: {e}")
fern/snippets/tool-router/python/quickstart-native-openai.py deleted
-48
@@ -1,48 +0,0 @@
1 -from dotenv import load_dotenv
2 -from composio import Composio
3 -from agents import Agent, Runner, SQLiteSession
4 -from composio_openai_agents import OpenAIAgentsProvider
5 -
6 -load_dotenv()
7 -
8 -# Initialize Composio with OpenAI Agents provider (API key from env var COMPOSIO_API_KEY)
9 -composio = Composio(provider=OpenAIAgentsProvider())
10 -
11 -# Unique identifier of the user
12 -user_id = "user_123"
13 -
14 -# Create a session and get native tools for the user
15 -session = composio.create(user_id=user_id)
16 -tools = session.tools()
17 -
18 -# Configure OpenAI agent with Composio tools
19 -agent = Agent(
20 - name="Personal Assistant",
21 - instructions="You are a helpful personal assistant. Use Composio tools to take action.",
22 - model="gpt-5.2",
23 - tools=tools,
24 -)
25 -
26 -# Memory for multi-turn conversation
27 -memory = SQLiteSession("conversation")
28 -
29 -print("""
30 -What task would you like me to help you with?
31 -I can use tools like Gmail, GitHub, Linear, Notion, and more.
32 -(Type 'exit' to exit)
33 -Example tasks:
34 - • 'Summarize my emails from today'
35 - • 'List all open issues on the composio github repository'
36 -""")
37 -
38 -while True:
39 - user_input = input("You: ").strip()
40 - if user_input.lower() == "exit":
41 - break
42 -
43 - print("Assistant: ", end="", flush=True)
44 - try:
45 - result = Runner.run_sync(starting_agent=agent, input=user_input, session=memory)
46 - print(f"{result.final_output}\n")
47 - except Exception as e:
48 - print(f"\n[Error]: {e}")
\ No newline at end of file
fern/snippets/tool-router/python/quickstart.py deleted
-42
@@ -1,42 +0,0 @@
1 -import asyncio
2 -import os
3 -from composio import Composio
4 -from composio_openai_agents import OpenAIAgentsProvider
5 -from agents import Agent, Runner, HostedMCPTool
6 -
7 -async def main() -> None:
8 - # Initialize Composio and create Tool Router session
9 - composio = Composio(
10 - api_key=os.getenv("COMPOSIO_API_KEY"), # Uses env var by default
11 - provider=OpenAIAgentsProvider()
12 - )
13 - session = composio.experimental.tool_router.create_session(
14 - user_id="user@example.com",
15 - toolkits=["gmail", "github"] # Optional: Limit available toolkits
16 - )
17 -
18 - # Set up OpenAI agent with Tool Router MCP endpoint
19 - agent = Agent(
20 - name="Assistant",
21 - instructions="You are a helpful assistant that can access Gmail and GitHub. "
22 - "Help users fetch emails, create issues, manage pull requests, and more.",
23 - tools=[
24 - HostedMCPTool(
25 - tool_config={
26 - "type": "mcp",
27 - "server_label": "tool_router",
28 - "server_url": session['url'],
29 - "require_approval": "never",
30 - }
31 - )
32 - ],
33 - )
34 -
35 - # Execute the agent
36 - result = await Runner.run(
37 - agent,
38 - "Fetch the contributors to composiohq/composio github repository and email the list to user@example.com"
39 - )
40 - print(result.final_output)
41 -
42 -asyncio.run(main())
\ No newline at end of file
fern/snippets/tool-router/typescript/manual-auth.ts deleted
-28
@@ -1,28 +0,0 @@
1 -import { Composio } from "@composio/core";
2 -
3 -const composio = new Composio({ apiKey: "your-api-key" });
4 -
5 -const requiredToolkits = ["gmail", "github"];
6 -
7 -const session = await composio.create("user_123", {
8 - manageConnections: false, // Disable in-chat auth prompts
9 -});
10 -
11 -const toolkits = await session.toolkits();
12 -
13 -const connected = toolkits.items
14 - .filter((t) => t.connection.connectedAccount)
15 - .map((t) => t.slug);
16 -
17 -const pending = requiredToolkits.filter((slug) => !connected.includes(slug));
18 -
19 -console.log("Connected:", connected);
20 -console.log("Pending:", pending);
21 -
22 -for (const slug of pending) {
23 - const connectionRequest = await session.authorize(slug);
24 - console.log(`Connect ${slug}: ${connectionRequest.redirectUrl}`);
25 - await connectionRequest.waitForConnection();
26 -}
27 -
28 -console.log(`All toolkits connected! MCP URL: ${session.mcp.url}`);
fern/snippets/tool-router/typescript/mcp-claude.ts deleted
-73
@@ -1,73 +0,0 @@
1 -import "dotenv/config";
2 -import { query, type Options } from "@anthropic-ai/claude-agent-sdk";
3 -import { Composio } from "@composio/core";
4 -import { createInterface } from "readline/promises";
5 -
6 -// Initialize Composio (API key from env var COMPOSIO_API_KEY or pass explicitly: { apiKey: "your-key" })
7 -const composio = new Composio();
8 -
9 -// Unique identifier of the user
10 -const userId = "user_123";
11 -
12 -// Create a tool router session for the user
13 -const session = await composio.create(userId);
14 -
15 -const options: Options = {
16 - systemPrompt: `You are a helpful assistant with access to external tools. ` +
17 - `Always use the available tools to complete user requests.`,
18 - mcpServers: {
19 - composio: {
20 - type: "http",
21 - url: session.mcp.url,
22 - headers: session.mcp.headers // Authentication headers for the Composio MCP server
23 - },
24 - },
25 - permissionMode: "bypassPermissions", // Auto-approve tools (demo only - use "default" in production)
26 -};
27 -
28 -// Set up interactive terminal input/output for the conversation
29 -const readline = createInterface({ input: process.stdin, output: process.stdout });
30 -
31 -console.log(`
32 -What task would you like me to help you with?
33 -I can use tools like Gmail, GitHub, Linear, Notion, and more.
34 -(Type 'exit' to exit)
35 -Example tasks:
36 - • 'Summarize my emails from today'
37 - • 'List all open issues on the composio github repository and create a notion page with the issues'
38 -`);
39 -
40 -let isFirstQuery = true;
41 -
42 -// Multi-turn conversation with agentic tool calling
43 -while (true) {
44 - const answer = await readline.question('You: ');
45 - const input = answer.trim();
46 - if (input.toLowerCase() === "exit") break;
47 -
48 - process.stdout.write("Claude: ");
49 -
50 - const queryOptions = isFirstQuery ? options : { ...options, continue: true };
51 - isFirstQuery = false;
52 -
53 - try {
54 - for await (const stream of query({ prompt: input, options: queryOptions })) {
55 - // Only process assistant messages (the SDK also sends result/error messages)
56 - if (stream.type === "assistant") {
57 - const { content } = stream.message;
58 - for (const block of content) {
59 - if (block.type === "tool_use") {
60 - process.stdout.write(`\n[Using tool: ${block.name}]`);
61 - } else if (block.type === "text") {
62 - process.stdout.write(block.text);
63 - }
64 - }
65 - }
66 - }
67 - } catch (error) {
68 - console.error("\n[Error]:", error instanceof Error ? error.message : error);
69 - }
70 - process.stdout.write("\n");
71 -}
72 -
73 -readline.close();
fern/snippets/tool-router/typescript/mcp-openai.ts deleted
-65
@@ -1,65 +0,0 @@
1 -import "dotenv/config";
2 -import { Composio } from "@composio/core";
3 -import { Agent, hostedMcpTool, run, MemorySession } from "@openai/agents";
4 -import { createInterface } from "readline/promises";
5 -
6 -// Initialize Composio (API key from env var COMPOSIO_API_KEY or pass explicitly: { apiKey: "your-key" })
7 -const composio = new Composio();
8 -
9 -// Unique identifier of the user
10 -const userId = "user_123";
11 -
12 -// Create a tool router session for the user
13 -const session = await composio.create(userId);
14 -
15 -const agent = new Agent({
16 - name: "Personal Assistant",
17 - instructions: "You are a helpful personal assistant. Use Composio tools to take action.",
18 - model: "gpt-5.2",
19 - tools: [
20 - hostedMcpTool({
21 - serverLabel: "composio",
22 - serverUrl: session.mcp.url,
23 - headers: session.mcp.headers, // Authentication headers for the Composio MCP server
24 - }),
25 - ],
26 -});
27 -
28 -// Create a memory session for persistent multi-turn conversation
29 -const memory = new MemorySession();
30 -
31 -// Execute an initial task
32 -console.log("Fetching GitHub issues from the Composio repository...\n");
33 -try {
34 - const initialResult = await run(
35 - agent,
36 - "Fetch all the open GitHub issues on the composio repository and group them by bugs/features/docs.",
37 - { session: memory }
38 - );
39 - console.log(`${initialResult.finalOutput}\n`);
40 -} catch (error) {
41 - console.error("[Error]:", error instanceof Error ? error.message : error);
42 -}
43 -
44 -// Continue with interactive conversation
45 -const readline = createInterface({ input: process.stdin, output: process.stdout });
46 -
47 -console.log(`
48 -What else would you like me to do?
49 -(Type 'exit' to exit)
50 -`);
51 -
52 -while (true) {
53 - const input = (await readline.question("You: ")).trim();
54 - if (input.toLowerCase() === "exit") break;
55 -
56 - console.log("Assistant: ");
57 -
58 - try {
59 - const result = await run(agent, input, { session: memory });
60 - console.log(`${result.finalOutput}\n`);
61 - } catch (error) {
62 - console.error("\n[Error]:", error instanceof Error ? error.message : error);
63 - }
64 -}
65 -readline.close();
fern/snippets/tool-router/typescript/mcp-vercel.ts deleted
-46
@@ -1,46 +0,0 @@
1 -import "dotenv/config";
2 -import { anthropic } from "@ai-sdk/anthropic";
3 -import { experimental_createMCPClient as createMCPClient } from "@ai-sdk/mcp";
4 -import { Composio } from "@composio/core";
5 -import { stepCountIs, streamText } from "ai";
6 -
7 -// Initialize Composio (API key from env var COMPOSIO_API_KEY or pass explicitly: { apiKey: "your-key" })
8 -const composio = new Composio();
9 -
10 -// Unique identifier of the user
11 -const userId = "user_123";
12 -
13 -// Create a tool router session for the user
14 -const { mcp } = await composio.create(userId);
15 -
16 -// Create an MCP client to connect to the Composio tool router
17 -const client = await createMCPClient({
18 - transport: {
19 - type: "http",
20 - url: mcp.url,
21 - headers: mcp.headers, // Authentication headers for the Composio MCP server
22 - },
23 -});
24 -const tools = await client.tools();
25 -
26 -console.log("Summarizing your emails from today");
27 -
28 -const stream = await streamText({
29 - system: "You are a helpful personal assistant. Use Composio tools to take action.",
30 - model: anthropic("claude-sonnet-4-5"),
31 - prompt: "Summarize my emails from today",
32 - stopWhen: stepCountIs(10),
33 - onStepFinish: (step) => {
34 - for (const toolCall of step.toolCalls) {
35 - console.log(`[Using tool: ${toolCall.toolName}]`);
36 - }
37 - },
38 - tools,
39 -});
40 -
41 -for await (const textPart of stream.textStream) {
42 - process.stdout.write(textPart);
43 -}
44 -
45 -console.log("\n\n---");
46 -console.log("Tip: If prompted to authenticate, complete the auth flow and run again.")
fern/snippets/tool-router/typescript/native-tools-openai.ts deleted
-62
@@ -1,62 +0,0 @@
1 -import "dotenv/config";
2 -import { Composio } from "@composio/core";
3 -import { Agent, run, MemorySession } from "@openai/agents";
4 -import { OpenAIAgentsProvider } from "@composio/openai-agents";
5 -import { createInterface } from "readline/promises";
6 -
7 -// Initialize Composio with OpenAI Agents provider (API key from env var COMPOSIO_API_KEY)
8 -const composio = new Composio({ provider: new OpenAIAgentsProvider() });
9 -
10 -// Unique identifier of the user
11 -const userId = "user_123";
12 -
13 -// Create a session and get native tools for the user
14 -const session = await composio.create(userId);
15 -const tools = await session.tools();
16 -
17 -const agent = new Agent({
18 - name: "Personal Assistant",
19 - instructions: "You are a helpful personal assistant. Use Composio tools to take action.",
20 - model: "gpt-5.2",
21 - tools,
22 -});
23 -
24 -// Create a memory session for persistent multi-turn conversation
25 -const memory = new MemorySession();
26 -
27 -// Execute an initial task
28 -console.log("Fetching GitHub issues from the Composio repository...\n");
29 -try {
30 - const initialResult = await run(
31 - agent,
32 - "Fetch all the open GitHub issues on the composio repository and group them by bugs/features/docs.",
33 - { session: memory }
34 - );
35 - console.log(`${initialResult.finalOutput}\n`);
36 -} catch (error) {
37 - console.error("[Error]:", error instanceof Error ? error.message : error);
38 -}
39 -
40 -// Continue with interactive conversation
41 -const readline = createInterface({ input: process.stdin, output: process.stdout });
42 -
43 -console.log(`
44 -What else would you like me to do?
45 -(Type 'exit' to exit)
46 -`);
47 -
48 -
49 -while (true) {
50 - const input = (await readline.question("You: ")).trim();
51 - if (input.toLowerCase() === "exit") break;
52 -
53 - console.log("Assistant: ");
54 -
55 - try {
56 - const result = await run(agent, input, { session: memory });
57 - console.log(`${result.finalOutput}\n`);
58 - } catch (error) {
59 - console.error("\n[Error]:", error instanceof Error ? error.message : error);
60 - }
61 -}
62 -readline.close();
fern/snippets/tool-router/typescript/native-tools-vercel.ts deleted
-38
@@ -1,38 +0,0 @@
1 -import "dotenv/config";
2 -import { anthropic } from "@ai-sdk/anthropic";
3 -import { Composio } from "@composio/core";
4 -import { VercelProvider } from "@composio/vercel";
5 -import { stepCountIs, streamText } from "ai";
6 -
7 -// Initialize Composio with Vercel provider (API key from env var COMPOSIO_API_KEY)
8 -const composio = new Composio({ provider: new VercelProvider() });
9 -
10 -// Unique identifier of the user
11 -const userId = "user_123";
12 -
13 -// Create a session and get native tools for the user
14 -const session = await composio.create(userId);
15 -const tools = await session.tools();
16 -
17 -console.log("Fetching GitHub issues from the Composio repository...");
18 -
19 -// Stream the response with tool calling
20 -const stream = await streamText({
21 - system: "You are a helpful personal assistant. Use Composio tools to take action.",
22 - model: anthropic("claude-sonnet-4-5"),
23 - prompt: "Fetch all the open GitHub issues on the composio repository and group them by bugs/features/docs.",
24 - stopWhen: stepCountIs(10),
25 - onStepFinish: (step) => {
26 - for (const toolCall of step.toolCalls) {
27 - console.log(`[Using tool: ${toolCall.toolName}]`);
28 - }
29 - },
30 - tools,
31 -});
32 -
33 -for await (const textPart of stream.textStream) {
34 - process.stdout.write(textPart);
35 -}
36 -
37 -console.log("\n\n---");
38 -console.log("Tip: If prompted to authenticate, complete the auth flow and run again.");
fern/snippets/tool-router/typescript/quickstart-mcp-claude.ts deleted
-74
@@ -1,74 +0,0 @@
1 -import "dotenv/config";
2 -import { query, type Options } from "@anthropic-ai/claude-agent-sdk";
3 -import { Composio } from "@composio/core";
4 -import { createInterface } from "readline/promises";
5 -
6 -// Initialize Composio (API key from env var COMPOSIO_API_KEY or pass explicitly: { apiKey: "your-key" })
7 -const composio = new Composio();
8 -
9 -// Unique identifier of the user
10 -const userId = "user_123";
11 -
12 -// Create a tool router session for the user
13 -const session = await composio.create(userId);
14 -
15 -const options: Options = {
16 - systemPrompt: `You are a helpful assistant with access to external tools. ` +
17 - `Always use the available tools to complete user requests.`,
18 - mcpServers: {
19 - composio: {
20 - type: "http",
21 - url: session.mcp.url,
22 - headers: session.mcp.headers // Authentication headers for the Composio MCP server
23 - },
24 - },
25 - permissionMode: "bypassPermissions", // Auto-approve tools (demo only - use "default" in production)
26 -};
27 -
28 -// Set up interactive terminal input/output for the conversation
29 -const readline = createInterface({ input: process.stdin, output: process.stdout });
30 -
31 -console.log(`
32 -What task would you like me to help you with?
33 -I can use tools like Gmail, GitHub, Linear, Notion, and more.
34 -(Type 'exit' to exit)
35 -Example tasks:
36 - • 'Summarize my emails from today'
37 - • 'List all open issues on the composio github repository and create a Google Sheet with the issues'
38 -`);
39 -
40 -let isFirstQuery = true;
41 -
42 -// Multi-turn conversation with agentic tool calling
43 -while (true) {
44 - const answer = await readline.question('You: ');
45 - const input = answer.trim();
46 - if (input.toLowerCase() === "exit") break;
47 -
48 - process.stdout.write("Claude: ");
49 -
50 - // Use `continue: true` to maintain conversation context
51 - const queryOptions = isFirstQuery ? options : { ...options, continue: true };
52 - isFirstQuery = false;
53 -
54 - try {
55 - for await (const stream of query({ prompt: input, options: queryOptions })) {
56 - // Only process assistant messages (the SDK also sends result/error messages)
57 - if (stream.type === "assistant") {
58 - const { content } = stream.message;
59 - for (const block of content) {
60 - if (block.type === "tool_use") {
61 - process.stdout.write(`\n[Using tool: ${block.name}]`);
62 - } else if (block.type === "text") {
63 - process.stdout.write(block.text);
64 - }
65 - }
66 - }
67 - }
68 - } catch (error) {
69 - console.error("\n[Error]:", error instanceof Error ? error.message : error);
70 - }
71 - process.stdout.write("\n");
72 -}
73 -
74 -readline.close();
fern/snippets/tool-router/typescript/quickstart-mcp-openai.ts deleted
-58
@@ -1,58 +0,0 @@
1 -import "dotenv/config";
2 -import { Composio } from "@composio/core";
3 -import { Agent, run, hostedMcpTool, MemorySession } from "@openai/agents";
4 -import { createInterface } from "readline/promises";
5 -
6 -// Initialize Composio (API key from env var COMPOSIO_API_KEY or pass explicitly: { apiKey: "your-key" })
7 -const composio = new Composio();
8 -
9 -// Unique identifier of the user
10 -const userId = "user_123";
11 -
12 -// Create a tool router session for the user
13 -const session = await composio.create(userId);
14 -
15 -const agent = new Agent({
16 - name: "Personal Assistant",
17 - instructions: "You are a helpful personal assistant. Use Composio tools to take action.",
18 - model: "gpt-5.2",
19 - tools: [
20 - hostedMcpTool({
21 - serverLabel: "composio",
22 - serverUrl: session.mcp.url,
23 - headers: session.mcp.headers // Authentication headers for the Composio MCP server
24 - }),
25 - ],
26 -});
27 -
28 -// Create a memory session for persistent multi-turn conversation
29 -const memory = new MemorySession();
30 -
31 -// Set up interactive terminal input/output for the conversation
32 -const readline = createInterface({ input: process.stdin, output: process.stdout });
33 -
34 -console.log(`
35 -What task would you like me to help you with?
36 -I can use tools like Gmail, GitHub, Linear, Notion, and more.
37 -(Type 'exit' to exit)
38 -Example tasks:
39 - • 'Summarize my emails from today'
40 - • 'List all open issues on the composio github repository and create a Google Sheet with the issues'
41 -`);
42 -
43 -// Multi-turn conversation with agentic tool calling
44 -while (true) {
45 - const input = (await readline.question("You: ")).trim();
46 - if (input.toLowerCase() === "exit") break;
47 -
48 - console.log("Assistant: ");
49 -
50 - try {
51 - // Multi-turn agentic loop: GPT calls tools and reasons until task is complete
52 - const result = await run(agent, input, { session: memory });
53 - console.log(`${result.finalOutput}`);
54 - } catch (error) {
55 - console.error("\n[Error]:", error instanceof Error ? error.message : error);
56 - }
57 -}
58 -readline.close();
fern/snippets/tool-router/typescript/quickstart-mcp-vercel.ts deleted
-46
@@ -1,46 +0,0 @@
1 -import "dotenv/config";
2 -import { anthropic } from "@ai-sdk/anthropic";
3 -import { experimental_createMCPClient as createMCPClient } from "@ai-sdk/mcp";
4 -import { Composio } from "@composio/core";
5 -import { stepCountIs, streamText } from "ai";
6 -
7 -// Initialize Composio (API key from env var COMPOSIO_API_KEY or pass explicitly: { apiKey: "your-key" })
8 -const composio = new Composio();
9 -
10 -// Unique identifier of the user
11 -const userId = "user_123";
12 -
13 -// Create a tool router session for the user
14 -const { mcp } = await composio.create(userId);
15 -
16 -// Create an MCP client to connect to the Composio tool router
17 -const client = await createMCPClient({
18 - transport: {
19 - type: "http",
20 - url: mcp.url,
21 - headers: mcp.headers, // Authentication headers for the Composio MCP server
22 - },
23 -});
24 -const tools = await client.tools();
25 -
26 -console.log("Summarizing your emails from today");
27 -
28 -const stream = await streamText({
29 - system: "You are a helpful personal assistant. Use Composio tools to take action.",
30 - model: anthropic("claude-sonnet-4-5"),
31 - prompt: "Summarize my emails from today",
32 - stopWhen: stepCountIs(10),
33 - onStepFinish: (step) => {
34 - for (const toolCall of step.toolCalls) {
35 - console.log(`[Using tool: ${toolCall.toolName}]`);
36 - }
37 - },
38 - tools,
39 -});
40 -
41 -for await (const textPart of stream.textStream) {
42 - process.stdout.write(textPart);
43 -}
44 -
45 -console.log("\n\n---");
46 -console.log("Tip: If prompted to authenticate, complete the auth flow and run again.");
fern/snippets/tool-router/typescript/quickstart-native-openai.ts deleted
-52
@@ -1,52 +0,0 @@
1 -import "dotenv/config";
2 -import { Composio } from "@composio/core";
3 -import { Agent, run, MemorySession } from "@openai/agents";
4 -import { OpenAIAgentsProvider } from "@composio/openai-agents";
5 -import { createInterface } from "readline/promises";
6 -
7 -// Initialize Composio with OpenAI Agents provider (API key from env var COMPOSIO_API_KEY)
8 -const composio = new Composio({ provider: new OpenAIAgentsProvider() });
9 -
10 -// Unique identifier of the user
11 -const userId = "user_123";
12 -// Create a tool router session for the user
13 -const session = await composio.create(userId);
14 -const tools = await session.tools();
15 -
16 -const agent = new Agent({
17 - name: "Personal Assistant",
18 - instructions: "You are a helpful personal assistant. Use Composio tools to take action.",
19 - model: "gpt-5.2",
20 - tools,
21 -});
22 -
23 -// Set up interactive terminal input/output for the conversation
24 -const readline = createInterface({ input: process.stdin, output: process.stdout });
25 -// Create a memory session for persistent multi-turn conversation
26 -const memory = new MemorySession();
27 -
28 -console.log(`
29 -What task would you like me to help you with?
30 -I can use tools like Gmail, GitHub, Linear, Notion, and more.
31 -(Type 'exit' to exit)
32 -Example tasks:
33 - • 'Summarize my emails from today'
34 - • 'List all open issues on the composio github repository and create a Google Sheet with the issues'
35 -`);
36 -
37 -// Multi-turn conversation with agentic tool calling
38 -while (true) {
39 - const query = await readline.question("You: ");
40 - const input = query.trim();
41 -
42 - if (input.toLowerCase() === "exit") break;
43 - process.stdout.write("Assistant: ");
44 -
45 - try {
46 - const result = await run(agent, input, { session: memory });
47 - process.stdout.write(`${result.finalOutput}`);
48 - } catch (error) {
49 - console.error("\n[Error]:", error instanceof Error ? error.message : error);
50 - }
51 -}
52 -readline.close();
fern/snippets/tool-router/typescript/quickstart-native-vercel.ts deleted
-39
@@ -1,39 +0,0 @@
1 -import "dotenv/config";
2 -import { anthropic } from "@ai-sdk/anthropic";
3 -import { Composio } from "@composio/core";
4 -import { VercelProvider } from "@composio/vercel";
5 -import { stepCountIs, streamText } from "ai";
6 -
7 -// Initialize Composio with Vercel provider (API key from env var COMPOSIO_API_KEY)
8 -const composio = new Composio({ provider: new VercelProvider() });
9 -
10 -// Unique identifier of the user
11 -const userId = "user_123";
12 -
13 -// Create a session and get native tools for the user
14 -const session = await composio.create(userId);
15 -const tools = await session.tools();
16 -
17 -process.stdout.write("Summarizing your emails from today");
18 -process.stdout.write("\n");
19 -
20 -const stream = await streamText({
21 - system: "You are a helpful personal assistant. Use Composio tools to take action.",
22 - model: anthropic("claude-sonnet-4-5"),
23 - prompt: "Summarize my emails from today",
24 - stopWhen: stepCountIs(10),
25 - onStepFinish: (step) => {
26 - for (const toolCall of step.toolCalls) {
27 - process.stdout.write(`[Using tool: ${toolCall.toolName}]`);
28 - process.stdout.write("\n");
29 - }
30 - },
31 - tools,
32 -});
33 -
34 -for await (const textPart of stream.textStream) {
35 - process.stdout.write(textPart);
36 -}
37 -
38 -process.stdout.write("\n");
39 -process.stdout.write("Tip: If prompted to authenticate, complete the auth flow and run again.");
fern/snippets/tool-router/typescript/quickstart.ts deleted
-41
@@ -1,41 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -import { OpenAIAgentsProvider } from '@composio/openai-agents';
3 -import { Agent, hostedMcpTool, run } from '@openai/agents';
4 -
5 -async function main() {
6 - // Initialize Composio with OpenAI Agents Provider
7 - const composio = new Composio({
8 - apiKey: process.env.COMPOSIO_API_KEY,
9 - provider: new OpenAIAgentsProvider()
10 - });
11 -
12 - // Create a Tool Router session for your user
13 - const session = await composio.experimental.toolRouter.createSession(
14 - 'user@example.com',
15 - {
16 - toolkits: ['gmail', 'github'] // Optional: Limit available toolkits
17 - }
18 - );
19 -
20 - // Create an agent with Tool Router MCP endpoint
21 - const agent = new Agent({
22 - name: 'Assistant',
23 - instructions: 'You are a helpful assistant that can access Gmail and GitHub. Help users fetch emails, create issues, manage pull requests, and more.',
24 - tools: [
25 - hostedMcpTool({
26 - serverLabel: 'tool_router',
27 - serverUrl: session.url,
28 - }),
29 - ],
30 - });
31 -
32 - // Execute the agent
33 - const result = await run(
34 - agent,
35 - 'Fetch the contributors to composiohq/composio github repository and email the list to user@example.com'
36 - );
37 -
38 - console.log(result.finalOutput);
39 -}
40 -
41 -main();
\ No newline at end of file
fern/snippets/triggers/python/trigger-subscription.py deleted
-17
@@ -1,17 +0,0 @@
1 -from composio import Composio
2 -
3 -# Initialize Composio client
4 -composio = Composio(api_key="your_api_key_here")
5 -
6 -# Subscribe to trigger events
7 -subscription = composio.triggers.subscribe()
8 -
9 -# Define event handler
10 -@subscription.handle(trigger_id="your_trigger_id")
11 -def handle_github_commit(data):
12 - print(f"New commit detected: {data}")
13 - # Add your custom logic here
14 -
15 -# listen for events on the trigger
16 -subscription.wait_forever()
17 -# Note: For production use, set up webhooks instead
fern/snippets/triggers/python/trigger-webhook.py deleted
-48
@@ -1,48 +0,0 @@
1 -from fastapi import FastAPI, Request, HTTPException
2 -from typing import Dict, Any
3 -import uvicorn
4 -import json
5 -import hmac
6 -import hashlib
7 -import base64
8 -import os
9 -
10 -def verify_webhook_signature(request: Request, body: bytes) -> bool:
11 - """Verify Composio webhook signature"""
12 - webhook_signature = request.headers.get("webhook-signature")
13 - webhook_id = request.headers.get("webhook-id")
14 - webhook_timestamp = request.headers.get("webhook-timestamp")
15 - webhook_secret = os.getenv("COMPOSIO_WEBHOOK_SECRET")
16 -
17 - if not all([webhook_signature, webhook_id, webhook_timestamp, webhook_secret]):
18 - raise HTTPException(status_code=400, detail="Missing required webhook headers or secret")
19 -
20 - if not webhook_signature.startswith("v1,"):
21 - raise HTTPException(status_code=401, detail="Invalid signature format")
22 -
23 - received = webhook_signature[3:]
24 - signing_string = f"{webhook_id}.{webhook_timestamp}.{body.decode()}"
25 - expected = base64.b64encode(
26 - hmac.new(webhook_secret.encode(), signing_string.encode(), hashlib.sha256).digest()
27 - ).decode()
28 -
29 - if not hmac.compare_digest(received, expected):
30 - raise HTTPException(status_code=401, detail="Invalid webhook signature")
31 -
32 - return True
33 -
34 -@app.post("/webhook")
35 -async def webhook_handler(request: Request):
36 - payload = await request.json()
37 -
38 - trigger_type = payload.get("type")
39 - event_data = payload.get("data", {})
40 -
41 - if trigger_type == "github_star_added_event":
42 - repo_name = event_data.get("repository_name")
43 - starred_by = event_data.get("starred_by")
44 - print(f"Repository {repo_name} starred by {starred_by}")
45 - # Add your business logic here
46 -
47 - return {"status": "success", "message": "Webhook processed"}
48 -
fern/snippets/triggers/python/triggers.py deleted
-17
@@ -1,17 +0,0 @@
1 -from composio import Composio
2 -
3 -composio = Composio(api_key="your-api-key")
4 -user_id = "user-id-123435"
5 -
6 -# Check what configuration is required
7 -trigger_type = composio.triggers.get_type("GITHUB_COMMIT_EVENT")
8 -print(trigger_type.config)
9 -# Returns: {"properties": {...}, "required": ["owner", "repo"], ...}
10 -
11 -# Create trigger with the required config
12 -trigger = composio.triggers.create(
13 - slug="GITHUB_COMMIT_EVENT",
14 - user_id=user_id,
15 - trigger_config={"owner": "your-repo-owner", "repo": "your-repo-name"},
16 -)
17 -print(f"Trigger created: {trigger.trigger_id}")
fern/snippets/triggers/typescript/trigger-subscription.ts deleted
-20
@@ -1,20 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -
3 -// Initialize Composio client
4 -const composio = new Composio({ apiKey: "your_api_key_here" });
5 -
6 -// Subscribe to trigger events
7 -composio.triggers.subscribe(
8 - (data) => {
9 - console.log(`New commit detected:`, data);
10 - // Add your custom logic here
11 - },
12 - { triggerId: 'your_trigger_id'
13 - // userId: 'user@acme.com',
14 - // toolkits: ['github', 'slack'],
15 - // triggerSlug: ["GITHUB_STAR_ADDED_EVENT"]
16 - // authConfigId: "ac_1234567890" }
17 - }
18 -);
19 -
20 -// Note: For production use, set up webhooks instead
\ No newline at end of file
fern/snippets/triggers/typescript/trigger-types.ts deleted
-58
@@ -1,58 +0,0 @@
1 -import { Composio, TriggerEvent } from '@composio/core';
2 -
3 -// Define type-safe payload for GitHub Star Added event
4 -export type GitHubStarAddedEventPayload = {
5 - action: "created";
6 - repository_id: number;
7 - repository_name: string;
8 - repository_url: string;
9 - starred_at: string;
10 - starred_by: string;
11 -};
12 -
13 -const composio = new Composio();
14 -const userId = 'user@acme.com';
15 -
16 -// Create the trigger
17 -const createResponse = await composio.triggers.create(userId, 'GITHUB_STAR_ADDED_EVENT', {
18 - triggerConfig: {
19 - owner: 'composiohq',
20 - repo: 'composio',
21 - },
22 -});
23 -
24 -// Fetch trigger type details
25 -const triggerType = await composio.triggers.getType("GITHUB_STAR_ADDED_EVENT");
26 -console.log(triggerType.config);
27 -
28 -// Type-safe trigger event handler
29 -function handleGitHubStarEvent(event: TriggerEvent<GitHubStarAddedEventPayload>) {
30 - console.log(`⭐ ${event.data.repository_name} starred by ${event.data.starred_by}`);
31 -}
32 -
33 -// Subscribe to triggers with type-safe handling
34 -await composio.triggers.subscribe(
35 - (triggerData) => {
36 - if (triggerData.triggerSlug === 'GITHUB_STAR_ADDED_EVENT') {
37 - const starEvent: TriggerEvent<GitHubStarAddedEventPayload> = {
38 - type: triggerData.triggerSlug,
39 - timestamp: new Date().toISOString(),
40 - data: {
41 - ...triggerData.payload as GitHubStarAddedEventPayload,
42 - connection_nano_id: triggerData.metadata.connectedAccount.id,
43 - trigger_nano_id: triggerData.id,
44 - user_id: triggerData.userId,
45 - }
46 - };
47 - handleGitHubStarEvent(starEvent);
48 - }
49 - },
50 - {
51 - authConfigId: 'ac_1234567890',
52 - triggerSlug: ['GITHUB_STAR_ADDED_EVENT'],
53 - }
54 -);
55 -
56 -await composio.triggers.enable('ti_9q19nLNykmVZ');
57 -await composio.triggers.disable('ti_9q19nLNykmVZ');
58 -
fern/snippets/triggers/typescript/trigger-webhook.ts deleted
-57
@@ -1,57 +0,0 @@
1 -import type { NextApiRequest, NextApiResponse } from 'next';
2 -import { TriggerEvent } from '@composio/core';
3 -import crypto from 'crypto';
4 -
5 -type GitHubStarEventData = {
6 - repository_name: string;
7 - repository_url: string;
8 - starred_by: string;
9 - starred_at: string;
10 -};
11 -
12 -function verifyWebhookSignature(
13 - req: NextApiRequest,
14 - body: string
15 -): boolean {
16 - const signature = req.headers['webhook-signature'] as string | undefined;
17 - const msgId = req.headers['webhook-id'] as string | undefined;
18 - const timestamp = req.headers['webhook-timestamp'] as string | undefined;
19 - const secret = process.env.COMPOSIO_WEBHOOK_SECRET;
20 -
21 - if (!signature || !msgId || !timestamp || !secret) {
22 - throw new Error('Missing required webhook headers or secret');
23 - }
24 -
25 - if (!signature.startsWith('v1,')) {
26 - throw new Error('Invalid signature format');
27 - }
28 -
29 - const received = signature.slice(3);
30 - const signingString = `${msgId}.${timestamp}.${body}`;
31 - const expected = crypto
32 - .createHmac('sha256', secret)
33 - .update(signingString)
34 - .digest('base64');
35 -
36 - return crypto.timingSafeEqual(Buffer.from(received), Buffer.from(expected));
37 -}
38 -
39 -export default async function webhookHandler(req: NextApiRequest, res: NextApiResponse) {
40 - const payload = req.body;
41 -
42 - if (payload.type === 'github_star_added_event') {
43 - const event: TriggerEvent<GitHubStarEventData> = {
44 - type: payload.type,
45 - timestamp: payload.timestamp,
46 - data: payload.data
47 - };
48 -
49 - console.log(`Repository ${event.data.repository_name} starred by ${event.data.starred_by}`);
50 - // Add your business logic here
51 - }
52 -
53 - res.status(200).json({
54 - status: 'success',
55 - message: 'Webhook processed'
56 - });
57 -}
fern/snippets/triggers/typescript/triggers.ts deleted
-22
@@ -1,22 +0,0 @@
1 -import { Composio } from '@composio/core';
2 -
3 -const composio = new Composio({apiKey: "your-api-key"});
4 -const userId = 'user-id-123435';
5 -
6 -// Check what configuration is required
7 -const triggerType = await composio.triggers.getType("GITHUB_COMMIT_EVENT");
8 -console.log(triggerType.config);
9 -// Returns: {"properties": {...}, "required": ["owner", "repo"], ...}
10 -
11 -// Create trigger with the required config
12 -const trigger = await composio.triggers.create(
13 - userId,
14 - 'GITHUB_COMMIT_EVENT',
15 - {
16 - triggerConfig: {
17 - owner: 'your-repo-owner',
18 - repo: 'your-repo-name'
19 - }
20 - }
21 -);
22 -console.log(`Trigger created: ${trigger.triggerId}`);
\ No newline at end of file
fern/tailwind.config.js deleted
-14
@@ -1,14 +0,0 @@
1 -const plugin = require("tailwindcss");
2 -
3 -/** @type {import('tailwindcss').Config} */
4 -module.exports = {
5 - darkMode: "class",
6 - content: ["./**/*.{md,mdx,tsx}", "./fern/assets/input.css"],
7 - theme: {
8 - extend: {},
9 - },
10 - plugins: [],
11 - future: {
12 - hoverOnlyWhenSupported: true,
13 - },
14 -};
fern/toolkits/src/introduction.mdx deleted
-37
@@ -1,37 +0,0 @@
1 ----
2 -title: Introduction to Tools
3 ----
4 -
5 -Tools are the building blocks of Composio. They are used to interact with external APIs and services.
6 -
7 -Composio comes with support for 250+ apps with built in authentication and actions.
8 -
9 -<CardGroup>
10 -<Card title="Twitter Tool" href="/toolkits/twitter" icon="fa-brands fa-x-twitter">
11 -View the authentication and actions for the Twitter tool.
12 -</Card>
13 -
14 -<Card title="Gmail Tool" href="/toolkits/gmail" icon="fa-light fa-envelope">
15 - View the authentication and actions for the Gmail tool.
16 -</Card>
17 -
18 -<Card title="Github Tool" href="/toolkits/github" icon="fa-brands fa-github">
19 - View the authentication and actions for the Github tool.
20 -</Card>
21 -
22 -<Card title="Notion Tool" href="/toolkits/notion" icon="fa-light fa-book">
23 - View the authentication and actions for the Notion tool.
24 -</Card>
25 -
26 -<Card title="Google Sheets Tool" href="/toolkits/googlesheets" icon="fa-light fa-file-spreadsheet">
27 - View the authentication and actions for the Google Sheets tool.
28 -</Card>
29 -
30 -<Card title="Shopify Tool" href="/toolkits/shopify" icon="fa-brands fa-shopify">
31 - View the authentication and actions for the Shopify tool.
32 -</Card>
33 -
34 -<Card title="Stripe Tool" href="/toolkits/stripe" icon="fa-brands fa-stripe">
35 -View the authentication and actions for the Stripe tool.
36 -</Card>
37 -</CardGroup>
fern/toolkits/src/premium-tools.mdx deleted
-66
@@ -1,66 +0,0 @@
1 ----
2 -title: Premium Tools
3 -image: "https://og.composio.dev/api/og?title=Premium%20Tools" # image for socials
4 -keywords: 'premium tools, composio premium tools, composio premium tools documentation, pricing'
5 -hide-nav-links: false
6 ----
7 -
8 -This is a quick overview of premium tools, what they are, how they are priced, what limits they have and such.
9 -
10 -
11 -## What are premium tools?
12 -
13 -Premium tools are essential tool calls that cost us more to run, normally paying for more premium services or longer running tasks.
14 -
15 -Think something like `E2B` or `Firecrawl`, these are not really comparable to a `GMAIL_SEND_EMAIL` call.
16 -
17 -These types of tools are separated out so we can pricing both of them competitively.
18 -
19 -This is the current list of premium tools, more will be added over time and this list might change in the future.
20 -
21 -- [Composio Search](/tools/composio_search)
22 -- [Code Interpreter (E2B)](/tools/codeinterpreter)
23 -- [Firecrawl](/tools/firecrawl)
24 -- [Perplexity](/tools/perplexity)
25 -- [Exa](/tools/exa)
26 -- [SerpAPI](/tools/serpapi)
27 -
28 -
29 -## How are premium tools priced?
30 -
31 -As a rough guide, they are priced at 3x the cost of a standard tool call — the specifics depends on your plan and the tool.
32 -
33 -
34 -| Plan | Included Standard Tool Calls | Included Premium Tool Calls | Usage Based Standard Tool Calls | Usage Based Premium Tool Calls |
35 -|---------------------|-----------------------------|----------------------------|-------------------------------|------------------------------|
36 -| Totally Free | 20k | 1k | – | – |
37 -| Ridiculously Cheap | 250k | 5k | $0.299/1k | $0.897/1k |
38 -| Serious Business | 2M | 50k | $0.249/1k | $0.747/1k |
39 -| Enterprise | Flexible | Flexible | Flexible | Flexible |
40 -
41 -This is a quick call out full pricing details are on the [pricing page](https://composio.dev/pricing).
42 -
43 -
44 -## What limits do premium tools have?
45 -
46 -Premium tools are also subject to lower rate limits than standard tool calls.
47 -
48 -If you need more than the default limits, please [contact us](mailto:billing@composio.dev) and we can find a workable solution.
49 -
50 -| Spending Tier | Standard Tool Calls Rate Limit | Premium Tool Calls Rate Limit |
51 -|---------------------|-------------------------------|------------------------------|
52 -| Free | 1,000/hour | 100/hour |
53 -| Ridiculously Cheap | 100,000/hour | 10,000/hour |
54 -| Serious Business | 100,000/hour | 10,000/hour |
55 -| Enterprise | Flexible | Flexible |
56 -
57 -
58 -
59 -
60 -
61 -
62 -## Feedback on premium tools
63 -
64 -These pricing changes are not rolling out immediately, and we are very open to feedback on the pricing and the limits.
65 -
66 -There is a lot of room for improvement and iteration here, please reach out if you have suggestions [here](mailto:rahul@composio.dev).
\ No newline at end of file
fern/tsconfig.json deleted
-11
@@ -1,11 +0,0 @@
1 -{
2 - "$schema": "https://json.schemastore.org/tsconfig",
3 - "extends": "../tsconfig.base.json",
4 - "include": ["pages/**/*", "src/**/*"],
5 - "exclude": ["node_modules", "dist"],
6 - "compilerOptions": {
7 - "module": "esnext",
8 - "target": "es2022",
9 - "moduleResolution": "bundler"
10 - }
11 -}
\ No newline at end of file
fern/tsconfig.typedoc.json deleted
-26
@@ -1,26 +0,0 @@
1 -{
2 - "compilerOptions": {
3 - "target": "ES2022",
4 - "module": "esnext",
5 - "moduleResolution": "bundler",
6 - "skipLibCheck": true,
7 - "strict": false,
8 - "resolveJsonModule": true,
9 - "declaration": true,
10 - "esModuleInterop": true,
11 - "lib": ["ES2022", "DOM"],
12 - "types": ["node"],
13 - "noEmit": true,
14 - "allowJs": true
15 - },
16 - "include": [
17 - "../ts/packages/core/src/**/*.ts"
18 - ],
19 - "exclude": [
20 - "**/*.test.ts",
21 - "**/*.spec.ts",
22 - "**/test/**",
23 - "**/tests/**",
24 - "**/node_modules/**"
25 - ]
26 -}
\ No newline at end of file
fern/turbo.json deleted
-132
@@ -1,132 +0,0 @@
1 -{
2 - "$schema": "https://turbo.build/schema.json",
3 - "extends": ["//"],
4 - "tasks": {
5 - "build": {
6 - "dependsOn": ["api:pull", "add-og", "snippets:build", "tools:generate", "sdkdocs"],
7 - "outputs": ["apis/openapi.json", "apis/openapi-mcp.json", "pages/dist/**", "toolkits/**"],
8 - "cache": true
9 - },
10 -
11 - "dev:deps": {
12 - "dependsOn": ["api:pull", "add-og", "sdkdocs", "tools:generate:dev", "snippets:build"],
13 - "cache": false
14 - },
15 -
16 - "dev": {
17 - "dependsOn": ["dev:deps"],
18 - "persistent": true,
19 - "cache": false
20 - },
21 -
22 - "dev:all": {
23 - "dependsOn": ["dev:deps"],
24 - "persistent": true,
25 - "cache": false
26 - },
27 -
28 - "api:pull": {
29 - "outputs": ["apis/openapi.json", "apis/openapi-mcp.json"],
30 - "cache": true
31 - },
32 -
33 - "add-og": {
34 - "inputs": ["scripts/add_og_imgs.py", "pages/**/*.mdx"],
35 - "cache": false
36 - },
37 -
38 - "snippets:build": {
39 - "dependsOn": ["^build"],
40 - "outputs": ["pages/dist/**"],
41 - "inputs": ["scripts/build-snippets.ts", "snippets/**", "docs/**"],
42 - "cache": true
43 - },
44 -
45 - "snippets:dev": {
46 - "persistent": true,
47 - "cache": false
48 - },
49 -
50 - "tools:generate": {
51 - "outputs": ["toolkits/**"],
52 - "inputs": ["generators/tool_doc_generator/**/*.py", "generators/tool_doc_generator/templates/**/*"],
53 - "cache": true,
54 - "env": ["COMPOSIO_API_KEY"]
55 - },
56 - "tools:generate:dev": {
57 - "cache": false,
58 - "inputs": ["generators/tool_doc_generator/**/*.py", "generators/tool_doc_generator/templates/**/*"],
59 - "env": ["COMPOSIO_API_KEY", "LIMIT"]
60 - },
61 -
62 - "sdkdocs": {
63 - "dependsOn": ["^build", "sdkdocs:ts", "sdkdocs:python"],
64 - "outputs": ["pages/dist/sdk/**"],
65 - "cache": true
66 - },
67 -
68 - "sdkdocs:ts": {
69 - "dependsOn": ["^build"],
70 - "outputs": ["pages/dist/sdk/typescript/**"],
71 - "inputs": ["../ts/packages/core/**/*.ts", "../ts/packages/providers/**/*.ts", "typedoc.json"],
72 - "cache": true
73 - },
74 -
75 - "sdkdocs:python": {
76 - "dependsOn": ["^build"],
77 - "outputs": ["pages/dist/sdk/python/**"],
78 - "inputs": ["generators/python-sdk/templates/**/*.md", "generators/python-sdk/**/*.py"],
79 - "cache": true
80 - },
81 -
82 - "llms:build": {
83 - "dependsOn": ["build"],
84 - "outputs": ["llms-txt/public/llms.txt"],
85 - "inputs": ["docs.yml", "pages/**/*.mdx", "pages/**/*.md", "toolkits/**/*.mdx", "scripts/build-llms-txt.ts"],
86 - "cache": true
87 - },
88 -
89 - "llms:dev": {
90 - "persistent": true,
91 - "cache": false
92 - },
93 -
94 - "llms:deploy": {
95 - "dependsOn": ["llms:build"],
96 - "cache": false,
97 - "env": ["CLOUDFLARE_API_TOKEN", "CLOUDFLARE_ACCOUNT_ID"]
98 - },
99 -
100 - "check": {
101 - "dependsOn": ["snippets:build"],
102 - "cache": false
103 - },
104 -
105 - "links": {
106 - "dependsOn": ["snippets:build"],
107 - "cache": false
108 - },
109 -
110 - "preview": {
111 - "dependsOn": ["build"],
112 - "cache": false,
113 - "env": ["FERN_TOKEN"]
114 - },
115 -
116 - "publish": {
117 - "dependsOn": ["build", "llms:deploy"],
118 - "cache": false,
119 - "env": ["FERN_TOKEN", "POSTHOG_API_KEY", "CLOUDFLARE_API_TOKEN", "CLOUDFLARE_ACCOUNT_ID"]
120 - },
121 -
122 - "clean": {
123 - "cache": false
124 - },
125 -
126 - "compile": {
127 - "outputs": ["dist/output.css"],
128 - "inputs": ["assets/input.css", "tailwind.config.js"],
129 - "cache": true
130 - }
131 - }
132 -}
fern/typedoc.json deleted
-40
@@ -1,40 +0,0 @@
1 -{
2 - "plugin": ["typedoc-plugin-zod", "typedoc-plugin-markdown"],
3 - "out": "./pages/dist/sdk/typescript",
4 - "fileExtension": ".mdx",
5 - "flattenOutputFiles": false,
6 - "useHTMLEncodedBrackets": false,
7 - "sanitizeComments": false,
8 - "readme": "none",
9 - "entryPoints": [
10 - "../ts/packages/core/src/composio.ts",
11 - "../ts/packages/core/src/models/AuthConfigs.ts",
12 - "../ts/packages/core/src/models/ConnectedAccounts.ts",
13 - "../ts/packages/core/src/models/ConnectionRequest.ts",
14 - "../ts/packages/core/src/models/CustomTools.ts",
15 - "../ts/packages/core/src/models/Toolkits.ts",
16 - "../ts/packages/core/src/models/Tools.ts",
17 - "../ts/packages/core/src/models/Triggers.ts",
18 - "../ts/packages/core/src/models/ToolRouter.ts",
19 - "../ts/packages/core/src/provider/BaseProvider.ts",
20 - "../ts/packages/core/src/provider/ComposioProvider.ts",
21 - "../ts/packages/core/src/provider/OpenAIProvider.ts"
22 - ],
23 - "tsconfig": "./tsconfig.typedoc.json",
24 - "skipErrorChecking": true,
25 - "treatWarningsAsErrors": false,
26 - "validation": {
27 - "notExported": false,
28 - "invalidLink": false,
29 - "notDocumented": false
30 - },
31 - "exclude": [
32 - "**/errors/**",
33 - "**/types/**",
34 - "**/utils/**",
35 - "**/services/**",
36 - "**/telemetry/**",
37 - "**/*.test.ts",
38 - "**/*.spec.ts"
39 - ]
40 -}
pyproject.toml
-4
@@ -9,8 +9,6 @@ members = [
9 "python/providers/langchain",
10 "python/providers/openai",
11 "python/providers/openai_agents",
12 - "fern/snippets/migration",
13 - "fern"
12 ]
13
14 [tool.uv.sources]
@@ -24,8 +22,6 @@ composio-google-adk = { workspace = true }
22 composio-openai = { workspace = true }
23 composio-openai-agents = { workspace = true }
24
27 -# Fern packages
28 -fern = { workspace = true }
25 composio = { workspace = true }
26
27 [dependency-groups]