Skip to content

feat: add --tools flag to limit available tools#5339

Open
paralin wants to merge 1 commit intoanomalyco:devfrom
paralin:tools-flag
Open

feat: add --tools flag to limit available tools#5339
paralin wants to merge 1 commit intoanomalyco:devfrom
paralin:tools-flag

Conversation

@paralin
Copy link
Contributor

@paralin paralin commented Dec 10, 2025

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

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: anomalyco#9386

Signed-off-by: Christian Stewart <christian@aperture.us>
@github-actions
Copy link
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: specify --tools on command-line for enabling/disabling tools

1 participant