[PR #5339] feat: add --tools flag to limit available tools #11354

Open
opened 2026-02-16 18:16:11 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/5339

State: open
Merged: No


Add --tools flag to serve, web, and TUI commands to enable selective tool access control. The flag accepts comma-separated patterns to enable/disable tools.

Usage examples:

  # Only allow read, write, and webfetch tools
  opencode serve --tools='-*,read,write,webfetch'

  # Disable specific tools
  opencode web --tools='-bash,-edit'

  # Use in TUI mode
  opencode --tools='-*,read,write,webfetch'

Changes:

  • Add --tools flag to serve, web, and TUI thread commands
  • Implement Wildcard.parseToolsPattern() to parse tool enable/disable patterns
  • Update Server.listen() to accept tools option
  • Pass default tools to SessionPrompt.prompt() in server
  • Add tests for parseToolsPattern()

Fixes #9386

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/5339 **State:** open **Merged:** No --- Add --tools flag to serve, web, and TUI commands to enable selective tool access control. The flag accepts comma-separated patterns to enable/disable tools. Usage examples: ``` # Only allow read, write, and webfetch tools opencode serve --tools='-*,read,write,webfetch' # Disable specific tools opencode web --tools='-bash,-edit' # Use in TUI mode opencode --tools='-*,read,write,webfetch' ``` Changes: - Add --tools flag to serve, web, and TUI thread commands - Implement Wildcard.parseToolsPattern() to parse tool enable/disable patterns - Update Server.listen() to accept tools option - Pass default tools to SessionPrompt.prompt() in server - Add tests for parseToolsPattern() Fixes #9386
yindo added the pull-request label 2026-02-16 18:16:11 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#11354