Repository navigation
Closed
Labels
coreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)discussionUsed for feature requests, proposals, ideas, etc. Open discussionUsed for feature requests, proposals, ideas, etc. Open discussion
Description
Feature hasn't been suggested before.
- I have verified this feature I'm about to request hasn't been suggested before. (I tried but there are many issues I can't really tell)
Describe the enhancement you want to request
Problem
When using OpenCode (via sdk) as an AI backend via API, there's no way to:
- Disable OpenCode's built-in tool execution
- Execute tools locally
- Send tool results back to OpenCode so the model can see them
Currently, tools can be configured with action: "allow" (executes immediately) or action: "ask" (waits for permission response), but:
- With
"allow": OpenCode executes the tool itself - With
"ask": The permission API responds successfully, but the tool never completes
Desired Flow
- App creates session with
permission: [{ permission: "bash", pattern: "*", action: "deny" }](or similar) - OpenCode detects tool is needed but doesn't execute it
- App executes the tool locally
- App sends the tool result back to OpenCode via API
- OpenCode continues with the tool result in its context
Suggested API
Option A: A new endpoint to submit tool results:
POST /session/{id}/tool-result
{
callID: "call_xxx",
tool: "bash",
output: "...",
status: "completed"
}
Option B: Support injecting tool results via a new message part type that OpenCode recognizes as a tool result rather than user input
Option C: Add a session configuration option like tool_execution: "external" that completely disables internal execution
Workaround
Currently we're using action: "allow" which works but means OpenCode executes the tools, not my app This loses the benefit of local execution (using user's environment, preserving context, etc.).
Environment
- OpenCode version: 1.3.13
- SDK: @opencode-ai/sdk
Reacted by Rodrigo Demetrio
Metadata
Metadata
Assignees
Labels
coreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)discussionUsed for feature requests, proposals, ideas, etc. Open discussionUsed for feature requests, proposals, ideas, etc. Open discussion
Activity
github-actions commentedon Apr 2, 2026
This issue might be a duplicate of existing issues. Please check:
questiontool interaction (no way to respond to tool calls in serve mode) #19702: SDK cannot handlequestiontool interaction — also describes the SDK lacking ability to intercept/respond to tool calls programmatically and send results back to OpenCodeIf you believe your issue is distinct, please clarify the differences.
rodrigodmpa commentedon Apr 3, 2026
Hi @thdxr, @sigmaSd — is this feature request actually completed? I’m trying to implement the same functionality in my application, but I haven’t been able to figure out how to achieve it.
sigmaSd commentedon Apr 3, 2026
No it's not but I closed because this feature request turns out to been asked multiple times and there is an open PE for it already
illera88 commentedon Apr 4, 2026
Hi @sigmaSd can you point to the open PR you are referring to?
Thanks
sigmaSd commentedon Apr 5, 2026
Hello @illera88 #12046