[FEATURE]: Setting global permissions for custom tool #3195

Open
opened 2026-02-16 17:39:03 -05:00 by yindo · 2 comments
Owner

Originally created by @JosXa on GitHub (Nov 28, 2025).

Originally assigned to: @rekram1-node on GitHub.

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

I have written this custom tool:

tool/read-dotenv.ts

import { tool } from "@opencode-ai/plugin"

export default tool({
  description: "Read a .env file given its absolute path",
  args: {
    path: tool.schema.string().describe("Absolute path to the .env file"),
  },
  async execute(args) {
    const content = await Bun.file(args.path).text();
    return content;
  },
})

Now I'm trying to turn it into ask mode in config.json:

  "permission": {
    "read-dotenv": "ask",
  },

This makes no difference, it is always run. Leading me to conclude that setting permissions on custom tools is just not possible right now - please tell me if it is!

Originally created by @JosXa on GitHub (Nov 28, 2025). Originally assigned to: @rekram1-node on GitHub. ### Feature hasn't been suggested before. - [x] I have verified this feature I'm about to request hasn't been suggested before. ### Describe the enhancement you want to request I have written this custom tool: _tool/read-dotenv.ts_ ```ts import { tool } from "@opencode-ai/plugin" export default tool({ description: "Read a .env file given its absolute path", args: { path: tool.schema.string().describe("Absolute path to the .env file"), }, async execute(args) { const content = await Bun.file(args.path).text(); return content; }, }) ``` Now I'm trying to turn it into `ask` mode in config.json: ```json "permission": { "read-dotenv": "ask", }, ``` This makes no difference, it is always run. Leading me to conclude that setting permissions on custom tools is just not possible right now - please tell me if it is!
yindo added the discussion label 2026-02-16 17:39:03 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Nov 28, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #4880: ShellFailed with exit code 1 when OpenCode tries to "ask" for permissions - Similar issue with permission system not working as expected
  • #3991: Plan agent ignores permissions and always forbids file edits - System prompts override permission settings
  • #3575: Overriding built-in agents, doesn't allow overriding permissions - Custom configuration not being respected for permissions
  • #4854: How to enable mcp tool approval dialog? - Similar request for "ask" mode permissions on tools (for MCP tools)
  • #3948: Custom Agent Writes/Edits Files Despite Configuration Restrictions - Custom agent ignoring permission configuration

Feel free to ignore if none of these address your specific case.

@github-actions[bot] commented on GitHub (Nov 28, 2025): This issue might be a duplicate of existing issues. Please check: - #4880: ShellFailed with exit code 1 when OpenCode tries to "ask" for permissions - Similar issue with permission system not working as expected - #3991: Plan agent ignores permissions and always forbids file edits - System prompts override permission settings - #3575: Overriding built-in agents, doesn't allow overriding permissions - Custom configuration not being respected for permissions - #4854: How to enable mcp tool approval dialog? - Similar request for "ask" mode permissions on tools (for MCP tools) - #3948: Custom Agent Writes/Edits Files Despite Configuration Restrictions - Custom agent ignoring permission configuration Feel free to ignore if none of these address your specific case.
Author
Owner

@rekram1-node commented on GitHub (Dec 5, 2025):

Yeah permissions only apply to a few tools rn we are gonna make them work w/ everything and w/ wildcards

@rekram1-node commented on GitHub (Dec 5, 2025): Yeah permissions only apply to a few tools rn we are gonna make them work w/ everything and w/ wildcards
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#3195