Skip to content

[Bug]: Composio MCP tool-call input sometimes emitted as string, breaks AI SDK tool_use validation #2406

@kdawgwilk

Description

@kdawgwilk

SDK Language

TypeScript / Node.js SDK (@composio/core)

SDK Version

@composio/core@0.5.1

Runtime Environment

Node.js 24 on macOS 15.7.2

Environment

Production Deployment

Describe the Bug

Summary
We’re seeing Composio MCP tool calls occasionally emit input as a string instead of an object. When using Vercel AI SDK v5 streaming, this causes a runtime validation error (tool_use.input: Input should be a valid dictionary) and breaks chat streaming.

Environment

  • AI SDK: ai@5.x
  • Composio: @composio/core + @composio/vercel (current versions at time of issue)
  • Integration: AI SDK streamText() + toUIMessageStream()
  • Tool: COMPOSIO_MULTI_EXECUTE_TOOL

Actual behavior
AI SDK receives a tool-call with input as a string (often JSON-looking but not parseable), which fails its schema validation and terminates streaming.

Expected behavior
Tool-call input should always be a JSON object (or valid structured data) consistent with AI SDK’s tool call schema.

Example (sanitized)
toolName: COMPOSIO_MULTI_EXECUTE_TOOL
input type: string (length ~400)
Parsing fails or produces a non-object value.

Impact

  • AI SDK stream fails with validation error
  • UI shows generic chat error
  • Requires manual normalization to avoid crashes

Notes
We implemented a temporary server-side normalization (coerce string → {} or parsed object) to prevent crashes. Ideally Composio should emit object-shaped tool input compatible with AI SDK expectations.

Steps to Reproduce

  1. Configure Composio MCP tools using @composio/core + @composio/vercel and create an AI SDK streamText() call with those tools enabled.
  2. Trigger a request that uses COMPOSIO_MULTI_EXECUTE_TOOL (e.g., ask to send a Slack DM).
  3. Observe the streaming response fail with tool input validation.

Minimal Reproducible Example

ts
import { streamText } from 'ai';
import { createComposioMcpTools } from './composio-mcp';
const { tools } = await createComposioMcpTools('user-123');
const result = streamText({
model: /* any AI SDK model /,
messages: [{ role: 'user', content: 'Send a Slack message to Someone' }],
tools,
});
for await (const chunk of result.toUIMessageStream()) {
// Stream to client
}

Error Output / Stack Trace

messages.3.content.1.tool_use.input: Input should be a valid dictionary

Reproducibility

  • Always reproducible
  • Intermittent / Sometimes
  • Happened once, can’t reproduce

Additional Context or Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions