Skip to content

[FEATURE]: Add isReadOnly and isDestructive flags to tool interface #20296

Closed as not planned

Description

@AndresCdo

Feature hasn't been suggested before.

  • I have verified this feature I'm about to request hasn't been suggested before.

Describe the enhancement you want to request

Add isReadOnly and isDestructive optional flags to the Tool.Def interface. These flags enable the permission system, auto-approval classifiers, and UI to make smarter decisions about tool behavior without analyzing tool internals at runtime.

Problem: Currently, the permission system and UI have no structured way to know whether a tool only reads data or can destructively modify state. This forces:

  • Permission prompts for every tool call, even safe read-only ones
  • No differentiation between read (safe) and write (destructive) at the system level
  • Auto-approval classifiers must analyze tool behavior heuristically instead of using explicit metadata

Proposed Solution: Add two optional boolean flags to Tool.Def:

export interface Def<Parameters extends z.ZodType, M extends Metadata> {
  description: string
  parameters: Parameters
  /** Whether this tool only reads data (never modifies state). Used for permission auto-approval. */
  isReadOnly?: boolean
  /** Whether this tool can destruct or irreversibly modify state. Used for elevated permission prompts. */
  isDestructive?: boolean
  execute(args: z.infer<Parameters>, ctx: Context): Promise<{ ... }>
}

Tools to annotate:

Tool isReadOnly isDestructive
read true -
glob true -
grep true -
list true -
webfetch true -
codesearch true -
write - true
edit - true
apply_patch - true
multiedit - true
bash - - (dynamic)
todowrite false -

Impact: Enables future auto-approval classifiers, smarter permission prompts, and UI differentiation between safe and destructive operations.

Risk: None — optional fields with no behavioral change. Purely additive metadata.

Activity

  1. added
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on Mar 31, 2026
  2. added a commit that references this issue on Mar 31, 2026
    68017a0
  3. removed
    coreAnything pertaining to core functionality of the application (opencode server stuff)
    on May 3, 2026
  4. github-actions commented on Jul 4, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions