Skip to content

[FEATURE]: Add askPermission to plugin ToolContext #6043

Closed

Description

@nielpattin

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

What

Plugins can now request permission from users before performing sensitive operations via ctx.askPermission().

Why

Currently, plugins have no way to prompt users for confirmation before destructive actions (file deletions, external API calls, etc). This makes it risky to use plugins in automated or YOLO mode.

With this change, plugin authors can:

  • Request explicit user consent before dangerous operations
  • Provide clear descriptions of what will happen
  • Respect the user's permission preferences

Changes

  • packages/plugin/src/tool.ts - Added optional askPermission to ToolContext type
  • packages/opencode/src/tool/registry.ts - Injects permission wrapper into plugin context

Backward Compatibility

The property is optional (askPermission?:), so existing plugins continue to work without modification.

Plugins that want to use this feature can check for its existence:

if (ctx.askPermission) {
  await ctx.askPermission({
    tool: "my-plugin",
    message: "Delete all temp files?",
  })
}

Demo: PR: 6042

(Ignore the skill tool mention, it's just a plugin that use the same format as the native skill support)

WindowsTerminal_roeVGaFi3l.mp4

Activity

  1. added
    discussionUsed for feature requests, proposals, ideas, etc. Open discussion
    on Dec 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    discussionUsed for feature requests, proposals, ideas, etc. Open discussion

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions