-
Notifications
You must be signed in to change notification settings - Fork 0
Tools
Yash Aryan edited this page Aug 8, 2026
·
1 revision
Tools are Ollama function-calling definitions executed locally in the Electron main process. They are attached to a chat turn when Tools are enabled.
| Kind | Persistence | Implementation |
|---|---|---|
| Builtin | Code |
tools/registry.ts BUILTINS + tools/exec.ts
|
| Custom shell/HTTP | userData/anylm-tools.json |
Templates with {param}; no app rebuild |
Default: builtins are enabled unless listed in the disabled set. Custom tools default to whatever enabled you set on save.
| File | Role |
|---|---|
app/src/main/tools/registry.ts |
Builtin catalog, save/toggle, ollamaTools()
|
app/src/main/tools/exec.ts |
Dispatch + confirm + shell/HTTP/custom |
app/src/main/tools/fs-tools.ts |
Workspace-relative FS operations |
app/src/main/tools/web-search.ts |
Search backend for web_search
|
app/src/renderer/js/tools-view.ts |
Tools UI |
app/src/types/domain.d.ts |
ToolDefinition, ToolParam, OllamaToolDef
|
| Name | Risky | Notes |
|---|---|---|
get_time |
no | Local clock |
read_file |
no | Relative to workspace or absolute |
list_directory |
no | |
write_file |
yes | Workspace-relative |
create_directory |
yes | |
move_path / copy_path / delete_path
|
yes | |
find_files |
no | Name substring / glob |
web_search |
no | Used by Web research skill |
open_app_or_url |
yes | |
run_shell |
yes | 15s timeout; prefer narrower tools |
http_fetch |
GET no / other yes | Body for POST/PUT |
ask_user |
no | Structured question → renderer |
generate_document |
yes | pdf/docx/pptx/md — always confirms |
Shell timeout constant: SHELL_TIMEOUT = 15_000 in exec.ts.
- Tools → New tool.
-
Name:
snake_case(becomes the Ollama function name). - Description: one clear sentence for the model about when to call it.
-
Kind:
-
Shell — command template with
{param}placeholders (always risky). - HTTP — URL template + method; non-GET is risky.
-
Shell — command template with
- Params: name | description | required.
- Enable the tool; in chat turn Tools on; ask something concrete.
- Prefer one focused tool over exposing raw
run_shell. - Escape assumptions: shell values are escaped; URL params are encoded.
- Keep output small; large stdout is truncated for the model.
- Write descriptions that include trigger phrases (“when the user asks to …”).
- Append to
BUILTINSinregistry.ts:
{
id: "my_tool",
name: "my_tool",
description: "Use when …",
params: [{ name: "x", description: "…", required: true }],
enabled: true,
builtin: true,
risky: false,
},- Implement a
case "my_tool":inexecBuiltininsideexec.ts. Always return a string. - If mutating / network / process: set
risky: trueso the confirm gate runs. - Optional: document on the marketing catalog (
web/) if user-facing.
tools/exec.execute(name, args, confirm, allow?, context?):
-
allow— optionalSetof tool names permitted even if globally disabled (skills use this). -
context— chat/project/workspace hints for FS and documents. - Confirm callback bridges to renderer
onToolConfirm/replyToolConfirm.
Skills may either:
- Reference registry tools by
toolNames, or - Define connector-native tools with their own
run(args, bearer).
Chat merges schemas from both registries. Routing: connector-owned names → skills/exec; everything else → tools/exec.
- Single-agent tool loop: up to 15 rounds (
ipc.ts). - Multi-agent workers: 3 rounds (
agents/workers.ts). - Needs a tool-capable Ollama model. Small models may emit text JSON; recovery logic tries to parse those into tool calls.
The local OpenAI-compatible proxy does not run AnyLM tools. External clients get governed chat completions only.
| Method | Purpose |
|---|---|
toolsList |
Builtin + custom |
toolsSave |
Create/update custom (kind, command/url, method, params) |
toolsDelete / toolsToggle
|
Manage custom / enabled state |
workspaceGet / Pick / Clear
|
FS sandbox root for file tools |
onToolConfirm / replyToolConfirm
|
Risky approval |
-
bun testcovers exec helpers, FS tools, web research recovery, etc. - Manual: toggle off/on, confirm deny path, workspace-relative paths, shell timeout.
| Page | Description |
|---|---|
| Home | Overview and navigation |
| Getting-Started | Local setup |
| Architecture | System design |
| Code-Structure | Directory map |
| Features | Feature inventory |
| Contributing | PR workflow |
| How-to-Change | Common change recipes |
| Gotchas | Footguns |
| Chat-Pipeline | Turn lifecycle |
| IPC-Contract | window.api |
| Auth-and-Firebase | Identity + rules |
| RAG-and-Knowledge | Vectors + graph |
| Agents | Multi-agent |
| Proxy-and-Governance | :3227 + policies |
| Configuration | Env + settings |
| Testing | bun test |
| Build-and-Release | Packaging |
| Skills | Build skills |
| Tools | Build tools |
| MCP-and-Extensions | MCP status + options |