You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[FEATURE]: Setting global permissions for custom tool #4881
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"exportdefaulttool({description: "Read a .env file given its absolute path",args: {path: tool.schema.string().describe("Absolute path to the .env file"),},asyncexecute(args){constcontent=awaitBun.file(args.path).text();returncontent;},})
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!
$cat~/.config/opencode/tools/searxng.tsimport{tool}from"@opencode-ai/plugin"constSEARXNG_URL="https://searx.example.org/search"exportdefaulttool({description: "Search the web using self-hosted SearXNG instance",args: {query: tool.schema.string().describe("Search query"),limit: tool.schema.number().optional().describe("Max number of results (default 10)"),},constlimit=args.limit||10consturl= `${SEARXNG_URL}?q=${encodeURIComponent(args.query)}&format=json` const raw = await Bun.$`curl-k-s${url}`.text()constdata=JSON.parse(raw)constresults=(data.results||[]).slice(0,limit)returnJSON.stringify(results.map((r)=>({title: r.title,url: r.url,engine: r.engine,content: r.content||"",})),null,2,)},})
The tool always runs without asking for permission, for example when prompted with do a searxng search for "example topic"
The workaround (adding await ctx.ask) mentioned by @peltax doesn't seem to work either, the tool still runs without asking for permission.
Activity
github-actions commentedon Nov 28, 2025
This issue might be a duplicate of existing issues. Please check:
ShellFailed with exit code 1when OpenCode tries to "ask" for permissions (Windows) #4880: ShellFailed with exit code 1 when OpenCode tries to "ask" for permissions - Similar issue with permission system not working as expectedFeel free to ignore if none of these address your specific case.
rekram1-node commentedon Dec 5, 2025
Yeah permissions only apply to a few tools rn we are gonna make them work w/ everything and w/ wildcards
peltax commentedon Mar 8, 2026
For now you can add the permission check in custom tool itself:
nodiscc commentedon Apr 21, 2026
Still reproducible on v1.14.19
Example working custom tool:
The tool always runs without asking for permission, for example when prompted with
do a searxng search for "example topic"The workaround (adding
await ctx.ask) mentioned by @peltax doesn't seem to work either, the tool still runs without asking for permission.fix(plugin): enable permission checks for custom tools
fix(plugin): enable permission checks for custom tools
github-actions commentedon Jul 3, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.