anomalyco / anomalyco/opencode
[V2] MCP tool name longer than 64 characters blocks all MCP tools from every server
@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: falseregistrations 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
- 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", "."]
}
}
}
}
- Have
my-mcp-serverreturn this tool fromtools/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.
- Start OpenCode or refresh the MCP tool list.
registerBatchfails withTool.RegistrationError: Invalid tool name: get_repository_pull_request_review_comments_with_full_context_and_pagination.- 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
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.