Skip to content

Tool names should not include server prefix — causes double-prefixing in MCP clients #1267

Description

@expiren

Problem

CodeGraph's MCP tools are named with a codegraph_ prefix (e.g., codegraph_explore, codegraph_search, codegraph_status). When used with MCP clients like OpenCode that auto-prefix all tools with the server name, this creates double-prefixed tool names:

Server name: codegraph
Tool name:   codegraph_explore
Registered:  codegraph_codegraph_explore

This causes two issues:

  1. "Unavailable tool" errors — The model's system prompt references codegraph_explore (the natural name), but the actual registered tool is codegraph_codegraph_explore. Every call to the unprefixed name fails with:

    Model tried to call unavailable tool 'codegraph_explore'
    
  2. Ugly developer experiencecodegraph_codegraph_explore is redundant and confusing. All 8 tools are affected:

    • codegraph_codegraph_explore
    • codegraph_codegraph_search
    • codegraph_codegraph_status
    • codegraph_codegraph_node
    • codegraph_codegraph_callers
    • codegraph_codegraph_callees
    • codegraph_codegraph_impact
    • codegraph_codegraph_files

Why This Happens

The MCP protocol convention is: <server_name>_<tool_name>. Most MCP servers name their tools without repeating their own name. For comparison:

MCP Server Tool Name Registered As Clean?
socraticode codebase_search socraticode_codebase_search
playwright browser_click playwright_browser_click
snyk snyk_code_scan snyk_snyk_code_scan ❌ same issue
codegraph codegraph_explore codegraph_codegraph_explore

Proposed Fix

Remove the codegraph_ prefix from tool names inside the MCP server:

Current Proposed
codegraph_explore explore
codegraph_search search
codegraph_status status
codegraph_node node
codegraph_callers callers
codegraph_callees callees
codegraph_impact impact
codegraph_files files

After the fix, MCP clients would register them as codegraph_explore, codegraph_search, etc. — clean, no duplication.

Current Workaround

We're patching oh-my-opencode's dist/index.js after every npm update to rewrite all prompt-level codegraph_explore references to codegraph_codegraph_explore. This is fragile and breaks on every update.

Environment

  • CodeGraph: @colbymchenry/codegraph@1.3.1
  • MCP Client: OpenCode (oh-my-opencode 4.16.1)
  • Node.js: 26.x (with Node 22 via CODEGRAPH_NODE_BIN)
  • OS: Windows 11

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions