anomalyco / anomalyco/opencode

[V2] MCP tool name longer than 64 characters blocks all MCP tools from every server

Open
#38,808 1 comment 0 reactions 1 assignee View on GitHub

@jlongster is already working on this.

Since Jul 25, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

When an MCP server exposes a tool whose name exceeds 64 characters, ToolRegistry.registerBatch rejects the complete MCP registration batch. Since all configured MCP servers are reconciled through one batch, tools from every server can be lost.

The registration flow currently validates every normalized tool segment with the provider-native name constraint before considering its placement:

const entries = registrationEntries(tools, options)
yield* Effect.forEach(entries, (entry) => validateName(entry.name), { discard: true })
const codemode = options?.codemode ?? true

This constraint is correct for tools exposed directly to a provider, but MCP tools default to Code Mode. In that placement, the only provider-facing tool name is execute; MCP names are internal Code Mode catalog paths, which support arbitrary non-empty path segments and bracket notation.

The MCP reconciler wraps registerBatch with Effect.orDie, so this typed registration failure becomes a defect and the fresh MCP registration scope never commits.

Expected behavior:

  • Code Mode registrations should not be subject to provider-native tool-name length constraints.
  • codemode: false registrations should validate their final flattened provider name, including the namespace prefix.
  • Registration should remain atomic rather than silently dropping declared tools.

Plugins

Any MCP server that exposes a tool with a name longer than 64 characters.

OpenCode version

V2

Steps to reproduce

  1. Configure a custom MCP server that exposes one tool with a name longer than 64 characters, alongside another server with valid tools:
{
  "mcp": {
    "servers": {
      "long": {
        "type": "local",
        "command": ["npx", "-y", "my-mcp-server"]
      },
      "filesystem": {
        "type": "local",
        "command": ["npx", "-y", "@modelcontextprotocol/server-filesystem", "."]
      }
    }
  }
}
  1. Have my-mcp-server return this tool from tools/list:
{
  name: "get_repository_pull_request_review_comments_with_full_context_and_pagination",
  description: "Example",
  inputSchema: { type: "object", properties: {} }
}

The example name is 76 characters.

  1. Start OpenCode or refresh the MCP tool list.
  2. registerBatch fails with Tool.RegistrationError: Invalid tool name: get_repository_pull_request_review_comments_with_full_context_and_pagination.
  3. MCP tools from both servers are unavailable, while built-in tools remain available.

Screenshot and/or share link

N/A

Operating System

Platform-independent

Terminal

N/A

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.