Tools
Luna provides 92 registered tools (tools=92; 74 built-in + 12 computer-use + 6 desktop-environment) plus dynamic MCP tool discovery. The LLM agent autonomously selects and executes tools based on the task. Permission modes and per-mode rulesets control which tools are available.
Tool Prefix Conventions
| Prefix | Source | Example |
|---|---|---|
builtin__ | Built into Luna | builtin__bash, builtin__read_file |
custom__ | Discovered from workspace | custom__my_tool |
mcp__ | MCP server | mcp__github_create_issue |
File Operations
bash
Execute shell commands in the workspace directory.
| Parameter | Type | Required | Description |
|---|---|---|---|
command | string | Yes | Shell command to execute |
timeout | number | No | Timeout in milliseconds (default: 60000) |
Output limited to 16KB. Exit code included in result. Commands use fork/exec with pipe capture.
read_file
Read file contents with optional line range. Detects image files and returns base64-encoded content blocks for vision-capable models.
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | Absolute file path |
offset | number | No | Starting line number (1-based) |
limit | number | No | Maximum lines to read |
write_file
Create or overwrite a file atomically.
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | File path |
content | string | Yes | File content |
Max size: 10MB. Uses atomic write (write to .tmp, then rename). Queued through mutation queue.
edit_file
Search and replace in an existing file. Fails if old_text is not found or matches multiple locations.
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | File path |
old_text | string | Yes | Exact text to find |
new_text | string | Yes | Replacement text |
Search
glob_search
Find files matching a glob pattern. Max 100 results, sorted by modification time.
| Parameter | Type | Required | Description |
|---|---|---|---|
pattern | string | Yes | Glob pattern (supports ** recursive) |
path | string | No | Base directory |
grep_search
Search file contents with regex. Max 50 results.
| Parameter | Type | Required | Description |
|---|---|---|---|
pattern | string | Yes | Regular expression pattern |
path | string | No | Base directory |
code_search
Search code using language-server analysis or text search fallback.
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Symbol name or text pattern |
search_type | string | Yes | definition, references, symbols, text |
file_path | string | No | Limit to this file |
language | string | No | Limit to this language |
Code Intelligence
lsp
Query a language server. Supports 7+ language servers.
| Parameter | Type | Required | Description |
|---|---|---|---|
operation | string | Yes | goToDefinition, findReferences, hover, documentSymbol, diagnostics |
path | string | Yes | File path |
line | number | Yes | Line number (1-based) |
character | number | Yes | Column number (1-based) |
Git
git
Execute structured git operations. Dangerous operations (force push, hard reset, rebase) are blocked.
| Parameter | Type | Required | Description |
|---|---|---|---|
command | string | Yes | status, diff, log, branch, show, add, commit, stash, checkout |
args | string | No | Optional arguments |
path | string | No | Optional file path |
git_snapshot
Manage git snapshots for undo and review. Auto-created after mutating tools
(: a mutating-tool completion schedules a debounced
snapshot_all when the session workspace is a git repo — debounce 2s,
24h cleanup retention; failures are warn-logged, never fatal to the tool).
Session checkpoints in a git workspace also record the working-tree HEAD
hash, and restore_checkpoint restores the tree to that position.
| Parameter | Type | Required | Description |
|---|---|---|---|
command | string | Yes | list, diff, restore |
snapshot_id | string | No | Snapshot commit hash |
files | array | No | File paths to restore |
count | number | No | Number to list (default: 10) |
Web
web_fetch
Fetch content from a URL. Output limited to 1MB. Uses libcurl via FFI.
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | URL to fetch |
format | string | No | text (default) or markdown |
web_search
Search the web via SearXNG or Brave Search API.
| Parameter | Type | Required | Description |
|---|---|---|---|
query | string | Yes | Search query |
max_results | number | No | Maximum results (default: 10) |
http_request
Make HTTP requests (GET, POST, PUT, PATCH, DELETE, HEAD).
| Parameter | Type | Required | Description |
|---|---|---|---|
url | string | Yes | Request URL |
method | string | Yes | HTTP method |
headers | object | No | Request headers |
body | string | No | Request body |
timeout | number | No | Timeout in milliseconds |
stream | boolean | No | Stream response |
max_stream_bytes | number | No | Max bytes when streaming (default: 100KB) |
MCP Tools
mcp_read_resource
Read a resource from an MCP server. If no server specified, tries all connected servers.
| Parameter | Type | Required | Description |
|---|---|---|---|
uri | string | Yes | MCP resource URI |
server | string | No | Specific MCP server name |
mcp_get_prompt
Get a prompt template from an MCP server.
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Prompt template name |
arguments | object | No | Template arguments |
server | string | No | Specific MCP server name |
Session Tools
todo
Manage a session-scoped task checklist.
| Parameter | Type | Required | Description |
|---|---|---|---|
action | string | Yes | list, add, update, remove |
id | string | No | Task ID |
text | string | No | Task description |
status | string | No | pending, in_progress, completed |
priority | string | No | high, medium, low |
undo_edit
Undo the last file edit(s). Maintains a stack of up to 50 entries.
| Parameter | Type | Required | Description |
|---|---|---|---|
count | number | No | Number of edits to undo (default: 1) |
task
Spawn a sub-agent with its own context. 60-second timeout, up to 20 steps.
| Parameter | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Task description |
tools | array | No | Restrict to these tools |
backend | string | No | local, zmq, luerl, team, background |
switch_mode
Switch the agent to a different operating mode.
| Parameter | Type | Required | Description |
|---|---|---|---|
mode | string | Yes | Mode name |
reason | string | Yes | Why the switch is needed |
Team Tools
Team assignment is directive-driven. The retired
team_spawntool has no live registration; work is assigned to teammates through Sol team directives, and workers communicate viateam_mail.
team_mail
Send a message to team members via priority mailbox.
| Parameter | Type | Required | Description |
|---|---|---|---|
team_id | string | Yes | Team ID |
body | string | Yes | Message body |
to | string | No | Recipient ID or all |
subject | string | No | Message subject |
priority | string | No | high, normal, low |
Utility Tools
calculator
Evaluate mathematical expressions safely. No code execution. Expressions are
evaluated in a restricted math-only environment (only math functions,
pi/e, and arithmetic operators are reachable).
| Parameter | Type | Required | Description |
|---|---|---|---|
expression | string | Yes | Math expression |
diagram
Generate Mermaid diagrams from descriptions.
| Parameter | Type | Required | Description |
|---|---|---|---|
description | string | Yes | What the diagram should show |
diagram_type | string | No | flowchart, sequence, class, state, er, gantt |
code | string | No | Direct Mermaid code |
file_watcher
Watch a file or directory for changes. Uses inotify when available.
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | File or directory path |
timeout | number | No | Seconds to watch (default: 10, max: 60) |
attach_image
Attach an image for multimodal analysis. Max 20MB.
| Parameter | Type | Required | Description |
|---|---|---|---|
path | string | Yes | Absolute path to image |
Desktop Automation Tools
6 desktop automation tools registered when the required display-server utilities are detected (X11/Wayland). Each tool degrades gracefully (is not registered) when its backing binary is absent, so headless environments simply expose fewer tools:
| Tool | Description | Permission | Requires |
|---|---|---|---|
window_manage | Manage windows via bspwm tiling WM (list, focus, close, move, resize, desktops, layout, fullscreen) | execute | bspwm (bspc) |
desktop_notify | Send desktop notifications (title/body/urgency) | execute | libnotify (notify-send) |
display_layout | Get or set display configuration via xrandr (list, arrange, resolution) | execute | xrandr |
window_info | Get detailed window geometry, title, WM_CLASS, and properties | read | xwininfo / xprop |
audio_control | Control audio via PulseAudio/PipeWire (list_sinks, set_volume, mute, unmute) | execute | pactl |
xrdb_query | Query or load the X11 resource database (query, get, load) | read | xrdb |
All desktop automation tools gracefully degrade in headless environments.
Tool Discovery
Luna scans the workspace for custom tool definitions:
Workspace scanning from .luna/tools/ and ~/.luna/tools/
Hot-reload with /tools-reload slash command
Listing with /tools-list slash command
Namespacing with custom__ prefix for discovered tools
Tool Selection Patterns
| Task | Tools |
|---|---|
| Explore codebase | glob_search, grep_search, read_file |
| Fix a bug | read_file, bash, edit_file, undo_edit |
| Create a new file | write_file |
| Refactor code | glob_search, read_file, edit_file, multi_edit |
| Run tests | bash |
| Research online | web_search, web_fetch |
| Code navigation | lsp |
| Track multi-step work | todo |
| Delegate subtask | task |
| Team collaboration | team_mail (+ team directives) |