Which symptom you have
These four have different causes, so start by matching yours. All of them assume Ollama is already running with enough context (we used 32,768).
- The file exists, but its contents are wrong in a way that isn’t obvious at first glance: the model’s reading, not OpenCode. Step 1 and 2 below.
- The agent reads the file and stops without writing anything: also the model. Try another one, and keep the task small.
- Empty replies, or “the response is not valid JSON”, from a model that reasons: the reasoning used up the context. Step 3.
- A tool from an MCP server “doesn’t exist”, even though opencode mcp list says connected: the tool name. Step 4.
Steps 1 and 2: delegate only what you can check, and check it with code
A local 9–12B agent works the tools mechanically, but you can’t hand it the reading. Use it for small tasks you can verify in a minute: renaming files, a draft you’ll review, searching the project, extracting a list you’ll cross-check. Before you launch the task, write down which properties the output must satisfy and which of them a script can check. If you can’t check anything, the task is too big for a small model.
In the book’s test, the task was to turn fictional meeting minutes into a table of actions. gemma4:12b produced six neat rows with the requested columns, but put the turn number in the literal-date column and assigned the “send to client” task to the person who spoke in that turn, when the minutes leave it without an owner. Assigning by proximity is exactly the trap that does the most damage in real minutes, and it doesn’t show at a glance. A review script that checks the expected properties (six rows, no numbers in the date column, PENDING where the owner is missing) caught five failed checks in that table.
Step 3: empty replies from a reasoning model
Some models think before they answer, and that reasoning takes up context. If it consumes everything, the answer comes back blank with no error. Raise the context first; if you can’t, turn reasoning off for that job or use a model that doesn’t reason by default.
Outside OpenCode, with the same API it uses (/v1) and the default context, qwen3.5:9b returned “the response is not valid JSON” after about 60 seconds, twice in a row: 3,661 tokens generated and 4,096 in total, all spent reasoning. With "reasoning_effort": "none" the same request took 3.6 seconds and returned valid JSON. Ollama’s documentation confirms that /v1/chat/completions accepts reasoning_effort. More detail in Ollama empty response: turn off thinking.
- $body = @{ model = 'qwen3.5:9b'; temperature = 0; reasoning_effort = 'none'; messages = @(@{ role = 'user'; content = 'Who is in charge of sending to the client?' }) } | ConvertTo-Json -Depth 5
- $r = Invoke-RestMethod http://127.0.0.1:11434/v1/chat/completions -Method Post -Body ([Text.Encoding]::UTF8.GetBytes($body)) -ContentType 'application/json'
- $r.choices[0].message.content; $r.usage
- Remove reasoning_effort and compare usage: if total_tokens matches the context and the reply is empty, the reasoning used up the room
Shortened from the book’s version, which pastes the test minutes into the message.
Step 4: MCP tools “not found” in OpenCode
The tool name changes depending on the program. The same server, called lab, with a tool called leer_documento, shows up in OpenCode as lab_leer_documento and in Claude Code as mcp__lab__leer_documento. A task that said “use leer_documento” led the model to conclude it didn’t have that tool, so it read the file another way. In your tasks and in AGENTS.md, use OpenCode’s exact name, or describe what the tool does.
And “connected” doesn’t mean it works: the same MCP configuration loaded when we launched OpenCode from the terminal, but not when we launched it from a Python script using the Windows path, while opencode mcp list said connected in both cases. Put the server in the project’s opencode.json, not in the global one, and confirm in a test task that the model actually used the tool. That is the only check that counts.
Step 5: make OpenCode ask before it acts
According to OpenCode’s documentation, by default it allows most operations without asking. With a model you’ve already seen misread a set of minutes, have it ask before it runs commands or edits files. Add this to the project’s opencode.json: "permission": { "bash": "ask", "edit": "ask", "webfetch": "deny" }. To fully close one MCP tool, use its OpenCode name: "tools": { "lab_crear_tarea_externa": false }.
A lesson from our tests: a blocklist only blocks what you thought of. We banned Bash and the web tools in another agent, and the model used PowerShell to download the pages anyway. Deny by default, open only what the task needs, and check in a test which tools it actually used.
Frequently asked questions
Which local model works best with OpenCode?In our test, gemma4:12b used the tools correctly and wrote the file; qwen3.5:9b read and stopped. Neither got the reading fully right, so check the output whatever you pick.
Why does OpenCode say my MCP tool doesn’t exist?Because OpenCode names it server_tool (lab_leer_documento), not by the bare tool name. Use that exact name in your instructions.
Why does my local model return empty replies in OpenCode?Usually its reasoning used up the context. Raise the context or set reasoning_effort to none for that model.
Is a local model good enough for coding agents?For small, checkable tasks, yes. For anything you can’t verify with a script or a quick look, not yet, in our tests.