anomalyco / anomalyco/opencode

MCP tools not sent to local OpenAI-compatible models (empty tools array)

Open
#39,164 2 comments 0 reactions 1 assignee View on GitHub

@jlongster is already working on this.

Since Jul 27, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

When using a local model via an OpenAI-compatible provider (Ollama proxy), OpenCode sends tools: [] (empty array) instead of the actual MCP tool definitions. The model responds with plain text because it never receives the tool definitions.

The same configuration works correctly with the Anthropic/Claude provider.

Environment
  • OpenCode: 1.18.5
  • Provider tested: @ai-sdk/openai-compatible v3.0.7 and @ai-sdk/openai v4.0.11
  • Local model: deepseek-v4-flash-stock (also qwen3.5:9b-stock)
  • Proxy: Ollama proxy (OpenAI-compatible endpoint)
  • MCP servers: filesystem, fetch
  • OS: Linux (CachyOS)
Steps to reproduce
  1. Configure local model with "tools": true in opencode.json
  2. Enable MCP servers (filesystem, fetch)
  3. Start OpenCode with local model
  4. Ask the model to use a tool
  5. Model responds with text, no tool call
Expected

Model receives MCP tool definitions and calls the appropriate tool.

Actual

OpenCode sends tools: [] (empty array). Logs show:

WARN "MCP connection closed" server=filesystem
WARN "schema rejection" kind=Payload reason="Expected object, got undefined"
Direct test (works)

Same request sent directly to the proxy WITH tool definitions → model responds with correct tool_calls. The model and proxy are not the problem.

Note

Affects both @ai-sdk/openai-compatible and @ai-sdk/openai. Does NOT occur with Anthropic/Claude provider.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.