Skip to content

Commit b73e94a

Browse files
continue[bot]Continuenate
committed
docs: Add troubleshooting and guidance for Ollama MCP tool calling
- Add troubleshooting section for Mistral/Gemma MCP tool calling errors - Document automatic message normalization in Ollama guide - Add guidance on choosing compatible models for MCP integration - Include links to troubleshooting from Ollama guide Related to PR #9253 Generated with Continue (https://continue.dev) Co-Authored-By: Continue <[email protected]> Co-authored-by: nate <[email protected]>
1 parent 815b43b commit b73e94a

File tree

2 files changed

+65
-2
lines changed

2 files changed

+65
-2
lines changed

docs/guides/ollama-guide.mdx

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ models:
168168
169169
### Model Capabilities and Tool Support
170170
171-
Some Ollama models support tools (function calling) which is required for Agent mode. However, not all models that claim tool support work correctly:
171+
Some Ollama models support tools (function calling) which is required for Agent mode and MCP integration. However, not all models that claim tool support work correctly:
172172
173173
#### Checking Tool Support
174174
@@ -181,6 +181,10 @@ models:
181181
- tool_use # Add this to enable tools
182182
```
183183
184+
<Info>
185+
**MCP Tool Calling Compatibility**: Continue automatically handles message normalization for Ollama models to ensure compatibility with MCP tool calling. This includes fixing known issues with Mistral and Gemma models. No additional configuration is required.
186+
</Info>
187+
184188
<Warning>
185189
**Known Issue**: Some models like DeepSeek R1 may show "Agent mode is not
186190
supported" or "does not support tools" even with capabilities configured. This
@@ -307,7 +311,19 @@ ollama pull deepseek-r1:32b
307311

308312
1. Add `capabilities: [tool_use]` to your model config
309313
2. If still not working, the model may not actually support tools
310-
3. Switch to a model with confirmed tool support (Llama 3.1, Mistral)
314+
3. Switch to a model with confirmed tool support (Llama 3.1, Mistral, DeepSeek, Qwen)
315+
316+
#### MCP Tool Calling Errors
317+
318+
**Problem**: Errors like "Unexpected role 'system' after role 'tool'" (Mistral) or "Invalid 'tool_calls': unknown variant 'index'" (Gemma)
319+
320+
**Solution**: These errors are automatically handled by Continue's message normalization system. If you encounter them:
321+
322+
1. Ensure you're using Continue v1.1.x or later
323+
2. The normalization happens automatically - no configuration needed
324+
3. For persistent issues, see the [troubleshooting guide](/troubleshooting#ollama-model-errors-with-mcp-tool-calling)
325+
326+
**Recommended models for MCP tool calling**: DeepSeek V3, Qwen3 family, Llama 3.1, Mistral (all versions)
311327

312328
#### Using Hub Blocks in Local Config
313329

@@ -370,6 +386,17 @@ Use Continue with Ollama to:
370386
- Identify potential bugs
371387
- Generate documentation
372388

389+
## Using Ollama with MCP Tools
390+
391+
Ollama models can be used with MCP (Model Context Protocol) servers for enhanced functionality. When using MCP tools:
392+
393+
- **Ensure tool support**: Add `capabilities: [tool_use]` to your model configuration
394+
- **Choose compatible models**: DeepSeek V3, Qwen3 family, Llama 3.1, and Mistral models work well with MCP tools
395+
- **Automatic normalization**: Continue automatically handles model-specific message formatting to ensure compatibility
396+
- **Error handling**: If you encounter tool calling errors, check the [troubleshooting guide](/troubleshooting#ollama-model-errors-with-mcp-tool-calling)
397+
398+
For more information on MCP integration, see the [MCP guides](/guides/overview#mcp-integration-cookbooks).
399+
373400
## Conclusion
374401

375402
Ollama with Continue provides a powerful local development environment for AI-assisted coding. You now have complete control over your AI models, ensuring privacy and enabling offline development workflows.

docs/troubleshooting.mdx

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,42 @@ If your keyboard shortcuts are not resolving, you may have other commands that a
8282

8383
## MCP Server connection issues
8484

85+
### Ollama model errors with MCP tool calling
86+
87+
Certain Ollama models may encounter errors during MCP tool calling operations, particularly after tool execution when the model processes tool results.
88+
89+
<AccordionGroup>
90+
<Accordion title="Mistral/Ministral: 'Unexpected role system after role tool'">
91+
**Error message:**
92+
```
93+
400 Bad Request: Unexpected role 'system' after role 'tool'
94+
```
95+
96+
**Cause:** Mistral family models don't accept system messages appearing after tool messages in the conversation.
97+
98+
**Solution:** This issue is automatically handled by Continue's message normalization (added in v1.1.x). If you're still experiencing this error:
99+
- Ensure you're using the latest version of Continue
100+
- The normalization automatically reorders system messages before tool interactions
101+
- No configuration changes are required
102+
</Accordion>
103+
104+
<Accordion title="Gemma models: 'Invalid tool_calls: unknown variant index'">
105+
**Error message:**
106+
```
107+
400 Bad Request: Invalid 'tool_calls': unknown variant 'index'
108+
```
109+
110+
**Cause:** Gemma models don't recognize the 'index' field in tool_calls structure.
111+
112+
**Solution:** This issue is automatically handled by Continue's message normalization (added in v1.1.x). If you're still experiencing this error:
113+
- Ensure you're using the latest version of Continue
114+
- The normalization automatically removes the 'index' field from tool calls
115+
- No configuration changes are required
116+
117+
**Note:** Some Gemma models may still experience compatibility issues with MCP tool calling even after normalization. Consider using alternative models like DeepSeek, Qwen, or Mistral for reliable MCP tool support.
118+
</Accordion>
119+
</AccordionGroup>
120+
85121
### "spawn ENAMETOOLONG" error on macOS
86122

87123
If you're seeing an error like `Failed to connect to "<MCP Server Name>"` with `Error: spawn ENAMETOOLONG` when using MCP servers on macOS, this is due to the environment being too large when spawning the MCP process.

0 commit comments

Comments
 (0)