Skip to content

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

Closed as not planned

Description

@heimoshuiyu

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

Activity

  1. github-actions commented on Jul 25, 2026

    @github-actions
    Contributor

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

  2. github-actions commented on Sep 25, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions