Summary
In the Code Mode runtime, tools provided by an MCP server (e.g. chrome-devtools) are listed in the tool catalog but fail with Unknown tool when invoked directly. They only work when called through the execute runtime's tools object (tools["chrome-devtools"]["tool-name"]). The catalog documentation is ambiguous about this, which led to a time-consuming misdiagnosis (the MCP server was healthy all along).
Environment
- opencode version: 0.0.0-next-17055 (next channel)
- OS: Windows_NT 10.0.26200 (win32 x64)
- Terminal: Unavailable: terminal environment variables are not set
- Shell: C:\WINDOWS\system32\cmd.exe
- Install/channel: next
- Active plugins: None found in config
Reproduction
- Configure an MCP server in
~/.config/opencode/opencode.jsonc, e.g.:
- Start opencode in Code Mode. The system prompt catalog lists the MCP tools, e.g.
tools["chrome-devtools"].click(...).
- Invoke one of the listed tools directly:
<invoke name="chrome-devtools.list_pages">
- Observe the error.
Expected Behavior
Either the catalog should indicate that tools are invoked via execute, or the listed tools should be directly invocable. Direct invocation should either work or be explicitly documented as unsupported.
Actual Behavior
Every direct invocation fails with:
{"error":{"type":"tool.execution","message":"Unknown tool: chrome-devtools.list_pages"}}
The same tools work when called inside execute:
await tools["chrome-devtools"]["list_pages"]({});
The opencode log confirms the MCP server was connected (message="mcp connected" server=chrome-devtools tools=29), so this is an invocation-runtime issue, not an MCP connection failure.
Additional Context
The catalog documentation is ambiguous. It states "The Code Mode catalog and search results are the complete set of tools available within Code Mode" (implying catalog tools are usable), and lists signatures like tools["chrome-devtools"].click(input: {...}) with no note that these must go through execute. Meanwhile, search itself also returned Unknown tool: search, so the catalog tools were unreachable through any documented path other than execute.
Misdiagnosis path taken before finding the fix: verified MCP config, launched the MCP server standalone (started fine), checked opencode2 service status, and parsed opencode.log — none of which were the problem. The resolution only came from re-reading the execute tool description: "Call tools through tools using only exact paths and signatures from the catalog."
Suggestion: document clearly in the Code Mode catalog that all tools (including MCP-provided) are invoked exclusively through the execute runtime, or accept direct invocation for catalog-listed tools.
Summary
In the Code Mode runtime, tools provided by an MCP server (e.g.
chrome-devtools) are listed in the tool catalog but fail withUnknown toolwhen invoked directly. They only work when called through theexecuteruntime'stoolsobject (tools["chrome-devtools"]["tool-name"]). The catalog documentation is ambiguous about this, which led to a time-consuming misdiagnosis (the MCP server was healthy all along).Environment
Reproduction
~/.config/opencode/opencode.jsonc, e.g.:tools["chrome-devtools"].click(...).Expected Behavior
Either the catalog should indicate that tools are invoked via
execute, or the listed tools should be directly invocable. Direct invocation should either work or be explicitly documented as unsupported.Actual Behavior
Every direct invocation fails with:
{"error":{"type":"tool.execution","message":"Unknown tool: chrome-devtools.list_pages"}}The same tools work when called inside
execute:The opencode log confirms the MCP server was connected (
message="mcp connected" server=chrome-devtools tools=29), so this is an invocation-runtime issue, not an MCP connection failure.Additional Context
The catalog documentation is ambiguous. It states "The Code Mode catalog and
searchresults are the complete set of tools available within Code Mode" (implying catalog tools are usable), and lists signatures liketools["chrome-devtools"].click(input: {...})with no note that these must go throughexecute. Meanwhile,searchitself also returnedUnknown tool: search, so the catalog tools were unreachable through any documented path other thanexecute.Misdiagnosis path taken before finding the fix: verified MCP config, launched the MCP server standalone (started fine), checked
opencode2 service status, and parsedopencode.log— none of which were the problem. The resolution only came from re-reading theexecutetool description: "Call tools throughtoolsusing only exact paths and signatures from the catalog."Suggestion: document clearly in the Code Mode catalog that all tools (including MCP-provided) are invoked exclusively through the
executeruntime, or accept direct invocation for catalog-listed tools.