Files
gogo2/tools-kiro.md
Dobromir Popov a86e07f556 tools
2025-10-09 13:58:43 +03:00

4.4 KiB

Kiro Tools Documentation

This document lists all the tools available to Kiro for assisting with development tasks.

File System Operations

executePwsh

Execute PowerShell or CMD commands on Windows systems.

  • Parameters: command (required), path (optional), ignoreWarning (optional)
  • Usage: Run shell commands, but avoid long-running processes like dev servers
  • Note: Never use 'cd' command - use path parameter instead

listDirectory

List directory contents in long format (similar to ls -la).

  • Parameters: path (required), depth (optional), explanation (required)
  • Usage: Explore file structure, can do recursive listing with depth parameter

readFile

Read content from a single file with optional line range specification.

  • Parameters: path (required), explanation (required), start_line (optional), end_line (optional)
  • Usage: Read entire files or specific line ranges

readMultipleFiles

Read content from multiple files simultaneously with optional line ranges.

  • Parameters: paths (required array), explanation (required), start_line (optional), end_line (optional)
  • Usage: Efficiently read multiple files at once

fsWrite

Create new files or overwrite existing files with content.

  • Parameters: path (required), text (required)
  • Usage: Create files, limit to ~50 lines then use fsAppend for larger content

fsAppend

Append text content to the end of existing files.

  • Parameters: path (required), text (required)
  • Usage: Add content to existing files, handles newline formatting automatically

deleteFile

Delete files at specified paths with graceful error handling.

  • Parameters: targetFile (required), explanation (required)
  • Usage: Remove unwanted files safely

strReplace

Replace specific text strings in files with exact matching.

  • Parameters: path (required), oldStr (required), newStr (required)
  • Usage: Make precise edits to existing files, requires exact whitespace matching

Search and Discovery

fileSearch

Fast fuzzy file search based on file path patterns.

  • Parameters: query (required), explanation (required), excludePattern (optional), includeIgnoredFiles (optional)
  • Usage: Find files when you know part of the path but not exact location

grepSearch

Fast text-based regex search within files using ripgrep.

  • Parameters: query (required), explanation (optional), caseSensitive (optional), includePattern (optional), excludePattern (optional)
  • Usage: Search for text patterns across files, supports regex and glob patterns

Code Analysis

getDiagnostics

Get compile, lint, type, and semantic issues in code files.

  • Parameters: paths (required array)
  • Usage: Check for syntax errors, linting issues, and type problems
  • Note: Use this instead of bash commands for error checking

Tool Usage Guidelines

Best Practices

  • Use readMultipleFiles instead of multiple readFile calls
  • Use getDiagnostics for code validation instead of shell commands
  • Avoid long-running commands like npm run dev, yarn start, webpack --watch
  • Use fsWrite for initial file creation, then fsAppend for additional content
  • Include sufficient context in strReplace operations for unique matching

Windows-Specific Notes

  • Commands are adapted for Windows cmd/PowerShell environment
  • Use ; as command separator in PowerShell instead of &&
  • File paths use Windows conventions

Search Patterns

  • Regex patterns: Use Rust regex syntax for grepSearch
  • Glob patterns: Use standard glob syntax (* for wildcards, ** for recursive)
  • File search: Fuzzy matching against file paths
  • Always escape special regex characters: ( ) [ ] { } + * ? ^ $ | . \

Error Handling

  • Tools fail gracefully with appropriate error messages
  • File operations check for existence and permissions
  • Search operations are capped to prevent overwhelming output

Integration with Kiro Features

These tools integrate with Kiro's key features:

  • Autopilot/Supervised modes: File modification tools respect user's autonomy settings
  • Chat context: Tools work with #File, #Folder, #Problems, #Terminal, #Git Diff, #Codebase
  • Specs: Tools support structured feature development workflows
  • Hooks: Tools can be triggered by IDE events
  • Steering: Tools respect workspace-specific guidelines in .kiro/steering/
  • MCP: Tools can interact with Model Context Protocol configurations