Skip to content

fix(opencode): normalize MCP structured arguments#32812

Open
davilima6 wants to merge 1 commit into
anomalyco:devfrom
davilima6:fix/mcp-params
Open

fix(opencode): normalize MCP structured arguments#32812
davilima6 wants to merge 1 commit into
anomalyco:devfrom
davilima6:fix/mcp-params

Conversation

@davilima6

@davilima6 davilima6 commented Jun 18, 2026

Copy link
Copy Markdown

Issue for this PR

Closes #28472

Related Next.js DevTools MCP reproduction: #28472 (comment)

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

MCP tools can receive JSON-shaped object arguments as strings. When the advertised MCP schema says a field should be an object or array, this PR parses JSON strings back into structured values before calling client.callTool.

It also handles empty strings for structured fields by converting them to {} or []. Invalid JSON strings are left unchanged so the MCP server can still return its own validation error.

How did you verify your code works?

  • bun test test/mcp/catalog.test.ts from packages/opencode
  • bun typecheck from packages/opencode
  • bun run lint from repo root completed with 0 errors, existing warnings only
  • Push hook ran bun turbo typecheck successfully

Screenshots / recordings

Not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Jun 18, 2026
@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Jun 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant