Skip to content

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

fix: resolve TypeScript build errors in Vercel AI and Mastra examples

Sushmithamallesh0b057dc0a645
diff --git a/docs/content/docs/quickstart.mdx b/docs/content/docs/quickstart.mdx
index 0ed3265b2..79401bf52 100644
--- a/docs/content/docs/quickstart.mdx
+++ b/docs/content/docs/quickstart.mdx
@@ -692,7 +692,7 @@ import "dotenv/config";
import { anthropic } from "@ai-sdk/anthropic";
import { Composio } from "@composio/core";
import { VercelProvider } from "@composio/vercel";
-import { CoreMessage, stepCountIs, streamText } from "ai";
+import { streamText, stepCountIs, type ModelMessage } from "ai";
import { createInterface } from "readline/promises";
// Initialize Composio with Vercel provider
@@ -715,13 +715,13 @@ Example tasks:
`);
// Message history for multi-turn conversation
-const messages: CoreMessage[] = [];
+const messages: ModelMessage[] = [];
while (true) {
const input = (await readline.question("You: ")).trim();
if (input.toLowerCase() === "exit") break;
- messages.push({ role: "user", content: input });
+ messages.push({ role: "user", content: [{ type: "text", text: input }] });
process.stdout.write("Assistant: ");
try {
@@ -729,7 +729,7 @@ while (true) {
system: "You are a helpful personal assistant. Use Composio tools to take action.",
model: anthropic("claude-sonnet-4-5"),
messages,
- maxSteps: 10,
+ stopWhen: stepCountIs(10),
onStepFinish: (step) => {
for (const toolCall of step.toolCalls) {
process.stdout.write(`\n[Using tool: ${toolCall.toolName}]`);
@@ -746,7 +746,7 @@ while (true) {
console.log();
// Add assistant response to history for context
- messages.push({ role: "assistant", content: assistantResponse });
+ messages.push({ role: "assistant", content: [{ type: "text", text: assistantResponse }] });
} catch (error) {
console.error("\n[Error]:", error instanceof Error ? error.message : error);
}
@@ -790,7 +790,7 @@ import "dotenv/config";
import { anthropic } from "@ai-sdk/anthropic";
import { experimental_createMCPClient as createMCPClient } from "@ai-sdk/mcp";
import { Composio } from "@composio/core";
-import { CoreMessage, stepCountIs, streamText } from "ai";
+import { streamText, stepCountIs, type ModelMessage } from "ai";
import { createInterface } from "readline/promises";
// Initialize Composio
@@ -822,13 +822,13 @@ Example tasks:
`);
// Message history for multi-turn conversation
-const messages: CoreMessage[] = [];
+const messages: ModelMessage[] = [];
while (true) {
const input = (await readline.question("You: ")).trim();
if (input.toLowerCase() === "exit") break;
- messages.push({ role: "user", content: input });
+ messages.push({ role: "user", content: [{ type: "text", text: input }] });
process.stdout.write("Assistant: ");
try {
@@ -836,7 +836,7 @@ while (true) {
system: "You are a helpful personal assistant. Use Composio tools to take action.",
model: anthropic("claude-sonnet-4-5"),
messages,
- maxSteps: 10,
+ stopWhen: stepCountIs(10),
onStepFinish: (step) => {
for (const toolCall of step.toolCalls) {
process.stdout.write(`\n[Using tool: ${toolCall.toolName}]`);
@@ -853,7 +853,7 @@ while (true) {
console.log();
// Add assistant response to history for context
- messages.push({ role: "assistant", content: assistantResponse });
+ messages.push({ role: "assistant", content: [{ type: "text", text: assistantResponse }] });
} catch (error) {
console.error("\n[Error]:", error instanceof Error ? error.message : error);
}
diff --git a/docs/content/docs/single-toolkit-mcp.mdx b/docs/content/docs/single-toolkit-mcp.mdx
index 950282281..ffcf06c22 100644
--- a/docs/content/docs/single-toolkit-mcp.mdx
+++ b/docs/content/docs/single-toolkit-mcp.mdx
@@ -192,6 +192,7 @@ const client = new MCPClient({
const agent = new Agent({
id: "assistant",
name: "Assistant",
+ instructions: "You are a helpful assistant that can read and manage emails.",
model: openai("gpt-4-turbo"),
tools: await client.getTools()
});
@@ -223,11 +224,21 @@ gmail_servers = composio.mcp.list(toolkits="gmail", limit=20)
import { Composio } from '@composio/core';
const composio = new Composio({ apiKey: 'your_api_key' });
// ---cut---
-const servers = await composio.mcp.list({ limit: 10, page: 1 });
+const servers = await composio.mcp.list({
+ toolkits: [],
+ authConfigs: [],
+ limit: 10,
+ page: 1
+});
console.log(`Found ${servers.items.length} servers`);
// Filter by toolkit
-const gmailServers = await composio.mcp.list({ toolkits: ["gmail"] });
+const gmailServers = await composio.mcp.list({
+ toolkits: ["gmail"],
+ authConfigs: [],
+ limit: 20,
+ page: 1
+});
```
</Tab>
</Tabs>