anomalyco / anomalyco/opencode
Tool definitions sent to models that cannot call tools (Vertex Gemini image models reject every request)
Open
@nexxeln is already working on this.
Since Aug 10, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Bug
Tool definitions are sent to models that can't call tools, so providers that reject function calling fail every request.
Vertex Gemini image models (gemini-2.5-flash-image) return:
Unable to submit request because the model does not support function calling.
Cause
capabilities.toolcall is set from provider config (provider.ts:1236) but never read when building a request. resolveTools in session/llm/request.ts filters only on permission rules and the per-message tools map, so all ~12 tools get declared regardless of the model.
Why it's hard to work around
- The error names the model, so it looks like a provider/model problem.
- Setting
tool_call: falsein config appears to be the fix but does nothing, since the flag isn't consulted in this path. - Denying tools by name in an agent isn't enough — agents start from
"*": "allow", and you can't name a plugin-injected tool you don't know exists. Onlypermission: {"*": deny}works.
Repro
- Configure a Vertex/Google image model, e.g.
gemini-2.5-flash-image. - Send any message with the stock
buildagent. - Request fails with the error above. Capturing the outgoing request shows a
toolsarray with 12functionDeclarations.
Version
1.18.15 (dev)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.