GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Claude models fail on MCP tools with no required parameters (undefined vs {}) · Issue #9020 · anomalyco/opencode

Claude models fail on MCP tools with no required parameters (undefined vs {}) #9020

New issue
Copy link
New issue
Copy link
Closed
#11203
Closed
Claude models fail on MCP tools with no required parameters (undefined vs {})#9020
#11203
Copy link
Assignees
thdxr
Labels
nix

Description

@belovedEmperor
belovedEmperor
opened on Jan 17, 2026
Issue body actions

Description

Claude models send undefined for MCP tool arguments when a tool has no required parameters. OpenCode passes this through unchanged, causing Zod validation to fail on the MCP server side.

Gemini models send {} for the same tools and work fine.

Steps to reproduce

  1. Configure @modelcontextprotocol/server-memory MCP server
  2. Use a Claude model (e.g., claude-sonnet-4-20250514)
  3. Trigger memory_read_graph tool (no required params)
  4. Tool execution aborted with invalid_union error

Error output

[
  {
    "code": "invalid_union",
    "errors": [
      [
        {
          "expected": "record",
          "code": "invalid_type",
          "path": [
            "state",
            "input"
          ],
          "message": "Invalid input: expected record, received undefined"
        }
      ],
      [
        {
          "expected": "object",
          "code": "invalid_type",
          "path": [
            "part"
          ],
          "message": "Invalid input: expected object, received undefined"
        },
        {
          "expected": "string",
          "code": "invalid_type",
          "path": [
            "delta"
          ],
          "message": "Invalid input: expected string, received undefined"
        }
      ],
      [
        {
          "expected": "object",
          "code": "invalid_type",
          "path": [
            "part"
          ],
          "message": "Invalid input: expected object, received undefined"
        },
        {
          "expected": "string",
          "code": "invalid_type",
          "path": [
            "delta"
          ],
          "message": "Invalid input: expected string, received undefined"
        }
      ]
    ],
    "path": [],
    "message": "Invalid input"
  }
]

Root cause

In packages/opencode/src/mcp/index.ts, convertMcpTool's execute function passes args directly:

arguments: args as Record<string, unknown>

When Claude sends undefined, this becomes arguments: undefined to the MCP server.

Suggested fix

arguments: args ?? {}

Environment

  • OS: NixOS
  • Models affected: Claude (all versions tested)
  • Models working: Gemini

Activity

  1. github-actions
    assigned
    thdxr
    on Jan 17, 2026
  2. github-actions
    added
    nix
    on Jan 17, 2026
  3. github-actions commented on Jan 17, 2026

    @github-actions
    github-actionsBot
    on Jan 17, 2026 – with GitHub Actions
    Contributor
    More actions

    This issue might be a duplicate of existing issues. Please check:

    • Strict JSON Schema validation fail on backends like SGLang (Missing required field in empty tool parameters) #8184: Strict JSON Schema validation fail on backends like SGLang (Missing required field in empty tool parameters)

    Feel free to ignore if none of these address your specific case.

  4. belovedEmperor commented on Jan 17, 2026

    @belovedEmperor
    belovedEmperor
    on Jan 17, 2026
    Author
    More actions

    Also confirmed this affects the Playwright MCP server - not specific to server-memory. Any MCP tool with no required parameters will fail when called by Claude.

  5. BingLi37 commented on Jan 20, 2026

    @BingLi37
    BingLi37
    on Jan 20, 2026
    More actions

    me too

  6. rekram1-node
    closed this as completedin #11203on Jan 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @thdxr
    thdxr

Labels

nix

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.