Repository navigation
ollama tool calling issues #3029
Description
┃ # New session - 2025-10-08T06:46:14.387Z ┃
┃ /share to create a shareable link 3.2K/0% ┃
┃ ┃
┃ hello ┃
┃ skybu (08:46 AM) ┃
┃ ┃
Hey there! How can I help you today?
Build gpt-oss:20b (08:46 AM)
┃ ┃
┃ write "hello world" to test.txt ┃
┃ skybu (08:46 AM) ┃
┃ ┃
┃ ┃
┃ Repo_browser.read_file ┃
┃ ┃
┃ The arguments provided to the tool are invalid: Model tried to call unavailable tool 'repo_browser.read_file'. Available tools: ┃
┃ invalid, bash, edit, webfetch, glob, grep, list, read, write, todowrite, todoread, task. ┃
┃ ┃
┃ ┃
┃ Assistant ┃
┃ ┃
┃ The arguments provided to the tool are invalid: Model tried to call unavailable tool 'assistant'. Available tools: invalid, bash, ┃
┃ edit, webfetch, glob, grep, list, read, write, todowrite, todoread, task. ┃
┃ ┃
┃ ┃
┃ List %!s(float64=2) (path=) ┃
┃ ┃
┃ G:\Junk\testopencode/ ┃
┃ ┃
┃ ┃
┃ ┃
┃ Assistant ┃
┃ ┃
┃ The arguments provided to the tool are invalid: Model tried to call unavailable tool 'assistant'. Available tools: invalid, bash, ┃
┃ edit, webfetch, glob, grep, list, read, write, todowrite, todoread, task. ┃
┃ ┃
┃ ┃
┃ Task ┃
┃ ┃
┃ ┃
Hey! I’m not sure what you’re trying to do. Could you let me know the details or what you’d like me to work on?
Build gpt-oss:20b (08:47 AM)
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"ollama": {
"npm": "@ai-sdk/openai-compatible",
"options": {
"baseURL": "http://localhost:11434/v1"
},
"models": {
"granite4:micro": { "tools": true },
"gpt-oss:20b": { "tools": true },
"QWEN14B40KContextWindow:latest": { "tools": true },
"gemma3:4b": { "tools": true },
"AI0002:latest": { "tools": true },
"AI0001:latest": { "tools": true },
"qwen3:1.7b": { "tools": true },
"qwen3:14b": { "tools": true },
"gemma3:12b": { "tools": true },
"hf.co/bartowski/mistralai_Devstral-Small-2505-GGUF:IQ2_M": { "tools": true },
"hf.co/bartowski/mistralai_Devstral-Small-2505-GGUF:IQ3_M": { "tools": true },
"devstral-q3kl:latest": { "tools": true },
"nomic-embed-text:v1.5": { "tools": true },
"devstral:latest": { "tools": true },
"JollyLlama/GLM-4-32B-0414-Q4_K_M:latest": { "tools": true },
"gemma3:12b-it-qat": { "tools": true },
"cogito:14b": { "tools": true },
"deepcoder:latest": { "tools": true },
"deepseek-r1:671b": { "tools": true },
"deepseek-r1:1.5b": { "tools": true },
"deepseek-r1:70b": { "tools": true },
"deepseek-r1:14b": { "tools": true },
"deepseek-r1:8b": { "tools": true },
"deepseek-r1:7b": { "tools": true },
"deepseek-r1:32b": { "tools": true },
"llama3.3:latest": { "tools": true },
"nemotron:latest": { "tools": true },
"deepseek-coder-v2:16b": { "tools": true },
"granite3-dense:8b": { "tools": true },
"starcoder2:15b": { "tools": true },
"codellama:code": { "tools": true },
"codellama:latest": { "tools": true },
"qwen2.5:7b": { "tools": true },
"gemma2:27b": { "tools": true },
"phi3:14b": { "tools": true },
"llama3.2:latest": { "tools": true },
"llama3.1:latest": { "tools": true },
"reflection:latest": { "tools": true },
"codellama:7b-code": { "tools": true }
}
}
}
}
Tried simple version too:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"ollama": {
"npm": "@ai-sdk/openai-compatible",
"options": {
"baseURL": "http://localhost:11434/v1"
},
"models": {
"granite4:micro": {
"tools": true
},
"gpt-oss:20b": {
"tools": true
}
}
}
}
}
Activity
github-actions commentedon Oct 8, 2025
This issue might be a duplicate of existing issues. Please check:
Your issue appears to be related to the common problem of write tool functionality not working properly with local/Ollama models in build mode. The JSON tool call output you're seeing suggests the model is generating tool calls but OpenCode isn't executing them properly.
Feel free to ignore if none of these address your specific case.
SkybuckFlying commentedon Oct 8, 2025
To reproduce:
ollama list
exit ollama via system tray
ollama serve
step 4:
ollama run
step 5:
opencode
step 6:
/models
Make sure to setup
config.json
ollama settings in environment variables and settings.
SkybuckFlying commentedon Oct 8, 2025
yes
cmd1.exe: ollama list
cmd2.exe ollama serve
cmd3.exe ollama run qwen3etc
cmd4.exe opencode
opencode interacts with ollama http
┃ ┃
┃ write "Hello World" to a textfile called: test.txt in the current folder ┃
┃ skybu (09:32 AM) ┃
┃ ┃
┃ ┃
┃ Write G:\Junk\testopencode\test.txt
Okay, the user asked to write "Hello World" to a file called test.txt in the current folder. I need to use the write tool for this.
Let me check the parameters required for the write function. The filePath must be an absolute path. The current working directory
is G:\Junk\testopencode, so the file path should be G:\Junk\testopencode\test.txt. The content is "Hello World". I should make
sure to use the correct parameters. No other tools are needed here since it's a straightforward write operation. Let me construct
the tool call accordingly. Build QWEN14B40KContextWindow:latest (09:35 AM)
I made this model a while ago:
QWEN14B40KContextWindow:latest
Increase it's context window... I used it today and it worked !
I am not sure how I created this model, but maybe this link will help:
https://github.com/p-lemonish/ollama-x-opencode
Maybe ollama now has a new feature to increase context windows without creating new models ?!
rekram1-node commentedon Oct 8, 2025
@SkybuckFlying this is an ollama configuration issue not opencode, either the model is too dumb or it doesn't have enough context.
I can point you in direction of resources for that but this: https://github.com/p-lemonish/ollama-x-opencode generally solved it for most people I've talked with
[-]write "hello world" to test.txt not working on windows 11. (is in build mode, file manipulation in plan mode would be usefull too !!!!!!!!!!!!!!!)[/-][+]ollama tool calling issues[/+]rekram1-node commentedon Oct 8, 2025
this issue may be useful: #2362
rekram1-node commentedon Oct 12, 2025
closing since this isn't an opencode issue, If you need more help getting your ollama setup for agentic development let me know
DoubleDensity commentedon Nov 19, 2025
Thank you! this was very helpful and got me off the ground with tool calling