// TOOL_CALLS.md

TOOL CALLS REFERENCE_

Reference for the regular tool calls that Zaguán Blade supports. Add these to your Local AI system prompts to extend usability with 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

Example

{ "path": "Cargo.toml" }
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

Tool results are automatically truncated if they exceed limits:

50KB Max size
2000 Max lines

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

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 text
You have access to the following tools:

- read_file: Read file contents. Args: {"path": "string"}
- write_file: Write to file. Args: {"path": "string", "content": "string"}
- grep_search: Search with regex. Args: {"pattern": "string", "path": "string"}
- apply_edit: Edit file. Args: {"path": "string", "old_text": "string", "new_text": "string"}
...

To use a tool, respond with:
<tool_call>
{"name": "tool_name", "arguments": {...}}
</tool_call>

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