Skip to content

MCP tool parameters of type "object" are serialized as strings instead of being passed as objects #28472

@e-picas

Description

@e-picas

Description

When calling MCP tools that have a top-level parameter named body of type object, opencode passes the value as a JSON string instead of a native object. The MCP tool's input validation then fails with:

MCP error -32602: Input validation error: Invalid arguments for tool send-mail: [
  {
    "code": "invalid_type",
    "expected": "object",
    "received": "string",
    "path": ["body"],
    "message": "Expected object, received string"
  }
]

This affects all write tools in @softeria/ms-365-mcp-server where the only required parameter is body: object (e.g. send-mail, create-draft-email, create-calendar-event, send-chat-message). Read-only tools with simple scalar parameters (e.g. list-mail-messages, verify-login) work correctly.

Plugins

@softeria/ms-365-mcp-server (latest, type: local / stdio)

OpenCode version

1.15.5

Steps to reproduce

  1. Add @softeria/ms-365-mcp-server as a local MCP in opencode.jsonc
  2. Login with ms365_login
  3. Ask the assistant to send an email: "send a test email to myself"
  4. The tool ms365_send-mail is called — fails with Expected object, received string on the body parameter

Any MCP tool with a single required parameter of type object named body will reproduce this.

Operating System

Ubuntu 22.04

Terminal

Warp

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions