|
105 | 105 | - **Seamless model switching** — capabilities update instantly when you switch models mid-conversation |
106 | 106 | - **Chain-of-thought reasoning** for models that support it (e.g. `qwen3`, `deepseek-r1`, `deepseek-v3.1`, `gpt-oss`) |
107 | 107 | - **Tool calling** and a full agent loop for multi-step model actions |
| 108 | +- **Custom coding tools** (`read`, `grep`, `glob`, `ls`, `write`, `edit`, `multiedit`, `apply_patch`, `bash`, `batch`, planning/todo/task tools, and more) |
108 | 109 | - **Web search** via Ollama's built-in tools (requires an Ollama API key) |
109 | 110 | - **Vision / image attachments** for vision-capable models (e.g. `gemma3`, `llava`) |
110 | 111 | - **Context window alignment** — `max_context_tokens` is forwarded to Ollama as `options.num_ctx` so the server-side context window always matches the client-side trim budget |
@@ -278,6 +279,20 @@ enabled = false |
278 | 279 | directory = "~/.local/state/ollamaterm/conversations" |
279 | 280 | metadata_path = "~/.local/state/ollamaterm/conversations/index.json" |
280 | 281 |
|
| 282 | +[tools] |
| 283 | +# Enable schema-first custom coding tools |
| 284 | +enabled = true |
| 285 | +# Base root for file/search/edit tools |
| 286 | +workspace_root = "." |
| 287 | +# Allow temporary external roots via external-directory tool |
| 288 | +allow_external_directories = false |
| 289 | +command_timeout_seconds = 30 |
| 290 | +max_output_lines = 200 |
| 291 | +max_output_bytes = 50000 |
| 292 | +max_read_bytes = 200000 |
| 293 | +max_search_results = 200 |
| 294 | +default_external_directories = [] |
| 295 | + |
281 | 296 | [capabilities] |
282 | 297 | # Show the model's reasoning trace inside the assistant bubble. |
283 | 298 | # Thinking support itself is auto-detected — this controls only the UI display. |
@@ -346,6 +361,99 @@ The agent loop allows the model to invoke tools multiple times before producing |
346 | 361 | a final answer. Control the upper bound with `max_tool_iterations` in |
347 | 362 | `[capabilities]`. |
348 | 363 |
|
| 364 | +In addition to Ollama web tools, OllamaTerm now ships a schema-first local |
| 365 | +coding toolset designed for agentic workflows: |
| 366 | + |
| 367 | +- File and search tools: `read`, `ls`, `glob`, `grep`, `codesearch` |
| 368 | +- Editing tools: `write`, `edit`, `multiedit`, `apply_patch` |
| 369 | +- Runtime tools: `bash`, `batch`, `external-directory` |
| 370 | +- Planning/state tools: `plan-enter`, `plan-exit`, `plan`, `todo`, `todoread`, `todowrite`, `task`, `question` |
| 371 | +- Introspection tools: `registry`, `tool`, `truncation`, `invalid` |
| 372 | + |
| 373 | +These tools are controlled by the `[tools]` config section and are constrained |
| 374 | +by workspace-root path checks, command timeouts, and output truncation limits. |
| 375 | + |
| 376 | +#### Function tools with Ollama (alpha/experimental) |
| 377 | + |
| 378 | +OllamaTerm passes tools to the Ollama Python SDK in two forms: |
| 379 | + |
| 380 | +- JSON function tools generated from the schema-first tool specs (the majority of tools below) |
| 381 | +- Python callables for built-in Ollama integrations when enabled (e.g. `web_search`, `web_fetch`) |
| 382 | + |
| 383 | +The model emits `tool_calls`, the app executes them, appends a `tool` role message with the result, and continues the loop until the assistant returns a final answer. |
| 384 | + |
| 385 | +> Warning: This tool suite is experimental. Most tools are untested and may be buggy or missing edge-case handling. Use with caution and review changes carefully, especially file edits. Outputs may be truncated according to configured limits. |
| 386 | +
|
| 387 | +##### Available tools (names and key parameters) |
| 388 | + |
| 389 | +- Files & search |
| 390 | + - `list` (built-in) — List files and directories. |
| 391 | + - `path?: string` (default: workspace root) |
| 392 | + - `ls` (custom) — Alternate directory listing with tree-style output. |
| 393 | + - `path?: string`, `ignore?: string[]` |
| 394 | + - `read` — Read a file window. |
| 395 | + - `path: string`, `offset?: int`, `limit?: int` |
| 396 | + - `glob` — Find files by glob. |
| 397 | + - `pattern: string`, `path?: string`, `max_results?: int` |
| 398 | + - `grep` / `codesearch` — Search file contents. |
| 399 | + - `query: string`, `path?: string`, `case_sensitive?: bool`, `fixed_strings?: bool`, `max_results?: int` |
| 400 | + |
| 401 | +- Editing |
| 402 | + - `write` — Atomic full-file write. |
| 403 | + - `path: string`, `content: string`, `overwrite?: bool`, `create_dirs?: bool` |
| 404 | + - `edit` — Single snippet replace. |
| 405 | + - `path: string`, `old_text: string`, `new_text: string`, `replace_all?: bool` |
| 406 | + - `multiedit` — Multiple snippet edits atomically. |
| 407 | + - `path: string`, `edits: { old_text, new_text, replace_all? }[]` |
| 408 | + - `apply_patch` — Apply structured patch hunks. |
| 409 | + - `path: string`, `hunks: { old_text, new_text, replace_all? }[]` |
| 410 | + |
| 411 | +- Runtime |
| 412 | + - `bash` — Run a shell command (capped by time/output limits). |
| 413 | + - `command: string`, `cwd?: string` |
| 414 | + - `batch` — Run a sequence of tool calls. |
| 415 | + - `calls: { name: string, arguments: object }[]`, `continue_on_error?: bool` |
| 416 | + - `external-directory` — Manage temporary external directory allowlist for this session. |
| 417 | + - `action: string`, `path?: string` |
| 418 | + |
| 419 | +- Planning & state |
| 420 | + - `plan-enter` | `plan-exit` | `plan` |
| 421 | + - `plan-enter: { goal?: string }` |
| 422 | + - `plan: { action?: string, content?: string }` |
| 423 | + - `todo` | `todoread` | `todowrite` | `task` |
| 424 | + - `todo: { item: string }` |
| 425 | + - `todowrite: { items: string[], mode?: "append"|"replace" }` |
| 426 | + - `task: { action?: string, name?: string, status?: string }` |
| 427 | + - `question` — Emit a structured clarification question. |
| 428 | + - `prompt: string`, `context?: string` |
| 429 | + |
| 430 | +- Introspection & utility |
| 431 | + - `registry` — List available tools. |
| 432 | + - `tool` — Inspect a tool definition. |
| 433 | + - `truncation` — Show output truncation limits. |
| 434 | + - `invalid` — Always fails (for error-path testing). |
| 435 | + |
| 436 | +- Web (requires tool-capable model; `web_search_enabled = true` and an API key) |
| 437 | + - `websearch` — Perform a web search via Ollama integration. |
| 438 | + - `query: string`, `max_results?: int` |
| 439 | + - `webfetch` — Fetch a URL via Ollama integration. |
| 440 | + - `url: string` |
| 441 | + |
| 442 | +Notes: |
| 443 | + |
| 444 | +- Directory listing may appear as `list` (built-in) or `ls` (custom) depending on which tool set is active. Both list files; prefer `list` when available. |
| 445 | +- File and command tools will prompt for permission. Paths are restricted to the configured workspace by default. |
| 446 | +- Large outputs are truncated. Use `offset`/`limit` (for `read`) and `max_results` (for `grep`/`glob`) to scope results. |
| 447 | + |
| 448 | +##### Quick examples |
| 449 | + |
| 450 | +```text |
| 451 | +List files here → Call tool: list { "path": "." } |
| 452 | +Search for a string → Call tool: grep { "query": "TODO", "path": "." } |
| 453 | +Read a file window → Call tool: read { "path": "src/main.py", "offset": 1, "limit": 120 } |
| 454 | +Make an edit → Call tool: edit { "path": "README.md", "old_text": "foo", "new_text": "bar", "replace_all": true } |
| 455 | +``` |
| 456 | + |
349 | 457 | ### Web search |
350 | 458 |
|
351 | 459 | Set `web_search_enabled = true` in `[capabilities]` and provide an Ollama API |
|
0 commit comments