Skip to content

Tools

Luna provides 45 built-in tools, 14 computer use tools, and 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: 120000)

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

fuzzy_edit

Fuzzy search and replace, tolerant of whitespace differences. Uses multi-strategy matching: exact, strip-whitespace, normalize-indent, fuzzy-line.

ParameterTypeRequiredDescription
pathstringYesFile path
old_textstringYesText to find (fuzzy matched)
new_textstringYesReplacement text

multi_edit

Edit multiple files atomically. If any edit fails, all changes roll back.

ParameterTypeRequiredDescription
editsarrayYesArray of {file_path, old_string, new_string} objects

list_directory

List directory contents. Returns file names, types, and sizes.

ParameterTypeRequiredDescription
pathstringYesDirectory path

create_directory

Create a directory recursively (like mkdir -p).

ParameterTypeRequiredDescription
pathstringYesDirectory path

delete_file

Delete a file or empty directory. Non-empty directories are not deleted.

ParameterTypeRequiredDescription
pathstringYesPath to delete

notebook

Read and edit Jupyter notebook cells (.ipynb files).

ParameterTypeRequiredDescription
commandstringYeslist_cells, read_cell, edit_cell, add_cell
file_pathstringYesPath to .ipynb
cell_indexnumberNoCell index (0-based)
contentstringNoCell content
cell_typestringNocode or markdown

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.

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

switch_mode

Switch the agent to a different operating mode.

ParameterTypeRequiredDescription
modestringYesMode name
reasonstringYesWhy the switch is needed

Search and retrieve full tool schemas by name or description.

ParameterTypeRequiredDescription
querystringYesPartial tool name or keyword

Team Tools

team_spawn

Spawn a teammate agent for collaborative work. Requires ZMQ connection to Sol.

ParameterTypeRequiredDescription
team_idstringYesTeam ID
modestringNoAgent mode (default: build)
promptstringNoInitial task assignment

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.

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

Computer Use Tools

14 desktop automation tools registered when a display server (X11 or Wayland) is detected:

ToolDescriptionPermission
screenshotCapture screenshotexecute
mouse_moveMove cursor to coordinatesexecute
mouse_clickClick mouse buttonexecute
mouse_dragDrag from start to endexecute
type_textType text at cursorexecute
press_keyPress key combinationexecute
scrollScroll up or downexecute
get_cursorGet cursor positionread
display_infoScreen resolution and display inforead
window_listList all visible windowsread
clipboard_readRead clipboard contentsread
clipboard_writeWrite text to clipboardwrite
window_managebspwm window managementexecute
desktop_notifySend desktop notificationexecute

All computer use 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_spawn, team_mail

Released under the MIT License.