Skip to content

tools: code mode catalog omits built-in tools, so tools.shell fails with "Unknown tool shell" #60014

Closed as duplicate

Description

@Perteghella

Summary

Inside Code Mode (execute) the tool catalog only exposes MCP tools and the opencode namespace. Built-ins (shell, read, grep, glob, webfetch, websearch) are absent, so tools.shell(...) fails with Unknown tool 'shell', even though shell is permitted and works when called as a top-level tool.

Environment

  • opencode version: 2.2.0
  • OS: Darwin 27.0.0 (darwin arm64)
  • Terminal: TERM_PROGRAM=vscode, TERM=xterm-256color, COLORTERM=truecolor
  • Shell: /bin/zsh
  • Install/channel: latest release
  • Active plugins: @dietrichgebert/ponytail; MCP server github (local). No project config, no custom agents.

Reproduction

  1. Start a session with the built-in plan agent.
  2. Ask for a task that needs a shell command, and let the model route it through Code Mode.
  3. Inside execute, call await tools.shell({ command: "echo ok" }).
  4. Also call search({ query: "" }) and inspect the returned catalog.

Expected Behavior

Either tools.shell resolves inside Code Mode, or the failure names the working alternative (that shell is a top-level tool). The docs describe the runtime as exposing tools "from its catalog" and never say built-ins are excluded.

Actual Behavior

✗execute
↳ Unknown tool 'shell'.
  Use search to find available tools.

search({ query: "" }) returns 21 entries, all tools.github.* (13) and tools.opencode.* (8). No built-in appears, so the suggested search cannot resolve shell either. Calling the top-level shell tool with the same command in the same session succeeds.

Additional Context

  • Not a permission problem: GET /api/agent reports plan permissions as * allow with edit denied (plus the ~/.opencode/plan/* exception); shell is allowed and works directly.
  • Reproduced consistently in a plan session; not verified under build.
  • Impact is cosmetic — one failed tool call, no side effects — but it fires whenever the model guesses tools.shell, and the error hint points to search, which cannot find the tool.
  • Workaround: call shell directly instead of through execute.

Activity

  1. opencodejr commented on Oct 28, 2026

    @opencodejr
    Contributor

    Thanks for the clear report! I think this is a duplicate of #53623.

    In v2, built-in tools like shell, read, grep, glob, webfetch and websearch are top-level only by design: they're registered outside the Code Mode catalog, so tools.shell(...) inside execute isn't expected to work. The real problem is the one you describe: the Code Mode instructions never say built-ins stay top-level, and the Unknown tool hint sends the model to search, which can't find them. #53623 tracks exactly that.

    Possible duplicates and related issues, ordered from most to least likely:

    Until then, your workaround of calling shell directly is the right one.

    The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different.

  2. opencodejr commented on Oct 29, 2026

    @opencodejr
    Contributor

    We haven't heard back, so I'm closing this as a duplicate of #53623. That issue covers the same problem: the Code Mode instructions don't say that built-in tools like shell, read and grep are only called at the top level. Models then try tools.shell(...) inside execute, get Unknown tool 'shell', and the search hint can't find the tool. Please follow #53623 for updates. PR #57627 proposes new wording for the prompt.

    If you'd like built-ins to be callable from inside execute, follow #55087. If your problem turns out to be different, reply here and we can take another look. Thanks for the detailed report!

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions