Skip to content

v2 codemode: tools.search is unavailable in the execute runtime #45349

Closed as not planned

Description

@dmmop

Summary

Code Mode documents tools.search(...) as the mechanism to discover tools in its runtime, but the dispatcher does not register it. Explicitly catalogued MCP tools work through execute; the documented discovery function does not.

Environment

  • opencode version: 0.0.0-beta-18155
  • OS: Linux 7.0.0-30-generic (x64)
  • Shell: zsh
  • Install/channel: beta

Reproduction

  1. Start a fresh OpenCode session with the Context7 MCP server connected.

  2. Run an explicitly catalogued tool inside the execute runtime:

    return await tools.context7["resolve-library-id"]({
      libraryName: "React",
      query: "React useEffect documentation",
    })
    
  3. Observe that it succeeds.

  4. Run the documented discovery call inside the same execute runtime:

    return await tools.search({
      namespace: "context7",
      query: "resolve library",
      limit: 10,
    })
    
  5. Observe Unknown tool 'search'.

Expected Behavior

tools.search(...) should resolve against the final Code Mode tool tree and return the matching tool signatures.

Actual Behavior

The documented discovery tool is unavailable in the execute runtime:

Unknown tool 'search'.

Additional Context

  • Reproducible after restarting the OpenCode service and starting a fresh session.
  • This is not an MCP connection or authentication failure: context7.resolve-library-id succeeds in the same execute invocation.
  • The failure is especially impactful for partial MCP catalogs, where tools.search(...) is the documented path to discover tools omitted from the initial prompt.
  • This resembles codemode: Executor nested tool search fails in TUI #40611 but reproduces with a standard MCP server and without a nested third-party execution runtime.

Activity

  1. rekram1-node commented on Aug 26, 2026

    @rekram1-node
    Contributor

    Code Mode documents tools.search(...)

    This is not correct.

  2. opencode-agent commented on Aug 26, 2026

    @opencode-agent
    Contributor

    Thanks for the report. There appears to be a misunderstanding about the discovery API: Code Mode's instructions specify search(...), not tools.search(...).

    For reference, in the V2 source:

    The discovery call inside execute should therefore be:

    return await search({
      namespace: "context7",
      query: "resolve library",
      limit: 10,
    })

    An Unknown tool 'search'. error from tools.search(...) does not demonstrate that the documented discovery function is missing; it calls a different path.

    We're closing this as cannot reproduce as reported. If you can share an actual session transcript showing OpenCode instructing the model to call tools.search(...), or the correct search(...) call failing, we'll investigate further. Please include the exact instructions, tool-call input, and returned output, with credentials and private information redacted.

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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions