Skip to main content
The Mastra provider transforms Composio tools into Mastra’s tool format with built-in execution. Pass the wrapped tools to a Mastra Agent, and the agent calls them automatically. Each tool gets both an input and an output schema, so Mastra can validate tool results as well as arguments.
1

Install

Install
2

Configure API Keys

Configure API Keys
Set COMPOSIO_API_KEY with your API key from Settings and OPENAI_API_KEY with your OpenAI API key.
.env
3

Create session and run

Create session and run

Provider specifics

Strict mode. Pass strict: true to normalize each tool’s input schema for OpenAI structured outputs before Mastra compiles it: every object lists all of its properties in required and is closed, and optional properties stay available but accept null. A null is dropped before the tool runs unless the tool’s own schema accepts null for that parameter, so nullable fields still receive an explicit null. Tools whose schema cannot be expressed in strict mode, such as objects that accept arbitrary keys, allOf, prefixItems, or unresolved $refs, keep their original schema and log a warning:
The provider runs each tool’s JSON Schema through Mastra’s schema-compat layer and inlines internal $ref pointers first. A few Composio tools reference $defs entries that the upstream API does not emit. Rather than crash tools.get, the provider falls back to a permissive object schema for that property and logs one warning per tool, so the affected field validates loosely.

Next

For Worker bindings, local secrets, and deployment steps, see the Cloudflare Workers walkthrough. It also links to the Mastra Worker example in the SDK repository.

What is a session?