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 21, 07:15 UTC
| 1 | # @composio/mastra + Zod v4 Tool Router Test |
| 2 | |
| 3 | Verifies that `@composio/mastra` works correctly with `zod@4` in a Tool Router workflow. |
| 4 | |
| 5 | ## Why This Exists |
| 6 | |
| 7 | Issue [#2109](https://github.com/ComposioHQ/composio/issues/2109) tracks Mastra integration support. The `@composio/mastra` provider must work with both Zod v3 and v4. This suite ensures: |
| 8 | |
| 9 | - MastraProvider integrates correctly with Composio core |
| 10 | - MCP client can connect to Composio's Tool Router endpoint |
| 11 | - Mastra Agent can use Composio tools via MCP |
| 12 | - Structured output with Zod v4 schemas works correctly |
| 13 | |
| 14 | ## What It Tests |
| 15 | |
| 16 | | Test | Description | |
| 17 | | -------------------- | ------------------------------------------------------------ | |
| 18 | | Tool Router workflow | Creates session, connects MCP, runs agent with Zod v4 schema | |
| 19 | |
| 20 | ## Test Setup |
| 21 | |
| 22 | This test runs **directly in Bun** (no Docker fixtures). It imports packages from the monorepo workspace and makes real API calls: |
| 23 | |
| 24 | ```typescript |
| 25 | import { Composio } from '@composio/core'; |
| 26 | import { MastraProvider } from '@composio/mastra'; |
| 27 | import { MCPClient } from '@mastra/mcp'; |
| 28 | import { Agent } from '@mastra/core/agent'; |
| 29 | import { createOpenAI } from '@ai-sdk/openai'; |
| 30 | import { z } from 'zod'; |
| 31 | ``` |
| 32 | |
| 33 | **Required environment variables:** |
| 34 | |
| 35 | - `COMPOSIO_API_KEY` - Composio API key for Tool Router |
| 36 | - `OPENAI_API_KEY` - OpenAI API key for agent LLM calls |
| 37 | |
| 38 | ## Isolation Tool |
| 39 | |
| 40 | **Docker** with Node.js versions: 22.23.5, 24.22.3, 26.13.1. |
| 41 | |
| 42 | ## Running |
| 43 | |
| 44 | ```bash |
| 45 | pnpm test:e2e |
| 46 | ``` |