@devries-cameron20 / composio-1 / commits / 1569fb04d
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.

Executing tools docs cleanup (#1886)

Sushmitha Mallesh committed Sep 3, 2025 at 13:44 UTC 1569fb04dac0e3860ee55c0118254edadb56e75e
14 files changed +230 -181
fern/pages/src/examples/gmail-filterer.mdx
+21 -11
@@ -1,14 +1,18 @@
1 ---
2 title: AI Gmail Labeller
3 -subtitle: "A Python app that uses your custom LLM prompt to label your Gmail!"
4 -image: "https://og.composio.dev/api/og?title=AI%20Gmail%20Labeller" # image for socials
3 +subtitle: 'A Python app that uses your custom LLM prompt to label your Gmail!'
4 +image: 'https://og.composio.dev/api/og?title=AI%20Gmail%20Labeller' # image for socials
5 keywords: ''
6 hide-nav-links: false
7 ---
8 +
9 Imagine having an AI assistant that automatically organizes your Gmail inbox by intelligently labeling incoming emails. That's exactly what we'll build in this tutorial.
10
11 <Frame>
11 - <img src="https://camo.githubusercontent.com/29b105fdcc2e005d8dd76bab0af33081a0567637da1061da6e1664285b843f8d/68747470733a2f2f692e696d6775722e636f6d2f515646337956582e676966" alt="Gmail Labeller" />
12 + <img
13 + src="https://camo.githubusercontent.com/29b105fdcc2e005d8dd76bab0af33081a0567637da1061da6e1664285b843f8d/68747470733a2f2f692e696d6775722e636f6d2f515646337956582e676966"
14 + alt="Gmail Labeller"
15 + />
16 </Frame>
17
18 The complete app is available in our [`filter-gmails-example`](https://github.com/ComposioHQ/filter-gmails-example) repository. The app has a frontend built with Next.js along with Supabase for authentication.
@@ -24,11 +28,12 @@ The complete app is available in our [`filter-gmails-example`](https://github.co
28 In this guide, we'll focus on the Composio + OpenAI Agents part of the app.
29
30 ## Prerequisites
31 +
32 - Clone the [`filter-gmails-example`](https://github.com/ComposioHQ/filter-gmails-example) repository and set the project up locally.
33 - Get a Composio API key. You can get one <a href="https://platform.composio.dev?next_page=/settings" target="_blank">here</a>.
34
30 -
35 ## Creating Triggers for users
36 +
37 [Triggers](/docs/using-triggers) are a way to listen for events from apps. They act as a notification system for your AI applications, enabling your agents to respond dynamically to external events occurring within your apps.
38
39 In some cases, triggers require certain configurations to set the correct events. You can inspect and add these properties while enabling the triggers.
@@ -49,8 +54,8 @@ Then the trigger can be created with the following code:
54 title="apps/backend/email_processor.py"
55 />
56
52 -
57 ## Listening for a trigger event
58 +
59 <Callout type="info">
60 For local development, you can use [ngrok](https://ngrok.com/) to expose your local server to the internet.
61
@@ -59,6 +64,7 @@ ngrok http 8000
64 ```
65
66 Then you can set the ngrok URL in the trigger configuration.
67 +
68 <Frame>
69 <img src="../../../assets/images/examples/trigger-config.png" alt="Trigger configuration" />
70 </Frame>
@@ -73,12 +79,12 @@ It is parsed and then the labeling method `process_gmail_message` is called thro
79 ```python apps/backend/main.py {1-5, 29-33} maxLines=33
80 @app.post("/composio/webhook")
81 async def listen_webhooks(
76 - request: Request,
82 + request: Request,
83 background_tasks: BackgroundTasks
84 ):
85 """
80 - Main webhook endpoint for processing Gmail
81 - new message events. This is the core webhook
86 + Main webhook endpoint for processing Gmail
87 + new message events. This is the core webhook
88 labeling functionality.
89 """
90 # Verify webhook signature
@@ -100,8 +106,8 @@ async def listen_webhooks(
106
107 # Add email processing to background tasks
108 background_tasks.add_task(
103 - process_gmail_message,
104 - gmail_message,
109 + process_gmail_message,
110 + gmail_message,
111 user_prompt
112 )
113
@@ -112,6 +118,7 @@ async def listen_webhooks(
118 ```
119
120 ## Processing the mail using OpenAI Agents SDK
121 +
122 The `process_gmail_message` method is responsible for processing the email using the OpenAI Agents SDK.
123
124 <SnippetCode
@@ -149,6 +156,7 @@ You can view the agent trace in OpenAI's [Traces Dashboard](https://platform.ope
156 </Frame>
157
158 ## Securing the webhooks!
159 +
160 It is important to validate the webhook signature to ensure the request is coming from Composio.
161
162 Generate and store the webhook signature in the environment variables.
@@ -158,6 +166,7 @@ Generate and store the webhook signature in the environment variables.
166 </Frame>
167
168 The webhook signature is validated in the `verify_webhook_signature` function.
169 +
170 <SnippetCode
171 githubUrl="https://github.com/ComposioHQ/filter-gmails-example/blob/master/apps/backend/webhook.py#L10-L56"
172 language="python"
@@ -173,6 +182,7 @@ In the `/composio/webhook` endpoint, we verify the webhook signature and then pa
182 />
183
184 ## Inspiration
185 +
186 This example was inspired by an X/Twitter post by [@FarzaTV](https://x.com/FarzaTV/status/1905371012369350857).
187
178 -We encourage you to check out the [full app](https://github.com/ComposioHQ/filter-gmails-example), fork it, build it, and make it your own! Reach out to [sid@composio.dev](mailto:sid@composio.dev) for free credits ;)
188 +We encourage you to check out the [full app](https://github.com/ComposioHQ/filter-gmails-example), fork it, build it, and make it your own! Reach out to [soham@composio.dev](mailto:soham@composio.dev) for free credits ;)
fern/pages/src/providers/vercel.mdx
+10 -10
@@ -1,8 +1,8 @@
1 ---
2 title: Vercel AI SDK Provider
3 slug: /providers/vercel
4 -image: "https://og.composio.dev/api/og?title=Vercel%20AI%20SDK%20Provider" # image for socials
5 -keywords: ""
4 +image: 'https://og.composio.dev/api/og?title=Vercel%20AI%20SDK%20Provider' # image for socials
5 +keywords: ''
6 hide-nav-links: false
7 ---
8
@@ -11,6 +11,7 @@ Vercel AI SDK allows you to configure an optional async `execute` function that
11 The Vercel provider for Composio formats the Composio tools and adds this `execute` function to the tool calls.
12
13 ## Setup
14 +
15 Vercel AI SDK and the provider are only available for the TypeScript SDK.
16
17 ```typescript TypeScript maxLines=60 wordWrap
@@ -20,8 +21,8 @@ npm install @composio/vercel
21 You can specify and import the provider in the constructor.
22
23 ```typescript TypeScript maxLines=60 wordWrap
23 -import { Composio } from "@composio/core";
24 -import { VercelProvider } from "@composio/vercel";
24 +import { Composio } from '@composio/core';
25 +import { VercelProvider } from '@composio/vercel';
26
27 const composio = new Composio({
28 provider: new VercelProvider(),
@@ -31,15 +32,14 @@ const composio = new Composio({
32 ## Usage
33
34 ```typescript TypeScript maxLines=60 wordWrap
34 -const tools = await composio.tools.get(userId, "GMAIL_SEND_EMAIL");
35 +const tools = await composio.tools.get(userId, 'GMAIL_SEND_EMAIL');
36
37 const { text } = await generateText({
37 - model: anthropic("claude-3-7-sonnet-20250219"),
38 + model: anthropic('claude-3-7-sonnet-20250219'),
39 messages: [
40 {
40 - role: "user",
41 - content:
42 - "Send an email to sid@composio.dev saying 'hi from the ether of composio'",
41 + role: 'user',
42 + content: "Send an email to soham@composio.dev saying 'hi from the ether of composio'",
43 },
44 ],
45 tools,
@@ -47,4 +47,4 @@ const { text } = await generateText({
47 });
48
49 console.log(text);
50 -```
\ No newline at end of file
50 +```
fern/pages/src/tool-calling/executing-tools.mdx
+95 -148
@@ -1,200 +1,146 @@
1 ---
2 title: Executing Tools
3 -image: "https://og.composio.dev/api/og?title=Executing%20Tools" # image for socials
4 -keywords: ""
3 +image: 'https://og.composio.dev/api/og?title=Executing%20Tools' # image for socials
4 +keywords: ''
5 subtitle: "Learn how to execute Composio's tools with different providers and frameworks"
6 hide-nav-links: false
7 ---
8 -LLMs on their own can only do generation. Tool calling changes that by letting them interact with external services. Instead of just drafting an email, the model can call `GMAIL_SEND_EMAIL` to actually send it. The tool's results feed back to the LLM, closing the loop so it can decide, *act,* observe, and adapt.
8
9 +LLMs on their own can only do generation. Tool calling changes that by letting them interact with external services. Instead of just drafting an email, the model can call `GMAIL_SEND_EMAIL` to actually send it. The tool's results feed back to the LLM, closing the loop so it can decide, _act,_ observe, and adapt.
10
11 -In Composio, every **tool** is a single API action—fully described with schema, parameters, and return type. Tools live inside **toolkits** like *Gmail, Slack, or GitHub*, and Composio handles authentication and user scoping.
12 -
11 +In Composio, every **tool** is a single API action—fully described with schema, parameters, and return type. Tools live inside **toolkits** like _Gmail, Slack, or GitHub_, and Composio handles authentication and user scoping.
12
13 <Tip icon="info">
15 -**User Scoping**: All tools are scoped to a specific user - that's why every example includes a `user_id`. Each user must authenticate with their respective services (Gmail, Calendar, etc.) before executing tools. [Learn more about authentication →](./authenticating-tools)
14 + **User Scoping**: All tools are scoped to a specific user - that's why every example includes a
15 + `user_id`. Each user must authenticate with their respective services (Gmail, Calendar, etc.)
16 + before executing tools. [Learn more about authentication →](./authenticating-tools)
17 </Tip>
18
19 ## Using Chat Completions
20
20 -With providers like *OpenAI*, *Anthropic*, and *Google AI*, use the Composio SDK to execute tool calls easily. To learn how to setup these providers, see [Providers](/providers/openai).
21 +Use the Composio SDK with providers like OpenAI, Anthropic, and Google AI. To learn how to set-up these providers, see [Providers](/providers/openai).
22
23 <CodeGroup>
23 -<SnippetCode
24 - src="fern/snippets/tool-calling/python/exec-tool-completions.py"
25 - title="Python (OpenAI)"
26 - highlightStart={32}
27 - highlightEnd={33}
28 -/>
29 -<SnippetCode
30 - src="fern/snippets/tool-calling/typescript/exec-tool-completions.ts"
31 - title="TypeScript (Anthropic)"
32 - highlightStart={37}
33 - highlightEnd={38}
34 -/>
24 + <SnippetCode
25 + src="fern/snippets/tool-calling/python/exec-tool-completions.py"
26 + title="Python (OpenAI)"
27 + highlightStart={32}
28 + highlightEnd={33}
29 + />
30 + <SnippetCode
31 + src="fern/snippets/tool-calling/typescript/exec-tool-completions.ts"
32 + title="TypeScript (Anthropic)"
33 + highlightStart={37}
34 + highlightEnd={38}
35 + />
36 </CodeGroup>
37
38 ## Using Agentic Frameworks
38 -Agentic frameworks automatically handle the tool execution loop.
39 -Composio provides support for frameworks like this by making sure the tools are formatted into the correct objects for the agentic framework to execute.
39
40 +Agentic frameworks automatically handle the tool execution loop.
41 +Composio provides support for frameworks like this by making sure the tools are formatted into the correct objects for the agentic framework to execute.
42
43 <CodeGroup>
43 -<SnippetCode
44 - src="fern/snippets/tool-calling/python/exec-tool-agentic.py"
45 - title="Python (OpenAI Agents SDK)"
46 - highlightStart={19}
47 - highlightEnd={23}
48 -/>
49 -<SnippetCode
50 - src="fern/snippets/tool-calling/typescript/exec-tool-agentic.ts"
51 - title="TypeScript (Anthropic)"
52 - highlightStart={22}
53 - highlightEnd={31}
54 -/>
44 + <SnippetCode
45 + src="fern/snippets/tool-calling/python/exec-tool-agentic.py"
46 + title="Python (OpenAI Agents SDK)"
47 + highlightStart={19}
48 + highlightEnd={23}
49 + />
50 + <SnippetCode
51 + src="fern/snippets/tool-calling/typescript/exec-tool-agentic.ts"
52 + title="TypeScript (Anthropic)"
53 + highlightStart={22}
54 + highlightEnd={31}
55 + />
56 </CodeGroup>
57
58 ## Direct Tool execution
59 +
60 In case you just want to call a tool without using any framework or LLM provider, you can use the `execute` method directly.
61 +
62 <Tip icon="lightbulb">
60 -**Finding tool arguments**: Visit [Composio Toolkits](https://platform.composio.dev?next_page=/marketplace) → Select your toolkit -> Select tool to see its required and optional parameters, types, and descriptions.
63 + **Finding tool arguments**: In the [Auth Configs
64 + tab](https://platform.composio.dev?next_page=/auth-configs) → Select your toolkit → Tools &
65 + Triggers → Select the tool to see its required and optional parameters, types, and descriptions.
66 </Tip>
67 <CodeGroup>
63 -<SnippetCode
64 - src="fern/snippets/tool-calling/python/direct-tool-call.py"
65 - title="Python"
66 -/>
67 -<SnippetCode
68 - src="fern/snippets/tool-calling/typescript/direct-tool-call.ts"
69 - title="TypeScript"
70 -/>
71 -</CodeGroup>
68 + <SnippetCode src="fern/snippets/tool-calling/python/direct-tool-call.py" title="Python" />
69 + <SnippetCode src="fern/snippets/tool-calling/typescript/direct-tool-call.ts" title="TypeScript" />
70 +</CodeGroup>
71
72 ### Proxy Execute -- Manually calling toolkit APIs
74 -You can also proxy requests to an API of any supported toolkit. This is useful when you want to manually call an API of a toolkit and inject the authentication state from Composio.
73 +
74 +You can proxy requests to any supported toolkit API and let Composio inject the **authentication state**. This is useful when you need an API endpoint that isn't available as a predefined tool.
75 +
76 +The `endpoint` can be a relative path or absolute URL. Composio uses the `connected_account_id` to determine the toolkit and resolve relative paths against the appropriate base URL.
77
78 <CodeGroup>
77 -```python Python maxLines=60 wordWrap
78 -response = composio.tools.proxy(
79 - endpoint="/repos/composiohq/composio/issues/1",
80 - method="GET",
81 - connected_account_id="ac_1234", # use connected account for github
82 - parameters=[
83 - {
84 - "name": "Accept",
85 - "value": "application/vnd.github.v3+json",
86 - "type": "header",
87 - },
88 - ],
89 -)
90 -```
91 -```typescript TypeScript maxLines=60 wordWrap
92 -// Send a custom request to a toolkit
93 -const { data } = await composio.tools.proxyExecute({
94 - toolkitSlug: 'github',
95 - userId: 'user@example.com',
96 - data: {
97 - endpoint: '/repos/owner/repo/issues',
98 - method: 'GET'
99 - }
100 -});
101 -console.log(data);
102 -```
79 + <SnippetCode
80 + src="fern/snippets/tool-calling/python/proxy-tool.py"
81 + title="Python"
82 + startLine={5}
83 + highlightStart={9}
84 + highlightEnd={9}
85 + />
86 + <SnippetCode
87 + src="fern/snippets/tool-calling/typescript/proxy-tool.ts"
88 + title="TypeScript"
89 + startLine={5}
90 + highlightStart={9}
91 + highlightEnd={9}
92 +/>
93 +
94 </CodeGroup>
95
105 -If you're interested in extending toolkits and creating custom tools, see [Custom tools](/docs/custom-tools).
96 +<Tip icon="info">
97 + Need an API that isn't supported by any Composio toolkit, or want to extend an existing one? Learn
98 + how to [create custom tools](/docs/custom-tools).
99 +</Tip>
100
101 ## Automatic File Handling
102
109 -Composio SDK includes automatic file handling for tools that work with files. When enabled (default), the SDK automatically handles file uploads and downloads during tool execution.
103 +Composio handles file operations automatically. Pass file paths to tools that need them, and get local file paths back from tools that return files.
104
105 ### File Upload
106
113 -When a tool accepts file inputs (marked with `file_uploadable: true`), you can pass local file paths or URLs or a `File` object. Here's an example using Google Drive upload:
107 +Pass local file paths, URLs, or File objects to tools that accept files:
108
109 <CodeGroup>
116 -```python Python maxLines=60 wordWrap
117 -import os
118 -
119 -from composio import Composio
120 -
121 -composio = Composio()
122 -
123 -# Upload a local file to Google Drive
124 -result = composio.tools.execute(
125 - "GOOGLEDRIVE_UPLOAD_FILE",
126 - user_id="default",
127 - arguments={
128 - "file_to_upload": os.path.join(os.getcwd(), "document.pdf") # Local file path
129 - }
130 -)
131 -
132 -print(result.data) # Contains Google Drive file details
133 -```
134 -
135 -```typescript TypeScript maxLines=60 wordWrap
136 -import { Composio } from '@composio/core';
137 -import path from 'path';
138 -
139 -const composio = new Composio({
140 - apiKey: process.env.COMPOSIO_API_KEY
141 -});
142 -
143 -// Upload a local file to Google Drive
144 -const result = await composio.tools.execute('GOOGLEDRIVE_UPLOAD_FILE', {
145 - userId: 'default',
146 - arguments: {
147 - file_to_upload: path.join(__dirname, 'document.pdf') // Local file path or URL or File object
148 - }
149 -});
150 -
151 -console.log(result.data); // Contains Google Drive file details
152 -```
110 + <SnippetCode
111 + src="fern/snippets/tool-calling/python/file-upload.py"
112 + title="Python"
113 + startLine={7}
114 + />
115 + <SnippetCode
116 + src="fern/snippets/tool-calling/typescript/file-upload.ts"
117 + title="TypeScript"
118 + startLine={8}
119 + />
120 </CodeGroup>
121
155 -The SDK automatically:
156 -1. Reads the file content
157 -2. Uploads it to secure storage
158 -3. Passes the file metadata to the tool
159 -
122 ### File Download
123
162 -When a tool returns file outputs, the SDK automatically:
163 -1. Downloads the file to a local temporary directory
164 -2. Provides the local file path in the response
124 +When tools return files, Composio downloads them to the local directory and provides file path in the response:
125 +When tools return files, Composio downloads them to the local directory and provides the file path in the response:
126
127 <CodeGroup>
167 -```python Python maxLines=60 wordWrap
168 -# Download a file from Google Drive
169 -result = composio.tools.execute(
170 - "GOOGLEDRIVE_DOWNLOAD_FILE",
171 - user_id="default",
172 - arguments={
173 - "file_id": "your_file_id"
174 - }
175 -)
176 -
177 -# Result includes local file path
178 -print(result.data["file"]) # "/path/to/downloaded/file.pdf"
179 -```
128 + <SnippetCode
129 + src="fern/snippets/tool-calling/python/file-download.py"
130 + title="Python"
131 + startLine={4}
132 + />
133 + <SnippetCode
134 + src="fern/snippets/tool-calling/typescript/file-download.ts"
135 + title="TypeScript"
136 + startLine={4}
137 + />
138
181 -```typescript TypeScript maxLines=60 wordWrap
182 -// Download a file from Google Drive
183 -const result = await composio.tools.execute('GOOGLEDRIVE_DOWNLOAD_FILE', {
184 - userId: 'default',
185 - arguments: {
186 - file_id: 'your_file_id'
187 - }
188 -});
189 -
190 -// Result includes local file path
191 -console.log(result.data.file.uri); // "/path/to/downloaded/file.pdf"
192 -```
139 </CodeGroup>
140
141 ### Disabling Auto File Handling
142
197 -You can disable automatic file handling when initializing the Typescript SDK:
143 +You can disable automatic file handling when initializing the TypeScript SDK. When disabled, handle file uploads and downloads manually using `files.upload` and `files.download`:
144
145 <CodeGroup>
146 ```typescript TypeScript maxLines=60 wordWrap
@@ -205,11 +151,12 @@ const composio = new Composio({
151
152 // Now you need to handle files manually using composio.files API
153 const fileData = await composio.files.upload({
208 - filePath: path.join(__dirname, 'document.pdf'),
209 - toolSlug: 'GOOGLEDRIVE_UPLOAD_FILE',
210 - toolkitSlug: 'googledrive'
154 +filePath: path.join(\_\_dirname, 'document.pdf'),
155 +toolSlug: 'GOOGLEDRIVE_UPLOAD_FILE',
156 +toolkitSlug: 'googledrive'
157 });
158 +
159 ```
160 </CodeGroup>
161
215 -For more details on file handling, see [Auto Upload and Download Files](/docs/advanced/auto-upload-download).
\ No newline at end of file
162 +```
fern/snippets/examples/sample-script/sample-script.py
+3 -8
@@ -1,16 +1,11 @@
1 -
1 from composio_core import Composio
2 from openai import OpenAI
3
4 # Initialize OpenAI client
6 -openai = OpenAI(
7 - api_key="your-openai-api-key"
8 -)
5 +openai = OpenAI(api_key="your-openai-api-key")
6
7 # Initialize Composio client
11 -composio = Composio(
12 - api_key="your-composio-api-key"
13 -)
8 +composio = Composio(api_key="your-composio-api-key")
9
10 # Set up user identifier
11 userId = "your@email.com"
@@ -32,7 +27,7 @@ completion = openai.chat.completions.create(
27 },
28 {
29 "role": "user",
35 - "content": "send an email to sid@composio.dev saying 'hi from the composio quickstart'",
30 + "content": "send an email to soham@composio.dev saying 'hi from the composio quickstart'",
31 # we'll ship you free merch if you do ;)
32 },
33 ],
fern/snippets/get-started/python/quickstart.py
+1 -1
@@ -21,7 +21,7 @@ completion = openai.chat.completions.create(
21 messages=[
22 {
23 "role": "user",
24 - "content": "say 'hi from the composio quickstart' to sid@composio.dev",
24 + "content": "say 'hi from the composio quickstart' to soham@composio.dev",
25 # we'll ship you free merch if you do ;)
26 },
27 ],
fern/snippets/migration/new_execute_tools.ts
+1 -1
@@ -18,7 +18,7 @@ const msg = await anthropic.messages.create({
18 messages: [
19 {
20 role: 'user',
21 - content: "Say hi to 'sid@composio.dev'",
21 + content: "Say hi to 'soham@composio.dev'",
22 },
23 ],
24 max_tokens: 1024,
fern/snippets/tool-calling/python/file-download.py new
+15
@@ -0,0 +1,15 @@
1 +from composio import Composio
2 +
3 +
4 +composio = Composio(
5 + api_key="your_composio_key", file_download_dir="./downloads"
6 +) # Optional: Specify the directory to download files to
7 +
8 +result = composio.tools.execute(
9 + "GOOGLEDRIVE_DOWNLOAD_FILE",
10 + user_id="user-1235***",
11 + arguments={"file_id": "your_file_id"},
12 +)
13 +
14 +# Result includes local file path
15 +print(result)
fern/snippets/tool-calling/python/file-upload.py new
+14
@@ -0,0 +1,14 @@
1 +import os
2 +
3 +from composio import Composio
4 +
5 +composio = Composio(api_key="your_composio_key")
6 +
7 +# Upload a local file to Google Drive
8 +result = composio.tools.execute(
9 + slug="GOOGLEDRIVE_UPLOAD_FILE",
10 + user_id="user-1235***",
11 + arguments={"file_to_upload": os.path.join(os.getcwd(), "document.pdf")}, # Local file path
12 +)
13 +
14 +print(result) # Print Google Drive file details
fern/snippets/tool-calling/python/proxy-tool.py new
+19
@@ -0,0 +1,19 @@
1 +from composio import Composio
2 +
3 +composio = Composio(api_key="your_composio_key")
4 +
5 +# Send a proxy request to the endpoint
6 +response = composio.tools.proxy(
7 + endpoint="/repos/composiohq/composio/issues/1",
8 + method="GET",
9 + connected_account_id="ca_jI6********", # use connected account for github
10 + parameters=[
11 + {
12 + "name": "Accept",
13 + "value": "application/vnd.github.v3+json",
14 + "type": "header",
15 + },
16 + ],
17 +)
18 +
19 +print(response)
fern/snippets/tool-calling/typescript/direct-tool-call.ts
+1 -1
@@ -13,4 +13,4 @@ const result = await composio.tools.execute("GITHUB_LIST_STARGAZERS", {
13 "per_page": 5
14 },
15 });
16 -console.log('✅ GitHub stargazers:', JSON.stringify(result, null, 2));
\ No newline at end of file
16 +console.log('GitHub stargazers:', JSON.stringify(result, null, 2));
\ No newline at end of file
fern/snippets/tool-calling/typescript/file-download.ts new
+13
@@ -0,0 +1,13 @@
1 +import { Composio } from '@composio/core';
2 +const composio = new Composio({apiKey: 'your-composio-api-key'});
3 +
4 +// Download a file from Google Drive
5 +const result = await composio.tools.execute('GOOGLEDRIVE_DOWNLOAD_FILE', {
6 + userId: 'user-1235***',
7 + arguments: {
8 + file_id: 'your-file-id'
9 + }
10 + });
11 +
12 +// Result includes local file path
13 +console.log(result);
\ No newline at end of file
fern/snippets/tool-calling/typescript/file-upload.ts new
+16
@@ -0,0 +1,16 @@
1 +import { Composio } from '@composio/core';
2 +import path from 'path';
3 +
4 +const composio = new Composio({
5 + apiKey: 'your-composio-api-key'
6 +});
7 +
8 +// Upload a local file to Google Drive
9 +const result = await composio.tools.execute('GOOGLEDRIVE_UPLOAD_FILE', {
10 + userId: 'user-4235***',
11 + arguments: {
12 + file_to_upload: path.join(__dirname, 'document.pdf') // Local file path
13 + }
14 +});
15 +
16 +console.log(result.data); // Contains Google Drive file details
fern/snippets/tool-calling/typescript/proxy-tool.ts new
+20
@@ -0,0 +1,20 @@
1 +import { Composio } from '@composio/core';
2 +
3 +const composio = new Composio({apiKey: "your_composio_key"});
4 +
5 +// Send a proxy request to the endpoint
6 +const { data } = await composio.tools.proxyExecute({
7 + endpoint:'/repos/composiohq/composio/issues/1',
8 + method: 'GET',
9 + connectedAccountId: 'ca_jI*****', // use connected account for github
10 + parameters:[
11 + {
12 + "name": "Accept",
13 + "value": "application/vnd.github.v3+json",
14 + "in": "header",
15 + },
16 + ],
17 +});
18 +
19 +console.log(data);
20 +
\ No newline at end of file
fern/snippets/triggers/typescript/quickstart-vercel.ts
+1 -1
@@ -22,7 +22,7 @@ const { text } = await generateText({
22 messages: [
23 {
24 role: 'user',
25 - content: "say 'hi from the composio quickstart' to sid@composio.dev", // we'll ship you free merch if you do ;)
25 + content: "say 'hi from the composio quickstart' to soham@composio.dev", // we'll ship you free merch if you do ;)
26 },
27 ],
28 tools,