feat: add model management tools to add-ollama-tool skill
Adds four new MCP tools to the existing ollama integration, consolidating model management (from #1331) into the single add-ollama-tool skill as requested by @gavrielc: - ollama_pull_model — pull a model from the Ollama registry - ollama_delete_model — delete a local model to free disk space - ollama_show_model — inspect modelfile, parameters, and architecture - ollama_list_running — list models loaded in memory with VRAM/processor info All four tools follow the existing patterns in this file: OLLAMA_HOST env var, ollamaFetch() with host.docker.internal fallback, log() and writeStatus() helpers. No changes to index.ts or container-runner.ts needed — OLLAMA_HOST is already forwarded via sdkEnv. Also updates SKILL.md description, tool list, verify steps, and adds a troubleshooting entry for large-model pull timeouts. Closes #1331. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,15 +1,19 @@
|
||||
---
|
||||
name: add-ollama-tool
|
||||
description: Add Ollama MCP server so the container agent can call local models for cheaper/faster tasks like summarization, translation, or general queries.
|
||||
description: Add Ollama MCP server so the container agent can call local models and manage the Ollama model library.
|
||||
---
|
||||
|
||||
# Add Ollama Integration
|
||||
|
||||
This skill adds a stdio-based MCP server that exposes local Ollama models as tools for the container agent. Claude remains the orchestrator but can offload work to local models.
|
||||
This skill adds a stdio-based MCP server that exposes local Ollama models as tools for the container agent. Claude remains the orchestrator but can offload work to local models, and can also manage the model library directly.
|
||||
|
||||
Tools added:
|
||||
- `ollama_list_models` — lists installed Ollama models
|
||||
- `ollama_generate` — sends a prompt to a specified model and returns the response
|
||||
- `ollama_list_models` — list installed models with name, size, family, and last modified date
|
||||
- `ollama_generate` — send a prompt to a specified model and return the response
|
||||
- `ollama_pull_model` — pull (download) a model from the Ollama registry by name
|
||||
- `ollama_delete_model` — delete a locally installed model to free disk space
|
||||
- `ollama_show_model` — show model details: modelfile, parameters, template, and architecture info
|
||||
- `ollama_list_running` — list models currently loaded in memory with memory usage and processor type
|
||||
|
||||
## Phase 1: Pre-flight
|
||||
|
||||
@@ -106,7 +110,7 @@ launchctl kickstart -k gui/$(id -u)/com.nanoclaw # macOS
|
||||
|
||||
## Phase 4: Verify
|
||||
|
||||
### Test via WhatsApp
|
||||
### Test inference
|
||||
|
||||
Tell the user:
|
||||
|
||||
@@ -114,6 +118,12 @@ Tell the user:
|
||||
>
|
||||
> The agent should use `ollama_list_models` to find available models, then `ollama_generate` to get a response.
|
||||
|
||||
### Test model management
|
||||
|
||||
> Send a message like: "pull the gemma3:1b model" or "which ollama models are currently loaded in memory?"
|
||||
>
|
||||
> The agent should call `ollama_pull_model` or `ollama_list_running` respectively.
|
||||
|
||||
### Monitor activity (optional)
|
||||
|
||||
Run the watcher script for macOS notifications when Ollama is used:
|
||||
@@ -129,9 +139,10 @@ tail -f logs/nanoclaw.log | grep -i ollama
|
||||
```
|
||||
|
||||
Look for:
|
||||
- `Agent output: ... Ollama ...` — agent used Ollama successfully
|
||||
- `[OLLAMA] >>> Generating` — generation started (if log surfacing works)
|
||||
- `[OLLAMA] >>> Generating` — generation started
|
||||
- `[OLLAMA] <<< Done` — generation completed
|
||||
- `[OLLAMA] Pulling model:` — pull in progress
|
||||
- `[OLLAMA] Deleted:` — model removed
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
@@ -151,3 +162,7 @@ The agent is trying to run `ollama` CLI inside the container instead of using th
|
||||
### Agent doesn't use Ollama tools
|
||||
|
||||
The agent may not know about the tools. Try being explicit: "use the ollama_generate tool with gemma3:1b to answer: ..."
|
||||
|
||||
### `ollama_pull_model` times out on large models
|
||||
|
||||
Large models (7B+) can take several minutes. The tool uses `stream: false` so it blocks until complete — this is intentional. For very large pulls, use the host CLI directly: `ollama pull <model>`
|
||||
|
||||
Reference in New Issue
Block a user