opencode icon indicating copy to clipboard operation
opencode copied to clipboard

[FEATURE]: Setting global permissions for custom tool

Open JosXa opened this issue 1 month ago • 2 comments

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

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!

JosXa avatar Nov 28 '25 21:11 JosXa

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] avatar Nov 28 '25 21:11 github-actions[bot]

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

rekram1-node avatar Dec 05 '25 05:12 rekram1-node