Overview
Tools are the building blocks that give AI agents their capabilities. Each tool is a discrete operation with:- Input Schema: Validated parameters using Zod
- Output Schema: Typed return values
- Execute Function: The implementation logic
Tool Categories
How Tools are Used
Agents autonomously decide which tools to use based on the task. For example, when asked to “fix the bug in auth.ts”, the Code Agent might:getStatus- Check repository statereadFile- Read auth.ts to understand the codeeditFile- Make the fixrunCommand- Run tests to verifystageFiles- Stage the changecreateCommit- Commit with a descriptive message
Git Operations Tools
These tools provide access to Git functionality for reading repository state, making changes, and managing branches.getStatus
Get the current status of the repository including staged, modified, and untracked files.string
Path to the repository. Defaults to current directory.
Example:
getDiff
Get the diff showing what has changed in the repository.boolean
default:false
If true, show only staged changes.
string[]
Specific files to show diff for. If not specified, shows all.
number
default:3
Number of context lines around changes.
Example:
stageFiles
Stage files for the next commit.string[]
required
Array of file paths to stage. Use
["."] to stage all files.
Example:
createCommit
Create a new commit with staged changes.string
required
The commit message describing the changes.
boolean
default:false
Stage all tracked modified files before committing (like
git commit -a).
Example:
getLog
Get the commit history.number
default:10
Maximum number of commits to return.
string
default:"HEAD"
Starting reference (branch, tag, or commit hash).
getBranches
List all branches in the repository. Input: None required Returns:switchBranch
Switch to a different branch.string
required
Name of the branch to switch to.
boolean
default:false
Create the branch if it doesn’t exist.
wit automatically saves uncommitted work when switching branches (auto-stash).
getMergeConflicts
Get information about current merge conflicts. Input: None required Returns:resolveConflict
Resolve a merge conflict by providing resolved content.string
required
Path to the conflicted file.
string
required
The resolved content to write.
boolean
default:true
Whether to mark the file as resolved.
undo
Undo the last operation(s) using wit’s journal.number
default:1
Number of operations to undo.
boolean
default:false
Preview what would be undone without actually undoing.
wit maintains a journal of all operations, making undo actually reliable unlike
git reflog.File System Tools
These tools allow agents to read, write, and navigate the repository file system.readFile
Read the contents of a file from the repository.string
required
Path to the file relative to repository root.
number
Start reading from this line (1-indexed).
number
Stop reading at this line (inclusive).
Example:
writeFile
Create a new file or overwrite an existing file.string
required
Path to the file relative to repository root.
string
required
Content to write to the file.
boolean
default:true
Create parent directories if they don’t exist.
Security:
- Cannot write to
.witor.gitdirectories - Cannot write outside the repository
editFile
Make targeted edits to existing files using search and replace.string
required
Path to the file relative to repository root.
Array
required
Array of edit operations to apply in order.
string
required
The exact text to find (must match exactly including whitespace).
string
required
The text to replace it with.
boolean
default:false
Validate edits without applying them.
Example:
listDirectory
List files and directories in the repository.string
default:"."
Directory path relative to repository root.
boolean
default:false
List subdirectories recursively.
number
default:3
Maximum depth for recursive listing (1-10).
Include hidden files (starting with .).
string
Filter by glob pattern (e.g.,
*.ts, src/**/*.js).runCommand
Execute shell commands with safety restrictions.string
required
The command to execute.
string[]
Command arguments as separate array items.
number
default:60000
Timeout in milliseconds (max 120000).
Record<string, string>
Additional environment variables.
Allowed Commands:
When sandbox is configured (E2B, Daytona, Docker, or Vercel), commands run in an isolated environment with fewer restrictions.
AI Generation Tools
These tools use AI to generate content like PR descriptions, code reviews, and release notes.generatePRDescription
Generate a pull request description from diff and commits.string
required
The diff content showing code changes.
Array
required
Commits included in the PR.
string
required
Commit message.
string
required
Commit SHA.
string
Optional title (generated if not provided).
string
Existing description to enhance.
reviewPR
Perform an AI-powered code review.string
required
The diff content to review.
Array
Full file contents for deeper analysis.
object
Additional context for the review.
string
Description of the repository.
string
Style guide to follow.
Checks Performed:
- SQL injection vulnerabilities
- Hardcoded secrets
- XSS risks
- Empty catch blocks
- Console.log statements
- Performance issues
- Code style
generateReleaseNotes
Generate release notes from commits between versions.string
required
The version being released (e.g., “v1.2.0”).
string
Previous version to compare against.
Array
required
Commits included in this release.
'standard' | 'detailed' | 'minimal' | 'changelog'
default:"standard"
Output style.
Search Tools
search
Search the repository for commits, files, and content.string
required
Search query (text pattern or regex).
boolean
default:true
Search in commit messages.
boolean
default:true
Search in file names.
boolean
default:true
Search in file contents.
boolean
default:false
Case-sensitive search.
number
default:20
Maximum results to return.
string
Glob pattern to filter files (e.g.,
*.ts).semanticSearch
Search the codebase using natural language queries.string
required
Natural language description (e.g., “function that handles user authentication”).
number
default:10
Maximum number of results.
number
Minimum similarity threshold (0-1).
string
Filter results to files matching this pattern.
string
Filter by programming language.
Example:
indexRepository
Index the repository for semantic search.boolean
default:false
Force reindex all files.
string[]
File patterns to include.
string[]
File patterns to exclude.
getIndexStatus
Get the status of the semantic search index. Input: None required Returns:Virtual Filesystem Tools
These tools work with an in-memory filesystem for the IDE and server-side operations. They allow editing files in bare repositories without a working directory.Virtual filesystem tools require a
sessionId parameter to identify the working session. Sessions are managed by the agent controller.virtualReadFile (vfs-read-file)
Read a file from the virtual filesystem.string
required
Session ID for the virtual repository.
string
required
Path to the file.
number
Start reading from this line.
number
Stop reading at this line.
virtualWriteFile (vfs-write-file)
Write a file to the virtual filesystem.string
required
Session ID for the virtual repository.
string
required
Path to the file.
string
required
Content to write.
boolean
default:true
Create parent directories.
virtualEditFile (vfs-edit-file)
Edit a file using search and replace.string
required
Session ID for the virtual repository.
string
required
Path to the file.
string
required
Text to find.
string
required
Text to replace with.
boolean
default:false
Replace all occurrences.
virtualListDirectory (vfs-list-directory)
List files in the virtual filesystem.string
required
Session ID for the virtual repository.
string
default:"."
Directory path.
boolean
default:false
List recursively.
Include hidden files.
virtualCommit (vfs-commit)
Commit changes from the virtual filesystem.string
required
Session ID for the virtual repository.
string
required
Commit message.
string
Author name.
string
Author email.
virtualStatus (vfs-status)
Get the status of changes in the virtual filesystem.string
required
Session ID for the virtual repository.
Tool Registry
Tools are organized into bundles for different use cases:witTools (Disk-based)
The main tool bundle for CLI and disk-based operations:virtualTools (In-memory)
Tools for the IDE and server-side operations:Creating Custom Tools
You can create custom tools to extend agent capabilities:Registering Custom Tools
Add your tool to an agent:Best Practices for Custom Tools
- Clear descriptions: The AI uses descriptions to decide which tool to use
- Validate inputs: Use Zod schemas thoroughly
- Handle errors gracefully: Return error messages, don’t throw
- Security first: Validate paths, sanitize inputs
- Consistent output: Always include
successand optionalerrorMessage - Idempotent when possible: Same inputs should produce same outputs
Example: Agent Tool Interaction
Here’s how an agent uses tools to complete a task:See Also
- AI Agents - Agent types and capabilities
- AI-Powered Features - AI commit messages and review
- Search - Semantic code search
- AI Workflows - Multi-step AI workflows