@devries-cameron20 / composio Mirror · read-only / commits / a1770b4c3
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.

Mirrored from https://github.com/Camo67/composio.git

Synced Nov 23, 00:30 UTC

feat: add build system to docs

balyan.sid@gmail.com committed Jun 13, 2025 at 22:22 UTC a1770b4c341684a7f2561024a05f9af6c414b050
79 files changed +1124 -4768
.github/workflows/preview_docs.yml
+10 -18
@@ -11,9 +11,6 @@ jobs:
11 container:
12 image: ghcr.io/composiohq/dev-base:latest
13 permissions: write-all
14 - defaults:
15 - run:
16 - working-directory: ./fern
14 env:
15 COMPOSIO_API_KEY: ${{ inputs.api_key || secrets.COMPOSIO_API_KEY_PROD }}
16
@@ -21,7 +18,7 @@ jobs:
18 - name: Checkout repository
19 uses: actions/checkout@v4
20
24 - - name: Install local dependencies
21 + - name: Install dependencies
22 run: pnpm install
23
24 - name: Install Python Dependencies
@@ -29,19 +26,14 @@ jobs:
26 uv sync
27 uv run composio apps generate-types
28
32 - - name: Generate Tool Documentation
33 - run: pnpm tools:generate && pnpm tools:uncomment
34 -
35 - - name: Generate SDK Reference
36 - run: pnpm sdkdocs
37 -
29 - name: Install Fern
30 run: npm install -g fern-api
31
41 - - name: Pull Latest OpenAPI Specification
42 - run: pnpm api:pull
32 + - name: Build documentation with Turbo
33 + run: turbo run build --filter=fern
34
35 - name: Build examples
36 + working-directory: ./fern
37 run: pnpm examples:build
38
39 - name: Generate preview URL
@@ -49,14 +41,14 @@ jobs:
41 env:
42 FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
43 POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }}
44 + run: turbo run preview --filter=fern -- --log-level debug
45 +
46 + - name: Extract and comment preview URL
47 + working-directory: ./fern
48 run: |
53 - OUTPUT=$(fern generate --docs --preview 2>&1) || true
54 - echo "$OUTPUT"
55 - URL=$(echo "$OUTPUT" | grep -oP 'Published docs to \K.*(?= \()')
56 - echo "Preview URL: $URL"
57 - echo "🌿 Preview your docs: $URL" > preview_url.txt
49 + echo "🌿 Check the logs above for the preview URL" > preview_url.txt
50
51 - name: Comment URL in PR
52 uses: thollander/actions-comment-pull-request@v2.4.3
53 with:
62 - filePath: fern/preview_url.txt
54 + filePath: fern/preview_url.txt
\ No newline at end of file
.gitignore
+4 -2
@@ -39,11 +39,13 @@ report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
39 # lerna
40 lerna-debug.log*
41
42 -# temp files
43 -temp
42 +# fern
43 fern/tools
44 fern/apis/openapi.yml
45 fern/apis/openapi-mcp.json
46 +fern/pages/
47 +fern/docs/sdk/
48 +
49 # Python cache files
50 __pycache__/
51 *.py[cod]
fern/docs.yml
+30 -35
@@ -78,11 +78,6 @@ colors:
78 # border:
79 # light: "#E0E0E0"
80 # dark: "#292929"
81 -experimental:
82 - mdx-components:
83 - - ./components
84 - - ./icons
85 - disable-stream-toggle: true
81 analytics:
82 posthog:
83 api-key: ${POSTHOG_API_KEY}
@@ -128,71 +123,71 @@ navigation:
123 skip-slug: true
124 contents:
125 - page: Welcome
131 - path: pages/get-started/welcome.mdx
126 + path: pages/welcome.mdx
127 slug: welcome
128 - page: Quickstart
134 - path: pages/get-started/quickstart.mdx
129 + path: pages/quickstart.mdx
130 slug: quickstart
131 - page: IDE and Agent Setup
137 - path: pages/get-started/dev-setup.mdx
132 + path: pages/dev-setup.mdx
133 slug: dev-setup
134 - page: Providers
140 - path: pages/get-started/providers.mdx
135 + path: pages/providers.mdx
136 slug: providers
137 - section: Tools
138 icon: tools
139 skip-slug: true
140 contents:
141 - page: Executing Tools
147 - path: pages/tool-calling/executing-tools.mdx
142 + path: pages/executing-tools.mdx
143 slug: executing-tools
144 - page: Authenticating Tools
150 - path: pages/tool-calling/authenticating-tools.mdx
145 + path: pages/authenticating-tools.mdx
146 slug: authenticating-tools
147 - page: Fetch and Filter Tools
153 - path: pages/tool-calling/fetching-tools.mdx
148 + path: pages/fetching-tools.mdx
149 slug: fetching-tools
150 - section: Modifiers
151 slug: modifiers
152 contents:
153 - page: Schema Modifiers
159 - path: pages/tool-calling/schema-modifiers.mdx
154 + path: pages/schema-modifiers.mdx
155 slug: schema-modifiers
156 - page: Before Tool Execution
162 - path: pages/tool-calling/before-execution-modifiers.mdx
157 + path: pages/before-execution-modifiers.mdx
158 slug: before-execution
159 - page: After Tool Execution
165 - path: pages/tool-calling/after-execution-modifiers.mdx
160 + path: pages/after-execution-modifiers.mdx
161 slug: after-execution
162 - page: Custom tools
168 - path: pages/tool-calling/custom-tools.mdx
163 + path: pages/custom-tools.mdx
164 slug: custom-tools
165 - section: Authentication
166 icon: lock
167 skip-slug: true
168 contents:
169 - page: Custom Auth Configs
175 - path: pages/authentication/custom-auth-configs.mdx
170 + path: pages/custom-auth-configs.mdx
171 slug: custom-auth-configs
172 - page: Programmatic Auth Configs
178 - path: pages/authentication/programmatic-auth-configs.mdx
173 + path: pages/programmatic-auth-configs.mdx
174 slug: programmatic-auth-configs
175 - page: Custom Auth Parameters
181 - path: pages/authentication/custom-auth-params.mdx
176 + path: pages/custom-auth-params.mdx
177 slug: custom-auth-params
178 - section: Triggers
179 icon: bolt
180 skip-slug: true
181 contents:
182 - page: Using Triggers
188 - path: pages/triggers/using-triggers.mdx
183 + path: pages/using-triggers.mdx
184 slug: using-triggers
185 - section: MCP
186 icon: server
187 skip-slug: true
188 contents:
189 - page: Introduction
195 - path: pages/mcp/introduction.mdx
190 + path: pages/introduction.mdx
191 slug: mcp-introduction
192 - tab: examples
193 layout:
@@ -201,27 +196,27 @@ navigation:
196 skip-slug: true
197 contents:
198 - page: Hello World
204 - path: pages/examples/dist/hello-world.mdx
199 + path: pages/hello-world.mdx
200 slug: examples/hello-world
201 - page: Sample Script
207 - path: pages/examples/dist/sample-script/sample-script.mdx
202 + path: pages/sample-script.mdx
203 slug: examples/sample-script
204 - page: Sample Webserver
210 - path: pages/examples/dist/sample-webserver/sample-webserver.mdx
205 + path: pages/sample-webserver.mdx
206 slug: examples/sample-webserver
207 - section: Full Stack Applications
208 icon: globe
209 skip-slug: true
210 contents:
211 - page: Full Stack Chat App
217 - path: pages/examples/dist/vercel-composio.mdx
212 + path: pages/vercel-composio.mdx
213 slug: full-stack-chat-app
214 - section: Productivity & Automation
215 icon: zap
216 skip-slug: true
217 contents:
218 - page: Gmail Filterer
224 - path: pages/examples/dist/gmail-filterer.mdx
219 + path: pages/gmail-filterer.mdx
220 slug: gmail-filterer
221 - tab: providers
222 layout:
@@ -229,23 +224,23 @@ navigation:
224 icon: code
225 contents:
226 - page: OpenAI Provider
232 - path: pages/providers/openai.mdx
227 + path: pages/openai.mdx
228 - page: Anthropic Provider
234 - path: pages/providers/anthropic.mdx
229 + path: pages/anthropic.mdx
230 - page: LangChain Provider
236 - path: pages/providers/langchain.mdx
231 + path: pages/langchain.mdx
232 - page: CrewAI Provider
238 - path: pages/providers/crewai.mdx
233 + path: pages/crewai.mdx
234 - page: Vercel AI SDK Provider
240 - path: pages/providers/vercel.mdx
235 + path: pages/vercel.mdx
236 - page: Google ADK Provider
242 - path: pages/providers/google-adk.mdx
237 + path: pages/google-adk.mdx
238 - page: OpenAI Agents Provider
244 - path: pages/providers/openai-agents.mdx
239 + path: pages/openai-agents.mdx
240 - page: Mastra Provider
246 - path: pages/providers/mastra.mdx
241 + path: pages/mastra.mdx
242 - page: Custom Provider
248 - path: pages/providers/custom.mdx
243 + path: pages/custom.mdx
244 - tab: tools
245 layout:
246 - section: Tools
fern/docs/authentication/custom-auth-configs.mdx renamed
+26 -24
@@ -20,7 +20,7 @@ You'll need to customize the auth config in cases where you want to add in a dif
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" />
23 +<img src="../assets/images/custom-auth-posthog.png" />
24 </Frame>
25 </Tab>
26 <Tab title="Example: Hubspot">
@@ -29,7 +29,7 @@ For Hubspot you may customize everything here. For each auth scheme there is a d
29 If you choose to use your own developer app for 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" />
32 +<img src="../assets/images/custom-auth-hubspot.png" />
33 </Frame>
34 </Tab>
35 </Tabs>
@@ -56,12 +56,12 @@ Examples for Google and GitHub:
56 <Tabs>
57 <Tab title="Google">
58 <Frame background="subtle" caption="Google OAuth Configuration">
59 - <img src="../../assets/images/google-oauth-config.png" />
59 + <img src="../assets/images/google-oauth-config.png" />
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" />
64 + <img src="../assets/images/github-oauth-config.png" />
65 </Frame>
66 </Tab>
67 </Tabs>
@@ -84,7 +84,7 @@ Once you have the OAuth credentials, you can add them to the auth config in the
84 4. Click **"Create Integration"** once done!
85
86 <Frame background="subtle" title="Auth Config Settings">
87 - <img src="../../assets/images/integration-step-3-0.png" />
87 + <img src="../assets/images/integration-step-3-0.png" />
88 </Frame>
89
90 As usual, copy and use the auth config ID starting with `ac_` in your application code via a secret manager.
@@ -106,7 +106,7 @@ connReq.id
106
107 console.log(connection);
108
109 -```
109 +````
110 ```python Python maxLines=60
111 # Create a new connected account
112 connection_request = composio.connected_accounts.initiate(
@@ -118,7 +118,8 @@ print(connection_request)
118 # Wait for the connection to be established
119 connected_account = connection_request.wait_for_connection()
120 print(connected_account)
121 -```
121 +````
122 +
123 </CodeGroup>
124
125 ### White-labeling the OAuth Consent Screen
@@ -126,7 +127,7 @@ print(connected_account)
127 By default the users will see an OAuth screen like the one below:
128
129 <Frame background="subtle" caption="Composio's Domain in OAuth Consent Screen">
129 - <img src="../../assets/images/oauth-branding.png" />
130 + <img src="../assets/images/oauth-branding.png" />
131 </Frame>
132
133 The OAuth redirect URL is surfaced in the some OAuth providers' consent screens. This may cause confusion for some users as that URL is not of the same domain as the application.
@@ -136,7 +137,7 @@ To remediate this:
137 <Steps>
138 <Step title="Set the Authorized Redirect URI">
139 Specify the Authorized Redirect URI to your own domain in the OAuth configuration.
139 -For example:
140 +For example:
141 ```
142 https://yourdomain.com/api/composio-redirect
143 ```
@@ -154,20 +155,21 @@ import type { NextApiRequest, NextApiResponse } from 'next';
155 export default function handler(req: NextApiRequest, res: NextApiResponse) {
156 // The target Composio endpoint that handles OAuth callbacks
157 const composioEndpoint = 'https://backend.composio.dev/api/v3/toolkits/callback';
157 -
158 - // Extract and preserve all query parameters
159 - const queryParams = new URLSearchParams();
160 - Object.entries(req.query).forEach(([key, value]) => {
161 - if (typeof value === 'string') {
162 - queryParams.append(key, value);
163 - }
164 - });
165 -
166 - // Redirect to Composio with all query parameters intact
167 - const redirectUrl = `${composioEndpoint}?${queryParams.toString()}`;
168 - res.redirect(302, redirectUrl);
158 +
159 +// Extract and preserve all query parameters
160 +const queryParams = new URLSearchParams();
161 +Object.entries(req.query).forEach(([key, value]) => {
162 +if (typeof value === 'string') {
163 +queryParams.append(key, value);
164 }
170 -```
165 +});
166 +
167 +// Redirect to Composio with all query parameters intact
168 +const redirectUrl = `${composioEndpoint}?${queryParams.toString()}`;
169 +res.redirect(302, redirectUrl);
170 +}
171 +
172 +````
173
174 ```python FastAPI (app.py)
175 from fastapi import FastAPI
@@ -196,7 +198,7 @@ def authorize_app(toolkit: str):
198 auth_config_id=auth_config_id,
199 )
200 return RedirectResponse(url=connection_request.redirect_url)
199 -```
201 +````
202
203 </CodeGroup>
204 </Step>
@@ -204,7 +206,7 @@ def authorize_app(toolkit: str):
206 Specify the your custom redirect URI in the auth config settings!
207
208 <Frame background="subtle" title="Auth Config Settings">
207 -<img src="../../assets/images/custom-redirect-uri.png" />
209 +<img src="../assets/images/custom-redirect-uri.png" />
210 </Frame>
211 </Step>
212 </Steps>
fern/docs/authentication/custom-auth-params.mdx renamed
fern/docs/authentication/programmatic-auth-configs.mdx renamed
fern/docs/changelog/2025-06-01.md renamed
fern/docs/examples/gmail-filterer.mdx renamed
fern/docs/examples/hello-world.mdx renamed
fern/docs/examples/sample-script.mdx renamed
+2 -2
@@ -17,8 +17,8 @@ pip install composio
17
18 Here's a complete Python example that demonstrates the Composio SDK:
19
20 -<ExampleCode
21 - src="fern/pages/examples/src/sample-script/sample-script.py"
20 +<SnippetCode
21 + src="fern/snippets/sample-script/sample-script.py"
22 startLine={1}
23 title="Setting up Composio and OpenAI"
24 highlightStart={17}
fern/docs/examples/sample-webserver.mdx renamed
+9 -9
@@ -34,8 +34,8 @@ In this tutorial, we will create an auth config, initiate a connection, and send
34
35 Basic scaffolding for the server.
36
37 -<ExampleCode
38 - src="fern/pages/examples/src/sample-webserver/index.ts"
37 +<SnippetCode
38 + src="fern/snippets/typescript/sample-webserver/index.ts"
39 startLine={1}
40 endLine={10}
41 title="Setup"
@@ -52,8 +52,8 @@ For this example, we will create a basic GMAIL auth config.
52
53 You are recommend to store these config ids, so that you can reuse them later.
54
55 -<ExampleCode
56 - src="fern/pages/examples/src/sample-webserver/index.ts"
55 +<SnippetCode
56 + src="fern/snippets/typescript/sample-webserver/index.ts"
57 startLine={12}
58 endLine={16}
59 title="Auth Configs"
@@ -68,8 +68,8 @@ Here we start the connection process, once your user uses the `redirectUrl` from
68 they will be redirected to the auth flow.
69 Once they have authorized the connection, you can use the `id` to get and execute the tools as the user.
70
71 -<ExampleCode
72 - src="fern/pages/examples/src/sample-webserver/index.ts"
71 +<SnippetCode
72 + src="fern/snippets/typescript/sample-webserver/index.ts"
73 startLine={16}
74 endLine={27}
75 title="Initiating a connection"
@@ -89,8 +89,8 @@ curl -X POST http://localhost:3000/create-connection \
89
90 Now let's send that email.
91
92 -<ExampleCode
93 - src="fern/pages/examples/src/sample-webserver/index.ts"
92 +<SnippetCode
93 + src="fern/snippets/typescript/sample-webserver/index.ts"
94 startLine={29}
95 endLine={59}
96 title="Sending an email"
@@ -109,7 +109,7 @@ curl -X POST http://localhost:3000/send-email \
109
110 ### Full Code
111
112 -You can see the full code [here](https://github.com/ComposioHQ/composio/blob/next/fern/pages/examples/src/sample-webserver/index.ts).
112 +You can see the full code [here](https://github.com/ComposioHQ/composio/blob/next/fern/snippets/typescript/sample-webserver/index.ts).
113
114
115 ### What just happened?
fern/docs/examples/vercel-composio.mdx renamed
+43 -46
@@ -1,12 +1,13 @@
1 ---
2 title: Fully featured AI chatbot with Composio
3 slug: /examples/vercel
4 -image: "https://og.composio.dev/api/og?title=Fully%20featured%20AI%20chatbot%20with%20Composio" # image for socials
5 -keywords: ""
4 +image: 'https://og.composio.dev/api/og?title=Fully%20featured%20AI%20chatbot%20with%20Composio' # 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,11 +15,12 @@ This page gives a high-level overview of the Composio SDK and how it is used in
15
16 You can find the demo live [here](https://chat.composio.dev/).
17
17 -
18 ## Prerequisites
19 +
20 Ensure you've followed the README.md in the [composiohq/chat](https://github.com/composiohq/chat) repository to set the project locally.
21
22 ## Creating auth configs
23 +
24 For all the apps you want to connect to the chatbot, you need to create their respective auth configs.
25
26 Learn how to create auth configs [here](/docs/authenticating-tools#creating-an-auth-config).
@@ -26,7 +28,7 @@ Learn how to create auth configs [here](/docs/authenticating-tools#creating-an-a
28 Once done, your auth configs will be available in the [Composio dashboard](https://app.composio.dev/integrations).
29
30 <Frame>
29 - <img src="../../../assets/images/examples/auth-configs.png" alt="Auth configs" />
31 + <img src="../assets/images/examples/auth-configs.png" alt="Auth configs" />
32 </Frame>
33
34 ### Save auth config IDs to environment variables
@@ -39,6 +41,7 @@ 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, server components, etc.
46
47 ```typescript lib/service/composio.ts
@@ -54,12 +57,13 @@ export default composio;
57 ```
58
59 ## Creating an API for fetching toolkits
60 +
61 The Composio SDK is meant to be used only in server-side code. For client-side functionality, we create API endpoints in the `/app/api/` directory.
62
63 In order to list the toolkits and their connection status, we create a Next.js API route to fetch the toolkits using Composio SDK.
64
65 <Frame>
62 - <img src="../../../assets/images/examples/toolkits.png" />
66 + <img src="../assets/images/examples/toolkits.png" />
67 </Frame>
68
69 ### 1. Listing connected accounts
@@ -72,16 +76,13 @@ export async function GET() {
76
77 // List connected accounts to get connection IDs for each toolkit
78 const connectedAccounts = await composio.connectedAccounts.list({
75 - userIds: [session.user.id],
76 -});
79 + userIds: [session.user.id],
80 + });
81
78 -const connectedToolkitMap = new Map();
79 -connectedAccounts.items.forEach((account) => {
80 - connectedToolkitMap.set(
81 - account.toolkit.slug.toUpperCase(),
82 - account.id,
83 - );
84 -});
82 + const connectedToolkitMap = new Map();
83 + connectedAccounts.items.forEach(account => {
84 + connectedToolkitMap.set(account.toolkit.slug.toUpperCase(), account.id);
85 + });
86
87 // ... continue with toolkit fetching ...
88 }
@@ -98,28 +99,29 @@ export async function GET() {
99
100 const SUPPORTED_TOOLKITS = ['GMAIL', 'GOOGLECALENDAR', 'GITHUB', 'NOTION'];
101
101 -// Fetch toolkit data from slugs
102 -const toolkitPromises = SUPPORTED_TOOLKITS.map(async (slug) => {
103 - const toolkit = await composio.toolkits.get(slug);
104 - const connectionId = connectedToolkitMap.get(slug.toUpperCase());
105 -
106 - return {
107 - name: toolkit.name,
108 - slug: toolkit.slug,
109 - description: toolkit.meta?.description,
110 - logo: toolkit.meta?.logo,
111 - categories: toolkit.meta?.categories,
112 - isConnected: !!connectionId,
113 - connectionId: connectionId || undefined,
114 - };
115 -});
102 + // Fetch toolkit data from slugs
103 + const toolkitPromises = SUPPORTED_TOOLKITS.map(async slug => {
104 + const toolkit = await composio.toolkits.get(slug);
105 + const connectionId = connectedToolkitMap.get(slug.toUpperCase());
106 +
107 + return {
108 + name: toolkit.name,
109 + slug: toolkit.slug,
110 + description: toolkit.meta?.description,
111 + logo: toolkit.meta?.logo,
112 + categories: toolkit.meta?.categories,
113 + isConnected: !!connectionId,
114 + connectionId: connectionId || undefined,
115 + };
116 + });
117
117 -const toolkits = await Promise.all(toolkitPromises);
118 -return NextResponse.json({ toolkits });
118 + const toolkits = await Promise.all(toolkitPromises);
119 + return NextResponse.json({ toolkits });
120 }
121 ```
122
123 ## Managing connections
124 +
125 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.
126
127 ### 1. Initiating a connection
@@ -127,10 +129,9 @@ Users need to connect and disconnect their accounts from the chatbot to enable t
129 When a user wants to connect their account, we create a connection request that redirects them to the OAuth provider:
130
131 <Frame>
130 - <img src="../../../assets/images/examples/create-connection.png" />
132 + <img src="../assets/images/examples/create-connection.png" />
133 </Frame>
134
133 -
135 ```typescript app/api/connections/initiate/route.ts
136 export async function POST(request: Request) {
137 // ... auth and validation ...
@@ -140,7 +141,7 @@ export async function POST(request: Request) {
141 // Initiate connection with Composio
142 const connectionRequest = await composio.connectedAccounts.initiate(
143 session.user.id,
143 - authConfigId,
144 + authConfigId
145 );
146
147 return NextResponse.json({
@@ -155,7 +156,7 @@ export async function POST(request: Request) {
156 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:
157
158 <Frame>
158 - <img src="../../../assets/images/examples/connection-status.png" />
159 + <img src="../assets/images/examples/connection-status.png" />
160 </Frame>
161
162 ```typescript app/api/connections/status/route.ts
@@ -165,9 +166,7 @@ export async function GET(request: Request) {
166 const connectionId = searchParams.get('connectionId');
167
168 // Wait for connection to complete
168 - const connection = await composio.connectedAccounts.waitForConnection(
169 - connectionId,
170 - );
169 + const connection = await composio.connectedAccounts.waitForConnection(connectionId);
170
171 return NextResponse.json({
172 id: connection.id,
@@ -199,6 +198,7 @@ export async function DELETE(request: Request) {
198 ```
199
200 ## Working with tools
201 +
202 Once users have connected their accounts, we need to track which toolkits are enabled and fetch the corresponding tools for the LLM.
203
204 ### 1. Tracking enabled toolkits
@@ -214,7 +214,7 @@ const { ... } = useChat({
214 const enabledToolkits = Array.from(
215 currentToolbarState.enabledToolkitsWithStatus.entries(),
216 ).map(([slug, isConnected]) => ({ slug, isConnected }));
217 -
217 +
218 return {
219 // ... other fields ...
220 enabledToolkits,
@@ -243,12 +243,9 @@ export async function getComposioTools(userId: string, toolkitSlugs: string[]) {
243 export async function POST(request: Request) {
244 // ... auth and parsing ...
245
246 - const toolkitSlugs = enabledToolkits?.map((t) => t.slug) || [];
246 + const toolkitSlugs = enabledToolkits?.map(t => t.slug) || [];
247
248 - const composioTools = await getComposioTools(
249 - session.user.id,
250 - toolkitSlugs,
251 - );
248 + const composioTools = await getComposioTools(session.user.id, toolkitSlugs);
249
250 const result = streamText({
251 // ... model config ...
@@ -264,7 +261,7 @@ export async function POST(request: Request) {
261 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.
262
263 <Frame>
267 - <img src="../../../assets/images/examples/custom-tool-component.png" />
264 + <img src="../assets/images/examples/custom-tool-component.png" />
265 </Frame>
266
267 You can find the `ToolCall` component at `components/tool-call.tsx`. Here's how to integrate it into your message rendering:
@@ -297,4 +294,4 @@ if (type === 'tool-invocation') {
294 );
295 }
296 }
300 -```
\ No newline at end of file
297 +```
fern/docs/get-started/dev-setup.mdx renamed
+11 -20
@@ -1,30 +1,21 @@
1 ---
2 title: IDE and Agent Setup
3 -subtitle: "Setup your AI IDE and agent to help you ship faster with Composio"
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: ""
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 guide explains how to setup your IDE, and coding agents to help you ship faster with Composio.
11
12 -{/* ## Generate types for tools
13 -<CodeGroup>
14 -```typescript TypeScript maxLines=60 wordWrap
15 -
16 -```
17 -
18 -```python Python maxLines=60 wordWrap
19 -
20 -```
21 -</CodeGroup> */}
12
13 ## Optimise Cursor
14 +
15 To optimize your experience building with Composio, you can add instructions to Cursor's system settings.
16
17 <Frame>
27 -<img src="../../assets/images/cursor-settings.png" alt="Cursor settings" />
18 + <img src="../assets/images/cursor-settings.png" alt="Cursor settings" />
19 </Frame>
20
21 Add the following to your Cursor "Rules for AI":
@@ -37,6 +28,7 @@ It lets you build agents that that can work across a user's apps like Gmail, Not
28
29 Below is a list of Composio documentation. Use your web and fetch capabilities to read the documentation you need.
30 [Composio Documentation](https://v3.docs.composio.dev)
31 +
32 - [Quickstart](https://v3.docs.composio.dev/docs/quickstart.mdx): Add authenticated tool-calling to any LLM agent in three steps.
33 - [Configuration](https://v3.docs.composio.dev/docs/configuration.mdx)
34 - [Providers](https://v3.docs.composio.dev/docs/toolsets.mdx)
@@ -47,7 +39,7 @@ Below is a list of Composio documentation. Use your web and fetch capabilities t
39 - [Before Execution Modifiers](https://v3.docs.composio.dev/docs/modifiers/before-execution.mdx): Learn how to use before execution modifiers to modify tool arguments before execution.
40 - [After Execution Modifiers](https://v3.docs.composio.dev/docs/modifiers/after-execution.mdx): Learn how to use after execution modifiers to transform tool results after execution.
41 - [Creating custom tools](https://v3.docs.composio.dev/docs/custom-tools.mdx): Learn how to extend Composio's toolkits with your own tools
50 -- [Custom Auth Configs](https://v3.docs.composio.dev/docs/custom-auth-configs.mdx): Guide to using customising auth configs for a toolkit
42 +- [Custom Auth Configs](https://v3.docs.composio.dev/docs/custom-auth-configs.mdx): Guide to using customising auth configs for a toolkit
43 - [Programmatic Auth Configs](https://v3.docs.composio.dev/docs/programmatic-auth-configs.mdx): Guide to creating auth configs programmatically
44 - [Custom Auth Parameters](https://v3.docs.composio.dev/docs/custom-auth-params.mdx): Guide to injecting custom credentials in headers or parameters for a toolkit
45 - [Using Triggers](https://v3.docs.composio.dev/docs/using-triggers.mdx): Send payloads to your system based on external events
@@ -61,7 +53,7 @@ Below is a list of Composio documentation. Use your web and fetch capabilities t
53 - [Mastra Provider](https://v3.docs.composio.dev/providers/mastra.mdx)
54 - [Custom Providers](https://v3.docs.composio.dev/toolsets/custom.mdx)
55
64 -```
56 +````
57
58 ```md Python
59 You are the best Python developer known for your high taste and usage of new and cutting-edge practices.
@@ -80,7 +72,7 @@ Below is a list of Composio documentation. Use your web and fetch capabilities t
72 - [Before Execution Modifiers](https://v3.docs.composio.dev/docs/modifiers/before-execution.mdx): Learn how to use before execution modifiers to modify tool arguments before execution.
73 - [After Execution Modifiers](https://v3.docs.composio.dev/docs/modifiers/after-execution.mdx): Learn how to use after execution modifiers to transform tool results after execution.
74 - [Creating custom tools](https://v3.docs.composio.dev/docs/custom-tools.mdx): Learn how to extend Composio's toolkits with your own tools
83 -- [Custom Auth Configs](https://v3.docs.composio.dev/docs/custom-auth-configs.mdx): Guide to using customising auth configs for a toolkit
75 +- [Custom Auth Configs](https://v3.docs.composio.dev/docs/custom-auth-configs.mdx): Guide to using customising auth configs for a toolkit
76 - [Programmatic Auth Configs](https://v3.docs.composio.dev/docs/programmatic-auth-configs.mdx): Guide to creating auth configs programmatically
77 - [Custom Auth Parameters](https://v3.docs.composio.dev/docs/custom-auth-params.mdx): Guide to injecting custom credentials in headers or parameters for a toolkit
78 - [Using Triggers](https://v3.docs.composio.dev/docs/using-triggers.mdx): Send payloads to your system based on external events
@@ -93,7 +85,6 @@ Below is a list of Composio documentation. Use your web and fetch capabilities t
85 - [OpenAI Agents Provider](https://v3.docs.composio.dev/providers/openai-agents.mdx)
86 - [Mastra Provider](https://v3.docs.composio.dev/providers/mastra.mdx)
87 - [Custom Providers](https://v3.docs.composio.dev/toolsets/custom.mdx)
96 -```
97 -</CodeGroup>
98 -
88 +````
89
90 +</CodeGroup>
fern/docs/get-started/providers.mdx renamed
+33 -20
@@ -1,24 +1,30 @@
1 ---
2 title: Providers
3 -image: "https://og.composio.dev/api/og?title=Providers" # image for socials
4 -keywords: ""
3 +image: 'https://og.composio.dev/api/og?title=Providers' # image for socials
4 +keywords: ''
5 hide-nav-links: false
6 ---
7
8 Every LLM framework and provider essentially does the same thing - **tool calling and giving agents skills** - but each has its own unique syntax and implementation. Whether you're using OpenAI, Anthropic, CrewAI, or LangGraph, you're solving the same problems with different APIs.
9
10 <Frame>
11 - <img src="../../assets/images/providers-and-toolsets.png" alt="Providers and Toolsets" width="400px" height="auto"/>
11 + <img
12 + src="../assets/images/providers-and-toolsets.png"
13 + alt="Providers and Toolsets"
14 + width="400px"
15 + height="auto"
16 + />
17 </Frame>
18
19 Composio standardizes this mess. Use the same tools across any framework with our unified interface, or create custom toolsets for frameworks we don't support yet. No more rewriting tool integrations when you switch providers.
20
21 Composio has two types of providers:
22 +
23 - **Completion Providers**: These frameworks are simply used to generate text, function calls. They don't have an automatic function execution step.
24 - **Agentic Providers**: These providers are used to create agents. They have a function execution step and the tools are executed automatically.
25
20 -
26 ## Providers
27 +
28 Here's how you can generate text with various providers using Composio SDK:
29
30 <Tabs>
@@ -31,16 +37,17 @@ import { OpenAIProvider } from "@composio/openai";
37 import { OpenAI } from "openai";
38
39 const composio = new Composio({
34 - provider: new OpenAIProvider(),
40 +provider: new OpenAIProvider(),
41 });
42
37 -```
43 +````
44 ```python Python
45 from composio import Composio
46 from composio_openai import OpenAIProvider
47
48 composio = Composio(provider=OpenAIProvider())
43 -```
49 +````
50 +
51 </CodeGroup>
52 </Tab>
53 <Tab title="Anthropic">
@@ -52,17 +59,19 @@ import { AnthropicProvider } from "@composio/anthropic";
59 import { Anthropic } from "@anthropic-ai/sdk";
60
61 const composio = new Composio({
55 - provider: new AnthropicProvider(),
62 +provider: new AnthropicProvider(),
63 });
64
65 const anthropic = new Anthropic();
59 -```
66 +
67 +````
68 ```python Python
69 from composio import Composio
70 from composio_anthropic import AnthropicProvider
71
72 composio = Composio(provider=AnthropicProvider())
65 -```
73 +````
74 +
75 </CodeGroup>
76 </Tab>
77 <Tab title="Vercel AI SDK">
@@ -75,10 +84,11 @@ import { VercelProvider } from "@composio/vercel";
84 const userId = "00000000-0000-0000-0000-000000000000"; // The user's ID.
85
86 const composio = new Composio({
78 - apiKey: process.env.COMPOSIO_API_KEY,
79 - provider: new VercelProvider(),
87 +apiKey: process.env.COMPOSIO_API_KEY,
88 +provider: new VercelProvider(),
89 });
81 -```
90 +
91 +````
92 </Tab>
93 <Tab title="Mastra">
94 ```typescript TypeScript
@@ -91,7 +101,8 @@ const composio = new Composio({
101 provider: new MastraProvider(),
102 });
103
94 -```
104 +````
105 +
106 </Tab>
107 <Tab title="OpenAI Agents">
108 ```python Python
@@ -99,6 +110,7 @@ from composio import Composio
110 from composio_openai_agents import OpenAIAgentsProvider
111
112 composio = Composio(provider=OpenAIAgentsProvider())
113 +
114 ```
115 </Tab>
116 </Tabs>
@@ -109,21 +121,21 @@ composio = Composio(provider=OpenAIAgentsProvider())
121 <CardGroup cols={3}>
122 <Card
123 title="OpenAI Provider"
112 - icon={<img src="../../assets/images/openai-logo.svg" width="24" height="24" />}
124 + icon={<img src="../assets/images/openai-logo.svg" width="24" height="24" />}
125 href="/providers/openai"
126 >
127 Integrate with OpenAI's tool calling and agents.
128 </Card>
129 <Card
130 title="Anthropic Provider"
119 - icon={<img src="../../assets/images/anthropic-logo.svg" width="24" height="24" />}
131 + icon={<img src="../assets/images/anthropic-logo.svg" width="24" height="24" />}
132 href="/providers/anthropic"
133 >
134 Use Anthropic's Claude models with Composio tools.
135 </Card>
136 <Card
137 title="Gemini Provider"
126 - icon={<img src="../../assets/images/google-logo.svg" width="24" height="24" />}
138 + icon={<img src="../assets/images/google-logo.svg" width="24" height="24" />}
139 href="/providers/google-adk"
140 >
141 Integrate with Google's Gemini models.
@@ -134,7 +146,7 @@ composio = Composio(provider=OpenAIAgentsProvider())
146 <CardGroup cols={3}>
147 <Card
148 title="LangGraph Provider"
137 - icon={<img src="../../assets/images/langgraph-logo.svg"/>}
149 + icon={<img src="../assets/images/langgraph-logo.svg"/>}
150 href="/providers/langgraph"
151 >
152 Add tools to LangGraph agent flows.
@@ -148,7 +160,7 @@ composio = Composio(provider=OpenAIAgentsProvider())
160 </Card>
161 <Card
162 title="Vercel AI SDK Provider"
151 - icon={<img src="../../assets/images/vercel-logo.svg" width="24" height="24" />}
163 + icon={<img src="../assets/images/vercel-logo.svg" width="24" height="24" />}
164 href="/providers/vercel"
165 >
166 Use Composio tools with Vercel's AI SDK.
@@ -171,4 +183,5 @@ composio = Composio(provider=OpenAIAgentsProvider())
183
184 <Tip title="Custom Toolsets" icon="puzzle">
185 Using a framework not supported? Create a [custom toolset](/toolsets/custom)!
174 -</Tip>
\ No newline at end of file
186 +</Tip>
187 +```
fern/docs/get-started/quickstart.mdx renamed
fern/docs/get-started/welcome.mdx renamed
+7 -5
@@ -1,20 +1,22 @@
1 ---
2 title: Welcome to Composio
3 -image: "https://og.composio.dev/api/og?title=Welcome%20to%20Composio" # image for socials
4 -keywords: ""
5 -subtitle: "Our API and SDKs enable developers to build AI applications and experiences that are a step above the rest."
3 +image: 'https://og.composio.dev/api/og?title=Welcome%20to%20Composio' # image for socials
4 +keywords: ''
5 +subtitle: 'Our API and SDKs enable developers to build AI applications and experiences that are a step above the rest.'
6 hide-nav-links: false
7 ---
8
9 <Frame>
10 - <img src="../../assets/images/intro.png" alt="Composio introduction image"/>
10 + <img src="../assets/images/intro.png" alt="Composio introduction image" />
11 </Frame>
12
13 <Tip>
14 -Give your AI IDE access to Composio's documentation using our llms.txt files: ([short .txt](/llms.txt), [long .txt](/llms-full.txt))
14 + Give your AI IDE access to Composio's documentation using our llms.txt files: ([short
15 + .txt](/llms.txt), [long .txt](/llms-full.txt))
16 </Tip>
17
18 Composio is an integration and tooling platform built for AI agents and LLM applications that lets you:
19 +
20 - Add tool-use capabilities to your AI agent from [300+ apps](/tools/).
21 - Give agents [authenticated access to tools](/docs/custom-auth-configs).
22 - [Listen and trigger](/docs/using-triggers) agents and workflows from external events (e.g., new Slack message, GitHub issue).
fern/docs/index.mdx new
+171
@@ -0,0 +1,171 @@
1 +---
2 +no-image-zoom: true
3 +---
4 +
5 +export const LandingPageCard = ({ href, title, imgSrc, description }) => (
6 + <div className="rounded-lg bg-[#F5F4F2] dark:bg-[#0F0F0F] px-6 py-5 hover:bg-[#E9E6DE] dark:hover:bg-[#292929] md:p-8">
7 + <a
8 + href={href}
9 + target="_self"
10 + className="flex h-full flex-col justify-between"
11 + style={{ textDecoration: 'none' }}
12 + >
13 + <div className="mb-5 flex flex-col justify-between gap-5">
14 + <h2 className="lg:min-h-20 [@media(min-width:1181px)]:min-h-0">
15 + {title}
16 + </h2>
17 + <img src={imgSrc} alt={title} />
18 + <p className="p-lg">{description}</p>
19 + </div>
20 + <div className="mt-2 text-sm text-[#2D4CB9] dark:text-[#4C6EE6] md:mt-0 md:self-end">
21 + {"GET STARTED"}
22 + <div className="ml-2 inline-block group-hover:no-underline">
23 + <svg
24 + width="12"
25 + height="11"
26 + viewBox="0 0 12 11"
27 + fill="none"
28 + xmlns="http://www.w3.org/2000/svg"
29 + style={{ transform: "rotate(-90deg)" }}
30 + >
31 + <path
32 + d="M6 10.75L0.75 5.31686L1.74907 4.27907L5.2556 8.00291L5.2556 0.25L6.7444 0.25L6.7444 8.00291L10.2509 4.27907L11.25 5.31686L6 10.75Z"
33 + fill="currentColor"
34 + ></path>
35 + </svg>
36 + </div>
37 + </div>
38 + </a>
39 + </div>
40 +);
41 +
42 +export const EndpointLink = ({ href, title }) => (
43 + <a
44 + href={href}
45 + className="group flex cursor-pointer flex-row text-sm !font-normal text-[#2D4CB9] dark:text-[#4C6EE6]"
46 + rel="noreferrer"
47 + target="_self"
48 + >
49 + {title}
50 + <span className="duration-400 flex items-center transition-all ease-in-out group-hover:pl-1 group-hover:pr-2">
51 + <div className="ml-2 inline-block text-sm !text-[#2D4CB9] group-hover:no-underline">
52 + <svg
53 + width="12"
54 + height="11"
55 + viewBox="0 0 12 11"
56 + fill="none"
57 + xmlns="http://www.w3.org/2000/svg"
58 + style={{ transform: "rotate(-90deg)" }}
59 + >
60 + <path
61 + d="M6 10.75L0.75 5.31686L1.74907 4.27907L5.2556 8.00291L5.2556 0.25L6.7444 0.25L6.7444 8.00291L10.2509 4.27907L11.25 5.31686L6 10.75Z"
62 + fill="currentColor"
63 + ></path>
64 + </svg>
65 + </div>
66 + </span>
67 + </a>
68 +);
69 +
70 +export const cards = [
71 + {
72 + href: "/docs",
73 + imgSrc: "https://fern-image-hosting.s3.amazonaws.com/cohere/8da77c9-Frame_138972.png",
74 + title: "Guides",
75 + description:
76 + "Understand how to use the Composio SDK and platform on a deeper level. Build with authenticated tools, triggers and more.",
77 + },
78 + {
79 + href: "/api-reference/",
80 + imgSrc: "https://fern-image-hosting.s3.amazonaws.com/cohere/8ff146a-Group_138977.png",
81 + title: "Reference",
82 + description:
83 + "Use Composio's tools and MCP servers into your agents with just a few lines of code.",
84 + },
85 + {
86 + href: "/cookbooks",
87 + imgSrc: "https://fern-image-hosting.s3.amazonaws.com/cohere/7fca92c-Group_138977_2.png",
88 + title: "Cookbooks",
89 + description:
90 + "A collection of resources to help developers get up and running with Composio.",
91 + },
92 +];
93 +
94 +export const frameworks = [
95 + {
96 + href: "/frameworks/langchain",
97 + title: "LangChain",
98 + },
99 + {
100 + href: "/frameworks/langgraph",
101 + title: "LangGraph",
102 + },
103 + {
104 + href: "/frameworks/crewai",
105 + title: "CrewAI",
106 + },
107 + {
108 + href: "/frameworks/vercel",
109 + title: "Vercel",
110 + },
111 + {
112 + href: "/frameworks/autogen",
113 + title: "Autogen",
114 + },
115 +];
116 +
117 +<div className="m-auto max-w-[1195px] flex-grow overflow-y-auto px-8 pt-10 md:p-10 md:pb-14">
118 + <div className="flex flex-col gap-5 md:!grid md:grid-cols-2 md:gap-10 md:pb-7 lg:!grid-cols-3 lg:gap-x-8 lg:gap-y-10 lg:pb-16">
119 + {cards.map((card) => (
120 + <LandingPageCard
121 + key={card.href}
122 + href={card.href}
123 + imgSrc={card.imgSrc}
124 + title={card.title}
125 + description={card.description}
126 + />
127 + ))}
128 + <a href="/frameworks" className="col-span-2" style={{ textDecoration: 'none' }}>
129 + <div className="mb-8 flex flex-col gap-9 rounded-lg bg-[#F5F4F2] dark:bg-[#0F0F0F] px-6 py-5 hover:bg-[#E9E6DE] dark:hover:bg-[#292929] md:!flex-row md:items-end md:gap-16 md:p-8 lg:gap-10">
130 + <div className="md:w-1/2">
131 + <h2 className="mb-8 mt-4 md:mt-0">Frameworks</h2>
132 + <p className="p-lg w-full">
133 + Build with frameworks that support Composio's tools and MCP servers.
134 + </p>
135 + </div>
136 + <div className="grid grid-cols-2 gap-5 md:w-1/2 md:gap-10 lg:w-1/3 lg:gap-8">
137 + {frameworks.map((framework) => (
138 + <EndpointLink key={framework.href} {...framework} />
139 + ))}
140 + </div>
141 + </div>
142 + </a>
143 + </div>
144 + <div
145 + className="block h-full w-full rounded-lg bg-cover bg-no-repeat p-6 md:hidden"
146 + style={{
147 + backgroundImage: "url('https://fern-image-hosting.s3.amazonaws.com/cohere/ddd53ed-Mask_group.png')",
148 + }}
149 + >
150 + <a
151 + href="https://cohere.com/llmu"
152 + target="_blank"
153 + className="flex h-full w-full flex-col justify-between !text-white md:!flex-row"
154 + >
155 + <div className="flex h-full flex-col justify-between">
156 + <div className="flex flex-row">
157 + <img
158 + src="https://fern-image-hosting.s3.amazonaws.com/cohere/9d0694c-Symbol.svg"
159 + alt=""
160 + className="h-7 w-7 lg:h-10 lg:w-10"
161 + />
162 + <h2 className="h3 mb-28 ml-5 mt-0">LLM University</h2>
163 + </div>
164 + <p className="p-lg !text-white">
165 + New to NLP? Learn about Natural Language processing and Large Language
166 + Models through our structured curriculum.
167 + </p>
168 + </div>
169 + </a>
170 + </div>
171 +</div>
fern/docs/mcp/introduction.mdx renamed
fern/docs/providers/anthropic.mdx renamed
fern/docs/providers/crewai.mdx renamed
fern/docs/providers/custom.mdx renamed
fern/docs/providers/google-adk.mdx renamed
fern/docs/providers/langchain.mdx renamed
fern/docs/providers/mastra.mdx renamed
fern/docs/providers/openai-agents.mdx renamed
fern/docs/providers/openai.mdx renamed
fern/docs/providers/vercel.mdx renamed
fern/docs/tool-calling/after-execution-modifiers.mdx new
+129
@@ -0,0 +1,129 @@
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: 'Learn how to use after execution modifiers to 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 +- Convert 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 `afterToolExecute` 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 +```typescript TypeScript maxLines=60 wordWrap
37 +const response = await openai.chat.completions.create({
38 + model: "gpt-4o-mini",
39 + messages,
40 + tools: tools,
41 + tool_choice: "auto",
42 +});
43 +
44 +console.log(response.choices[0].message.tool_calls);
45 +
46 +if (response.choices[0].message.tool*calls) {
47 +const result = await composio.tools.execute(
48 +"HACKERNEWS_GET_USER",
49 +{
50 +userId: userId,
51 +arguments: JSON.parse(
52 +response.choices[0].message.tool_calls[0].function.arguments
53 +),
54 +},
55 +{
56 +afterToolExecute: (toolSlug, *, result) => {
57 +if (toolSlug === "HACKERNEWS_GET_USER") {
58 +const { data } = result;
59 +const responseData = data.response_data as { karma: number };
60 +return {
61 +...result,
62 +data: {
63 +karma: responseData.karma
64 +},
65 +};
66 +}
67 +return result;
68 +},
69 +}
70 +);
71 +console.log(JSON.stringify(result, null, 2));
72 +}
73 +
74 +````
75 +```python Python maxLines=60 wordWrap
76 +
77 +````
78 +
79 +</CodeGroup>
80 +</Tab>
81 +
82 +<Tab title="With Agentic Frameworks">
83 +Agentic providers have a function execution step.
84 +The modifier is configured on the `tools.get` method which modifies the execution logic within the framework!
85 +<CodeGroup>
86 +```typescript TypeScript maxLines=60 wordWrap {24-27}
87 +import { Composio } from "@composio/core";
88 +import { VercelProvider } from "@composio/vercel";
89 +import { generateText } from "ai";
90 +import { openai } from "@ai-sdk/openai";
91 +import { v4 as uuidv4 } from "uuid";
92 +
93 +const composio = new Composio({
94 +apiKey: process.env.COMPOSIO_API_KEY,
95 +provider: new VercelProvider(),
96 +});
97 +
98 +const userId = uuidv4(); // The user's ID.
99 +
100 +const agenticTools = await composio.tools.get(
101 +userId,
102 +{
103 +tools: ["HACKERNEWS_GET_USER"],
104 +},
105 +{
106 +afterExecute: (toolSlug, toolkitSlug, result) => {
107 +if (toolSlug === "HACKERNEWS_GET_USER") {
108 +const { data } = result;
109 +const responseData = data.response_data as { karma: number };
110 +return {
111 +...result,
112 +data: {
113 +karma: responseData.karma
114 +},
115 +};
116 +}
117 +return result;
118 +},
119 +}
120 +);
121 +
122 +````
123 +```python Python maxLines=60 wordWrap
124 +
125 +````
126 +
127 +</CodeGroup>
128 +</Tab>
129 +</Tabs>
fern/docs/tool-calling/authenticating-tools.mdx renamed
+11 -10
@@ -6,7 +6,6 @@ subtitle: 'Learn how to authenticate tools'
6 hide-nav-links: false
7 ---
8
9 -
9 Different apps (like Slack, Notion, Shopify) have their own authentication flows that users must complete to grant access to their accounts. Agents need authenticated access to these tools to perform actions on behalf of users.
10
11 ## Creating an auth config
@@ -30,13 +29,13 @@ Once created, it's reusable across multiple users.
29 <Step title="Select App">
30 Navigate to the [Apps page](https://app.composio.dev/apps) and choose the app you want to integrate (for example, Google Sheets).
31 <Frame background="subtle" title="Application Selection Screen">
33 - <img src="../../assets/images/integration-step-1-0.png" />
32 + <img src="../assets/images/integration-step-1-0.png" />
33 </Frame>
34 </Step>
35 <Step title="Initiate Setup">
36 Click the **"Setup Integration"** button.
37 <Frame background="subtle" title="Auth Config Setup Interface">
39 - <img src="../../assets/images/integration-step-2-0.png" />
38 + <img src="../assets/images/integration-step-2-0.png" />
39 </Frame>
40 </Step>
41 <Step title="Configure Auth Config Settings">
@@ -49,7 +48,7 @@ Once created, it's reusable across multiple users.
48 </Note>
49
50 <Frame background="subtle" title="Auth Config Settings">
52 - <img src="../../assets/images/auth-config-creation.png" />
51 + <img src="../assets/images/auth-config-creation.png" />
52 </Frame>
53 </Step>
54 <Step title="Create and Get ID">
@@ -95,7 +94,7 @@ await connRequest.waitForConnection();
94 // In case the `connRequest` object dies, the ID can be used too.
95 await composio.connectedAccounts.waitForConnection(connRequest.id);
96
98 -```
97 +````
98 ```python Python maxLines=60 wordWrap
99 from composio import Composio
100
@@ -113,7 +112,8 @@ print(connection_request.redirect_url)
112 # Wait for the connection to be established
113 connected_account = connection_request.wait_for_connection()
114 print(connected_account)
116 -```
115 +````
116 +
117 </CodeGroup>
118
119 ## Connecting to an API Key toolkit
@@ -138,7 +138,7 @@ apiKey: "sk_1234567890", // The field name for the API key/token
138 }
139 );
140
141 -```
141 +````
142 ```python Python maxLines=60 wordWrap
143 from composio.types import auth_scheme
144
@@ -154,7 +154,8 @@ connection_request = composio.connected_accounts.initiate(
154 ),
155 )
156 print(connection_request)
157 -```
157 +````
158 +
159 </CodeGroup>
160
161 ### Fetching the field name
@@ -177,7 +178,7 @@ detail => detail.fields.connectedAccountInitiation
178 );
179 console.log(fieldNames); // e.g. ["apiKey"]
180
180 -```
181 +````
182
183 ```python Python maxLines=60 wordWrap
184 required_fields = composio.connected_accounts.get_required_fields(
@@ -270,7 +271,7 @@ data: authData,
271
272 console.log("Connection request ID:", connectionRequest.id);
273
273 -```
274 +````
275 ```python Python maxLines=60 wordWrap
276 import os
277 from composio import Composio
fern/docs/tool-calling/before-execution-modifiers.mdx renamed
+65 -55
@@ -1,31 +1,37 @@
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: "Learn how to use before execution modifiers to modify tool arguments before execution."
3 +image: 'https://og.composio.dev/api/og?title=Before%20Execution%20Modifiers' # image for socials
4 +keywords: ''
5 +subtitle: 'Learn how to use before execution modifiers to 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 -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.
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>
19 - <img src="../../assets/images/before-execute.png" alt="Before Execution Modifier" />
21 + <img src="../assets/images/before-execute.png" alt="Before Execution Modifier" />
22 </Frame>
23
22 -<Note>Below we use the `beforeToolExecute` modifier to modify the number of posts returned by the `HACKERNEWS_GET_LATEST_POSTS` tool.</Note>
24 +<Note>
25 + Below we use the `beforeToolExecute` 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 ```typescript TypeScript maxLines=60 wordWrap {11, 20-28}
37 const response = await openai.chat.completions.create({
@@ -37,31 +43,33 @@ const response = await openai.chat.completions.create({
43
44 console.log(response.choices[0].message.tool_calls);
45
40 -if (response.choices[0].message.tool_calls) {
41 - const result = await composio.tools.execute(
42 - "HACKERNEWS_GET_LATEST_POSTS",
43 - {
44 - userId: userId,
45 - arguments: JSON.parse(
46 - response.choices[0].message.tool_calls[0].function.arguments
47 - ),
48 - },
49 - {
50 - beforeToolExecute: (toolSlug, _, params) => {
51 - if (toolSlug === "HACKERNEWS_GET_LATEST_POSTS") {
52 - params.arguments.size = 1;
53 - }
54 - console.log(params);
55 - return params;
56 - },
57 - }
58 - );
59 - console.log(JSON.stringify(result, null, 2));
46 +if (response.choices[0].message.tool*calls) {
47 +const result = await composio.tools.execute(
48 +"HACKERNEWS_GET_LATEST_POSTS",
49 +{
50 +userId: userId,
51 +arguments: JSON.parse(
52 +response.choices[0].message.tool_calls[0].function.arguments
53 +),
54 +},
55 +{
56 +beforeToolExecute: (toolSlug, *, params) => {
57 +if (toolSlug === "HACKERNEWS_GET_LATEST_POSTS") {
58 +params.arguments.size = 1;
59 +}
60 +console.log(params);
61 +return params;
62 +},
63 +}
64 +);
65 +console.log(JSON.stringify(result, null, 2));
66 }
61 -```
67 +
68 +````
69 ```python Python maxLines=60 wordWrap
70
64 -```
71 +````
72 +
73 </CodeGroup>
74 </Tab>
75
@@ -76,43 +84,45 @@ import { MastraProvider } from "@composio/mastra";
84 import { Agent } from "@mastra/core/agent";
85
86 const composio = new Composio({
79 - apiKey: process.env.COMPOSIO_API_KEY,
80 - provider: new MastraProvider(),
87 +apiKey: process.env.COMPOSIO_API_KEY,
88 +provider: new MastraProvider(),
89 });
90
91 const userId = "user@acme.com"; // The user's ID.
92
93 const agenticTools = await composio.tools.get(
86 - userId,
87 - {
88 - tools: [
89 - "HACKERNEWS_GET_LATEST_POSTS",
90 - "HACKERNEWS_GET_USER",
91 - "LINEAR_CREATE_LINEAR_ISSUE",
92 - ],
93 - },
94 - {
95 - beforeToolExecute: (toolSlug, _, params) => {
96 - if (toolSlug === "LINEAR_CREATE_LINEAR_ISSUE") {
97 - params.arguments.project_id = "1234567890";
98 - }
99 - return params;
100 - },
101 - }
94 +userId,
95 +{
96 +tools: [
97 +"HACKERNEWS_GET_LATEST_POSTS",
98 +"HACKERNEWS_GET_USER",
99 +"LINEAR_CREATE_LINEAR_ISSUE",
100 +],
101 +},
102 +{
103 +beforeToolExecute: (toolSlug, \_, params) => {
104 +if (toolSlug === "LINEAR_CREATE_LINEAR_ISSUE") {
105 +params.arguments.project_id = "1234567890";
106 +}
107 +return params;
108 +},
109 +}
110 );
111
112 const { text } = await generateText({
105 - model: openai("gpt-4o-mini"),
106 - messages: [
107 - { role: "user", content: "Create an issue to `sid` to add RLS" },
108 - ],
109 - tools: agenticTools,
110 - maxSteps: 5,
113 +model: openai("gpt-4o-mini"),
114 +messages: [
115 +{ role: "user", content: "Create an issue to `sid` to add RLS" },
116 +],
117 +tools: agenticTools,
118 +maxSteps: 5,
119 });
112 -```
120 +
121 +````
122 ```python Python maxLines=60 wordWrap
123
115 -```
124 +````
125 +
126 </CodeGroup>
127 </Tab>
118 -</Tabs>
\ No newline at end of file
128 +</Tabs>
fern/docs/tool-calling/custom-tools.mdx renamed
fern/docs/tool-calling/executing-tools.mdx renamed
fern/docs/tool-calling/fetching-tools.mdx renamed
fern/docs/tool-calling/schema-modifiers.mdx new
+120
@@ -0,0 +1,120 @@
1 +---
2 +title: Schema Modifiers
3 +image: 'https://og.composio.dev/api/og?title=Schema%20Modifiers' # image for socials
4 +keywords: ''
5 +subtitle: 'Learn how to use schema modifiers to transform tool schemas before they are seen by 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:** - Adding arguments to the tool. For example, adding a `thought` argument to the tool
19 +to prompt the agent to explain the reasoning. - Hiding arguments from the tool. In cases where the
20 +argument is irrelevant to the tool. - Adding extra arguments to the tool schema for custom use cases
21 +or execution. - Adding default values to tool arguments.
22 +
23 +<Note>
24 + Below we modify the schema of the `HACKERNEWS_GET_LATEST_POSTS` to make the `size` argument
25 + required and remove the `page` argument.
26 +</Note>
27 +
28 +<CodeGroup>
29 +```typescript TypeScript maxLines=60 wordWrap
30 +const userId = "your@email.com";
31 +
32 +const tools = await composio.tools.get(
33 +userId,
34 +{
35 +tools: ["HACKERNEWS_GET_LATEST_POSTS", "HACKERNEWS_GET_USER"],
36 +},
37 +{
38 +modifyToolSchema: (toolSlug, \_, toolSchema) => {
39 +if (toolSlug === "HACKERNEWS_GET_LATEST_POSTS") {
40 +const { inputParameters } = toolSchema;
41 +if (inputParameters?.properties) {
42 +delete inputParameters.properties["page"];
43 +}
44 +inputParameters.required = ["size"];
45 +}
46 +return toolSchema;
47 +},
48 +}
49 +);
50 +
51 +console.log(JSON.stringify(tools, null, 2));
52 +
53 +````
54 +```python Python maxLines=60 wordWrap
55 +
56 +````
57 +
58 +</CodeGroup>
59 +
60 +In using the above modified tool schema, the `page` argument is removed and the `size` argument is required.
61 +
62 +You can test this out by viewing the tool call response in the LLM too!
63 +
64 +<Accordion title="Schema modified tool call">
65 +<CodeGroup>
66 +
67 +```typescript TypeScript maxLines=60 wordWrap
68 +import { Composio } from '@composio/core';
69 +import { OpenAI } from 'openai';
70 +
71 +const composio = new Composio({
72 + apiKey: process.env.COMPOSIO_API_KEY,
73 +});
74 +const openai = new OpenAI();
75 +
76 +const userId = 'your@email.com';
77 +
78 +const tools = await composio.tools.get(
79 + userId,
80 + {
81 + tools: ['HACKERNEWS_GET_LATEST_POSTS', 'HACKERNEWS_GET_USER'],
82 + },
83 + {
84 + modifyToolSchema: (toolSlug, _, toolSchema) => {
85 + if (toolSlug === 'HACKERNEWS_GET_LATEST_POSTS') {
86 + const { inputParameters } = toolSchema;
87 + if (inputParameters?.properties) {
88 + delete inputParameters.properties['page'];
89 + }
90 + inputParameters.required = ['size'];
91 + }
92 + return toolSchema;
93 + },
94 + }
95 +);
96 +
97 +console.log(JSON.stringify(tools, null, 2));
98 +
99 +const response = await openai.chat.completions.create({
100 + model: 'gpt-4o-mini',
101 + messages: [
102 + {
103 + role: 'system',
104 + content: 'You are a helpful assistant that can help with tasks.',
105 + },
106 + { role: 'user', content: 'Get the latest posts from Hacker News' },
107 + ],
108 + tools: tools,
109 + tool_choice: 'auto',
110 +});
111 +
112 +console.log(response.choices[0].message.tool_calls);
113 +```
114 +
115 +```python Python maxLines=60 wordWrap
116 +
117 +```
118 +
119 +</CodeGroup>
120 +</Accordion>
fern/docs/triggers/using-triggers.mdx renamed
+51 -48
@@ -1,8 +1,8 @@
1 ---
2 title: Using Triggers
3 subtitle: Send payloads to your system based on external events
4 -image: "https://og.composio.dev/api/og?title=Using%20Triggers" # image for socials
5 -keywords: ""
4 +image: 'https://og.composio.dev/api/og?title=Using%20Triggers' # image for socials
5 +keywords: ''
6 hide-nav-links: true
7 ---
8
@@ -10,33 +10,33 @@ Triggers act as a notification system for your AI applications, enabling your ag
10
11 When these events take place, triggers capture relevant information and deliver structured payloads directly to your system, facilitating timely and context-aware responses.
12
13 -
13 <Frame caption="Triggers through Composio" background="subtle">
15 -![Triggers Overview](../../assets/images/triggers.png)
14 + ![Triggers Overview](../assets/images/triggers.png)
15 </Frame>
16
18 -
17 <Tip title="Prerequisites">
20 -Before proceeding, ensure you've created an auth config and established a connection to your external account (e.g., Slack, GitHub).
18 + Before proceeding, ensure you've created an auth config and established a connection to your
19 + external account (e.g., Slack, GitHub).
20 </Tip>
21
22 ## Creating a trigger
23 +
24 Head to the any app that supports triggers, eg [Slack](https://app.composio.dev/app/slack) in the dashboard and enable the trigger of choice.
25 -<video
26 - src="../../assets/videos/enabling-triggers.mp4"
27 - width="854"
28 - height="480"
29 - autoplay
30 - loop
31 - playsinline
32 - controls
33 ->
34 -</video>
25 +
26 +<video
27 + src="../assets/videos/enabling-triggers.mp4"
28 + width="854"
29 + height="480"
30 + autoplay
31 + loop
32 + playsinline
33 + controls
34 +></video>
35
36 The [triggers page](https://app.composio.dev/active_triggers?page=1) will show you all the triggers that are enabled for your account.
37
38 <Frame caption="Triggers page" background="subtle">
39 -<img src="../../assets/images/manage-triggers.png" alt="Manage triggers" />
39 + <img src="../assets/images/manage-triggers.png" alt="Manage triggers" />
40 </Frame>
41
42 You create triggers through the SDK as well.
@@ -75,13 +75,14 @@ const connections = await composio.connectedAccounts.list({userIds: [userId]});
75 console.log(connections.items[0].id);
76
77 const createResponse = await composio.triggers.create("GITHUB_STAR_ADDED_EVENT", {
78 - connectedAccountId: connections.items[0].id,
79 - triggerConfig: {
80 - owner: "composiohq",
81 - repo: "composio",
82 - },
78 +connectedAccountId: connections.items[0].id,
79 +triggerConfig: {
80 +owner: "composiohq",
81 +repo: "composio",
82 +},
83 });
84 -```
84 +
85 +````
86 ```python Python
87 # Fetch connected account for user
88 user_id = "user@acme.com"
@@ -102,10 +103,12 @@ instance = composio.triggers.create(
103 },
104 )
105 print(instance)
105 -```
106 +````
107 +
108 </CodeGroup>
109
110 ## Subscribing to triggers
111 +
112 You can subscribe to triggers to receive payloads from the trigger.
113
114 You subscribe to multiple trigger events by configuring the filters.
@@ -141,8 +144,9 @@ subscription = composio.triggers.subscribe()
144
145 )
146 def handle_github_event(data):
144 - print(data)
145 -```
147 +print(data)
148 +
149 +````
150 </CodeGroup>
151
152 ### Trigger payload types
@@ -153,21 +157,29 @@ When subscribing to triggers, it is helpful to know the payload type recieved fr
157 const triggerType = await composio.triggers.getType("SLACK_RECEIVE_MESSAGE");
158
159 console.log(triggerType.payload);
156 -```
160 +````
161 +
162 ```python Python
163 # Get a trigger by id
164 trigger = composio.triggers.get_type(slug="GITHUB_COMMIT_EVENT")
165 print(trigger.payload)
166 ```
167 +
168 </CodeGroup>
169
170 ## Specifying trigger configuration
171 +
172 In some cases, triggers require certain configuration to set the correct events. You can inspect and add these properties while enabling the triggers.
173
174 The dashboard will show you the trigger configuration to fill in.
175
176 <Frame caption="Trigger configuration" background="subtle">
170 -<img src="../../assets/images/trigger-config.png" alt="Trigger configuration" width="400px" height="auto"/>
177 + <img
178 + src="../assets/images/trigger-config.png"
179 + alt="Trigger configuration"
180 + width="400px"
181 + height="auto"
182 + />
183 </Frame>
184
185 <CodeGroup>
@@ -175,14 +187,15 @@ The dashboard will show you the trigger configuration to fill in.
187 const triggerType = await composio.triggers.getType("GITHUB_STAR_ADDED_EVENT");
188
189 console.log(triggerType.config);
178 -```
190 +
191 +````
192 ```python Python
193 # Get a trigger by id
194 trigger = composio.triggers.get_type(slug="GITHUB_COMMIT_EVENT")
195 print(trigger.config)
183 -```
184 -</CodeGroup>
196 +````
197
198 +</CodeGroup>
199
200 <CodeGroup>
201 ```typescript TypeScript
@@ -206,30 +219,20 @@ instance = composio.triggers.create(
219 ```
220 </CodeGroup>
221
209 -
222 ## Enabling/Disabling triggers
223 +
224 In cases where the trigger isn't required for the system, it can be disabled.
225
226 <CodeGroup>
214 -```typescript TypeScript
215 -await composio.triggers.disable("ti_abcd123");
216 -```
217 -```python Python
218 -# Disable a trigger instance
219 -disabled_instance = composio.triggers.disable(trigger_id="ti_abcd123")
220 -print(disabled_instance)
221 -```
227 + ```typescript TypeScript await composio.triggers.disable("ti_abcd123"); ``` ```python Python #
228 + Disable a trigger instance disabled_instance = composio.triggers.disable(trigger_id="ti_abcd123")
229 + print(disabled_instance) ```
230 </CodeGroup>
231
232 If needed, the trigger can be enabled again.
233
234 <CodeGroup>
227 -```typescript TypeScript
228 -await composio.triggers.enable("ti_abcd123);
229 -```
230 -```python Python
231 -# Enable a trigger instance
232 -enabled_instance = composio.triggers.enable(trigger_id="ti_abcd123")
233 -print(enabled_instance)
234 -```
235 + ```typescript TypeScript await composio.triggers.enable("ti_abcd123); ``` ```python Python #
236 + Enable a trigger instance enabled_instance = composio.triggers.enable(trigger_id="ti_abcd123")
237 + print(enabled_instance) ```
238 </CodeGroup>
fern/icons/arrow-right.tsx deleted
-34
@@ -1,34 +0,0 @@
1 -import { ReactElement } from "react";
2 -
3 -export default function ArrowRightIcon({
4 - size = 10,
5 -}: {
6 - size?: number;
7 -}): ReactElement {
8 - return (
9 - <svg
10 - width={size}
11 - height={size}
12 - viewBox="0 0 10 10"
13 - fill="none"
14 - xmlns="http://www.w3.org/2000/svg"
15 - >
16 - <path
17 - 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"
18 - fill="#39594d"
19 - ></path>
20 - <path
21 - 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"
22 - fill="#39594d"
23 - ></path>
24 - <path
25 - 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"
26 - fill="#39594d"
27 - ></path>
28 - <path
29 - 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"
30 - fill="#39594d"
31 - ></path>
32 - </svg>
33 - );
34 -}
fern/package.json
+10 -8
@@ -6,20 +6,22 @@
6 "packageManager": "pnpm@10.8.0",
7 "scripts": {
8 "preinstall": "npx only-allow pnpm",
9 - "clean": "rm -rf ./dist && rm -rf ./node_modules && rm -rf ./pages/examples/dist",
9 + "clean": "rm -rf ./dist && rm -rf ./node_modules && rm -rf ./docs/snippets/dist",
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:comment": "uv run python scripts/manage-tool-docs.py comment",
13 "tools:uncomment": "uv run python scripts/manage-tool-docs.py uncomment",
14 "sdkdocs": "pnpm exec typedoc",
15 "api:pull": "bash scripts/pull-openapi-spec.sh",
16 - "examples:build": "bun run scripts/examples-dev.ts",
17 - "examples:dev": "bun run scripts/examples-dev.ts --watch",
18 - "check": "pnpm tools:comment && pnpm examples:build && fern check",
19 - "dev": "pnpm tools:comment && pnpm examples:build && fern docs dev",
20 - "links": "pnpm tools:uncomment && pnpm examples:build && fern docs broken-links",
21 - "preview": "pnpm tools:uncomment && pnpm examples:build && fern generate --docs --preview --log-level debug",
22 - "publish": "echo 'use only in emergencies, recommend making a PR' && pnpm tools:uncomment && pnpm examples:build && fern generate --docs",
16 + "snippets:build": "bun run scripts/build-snippets.ts",
17 + "snippets:dev": "bun run scripts/build-snippets.ts --watch",
18 + "add-og": "uv run scripts/add_og_imgs.py",
19 + "check": "fern check",
20 + "dev": "fern docs dev",
21 + "links": "fern docs broken-links",
22 + "build": "echo 'Build orchestrated by Turbo'",
23 + "preview": "fern generate --docs --preview --log-level debug",
24 + "publish": "echo 'use only in emergencies, recommend making a PR' && fern generate --docs",
25 "generate": "pnpm tools:generate && pnpm sdkdocs",
26 "prepublish": "exit 1"
27 },
fern/pages/sdk/python/index.mdx
fern/pages/sdk/typescript/AuthConfigs/README.mdx deleted
-23
@@ -1,23 +0,0 @@
1 -[**@composio/core**](../README.mdx)
2 -
3 -***
4 -
5 -[@composio/core](../README.mdx) / AuthConfigs
6 -
7 -# AuthConfigs
8 -
9 -## Fileoverview
10 -
11 -Auth configs class for Composio SDK, used to manage authentication configurations.
12 -
13 -## Author
14 -
15 -Musthaq Ahamad <musthaq@composio.dev>
16 -
17 -## Date
18 -
19 -2025-05-05
20 -
21 -## Classes
22 -
23 -- [AuthConfigs](classes/AuthConfigs.mdx)
fern/pages/sdk/typescript/AuthConfigs/classes/AuthConfigs.mdx deleted
-409
@@ -1,409 +0,0 @@
1 -[**@composio/core**](../../README.mdx)
2 -
3 -***
4 -
5 -[@composio/core](../../README.mdx) / [AuthConfigs](../README.mdx) / AuthConfigs
6 -
7 -# Class: AuthConfigs
8 -
9 -Defined in: [packages/core/src/models/AuthConfigs.ts:37](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/AuthConfigs.ts#L37)
10 -
11 -AuthConfigs class
12 -
13 -This class is used to manage authentication configurations in the Composio SDK.
14 -Auth configs are used to configure authentication providers and settings.
15 -
16 -## Constructors
17 -
18 -### Constructor
19 -
20 -> **new AuthConfigs**(`client`): `AuthConfigs`
21 -
22 -Defined in: [packages/core/src/models/AuthConfigs.ts:40](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/AuthConfigs.ts#L40)
23 -
24 -#### Parameters
25 -
26 -##### client
27 -
28 -`Composio`
29 -
30 -#### Returns
31 -
32 -`AuthConfigs`
33 -
34 -## Methods
35 -
36 -### create()
37 -
38 -> **create**(`toolkit`, `options`): `Promise`\<\{ \}\>
39 -
40 -Defined in: [packages/core/src/models/AuthConfigs.ts:160](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/AuthConfigs.ts#L160)
41 -
42 -Create a new auth config
43 -
44 -#### Parameters
45 -
46 -##### toolkit
47 -
48 -`string`
49 -
50 -Unique identifier of the toolkit
51 -
52 -##### options
53 -
54 -Options for creating a new auth config
55 -
56 -\{ \} | \{ \}
57 -
58 -#### Returns
59 -
60 -`Promise`\<\{ \}\>
61 -
62 -Created auth config
63 -
64 -#### Example
65 -
66 -```ts
67 -const authConfig = await authConfigs.create('my-toolkit', {
68 - type: AuthConfigTypes.CUSTOM,
69 - name: 'My Custom Auth Config',
70 - authScheme: AuthSchemeTypes.API_KEY,
71 - credentials: {
72 - apiKey: '1234567890',
73 - },
74 -});
75 -```
76 -
77 -#### Link
78 -
79 -https://docs.composio.dev/reference/auth-configs/create-auth-config
80 -
81 -***
82 -
83 -### delete()
84 -
85 -> **delete**(`nanoid`): `Promise`\<`unknown`\>
86 -
87 -Defined in: [packages/core/src/models/AuthConfigs.ts:298](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/AuthConfigs.ts#L298)
88 -
89 -Deletes an authentication configuration.
90 -
91 -This method permanently removes an auth config from the Composio platform.
92 -This action cannot be undone and will prevent any connected accounts that use
93 -this auth config from functioning.
94 -
95 -#### Parameters
96 -
97 -##### nanoid
98 -
99 -`string`
100 -
101 -The unique identifier of the auth config to delete
102 -
103 -#### Returns
104 -
105 -`Promise`\<`unknown`\>
106 -
107 -The deletion response
108 -
109 -#### Throws
110 -
111 -If the auth config doesn't exist or cannot be deleted
112 -
113 -#### Example
114 -
115 -```typescript
116 -// Delete an auth config
117 -await composio.authConfigs.delete('auth_abc123');
118 -```
119 -
120 -***
121 -
122 -### disable()
123 -
124 -> **disable**(`nanoid`): `Promise`\<`unknown`\>
125 -
126 -Defined in: [packages/core/src/models/AuthConfigs.ts:368](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/AuthConfigs.ts#L368)
127 -
128 -Disables an authentication configuration.
129 -
130 -This is a convenience method that calls updateStatus with 'DISABLED'.
131 -When disabled, the auth config cannot be used to create new connected accounts
132 -or authenticate with third-party services, but existing connections may continue to work.
133 -
134 -#### Parameters
135 -
136 -##### nanoid
137 -
138 -`string`
139 -
140 -The unique identifier of the auth config to disable
141 -
142 -#### Returns
143 -
144 -`Promise`\<`unknown`\>
145 -
146 -The updated auth config details
147 -
148 -#### Throws
149 -
150 -If the auth config cannot be found or disabled
151 -
152 -#### Example
153 -
154 -```typescript
155 -// Disable an auth config
156 -await composio.authConfigs.disable('auth_abc123');
157 -```
158 -
159 -***
160 -
161 -### enable()
162 -
163 -> **enable**(`nanoid`): `Promise`\<`unknown`\>
164 -
165 -Defined in: [packages/core/src/models/AuthConfigs.ts:347](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/AuthConfigs.ts#L347)
166 -
167 -Enables an authentication configuration.
168 -
169 -This is a convenience method that calls updateStatus with 'ENABLED'.
170 -When enabled, the auth config can be used to create new connected accounts
171 -and authenticate with third-party services.
172 -
173 -#### Parameters
174 -
175 -##### nanoid
176 -
177 -`string`
178 -
179 -The unique identifier of the auth config to enable
180 -
181 -#### Returns
182 -
183 -`Promise`\<`unknown`\>
184 -
185 -The updated auth config details
186 -
187 -#### Throws
188 -
189 -If the auth config cannot be found or enabled
190 -
191 -#### Example
192 -
193 -```typescript
194 -// Enable an auth config
195 -await composio.authConfigs.enable('auth_abc123');
196 -```
197 -
198 -***
199 -
200 -### get()
201 -
202 -> **get**(`nanoid`): `Promise`\<\{ \}\>
203 -
204 -Defined in: [packages/core/src/models/AuthConfigs.ts:223](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/AuthConfigs.ts#L223)
205 -
206 -Retrieves a specific authentication configuration by its ID.
207 -
208 -This method fetches detailed information about a single auth config
209 -and transforms the response to the SDK's standardized format.
210 -
211 -#### Parameters
212 -
213 -##### nanoid
214 -
215 -`string`
216 -
217 -The unique identifier of the auth config to retrieve
218 -
219 -#### Returns
220 -
221 -`Promise`\<\{ \}\>
222 -
223 -The auth config details
224 -
225 -#### Throws
226 -
227 -If the auth config cannot be found or an API error occurs
228 -
229 -#### Throws
230 -
231 -If the response fails validation
232 -
233 -#### Example
234 -
235 -```typescript
236 -// Get an auth config by ID
237 -const authConfig = await composio.authConfigs.get('auth_abc123');
238 -console.log(authConfig.name); // e.g., 'GitHub Auth'
239 -console.log(authConfig.toolkit.slug); // e.g., 'github'
240 -```
241 -
242 -***
243 -
244 -### getClient()
245 -
246 -> `protected` **getClient**(): `Composio`
247 -
248 -Defined in: [packages/core/src/models/AuthConfigs.ts:50](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/AuthConfigs.ts#L50)
249 -
250 -Protected getter for the client instance.
251 -This is primarily used for testing purposes.
252 -
253 -#### Returns
254 -
255 -`Composio`
256 -
257 -***
258 -
259 -### list()
260 -
261 -> **list**(`query?`): `Promise`\<\{ \}\>
262 -
263 -Defined in: [packages/core/src/models/AuthConfigs.ts:121](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/AuthConfigs.ts#L121)
264 -
265 -Lists authentication configurations based on provided filter criteria.
266 -
267 -This method retrieves auth configs from the Composio API, transforms them to the SDK format,
268 -and supports filtering by various parameters.
269 -
270 -#### Parameters
271 -
272 -##### query?
273 -
274 -Optional query parameters for filtering auth configs
275 -
276 -#### Returns
277 -
278 -`Promise`\<\{ \}\>
279 -
280 -A paginated list of auth configurations
281 -
282 -#### Throws
283 -
284 -If the query parameters or response fail validation
285 -
286 -#### Example
287 -
288 -```typescript
289 -// List all auth configs
290 -const allConfigs = await composio.authConfigs.list();
291 -
292 -// List auth configs for a specific toolkit
293 -const githubConfigs = await composio.authConfigs.list({
294 - toolkit: 'github'
295 -});
296 -
297 -// List Composio-managed auth configs
298 -const managedConfigs = await composio.authConfigs.list({
299 - isComposioManaged: true
300 -});
301 -```
302 -
303 -***
304 -
305 -### update()
306 -
307 -> **update**(`nanoid`, `data`): `Promise`\<`unknown`\>
308 -
309 -Defined in: [packages/core/src/models/AuthConfigs.ts:258](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/AuthConfigs.ts#L258)
310 -
311 -Updates an existing authentication configuration.
312 -
313 -This method allows you to modify properties of an auth config such as credentials,
314 -scopes, or tool restrictions. The update type (custom or default) determines which
315 -fields can be updated.
316 -
317 -#### Parameters
318 -
319 -##### nanoid
320 -
321 -`string`
322 -
323 -The unique identifier of the auth config to update
324 -
325 -##### data
326 -
327 -The data to update, which can be either custom or default type
328 -
329 -\{ \} | \{ \}
330 -
331 -#### Returns
332 -
333 -`Promise`\<`unknown`\>
334 -
335 -The updated auth config
336 -
337 -#### Throws
338 -
339 -If the update parameters are invalid
340 -
341 -#### Throws
342 -
343 -If the auth config cannot be found or updated
344 -
345 -#### Example
346 -
347 -```typescript
348 -// Update a custom auth config with new credentials
349 -const updatedConfig = await composio.authConfigs.update('auth_abc123', {
350 - type: 'custom',
351 - credentials: {
352 - apiKey: 'new-api-key-value'
353 - }
354 -});
355 -
356 -// Update a default auth config with new scopes
357 -const updatedConfig = await composio.authConfigs.update('auth_abc123', {
358 - type: 'default',
359 - scopes: ['read:user', 'repo']
360 -});
361 -```
362 -
363 -***
364 -
365 -### updateStatus()
366 -
367 -> **updateStatus**(`status`, `nanoid`): `Promise`\<`unknown`\>
368 -
369 -Defined in: [packages/core/src/models/AuthConfigs.ts:323](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/AuthConfigs.ts#L323)
370 -
371 -Updates the status of an authentication configuration.
372 -
373 -This method allows you to enable or disable an auth config. When disabled,
374 -the auth config cannot be used to create new connected accounts or authenticate
375 -with third-party services.
376 -
377 -#### Parameters
378 -
379 -##### status
380 -
381 -The status to set ('ENABLED' or 'DISABLED')
382 -
383 -`"ENABLED"` | `"DISABLED"`
384 -
385 -##### nanoid
386 -
387 -`string`
388 -
389 -The unique identifier of the auth config
390 -
391 -#### Returns
392 -
393 -`Promise`\<`unknown`\>
394 -
395 -The updated auth config details
396 -
397 -#### Throws
398 -
399 -If the auth config cannot be found or the status cannot be updated
400 -
401 -#### Example
402 -
403 -```typescript
404 -// Disable an auth config
405 -await composio.authConfigs.updateStatus('DISABLED', 'auth_abc123');
406 -
407 -// Enable an auth config
408 -await composio.authConfigs.updateStatus('ENABLED', 'auth_abc123');
409 -```
fern/pages/sdk/typescript/ConnectedAccounts/README.mdx deleted
-23
@@ -1,23 +0,0 @@
1 -[**@composio/core**](../README.mdx)
2 -
3 -***
4 -
5 -[@composio/core](../README.mdx) / ConnectedAccounts
6 -
7 -# ConnectedAccounts
8 -
9 -## Fileoverview
10 -
11 -Connected accounts class for Composio SDK, used to manage connected accounts of a user.
12 -
13 -## Author
14 -
15 -Musthaq Ahamad <musthaq@composio.dev>
16 -
17 -## Date
18 -
19 -2025-05-05
20 -
21 -## Classes
22 -
23 -- [ConnectedAccounts](classes/ConnectedAccounts.mdx)
fern/pages/sdk/typescript/ConnectedAccounts/classes/ConnectedAccounts.mdx deleted
-411
@@ -1,411 +0,0 @@
1 -[**@composio/core**](../../README.mdx)
2 -
3 -***
4 -
5 -[@composio/core](../../README.mdx) / [ConnectedAccounts](../README.mdx) / ConnectedAccounts
6 -
7 -# Class: ConnectedAccounts
8 -
9 -Defined in: [packages/core/src/models/ConnectedAccounts.ts:34](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/ConnectedAccounts.ts#L34)
10 -
11 -ConnectedAccounts class
12 -
13 -This class is used to manage connected accounts in the Composio SDK.
14 -Connected accounts are used to authenticate with third-party services.
15 -
16 -## Constructors
17 -
18 -### Constructor
19 -
20 -> **new ConnectedAccounts**(`client`): `ConnectedAccounts`
21 -
22 -Defined in: [packages/core/src/models/ConnectedAccounts.ts:37](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/ConnectedAccounts.ts#L37)
23 -
24 -#### Parameters
25 -
26 -##### client
27 -
28 -`Composio`
29 -
30 -#### Returns
31 -
32 -`ConnectedAccounts`
33 -
34 -## Methods
35 -
36 -### delete()
37 -
38 -> **delete**(`nanoid`): `Promise`\<`ConnectedAccountDeleteResponse`\>
39 -
40 -Defined in: [packages/core/src/models/ConnectedAccounts.ts:218](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/ConnectedAccounts.ts#L218)
41 -
42 -Deletes a connected account.
43 -
44 -This method permanently removes a connected account from the Composio platform.
45 -This action cannot be undone and will revoke any access tokens associated with the account.
46 -
47 -#### Parameters
48 -
49 -##### nanoid
50 -
51 -`string`
52 -
53 -The unique identifier of the connected account to delete
54 -
55 -#### Returns
56 -
57 -`Promise`\<`ConnectedAccountDeleteResponse`\>
58 -
59 -The deletion response
60 -
61 -#### Throws
62 -
63 -If the account doesn't exist or cannot be deleted
64 -
65 -#### Example
66 -
67 -```typescript
68 -// Delete a connected account
69 -await composio.connectedAccounts.delete('conn_abc123');
70 -```
71 -
72 -***
73 -
74 -### disable()
75 -
76 -> **disable**(`nanoid`): `Promise`\<`ConnectedAccountUpdateStatusResponse`\>
77 -
78 -Defined in: [packages/core/src/models/ConnectedAccounts.ts:303](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/ConnectedAccounts.ts#L303)
79 -
80 -Disable a connected account
81 -
82 -#### Parameters
83 -
84 -##### nanoid
85 -
86 -`string`
87 -
88 -Unique identifier of the connected account
89 -
90 -#### Returns
91 -
92 -`Promise`\<`ConnectedAccountUpdateStatusResponse`\>
93 -
94 -Updated connected account details
95 -
96 -#### Example
97 -
98 -```typescript
99 -// Disable a connected account
100 -const disabledAccount = await composio.connectedAccounts.disable('conn_abc123');
101 -console.log(disabledAccount.isDisabled); // true
102 -
103 -// You can also use updateStatus with a reason
104 -// const disabledAccount = await composio.connectedAccounts.updateStatus('conn_abc123', {
105 -// enabled: false,
106 -// reason: 'No longer needed'
107 -// });
108 -```
109 -
110 -***
111 -
112 -### enable()
113 -
114 -> **enable**(`nanoid`): `Promise`\<`ConnectedAccountUpdateStatusResponse`\>
115 -
116 -Defined in: [packages/core/src/models/ConnectedAccounts.ts:281](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/ConnectedAccounts.ts#L281)
117 -
118 -Enable a connected account
119 -
120 -#### Parameters
121 -
122 -##### nanoid
123 -
124 -`string`
125 -
126 -Unique identifier of the connected account
127 -
128 -#### Returns
129 -
130 -`Promise`\<`ConnectedAccountUpdateStatusResponse`\>
131 -
132 -Updated connected account details
133 -
134 -#### Example
135 -
136 -```typescript
137 -// Enable a previously disabled connected account
138 -const enabledAccount = await composio.connectedAccounts.enable('conn_abc123');
139 -console.log(enabledAccount.isDisabled); // false
140 -```
141 -
142 -***
143 -
144 -### get()
145 -
146 -> **get**(`nanoid`): `Promise`\<\{ \}\>
147 -
148 -Defined in: [packages/core/src/models/ConnectedAccounts.ts:197](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/ConnectedAccounts.ts#L197)
149 -
150 -Retrieves a specific connected account by its ID.
151 -
152 -This method fetches detailed information about a single connected account
153 -and transforms the response to the SDK's standardized format.
154 -
155 -#### Parameters
156 -
157 -##### nanoid
158 -
159 -`string`
160 -
161 -The unique identifier of the connected account
162 -
163 -#### Returns
164 -
165 -`Promise`\<\{ \}\>
166 -
167 -The connected account details
168 -
169 -#### Throws
170 -
171 -If the connected account cannot be found or an API error occurs
172 -
173 -#### Example
174 -
175 -```typescript
176 -// Get a connected account by ID
177 -const account = await composio.connectedAccounts.get('conn_abc123');
178 -console.log(account.status); // e.g., 'ACTIVE'
179 -console.log(account.toolkit.slug); // e.g., 'github'
180 -```
181 -
182 -***
183 -
184 -### initiate()
185 -
186 -> **initiate**(`userId`, `authConfigId`, `options?`): `Promise`\<[`ConnectionRequest`](../../ConnectionRequest/classes/ConnectionRequest.mdx)\>
187 -
188 -Defined in: [packages/core/src/models/ConnectedAccounts.ts:121](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/ConnectedAccounts.ts#L121)
189 -
190 -Compound function to create a new connected account.
191 -This function creates a new connected account and returns a connection request.
192 -Users can then wait for the connection to be established using the `waitForConnection` method.
193 -
194 -#### Parameters
195 -
196 -##### userId
197 -
198 -`string`
199 -
200 -User ID of the connected account
201 -
202 -##### authConfigId
203 -
204 -`string`
205 -
206 -Auth config ID of the connected account
207 -
208 -##### options?
209 -
210 -#### Returns
211 -
212 -`Promise`\<[`ConnectionRequest`](../../ConnectionRequest/classes/ConnectionRequest.mdx)\>
213 -
214 -Connection request object
215 -
216 -#### Example
217 -
218 -```ts
219 -const connectionRequest = await composio.createConnectedAccount('user_123', 'auth_config_123', {
220 - data: {
221 - name: 'My Connected Account',
222 - },
223 -});
224 -```
225 -
226 -#### Link
227 -
228 -https://docs.composio.dev/reference/connected-accounts/create-connected-account
229 -
230 -***
231 -
232 -### list()
233 -
234 -> **list**(`query?`): `Promise`\<\{ \}\>
235 -
236 -Defined in: [packages/core/src/models/ConnectedAccounts.ts:66](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/ConnectedAccounts.ts#L66)
237 -
238 -Lists all connected accounts based on provided filter criteria.
239 -
240 -This method retrieves connected accounts from the Composio API with optional filtering.
241 -
242 -#### Parameters
243 -
244 -##### query?
245 -
246 -Optional query parameters for filtering connected accounts
247 -
248 -#### Returns
249 -
250 -`Promise`\<\{ \}\>
251 -
252 -A paginated list of connected accounts
253 -
254 -#### Throws
255 -
256 -If the query fails validation against the expected schema
257 -
258 -#### Example
259 -
260 -```typescript
261 -// List all connected accounts
262 -const allAccounts = await composio.connectedAccounts.list();
263 -
264 -// List accounts for a specific user
265 -const userAccounts = await composio.connectedAccounts.list({
266 - userIds: ['user123']
267 -});
268 -
269 -// List accounts for a specific toolkit
270 -const githubAccounts = await composio.connectedAccounts.list({
271 - toolkitSlugs: ['github']
272 -});
273 -```
274 -
275 -***
276 -
277 -### refresh()
278 -
279 -> **refresh**(`nanoid`): `Promise`\<`ConnectedAccountRefreshResponse`\>
280 -
281 -Defined in: [packages/core/src/models/ConnectedAccounts.ts:238](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/ConnectedAccounts.ts#L238)
282 -
283 -Refreshes a connected account's authentication credentials.
284 -
285 -This method attempts to refresh OAuth tokens or other credentials associated with
286 -the connected account. This is useful when a token has expired or is about to expire.
287 -
288 -#### Parameters
289 -
290 -##### nanoid
291 -
292 -`string`
293 -
294 -The unique identifier of the connected account to refresh
295 -
296 -#### Returns
297 -
298 -`Promise`\<`ConnectedAccountRefreshResponse`\>
299 -
300 -The response containing the refreshed account details
301 -
302 -#### Throws
303 -
304 -If the account doesn't exist or credentials cannot be refreshed
305 -
306 -#### Example
307 -
308 -```typescript
309 -// Refresh a connected account's credentials
310 -const refreshedAccount = await composio.connectedAccounts.refresh('conn_abc123');
311 -```
312 -
313 -***
314 -
315 -### updateStatus()
316 -
317 -> **updateStatus**(`nanoid`, `params`): `Promise`\<`ConnectedAccountUpdateStatusResponse`\>
318 -
319 -Defined in: [packages/core/src/models/ConnectedAccounts.ts:262](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/ConnectedAccounts.ts#L262)
320 -
321 -Update the status of a connected account
322 -
323 -#### Parameters
324 -
325 -##### nanoid
326 -
327 -`string`
328 -
329 -Unique identifier of the connected account
330 -
331 -##### params
332 -
333 -`ConnectedAccountUpdateStatusParams`
334 -
335 -Parameters for updating the status
336 -
337 -#### Returns
338 -
339 -`Promise`\<`ConnectedAccountUpdateStatusResponse`\>
340 -
341 -Updated connected account details
342 -
343 -#### Example
344 -
345 -```typescript
346 -// Enable a connected account
347 -const updatedAccount = await composio.connectedAccounts.updateStatus('conn_abc123', {
348 - enabled: true
349 -});
350 -
351 -// Disable a connected account with a reason
352 -const disabledAccount = await composio.connectedAccounts.updateStatus('conn_abc123', {
353 - enabled: false,
354 - reason: 'Token expired'
355 -});
356 -```
357 -
358 -***
359 -
360 -### waitForConnection()
361 -
362 -> **waitForConnection**(`connectedAccountId`, `timeout?`): `Promise`\<\{ \}\>
363 -
364 -Defined in: [packages/core/src/models/ConnectedAccounts.ts:171](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/ConnectedAccounts.ts#L171)
365 -
366 -Waits for a connection request to complete and become active.
367 -
368 -This method continuously polls the Composio API to check the status of a connection
369 -until it either becomes active, enters a terminal error state, or times out.
370 -
371 -#### Parameters
372 -
373 -##### connectedAccountId
374 -
375 -`string`
376 -
377 -The ID of the connected account to wait for
378 -
379 -##### timeout?
380 -
381 -`number` = `60000`
382 -
383 -Maximum time to wait in milliseconds (default: 60 seconds)
384 -
385 -#### Returns
386 -
387 -`Promise`\<\{ \}\>
388 -
389 -The finalized connected account data
390 -
391 -#### Throws
392 -
393 -If the connected account cannot be found
394 -
395 -#### Throws
396 -
397 -If the connection enters a failed, expired, or deleted state
398 -
399 -#### Throws
400 -
401 -If the connection does not complete within the timeout period
402 -
403 -#### Example
404 -
405 -```typescript
406 -// Wait for a connection to complete with default timeout
407 -const connectedAccount = await composio.connectedAccounts.waitForConnection('conn_123abc');
408 -
409 -// Wait with a custom timeout of 2 minutes
410 -const connectedAccount = await composio.connectedAccounts.waitForConnection('conn_123abc', 120000);
411 -```
fern/pages/sdk/typescript/ConnectionRequest/README.mdx deleted
-27
@@ -1,27 +0,0 @@
1 -[**@composio/core**](../README.mdx)
2 -
3 -***
4 -
5 -[@composio/core](../README.mdx) / ConnectionRequest
6 -
7 -# ConnectionRequest
8 -
9 -## Fileoverview
10 -
11 -Connection request class for Composio SDK, used to manage an initiated connection request.
12 -
13 -## Author
14 -
15 -Musthaq Ahamad <musthaq@composio.dev>
16 -
17 -## Date
18 -
19 -2025-05-05
20 -
21 -## Classes
22 -
23 -- [ConnectionRequest](classes/ConnectionRequest.mdx)
24 -
25 -## Functions
26 -
27 -- [connectionRequest](functions/connectionRequest.mdx)
fern/pages/sdk/typescript/ConnectionRequest/classes/ConnectionRequest.mdx deleted
-146
@@ -1,146 +0,0 @@
1 -[**@composio/core**](../../README.mdx)
2 -
3 -***
4 -
5 -[@composio/core](../../README.mdx) / [ConnectionRequest](../README.mdx) / ConnectionRequest
6 -
7 -# Class: ConnectionRequest
8 -
9 -Defined in: [packages/core/src/models/ConnectionRequest.ts:21](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/ConnectionRequest.ts#L21)
10 -
11 -## Constructors
12 -
13 -### Constructor
14 -
15 -> **new ConnectionRequest**(`client`, `connectedAccountId`, `status?`, `redirectUrl?`): `ConnectionRequest`
16 -
17 -Defined in: [packages/core/src/models/ConnectionRequest.ts:27](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/ConnectionRequest.ts#L27)
18 -
19 -#### Parameters
20 -
21 -##### client
22 -
23 -`Composio`
24 -
25 -##### connectedAccountId
26 -
27 -`string`
28 -
29 -##### status?
30 -
31 -`ConnectedAccountStatus`
32 -
33 -##### redirectUrl?
34 -
35 -`string`
36 -
37 -#### Returns
38 -
39 -`ConnectionRequest`
40 -
41 -## Properties
42 -
43 -### id
44 -
45 -> **id**: `string`
46 -
47 -Defined in: [packages/core/src/models/ConnectionRequest.ts:23](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/ConnectionRequest.ts#L23)
48 -
49 -***
50 -
51 -### redirectUrl?
52 -
53 -> `optional` **redirectUrl**: `string`
54 -
55 -Defined in: [packages/core/src/models/ConnectionRequest.ts:25](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/ConnectionRequest.ts#L25)
56 -
57 -***
58 -
59 -### status?
60 -
61 -> `optional` **status**: `ConnectedAccountStatus`
62 -
63 -Defined in: [packages/core/src/models/ConnectionRequest.ts:24](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/ConnectionRequest.ts#L24)
64 -
65 -## Methods
66 -
67 -### toJSON()
68 -
69 -> **toJSON**(): `Record`\<`string`, `unknown`\>
70 -
71 -Defined in: [packages/core/src/models/ConnectionRequest.ts:131](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/ConnectionRequest.ts#L131)
72 -
73 -Returns a JSON-serializable representation of the connection request
74 -Excludes the private client property to avoid cyclic reference issues
75 -
76 -#### Returns
77 -
78 -`Record`\<`string`, `unknown`\>
79 -
80 -***
81 -
82 -### toString()
83 -
84 -> **toString**(): `string`
85 -
86 -Defined in: [packages/core/src/models/ConnectionRequest.ts:142](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/ConnectionRequest.ts#L142)
87 -
88 -Returns a string representation of the connection request
89 -
90 -#### Returns
91 -
92 -`string`
93 -
94 -***
95 -
96 -### waitForConnection()
97 -
98 -> **waitForConnection**(`timeout?`): `Promise`\<\{ \}\>
99 -
100 -Defined in: [packages/core/src/models/ConnectionRequest.ts:66](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/ConnectionRequest.ts#L66)
101 -
102 -Waits for the connection request to complete and become active.
103 -
104 -This method continuously polls the Composio API to check the status of the connection request
105 -until it either becomes active, enters a terminal error state, or times out.
106 -
107 -#### Parameters
108 -
109 -##### timeout?
110 -
111 -`number` = `60000`
112 -
113 -Maximum time to wait in milliseconds before timing out (default: 60 seconds)
114 -
115 -#### Returns
116 -
117 -`Promise`\<\{ \}\>
118 -
119 -The final connected account response when successful
120 -
121 -#### Throws
122 -
123 -If the connected account cannot be found
124 -
125 -#### Throws
126 -
127 -If the connection enters a failed, expired, or deleted state
128 -
129 -#### Throws
130 -
131 -If the connection request does not complete within the timeout period
132 -
133 -#### Example
134 -
135 -```typescript
136 -// Wait for connection with default timeout (60 seconds)
137 -try {
138 - const connection = await connectionRequest.waitForConnection();
139 - console.log('Connection established:', connection.id);
140 -} catch (error) {
141 - console.error('Connection failed:', error.message);
142 -}
143 -
144 -// Wait for connection with custom timeout (2 minutes)
145 -const connection = await connectionRequest.waitForConnection(120000);
146 -```
fern/pages/sdk/typescript/ConnectionRequest/functions/connectionRequest.mdx deleted
-39
@@ -1,39 +0,0 @@
1 -[**@composio/core**](../../README.mdx)
2 -
3 -***
4 -
5 -[@composio/core](../../README.mdx) / [ConnectionRequest](../README.mdx) / connectionRequest
6 -
7 -# Function: connectionRequest()
8 -
9 -> **connectionRequest**(`client`): `object`
10 -
11 -Defined in: [packages/core/src/models/ConnectionRequest.ts:147](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/ConnectionRequest.ts#L147)
12 -
13 -## Parameters
14 -
15 -### client
16 -
17 -`Composio`
18 -
19 -## Returns
20 -
21 -`object`
22 -
23 -### waitForConnection()
24 -
25 -> **waitForConnection**: (`connectedAccountId`, `timeout`) => `Promise`\<\{ \}\>
26 -
27 -#### Parameters
28 -
29 -##### connectedAccountId
30 -
31 -`string`
32 -
33 -##### timeout
34 -
35 -`number` = `60000`
36 -
37 -#### Returns
38 -
39 -`Promise`\<\{ \}\>
fern/pages/sdk/typescript/CustomTools/README.mdx deleted
-23
@@ -1,23 +0,0 @@
1 -[**@composio/core**](../README.mdx)
2 -
3 -***
4 -
5 -[@composio/core](../README.mdx) / CustomTools
6 -
7 -# CustomTools
8 -
9 -## Fileoverview
10 -
11 -Custom tools class for Composio SDK, used to manage custom tools created by users.
12 -
13 -## Author
14 -
15 -Musthaq Ahamad <musthaq@composio.dev>
16 -
17 -## Date
18 -
19 -2025-05-05
20 -
21 -## Classes
22 -
23 -- [CustomTools](classes/CustomTools.mdx)
fern/pages/sdk/typescript/CustomTools/classes/CustomTools.mdx deleted
-183
@@ -1,183 +0,0 @@
1 -[**@composio/core**](../../README.mdx)
2 -
3 ----
4 -
5 -[@composio/core](../../README.mdx) / [CustomTools](../README.mdx) / CustomTools
6 -
7 -# Class: CustomTools
8 -
9 -Defined in: [packages/core/src/models/CustomTools.ts:37](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/CustomTools.ts#L37)
10 -
11 -## Constructors
12 -
13 -### Constructor
14 -
15 -> **new CustomTools**(`client`): `CustomTools`
16 -
17 -Defined in: [packages/core/src/models/CustomTools.ts:41](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/CustomTools.ts#L41)
18 -
19 -#### Parameters
20 -
21 -##### client
22 -
23 -`Composio`
24 -
25 -#### Returns
26 -
27 -`CustomTools`
28 -
29 -## Methods
30 -
31 -### createTool()
32 -
33 -> **createTool**\<`T`\>(`toolOptions`): `Promise`\<\{ \}\>
34 -
35 -Defined in: [packages/core/src/models/CustomTools.ts:76](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/CustomTools.ts#L76)
36 -
37 -Create a custom tool and registers it in the registry.
38 -This is just an in memory registry and is not persisted.
39 -
40 -#### Type Parameters
41 -
42 -##### T
43 -
44 -`T` _extends_ `CustomToolInputParameter`
45 -
46 -#### Parameters
47 -
48 -##### toolOptions
49 -
50 -`CustomToolOptions`\<`T`\>
51 -
52 -CustomToolOptions
53 -
54 -#### Returns
55 -
56 -`Promise`\<\{ \}\>
57 -
58 -The tool created
59 -
60 -#### Example
61 -
62 -```typescript
63 -// Create a custom tool with input parameters
64 -const customTool = await composio.customTools.createTool({
65 - name: 'My Custom Tool',
66 - description: 'A tool that performs a custom operation',
67 - slug: 'MY_CUSTOM_TOOL',
68 - inputParams: z.object({
69 - query: z.string().describe('The search query'),
70 - limit: z.number().optional().describe('Maximum number of results'),
71 - }),
72 - execute: async (input, connectionConfig, executeToolRequest) => {
73 - // Custom implementation logic
74 - return {
75 - data: { results: ['result1', 'result2'] },
76 - };
77 - },
78 -});
79 -```
80 -
81 ----
82 -
83 -### executeCustomTool()
84 -
85 -> **executeCustomTool**(`slug`, `body`): `Promise`\<\{ \}\>
86 -
87 -Defined in: [packages/core/src/models/CustomTools.ts:267](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/CustomTools.ts#L267)
88 -
89 -Execute a custom tool
90 -
91 -#### Parameters
92 -
93 -##### slug
94 -
95 -`string`
96 -
97 -The slug of the tool to execute
98 -
99 -##### body
100 -
101 -#### Returns
102 -
103 -`Promise`\<\{ \}\>
104 -
105 -The response from the tool
106 -
107 -#### Description
108 -
109 -If a toolkit is used, the connected account id is used to execute the tool.
110 -If a connected account id is provided, it is used to execute the tool.
111 -If a connected account id is not provided, the first connected account for the toolkit is used.
112 -
113 ----
114 -
115 -### getCustomToolBySlug()
116 -
117 -> **getCustomToolBySlug**(`slug`): `Promise`\<\{ \}\>
118 -
119 -Defined in: [packages/core/src/models/CustomTools.ts:169](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/CustomTools.ts#L169)
120 -
121 -Get a custom tool by slug from the registry.
122 -
123 -#### Parameters
124 -
125 -##### slug
126 -
127 -`string`
128 -
129 -The slug of the tool to get
130 -
131 -#### Returns
132 -
133 -`Promise`\<\{ \}\>
134 -
135 -The tool
136 -
137 -#### Example
138 -
139 -```typescript
140 -// Get a specific custom tool by its slug
141 -const myTool = await composio.customTools.getCustomToolBySlug('MY_CUSTOM_TOOL');
142 -if (myTool) {
143 - console.log(`Found tool: ${myTool.name}`);
144 -} else {
145 - console.log('Tool not found');
146 -}
147 -```
148 -
149 ----
150 -
151 -### getCustomTools()
152 -
153 -> **getCustomTools**(`__namedParameters`): `Promise`\<`ToolList`\>
154 -
155 -Defined in: [packages/core/src/models/CustomTools.ts:134](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/CustomTools.ts#L134)
156 -
157 -Get all the custom tools from the registry.
158 -
159 -#### Parameters
160 -
161 -##### \_\_namedParameters
162 -
163 -###### toolSlugs?
164 -
165 -`string`[]
166 -
167 -#### Returns
168 -
169 -`Promise`\<`ToolList`\>
170 -
171 -The list of tools
172 -
173 -#### Example
174 -
175 -```typescript
176 -// Get all custom tools
177 -const allTools = await composio.customTools.getCustomTools({});
178 -
179 -// Get specific custom tools by slug
180 -const specificTools = await composio.customTools.getCustomTools({
181 - toolSlugs: ['MY_CUSTOM_TOOL', 'ANOTHER_CUSTOM_TOOL'],
182 -});
183 -```
fern/pages/sdk/typescript/README.mdx deleted
-20
@@ -1,20 +0,0 @@
1 -**@composio/core**
2 -
3 -***
4 -
5 -# @composio/core
6 -
7 -## Modules
8 -
9 -- [AuthConfigs](AuthConfigs/README.mdx)
10 -- [composio](composio/README.mdx)
11 -- [ConnectedAccounts](ConnectedAccounts/README.mdx)
12 -- [ConnectionRequest](ConnectionRequest/README.mdx)
13 -- [CustomTools](CustomTools/README.mdx)
14 -- [models/Session](models/Session/README.mdx)
15 -- [models/Toolkits](models/Toolkits/README.mdx)
16 -- [models/Tools](models/Tools/README.mdx)
17 -- [models/Triggers](models/Triggers/README.mdx)
18 -- [provider/BaseProvider](provider/BaseProvider/README.mdx)
19 -- [provider/ComposioProvider](provider/ComposioProvider/README.mdx)
20 -- [provider/OpenAIProvider](provider/OpenAIProvider/README.mdx)
fern/pages/sdk/typescript/composio/README.mdx deleted
-15
@@ -1,15 +0,0 @@
1 -[**@composio/core**](../README.mdx)
2 -
3 -***
4 -
5 -[@composio/core](../README.mdx) / composio
6 -
7 -# composio
8 -
9 -## Classes
10 -
11 -- [Composio](classes/Composio.mdx)
12 -
13 -## Type Aliases
14 -
15 -- [ComposioConfig](type-aliases/ComposioConfig.mdx)
fern/pages/sdk/typescript/composio/classes/Composio.mdx deleted
-180
@@ -1,180 +0,0 @@
1 -[**@composio/core**](../../README.mdx)
2 -
3 -***
4 -
5 -[@composio/core](../../README.mdx) / [composio](../README.mdx) / Composio
6 -
7 -# Class: Composio\<TProvider\>
8 -
9 -Defined in: [packages/core/src/composio.ts:48](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/composio.ts#L48)
10 -
11 -This is the core class for Composio.
12 -It is used to initialize the Composio SDK and provide a global configuration.
13 -
14 -## Type Parameters
15 -
16 -### TProvider
17 -
18 -`TProvider` *extends* [`BaseComposioProvider`](../../provider/BaseProvider/type-aliases/BaseComposioProvider.mdx)\<`unknown`, `unknown`\> = [`OpenAIProvider`](../../provider/OpenAIProvider/classes/OpenAIProvider.mdx)
19 -
20 -## Constructors
21 -
22 -### Constructor
23 -
24 -> **new Composio**\<`TProvider`\>(`config?`): `Composio`\<`TProvider`\>
25 -
26 -Defined in: [packages/core/src/composio.ts:105](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/composio.ts#L105)
27 -
28 -Creates a new instance of the Composio SDK.
29 -
30 -The constructor initializes the SDK with the provided configuration options,
31 -sets up the API client, and initializes all core models (tools, toolkits, etc.).
32 -
33 -#### Parameters
34 -
35 -##### config?
36 -
37 -[`ComposioConfig`](../type-aliases/ComposioConfig.mdx)\<`TProvider`\>
38 -
39 -Configuration options for the Composio SDK
40 -
41 -#### Returns
42 -
43 -`Composio`\<`TProvider`\>
44 -
45 -#### Example
46 -
47 -```typescript
48 -// Initialize with default configuration
49 -const composio = new Composio();
50 -
51 -// Initialize with custom API key and base URL
52 -const composio = new Composio({
53 - apiKey: 'your-api-key',
54 - baseURL: 'https://api.composio.dev'
55 -});
56 -
57 -// Initialize with custom provider
58 -const composio = new Composio({
59 - apiKey: 'your-api-key',
60 - provider: new CustomProvider()
61 -});
62 -```
63 -
64 -## Properties
65 -
66 -### authConfigs
67 -
68 -> **authConfigs**: [`AuthConfigs`](../../AuthConfigs/classes/AuthConfigs.mdx)
69 -
70 -Defined in: [packages/core/src/composio.ts:69](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/composio.ts#L69)
71 -
72 -***
73 -
74 -### connectedAccounts
75 -
76 -> **connectedAccounts**: [`ConnectedAccounts`](../../ConnectedAccounts/classes/ConnectedAccounts.mdx)
77 -
78 -Defined in: [packages/core/src/composio.ts:71](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/composio.ts#L71)
79 -
80 -***
81 -
82 -### provider
83 -
84 -> **provider**: `TProvider`
85 -
86 -Defined in: [packages/core/src/composio.ts:67](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/composio.ts#L67)
87 -
88 -***
89 -
90 -### toolkits
91 -
92 -> **toolkits**: [`Toolkits`](../../models/Toolkits/classes/Toolkits.mdx)
93 -
94 -Defined in: [packages/core/src/composio.ts:65](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/composio.ts#L65)
95 -
96 -***
97 -
98 -### tools
99 -
100 -> **tools**: [`Tools`](../../models/Tools/classes/Tools.mdx)\<`unknown`, `unknown`, `TProvider`\>
101 -
102 -Defined in: [packages/core/src/composio.ts:64](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/composio.ts#L64)
103 -
104 -Core models for Composio.
105 -
106 -***
107 -
108 -### triggers
109 -
110 -> **triggers**: [`Triggers`](../../models/Triggers/classes/Triggers.mdx)
111 -
112 -Defined in: [packages/core/src/composio.ts:66](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/composio.ts#L66)
113 -
114 -## Methods
115 -
116 -### createSession()
117 -
118 -> **createSession**(`options?`): `Composio`\<`TProvider`\>
119 -
120 -Defined in: [packages/core/src/composio.ts:223](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/composio.ts#L223)
121 -
122 -Creates a new instance of the Composio SDK with custom request options while preserving the existing configuration.
123 -This method is particularly useful when you need to:
124 -- Add custom headers for specific requests
125 -- Track request contexts with unique identifiers
126 -- Override default request behavior for a subset of operations
127 -
128 -The new instance inherits all configuration from the parent instance (apiKey, baseURL, provider, etc.)
129 -but allows you to specify custom request options that will be used for all API calls made through this session.
130 -
131 -#### Parameters
132 -
133 -##### options?
134 -
135 -###### headers?
136 -
137 -`ComposioRequestHeaders`
138 -
139 -#### Returns
140 -
141 -`Composio`\<`TProvider`\>
142 -
143 -A new Composio instance with the custom request options applied.
144 -
145 -#### Example
146 -
147 -```typescript
148 -// Create a base Composio instance
149 -const composio = new Composio({
150 - apiKey: 'your-api-key'
151 -});
152 -
153 -// Create a session with request tracking headers
154 -const composioWithCustomHeaders = composio.createSession({
155 - headers: {
156 - 'x-request-id': '1234567890',
157 - 'x-correlation-id': 'session-abc-123',
158 - 'x-custom-header': 'custom-value'
159 - }
160 -});
161 -
162 -// Use the session for making API calls with the custom headers
163 -await composioWithCustomHeaders.tools.list();
164 -```
165 -
166 -***
167 -
168 -### getClient()
169 -
170 -> **getClient**(): `Composio`
171 -
172 -Defined in: [packages/core/src/composio.ts:182](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/composio.ts#L182)
173 -
174 -Get the Composio SDK client.
175 -
176 -#### Returns
177 -
178 -`Composio`
179 -
180 -The Composio API client.
fern/pages/sdk/typescript/composio/type-aliases/ComposioConfig.mdx deleted
-86
@@ -1,86 +0,0 @@
1 -[**@composio/core**](../../README.mdx)
2 -
3 -***
4 -
5 -[@composio/core](../../README.mdx) / [composio](../README.mdx) / ComposioConfig
6 -
7 -# Type Alias: ComposioConfig\<TProvider\>
8 -
9 -> **ComposioConfig**\<`TProvider`\> = `object`
10 -
11 -Defined in: [packages/core/src/composio.ts:20](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/composio.ts#L20)
12 -
13 -## Type Parameters
14 -
15 -### TProvider
16 -
17 -`TProvider` *extends* [`BaseComposioProvider`](../../provider/BaseProvider/type-aliases/BaseComposioProvider.mdx)\<`unknown`, `unknown`\> = [`OpenAIProvider`](../../provider/OpenAIProvider/classes/OpenAIProvider.mdx)
18 -
19 -## Properties
20 -
21 -### allowTracing?
22 -
23 -> `optional` **allowTracing**: `boolean`
24 -
25 -Defined in: [packages/core/src/composio.ts:26](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/composio.ts#L26)
26 -
27 -***
28 -
29 -### allowTracking?
30 -
31 -> `optional` **allowTracking**: `boolean`
32 -
33 -Defined in: [packages/core/src/composio.ts:25](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/composio.ts#L25)
34 -
35 -***
36 -
37 -### apiKey?
38 -
39 -> `optional` **apiKey**: `string` \| `null`
40 -
41 -Defined in: [packages/core/src/composio.ts:23](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/composio.ts#L23)
42 -
43 -***
44 -
45 -### baseURL?
46 -
47 -> `optional` **baseURL**: `string` \| `null`
48 -
49 -Defined in: [packages/core/src/composio.ts:24](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/composio.ts#L24)
50 -
51 -***
52 -
53 -### defaultHeaders?
54 -
55 -> `optional` **defaultHeaders**: `ComposioRequestHeaders`
56 -
57 -Defined in: [packages/core/src/composio.ts:41](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/composio.ts#L41)
58 -
59 -Request options to be passed to the Composio API client.
60 -This is useful for passing in a custom fetch implementation.
61 -
62 -#### Example
63 -
64 -```typescript
65 -const composio = new Composio({
66 - defaultHeaders: {
67 - 'x-request-id': '1234567890',
68 - },
69 -});
70 -```
71 -
72 -***
73 -
74 -### provider?
75 -
76 -> `optional` **provider**: `TProvider`
77 -
78 -Defined in: [packages/core/src/composio.ts:27](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/composio.ts#L27)
79 -
80 -***
81 -
82 -### telemetryTransport?
83 -
84 -> `optional` **telemetryTransport**: `BaseTelemetryTransport`
85 -
86 -Defined in: [packages/core/src/composio.ts:28](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/composio.ts#L28)
fern/pages/sdk/typescript/models/Session/README.mdx deleted
-11
@@ -1,11 +0,0 @@
1 -[**@composio/core**](../../README.mdx)
2 -
3 -***
4 -
5 -[@composio/core](../../README.mdx) / models/Session
6 -
7 -# models/Session
8 -
9 -## Classes
10 -
11 -- [Session](classes/Session.mdx)
fern/pages/sdk/typescript/models/Session/classes/Session.mdx deleted
-43
@@ -1,43 +0,0 @@
1 -[**@composio/core**](../../../README.mdx)
2 -
3 -***
4 -
5 -[@composio/core](../../../README.mdx) / [models/Session](../README.mdx) / Session
6 -
7 -# Class: Session
8 -
9 -Defined in: [packages/core/src/models/Session.ts:5](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Session.ts#L5)
10 -
11 -## Constructors
12 -
13 -### Constructor
14 -
15 -> **new Session**(`client`): `Session`
16 -
17 -Defined in: [packages/core/src/models/Session.ts:8](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Session.ts#L8)
18 -
19 -#### Parameters
20 -
21 -##### client
22 -
23 -`Composio`
24 -
25 -#### Returns
26 -
27 -`Session`
28 -
29 -## Methods
30 -
31 -### getInfo()
32 -
33 -> **getInfo**(): `Promise`\<`SessionRetrieveResponse`\>
34 -
35 -Defined in: [packages/core/src/models/Session.ts:17](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Session.ts#L17)
36 -
37 -Get the active session info
38 -
39 -#### Returns
40 -
41 -`Promise`\<`SessionRetrieveResponse`\>
42 -
43 -Session info
fern/pages/sdk/typescript/models/Toolkits/README.mdx deleted
-11
@@ -1,11 +0,0 @@
1 -[**@composio/core**](../../README.mdx)
2 -
3 -***
4 -
5 -[@composio/core](../../README.mdx) / models/Toolkits
6 -
7 -# models/Toolkits
8 -
9 -## Classes
10 -
11 -- [Toolkits](classes/Toolkits.mdx)
fern/pages/sdk/typescript/models/Toolkits/classes/Toolkits.mdx deleted
-186
@@ -1,186 +0,0 @@
1 -[**@composio/core**](../../../README.mdx)
2 -
3 -***
4 -
5 -[@composio/core](../../../README.mdx) / [models/Toolkits](../README.mdx) / Toolkits
6 -
7 -# Class: Toolkits
8 -
9 -Defined in: [packages/core/src/models/Toolkits.ts:27](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Toolkits.ts#L27)
10 -
11 -Toolkits class
12 -
13 -Toolkits are a collection of tools that can be used to perform various tasks.
14 -This is similar/replacement of `apps` in the Composio API.
15 -
16 -## Constructors
17 -
18 -### Constructor
19 -
20 -> **new Toolkits**(`client`): `Toolkits`
21 -
22 -Defined in: [packages/core/src/models/Toolkits.ts:30](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Toolkits.ts#L30)
23 -
24 -#### Parameters
25 -
26 -##### client
27 -
28 -`Composio`
29 -
30 -#### Returns
31 -
32 -`Toolkits`
33 -
34 -## Methods
35 -
36 -### authorize()
37 -
38 -> **authorize**(`userId`, `toolkitSlug`): `Promise`\<[`ConnectionRequest`](../../../ConnectionRequest/classes/ConnectionRequest.mdx)\>
39 -
40 -Defined in: [packages/core/src/models/Toolkits.ts:255](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Toolkits.ts#L255)
41 -
42 -Authorizes a user to use a toolkit.
43 -This method will create an auth config if one doesn't exist and initiate a connection request.
44 -
45 -#### Parameters
46 -
47 -##### userId
48 -
49 -`string`
50 -
51 -The user id of the user to authorize
52 -
53 -##### toolkitSlug
54 -
55 -`string`
56 -
57 -The slug of the toolkit to authorize
58 -
59 -#### Returns
60 -
61 -`Promise`\<[`ConnectionRequest`](../../../ConnectionRequest/classes/ConnectionRequest.mdx)\>
62 -
63 -The connection request object
64 -
65 -#### Example
66 -
67 -```typescript
68 -const connectionRequest = await composio.toolkits.authorize(userId, 'github');
69 -```
70 -
71 -***
72 -
73 -### get()
74 -
75 -Implementation method that handles both overloads for retrieving toolkits.
76 -
77 -#### Param
78 -
79 -Either a toolkit slug or query parameters
80 -
81 -#### Call Signature
82 -
83 -> **get**(`slug`): `Promise`\<\{ \}\>
84 -
85 -Defined in: [packages/core/src/models/Toolkits.ts:171](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Toolkits.ts#L171)
86 -
87 -Retrieves a specific toolkit by its slug identifier.
88 -
89 -##### Parameters
90 -
91 -###### slug
92 -
93 -`string`
94 -
95 -The unique slug identifier of the toolkit to retrieve
96 -
97 -##### Returns
98 -
99 -`Promise`\<\{ \}\>
100 -
101 -The toolkit or list of toolkits
102 -
103 -##### Param
104 -
105 -Either a toolkit slug or query parameters
106 -
107 -##### Throws
108 -
109 -If no toolkit with the given slug exists
110 -
111 -##### Example
112 -
113 -```typescript
114 -// Get a specific toolkit
115 -const githubToolkit = await composio.toolkits.get('github');
116 -console.log(githubToolkit.name); // GitHub
117 -console.log(githubToolkit.authConfigDetails); // Authentication configuration details
118 -```
119 -
120 -#### Call Signature
121 -
122 -> **get**(`query`): `Promise`\<\{ \}\>
123 -
124 -Defined in: [packages/core/src/models/Toolkits.ts:195](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Toolkits.ts#L195)
125 -
126 -Retrieves a list of toolkits based on the provided query parameters.
127 -
128 -##### Parameters
129 -
130 -###### query
131 -
132 -The query parameters to filter toolkits
133 -
134 -##### Returns
135 -
136 -`Promise`\<\{ \}\>
137 -
138 -The toolkit or list of toolkits
139 -
140 -##### Param
141 -
142 -Either a toolkit slug or query parameters
143 -
144 -##### Example
145 -
146 -```typescript
147 -// Get all toolkits
148 -const allToolkits = await composio.toolkits.get({});
149 -
150 -// Get toolkits by category
151 -const devToolkits = await composio.toolkits.get({
152 - category: 'developer-tools'
153 -});
154 -
155 -// Get local toolkits
156 -const localToolkits = await composio.toolkits.get({
157 - isLocal: true
158 -});
159 -```
160 -
161 -***
162 -
163 -### listCategories()
164 -
165 -> **listCategories**(): `Promise`\<\{ \}\>
166 -
167 -Defined in: [packages/core/src/models/Toolkits.ts:227](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Toolkits.ts#L227)
168 -
169 -Retrieves all toolkit categories available in the Composio SDK.
170 -
171 -This method fetches the complete list of categories from the Composio API
172 -and transforms the response to use camelCase property naming.
173 -
174 -#### Returns
175 -
176 -`Promise`\<\{ \}\>
177 -
178 -The list of toolkit categories
179 -
180 -#### Example
181 -
182 -```typescript
183 -// Get all toolkit categories
184 -const categories = await composio.toolkits.listCategories();
185 -console.log(categories.items); // Array of category objects
186 -```
fern/pages/sdk/typescript/models/Tools/README.mdx deleted
-11
@@ -1,11 +0,0 @@
1 -[**@composio/core**](../../README.mdx)
2 -
3 -***
4 -
5 -[@composio/core](../../README.mdx) / models/Tools
6 -
7 -# models/Tools
8 -
9 -## Classes
10 -
11 -- [Tools](classes/Tools.mdx)
fern/pages/sdk/typescript/models/Tools/classes/Tools.mdx deleted
-557
@@ -1,557 +0,0 @@
1 -[**@composio/core**](../../../README.mdx)
2 -
3 ----
4 -
5 -[@composio/core](../../../README.mdx) / [models/Tools](../README.mdx) / Tools
6 -
7 -# Class: Tools\<TToolCollection, TTool, TProvider\>
8 -
9 -Defined in: [packages/core/src/models/Tools.ts:48](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Tools.ts#L48)
10 -
11 -This class is used to manage tools in the Composio SDK.
12 -It provides methods to list, get, and execute tools.
13 -
14 -## Type Parameters
15 -
16 -### TToolCollection
17 -
18 -`TToolCollection`
19 -
20 -### TTool
21 -
22 -`TTool`
23 -
24 -### TProvider
25 -
26 -`TProvider` _extends_ [`BaseComposioProvider`](../../../provider/BaseProvider/type-aliases/BaseComposioProvider.mdx)\<`TToolCollection`, `TTool`\>
27 -
28 -## Constructors
29 -
30 -### Constructor
31 -
32 -> **new Tools**\<`TToolCollection`, `TTool`, `TProvider`\>(`client`, `provider`): `Tools`\<`TToolCollection`, `TTool`, `TProvider`\>
33 -
34 -Defined in: [packages/core/src/models/Tools.ts:57](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Tools.ts#L57)
35 -
36 -#### Parameters
37 -
38 -##### client
39 -
40 -`Composio`
41 -
42 -##### provider
43 -
44 -`TProvider`
45 -
46 -#### Returns
47 -
48 -`Tools`\<`TToolCollection`, `TTool`, `TProvider`\>
49 -
50 -## Methods
51 -
52 -### createCustomTool()
53 -
54 -> **createCustomTool**\<`T`\>(`body`): `Promise`\<\{ \}\>
55 -
56 -Defined in: [packages/core/src/models/Tools.ts:797](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Tools.ts#L797)
57 -
58 -Creates a custom tool that can be used within the Composio SDK.
59 -
60 -Custom tools allow you to extend the functionality of Composio with your own implementations
61 -while keeping a consistent interface for both built-in and custom tools.
62 -
63 -#### Type Parameters
64 -
65 -##### T
66 -
67 -`T` _extends_ `CustomToolInputParameter`
68 -
69 -#### Parameters
70 -
71 -##### body
72 -
73 -`CustomToolOptions`\<`T`\>
74 -
75 -The configuration for the custom tool
76 -
77 -#### Returns
78 -
79 -`Promise`\<\{ \}\>
80 -
81 -The created custom tool
82 -
83 -#### Examples
84 -
85 -```typescript
86 -// creating a custom tool with a toolkit
87 -await composio.tools.createCustomTool({
88 - name: 'My Custom Tool',
89 - description: 'A custom tool that does something specific',
90 - slug: 'MY_CUSTOM_TOOL',
91 - userId: 'default',
92 - connectedAccountId: '123',
93 - toolkitSlug: 'github',
94 - inputParameters: z.object({
95 - param1: z.string().describe('First parameter'),
96 - }),
97 - execute: async (input, connectionConfig, executeToolRequest) => {
98 - // Custom logic here
99 - return { data: { result: 'Success!' } };
100 - },
101 -});
102 -```
103 -
104 -````typescript
105 -// creating a custom tool without a toolkit
106 -await composio.tools.createCustomTool({
107 - name: 'My Custom Tool',
108 - description: 'A custom tool that does something specific',
109 - slug: 'MY_CUSTOM_TOOL',
110 - inputParameters: z.object({
111 - param1: z.string().describe('First parameter'),
112 - }),
113 - execute: async (input) => {
114 - // Custom logic here
115 - return { data: { result: 'Success!' } };
116 - }
117 -});
118 -
119 -***
120 -
121 -### execute()
122 -
123 -> **execute**(`slug`, `body`, `modifiers?`): `Promise`\<\{ \}\>
124 -
125 -Defined in: [packages/core/src/models/Tools.ts:622](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Tools.ts#L622)
126 -
127 -Executes a given tool with the provided parameters.
128 -
129 -This method calls the Composio API or a custom tool handler to execute the tool and returns the response.
130 -It automatically determines whether to use a custom tool or a Composio API tool based on the slug.
131 -
132 -#### Parameters
133 -
134 -##### slug
135 -
136 -`string`
137 -
138 -The slug/ID of the tool to be executed
139 -
140 -##### body
141 -
142 -The parameters to be passed to the tool
143 -
144 -##### modifiers?
145 -
146 -`ExecuteToolModifiers`
147 -
148 -Optional modifiers to transform the request or response
149 -
150 -#### Returns
151 -
152 -`Promise`\<\{ \}\>
153 -
154 -- The response from the tool execution
155 -
156 -#### Throws
157 -
158 -If the CustomTools instance is not initialized
159 -
160 -#### Throws
161 -
162 -If the tool with the given slug is not found
163 -
164 -#### Throws
165 -
166 -If there is an error during tool execution
167 -
168 -#### Example
169 -
170 -```typescript
171 -// Execute a Composio API tool
172 -const result = await composio.tools.execute('HACKERNEWS_GET_USER', {
173 - userId: 'default',
174 - arguments: { userId: 'pg' }
175 -});
176 -
177 -// Execute with modifiers
178 -const result = await composio.tools.execute('GITHUB_GET_ISSUES', {
179 - userId: 'default',
180 - arguments: { owner: 'composio', repo: 'sdk' }
181 -}, {
182 - beforeExecute: (toolSlug, toolkitSlug, params) => {
183 - // Modify params before execution
184 - return params;
185 - },
186 - afterExecute: (toolSlug, toolkitSlug, result) => {
187 - // Transform result after execution
188 - return result;
189 - }
190 -});
191 -````
192 -
193 ----
194 -
195 -### get()
196 -
197 -Get a tool or list of tools based on the provided arguments.
198 -This is an implementation method that handles both overloads.
199 -
200 -#### Param
201 -
202 -The user id to get the tool(s) for
203 -
204 -#### Param
205 -
206 -Either a slug string or filters object
207 -
208 -#### Param
209 -
210 -Optional provider options
211 -
212 -#### Call Signature
213 -
214 -> **get**\<`T`\>(`userId`, `filters`, `options?`): `Promise`\<`ReturnType`\<`T`\[`"wrapTools"`\]\>\>
215 -
216 -Defined in: [packages/core/src/models/Tools.ts:401](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Tools.ts#L401)
217 -
218 -Get a list of tools from Composio based on filters.
219 -This method fetches the tools from the Composio API and wraps them using the provider.
220 -
221 -##### Type Parameters
222 -
223 -###### T
224 -
225 -`T` _extends_ [`BaseComposioProvider`](../../../provider/BaseProvider/type-aliases/BaseComposioProvider.mdx)\<`TToolCollection`, `TTool`\>
226 -
227 -##### Parameters
228 -
229 -###### userId
230 -
231 -`string`
232 -
233 -The user id to get the tools for
234 -
235 -###### filters
236 -
237 -`ToolListParams`
238 -
239 -The filters to apply when fetching tools
240 -
241 -###### options?
242 -
243 -`ProviderOptions`\<`TProvider`\>
244 -
245 -Optional provider options including modifiers
246 -
247 -##### Returns
248 -
249 -`Promise`\<`ReturnType`\<`T`\[`"wrapTools"`\]\>\>
250 -
251 -The tool collection
252 -
253 -##### Param
254 -
255 -The user id to get the tool(s) for
256 -
257 -##### Param
258 -
259 -Either a slug string or filters object
260 -
261 -##### Param
262 -
263 -Optional provider options
264 -
265 -##### Example
266 -
267 -```typescript
268 -// Get tools from the GitHub toolkit
269 -const tools = await composio.tools.get('default', {
270 - toolkits: ['github'],
271 - limit: 10,
272 -});
273 -
274 -// Get tools with search
275 -const tools = await composio.tools.get('default', {
276 - search: 'user',
277 - important: true,
278 -});
279 -```
280 -
281 -#### Call Signature
282 -
283 -> **get**\<`T`\>(`userId`, `slug`, `options?`): `Promise`\<`ReturnType`\<`T`\[`"wrapTools"`\]\>\>
284 -
285 -Defined in: [packages/core/src/models/Tools.ts:430](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Tools.ts#L430)
286 -
287 -Get a specific tool by its slug.
288 -This method fetches the tool from the Composio API and wraps it using the provider.
289 -
290 -##### Type Parameters
291 -
292 -###### T
293 -
294 -`T` _extends_ [`BaseComposioProvider`](../../../provider/BaseProvider/type-aliases/BaseComposioProvider.mdx)\<`TToolCollection`, `TTool`\>
295 -
296 -##### Parameters
297 -
298 -###### userId
299 -
300 -`string`
301 -
302 -The user id to get the tool for
303 -
304 -###### slug
305 -
306 -`string`
307 -
308 -The slug of the tool to fetch
309 -
310 -###### options?
311 -
312 -`ProviderOptions`\<`TProvider`\>
313 -
314 -Optional provider options including modifiers
315 -
316 -##### Returns
317 -
318 -`Promise`\<`ReturnType`\<`T`\[`"wrapTools"`\]\>\>
319 -
320 -The tool collection
321 -
322 -##### Param
323 -
324 -The user id to get the tool(s) for
325 -
326 -##### Param
327 -
328 -Either a slug string or filters object
329 -
330 -##### Param
331 -
332 -Optional provider options
333 -
334 -##### Example
335 -
336 -```typescript
337 -// Get a specific tool by slug
338 -const hackerNewsUserTool = await composio.tools.get('default', 'HACKERNEWS_GET_USER');
339 -
340 -// Get a tool with schema modifications
341 -const tool = await composio.tools.get('default', 'GITHUB_GET_REPOS', {
342 - modifySchema: (toolSlug, toolkitSlug, schema) => {
343 - // Customize the tool schema
344 - return { ...schema, description: 'Custom description' };
345 - },
346 -});
347 -```
348 -
349 ----
350 -
351 -### getInput()
352 -
353 -> **getInput**(`slug`, `body`): `Promise`\<`ToolGetInputResponse`\>
354 -
355 -Defined in: [packages/core/src/models/Tools.ts:693](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Tools.ts#L693)
356 -
357 -Fetches the input parameters for a given tool.
358 -
359 -This method is used to get the input parameters for a tool before executing it.
360 -
361 -#### Parameters
362 -
363 -##### slug
364 -
365 -`string`
366 -
367 -The ID of the tool to find input for
368 -
369 -##### body
370 -
371 -`ToolGetInputParams`
372 -
373 -The parameters to be passed to the tool
374 -
375 -#### Returns
376 -
377 -`Promise`\<`ToolGetInputResponse`\>
378 -
379 -The input parameters schema for the specified tool
380 -
381 -#### Example
382 -
383 -```typescript
384 -// Get input parameters for a specific tool
385 -const inputParams = await composio.tools.getInput('GITHUB_CREATE_ISSUE', {
386 - userId: 'default',
387 -});
388 -console.log(inputParams.schema);
389 -```
390 -
391 ----
392 -
393 -### getRawComposioToolBySlug()
394 -
395 -> **getRawComposioToolBySlug**(`userId`, `slug`, `modifier?`): `Promise`\<\{ \}\>
396 -
397 -Defined in: [packages/core/src/models/Tools.ts:341](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Tools.ts#L341)
398 -
399 -Retrieves a tool by its Slug.
400 -This method is used to get the raw tools from the composio API.
401 -
402 -#### Parameters
403 -
404 -##### userId
405 -
406 -`string`
407 -
408 -##### slug
409 -
410 -`string`
411 -
412 -The ID of the tool to be retrieved
413 -
414 -##### modifier?
415 -
416 -`TransformToolSchemaModifier`
417 -
418 -#### Returns
419 -
420 -`Promise`\<\{ \}\>
421 -
422 -The tool
423 -
424 -#### Example
425 -
426 -```ts
427 -const tool = await composio.tools.getRawComposioToolBySlug('default', 'github');
428 -```
429 -
430 ----
431 -
432 -### getRawComposioTools()
433 -
434 -> **getRawComposioTools**(`userId`, `query?`, `modifier?`): `Promise`\<`ToolList`\>
435 -
436 -Defined in: [packages/core/src/models/Tools.ts:252](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Tools.ts#L252)
437 -
438 -Lists all tools available in the Composio SDK including custom tools.
439 -
440 -This method fetches tools from the Composio API in raw format and combines them with
441 -any registered custom tools. The response can be filtered and modified as needed.
442 -
443 -#### Parameters
444 -
445 -##### userId
446 -
447 -`string`
448 -
449 -The user ID for whom to fetch the tools
450 -
451 -##### query?
452 -
453 -`ToolListParams`
454 -
455 -Optional query parameters to filter the tools
456 -
457 -##### modifier?
458 -
459 -`TransformToolSchemaModifier`
460 -
461 -Optional function to transform tool schemas
462 -
463 -#### Returns
464 -
465 -`Promise`\<`ToolList`\>
466 -
467 -List of tools matching the query criteria
468 -
469 -#### Example
470 -
471 -```typescript
472 -// Get all tools
473 -const tools = await composio.tools.getRawComposioTools('default');
474 -
475 -// Get tools with filters
476 -const githubTools = await composio.tools.getRawComposioTools('default', {
477 - toolkits: ['github'],
478 - important: true,
479 -});
480 -
481 -// Get tools with schema transformation
482 -const tools = await composio.tools.getRawComposioTools(
483 - 'default',
484 - {},
485 - (toolSlug, toolkitSlug, tool) => {
486 - // Add custom properties to tool schema
487 - return { ...tool, customProperty: 'value' };
488 - }
489 -);
490 -```
491 -
492 ----
493 -
494 -### getToolsEnum()
495 -
496 -> **getToolsEnum**(): `Promise`\<`string`\>
497 -
498 -Defined in: [packages/core/src/models/Tools.ts:671](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Tools.ts#L671)
499 -
500 -Fetches the list of all available tools in the Composio SDK.
501 -
502 -This method is mostly used by the CLI to get the list of tools.
503 -No filtering is done on the tools, the list is cached in the backend, no further optimization is required.
504 -
505 -#### Returns
506 -
507 -`Promise`\<`string`\>
508 -
509 -The complete list of all available tools with their metadata
510 -
511 -#### Example
512 -
513 -```typescript
514 -// Get all available tools as an enum
515 -const toolsEnum = await composio.tools.getToolsEnum();
516 -console.log(toolsEnum.items);
517 -```
518 -
519 ----
520 -
521 -### proxyExecute()
522 -
523 -> **proxyExecute**(`body`): `Promise`\<`ToolProxyResponse`\>
524 -
525 -Defined in: [packages/core/src/models/Tools.ts:720](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Tools.ts#L720)
526 -
527 -Proxies a custom request to a toolkit/integration.
528 -
529 -This method allows sending custom requests to a specific toolkit or integration
530 -when you need more flexibility than the standard tool execution methods provide.
531 -
532 -#### Parameters
533 -
534 -##### body
535 -
536 -The parameters for the proxy request including toolkit slug and custom data
537 -
538 -#### Returns
539 -
540 -`Promise`\<`ToolProxyResponse`\>
541 -
542 -The response from the proxied request
543 -
544 -#### Example
545 -
546 -```typescript
547 -// Send a custom request to a toolkit
548 -const response = await composio.tools.proxyExecute({
549 - toolkitSlug: 'github',
550 - userId: 'default',
551 - data: {
552 - endpoint: '/repos/owner/repo/issues',
553 - method: 'GET',
554 - },
555 -});
556 -console.log(response.data);
557 -```
fern/pages/sdk/typescript/models/Triggers/README.mdx deleted
-11
@@ -1,11 +0,0 @@
1 -[**@composio/core**](../../README.mdx)
2 -
3 -***
4 -
5 -[@composio/core](../../README.mdx) / models/Triggers
6 -
7 -# models/Triggers
8 -
9 -## Classes
10 -
11 -- [Triggers](classes/Triggers.mdx)
fern/pages/sdk/typescript/models/Triggers/classes/Triggers.mdx deleted
-318
@@ -1,318 +0,0 @@
1 -[**@composio/core**](../../../README.mdx)
2 -
3 -***
4 -
5 -[@composio/core](../../../README.mdx) / [models/Triggers](../README.mdx) / Triggers
6 -
7 -# Class: Triggers
8 -
9 -Defined in: [packages/core/src/models/Triggers.ts:38](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Triggers.ts#L38)
10 -
11 -Trigger (Instance) class
12 -/api/v3/trigger_instances
13 -
14 -## Constructors
15 -
16 -### Constructor
17 -
18 -> **new Triggers**(`client`): `Triggers`
19 -
20 -Defined in: [packages/core/src/models/Triggers.ts:42](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Triggers.ts#L42)
21 -
22 -#### Parameters
23 -
24 -##### client
25 -
26 -`Composio`
27 -
28 -#### Returns
29 -
30 -`Triggers`
31 -
32 -## Methods
33 -
34 -### create()
35 -
36 -> **create**(`slug`, `body`): `Promise`\<\{ \}\>
37 -
38 -Defined in: [packages/core/src/models/Triggers.ts:142](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Triggers.ts#L142)
39 -
40 -Create a new trigger instance
41 -
42 -#### Parameters
43 -
44 -##### slug
45 -
46 -`string`
47 -
48 -The slug of the trigger instance
49 -
50 -##### body
51 -
52 -The parameters to create the trigger instance
53 -
54 -#### Returns
55 -
56 -`Promise`\<\{ \}\>
57 -
58 -The created trigger instance
59 -
60 -***
61 -
62 -### delete()
63 -
64 -> **delete**(`triggerId`): `Promise`\<\{ \}\>
65 -
66 -Defined in: [packages/core/src/models/Triggers.ts:191](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Triggers.ts#L191)
67 -
68 -Delete a trigger instance
69 -
70 -#### Parameters
71 -
72 -##### triggerId
73 -
74 -`string`
75 -
76 -The slug of the trigger instance
77 -
78 -#### Returns
79 -
80 -`Promise`\<\{ \}\>
81 -
82 -***
83 -
84 -### disable()
85 -
86 -> **disable**(`triggerId`): `Promise`\<`ManageUpdateResponse`\>
87 -
88 -Defined in: [packages/core/src/models/Triggers.ts:212](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Triggers.ts#L212)
89 -
90 -Disable a trigger instance
91 -
92 -#### Parameters
93 -
94 -##### triggerId
95 -
96 -`string`
97 -
98 -The id of the trigger instance
99 -
100 -#### Returns
101 -
102 -`Promise`\<`ManageUpdateResponse`\>
103 -
104 -The updated trigger instance
105 -
106 -***
107 -
108 -### enable()
109 -
110 -> **enable**(`triggerId`): `Promise`\<`ManageUpdateResponse`\>
111 -
112 -Defined in: [packages/core/src/models/Triggers.ts:224](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Triggers.ts#L224)
113 -
114 -Enable a trigger instance
115 -
116 -#### Parameters
117 -
118 -##### triggerId
119 -
120 -`string`
121 -
122 -The id of the trigger instance
123 -
124 -#### Returns
125 -
126 -`Promise`\<`ManageUpdateResponse`\>
127 -
128 -The updated trigger instance
129 -
130 -***
131 -
132 -### getType()
133 -
134 -> **getType**(`slug`): `Promise`\<`TriggersTypeRetrieveResponse`\>
135 -
136 -Defined in: [packages/core/src/models/Triggers.ts:251](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Triggers.ts#L251)
137 -
138 -Retrieve a trigger type by its slug
139 -
140 -#### Parameters
141 -
142 -##### slug
143 -
144 -`string`
145 -
146 -The slug of the trigger type
147 -
148 -#### Returns
149 -
150 -`Promise`\<`TriggersTypeRetrieveResponse`\>
151 -
152 -The trigger type object
153 -
154 -***
155 -
156 -### listActive()
157 -
158 -> **listActive**(`query?`): `Promise`\<\{ \}\>
159 -
160 -Defined in: [packages/core/src/models/Triggers.ts:93](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Triggers.ts#L93)
161 -
162 -Fetch list of all the active triggers
163 -
164 -#### Parameters
165 -
166 -##### query?
167 -
168 -The query parameters to filter the trigger instances
169 -
170 -#### Returns
171 -
172 -`Promise`\<\{ \}\>
173 -
174 -List of trigger instances
175 -
176 -#### Throws
177 -
178 -If the parameters are invalid
179 -
180 -#### Throws
181 -
182 -If the client is not authenticated
183 -
184 -#### Example
185 -
186 -```ts
187 -const triggers = await triggers.listActive({
188 - authConfigIds: ['123'],
189 - connectedAccountIds: ['456'],
190 -});
191 -```
192 -
193 -***
194 -
195 -### listEnum()
196 -
197 -> **listEnum**(): `Promise`\<`string`\>
198 -
199 -Defined in: [packages/core/src/models/Triggers.ts:262](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Triggers.ts#L262)
200 -
201 -Fetches the list of all the available trigger enums
202 -
203 -This method is used by the CLI where filters are not required.
204 -
205 -#### Returns
206 -
207 -`Promise`\<`string`\>
208 -
209 -***
210 -
211 -### listTypes()
212 -
213 -> **listTypes**(`query?`): `Promise`\<`TriggersTypeListResponse`\>
214 -
215 -Defined in: [packages/core/src/models/Triggers.ts:240](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Triggers.ts#L240)
216 -
217 -List all the trigger types
218 -
219 -#### Parameters
220 -
221 -##### query?
222 -
223 -`TriggersTypeListParams`
224 -
225 -The query parameters to filter the trigger types
226 -
227 -#### Returns
228 -
229 -`Promise`\<`TriggersTypeListResponse`\>
230 -
231 -The list of trigger types
232 -
233 -***
234 -
235 -### subscribe()
236 -
237 -> **subscribe**(`fn`, `filters`): `Promise`\<`void`\>
238 -
239 -Defined in: [packages/core/src/models/Triggers.ts:280](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Triggers.ts#L280)
240 -
241 -Subscribe to all the triggers
242 -
243 -#### Parameters
244 -
245 -##### fn
246 -
247 -(`_data`) => `void`
248 -
249 -The function to call when a trigger is received
250 -
251 -##### filters
252 -
253 -The filters to apply to the triggers
254 -
255 -#### Returns
256 -
257 -`Promise`\<`void`\>
258 -
259 -#### Example
260 -
261 -```ts
262 -
263 -triggers.subscribe((data) => {
264 - console.log(data);
265 -}, );
266 -```
267 -
268 -***
269 -
270 -### unsubscribe()
271 -
272 -> **unsubscribe**(): `Promise`\<`void`\>
273 -
274 -Defined in: [packages/core/src/models/Triggers.ts:441](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Triggers.ts#L441)
275 -
276 -Unsubscribe from all the triggers
277 -
278 -#### Returns
279 -
280 -`Promise`\<`void`\>
281 -
282 -#### Example
283 -
284 -```ts
285 -composio.trigger.subscribe((data) => {
286 - console.log(data);
287 -});
288 -
289 -await triggers.unsubscribe();
290 -```
291 -
292 -***
293 -
294 -### update()
295 -
296 -> **update**(`triggerId`, `body`): `Promise`\<\{ \}\>
297 -
298 -Defined in: [packages/core/src/models/Triggers.ts:178](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/models/Triggers.ts#L178)
299 -
300 -Update an existing trigger instance
301 -
302 -#### Parameters
303 -
304 -##### triggerId
305 -
306 -`string`
307 -
308 -The Id of the trigger instance
309 -
310 -##### body
311 -
312 -The parameters to update the trigger instance
313 -
314 -#### Returns
315 -
316 -`Promise`\<\{ \}\>
317 -
318 -The updated trigger instance response
fern/pages/sdk/typescript/provider/BaseProvider/README.mdx deleted
-16
@@ -1,16 +0,0 @@
1 -[**@composio/core**](../../README.mdx)
2 -
3 -***
4 -
5 -[@composio/core](../../README.mdx) / provider/BaseProvider
6 -
7 -# provider/BaseProvider
8 -
9 -## Classes
10 -
11 -- [BaseAgenticProvider](classes/BaseAgenticProvider.mdx)
12 -- [BaseNonAgenticProvider](classes/BaseNonAgenticProvider.mdx)
13 -
14 -## Type Aliases
15 -
16 -- [BaseComposioProvider](type-aliases/BaseComposioProvider.mdx)
fern/pages/sdk/typescript/provider/BaseProvider/classes/BaseAgenticProvider.mdx deleted
-193
@@ -1,193 +0,0 @@
1 -[**@composio/core**](../../../README.mdx)
2 -
3 -***
4 -
5 -[@composio/core](../../../README.mdx) / [provider/BaseProvider](../README.mdx) / BaseAgenticProvider
6 -
7 -# Class: `abstract` BaseAgenticProvider\<TToolCollection, TTool\>
8 -
9 -Defined in: [packages/core/src/provider/BaseProvider.ts:88](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/BaseProvider.ts#L88)
10 -
11 -Base class for all agentic toolsets.
12 -This class is not meant to be used directly, but rather to be extended by concrete provider implementations.
13 -
14 -## Extends
15 -
16 -- `BaseProvider`
17 -
18 -## Type Parameters
19 -
20 -### TToolCollection
21 -
22 -`TToolCollection`
23 -
24 -### TTool
25 -
26 -`TTool`
27 -
28 -## Constructors
29 -
30 -### Constructor
31 -
32 -> **new BaseAgenticProvider**\<`TToolCollection`, `TTool`\>(): `BaseAgenticProvider`\<`TToolCollection`, `TTool`\>
33 -
34 -#### Returns
35 -
36 -`BaseAgenticProvider`\<`TToolCollection`, `TTool`\>
37 -
38 -#### Inherited from
39 -
40 -`BaseProvider.constructor`
41 -
42 -## Properties
43 -
44 -### \_isAgentic
45 -
46 -> `readonly` **\_isAgentic**: `true` = `true`
47 -
48 -Defined in: [packages/core/src/provider/BaseProvider.ts:89](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/BaseProvider.ts#L89)
49 -
50 -**`Internal`**
51 -
52 -Whether the provider is agentic.
53 -This is set automatically set by the core SDK implementation for different provider types.
54 -
55 -#### Overrides
56 -
57 -`BaseProvider._isAgentic`
58 -
59 -***
60 -
61 -### name
62 -
63 -> `abstract` `readonly` **name**: `string`
64 -
65 -Defined in: [packages/core/src/provider/BaseProvider.ts:17](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/BaseProvider.ts#L17)
66 -
67 -The name of the provider.
68 -Used to identify the provider in the telemetry.
69 -
70 -#### Inherited from
71 -
72 -`BaseProvider.name`
73 -
74 -## Methods
75 -
76 -### \_setExecuteToolFn()
77 -
78 -> **\_setExecuteToolFn**(`executeToolFn`): `void`
79 -
80 -Defined in: [packages/core/src/provider/BaseProvider.ts:35](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/BaseProvider.ts#L35)
81 -
82 -**`Internal`**
83 -
84 -Set the function to execute a tool.
85 -This is set automatically and injected by the core SDK.
86 -
87 -#### Parameters
88 -
89 -##### executeToolFn
90 -
91 -`GlobalExecuteToolFn`
92 -
93 -#### Returns
94 -
95 -`void`
96 -
97 -#### Inherited from
98 -
99 -`BaseProvider._setExecuteToolFn`
100 -
101 -***
102 -
103 -### executeTool()
104 -
105 -> **executeTool**(`toolSlug`, `body`, `modifers?`): `Promise`\<\{ \}\>
106 -
107 -Defined in: [packages/core/src/provider/BaseProvider.ts:49](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/BaseProvider.ts#L49)
108 -
109 -Global function to execute a tool.
110 -This function is used by providerds to implement helper functions to execute tools.
111 -This is a 1:1 mapping of the `execute` method in the `Tools` class.
112 -
113 -#### Parameters
114 -
115 -##### toolSlug
116 -
117 -`string`
118 -
119 -The slug of the tool to execute.
120 -
121 -##### body
122 -
123 -The body of the tool execution.
124 -
125 -##### modifers?
126 -
127 -`ExecuteToolModifiers`
128 -
129 -The modifiers of the tool execution.
130 -
131 -#### Returns
132 -
133 -`Promise`\<\{ \}\>
134 -
135 -The result of the tool execution.
136 -
137 -#### Inherited from
138 -
139 -`BaseProvider.executeTool`
140 -
141 -***
142 -
143 -### wrapTool()
144 -
145 -> `abstract` **wrapTool**(`tool`, `executeTool`): `TTool`
146 -
147 -Defined in: [packages/core/src/provider/BaseProvider.ts:96](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/BaseProvider.ts#L96)
148 -
149 -Wrap a tool in the provider specific format.
150 -
151 -#### Parameters
152 -
153 -##### tool
154 -
155 -The tool to wrap.
156 -
157 -##### executeTool
158 -
159 -`ExecuteToolFn`
160 -
161 -#### Returns
162 -
163 -`TTool`
164 -
165 -The wrapped tool.
166 -
167 -***
168 -
169 -### wrapTools()
170 -
171 -> `abstract` **wrapTools**(`tools`, `executeTool`): `TToolCollection`
172 -
173 -Defined in: [packages/core/src/provider/BaseProvider.ts:102](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/BaseProvider.ts#L102)
174 -
175 -Wrap a list of tools in the provider specific format.
176 -
177 -#### Parameters
178 -
179 -##### tools
180 -
181 -`object`[]
182 -
183 -The tools to wrap.
184 -
185 -##### executeTool
186 -
187 -`ExecuteToolFn`
188 -
189 -#### Returns
190 -
191 -`TToolCollection`
192 -
193 -The wrapped tools.
fern/pages/sdk/typescript/provider/BaseProvider/classes/BaseNonAgenticProvider.mdx deleted
-190
@@ -1,190 +0,0 @@
1 -[**@composio/core**](../../../README.mdx)
2 -
3 -***
4 -
5 -[@composio/core](../../../README.mdx) / [provider/BaseProvider](../README.mdx) / BaseNonAgenticProvider
6 -
7 -# Class: `abstract` BaseNonAgenticProvider\<TToolCollection, TTool\>
8 -
9 -Defined in: [packages/core/src/provider/BaseProvider.ts:66](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/BaseProvider.ts#L66)
10 -
11 -Base class for all non-agentic toolsets.
12 -This class is not meant to be used directly, but rather to be extended by concrete provider implementations.
13 -
14 -## Extends
15 -
16 -- `BaseProvider`
17 -
18 -## Extended by
19 -
20 -- [`ComposioProvider`](../../ComposioProvider/classes/ComposioProvider.mdx)
21 -- [`OpenAIProvider`](../../OpenAIProvider/classes/OpenAIProvider.mdx)
22 -
23 -## Type Parameters
24 -
25 -### TToolCollection
26 -
27 -`TToolCollection`
28 -
29 -### TTool
30 -
31 -`TTool`
32 -
33 -## Constructors
34 -
35 -### Constructor
36 -
37 -> **new BaseNonAgenticProvider**\<`TToolCollection`, `TTool`\>(): `BaseNonAgenticProvider`\<`TToolCollection`, `TTool`\>
38 -
39 -#### Returns
40 -
41 -`BaseNonAgenticProvider`\<`TToolCollection`, `TTool`\>
42 -
43 -#### Inherited from
44 -
45 -`BaseProvider.constructor`
46 -
47 -## Properties
48 -
49 -### \_isAgentic
50 -
51 -> `readonly` **\_isAgentic**: `false` = `false`
52 -
53 -Defined in: [packages/core/src/provider/BaseProvider.ts:67](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/BaseProvider.ts#L67)
54 -
55 -**`Internal`**
56 -
57 -Whether the provider is agentic.
58 -This is set automatically set by the core SDK implementation for different provider types.
59 -
60 -#### Overrides
61 -
62 -`BaseProvider._isAgentic`
63 -
64 -***
65 -
66 -### name
67 -
68 -> `abstract` `readonly` **name**: `string`
69 -
70 -Defined in: [packages/core/src/provider/BaseProvider.ts:17](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/BaseProvider.ts#L17)
71 -
72 -The name of the provider.
73 -Used to identify the provider in the telemetry.
74 -
75 -#### Inherited from
76 -
77 -`BaseProvider.name`
78 -
79 -## Methods
80 -
81 -### \_setExecuteToolFn()
82 -
83 -> **\_setExecuteToolFn**(`executeToolFn`): `void`
84 -
85 -Defined in: [packages/core/src/provider/BaseProvider.ts:35](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/BaseProvider.ts#L35)
86 -
87 -**`Internal`**
88 -
89 -Set the function to execute a tool.
90 -This is set automatically and injected by the core SDK.
91 -
92 -#### Parameters
93 -
94 -##### executeToolFn
95 -
96 -`GlobalExecuteToolFn`
97 -
98 -#### Returns
99 -
100 -`void`
101 -
102 -#### Inherited from
103 -
104 -`BaseProvider._setExecuteToolFn`
105 -
106 -***
107 -
108 -### executeTool()
109 -
110 -> **executeTool**(`toolSlug`, `body`, `modifers?`): `Promise`\<\{ \}\>
111 -
112 -Defined in: [packages/core/src/provider/BaseProvider.ts:49](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/BaseProvider.ts#L49)
113 -
114 -Global function to execute a tool.
115 -This function is used by providerds to implement helper functions to execute tools.
116 -This is a 1:1 mapping of the `execute` method in the `Tools` class.
117 -
118 -#### Parameters
119 -
120 -##### toolSlug
121 -
122 -`string`
123 -
124 -The slug of the tool to execute.
125 -
126 -##### body
127 -
128 -The body of the tool execution.
129 -
130 -##### modifers?
131 -
132 -`ExecuteToolModifiers`
133 -
134 -The modifiers of the tool execution.
135 -
136 -#### Returns
137 -
138 -`Promise`\<\{ \}\>
139 -
140 -The result of the tool execution.
141 -
142 -#### Inherited from
143 -
144 -`BaseProvider.executeTool`
145 -
146 -***
147 -
148 -### wrapTool()
149 -
150 -> `abstract` **wrapTool**(`tool`): `TTool`
151 -
152 -Defined in: [packages/core/src/provider/BaseProvider.ts:74](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/BaseProvider.ts#L74)
153 -
154 -Wrap a tool in the provider specific format.
155 -
156 -#### Parameters
157 -
158 -##### tool
159 -
160 -The tool to wrap.
161 -
162 -#### Returns
163 -
164 -`TTool`
165 -
166 -The wrapped tool.
167 -
168 -***
169 -
170 -### wrapTools()
171 -
172 -> `abstract` **wrapTools**(`tools`): `TToolCollection`
173 -
174 -Defined in: [packages/core/src/provider/BaseProvider.ts:80](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/BaseProvider.ts#L80)
175 -
176 -Wrap a list of tools in the provider specific format.
177 -
178 -#### Parameters
179 -
180 -##### tools
181 -
182 -`object`[]
183 -
184 -The tools to wrap.
185 -
186 -#### Returns
187 -
188 -`TToolCollection`
189 -
190 -The wrapped tools.
fern/pages/sdk/typescript/provider/BaseProvider/type-aliases/BaseComposioProvider.mdx deleted
-26
@@ -1,26 +0,0 @@
1 -[**@composio/core**](../../../README.mdx)
2 -
3 -***
4 -
5 -[@composio/core](../../../README.mdx) / [provider/BaseProvider](../README.mdx) / BaseComposioProvider
6 -
7 -# Type Alias: BaseComposioProvider\<TToolCollection, TTool\>
8 -
9 -> **BaseComposioProvider**\<`TToolCollection`, `TTool`\> = [`BaseNonAgenticProvider`](../classes/BaseNonAgenticProvider.mdx)\<`TToolCollection`, `TTool`\> \| [`BaseAgenticProvider`](../classes/BaseAgenticProvider.mdx)\<`TToolCollection`, `TTool`\>
10 -
11 -Defined in: [packages/core/src/provider/BaseProvider.ts:110](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/BaseProvider.ts#L110)
12 -
13 -**`Internal`**
14 -
15 -Base type for all toolsets.
16 -This type is used to infer the type of the provider from the provider implementation.
17 -
18 -## Type Parameters
19 -
20 -### TToolCollection
21 -
22 -`TToolCollection`
23 -
24 -### TTool
25 -
26 -`TTool`
fern/pages/sdk/typescript/provider/ComposioProvider/README.mdx deleted
-11
@@ -1,11 +0,0 @@
1 -[**@composio/core**](../../README.mdx)
2 -
3 -***
4 -
5 -[@composio/core](../../README.mdx) / provider/ComposioProvider
6 -
7 -# provider/ComposioProvider
8 -
9 -## Classes
10 -
11 -- [ComposioProvider](classes/ComposioProvider.mdx)
fern/pages/sdk/typescript/provider/ComposioProvider/classes/ComposioProvider.mdx deleted
-183
@@ -1,183 +0,0 @@
1 -[**@composio/core**](../../../README.mdx)
2 -
3 -***
4 -
5 -[@composio/core](../../../README.mdx) / [provider/ComposioProvider](../README.mdx) / ComposioProvider
6 -
7 -# Class: ComposioProvider
8 -
9 -Defined in: [packages/core/src/provider/ComposioProvider.ts:14](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/ComposioProvider.ts#L14)
10 -
11 -Base class for all non-agentic toolsets.
12 -This class is not meant to be used directly, but rather to be extended by concrete provider implementations.
13 -
14 -## Extends
15 -
16 -- [`BaseNonAgenticProvider`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx)\<`CustomTool`[], `CustomTool`\>
17 -
18 -## Constructors
19 -
20 -### Constructor
21 -
22 -> **new ComposioProvider**(): `ComposioProvider`
23 -
24 -#### Returns
25 -
26 -`ComposioProvider`
27 -
28 -#### Inherited from
29 -
30 -[`BaseNonAgenticProvider`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx).[`constructor`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx#constructor)
31 -
32 -## Properties
33 -
34 -### \_isAgentic
35 -
36 -> `readonly` **\_isAgentic**: `false` = `false`
37 -
38 -Defined in: [packages/core/src/provider/BaseProvider.ts:67](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/BaseProvider.ts#L67)
39 -
40 -**`Internal`**
41 -
42 -Whether the provider is agentic.
43 -This is set automatically set by the core SDK implementation for different provider types.
44 -
45 -#### Inherited from
46 -
47 -[`BaseNonAgenticProvider`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx).[`_isAgentic`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx#_isagentic)
48 -
49 -***
50 -
51 -### name
52 -
53 -> `readonly` **name**: `"ComposioProvider"` = `'ComposioProvider'`
54 -
55 -Defined in: [packages/core/src/provider/ComposioProvider.ts:15](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/ComposioProvider.ts#L15)
56 -
57 -The name of the provider.
58 -Used to identify the provider in the telemetry.
59 -
60 -#### Overrides
61 -
62 -[`BaseNonAgenticProvider`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx).[`name`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx#name)
63 -
64 -## Methods
65 -
66 -### \_setExecuteToolFn()
67 -
68 -> **\_setExecuteToolFn**(`executeToolFn`): `void`
69 -
70 -Defined in: [packages/core/src/provider/BaseProvider.ts:35](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/BaseProvider.ts#L35)
71 -
72 -**`Internal`**
73 -
74 -Set the function to execute a tool.
75 -This is set automatically and injected by the core SDK.
76 -
77 -#### Parameters
78 -
79 -##### executeToolFn
80 -
81 -`GlobalExecuteToolFn`
82 -
83 -#### Returns
84 -
85 -`void`
86 -
87 -#### Inherited from
88 -
89 -[`BaseNonAgenticProvider`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx).[`_setExecuteToolFn`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx#_setexecutetoolfn)
90 -
91 -***
92 -
93 -### executeTool()
94 -
95 -> **executeTool**(`toolSlug`, `body`, `modifers?`): `Promise`\<\{ \}\>
96 -
97 -Defined in: [packages/core/src/provider/BaseProvider.ts:49](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/BaseProvider.ts#L49)
98 -
99 -Global function to execute a tool.
100 -This function is used by providerds to implement helper functions to execute tools.
101 -This is a 1:1 mapping of the `execute` method in the `Tools` class.
102 -
103 -#### Parameters
104 -
105 -##### toolSlug
106 -
107 -`string`
108 -
109 -The slug of the tool to execute.
110 -
111 -##### body
112 -
113 -The body of the tool execution.
114 -
115 -##### modifers?
116 -
117 -`ExecuteToolModifiers`
118 -
119 -The modifiers of the tool execution.
120 -
121 -#### Returns
122 -
123 -`Promise`\<\{ \}\>
124 -
125 -The result of the tool execution.
126 -
127 -#### Inherited from
128 -
129 -[`BaseNonAgenticProvider`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx).[`executeTool`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx#executetool)
130 -
131 -***
132 -
133 -### wrapTool()
134 -
135 -> **wrapTool**(`tool`): `CustomTool`
136 -
137 -Defined in: [packages/core/src/provider/ComposioProvider.ts:17](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/ComposioProvider.ts#L17)
138 -
139 -Wrap a tool in the provider specific format.
140 -
141 -#### Parameters
142 -
143 -##### tool
144 -
145 -The tool to wrap.
146 -
147 -#### Returns
148 -
149 -`CustomTool`
150 -
151 -The wrapped tool.
152 -
153 -#### Overrides
154 -
155 -[`BaseNonAgenticProvider`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx).[`wrapTool`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx#wraptool)
156 -
157 -***
158 -
159 -### wrapTools()
160 -
161 -> **wrapTools**(`tools`): `CustomTool`[]
162 -
163 -Defined in: [packages/core/src/provider/ComposioProvider.ts:21](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/ComposioProvider.ts#L21)
164 -
165 -Wrap a list of tools in the provider specific format.
166 -
167 -#### Parameters
168 -
169 -##### tools
170 -
171 -`object`[]
172 -
173 -The tools to wrap.
174 -
175 -#### Returns
176 -
177 -`CustomTool`[]
178 -
179 -The wrapped tools.
180 -
181 -#### Overrides
182 -
183 -[`BaseNonAgenticProvider`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx).[`wrapTools`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx#wraptools)
fern/pages/sdk/typescript/provider/OpenAIProvider/README.mdx deleted
-16
@@ -1,16 +0,0 @@
1 -[**@composio/core**](../../README.mdx)
2 -
3 -***
4 -
5 -[@composio/core](../../README.mdx) / provider/OpenAIProvider
6 -
7 -# provider/OpenAIProvider
8 -
9 -## Classes
10 -
11 -- [OpenAIProvider](classes/OpenAIProvider.mdx)
12 -
13 -## Type Aliases
14 -
15 -- [OpenAiTool](type-aliases/OpenAiTool.mdx)
16 -- [OpenAiToolCollection](type-aliases/OpenAiToolCollection.mdx)
fern/pages/sdk/typescript/provider/OpenAIProvider/classes/OpenAIProvider.mdx deleted
-655
@@ -1,655 +0,0 @@
1 -[**@composio/core**](../../../README.mdx)
2 -
3 -***
4 -
5 -[@composio/core](../../../README.mdx) / [provider/OpenAIProvider](../README.mdx) / OpenAIProvider
6 -
7 -# Class: OpenAIProvider
8 -
9 -Defined in: [packages/core/src/provider/OpenAIProvider.ts:20](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/OpenAIProvider.ts#L20)
10 -
11 -Base class for all non-agentic toolsets.
12 -This class is not meant to be used directly, but rather to be extended by concrete provider implementations.
13 -
14 -## Extends
15 -
16 -- [`BaseNonAgenticProvider`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx)\<[`OpenAiToolCollection`](../type-aliases/OpenAiToolCollection.mdx), [`OpenAiTool`](../type-aliases/OpenAiTool.mdx)\>
17 -
18 -## Constructors
19 -
20 -### Constructor
21 -
22 -> **new OpenAIProvider**(): `OpenAIProvider`
23 -
24 -Defined in: [packages/core/src/provider/OpenAIProvider.ts:43](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/OpenAIProvider.ts#L43)
25 -
26 -Creates a new instance of the OpenAIProvider.
27 -
28 -This is the default provider for the Composio SDK and is automatically
29 -available without additional installation.
30 -
31 -#### Returns
32 -
33 -`OpenAIProvider`
34 -
35 -#### Example
36 -
37 -```typescript
38 -// The OpenAIProvider is used by default when initializing Composio
39 -const composio = new Composio({
40 - apiKey: 'your-api-key'
41 -});
42 -
43 -// You can also explicitly specify it
44 -const composio = new Composio({
45 - apiKey: 'your-api-key',
46 - provider: new OpenAIProvider()
47 -});
48 -```
49 -
50 -#### Overrides
51 -
52 -[`BaseNonAgenticProvider`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx).[`constructor`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx#constructor)
53 -
54 -## Properties
55 -
56 -### \_isAgentic
57 -
58 -> `readonly` **\_isAgentic**: `false` = `false`
59 -
60 -Defined in: [packages/core/src/provider/BaseProvider.ts:67](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/BaseProvider.ts#L67)
61 -
62 -**`Internal`**
63 -
64 -Whether the provider is agentic.
65 -This is set automatically set by the core SDK implementation for different provider types.
66 -
67 -#### Inherited from
68 -
69 -[`BaseNonAgenticProvider`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx).[`_isAgentic`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx#_isagentic)
70 -
71 -***
72 -
73 -### name
74 -
75 -> `readonly` **name**: `"openai"` = `'openai'`
76 -
77 -Defined in: [packages/core/src/provider/OpenAIProvider.ts:21](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/OpenAIProvider.ts#L21)
78 -
79 -The name of the provider.
80 -Used to identify the provider in the telemetry.
81 -
82 -#### Overrides
83 -
84 -[`BaseNonAgenticProvider`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx).[`name`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx#name)
85 -
86 -## Methods
87 -
88 -### \_setExecuteToolFn()
89 -
90 -> **\_setExecuteToolFn**(`executeToolFn`): `void`
91 -
92 -Defined in: [packages/core/src/provider/BaseProvider.ts:35](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/BaseProvider.ts#L35)
93 -
94 -**`Internal`**
95 -
96 -Set the function to execute a tool.
97 -This is set automatically and injected by the core SDK.
98 -
99 -#### Parameters
100 -
101 -##### executeToolFn
102 -
103 -`GlobalExecuteToolFn`
104 -
105 -#### Returns
106 -
107 -`void`
108 -
109 -#### Inherited from
110 -
111 -[`BaseNonAgenticProvider`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx).[`_setExecuteToolFn`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx#_setexecutetoolfn)
112 -
113 -***
114 -
115 -### executeTool()
116 -
117 -> **executeTool**(`toolSlug`, `body`, `modifers?`): `Promise`\<\{ \}\>
118 -
119 -Defined in: [packages/core/src/provider/BaseProvider.ts:49](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/BaseProvider.ts#L49)
120 -
121 -Global function to execute a tool.
122 -This function is used by providerds to implement helper functions to execute tools.
123 -This is a 1:1 mapping of the `execute` method in the `Tools` class.
124 -
125 -#### Parameters
126 -
127 -##### toolSlug
128 -
129 -`string`
130 -
131 -The slug of the tool to execute.
132 -
133 -##### body
134 -
135 -The body of the tool execution.
136 -
137 -##### modifers?
138 -
139 -`ExecuteToolModifiers`
140 -
141 -The modifiers of the tool execution.
142 -
143 -#### Returns
144 -
145 -`Promise`\<\{ \}\>
146 -
147 -The result of the tool execution.
148 -
149 -#### Inherited from
150 -
151 -[`BaseNonAgenticProvider`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx).[`executeTool`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx#executetool)
152 -
153 -***
154 -
155 -### executeToolCall()
156 -
157 -> **executeToolCall**(`userId`, `tool`, `options?`, `modifiers?`): `Promise`\<`string`\>
158 -
159 -Defined in: [packages/core/src/provider/OpenAIProvider.ts:160](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/OpenAIProvider.ts#L160)
160 -
161 -Executes a tool call from OpenAI's chat completion.
162 -
163 -This method processes a tool call from OpenAI's chat completion API,
164 -executes the corresponding Composio tool, and returns the result.
165 -
166 -#### Parameters
167 -
168 -##### userId
169 -
170 -`string`
171 -
172 -The user ID for authentication and tracking
173 -
174 -##### tool
175 -
176 -`ChatCompletionMessageToolCall`
177 -
178 -The tool call from OpenAI
179 -
180 -##### options?
181 -
182 -`ExecuteToolFnOptions`
183 -
184 -Optional execution options
185 -
186 -##### modifiers?
187 -
188 -`ExecuteToolModifiers`
189 -
190 -Optional execution modifiers
191 -
192 -#### Returns
193 -
194 -`Promise`\<`string`\>
195 -
196 -The result of the tool call as a JSON string
197 -
198 -#### Example
199 -
200 -```typescript
201 -// Execute a tool call from OpenAI
202 -const toolCall = {
203 - id: 'call_abc123',
204 - type: 'function',
205 - function: {
206 - name: 'SEARCH_TOOL',
207 - arguments: '{"query":"composio documentation"}'
208 - }
209 -};
210 -
211 -const result = await provider.executeToolCall(
212 - 'user123',
213 - toolCall,
214 - { connectedAccountId: 'conn_xyz456' }
215 -);
216 -console.log(JSON.parse(result));
217 -```
218 -
219 -***
220 -
221 -### handleAssistantMessage()
222 -
223 -> **handleAssistantMessage**(`userId`, `run`, `options?`, `modifiers?`): `Promise`\<`ToolOutput`[]\>
224 -
225 -Defined in: [packages/core/src/provider/OpenAIProvider.ts:282](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/OpenAIProvider.ts#L282)
226 -
227 -Handles all the tool calls from the OpenAI Assistant API.
228 -
229 -This method processes tool calls from an OpenAI Assistant run,
230 -executes each tool call, and returns the tool outputs for submission.
231 -
232 -#### Parameters
233 -
234 -##### userId
235 -
236 -`string`
237 -
238 -The user ID for authentication and tracking
239 -
240 -##### run
241 -
242 -`Run`
243 -
244 -The Assistant run object containing tool calls
245 -
246 -##### options?
247 -
248 -`ExecuteToolFnOptions`
249 -
250 -Optional execution options
251 -
252 -##### modifiers?
253 -
254 -`ExecuteToolModifiers`
255 -
256 -Optional execution modifiers
257 -
258 -#### Returns
259 -
260 -`Promise`\<`ToolOutput`[]\>
261 -
262 -Array of tool outputs for submission
263 -
264 -#### Example
265 -
266 -```typescript
267 -// Handle tool calls from an OpenAI Assistant run
268 -const run = {
269 - id: 'run_abc123',
270 - required_action: {
271 - submit_tool_outputs: {
272 - tool_calls: [
273 - {
274 - id: 'call_xyz789',
275 - type: 'function',
276 - function: {
277 - name: 'SEARCH_TOOL',
278 - arguments: '{"query":"composio documentation"}'
279 - }
280 - }
281 - ]
282 - }
283 - }
284 -};
285 -
286 -const toolOutputs = await provider.handleAssistantMessage(
287 - 'user123',
288 - run,
289 - { connectedAccountId: 'conn_xyz456' }
290 -);
291 -
292 -// Submit tool outputs back to OpenAI
293 -await openai.beta.threads.runs.submitToolOutputs(
294 - thread.id,
295 - run.id,
296 - { tool_outputs: toolOutputs }
297 -);
298 -```
299 -
300 -***
301 -
302 -### handleToolCalls()
303 -
304 -> **handleToolCalls**(`userId`, `chatCompletion`, `options?`, `modifiers?`): `Promise`\<`string`[]\>
305 -
306 -Defined in: [packages/core/src/provider/OpenAIProvider.ts:218](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/OpenAIProvider.ts#L218)
307 -
308 -Handles tool calls from OpenAI's chat completion response.
309 -
310 -This method processes tool calls from an OpenAI chat completion response,
311 -executes each tool call, and returns the results.
312 -
313 -#### Parameters
314 -
315 -##### userId
316 -
317 -`string`
318 -
319 -The user ID for authentication and tracking
320 -
321 -##### chatCompletion
322 -
323 -`ChatCompletion`
324 -
325 -The chat completion response from OpenAI
326 -
327 -##### options?
328 -
329 -`ExecuteToolFnOptions`
330 -
331 -Optional execution options
332 -
333 -##### modifiers?
334 -
335 -`ExecuteToolModifiers`
336 -
337 -Optional execution modifiers
338 -
339 -#### Returns
340 -
341 -`Promise`\<`string`[]\>
342 -
343 -Array of tool execution results as JSON strings
344 -
345 -#### Example
346 -
347 -```typescript
348 -// Handle tool calls from a chat completion response
349 -const chatCompletion = {
350 - choices: [
351 - {
352 - message: {
353 - tool_calls: [
354 - {
355 - id: 'call_abc123',
356 - type: 'function',
357 - function: {
358 - name: 'SEARCH_TOOL',
359 - arguments: '{"query":"composio documentation"}'
360 - }
361 - }
362 - ]
363 - }
364 - }
365 - ]
366 -};
367 -
368 -const results = await provider.handleToolCalls(
369 - 'user123',
370 - chatCompletion,
371 - { connectedAccountId: 'conn_xyz456' }
372 -);
373 -console.log(results); // Array of tool execution results
374 -```
375 -
376 -***
377 -
378 -### waitAndHandleAssistantStreamToolCalls()
379 -
380 -> **waitAndHandleAssistantStreamToolCalls**(`userId`, `client`, `runStream`, `thread`, `options?`, `modifiers?`): `AsyncGenerator`\<`AssistantStreamEvent`, `void`, `unknown`\>
381 -
382 -Defined in: [packages/core/src/provider/OpenAIProvider.ts:354](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/OpenAIProvider.ts#L354)
383 -
384 -Waits for the assistant stream and handles the tool calls.
385 -
386 -This method processes an OpenAI Assistant stream, handles any tool calls
387 -that require action, and yields each event from the stream. It's designed
388 -for streaming Assistant responses while handling tool calls in real-time.
389 -
390 -#### Parameters
391 -
392 -##### userId
393 -
394 -`string`
395 -
396 -The user ID for authentication and tracking
397 -
398 -##### client
399 -
400 -`OpenAI`
401 -
402 -The OpenAI client instance
403 -
404 -##### runStream
405 -
406 -`Stream`\<`AssistantStreamEvent`\>
407 -
408 -The Assistant run stream
409 -
410 -##### thread
411 -
412 -`Thread`
413 -
414 -The thread object
415 -
416 -##### options?
417 -
418 -`ExecuteToolFnOptions`
419 -
420 -Optional execution options
421 -
422 -##### modifiers?
423 -
424 -`ExecuteToolModifiers`
425 -
426 -Optional execution modifiers
427 -
428 -#### Returns
429 -
430 -`AsyncGenerator`\<`AssistantStreamEvent`, `void`, `unknown`\>
431 -
432 -Generator yielding stream events
433 -
434 -#### Example
435 -
436 -```typescript
437 -// Process an OpenAI Assistant stream with tool calls
438 -const thread = await openai.beta.threads.create();
439 -const runStream = openai.beta.threads.runs.stream(thread.id, {
440 - assistant_id: 'asst_abc123',
441 - tools: provider.wrapTools(composioTools)
442 -});
443 -
444 -// Process the stream and handle tool calls
445 -const streamProcessor = provider.waitAndHandleAssistantStreamToolCalls(
446 - 'user123',
447 - openai,
448 - runStream,
449 - thread,
450 - { connectedAccountId: 'conn_xyz456' }
451 -);
452 -
453 -// Consume the stream events
454 -for await (const event of streamProcessor) {
455 - if (event.event === 'thread.message.delta') {
456 - console.log(event.data.delta.content);
457 - }
458 -}
459 -```
460 -
461 -***
462 -
463 -### waitAndHandleAssistantToolCalls()
464 -
465 -> **waitAndHandleAssistantToolCalls**(`userId`, `client`, `run`, `thread`, `options?`, `modifiers?`): `Promise`\<`Run`\>
466 -
467 -Defined in: [packages/core/src/provider/OpenAIProvider.ts:472](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/OpenAIProvider.ts#L472)
468 -
469 -Waits for the assistant tool calls and handles them.
470 -
471 -This method polls an OpenAI Assistant run until it completes or requires action,
472 -handles any tool calls, and returns the final run object. It's designed for
473 -non-streaming Assistant interactions.
474 -
475 -#### Parameters
476 -
477 -##### userId
478 -
479 -`string`
480 -
481 -The user ID for authentication and tracking
482 -
483 -##### client
484 -
485 -`OpenAI`
486 -
487 -The OpenAI client instance
488 -
489 -##### run
490 -
491 -`Run`
492 -
493 -The initial run object
494 -
495 -##### thread
496 -
497 -`Thread`
498 -
499 -The thread object
500 -
501 -##### options?
502 -
503 -`ExecuteToolFnOptions`
504 -
505 -Optional execution options
506 -
507 -##### modifiers?
508 -
509 -`ExecuteToolModifiers`
510 -
511 -Optional execution modifiers
512 -
513 -#### Returns
514 -
515 -`Promise`\<`Run`\>
516 -
517 -The final run object after completion
518 -
519 -#### Example
520 -
521 -```typescript
522 -// Process an OpenAI Assistant run with tool calls
523 -const thread = await openai.beta.threads.create();
524 -await openai.beta.threads.messages.create(thread.id, {
525 - role: 'user',
526 - content: 'Find information about Composio'
527 -});
528 -
529 -let run = await openai.beta.threads.runs.create(thread.id, {
530 - assistant_id: 'asst_abc123',
531 - tools: provider.wrapTools(composioTools)
532 -});
533 -
534 -// Wait for the run to complete, handling any tool calls
535 -run = await provider.waitAndHandleAssistantToolCalls(
536 - 'user123',
537 - openai,
538 - run,
539 - thread,
540 - { connectedAccountId: 'conn_xyz456' }
541 -);
542 -
543 -// Get the final messages after run completion
544 -const messages = await openai.beta.threads.messages.list(thread.id);
545 -console.log(messages.data[0].content);
546 -```
547 -
548 -***
549 -
550 -### wrapTool()
551 -
552 -> **wrapTool**(`tool`): `ChatCompletionTool`
553 -
554 -Defined in: [packages/core/src/provider/OpenAIProvider.ts:74](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/OpenAIProvider.ts#L74)
555 -
556 -Wraps a Composio tool in the OpenAI function calling format.
557 -
558 -This method transforms a Composio tool definition into the format
559 -expected by OpenAI's function calling API.
560 -
561 -#### Parameters
562 -
563 -##### tool
564 -
565 -The Composio tool to wrap
566 -
567 -#### Returns
568 -
569 -`ChatCompletionTool`
570 -
571 -The wrapped tool in OpenAI format
572 -
573 -#### Example
574 -
575 -```typescript
576 -// Wrap a single tool for use with OpenAI
577 -const composioTool = {
578 - slug: 'SEARCH_TOOL',
579 - description: 'Search for information',
580 - inputParameters: {
581 - type: 'object',
582 - properties: {
583 - query: { type: 'string' }
584 - },
585 - required: ['query']
586 - }
587 -};
588 -
589 -const openAITool = provider.wrapTool(composioTool);
590 -```
591 -
592 -#### Overrides
593 -
594 -[`BaseNonAgenticProvider`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx).[`wrapTool`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx#wraptool)
595 -
596 -***
597 -
598 -### wrapTools()
599 -
600 -> **wrapTools**(`tools`): [`OpenAiToolCollection`](../type-aliases/OpenAiToolCollection.mdx)
601 -
602 -Defined in: [packages/core/src/provider/OpenAIProvider.ts:124](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/OpenAIProvider.ts#L124)
603 -
604 -Wraps multiple Composio tools in the OpenAI function calling format.
605 -
606 -This method transforms a list of Composio tools into the format
607 -expected by OpenAI's function calling API.
608 -
609 -#### Parameters
610 -
611 -##### tools
612 -
613 -`object`[]
614 -
615 -Array of Composio tools to wrap
616 -
617 -#### Returns
618 -
619 -[`OpenAiToolCollection`](../type-aliases/OpenAiToolCollection.mdx)
620 -
621 -Array of wrapped tools in OpenAI format
622 -
623 -#### Example
624 -
625 -```typescript
626 -// Wrap multiple tools for use with OpenAI
627 -const composioTools = [
628 - {
629 - slug: 'SEARCH_TOOL',
630 - description: 'Search for information',
631 - inputParameters: {
632 - type: 'object',
633 - properties: {
634 - query: { type: 'string' }
635 - }
636 - }
637 - },
638 - {
639 - slug: 'WEATHER_TOOL',
640 - description: 'Get weather information',
641 - inputParameters: {
642 - type: 'object',
643 - properties: {
644 - location: { type: 'string' }
645 - }
646 - }
647 - }
648 -];
649 -
650 -const openAITools = provider.wrapTools(composioTools);
651 -```
652 -
653 -#### Overrides
654 -
655 -[`BaseNonAgenticProvider`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx).[`wrapTools`](../../BaseProvider/classes/BaseNonAgenticProvider.mdx#wraptools)
fern/pages/sdk/typescript/provider/OpenAIProvider/type-aliases/OpenAiTool.mdx deleted
-11
@@ -1,11 +0,0 @@
1 -[**@composio/core**](../../../README.mdx)
2 -
3 -***
4 -
5 -[@composio/core](../../../README.mdx) / [provider/OpenAIProvider](../README.mdx) / OpenAiTool
6 -
7 -# Type Alias: OpenAiTool
8 -
9 -> **OpenAiTool** = `OpenAI.ChatCompletionTool`
10 -
11 -Defined in: [packages/core/src/provider/OpenAIProvider.ts:18](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/OpenAIProvider.ts#L18)
fern/pages/sdk/typescript/provider/OpenAIProvider/type-aliases/OpenAiToolCollection.mdx deleted
-11
@@ -1,11 +0,0 @@
1 -[**@composio/core**](../../../README.mdx)
2 -
3 -***
4 -
5 -[@composio/core](../../../README.mdx) / [provider/OpenAIProvider](../README.mdx) / OpenAiToolCollection
6 -
7 -# Type Alias: OpenAiToolCollection
8 -
9 -> **OpenAiToolCollection** = [`OpenAiTool`](OpenAiTool.mdx)[]
10 -
11 -Defined in: [packages/core/src/provider/OpenAIProvider.ts:19](https://github.com/ComposioHQ/sdk-v3-ts/blob/d452a596cdc5436dd82cd6e55ff43fd070539a9c/packages/core/src/provider/OpenAIProvider.ts#L19)
fern/pages/tool-calling/after-execution-modifiers.mdx deleted
-121
@@ -1,121 +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: "Learn how to use after execution modifiers to transform tool results after execution."
6 -hide-nav-links: false
7 ----
8 -
9 -
10 -After execution modifiers are part of Composio SDK's powerful middleware capabilities that allow you to customize and extend the behavior of tools.
11 -
12 -## After Execution Modifiers
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 -- Modifying or truncating the output of the tool.
17 -- Convert the output to a different format before returning it to the agent.
18 -
19 -<Frame>
20 - <img src="../../assets/images/after-execute.png" alt="After Execution Modifier" />
21 -</Frame>
22 -
23 -<Note>Below we use the `afterToolExecute` modifier to truncate the output of the `HACKERNEWS_GET_USER` tool and only return the karma of the user.</Note>
24 -
25 -<Tabs>
26 -<Tab title="With Chat Completions">
27 -Since completion providers don't have a function execution step -- Composio will execute the tool call directly.
28 -
29 -Hence, the modifier is configured on the `tools.execute` method.
30 -
31 -<CodeGroup>
32 -```typescript TypeScript maxLines=60 wordWrap
33 -const response = await openai.chat.completions.create({
34 - model: "gpt-4o-mini",
35 - messages,
36 - tools: tools,
37 - tool_choice: "auto",
38 -});
39 -
40 -console.log(response.choices[0].message.tool_calls);
41 -
42 -if (response.choices[0].message.tool_calls) {
43 - const result = await composio.tools.execute(
44 - "HACKERNEWS_GET_USER",
45 - {
46 - userId: userId,
47 - arguments: JSON.parse(
48 - response.choices[0].message.tool_calls[0].function.arguments
49 - ),
50 - },
51 - {
52 - afterToolExecute: (toolSlug, _, result) => {
53 - if (toolSlug === "HACKERNEWS_GET_USER") {
54 - const { data } = result;
55 - const responseData = data.response_data as { karma: number };
56 - return {
57 - ...result,
58 - data: {
59 - karma: responseData.karma
60 - },
61 - };
62 - }
63 - return result;
64 - },
65 - }
66 - );
67 - console.log(JSON.stringify(result, null, 2));
68 -}
69 -```
70 -```python Python maxLines=60 wordWrap
71 -
72 -```
73 -</CodeGroup>
74 -</Tab>
75 -
76 -<Tab title="With Agentic Frameworks">
77 -Agentic providers have a function execution step.
78 -The modifier is configured on the `tools.get` method which modifies the execution logic within the framework!
79 -<CodeGroup>
80 -```typescript TypeScript maxLines=60 wordWrap {24-27}
81 -import { Composio } from "@composio/core";
82 -import { VercelProvider } from "@composio/vercel";
83 -import { generateText } from "ai";
84 -import { openai } from "@ai-sdk/openai";
85 -import { v4 as uuidv4 } from "uuid";
86 -
87 -const composio = new Composio({
88 - apiKey: process.env.COMPOSIO_API_KEY,
89 - provider: new VercelProvider(),
90 -});
91 -
92 -const userId = uuidv4(); // The user's ID.
93 -
94 -const agenticTools = await composio.tools.get(
95 - userId,
96 - {
97 - tools: ["HACKERNEWS_GET_USER"],
98 - },
99 - {
100 - afterExecute: (toolSlug, toolkitSlug, result) => {
101 - if (toolSlug === "HACKERNEWS_GET_USER") {
102 - const { data } = result;
103 - const responseData = data.response_data as { karma: number };
104 - return {
105 - ...result,
106 - data: {
107 - karma: responseData.karma
108 - },
109 - };
110 - }
111 - return result;
112 - },
113 - }
114 -);
115 -```
116 -```python Python maxLines=60 wordWrap
117 -
118 -```
119 -</CodeGroup>
120 -</Tab>
121 -</Tabs>
\ No newline at end of file
fern/pages/tool-calling/schema-modifiers.mdx deleted
-115
@@ -1,115 +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: "Learn how to use schema modifiers to transform tool schemas before they are seen by 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 -Schema modifiers transform a tool's schema before the tool is seen by an agent.
13 -
14 -<Frame>
15 - <img src="../../assets/images/schema-modifier.png" alt="Schema Modifier" />
16 -</Frame>
17 -**Useful for:**
18 -- Adding arguments to the tool. For example, adding a `thought` argument to the tool to prompt the agent to explain the reasoning.
19 -- Hiding arguments from the tool. In cases where the argument is irrelevant to the tool.
20 -- Adding extra arguments to the tool schema for custom use cases or execution.
21 -- Adding default values to tool arguments.
22 -
23 -<Note>
24 -Below we modify the schema of the `HACKERNEWS_GET_LATEST_POSTS` to make the `size` argument required and remove the `page` argument.
25 -</Note>
26 -
27 -<CodeGroup>
28 -```typescript TypeScript maxLines=60 wordWrap
29 -const userId = "your@email.com";
30 -
31 -const tools = await composio.tools.get(
32 - userId,
33 - {
34 - tools: ["HACKERNEWS_GET_LATEST_POSTS", "HACKERNEWS_GET_USER"],
35 - },
36 - {
37 - modifyToolSchema: (toolSlug, _, toolSchema) => {
38 - if (toolSlug === "HACKERNEWS_GET_LATEST_POSTS") {
39 - const { inputParameters } = toolSchema;
40 - if (inputParameters?.properties) {
41 - delete inputParameters.properties["page"];
42 - }
43 - inputParameters.required = ["size"];
44 - }
45 - return toolSchema;
46 - },
47 - }
48 -);
49 -
50 -console.log(JSON.stringify(tools, null, 2));
51 -```
52 -```python Python maxLines=60 wordWrap
53 -
54 -```
55 -</CodeGroup>
56 -
57 -In using the above modified tool schema, the `page` argument is removed and the `size` argument is required.
58 -
59 -You can test this out by viewing the tool call response in the LLM too!
60 -
61 -<Accordion title="Schema modified tool call">
62 -<CodeGroup>
63 -
64 -```typescript TypeScript maxLines=60 wordWrap
65 -import { Composio } from "@composio/core";
66 -import { OpenAI } from "openai";
67 -
68 -const composio = new Composio({
69 - apiKey: process.env.COMPOSIO_API_KEY,
70 -});
71 -const openai = new OpenAI();
72 -
73 -const userId = "your@email.com";
74 -
75 -const tools = await composio.tools.get(
76 - userId,
77 - {
78 - tools: ["HACKERNEWS_GET_LATEST_POSTS", "HACKERNEWS_GET_USER"],
79 - },
80 - {
81 - modifyToolSchema: (toolSlug, _, toolSchema) => {
82 - if (toolSlug === "HACKERNEWS_GET_LATEST_POSTS") {
83 - const { inputParameters } = toolSchema;
84 - if (inputParameters?.properties) {
85 - delete inputParameters.properties["page"];
86 - }
87 - inputParameters.required = ["size"];
88 - }
89 - return toolSchema;
90 - },
91 - }
92 -);
93 -
94 -console.log(JSON.stringify(tools, null, 2));
95 -
96 -const response = await openai.chat.completions.create({
97 - model: "gpt-4o-mini",
98 - messages: [
99 - {
100 - role: "system",
101 - content: "You are a helpful assistant that can help with tasks.",
102 - },
103 - { role: "user", content: "Get the latest posts from Hacker News" },
104 - ],
105 - tools: tools,
106 - tool_choice: "auto",
107 -});
108 -
109 -console.log(response.choices[0].message.tool_calls);
110 -```
111 -```python Python maxLines=60 wordWrap
112 -
113 -```
114 -</CodeGroup>
115 -</Accordion>
\ No newline at end of file
fern/scripts/build-snippets.ts new
+280
@@ -0,0 +1,280 @@
1 +#!/usr/bin/env bun
2 +/* eslint-disable no-console */
3 +
4 +import fs, { watch } from 'fs';
5 +import path from 'path';
6 +
7 +const DOCS_SRC_DIR = path.join(import.meta.dir, '../docs');
8 +const PAGES_DIR = path.join(import.meta.dir, '../pages');
9 +const PROJECT_ROOT = path.join(import.meta.dir, '../..');
10 +
11 +interface SnippetCodeProps {
12 + src: string;
13 + startLine?: number;
14 + endLine?: number;
15 + highlightStart?: number;
16 + highlightEnd?: number;
17 + title?: string;
18 + language?: string;
19 +}
20 +
21 +function ensureDistDir() {
22 + // Remove existing pages directory to ensure clean build
23 + if (fs.existsSync(PAGES_DIR)) {
24 + fs.rmSync(PAGES_DIR, { recursive: true, force: true });
25 + console.log('🧹 Cleaned existing pages directory');
26 + }
27 +
28 + // Create fresh pages directory
29 + fs.mkdirSync(PAGES_DIR, { recursive: true });
30 +}
31 +
32 +function getLanguageFromPath(filePath: string): { syntax: string; displayName: string } {
33 + const extension = filePath.split('.').pop()?.toLowerCase();
34 + const languageMap: Record<string, { syntax: string; displayName: string }> = {
35 + py: { syntax: 'python', displayName: 'Python' },
36 + js: { syntax: 'javascript', displayName: 'JavaScript' },
37 + ts: { syntax: 'typescript', displayName: 'TypeScript' },
38 + tsx: { syntax: 'typescript', displayName: 'TypeScript' },
39 + jsx: { syntax: 'javascript', displayName: 'JavaScript' },
40 + java: { syntax: 'java', displayName: 'Java' },
41 + cpp: { syntax: 'cpp', displayName: 'C++' },
42 + c: { syntax: 'c', displayName: 'C' },
43 + go: { syntax: 'go', displayName: 'Go' },
44 + rs: { syntax: 'rust', displayName: 'Rust' },
45 + php: { syntax: 'php', displayName: 'PHP' },
46 + rb: { syntax: 'ruby', displayName: 'Ruby' },
47 + swift: { syntax: 'swift', displayName: 'Swift' },
48 + kt: { syntax: 'kotlin', displayName: 'Kotlin' },
49 + scala: { syntax: 'scala', displayName: 'Scala' },
50 + sh: { syntax: 'bash', displayName: 'Bash' },
51 + yml: { syntax: 'yaml', displayName: 'YAML' },
52 + yaml: { syntax: 'yaml', displayName: 'YAML' },
53 + json: { syntax: 'json', displayName: 'JSON' },
54 + xml: { syntax: 'xml', displayName: 'XML' },
55 + html: { syntax: 'html', displayName: 'HTML' },
56 + css: { syntax: 'css', displayName: 'CSS' },
57 + scss: { syntax: 'scss', displayName: 'SCSS' },
58 + sql: { syntax: 'sql', displayName: 'SQL' },
59 + };
60 + return languageMap[extension || ''] || { syntax: 'text', displayName: 'Text' };
61 +}
62 +
63 +function readFileLines(filePath: string, startLine?: number, endLine?: number): string {
64 + try {
65 + const fullPath = path.resolve(PROJECT_ROOT, filePath);
66 + const content = fs.readFileSync(fullPath, 'utf8');
67 + const lines = content.split('\n');
68 +
69 + const start = startLine ? startLine - 1 : 0;
70 + const end = endLine ? endLine : lines.length;
71 +
72 + return lines.slice(start, end).join('\n');
73 + } catch (error) {
74 + console.warn(`⚠️ Failed to read file: ${filePath}`, error);
75 + return `// File not found: ${filePath}`;
76 + }
77 +}
78 +
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 +function parseSnippetCodeTags(content: string): string {
97 + const exampleCodeRegex = /<SnippetCode\s+([^>]*?)(?:\s*\/?>|>\s*<\/SnippetCode>)/g;
98 +
99 + return content.replace(exampleCodeRegex, (match, propsString) => {
100 + // Parse props from the tag
101 + const props: Partial<SnippetCodeProps> = {};
102 +
103 + // Extract src
104 + const srcMatch = propsString.match(/src=["']([^"']+)["']/);
105 + if (srcMatch) props.src = srcMatch[1];
106 +
107 + // Extract other numeric props (handle both JSX {1} and quoted "1" syntax)
108 + const startLineMatch = propsString.match(/startLine=(?:["'](\d+)["']|{(\d+)})/);
109 + if (startLineMatch) props.startLine = parseInt(startLineMatch[1] || startLineMatch[2]);
110 +
111 + const endLineMatch = propsString.match(/endLine=(?:["'](\d+)["']|{(\d+)})/);
112 + if (endLineMatch) props.endLine = parseInt(endLineMatch[1] || endLineMatch[2]);
113 +
114 + const highlightStartMatch = propsString.match(/highlightStart=(?:["'](\d+)["']|{(\d+)})/);
115 + if (highlightStartMatch)
116 + props.highlightStart = parseInt(highlightStartMatch[1] || highlightStartMatch[2]);
117 +
118 + const highlightEndMatch = propsString.match(/highlightEnd=(?:["'](\d+)["']|{(\d+)})/);
119 + if (highlightEndMatch)
120 + props.highlightEnd = parseInt(highlightEndMatch[1] || highlightEndMatch[2]);
121 +
122 + // Extract string props
123 + const titleMatch = propsString.match(/title=["']([^"']+)["']/);
124 + if (titleMatch) props.title = titleMatch[1];
125 +
126 + const languageMatch = propsString.match(/language=["']([^"']+)["']/);
127 + if (languageMatch) props.language = languageMatch[1];
128 +
129 + if (!props.src) {
130 + console.warn('⚠️ SnippetCode tag missing src attribute:', match);
131 + return '```\n// Error: SnippetCode tag missing src attribute\n```';
132 + }
133 +
134 + // Read the file content
135 + const codeContent = readFileLines(props.src, props.startLine, props.endLine);
136 + const langInfo = getLanguageFromPath(props.src);
137 + const syntax = props.language || langInfo.syntax;
138 + const displayName = langInfo.displayName;
139 +
140 + // Generate highlight string if needed
141 + const highlightString =
142 + props.highlightStart && props.highlightEnd
143 + ? generateHighlightString(props.startLine || 1, props.highlightStart, props.highlightEnd)
144 + : '';
145 +
146 + // Use provided title or fall back to language display name
147 + const title = props.title || displayName;
148 + const titleComment = ` title="${title}"`;
149 +
150 + // Create the code block with syntax, display name, and maxLines
151 + const codeBlock = `\`\`\`${syntax} ${displayName}${highlightString ? ` ${highlightString}` : ''}${titleComment} maxLines=40\n${codeContent}\n\`\`\``;
152 +
153 + return codeBlock;
154 + });
155 +}
156 +
157 +function processFile(srcPath: string, distPath: string) {
158 + try {
159 + const content = fs.readFileSync(srcPath, 'utf8');
160 + const processedContent = parseSnippetCodeTags(content);
161 +
162 + // Ensure the directory exists
163 + const distDir = path.dirname(distPath);
164 + if (!fs.existsSync(distDir)) {
165 + fs.mkdirSync(distDir, { recursive: true });
166 + }
167 +
168 + fs.writeFileSync(distPath, processedContent);
169 + console.log(
170 + `✅ Processed: ${path.relative(DOCS_SRC_DIR, srcPath)} -> ${path.relative(PAGES_DIR, distPath)}`
171 + );
172 + } catch (error) {
173 + console.error(`❌ Error processing ${srcPath}:`, error);
174 + }
175 +}
176 +
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(DOCS_SRC_DIR, srcPath);
193 +
194 + // Check if this file is in the SDK directory
195 + const isInSDK = relativePath.startsWith('sdk/') || relativePath.startsWith('sdk\\');
196 +
197 + // If in SDK, preserve directory structure; otherwise flatten
198 + const distPath = isInSDK
199 + ? path.join(PAGES_DIR, relativePath)
200 + : path.join(PAGES_DIR, entry.name);
201 +
202 + processFile(srcPath, distPath);
203 + }
204 + }
205 + }
206 +
207 + processDirectory(DOCS_SRC_DIR);
208 + console.log('✅ All files processed');
209 +}
210 +
211 +// Watch for changes and reprocess
212 +function startWatchMode() {
213 + console.log('👀 Watching for changes...');
214 +
215 + const watcher = watch(DOCS_SRC_DIR, { recursive: true }, (eventType, filename) => {
216 + if (!filename) return;
217 + if (!filename.endsWith('.mdx')) return;
218 +
219 + const srcPath = path.join(DOCS_SRC_DIR, filename);
220 +
221 + // Check if this file is in the SDK directory
222 + const isInSDK = filename.startsWith('sdk/') || filename.startsWith('sdk\\');
223 +
224 + // If in SDK, preserve directory structure; otherwise flatten
225 + const distPath = isInSDK
226 + ? path.join(PAGES_DIR, filename)
227 + : path.join(PAGES_DIR, path.basename(filename));
228 +
229 + if (eventType === 'change' && fs.existsSync(srcPath)) {
230 + console.log(`🔄 File changed: ${filename}`);
231 + processFile(srcPath, distPath);
232 + }
233 + });
234 +
235 + // Also watch source files that might be referenced
236 + const sourceWatcher = watch(PROJECT_ROOT, { recursive: true }, (eventType, filename) => {
237 + if (!filename) return;
238 + if (filename.includes('node_modules')) return;
239 + if (filename.includes('.git')) return;
240 + if (filename.includes('fern/pages')) return; // Skip pages (output) files
241 + if (filename.includes('fern/scripts')) return; // Skip the script itself
242 +
243 + // If a source file changes, reprocess all .mdx files since we don't know which ones reference it
244 + if (
245 + eventType === 'change' &&
246 + (filename.endsWith('.ts') || filename.endsWith('.js') || filename.endsWith('.py'))
247 + ) {
248 + console.log(`🔄 Source file changed: ${filename}, reprocessing all .mdx files...`);
249 + processAllFiles();
250 + }
251 + });
252 +
253 + // Cleanup on exit
254 + process.on('SIGINT', () => {
255 + console.log('\n👋 Stopping watchers...');
256 + watcher.close();
257 + sourceWatcher.close();
258 + process.exit(0);
259 + });
260 +}
261 +
262 +// Main function
263 +function main() {
264 + console.log('🚀 Starting SnippetCode processor...');
265 +
266 + ensureDistDir();
267 + processAllFiles();
268 +
269 + // Check if we should run in watch mode
270 + const isWatchMode = process.argv.includes('--watch') || process.argv.includes('-w');
271 +
272 + if (isWatchMode) {
273 + startWatchMode();
274 + } else {
275 + console.log('✅ Processing complete. Use --watch flag to enable watch mode.');
276 + }
277 +}
278 +
279 +// Run the main function directly
280 +main();
fern/scripts/convert-cookbooks-mdx.mjs deleted
-38
@@ -1,38 +0,0 @@
1 -import fs from "fs/promises";
2 -import path from "path";
3 -import { fileURLToPath } from "url";
4 -
5 -const __filename = fileURLToPath(import.meta.url);
6 -const __dirname = path.dirname(__filename);
7 -
8 -const cookbooksJsonDir = path.join(__dirname, "./cookbooks-json");
9 -const cookbooksMdxDir = path.join(__dirname, "./cookbooks-mdx");
10 -await fs.mkdir(cookbooksMdxDir, { recursive: true });
11 -
12 -const cookbooks = await fs.readdir(cookbooksJsonDir);
13 -
14 -for (const cookbook of cookbooks) {
15 - const inputPath = path.join(cookbooksJsonDir, cookbook);
16 - const outputPath = path.join(
17 - cookbooksMdxDir,
18 - cookbook.replace(".json", ".mdx")
19 - );
20 - const cookbookJson = await fs.readFile(inputPath, "utf-8");
21 - const cookbookData = JSON.parse(cookbookJson);
22 - const str = `${cookbookData.custompage.body}`;
23 -
24 - const body = str.replaceAll(
25 - /\[block:html\](.*?)\[\/block\]/gs,
26 - (value, b) => {
27 - return JSON.parse(b.trim()).html;
28 - }
29 - );
30 - const cookbookMdx = `---
31 -title: ${cookbookData.meta.title}
32 -slug: /page/${cookbook.replace(".json", "")}
33 ----
34 -
35 -${body}
36 -`;
37 - await fs.writeFile(outputPath, cookbookMdx);
38 -}
fern/scripts/download-cookbooks.mjs deleted
-98
@@ -1,98 +0,0 @@
1 -import fs from "fs/promises";
2 -import path from "path";
3 -import { fileURLToPath } from "url";
4 -
5 -const __filename = fileURLToPath(import.meta.url);
6 -const __dirname = path.dirname(__filename);
7 -
8 -const outputDir = path.join(__dirname, "cookbooks-json");
9 -await fs.mkdir(outputDir, { recursive: true });
10 -
11 -const pages = [
12 - "/page/calendar-agent",
13 - "/page/basic-tool-use",
14 - "/page/basic-multi-step",
15 - "/page/data-analyst-agent",
16 - "/page/agent-short-term-memory",
17 - "/page/agent-api-calls",
18 - "/page/csv-agent",
19 - "/page/agentic-rag-mixed-data",
20 - "/page/sql-agent",
21 - "/page/csv-agent-native-api",
22 - "/page/pdf-extractor",
23 - "/page/agentic-multi-stage-rag",
24 - "/page/basic-multi-step",
25 - "/page/data-analyst-agent",
26 - "/page/csv-agent",
27 - "/page/multilingual-search",
28 - "/page/creating-a-qa-bot",
29 - "/page/wikipedia-semantic-search",
30 - "/page/embed-jobs-serverless-pinecone",
31 - "/page/elasticsearch-and-cohere",
32 - "/page/embed-jobs",
33 - "/page/basic-semantic-search",
34 - "/page/multilingual-search",
35 - "/page/wikipedia-search-with-weaviate",
36 - "/page/creating-a-qa-bot",
37 - "/page/rerank-demo",
38 - "/page/embed-jobs-serverless-pinecone",
39 - "/page/elasticsearch-and-cohere",
40 - "/page/basic-rag",
41 - "/page/elasticsearch-and-cohere",
42 - "/page/chunking-strategies",
43 - "/page/migrating-prompts",
44 - "/page/rag-with-chat-embed",
45 - "/page/creating-a-qa-bot",
46 - "/page/rag-evaluation-deep-dive",
47 - "/page/analysis-of-financial-forms",
48 - "/page/long-form-general-strategies",
49 - "/page/summarization-evals",
50 - "/page/grounded-summarization",
51 - "/page/fueling-generative-content",
52 - "/page/text-classification-using-embeddings",
53 - "/page/article-recommender-with-text-embeddings",
54 - "/page/document-parsing-for-enterprises",
55 - "/page/pondr",
56 - "/page/hello-world-meet-ai",
57 - "/page/topic-modeling-ai-papers",
58 - "/page/analyzing-hacker-news",
59 -];
60 -
61 -async function downloadCookbooks(pages) {
62 - try {
63 - for (const page of pages) {
64 - try {
65 - const response = await fetch(`https://docs.cohere.com${page}?json=on`, {
66 - method: "GET",
67 - redirect: "follow",
68 - headers: {
69 - accept: "application/json",
70 - cookie: `connect.sid=${process.env.README_SESSION_ID}`,
71 - "x-requested-with": "XMLHttpRequest",
72 - },
73 - });
74 -
75 - if (!response.ok) {
76 - throw new Error(`Failed to fetch ${page}: ${response.statusText}`);
77 - }
78 -
79 - const data = await response.json();
80 - const filename = `${page.split("/").pop()}.json`;
81 -
82 - await fs.writeFile(
83 - path.join(outputDir, filename),
84 - JSON.stringify(data, null, 2)
85 - );
86 -
87 - console.log(`Successfully wrote ${filename}`);
88 - } catch (error) {
89 - console.error(`Error processing ${page}:`, error);
90 - break;
91 - }
92 - }
93 - } catch (error) {
94 - console.error("Error setting up directory or fetching pages:", error);
95 - }
96 -}
97 -
98 -void downloadCookbooks(pages);
fern/snippets/sample-script/sample-script.py renamed
fern/snippets/typescript/sample-webserver/index.ts renamed
fern/snippets/typescript/triggers.ts new
+16
@@ -0,0 +1,16 @@
1 +import { Composio } from "@composio/core";
2 +
3 +const composio = new Composio()
4 +
5 +await composio.triggers.subscribe(
6 + triggerData => {
7 + console.log('Received trigger:', triggerData);
8 + },
9 + {
10 + // triggerId: 'ti_9q19nLNykmVZ',
11 + // toolkits: ['GITHUB']
12 + // userId: "sid",
13 + // triggerSlug: ["GITHUB_STAR_ADDED_EVENT"]
14 + authConfigId: "ac_1234567890"
15 + }
16 +)
\ No newline at end of file
fern/turbo.json
+95 -15
@@ -1,18 +1,98 @@
1 {
2 - "$schema": "https://turbo.build/schema.json",
3 - "tasks": {
4 - "dev": {
5 - "with": ["examples:dev"],
6 - "outputs": ["dist/"]
7 - },
8 - "build": {
9 - "dependsOn": ["examples:build"],
10 - "outputs": ["dist/"]
11 - },
12 - "test": {
13 - "dependsOn": ["^build"],
14 - "outputs": ["dist/"]
15 - }
2 + "$schema": "https://turbo.build/schema.json",
3 + "extends": ["//"],
4 + "tasks": {
5 + "build": {
6 + "dependsOn": ["api:pull", "add-og", "snippets:build", "tools:generate", "tools:uncomment", "sdkdocs"],
7 + "outputs": ["pages/*.mdx", "tools/*.mdx", "pages/sdk/**"],
8 + "cache": true
9 + },
10 +
11 + "dev": {
12 + "dependsOn": ["tools:comment", "snippets:build"],
13 + "persistent": true,
14 + "cache": false
15 + },
16 +
17 + "api:pull": {
18 + "outputs": ["apis/openapi.yml", "apis/openapi-mcp.json"],
19 + "cache": true
20 + },
21 +
22 + "add-og": {
23 + "dependsOn": ["^build"],
24 + "outputs": ["pages/**/*.mdx"],
25 + "inputs": ["scripts/add_og_imgs.py", "pages/**/*.mdx"],
26 + "cache": true
27 + },
28 +
29 + "snippets:build": {
30 + "dependsOn": ["^build"],
31 + "outputs": ["pages/**"],
32 + "inputs": ["scripts/build-snippets.ts", "snippets/**"],
33 + "cache": true
34 + },
35 +
36 + "snippets:dev": {
37 + "persistent": true,
38 + "cache": false
39 + },
40 +
41 + "tools:generate": {
42 + "outputs": ["tools/**"],
43 + "inputs": ["generators/tool_doc_generator/**/*.py"],
44 + "cache": true
45 + },
46 +
47 + "tools:comment": {
48 + "outputs": ["docs.yml"],
49 + "inputs": ["scripts/manage-tool-docs.py", "docs.yml"],
50 + "cache": true
51 + },
52 +
53 + "tools:uncomment": {
54 + "outputs": ["docs.yml"],
55 + "inputs": ["scripts/manage-tool-docs.py", "docs.yml"],
56 + "cache": true
57 + },
58 +
59 + "sdkdocs": {
60 + "dependsOn": ["^build"],
61 + "outputs": ["docs/sdk/**"],
62 + "inputs": ["../packages/core/**/*.ts", "../packages/providers/**/*.ts", "typedoc.json"],
63 + "cache": true
64 + },
65 +
66 + "check": {
67 + "dependsOn": ["tools:comment", "snippets:build"],
68 + "cache": false
69 + },
70 +
71 + "links": {
72 + "dependsOn": ["tools:uncomment", "snippets:build"],
73 + "cache": false
74 + },
75 +
76 + "preview": {
77 + "dependsOn": ["tools:uncomment", "snippets:build"],
78 + "cache": false,
79 + "env": ["FERN_TOKEN"]
80 + },
81 +
82 + "publish": {
83 + "dependsOn": ["tools:uncomment", "snippets:build"],
84 + "cache": false,
85 + "env": ["FERN_TOKEN"]
86 + },
87 +
88 + "clean": {
89 + "cache": false
90 + },
91 +
92 + "compile": {
93 + "outputs": ["dist/output.css"],
94 + "inputs": ["assets/input.css", "tailwind.config.js"],
95 + "cache": true
96 }
97 }
18 -
\ No newline at end of file
98 +}
\ No newline at end of file
pnpm-workspace.yaml
+1
@@ -6,3 +6,4 @@ packages:
6 - 'examples/*'
7 - 'fern'
8 - 'fern/pages/examples/*'
9 + - 'fern/snippets/*'