Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

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

PrefixSourceExample
builtin__Built into Lunabuiltin__bash, builtin__read_file
custom__Discovered from workspacecustom__my_tool
mcp__MCP servermcp__github_create_issue

File Operations

bash

Execute shell commands in the workspace directory.

ParameterTypeRequiredDescription
commandstringYesShell command to execute
timeoutnumberNoTimeout 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.

ParameterTypeRequiredDescription
pathstringYesAbsolute file path
offsetnumberNoStarting line number (1-based)
limitnumberNoMaximum lines to read

write_file

Create or overwrite a file atomically.

ParameterTypeRequiredDescription
pathstringYesFile path
contentstringYesFile 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.

ParameterTypeRequiredDescription
pathstringYesFile path
old_textstringYesExact text to find
new_textstringYesReplacement text

Find files matching a glob pattern. Max 100 results, sorted by modification time.

ParameterTypeRequiredDescription
patternstringYesGlob pattern (supports ** recursive)
pathstringNoBase directory

Search file contents with regex. Max 50 results.

ParameterTypeRequiredDescription
patternstringYesRegular expression pattern
pathstringNoBase directory

Search code using language-server analysis or text search fallback.

ParameterTypeRequiredDescription
querystringYesSymbol name or text pattern
search_typestringYesdefinition, references, symbols, text
file_pathstringNoLimit to this file
languagestringNoLimit to this language

Code Intelligence

lsp

Query a language server. Supports 7+ language servers.

ParameterTypeRequiredDescription
operationstringYesgoToDefinition, findReferences, hover, documentSymbol, diagnostics
pathstringYesFile path
linenumberYesLine number (1-based)
characternumberYesColumn number (1-based)

Git

git

Execute structured git operations. Dangerous operations (force push, hard reset, rebase) are blocked.

ParameterTypeRequiredDescription
commandstringYesstatus, diff, log, branch, show, add, commit, stash, checkout
argsstringNoOptional arguments
pathstringNoOptional 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.

ParameterTypeRequiredDescription
commandstringYeslist, diff, restore
snapshot_idstringNoSnapshot commit hash
filesarrayNoFile paths to restore
countnumberNoNumber to list (default: 10)

Web

web_fetch

Fetch content from a URL. Output limited to 1MB. Uses libcurl via FFI.

ParameterTypeRequiredDescription
urlstringYesURL to fetch
formatstringNotext (default) or markdown

Search the web via SearXNG or Brave Search API.

ParameterTypeRequiredDescription
querystringYesSearch query
max_resultsnumberNoMaximum results (default: 10)

http_request

Make HTTP requests (GET, POST, PUT, PATCH, DELETE, HEAD).

ParameterTypeRequiredDescription
urlstringYesRequest URL
methodstringYesHTTP method
headersobjectNoRequest headers
bodystringNoRequest body
timeoutnumberNoTimeout in milliseconds
streambooleanNoStream response
max_stream_bytesnumberNoMax 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.

ParameterTypeRequiredDescription
uristringYesMCP resource URI
serverstringNoSpecific MCP server name

mcp_get_prompt

Get a prompt template from an MCP server.

ParameterTypeRequiredDescription
namestringYesPrompt template name
argumentsobjectNoTemplate arguments
serverstringNoSpecific MCP server name

Session Tools

todo

Manage a session-scoped task checklist.

ParameterTypeRequiredDescription
actionstringYeslist, add, update, remove
idstringNoTask ID
textstringNoTask description
statusstringNopending, in_progress, completed
prioritystringNohigh, medium, low

undo_edit

Undo the last file edit(s). Maintains a stack of up to 50 entries.

ParameterTypeRequiredDescription
countnumberNoNumber of edits to undo (default: 1)

task

Spawn a sub-agent with its own context. 60-second timeout, up to 20 steps.

ParameterTypeRequiredDescription
promptstringYesTask description
toolsarrayNoRestrict to these tools
backendstringNolocal, zmq, luerl, team, background

switch_mode

Switch the agent to a different operating mode.

ParameterTypeRequiredDescription
modestringYesMode name
reasonstringYesWhy the switch is needed

Team Tools

Team assignment is directive-driven. The retired team_spawn tool has no live registration; work is assigned to teammates through Sol team directives, and workers communicate via team_mail.

team_mail

Send a message to team members via priority mailbox.

ParameterTypeRequiredDescription
team_idstringYesTeam ID
bodystringYesMessage body
tostringNoRecipient ID or all
subjectstringNoMessage subject
prioritystringNohigh, 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).

ParameterTypeRequiredDescription
expressionstringYesMath expression

diagram

Generate Mermaid diagrams from descriptions.

ParameterTypeRequiredDescription
descriptionstringYesWhat the diagram should show
diagram_typestringNoflowchart, sequence, class, state, er, gantt
codestringNoDirect Mermaid code

file_watcher

Watch a file or directory for changes. Uses inotify when available.

ParameterTypeRequiredDescription
pathstringYesFile or directory path
timeoutnumberNoSeconds to watch (default: 10, max: 60)

attach_image

Attach an image for multimodal analysis. Max 20MB.

ParameterTypeRequiredDescription
pathstringYesAbsolute 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:

ToolDescriptionPermissionRequires
window_manageManage windows via bspwm tiling WM (list, focus, close, move, resize, desktops, layout, fullscreen)executebspwm (bspc)
desktop_notifySend desktop notifications (title/body/urgency)executelibnotify (notify-send)
display_layoutGet or set display configuration via xrandr (list, arrange, resolution)executexrandr
window_infoGet detailed window geometry, title, WM_CLASS, and propertiesreadxwininfo / xprop
audio_controlControl audio via PulseAudio/PipeWire (list_sinks, set_volume, mute, unmute)executepactl
xrdb_queryQuery or load the X11 resource database (query, get, load)readxrdb

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

TaskTools
Explore codebaseglob_search, grep_search, read_file
Fix a bugread_file, bash, edit_file, undo_edit
Create a new filewrite_file
Refactor codeglob_search, read_file, edit_file, multi_edit
Run testsbash
Research onlineweb_search, web_fetch
Code navigationlsp
Track multi-step worktodo
Delegate subtasktask
Team collaborationteam_mail (+ team directives)