+ TOOL CALLS + REFERENCE_ +
++ Complete reference for all tool calls available in Zaguán Blade. + These are the standard tools you can add to your Local AI system prompts. +
+Overview
+ ++ This document describes the regular tool calls that Zaguán Blade supports. These are the tools you can add to your Local AI system prompts to extend usability. +
+ ++ 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 the complete contents of a file.
+ +Parameters
+path | string (required) | File path (relative to workspace or absolute) |
Example
+{ "path": "src/main.rs" }
+ Read a specific line range from a file with optional context.
+ +Parameters
+path | string (required) | File path |
start_line | integer (optional) | Start line (1-indexed, default: 1) |
end_line | integer (optional) | End line (1-indexed, default: end of file) |
context_lines | integer (optional) | Extra context lines before/after range (default: 0) |
Example
+{
+ "path": "src/lib.rs",
+ "start_line": 50,
+ "end_line": 100,
+ "context_lines": 3
+}
+ Write content to a file. Creates parent directories if needed.
+ +Parameters
+path | string (required) | File path |
content | string (required) | Content to write |
Example
+{
+ "path": "src/new_module.rs",
+ "content": "pub fn hello() {\n println!(\"Hello!\");\n}\n"
+}
+ Apply search/replace edits with robust fuzzy matching. Supports both single patches and atomic multi-patch operations.
+ +Single Patch Parameters
+path | string (required) | File path |
old_text | string (required) | Text to find and replace |
new_text | string (required) | Replacement text |
Single Patch Example
+{
+ "path": "src/lib.rs",
+ "old_text": "let x = 5;",
+ "new_text": "let x = 10;"
+}
+ Multi-Patch Example
+{
+ "path": "src/lib.rs",
+ "patches": [
+ {"old_text": "fn foo()", "new_text": "fn bar()"},
+ {"old_text": "let a = 1;", "new_text": "let a = 2;"}
+ ]
+}
+ Delete a file or directory.
+ +Parameters
+path | string (required) | Path to delete |
recursive | boolean (optional) | Required for directories (default: false) |
Move or rename a file.
+ +Parameters
+source | string (required) | Source path |
destination | string (required) | Destination path |
Copy a file or directory (recursive for directories).
+ +Parameters
+source | string (required) | Source path |
destination | string (required) | Destination path |
Get metadata about a file or directory.
+ +Parameters
+path | string (required) | Path to inspect |
Returns
+JSON with path, size, is_directory, is_file, modified, readonly
Create a directory (and parent directories if needed).
+ +Parameters
+path | string (required) | Directory path to create |
Directory & Search Tools
+ +List directory contents with tree view.
+ +Parameters
+path | string (optional) | Directory path (default: ".") |
max_depth | integer (optional) | Max traversal depth (default: 1) |
Get a tree view of the workspace structure.
+ +Parameters
+path | string (optional) | Starting path (default: ".") |
depth | integer (optional) | Max depth (default: 2) |
limit | integer (optional) | Max entries (default: 50, max: 200) |
Automatically ignores common directories like node_modules, target, .git, __pycache__, etc.
Find files using glob patterns.
+ +Parameters
+pattern | string (required) | Glob pattern (e.g., **/*.rs) |
path | string (optional) | Base path for search |
case_sensitive | boolean (optional) | Case-sensitive matching (default: false) |
Search file contents using regex patterns.
+ +Parameters
+pattern | string (required) | Regex pattern to search |
path | string (optional) | Directory to search (default: ".") |
Example
+{
+ "pattern": "fn\\s+main",
+ "path": "src"
+}
+ Returns
+Matches in format filepath:line_number:line_content
Search codebase with context lines around matches.
+ +Parameters
+query | string (required) | Regex pattern to search |
file_pattern | string (optional) | Filter files (e.g., *.rs,*.toml) |
max_results | integer (optional) | Maximum results (default: 50) |
Example
+{
+ "query": "struct.*Config",
+ "file_pattern": "*.rs",
+ "max_results": 20
+}
+ Editor Interaction Tools
+ +Get current editor context including active file, cursor position, and open files.
+ +Parameters
+None
+Returns
+JSON with: active_file, open_files, active_tab_index, cursor_line, cursor_column, selection_start_line, selection_end_line
Open a file in the editor.
+ +Parameters
+path | string (required) | File path to open |
line | integer (optional) | Line number to jump to |
Navigate to a specific line in the active file.
+ +Parameters
+line | integer (required) | Line number (1-indexed) |
column | integer (optional) | Column number |
Get the currently selected text in the editor.
+ +Parameters
+None
+Returns
+The selected text content.
+Replace the current selection with new content.
+ +Parameters
+content | string (required) | Replacement content |
Insert content at the current cursor position.
+ +Parameters
+content | string (required) | Content to insert |
Command Execution
+ +Execute a shell command (requires user approval).
+ +Parameters
+command | string (required) | Shell command to execute |
cwd | string (required) | Working directory |
Example
+{
+ "command": "cargo build --release",
+ "cwd": "."
+}
+ This tool requires user confirmation before execution for safety.
+Tool Result Handling
+ +Truncation
+Tool results are automatically truncated if they exceed limits:
+ +When truncated, the first 100 lines and last 50 lines are shown with a truncation message.
+Path Resolution
+ +All paths can be:
+ + + +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. Example format: +
+ +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:
+
+{"name": "tool_name", "arguments": {...}}
+
+ + The exact format depends on your AI provider's tool calling conventions. +
+