Description
Problem
When using OpenCode via SDK (not CLI), there is no way to handle or respond to the question tool call triggered by the model.
In my setup, I built a custom frontend (web UI) and communicate with OpenCode through the SDK + backend service. However:
- The model frequently triggers the
question tool
- The server enters a waiting state for user input
- But the SDK does NOT expose any API to:
- intercept the
question tool call
- provide the answer programmatically
- continue the execution loop
This causes the request to hang indefinitely.
Expected Behavior
There should be a way in SDK / serve mode to:
- Detect when a
question tool is triggered
- Retrieve the question payload (prompt, metadata, etc.)
- Send back the user's answer programmatically
- Resume the execution
Example (pseudo API):
client.onToolCall((tool) => {
if (tool.name === "question") {
return {
answer: "user input from my UI"
}
}
})
### Plugins
_No response_
### OpenCode version
1.3.2
### Steps to reproduce
## CLI vs SDK Behavior
CLI:
- `question` is displayed
- user can input answer
- execution continues
SDK:
- `question` is triggered internally
- no way to respond
- execution hangs
This indicates the interaction layer exists in CLI but is not exposed in SDK.
### Screenshot and/or share link
_No response_
### Operating System
windows
### Terminal
_No response_
Description
Problem
When using OpenCode via SDK (not CLI), there is no way to handle or respond to the
questiontool call triggered by the model.In my setup, I built a custom frontend (web UI) and communicate with OpenCode through the SDK + backend service. However:
questiontoolquestiontool callThis causes the request to hang indefinitely.
Expected Behavior
There should be a way in SDK / serve mode to:
questiontool is triggeredExample (pseudo API):