You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MCP tool parameters of type "object" are serialized as strings instead of being passed as objects #28472
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:
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
Add @softeria/ms-365-mcp-server as a local MCP in opencode.jsonc
Login with ms365_login
Ask the assistant to send an email: "send a test email to myself"
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.
If object parameters are arriving as strings, I would check whether there is a JSON stringify boundary happening before the MCP transport layer thinks it has a schema-typed payload.
This is one of those bugs where a receipt helps quickly: original JSON Schema type, model-emitted arguments, post-normalization payload, and the final wire payload handed to the tool transport. Once one boundary serializes early, downstream code can still look "valid" while object tools behave like they got plain text.
I’m seeing the same kind of failure with the Next.js DevTools MCP integration.
Versions I tested with:
OpenCode: 1.17.8
Node: 24.16.0
Next.js: 16.2.9
Next MCP endpoint: the built-in /_next/mcp endpoint from next-server (v16.2.9)
OS: macOS
The connection itself works. OpenCode can discover the Next MCP server on http://localhost:3000, and nextjs_index lists the tools correctly:
get_project_metadata
get_errors
get_page_metadata
get_logs
get_server_action_by_id
get_routes
The failure happens when OpenCode tries to call one of those tools through nextjs_call.
For example, calling the no-arg get_errors tool fails with:
I also tried get_routes with args set to JSON text like this:
{"routerType":"pages"}
That fails the same way: the server still receives a string where it expects an object.
This same Next MCP setup works for me in Cursor, so the Next server and MCP endpoint seem fine. The difference looks like it is in how OpenCode forwards or normalizes the tool arguments. It lines up with Keesan12’s comment above: something appears to stringify the object-shaped argument before it reaches the MCP transport layer.
Activity
github-actions commentedon May 20, 2026
This issue might be a duplicate of existing issues. Please check:
objectare not handled correctly, leading to validation errors on the server side.Keesan12 commentedon May 20, 2026
If object parameters are arriving as strings, I would check whether there is a JSON stringify boundary happening before the MCP transport layer thinks it has a schema-typed payload.
This is one of those bugs where a receipt helps quickly: original JSON Schema type, model-emitted arguments, post-normalization payload, and the final wire payload handed to the tool transport. Once one boundary serializes early, downstream code can still look "valid" while object tools behave like they got plain text.
davilima6 commentedon Jun 18, 2026
I’m seeing the same kind of failure with the Next.js DevTools MCP integration.
Versions I tested with:
1.17.824.16.016.2.9/_next/mcpendpoint fromnext-server (v16.2.9)The connection itself works. OpenCode can discover the Next MCP server on
http://localhost:3000, andnextjs_indexlists the tools correctly:get_project_metadataget_errorsget_page_metadataget_logsget_server_action_by_idget_routesThe failure happens when OpenCode tries to call one of those tools through
nextjs_call.For example, calling the no-arg
get_errorstool fails with:I also tried
get_routeswithargsset to JSON text like this:{"routerType":"pages"}That fails the same way: the server still receives a string where it expects an object.
This same Next MCP setup works for me in Cursor, so the Next server and MCP endpoint seem fine. The difference looks like it is in how OpenCode forwards or normalizes the tool arguments. It lines up with Keesan12’s comment above: something appears to stringify the object-shaped argument before it reaches the MCP transport layer.
davilima6 commentedon Jun 18, 2026
I proposed a fix in #32812. The Next.js MCP server works as expected with that branch
rekram1-node commentedon Jun 22, 2026
this would just be ur model not calling tools correctly rather than an opencode bug, maybe u can share a repro? but i cannot reproduce this
davilima6 commentedon Jun 22, 2026
@rekram1-node , thanks for looking into it! I'll try to prepare a separate, throw-away PR with a repro