// TOOL_CALLS.md

TOOL CALLS REFERENCE_

Complete reference for all tool calls available in Zaguán Blade. Add these to your Local AI system prompts to enable file operations, search, editor control, and command execution.

NOTE This does not cover Blade-specific or ZLP (Zaguán Language Protocol) tools. These are standard file/editor tools for general AI coding assistance.

File Operations

read_file READ

Read the complete contents of a file.

Aliases: file_path, filepath, filename

Parameters

NameTypeDescription
pathrequired stringFile path (relative to workspace or absolute)

Example

{ "path": "src/main.rs" }
read_file_range READ

Read a specific line range from a file with optional context.

Parameters

NameTypeDescription
pathrequired stringFile path
start_lineoptional integerStart line (1-indexed, default: 1)
end_lineoptional integerEnd line (1-indexed, default: end of file)
context_linesoptional integerExtra context lines before/after range (default: 0)

Example

{
  "path": "src/lib.rs",
  "start_line": 50,
  "end_line": 100,
  "context_lines": 3
}
write_file / create_file WRITE

Write content to a file. Creates parent directories if needed.

Content aliases: contents, text, data

Parameters

NameTypeDescription
pathrequired stringFile path
contentrequired stringContent to write

Example

{
  "path": "src/new_module.rs",
  "content": "pub fn hello() {\n    println!(\"Hello!\");\n}\n"
}
edit_file EDIT LEGACY

Apply a search/replace edit to a file (legacy tool).

Aliases: old/from for old_content, new/to for new_content

Parameters

NameTypeDescription
pathrequired stringFile path
old_contentrequired stringText to find
new_contentrequired stringReplacement text

Example

{
  "path": "src/main.rs",
  "old_content": "fn old_function()",
  "new_content": "fn new_function()"
}
delete_file DELETE

Delete a file or directory.

Parameters

NameTypeDescription
pathrequired stringPath to delete
recursiveoptional booleanRequired for directories (default: false)

Example

{ "path": "temp/old_file.txt" }
move_file MOVE

Move or rename a file.

Parameters

NameTypeDescription
sourcerequired stringSource path
destinationrequired stringDestination path

Example

{
  "source": "src/old_name.rs",
  "destination": "src/new_name.rs"
}
copy_file COPY

Copy a file or directory (recursive for directories).

Parameters

NameTypeDescription
sourcerequired stringSource path
destinationrequired stringDestination path

Example

{
  "source": "templates/base.html",
  "destination": "src/templates/base.html"
}
get_file_info INFO

Get metadata about a file or directory.

Parameters

NameTypeDescription
pathrequired stringPath to inspect

Returns

path size is_directory is_file modified readonly
create_directory CREATE

Create a directory (and parent directories if needed).

Parameters

NameTypeDescription
pathrequired stringDirectory path to create

Example

{ "path": "src/modules/new_feature" }

Editor Interaction Tools

open_file CONTROL

Open a file in the editor.

Parameters

NameTypeDescription
pathrequired stringFile path to open
lineoptional integerLine number to jump to

Example

{
  "path": "src/main.rs",
  "line": 42
}
goto_line CONTROL

Navigate to a specific line in the active file.

Parameters

NameTypeDescription
linerequired integerLine number (1-indexed)
columnoptional integerColumn number

Example

{
  "line": 100,
  "column": 15
}
get_selection SELECTION

Get the currently selected text in the editor.

Parameters

None

Returns

The selected text content.

replace_selection EDIT

Replace the current selection with new content.

Parameters

NameTypeDescription
contentrequired stringReplacement content

Example

{ "content": "new replacement text" }
insert_at_cursor EDIT

Insert content at the current cursor position.

Parameters

NameTypeDescription
contentrequired stringContent to insert

Example

{ "content": "// TODO: implement this\n" }

Command Execution

Tool Result Handling

The 50KB / 2000 line limits apply only to tool results - what zblade sends back to the model after executing a tool (e.g., the output of read_file). These limits only apply in local mode, when the Zaguán Coder Daemon isn't handling storage.

50KB Result max size
2000 Result max lines

When truncated, the first 100 lines and last 50 lines are shown with a truncation message.

There are no size limits on incoming tool calls from the model. zblade will accept a write_file with any size content. The write_file handler itself has no caps - it writes whatever content string it receives directly to disk.

ℹ️

zblade includes dropped tool call detection. If a tool call from the model never arrives (e.g., streaming progress events complete but the final tool call with arguments is dropped server-side), zblade will catch this and surface a clear error.

Path Resolution

All paths can be:

Relative Resolved from workspace root (e.g., src/main.rs)
Absolute Used as-is (must be within workspace)
⚠️

Paths outside the workspace are rejected for security.

Adding Tools to Your AI System Prompt

To use these tools with a local AI, include the tool definitions in your system prompt. See the Local AI System Prompts section for setup instructions.

Example System Prompt Snippet markdown
# Available Tools

**get_workspace_structure** - Get project directory tree
**list_dir** - List files/directories in a path
**read_file** - Read file contents
**write_file** - Create or overwrite a file
**apply_patch** - Replace specific content in a file (for edits)
**grep_search** - Search for patterns across files
**run_command** - Execute shell commands (use cwd parameter)
**get_editor_state** - Get currently open file and cursor position

The exact format depends on your AI provider's tool calling conventions.