Fetching Tools

Learn how to filter and go through Composio tools programmatically

Composio has 9000+ tools that one can view, fetch and filter from.

To view the tools, you can use the Composio Tool Directory. It’s a searchable catalog of tools from all our apps. It has the following info for each app:

  • Authentication details for the app.
  • List of available actions.
  • Schema for each action.

Once you know which tools you need, you can fetch their definitions programmatically using the methods below.

Fetching Specific Actions

This is the most precise method. Use it when you know exactly which tool(s) your agent needs access to for a specific task. You can pass specific Action enums or their string equivalents.

1from composio_openai import ComposioToolSet, Action
2
3# Initialize ToolSet (assuming API key is in env)
4toolset = ComposioToolSet()
5
6# Fetch only the tool for starring a GitHub repo
7github_star_tool = toolset.get_tools(
8 actions=[Action.GITHUB_STAR_A_REPOSITORY_FOR_THE_AUTHENTICATED_USER]
9)
10
11print(github_star_tool)
12# Output will contain the schema for the specified action.

Fetching Tools by App

If you want to give an LLM general capabilities for a connected application (like “manage my GitHub issues”), you can fetch tools by specifying the App.

1# Fetch default tools for the connected GitHub app
2github_tools = toolset.get_tools(apps=[App.GITHUB])
3
4print(f"Fetched {len(github_tools)} tools for GitHub.")
5# Output contains schemas for 'important' GitHub tools.
Default App Tool Filtering

By default, fetching tools using only the apps filter returns actions tagged as important. This prevents overwhelming the LLM’s context window with too many tools. If you need all actions for an app, you’ll need to fetch them explicitly or explore the app’s page in the Tool Directory.

Fetching Specific Tools

You can fetch specific tools by their action names.

1# Fetch specific tools by action name
2github_tools = toolset.get_tools(
3 actions=[
4 Action.GITHUB_GET_THE_AUTHENTICATED_USER,
5 Action.GITHUB_LIST_REPOSITORIES_FOR_THE_AUTHENTICATED_USER
6 ]
7)
8
9print(f"Fetched {len(github_tools)} tools.")
10# Output contains schemas for the specified actions.

Filtering App Tools by Tags

You can refine the tools fetched for an app by adding tags. This is useful for focusing the LLM on a specific category of actions within an app.

1# Fetch only Jira tools related to 'Issues'
2jira_issue_tools = toolset.get_tools(
3 apps=[App.JIRA],
4 tags=["Issues"] # Tag names are case-sensitive
5)
6
7print(f"Fetched {len(jira_issue_tools)} Jira tools tagged with 'Issues'.")

Finding Tools by Use Case (Experimental)

For creating more agentic flows when creating general agents over a broad problem statement, you can search for actions based on a natural language description of the task and then inject it in.

This feature uses semantic search and is currently experimental. Results may vary.
1# Describe the task
2query = "create a new page in notion"
3
4# Find relevant action ENUMS (Python-specific helper)
5relevant_actions = toolset.find_actions_by_use_case(
6 use_case=query,
7 apps=[App.NOTION] # Optionally scope the search to specific apps
8 # advanced=True # Use for complex queries needing multiple tools
9)
10
11print(f"Found relevant actions: {relevant_actions}")
12
13# Fetch the actual tool schemas for the found actions
14if relevant_actions:
15 notion_tools = toolset.get_tools(actions=relevant_actions)
16 print(f"Fetched {len(notion_tools)} tool(s) for the use case.")
17else:
18 print("No relevant actions found for the use case.")
19
20# Use the `notion_tools` in your agent

Use the advanced=True (Python) / advanced: true (TypeScript) flag if the use case might require multiple tools working together in sequence. Composio’s search will attempt to find a suitable chain of actions.

Inspecting Tool Schemas

Sometimes, you might need to examine the raw JSON schema definition of a tool, rather than getting it pre-formatted for a specific LLM framework via get_tools. This can be useful for:

  • Understanding exact input parameters and output structures.
  • Building custom logic around tool definitions.
  • Debugging tool interactions.
  • Research and experimentation.

You can retrieve the raw action schemas using the get_action_schemas method.

Bypass Connection Checks

A key feature for inspection is setting check_connected_accounts=False. This allows you to fetch the schema for any tool, even if you haven’t connected the corresponding app via composio add <app>, making it ideal for exploration.

1from composio import ComposioToolSet, Action, App # Use base ComposioToolSet for schema inspection
2
3# Initialize base ToolSet
4base_toolset = ComposioToolSet()
5
6# Get the raw schema for a specific Google Calendar action
7# Bypass the check for an active Google Calendar connection
8calendar_schemas = base_toolset.get_action_schemas(
9 actions=[Action.GOOGLECALENDAR_LIST_CALENDARS],
10 check_connected_accounts=False
11)
12
13if calendar_schemas:
14 import json
15 print("Raw Schema for GOOGLECALENDAR_LIST_CALENDARS:")
16 # calendar_schemas is a list, access the first element
17 print(json.dumps(calendar_schemas[0].model_dump(), indent=2))
18else:
19 print("Schema not found.")
20
21# You can also fetch schemas by app or tags similarly
22# github_schemas = base_toolset.get_action_schemas(
23# apps=[App.GITHUB], check_connected_accounts=False
24# )

This method returns detailed ActionModel objects containing the full parameter and response schemas, version information, and more, without the framework-specific wrappers applied by get_tools.