Skip to content

execute: tools.shell unavailable inside Code Mode runtime despite being in catalog #39312

Closed as not planned

Description

@adamcjm

Summary

execute 运行时中无法调用 tools.shell,尽管 shell 列在工具目录中且其他 catalog 工具(read、write、grep 等)均可用。

Environment

  • opencode version: 1.18.5 (next channel)
  • OS: Darwin 24.6.0 (darwin arm64)
  • Terminal: ghostty, TERM=xterm-256color, COLORTERM=truecolor
  • Shell: /bin/zsh
  • Install/channel: next (0.0.0-next-16365)

Reproduction

  1. 在 execute 的 JavaScript 代码块中调用 tools.shell({ command: 'echo hello' })
const res = await tools.shell({ command: 'echo hello' });
  1. 返回错误:
Error: Unknown tool 'shell'. The tool may have been removed or renamed. Use search to find available tools.

Expected Behavior

tools.shell 应在 execute 运行时中可用,与 tools.read、tools.write、tools.grep、tools.glob 等其他 catalog 工具行为一致。

Actual Behavior

tools.shell 抛出 Unknown tool 'shell' 错误。

Additional Context

  • 其他 catalog 工具在 execute 中均正常工作:read ✓、write ✓、grep ✓、glob ✓、question ✓、edit ✓、webfetch ✓
  • execute 文档说明:"the only callable tools are those explicitly listed in the Code Mode catalog instructions"——shell 确实在 catalog 中,但实际不可用
  • 这导致无法在 execute 中执行 shell 命令来动态探索文件系统或运行外部工具

Activity

  1. opencode-agent commented on Jul 28, 2026

    @opencode-agent
    Contributor

    感谢报告。这里可能混淆了顶层原生工具列表和 Code Mode 自己的 catalog:在 V2 中,shell 明确注册为 codemode: false,因此它只能作为顶层 shell 工具调用,并不会暴露为 execute 内的 tools.shell。

    所以 Unknown tool 'shell' 是当前的预期行为;Code Mode 只能调用其 catalog instructions 中明确列出的工具(或通过 search 返回的工具)。我们先关闭此 issue。

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