Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
TypeScript agentic-aiagentsaiai-agentsaiagentsdeveloper-toolsfunction-callinggpt-4javascriptjsllmllmopsmcppythonremote-mcp-serverssetypescript
Update documentation for tools and providers, including new examples and modifications to existing code snippets. Added custom provider guides for Python and TypeScript, and improved the structure of authentication and execution examples. Adjusted navigation in the documentation to reflect these changes.
[email protected]0bf38f674e8b
diff --git a/fern/docs.yml b/fern/docs.ymlindex cc5e61c6b..71e766b5a 100644--- a/fern/docs.yml+++ b/fern/docs.yml@@ -175,12 +175,6 @@ navigation:icon: rocketskip-slug: truecontents:- - page: Hello World- path: pages/dist/examples/hello-world.mdx- slug: examples/hello-world- - page: Sample Script- path: pages/dist/examples/sample-script.mdx- slug: examples/sample-script- page: Basic Hono Serverpath: pages/dist/examples/sample-webserver/sample-webserver.mdxslug: examples/sample-webserver@@ -225,10 +219,15 @@ navigation:- page: Mastra Providerpath: pages/dist/providers/mastra.mdx- section: Writing your own provider+ skip-slug: trueicon: codecontents:- page: TypeScript- path: pages/dist/providers/custom.mdx+ path: pages/dist/providers/ts-custom.mdx+ slug: providers/custom/typescript+ - page: Python+ path: pages/dist/providers/py-custom.mdx+ slug: providers/custom/python- tab: toolslayout:- section: Tooldiff --git a/fern/pages/src/authentication/custom-auth-configs.mdx b/fern/pages/src/authentication/custom-auth-configs.mdxindex a35c0e405..4ed98f4a4 100644--- a/fern/pages/src/authentication/custom-auth-configs.mdx+++ b/fern/pages/src/authentication/custom-auth-configs.mdx@@ -95,18 +95,6 @@ As usual, copy and use the auth config ID starting with `ac_` in your applicatioThis auth config is now ready to be used in your application!<CodeGroup>-```typescript TypeScript maxLines=60-const connReq = await composio.connectedAccounts.initiate(userId, "ac_1234");--console.log(connReq.redirectUrl);--const connection = await composio.connectedAccounts.waitForConnection(-connReq.id-);--console.log(connection);--```````python Python maxLines=60# Create a new connected accountconnection_request = composio.connected_accounts.initiate(@@ -118,7 +106,19 @@ print(connection_request)# Wait for the connection to be establishedconnected_account = connection_request.wait_for_connection()print(connected_account)-````+```+```typescript TypeScript maxLines=60+const connReq = await composio.connectedAccounts.initiate(userId, "ac_1234");++console.log(connReq.redirectUrl);++const connection = await composio.connectedAccounts.waitForConnection(+connReq.id+);++console.log(connection);++```</CodeGroup>@@ -149,28 +149,6 @@ Create a redirect logic, either through your DNS or in your application to redir**Example: API Route for OAuth Redirect**<CodeGroup>-```typescript Next.js (pages/api/composio-redirect.ts)-import type { NextApiRequest, NextApiResponse } from 'next';--export default function handler(req: NextApiRequest, res: NextApiResponse) {- // The target Composio endpoint that handles OAuth callbacks- const composioEndpoint = 'https://backend.composio.dev/api/v3/toolkits/callback';--// Extract and preserve all query parameters-const queryParams = new URLSearchParams();-Object.entries(req.query).forEach(([key, value]) => {-if (typeof value === 'string') {-queryParams.append(key, value);-}-});--// Redirect to Composio with all query parameters intact-const redirectUrl = `${composioEndpoint}?${queryParams.toString()}`;-res.redirect(302, redirectUrl);-}--````-```python FastAPI (app.py)from fastapi import FastAPIfrom fastapi.responses import RedirectResponse@@ -198,7 +176,29 @@ def authorize_app(toolkit: str):auth_config_id=auth_config_id,)return RedirectResponse(url=connection_request.redirect_url)-````+```++```typescript Next.js (pages/api/composio-redirect.ts)+import type { NextApiRequest, NextApiResponse } from 'next';++export default function handler(req: NextApiRequest, res: NextApiResponse) {+ // The target Composio endpoint that handles OAuth callbacks+ const composioEndpoint = 'https://backend.composio.dev/api/v3/toolkits/callback';++// Extract and preserve all query parameters+const queryParams = new URLSearchParams();+Object.entries(req.query).forEach(([key, value]) => {+if (typeof value === 'string') {+queryParams.append(key, value);+}+});++// Redirect to Composio with all query parameters intact+const redirectUrl = `${composioEndpoint}?${queryParams.toString()}`;+res.redirect(302, redirectUrl);+}++```</CodeGroup></Step>diff --git a/fern/pages/src/authentication/custom-auth-params.mdx b/fern/pages/src/authentication/custom-auth-params.mdxindex b1f2b5d0c..bac7a6ba3 100644--- a/fern/pages/src/authentication/custom-auth-params.mdx+++ b/fern/pages/src/authentication/custom-auth-params.mdx@@ -13,6 +13,11 @@ In case Composio is not being used for managing the auth but only for the tools.First, initialize the Composio SDK with your API key:<CodeGroup>+```python Python maxLines=10+from composio import Composio++composio = Composio()+``````typescript TypeScript maxLines=10import { Composio } from "@composio/core";@@ -20,11 +25,6 @@ const composio = new Composio({apiKey: process.env.COMPOSIO_API_KEY,});```-```python Python maxLines=10-from composio import Composio--composio = Composio()-```</CodeGroup>## Creating the Auth Modifier Function@@ -37,28 +37,6 @@ Before Execute Modifiers are a way to modify the parameters of a tool before it</Card><CodeGroup>-```typescript TypeScript maxLines=25-const authModifier = (toolSlug: string, toolkitSlug: string, params: any) => {- // Add authentication parameters for specific toolkits- if (toolkitSlug === "NOTION") {- if (!params.customAuthParams) {- params.customAuthParams = {};- }-- if (!params.customAuthParams.parameters) {- params.customAuthParams.parameters = [];- }-- // Add an API key to the headers- params.customAuthParams.parameters.push({- in: "header",- name: "X-API-Key",- value: process.env.CUSTOM_API_KEY,- });- }- return params;-};-``````python Python maxLines=25from composio import before_executefrom composio.types import ToolExecuteParams@@ -82,6 +60,28 @@ def add_custom_auth()return params```+```typescript TypeScript maxLines=25+const authModifier = (toolSlug: string, toolkitSlug: string, params: any) => {+ // Add authentication parameters for specific toolkits+ if (toolkitSlug === "NOTION") {+ if (!params.customAuthParams) {+ params.customAuthParams = {};+ }++ if (!params.customAuthParams.parameters) {+ params.customAuthParams.parameters = [];+ }++ // Add an API key to the headers+ params.customAuthParams.parameters.push({+ in: "header",+ name: "X-API-Key",+ value: process.env.CUSTOM_API_KEY,+ });+ }+ return params;+};+```</CodeGroup>## Executing Tools with Custom Auth@@ -94,6 +94,17 @@ Following is an example of how to execute a tool with a custom authentication moFor Agentic Providers, read about [Before Execution Modifiers](/docs/modifiers/before-execution).<CodeGroup>+```python Python maxLines=20+result = composio.tools.execute(+ slug="NOTION_GET_DATABASE_ITEMS",+ user_id="default",+ arguments={},+ modifiers=[+ add_custom_auth,+ ],+)+print(result)+``````typescript TypeScript maxLines=20const result = await composio.tools.execute("NOTION_GET_DATABASE_ITEMS",@@ -110,15 +121,4 @@ const result = await composio.tools.execute(console.log(JSON.stringify(result, null, 2));```-```python Python maxLines=20-result = composio.tools.execute(- slug="NOTION_GET_DATABASE_ITEMS",- user_id="default",- arguments={},- modifiers=[- add_custom_auth,- ],-)-print(result)-```</CodeGroup>\ No newline at end of filediff --git a/fern/pages/src/authentication/programmatic-auth-configs.mdx b/fern/pages/src/authentication/programmatic-auth-configs.mdxindex 26d99034c..89e04ae77 100644--- a/fern/pages/src/authentication/programmatic-auth-configs.mdx+++ b/fern/pages/src/authentication/programmatic-auth-configs.mdx@@ -15,19 +15,6 @@ Auth configs are created once and reused many times. However when dealing with mFor certain apps, you can optionally use Composio's managed auth. This means you don't have to provide your own OAuth credentials, Bearer tokens, API keys, etc.<CodeGroup>-```typescript TypeScript maxLines=60 wordWrap {7}-import { Composio } from "@composio/core";--const composio = new Composio();--const authConfig = await composio.authConfigs.create("LINEAR", {- name: "Linear",- type: "use_composio_managed_auth",-});--console.log(authConfig);-```-```python Python maxLines=60 wordWrapfrom composio import Composio@@ -42,6 +29,19 @@ auth_config = composio.auth_configs.create()print(auth_config)```++```typescript TypeScript maxLines=60 wordWrap {7}+import { Composio } from "@composio/core";++const composio = new Composio();++const authConfig = await composio.authConfigs.create("LINEAR", {+ name: "Linear",+ type: "use_composio_managed_auth",+});++console.log(authConfig);+```</CodeGroup>@@ -59,20 +59,6 @@ This is the URI that captures the OAuth code that is returned to the app.In this case, we're using our own OAuth2 client ID and secret to create the auth config for Notion:<CodeGroup>-```typescript TypeScript maxLines=60 wordWrap-const authConfig = await composio.authConfigs.create("NOTION", {- name: "Notion",- type: "use_custom_auth",- credentials: {- client_id: "1234567890",- client_secret: "1234567890",- oauth_redirect_uri: "https://backend.composio.dev/api/v3/toolkits/callback",- },- authScheme: "OAUTH2",-});--console.log(authConfig);-``````python Python maxLines=60 wordWrap# Use custom authauth_config = composio.auth_configs.create(@@ -90,6 +76,20 @@ auth_config = composio.auth_configs.create()print(auth_config)```+```typescript TypeScript maxLines=60 wordWrap+const authConfig = await composio.authConfigs.create("NOTION", {+ name: "Notion",+ type: "use_custom_auth",+ credentials: {+ client_id: "1234567890",+ client_secret: "1234567890",+ oauth_redirect_uri: "https://backend.composio.dev/api/v3/toolkits/callback",+ },+ authScheme: "OAUTH2",+});++console.log(authConfig);+```</CodeGroup>### Fetching the fields@@ -98,6 +98,14 @@ For more complex cases where you need to dynamically discover the exact field na**Inspect the auth config details**<CodeGroup>+```python Python maxLines=60 wordWrap+required_fields = composio.toolkits.get_auth_config_creation_fields(+ toolkit="NOTION",+ auth_scheme="OAUTH2",+ required_only=True,+)+print(required_fields)+``````typescript TypeScript maxLines=60const toolkits = await composio.toolkits.get("NOTION");@@ -108,14 +116,6 @@ const authFields = await composio.toolkits.getAuthConfigCreationFields('NOTION',console.log("Required auth config fields:", authFields);```-```python Python maxLines=60 wordWrap-required_fields = composio.toolkits.get_auth_config_creation_fields(- toolkit="NOTION",- auth_scheme="OAUTH2",- required_only=True,-)-print(required_fields)-```</CodeGroup>@@ -129,31 +129,6 @@ NOTION_CLIENT_SECRET=your_client_secretThis makes it easy to create the auth config programmatically by reading required fields from the environment variables.<CodeGroup>-```typescript TypeScript maxLines=60 wordWrap-import { Composio } from "@composio/core";--const composio = new Composio({- apiKey: process.env.COMPOSIO_API_KEY,-});--const authConfigCreationFields = await composio.toolkits.getAuthConfigCreationFields('NOTION', 'OAUTH2', {- requiredOnly: true,-});--console.log("Required auth config fields:", requiredAuthFields);--const authConfig = await composio.authConfigs.create("NOTION", {- name: "Notion",- type: "use_custom_auth",- authScheme: "OAUTH2", // Replace with the correct scheme for your toolkit if different- credentials: Object.fromEntries(- requiredAuthFields.map(({ name }) => [- name,- process.env[`NOTION_${name.toUpperCase()}`] || "",- ])- ),-});-``````python Python maxLines=60 wordWrapimport os@@ -183,5 +158,30 @@ auth_config = composio.auth_configs.create(},)```+```typescript TypeScript maxLines=60 wordWrap+import { Composio } from "@composio/core";++const composio = new Composio({+ apiKey: process.env.COMPOSIO_API_KEY,+});++const authConfigCreationFields = await composio.toolkits.getAuthConfigCreationFields('NOTION', 'OAUTH2', {+ requiredOnly: true,+});++console.log("Required auth config fields:", requiredAuthFields);++const authConfig = await composio.authConfigs.create("NOTION", {+ name: "Notion",+ type: "use_custom_auth",+ authScheme: "OAUTH2", // Replace with the correct scheme for your toolkit if different+ credentials: Object.fromEntries(+ requiredAuthFields.map(({ name }) => [+ name,+ process.env[`NOTION_${name.toUpperCase()}`] || "",+ ])+ ),+});+```</CodeGroup></Accordion>\ No newline at end of filediff --git a/fern/pages/src/get-started/providers.mdx b/fern/pages/src/get-started/providers.mdxindex c7a4c78ef..5145b60ca 100644--- a/fern/pages/src/get-started/providers.mdx+++ b/fern/pages/src/get-started/providers.mdx@@ -31,18 +31,18 @@ Here's how you can generate text with various providers using Composio SDK:<Tab title="OpenAI (Default)">OpenAI is a completion provider. You can use it to generate text, function calls.<CodeGroup>+```python Python+from composio import Composio+from composio_openai import OpenAIProvider++composio = Composio(provider=OpenAIProvider())+``````typescript TypeScriptimport { Composio } from "@composio/core";import { OpenAIProvider } from "@composio/openai";const composio = new Composio({ provider: new OpenAIProvider() });-```-```python Python-from composio import Composio-from composio_openai import OpenAIProvider--composio = Composio(provider=OpenAIProvider())```</CodeGroup>@@ -50,6 +50,12 @@ composio = Composio(provider=OpenAIProvider())<Tab title="Anthropic">Anthropic is a completion provider. You can use it to generate text, function calls.<CodeGroup>+```python Python+from composio import Composio+from composio_anthropic import AnthropicProvider++composio = Composio(provider=AnthropicProvider())+``````typescript TypeScriptimport { Composio } from "@composio/core";import { AnthropicProvider } from "@composio/anthropic";@@ -58,13 +64,6 @@ import { Anthropic } from "@anthropic-ai/sdk";const composio = new Composio({ provider: new AnthropicProvider() });```-```python Python-from composio import Composio-from composio_anthropic import AnthropicProvider--composio = Composio(provider=AnthropicProvider())-```-</CodeGroup></Tab><Tab title="Vercel AI SDK">@@ -95,11 +94,40 @@ const composio = new Composio({</Tab><Tab title="OpenAI Agents">```python Python+import asyncio++from agents import Agent, Runner+from composio import Composiofrom composio_openai_agents import OpenAIAgentsProvider+# Initialize Composio toolsetcomposio = Composio(provider=OpenAIAgentsProvider())+# Get all the tools+tools = composio.tools.get(+ user_id="default",+ tools=["GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER"],+)++# Create an agent with the tools+agent = Agent(+ name="GitHub Agent",+ instructions="You are a helpful assistant.",+ tools=tools,+)++# Run the agent+async def main():+ result = await Runner.run(+ starting_agent=agent,+ input=(+ "Star the repository composiohq/composio on GitHub"+ ),+ )+ print(result.final_output)++asyncio.run(main())```</Tab></Tabs>diff --git a/fern/pages/src/get-started/quickstart.mdx b/fern/pages/src/get-started/quickstart.mdxindex 36b39af78..967b0be60 100644--- a/fern/pages/src/get-started/quickstart.mdx+++ b/fern/pages/src/get-started/quickstart.mdx@@ -26,12 +26,12 @@ export COMPOSIO_API_KEY=your_api_key## Install the SDKFirst and foremost, install the Composio SDK.<CodeGroup>-```bash title="TypeScript" for="typescript"-npm install @composio/core@next-``````bash title="Python" for="python"pip install composio```+```bash title="TypeScript" for="typescript"+npm install @composio/core@next+```</CodeGroup>## Initialise@@ -39,6 +39,13 @@ pip install composioTo use the SDK, you need to initialize it with your API key:<CodeGroup>+```python Python+from composio import Composio++composio = Composio(+ # api_key="your-api-key",+)+``````typescript TypeScriptimport { Composio } from '@composio/core';@@ -47,13 +54,6 @@ const composio = new Composio({// apiKey: 'your-api-key',});```-```python Python-from composio import Composio--composio = Composio(- # api_key="your-api-key",-)-```</CodeGroup>diff --git a/fern/pages/src/migration-guide.mdx b/fern/pages/src/migration-guide.mdxindex 59a3218f4..9f3bc7229 100644--- a/fern/pages/src/migration-guide.mdx+++ b/fern/pages/src/migration-guide.mdx@@ -191,14 +191,14 @@ To examine the raw schema definition of a tool for understanding input/output pa<CodeGroup><SnippetCode- src="fern/snippets/python/raw_tools.py"+ src="fern/snippets/tool-calling/python/raw_tools.py"startLine={1}endLine={11}title="Python (current)"/><SnippetCode- src="fern/snippets/typescript/raw_tools.ts"+ src="fern/snippets/tool-calling/typescript/raw_tools.ts"startLine={1}endLine={11}title="TypeScript (current)"diff --git a/fern/pages/src/providers/anthropic.mdx b/fern/pages/src/providers/anthropic.mdxindex 97c4b17d4..a0f178225 100644--- a/fern/pages/src/providers/anthropic.mdx+++ b/fern/pages/src/providers/anthropic.mdx@@ -13,18 +13,29 @@ The Anthropic Provider transforms Composio tools into a format compatible with AAnthropic provider can be installed for both the SDKs.<CodeGroup>-```bash title="TypeScript" for="typescript" maxLines=60 wordWrap-npm install @composio/anthropic @anthropic-ai/sdk-```-```bash title="Python" for="python" maxLines=60 wordWrappip install composio[anthropic]```++```bash title="TypeScript" for="typescript" maxLines=60 wordWrap+npm install @composio/anthropic @anthropic-ai/sdk+```</CodeGroup>You can specify the provider in the constructor. The constructor also takes in an optional `cacheTools` parameter.<CodeGroup>+```python Python maxLines=60 wordWrap+import anthropic++from composio import Composio+from composio_anthropic import AnthropicProvider++# Initialize tools.+anthropic_client = anthropic.Anthropic()+composio = Composio(provider=AnthropicProvider())+```+```typescript TypeScript maxLines=60 wordWrap {5}import { Composio } from "@composio/core";import { AnthropicProvider } from "@composio/anthropic";@@ -37,22 +48,33 @@ const composio = new Composio({const anthropic = new Anthropic();```+</CodeGroup>+## Usage++<CodeGroup>```python Python maxLines=60 wordWrap-import anthropic+# Define your user ID+user_id = "default"-from composio import Composio-from composio_anthropic import AnthropicProvider+# Get GitHub tools that are pre-configured+tools = composio.tools.get(user_id=user_id, toolkits=["GITHUB"])-# Initialize tools.-anthropic_client = anthropic.Anthropic()-composio = Composio(provider=AnthropicProvider())-```-</CodeGroup>+# Get response from the LLM+response = anthropic_client.messages.create(+ model="claude-3-5-sonnet-20240620",+ max_tokens=1024,+ tools=tools,+ messages=[+ {"role": "user", "content": "Star me composiohq/composio repo in github."},+ ],+)-## Usage+# Execute the function calls.+result = composio.provider.handle_tool_calls(user_id=user_id, response=response)+print(result)+```-<CodeGroup>```typescript TypeScript maxLines=60 wordWrapconst userId = "[email protected]";const tools = await composio.tools.get(userId, {@@ -75,28 +97,6 @@ const res = await composio.provider.handleToolCalls(userId, msg);console.log(JSON.parse(res[0]).details);```--```python Python maxLines=60 wordWrap-# Define your user ID-user_id = "default"--# Get GitHub tools that are pre-configured-tools = composio.tools.get(user_id=user_id, toolkits=["GITHUB"])--# Get response from the LLM-response = anthropic_client.messages.create(- model="claude-3-5-sonnet-20240620",- max_tokens=1024,- tools=tools,- messages=[- {"role": "user", "content": "Star me composiohq/composio repo in github."},- ],-)--# Execute the function calls.-result = composio.provider.handle_tool_calls(user_id=user_id, response=response)-print(result)-```</CodeGroup>### Streamingdiff --git a/fern/pages/src/providers/openai.mdx b/fern/pages/src/providers/openai.mdxindex 090598cbd..30ce3b796 100644--- a/fern/pages/src/providers/openai.mdx+++ b/fern/pages/src/providers/openai.mdx@@ -12,25 +12,25 @@ The OpenAI Provider is the default provider for the Composio SDK. It transformsBy default the OpenAI Provider is installed when you install the Composio SDK. You can also install it manually:<CodeGroup>-```bash title="TypeScript" for="typescript"-npm install @composio/openai-``````bash title="Python" for="python"pip install composio[openai]```+```bash title="TypeScript" for="typescript"+npm install @composio/openai+```</CodeGroup>The OpenAI Provider is used by default when you initialize the Composio SDK but you can explicitly specify it.<CodeGroup><SnippetCode- src="fern/snippets/providers/typescript/openai.ts"+ src="fern/snippets/providers/python/openai-provider.py"startLine={1}- endLine={7}+ endLine={8}/><SnippetCode- src="fern/snippets/providers/python/openai-provider.py"+ src="fern/snippets/providers/typescript/openai.ts"startLine={1}- endLine={8}+ endLine={7}/></CodeGroup>@@ -38,30 +38,30 @@ The OpenAI Provider is used by default when you initialize the Composio SDK butThe Responses API is the recommended way to build more agentic flows with the OpenAI API. Read more about it in the [OpenAI documentation](https://platform.openai.com/docs/guides/responses-vs-chat-completions)<CodeGroup>+```python++```<SnippetCodesrc="fern/snippets/providers/typescript/openai.ts"startLine={5}endLine={24}/>-```python--```</CodeGroup>## Chat Completion APIChat Completion API is the industry standard for building LLM-powered applications. Chat completions is also adopted and used by many other LLM providers apart from OpenAI.<CodeGroup>-<SnippetCode- src="fern/snippets/providers/typescript/openai.ts"- startLine={26}- endLine={45}-/><SnippetCodesrc="fern/snippets/providers/python/openai-provider.py"startLine={10}endLine={24}/>+<SnippetCode+ src="fern/snippets/providers/typescript/openai.ts"+ startLine={26}+ endLine={45}+/></CodeGroup>diff --git a/fern/pages/src/providers/py-custom.mdx b/fern/pages/src/providers/py-custom.mdxnew file mode 100644index 000000000..32b2d9fbb--- /dev/null+++ b/fern/pages/src/providers/py-custom.mdx@@ -0,0 +1,6 @@+---+title: Python Custom Provider+image: "https://og.composio.dev/api/og?title=Custom%20Providers" # image for socials+keywords: ""+hide-nav-links: false+---diff --git a/fern/pages/src/providers/custom.mdx b/fern/pages/src/providers/ts-custom.mdxsimilarity index 98%rename from fern/pages/src/providers/custom.mdxrename to fern/pages/src/providers/ts-custom.mdxindex 8ac59e7c8..15ba4ac0a 100644--- a/fern/pages/src/providers/custom.mdx+++ b/fern/pages/src/providers/ts-custom.mdx@@ -1,11 +1,11 @@----title: Custom Providers+title: TypeScript Custom Providerimage: "https://og.composio.dev/api/og?title=Custom%20Providers" # image for socialskeywords: ""hide-nav-links: false----This guide provides a comprehensive walkthrough of creating custom providers for the Composio SDK, enabling integration with different AI frameworks and platforms.+This guide provides a comprehensive walkthrough of creating custom providers for the Composio TypeScriptSDK, enabling integration with different AI frameworks and platforms.## Provider Architecturediff --git a/fern/pages/src/tool-calling/after-execution-modifiers.mdx b/fern/pages/src/tool-calling/after-execution-modifiers.mdxindex 93d9710ed..0556afe6d 100644--- a/fern/pages/src/tool-calling/after-execution-modifiers.mdx+++ b/fern/pages/src/tool-calling/after-execution-modifiers.mdx@@ -33,6 +33,41 @@ Since completion providers don't have a function execution step -- Composio willHence, the modifier is configured on the `tools.execute` method.<CodeGroup>+```python Python maxLines=60 wordWrap+from composio import Composio, after_execute+from composio.types import ToolExecutionResponse++@after_execute(tools=["HACKERNEWS_GET_USER"])+def after_execute_modifier(+ tool: str,+ toolkit: str,+ response: ToolExecutionResponse,+) -> ToolExecutionResponse:+ return {+ **response,+ "data": {+ "karama": response["data"]["karama"],+ },+ }++# Get response from the LLM+response = openai_client.chat.completions.create(+ model="gpt-4o-mini",+ tools=tools,+ messages=messages,+)+print(response)++# Execute the function calls.+result = composio.provider.handle_tool_calls(+ response=response,+ user_id="default",+ modifiers=[+ after_execute_modifier,+ ]+)+print(result)+``````typescript TypeScript maxLines=60 wordWrapconst response = await openai.chat.completions.create({model: "gpt-4o-mini",@@ -73,9 +108,20 @@ if (tool_calls) {}```-```python Python maxLines=60 wordWrap++</CodeGroup>+</Tab>++<Tab title="With Agentic Frameworks">+Agentic providers have a function execution step.+The modifier is configured on the `tools.get` method which modifies the execution logic within the framework!+<CodeGroup>+```python Python (CrewAI) maxLines=60 wordWrapfrom composio import Composio, after_executefrom composio.types import ToolExecutionResponse+from composio_crewai import CrewAIProvider++composio = Composio(provider=CrewAIProvider())@after_execute(tools=["HACKERNEWS_GET_USER"])def after_execute_modifier(@@ -86,36 +132,19 @@ def after_execute_modifier(return {**response,"data": {- "karama": response["data"]["karama"],+ "karma": response["data"]["karma"],},}-# Get response from the LLM-response = openai_client.chat.completions.create(- model="gpt-4o-mini",- tools=tools,- messages=messages,-)-print(response)-# Execute the function calls.-result = composio.provider.handle_tool_calls(- response=response,- user_id="default",- modifiers=[- after_execute_modifier,- ]+tools = composio.tools.get(+ user_id="default",+ slug="HACKERNEWS_GET_USER",+ modifiers=[+ after_execute_modifier,+ ])-print(result)```--</CodeGroup>-</Tab>--<Tab title="With Agentic Frameworks">-Agentic providers have a function execution step.-The modifier is configured on the `tools.get` method which modifies the execution logic within the framework!-<CodeGroup>```typescript TypeScript (Vercel) maxLines=60 wordWrap {24-27}import { Composio } from "@composio/core";import { VercelProvider } from "@composio/vercel";@@ -151,35 +180,6 @@ const agenticTools = await composio.tools.get(});-```-```python Python (CrewAI) maxLines=60 wordWrap-from composio import Composio, after_execute-from composio.types import ToolExecutionResponse-from composio_crewai import CrewAIProvider--composio = Composio(provider=CrewAIProvider())--@after_execute(tools=["HACKERNEWS_GET_USER"])-def after_execute_modifier(- tool: str,- toolkit: str,- response: ToolExecutionResponse,-) -> ToolExecutionResponse:- return {- **response,- "data": {- "karama": response["data"]["karama"],- },- }---tools = composio.tools.get(- user_id="default",- slug="HACKERNEWS_GET_USER",- modifiers=[- after_execute_modifier,- ]-)```</CodeGroup>diff --git a/fern/pages/src/tool-calling/authenticating-tools.mdx b/fern/pages/src/tool-calling/authenticating-tools.mdxindex d32e1a8ee..3ad237477 100644--- a/fern/pages/src/tool-calling/authenticating-tools.mdx+++ b/fern/pages/src/tool-calling/authenticating-tools.mdx@@ -66,16 +66,16 @@ Here's how to authenticate a toolkit for a given user using the OAuth flow.<CodeGroup><SnippetCode- src="fern/snippets/tool-calling/typescript/auth-tools.ts"+ src="fern/snippets/tool-calling/python/auth-tools.py"startLine={1}endLine={21}- title="TypeScript"+ title="Python"/><SnippetCode- src="fern/snippets/tool-calling/python/auth-tools.py"+ src="fern/snippets/tool-calling/typescript/auth-tools.ts"startLine={1}endLine={21}- title="Python"+ title="TypeScript"/></CodeGroup>@@ -88,18 +88,18 @@ For API key based toolkits, you can either request the user to provide the API kIf you know the required authentication fields for your toolkit (like `apiKey` for most API-based services), you can directly create the connection:<CodeGroup>-<SnippetCode- src="fern/snippets/tool-calling/typescript/auth-tools.ts"- startLine={24}- endLine={37}- title="TypeScript"-/><SnippetCodesrc="fern/snippets/tool-calling/python/auth-tools.py"startLine={23}endLine={31}title="Python"/>+<SnippetCode+ src="fern/snippets/tool-calling/typescript/auth-tools.ts"+ startLine={24}+ endLine={37}+ title="TypeScript"+/></CodeGroup>## Specifying auth schemes@@ -112,18 +112,18 @@ The auth scheme information is typed and can be configured as follows:<CodeGroup>-<SnippetCode- src="fern/snippets/tool-calling/typescript/auth-tools.ts"- startLine={38}- endLine={50}- title="TypeScript"-/><SnippetCodesrc="fern/snippets/tool-calling/python/auth-tools.py"startLine={32}endLine={44}title="Python"/>+<SnippetCode+ src="fern/snippets/tool-calling/typescript/auth-tools.ts"+ startLine={38}+ endLine={50}+ title="TypeScript"+/></CodeGroup>It might be useful to read all the optional and required auth config fields for a toolkit and optionally prompt the user for the values.@@ -136,15 +136,15 @@ In this case, the user will be redirected to `https://www.yourapp.com/callback`<CodeGroup><SnippetCode- src="fern/snippets/tool-calling/typescript/callback-url.ts"+ src="fern/snippets/tool-calling/python/callback-url.py"startLine={10}endLine={20}- title="TypeScript"+ title="Python"/><SnippetCode- src="fern/snippets/tool-calling/python/callback-url.py"+ src="fern/snippets/tool-calling/typescript/callback-url.ts"startLine={10}endLine={20}- title="Python"+ title="TypeScript"/></CodeGroup>diff --git a/fern/pages/src/tool-calling/before-execution-modifiers.mdx b/fern/pages/src/tool-calling/before-execution-modifiers.mdxindex 28803e1d5..c00056638 100644--- a/fern/pages/src/tool-calling/before-execution-modifiers.mdx+++ b/fern/pages/src/tool-calling/before-execution-modifiers.mdx@@ -33,6 +33,46 @@ Since completion providers don't have a function execution step -- Composio willHence, the modifier is configured on the `tools.execute` method.<CodeGroup>+```python Python maxLines=60 wordWrap+from openai import OpenAI+from composio import Composio, before_execute+from composio.types import ToolExecuteParams++composio = Composio()+openai_client = OpenAI()+user_id = "[email protected]"++@before_execute(tools=["HACKERNEWS_GET_LATEST_POSTS"])+def before_execute_modifier(+ tool: str,+ toolkit: str,+ params: ToolExecuteParams,+) -> ToolExecuteParams:+ params["arguments"]["size"] = 1+ return params+++# Get tools+tools = composio.tools.get(user_id=user_id, slug="HACKERNEWS_GET_LATEST_POSTS")++# Get response from the LLM+response = openai_client.chat.completions.create(+ model="gpt-4o-mini",+ tools=tools,+ messages=[{"role": "user", "content": "Fetch latest posts from hackernews"}],+)+print(response)++# Execute the function calls.+result = composio.provider.handle_tool_calls(+ response=response,+ user_id="default",+ modifiers=[+ before_execute_modifier,+ ],+)+print(result)+``````typescript TypeScript maxLines=60 wordWrap {11, 20-28}const response = await openai.chat.completions.create({model: "gpt-4o-mini",@@ -69,55 +109,43 @@ if (tool_calls) {}```-```python Python maxLines=60 wordWrap-from openai import OpenAI++</CodeGroup>+</Tab>++<Tab title="With Agentic Frameworks">+Agentic providers have a function execution step.+The modifier is configured on the `tools.get` method which modifies the execution logic within the framework!++<CodeGroup>+```python Python (CrewAI) maxLines=60 wordWrapfrom composio import Composio, before_executefrom composio.types import ToolExecuteParams+from composio_crewai import CrewAIProvider-composio = Composio()-openai_client = OpenAI()-user_id = "[email protected]"+composio = Composio(provider=CrewAIProvider())-@before_execute(tools=["HACKERNEWS_GET_LATEST_POSTS"])-def before_execute_modifier(+@before_execute(tools=["LINEAR_CREATE_LINEAR_ISSUE"])+def modify_linear_project_id(tool: str,toolkit: str,params: ToolExecuteParams,) -> ToolExecuteParams:- params["arguments"]["size"] = 1+ params["arguments"]["project_id"] = "1234567890"return params--# Get tools-tools = composio.tools.get(user_id=user_id, slug="HACKERNEWS_GET_LATEST_POSTS")--# Get response from the LLM-response = openai_client.chat.completions.create(- model="gpt-4o-mini",- tools=tools,- messages=[{"role": "user", "content": "Fetch latest posts from hackernews"}],-)-print(response)--# Execute the function calls.-result = composio.provider.handle_tool_calls(- response=response,+tools = composio.tools.get(user_id="default",- modifiers=[- before_execute_modifier,+ tools=[+ "HACKERNEWS_GET_LATEST_POSTS",+ "HACKERNEWS_GET_USER",+ "LINEAR_CREATE_LINEAR_ISSUE",],+ modifiers=[+ after_execute_modifier,+ ])-print(result)```--</CodeGroup>-</Tab>--<Tab title="With Agentic Frameworks">-Agentic providers have a function execution step.-The modifier is configured on the `tools.get` method which modifies the execution logic within the framework!--<CodeGroup>```typescript TypeScript (Mastra) maxLines=60 wordWrap {22-26}import { Composio } from "@composio/core";import { MastraProvider } from "@composio/mastra";@@ -158,34 +186,6 @@ const { text } = await generateText({maxSteps: 5,});-```-```python Python (CrewAI) maxLines=60 wordWrap-from composio import Composio, before_execute-from composio.types import ToolExecuteParams-from composio_crewai import CrewAIProvider--composio = Composio(provider=CrewAIProvider())--@before_execute(tools=["LINEAR_CREATE_LINEAR_ISSUE"])-def modify_linear_project_id(- tool: str,- toolkit: str,- params: ToolExecuteParams,-) -> ToolExecuteParams:- params["arguments"]["project_id"] = "1234567890"- return params--tools = composio.tools.get(- user_id="default",- tools=[- "HACKERNEWS_GET_LATEST_POSTS",- "HACKERNEWS_GET_USER",- "LINEAR_CREATE_LINEAR_ISSUE",- ],- modifiers=[- after_execute_modifier,- ]-)```</CodeGroup>diff --git a/fern/pages/src/tool-calling/custom-tools.mdx b/fern/pages/src/tool-calling/custom-tools.mdxindex 7ac6ef4b1..bee4390d5 100644--- a/fern/pages/src/tool-calling/custom-tools.mdx+++ b/fern/pages/src/tool-calling/custom-tools.mdx@@ -203,6 +203,37 @@ def get_issue_info_direct(You can add custom headers and query parameters to your toolkit-based tools using the `parameters` option in `executeToolRequest`:<CodeGroup>+```python Python maxLines=60 wordWrap[email protected]_tool(toolkit="github")+def get_issue_info(+ request: GetIssueInfoInput,+ execute_request: ExecuteRequestFn,+ auth_credentials: dict,+) -> dict:+ """Get information about a GitHub issue."""+ response = execute_request(+ endpoint=f"/repos/composiohq/composio/issues/{request.issue_number}",+ method="GET",+ parameters=[+ {+ "name": "Accept",+ "value": "application/vnd.github.v3+json",+ "type": "header",+ },+ {+ "name": "Authorization",+ "value": f"Bearer {auth_credentials['access_token']}",+ "type": "header",+ },+ {+ "name": 'X-Custom-Header',+ "value": 'custom-value',+ "type": 'header',+ },+ ],+ )+ return {"data": response.data}+``````typescript TypeScript maxLines=60const tool = await composio.tools.createCustomTool({slug: 'GITHUB_SEARCH_REPOSITORIES',@@ -247,37 +278,6 @@ const tool = await composio.tools.createCustomTool({},});```-```python Python maxLines=60 wordWrap[email protected]_tool(toolkit="github")-def get_issue_info(- request: GetIssueInfoInput,- execute_request: ExecuteRequestFn,- auth_credentials: dict,-) -> dict:- """Get information about a GitHub issue."""- response = execute_request(- endpoint=f"/repos/composiohq/composio/issues/{request.issue_number}",- method="GET",- parameters=[- {- "name": "Accept",- "value": "application/vnd.github.v3+json",- "type": "header",- },- {- "name": "Authorization",- "value": f"Bearer {auth_credentials['access_token']}",- "type": "header",- },- {- "name": 'X-Custom-Header',- "value": 'custom-value',- "type": 'header',- },- ],- )- return {"data": response.data}-```</CodeGroup>## Executing Custom Tools@@ -285,6 +285,13 @@ def get_issue_info(You can execute custom tools just like any other tool:<CodeGroup>+```python Python maxLines=60 wordWrap+response = composio.tools.execute(+ user_id="default",+ slug="TOOL_SLUG", # For the tool above you can use `get_issue_info.slug`+ arguments={"issue_number": 1},+)+``````typescript TypeScript maxLines=60 wordWrapconst result = await composio.tools.execute('TOOL_SLUG', {arguments: {@@ -294,13 +301,6 @@ const result = await composio.tools.execute('TOOL_SLUG', {connectedAccountId: 'optional-account-id', // Required for toolkit-based tools});```-```python Python maxLines=60 wordWrap-response = composio.tools.execute(- user_id="default",- slug="TOOL_SLUG", # For the tool above you can use `get_issue_info.slug`- arguments={"issue_number": 1},-)-```</CodeGroup>## Best Practicesdiff --git a/fern/pages/src/tool-calling/executing-tools.mdx b/fern/pages/src/tool-calling/executing-tools.mdxindex 04ede809c..6dc36bd1b 100644--- a/fern/pages/src/tool-calling/executing-tools.mdx+++ b/fern/pages/src/tool-calling/executing-tools.mdx@@ -15,22 +15,20 @@ This approach works consistently across all supported non-agent providers.To learn how to setup these providers, see [Providers](/providers).<CodeGroup>-<SnippetCode- src="fern/snippets/tool-calling/typescript/exec-tool-completions.ts"- startLine={1}- endLine={30}- title="TypeScript (Anthropic)"-/>-<SnippetCodesrc="fern/snippets/tool-calling/python/exec-tool-completions.py"startLine={1}endLine={25}title="Python (Google)"/>+<SnippetCode+ src="fern/snippets/tool-calling/typescript/exec-tool-completions.ts"+ startLine={1}+ endLine={30}+ title="TypeScript (Anthropic)"+/></CodeGroup>-## Using Agentic FrameworksComposio also has first-party support for agentic frameworks which execute tools, feed the result to the LLM and continue the conversation.@@ -40,19 +38,18 @@ Here, the tool execution is handled by the agentic framework. Composio makes sur</Tip><CodeGroup>-<SnippetCode- src="fern/snippets/tool-calling/typescript/exec-tool-agentic.ts"- startLine={1}- endLine={30}- title="TypeScript (Anthropic)"-/>-<SnippetCodesrc="fern/snippets/tool-calling/python/exec-tool-agentic.py"startLine={1}endLine={37}title="Python (OpenAI Agents SDK)"/>+<SnippetCode+ src="fern/snippets/tool-calling/typescript/exec-tool-agentic.ts"+ startLine={1}+ endLine={30}+ title="TypeScript (Anthropic)"+/></CodeGroup>## Tools are scoped to a user@@ -67,19 +64,6 @@ For more information on authentication, see [Authenticating Tools](./authenticatIn case you just want to call a tool manually -- not using any framework or LLM provider, you can do so using the `execute` method.<CodeGroup>-```typescript TypeScript maxLines=60 wordWrap-const userId = "[email protected]";-const composio = new Composio();--const result = await composio.tools.execute("HACKERNEWS_GET_USER", {- userId,- arguments: {- username: "pg",- },-});-console.log(result);-```-```python Python maxLines=60 wordWrapuser_id = "[email protected]"@@ -92,24 +76,24 @@ result = composio.tools.execute()print(result)```+```typescript TypeScript maxLines=60 wordWrap+const userId = "[email protected]";+const composio = new Composio();++const result = await composio.tools.execute("HACKERNEWS_GET_USER", {+ userId,+ arguments: {+ username: "pg",+ },+});+console.log(result);+```</CodeGroup>### Proxy Execute -- Manually calling toolkit APIsYou 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.<CodeGroup>-```typescript TypeScript maxLines=60 wordWrap-// Send a custom request to a toolkit-const { data } = await composio.tools.proxyExecute({- toolkitSlug: 'github',- userId: '[email protected]',- data: {- endpoint: '/repos/owner/repo/issues',- method: 'GET'- }-});-console.log(data);-``````python Python maxLines=60 wordWrapresponse = composio.tools.proxy(endpoint="/repos/composiohq/composio/issues/1",@@ -124,6 +108,18 @@ response = composio.tools.proxy(],)```+```typescript TypeScript maxLines=60 wordWrap+// Send a custom request to a toolkit+const { data } = await composio.tools.proxyExecute({+ toolkitSlug: 'github',+ userId: '[email protected]',+ data: {+ endpoint: '/repos/owner/repo/issues',+ method: 'GET'+ }+});+console.log(data);+```</CodeGroup>If you're interested in extending toolkits and creating custom tools, see [Custom tools](/docs/custom-tools).@@ -137,25 +133,6 @@ Composio SDK includes automatic file handling for tools that work with files. WhWhen a tool accepts file inputs (marked with `file_uploadable: true`), you can pass local file paths or URLs. Here's an example using Google Drive upload:<CodeGroup>-```typescript TypeScript maxLines=60 wordWrap-import { Composio } from '@composio/core';-import path from 'path';--const composio = new Composio({- apiKey: process.env.COMPOSIO_API_KEY-});--// Upload a local file to Google Drive-const result = await composio.tools.execute('GOOGLEDRIVE_UPLOAD_FILE', {- userId: 'default',- arguments: {- file_to_upload: path.join(__dirname, 'document.pdf') // Local file path- }-});--console.log(result.data); // Contains Google Drive file details-```-```python Python maxLines=60 wordWrapimport os@@ -174,6 +151,25 @@ result = composio.tools.execute(print(result.data) # Contains Google Drive file details```++```typescript TypeScript maxLines=60 wordWrap+import { Composio } from '@composio/core';+import path from 'path';++const composio = new Composio({+ apiKey: process.env.COMPOSIO_API_KEY+});++// Upload a local file to Google Drive+const result = await composio.tools.execute('GOOGLEDRIVE_UPLOAD_FILE', {+ userId: 'default',+ arguments: {+ file_to_upload: path.join(__dirname, 'document.pdf') // Local file path+ }+});++console.log(result.data); // Contains Google Drive file details+```</CodeGroup>The SDK automatically:@@ -188,19 +184,6 @@ When a tool returns file outputs, the SDK automatically:2. Provides the local file path in the response<CodeGroup>-```typescript TypeScript maxLines=60 wordWrap-// Download a file from Google Drive-const result = await composio.tools.execute('GOOGLEDRIVE_DOWNLOAD_FILE', {- userId: 'default',- arguments: {- file_id: 'your_file_id'- }-});--// Result includes local file path-console.log(result.data.file.uri); // "/path/to/downloaded/file.pdf"-```-```python Python maxLines=60 wordWrap# Download a file from Google Driveresult = composio.tools.execute(@@ -214,6 +197,19 @@ result = composio.tools.execute(# Result includes local file pathprint(result.data["file"]) # "/path/to/downloaded/file.pdf"```++```typescript TypeScript maxLines=60 wordWrap+// Download a file from Google Drive+const result = await composio.tools.execute('GOOGLEDRIVE_DOWNLOAD_FILE', {+ userId: 'default',+ arguments: {+ file_id: 'your_file_id'+ }+});++// Result includes local file path+console.log(result.data.file.uri); // "/path/to/downloaded/file.pdf"+```</CodeGroup>### Disabling Auto File Handlingdiff --git a/fern/pages/src/tool-calling/fetching-tools.mdx b/fern/pages/src/tool-calling/fetching-tools.mdxindex 1f9d693ff..3730b54b3 100644--- a/fern/pages/src/tool-calling/fetching-tools.mdx+++ b/fern/pages/src/tool-calling/fetching-tools.mdx@@ -24,6 +24,13 @@ Composio determines the importance of a tool based on the usage and relevance of</Tip><CodeGroup>+```python Python maxLines=60 wordWrap+tools = composio.tools.get(+ user_id,+ toolkits=["GITHUB", "HACKERNEWS"],+)+```+```typescript TypeScript maxLines=60 wordWrapconst tools = await composio.tools.get(userId,@@ -32,13 +39,6 @@ const tools = await composio.tools.get(});```--```python Python maxLines=60 wordWrap-tools = composio.tools.get(- user_id,- toolkits=["GITHUB", "HACKERNEWS"],-)-```</CodeGroup>**Limiting the results**@@ -48,12 +48,6 @@ Multiple toolkits have 100s of tools. These can easily overwhelm the LLM. Hence,The default `limit` is 20 -- meaning you get the top 20 important tools from the toolkit.<CodeGroup>-```typescript TypeScript maxLines=60 wordWrap-const tools = await composio.tools.get(userId, {- toolkits: ["GITHUB"],- limit: 5, // Returns the top 5 important tools from the toolkit-});-``````python Python maxLines=60 wordWraptools = composio.tools.get(user_id,@@ -61,6 +55,12 @@ tools = composio.tools.get(limit=5, # Returns the top 5 important tools from the toolkit)```+```typescript TypeScript maxLines=60 wordWrap+const tools = await composio.tools.get(userId, {+ toolkits: ["GITHUB"],+ limit: 5, // Returns the top 5 important tools from the toolkit+});+```</CodeGroup>**Filtering by scopes**@@ -75,14 +75,6 @@ Scope filtering can only be used with a single toolkit at a time.</Tip><CodeGroup>-```typescript TypeScript maxLines=60 wordWrap-// Get GitHub tools that require specific scopes-const tools = await composio.tools.get(userId, {- toolkits: ["GITHUB"],- scopes: ["repo"], // Only get tools requiring these scopes- limit: 10-});-``````python Python maxLines=60 wordWrap# Get GitHub tools that require specific scopestools = composio.tools.get(@@ -92,6 +84,14 @@ tools = composio.tools.get(limit=10)```+```typescript TypeScript maxLines=60 wordWrap+// Get GitHub tools that require specific scopes+const tools = await composio.tools.get(userId, {+ toolkits: ["GITHUB"],+ scopes: ["repo"], // Only get tools requiring these scopes+ limit: 10+});+```</CodeGroup>## Filtering by tool@@ -99,16 +99,6 @@ You may specify the list of tools to fetch by directly providing the tool names.<CodeGroup>-```typescript TypeScript maxLines=60 wordWrap-const tools = await composio.tools.get(userId, {- tools: [- "GITHUB_CREATE_AN_ISSUE",- "GITHUB_CREATE_AN_ISSUE_COMMENT",- "GITHUB_CREATE_A_COMMIT",- ],-});-```-```python Python maxLines=60 wordWraptools = composio.tools.get(user_id,@@ -119,6 +109,16 @@ tools = composio.tools.get(],)```++```typescript TypeScript maxLines=60 wordWrap+const tools = await composio.tools.get(userId, {+ tools: [+ "GITHUB_CREATE_AN_ISSUE",+ "GITHUB_CREATE_AN_ISSUE_COMMENT",+ "GITHUB_CREATE_A_COMMIT",+ ],+});+```</CodeGroup>## Fetching raw tools@@ -130,16 +130,16 @@ To examine the raw schema definitition of a tool to understand the input/output<CodeGroup><SnippetCode- src="fern/snippets/tool-calling/typescript/raw_tools.ts"+ src="fern/snippets/tool-calling/python/raw_tools.py"startLine={5}endLine={7}- title="TypeScript"+ title="Python"/><SnippetCode- src="fern/snippets/tool-calling/python/raw_tools.py"+ src="fern/snippets/tool-calling/typescript/raw_tools.ts"startLine={5}endLine={7}- title="Python"+ title="TypeScript"/></CodeGroup>@@ -150,19 +150,6 @@ You may also filter tools by searching for them. This is a good way to find toolThis step runs a semantic search on the tool names and descriptions and returns the most relevant tools.<CodeGroup>-```typescript TypeScript maxLines=60 wordWrap-const tools = await composio.tools.get(userId, {- search: "hubspot organize contacts",-});--// Search within a specific toolkit-const tools = await composio.tools.get(userId, {- search: "repository issues",- toolkits: ["GITHUB"], // Optional: limit search to specific toolkit- limit: 5 // Optional: limit number of results-});-```-```python Python maxLines=60 wordWraptools = composio.tools.get(user_id,@@ -177,6 +164,19 @@ tools = composio.tools.get(limit=5 # Optional: limit number of results)```++```typescript TypeScript maxLines=60 wordWrap+const tools = await composio.tools.get(userId, {+ search: "hubspot organize contacts",+});++// Search within a specific toolkit+const tools = await composio.tools.get(userId, {+ search: "repository issues",+ toolkits: ["GITHUB"], // Optional: limit search to specific toolkit+ limit: 5 // Optional: limit number of results+});+```</CodeGroup>## Filter Combinationsdiff --git a/fern/pages/src/tool-calling/schema-modifiers.mdx b/fern/pages/src/tool-calling/schema-modifiers.mdxindex a5ea9f29c..f2905a027 100644--- a/fern/pages/src/tool-calling/schema-modifiers.mdx+++ b/fern/pages/src/tool-calling/schema-modifiers.mdx@@ -27,6 +27,30 @@ Schema modifiers transform a tool's schema before the tool is seen by an agent.</Note><CodeGroup>+```python Python maxLines=60 wordWrap+from composio import Composio, schema_modifier+from composio.types import Tool++user_id = "[email protected]"++@schema_modifier(tools=["HACKERNEWS_GET_LATEST_POSTS"])+def modify_schema(+ tool: str,+ toolkit: str,+ schema: Tool,+) -> Tool:+ _ = schema.input_parameters["properties"].pop("page", None)+ schema.input_parameters["required"] = ["size"]+ return schema++tools = composio.tools.get(+ user_id=user_id,+ tools=["HACKERNEWS_GET_LATEST_POSTS", "HACKERNEWS_GET_USER"],+ modifiers=[+ modify_schema,+ ]+)+``````typescript TypeScript maxLines=60 wordWrapconst userId = "[email protected]";@@ -52,11 +76,23 @@ const tools = await composio.tools.get(console.log(JSON.stringify(tools, null, 2));```-```python Python maxLines=60 wordWrap++</CodeGroup>++In using the above modified tool schema, the `page` argument is removed and the `size` argument is required.++You can test this out by viewing the tool call response in the LLM too!++<Accordion title="Schema modified tool call">+<CodeGroup>++```python Python maxLines=60 wordWrap++from openai import OpenAIfrom composio import Composio, schema_modifierfrom composio.types import Tool+from composio_openai import OpenAIProvider-user_id = "[email protected]"@schema_modifier(tools=["HACKERNEWS_GET_LATEST_POSTS"])def modify_schema(@@ -68,23 +104,37 @@ def modify_schema(schema.input_parameters["required"] = ["size"]return schema-tools = composio.tools.get(- user_id=user_id,- tools=["HACKERNEWS_GET_LATEST_POSTS", "HACKERNEWS_GET_USER"],- modifiers=[- modify_schema,- ]-)-```+# Initialize tools.+openai_client = OpenAI()+composio = Composio(provider=OpenAIProvider())-</CodeGroup>+# Define task.+task = "Get the latest posts from Hacker News"-In using the above modified tool schema, the `page` argument is removed and the `size` argument is required.+# Get GitHub tools that are pre-configured+tools = composio.tools.get(+ user_id="default",+ tools=['HACKERNEWS_GET_LATEST_POSTS', 'HACKERNEWS_GET_USER'],+ modifiers=[+ modify_schema,+ ],+)-You can test this out by viewing the tool call response in the LLM too!+# Get response from the LLM+response = openai_client.chat.completions.create(+ model="gpt-4o-mini",+ tools=tools,+ messages=[+ {"role": "system", "content": "You are a helpful assistant."},+ {"role": "user", "content": task},+ ],+)+print(response)-<Accordion title="Schema modified tool call">-<CodeGroup>+# Execute the function calls.+result = composio.provider.handle_tool_calls(response=response, user_id="default")+print(result)+``````typescript TypeScript maxLines=60 wordWrapimport { Composio } from '@composio/core';@@ -134,55 +184,5 @@ const response = await openai.chat.completions.create({console.log(response.choices[0].message.tool_calls);```-```python Python maxLines=60 wordWrap--from openai import OpenAI-from composio import Composio, schema_modifier-from composio.types import Tool-from composio_openai import OpenAIProvider---@schema_modifier(tools=["HACKERNEWS_GET_LATEST_POSTS"])-def modify_schema(- tool: str,- toolkit: str,- schema: Tool,-) -> Tool:- _ = schema.input_parameters["properties"].pop("page", None)- schema.input_parameters["required"] = ["size"]- return schema--# Initialize tools.-openai_client = OpenAI()-composio = Composio(provider=OpenAIProvider())--# Define task.-task = "Star a repo composiohq/composio on GitHub"--# Get GitHub tools that are pre-configured-tools = composio.tools.get(- user_id="default",- tools=['HACKERNEWS_GET_LATEST_POSTS', 'HACKERNEWS_GET_USER'],- modifiers=[- modify_schema,- ],-)--# Get response from the LLM-response = openai_client.chat.completions.create(- model="gpt-4o-mini",- tools=tools,- messages=[- {"role": "system", "content": "You are a helpful assistant."},- {"role": "user", "content": task},- ],-)-print(response)--# Execute the function calls.-result = composio.provider.handle_tool_calls(response=response, user_id="default")-print(result)-```-</CodeGroup></Accordion>diff --git a/fern/pages/src/triggers/using-triggers.mdx b/fern/pages/src/triggers/using-triggers.mdxindex 2165eab61..b8ab9ed04 100644--- a/fern/pages/src/triggers/using-triggers.mdx+++ b/fern/pages/src/triggers/using-triggers.mdx@@ -56,12 +56,6 @@ First, you can view the required configuration to make the trigger too as followTo create a trigger, first fetch the user's connection ID, then use it along with the required configuration.<CodeGroup>-<SnippetCode- src="fern/snippets/triggers/typescript/triggers.ts"- startLine={28}- endLine={40}- title="TypeScript (new)"-/>```python Pythoninstance = composio.triggers.create(slug="GITHUB_COMMIT_EVENT",@@ -73,6 +67,12 @@ instance = composio.triggers.create()print(instance)```+<SnippetCode+ src="fern/snippets/triggers/typescript/triggers.ts"+ startLine={28}+ endLine={40}+ title="TypeScript (new)"+/></CodeGroup>@@ -85,14 +85,6 @@ When you specify multiple multiple filters, _ALL_ of them must match for the triThis method uses websockets to subscribe to the trigger.<CodeGroup>-<SnippetCode-src="fern/snippets/triggers/typescript/triggers.ts"-startLine={42}-endLine={53}-title="TypeScript (new)"-/>--```python Python# Fetch connected account for useruser_id = "[email protected]"@@ -115,6 +107,13 @@ instance = composio.triggers.create(print(instance)```+<SnippetCode+src="fern/snippets/triggers/typescript/triggers.ts"+startLine={42}+endLine={53}+title="TypeScript (new)"+/>+</CodeGroup>@@ -128,13 +127,13 @@ To receive trigger events via webhooks, you need to configure a publicly accessi<CodeGroup><SnippetCode- src="fern/snippets/triggers/typescript/trigger-webhook.ts"- title="app/api/webhook/route.ts"+ src="fern/snippets/triggers/python/trigger-webhook.py"+ title="app/route.py"/><SnippetCode- src="fern/snippets/triggers/python/trigger-webhook.py"- title="app/route.py"+ src="fern/snippets/triggers/typescript/trigger-webhook.ts"+ title="app/api/webhook/route.ts"/></CodeGroup>@@ -143,18 +142,18 @@ To receive trigger events via webhooks, you need to configure a publicly accessiWhen subscribing to triggers, it is helpful to know the payload type recieved from the trigger. You can inspect the payload type by fetching the trigger type.<CodeGroup>-```typescript TypeScript maxLines=60 wordWrap-const triggerType = await composio.triggers.getType("SLACK_RECEIVE_MESSAGE");--console.log(triggerType.payload);-```-```python Python maxLines=60 wordWrap# Get a trigger by idtrigger = composio.triggers.get_type(slug="GITHUB_COMMIT_EVENT")print(trigger.payload)```+```typescript TypeScript maxLines=60 wordWrap+const triggerType = await composio.triggers.getType("SLACK_RECEIVE_MESSAGE");++console.log(triggerType.payload);+```+</CodeGroup>## Subscribing to triggers through the SDK@@ -168,6 +167,17 @@ You subscribe to multiple trigger events by configuring the filters.When you specify multiple multiple filters, _ALL_ of them must match for the trigger to be subscribed to.<CodeGroup>+```python Python maxLines=60 wordWrap+user_id = "[email protected]"++# Subscribe to a trigger+subscription = composio.triggers.subscribe()++# Define a handler[email protected](toolkit="GITHUB", user_id=user_id)+def handle_github_event(data):+ print(data)+``````typescript TypeScript maxLines=60 wordWrapawait composio.triggers.subscribe(triggerData => {@@ -182,17 +192,6 @@ await composio.triggers.subscribe(})```-```python Python maxLines=60 wordWrap-user_id = "[email protected]"--# Subscribe to a trigger-subscription = composio.triggers.subscribe()--# Define a handler[email protected](toolkit="GITHUB", user_id=user_id)-def handle_github_event(data):- print(data)-```</CodeGroup>## Specifying trigger configuration@@ -211,30 +210,22 @@ The dashboard will show you the trigger configuration to fill in.</Frame><CodeGroup>+```python Python maxLines=60 wordWrap+# Get a trigger by id+trigger = composio.triggers.get_type(slug="GITHUB_COMMIT_EVENT")+print(trigger.config)+```+```typescript TypeScript maxLines=60 wordWrapconst triggerType = await composio.triggers.getType("GITHUB_STAR_ADDED_EVENT");console.log(triggerType.config);-```-```python Python maxLines=60 wordWrap-# Get a trigger by id-trigger = composio.triggers.get_type(slug="GITHUB_COMMIT_EVENT")-print(trigger.config)```</CodeGroup><CodeGroup>-```typescript TypeScript maxLines=60 wordWrap-await composio.triggers.create("GITHUB_PULL_REQUEST_EVENT", {- connectedAccountId: "ca_k_py8Qbd17_d",- triggerConfig: { // Properties expected for trigger config- owner: "composiohq",- repo: "composio",- },-});-``````python Python maxLines=60 wordWrapinstance = composio.triggers.create(slug="GITHUB_PULL_REQUEST_EVENT",@@ -245,6 +236,15 @@ instance = composio.triggers.create(},)```+```typescript TypeScript maxLines=60 wordWrap+await composio.triggers.create("GITHUB_PULL_REQUEST_EVENT", {+ connectedAccountId: "ca_k_py8Qbd17_d",+ triggerConfig: { // Properties expected for trigger config+ owner: "composiohq",+ repo: "composio",+ },+});+```</CodeGroup>## Enabling/Disabling triggers@@ -252,27 +252,27 @@ instance = composio.triggers.create(In cases where the trigger isn't required for the system, it can be disabled.<CodeGroup>- ```typescript TypeScript maxLines=60 wordWrap- await composio.triggers.disable("ti_abcd123");- ``````python Python maxLines=60 wordWrap# Disable a trigger instancedisabled_instance = composio.triggers.disable(trigger_id="ti_abcd123")print(disabled_instance)```+ ```typescript TypeScript maxLines=60 wordWrap+ await composio.triggers.disable("ti_abcd123");+ ```</CodeGroup>If needed, the trigger can be enabled again.<CodeGroup>- ```typescript TypeScript maxLines=60 wordWrap- await composio.triggers.enable("ti_abcd123");- ``````python Python maxLines=60 wordWrap# Enable a trigger instanceenabled_instance = composio.triggers.enable(trigger_id="ti_abcd123")print(enabled_instance)```+ ```typescript TypeScript maxLines=60 wordWrap+ await composio.triggers.enable("ti_abcd123");+ ```</CodeGroup>## Troubleshooting