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
| Category | Count | Purpose |
|---|---|---|
| Git Operations | 10 | Repository state and history |
| File System | 5 | Read, write, edit files |
| AI Generation | 4 | PR descriptions, reviews, release notes |
| Search | 3 | Pattern and semantic search |
| Virtual Filesystem | 6 | In-memory operations for IDE/server |
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.Path to the repository. Defaults to current directory.
| Field | Type | Description |
|---|---|---|
branch | string | null | Current branch name |
staged | string[] | Files staged for commit |
modified | string[] | Modified but not staged |
untracked | string[] | New untracked files |
deleted | string[] | Deleted files |
hasChanges | boolean | Whether any changes exist |
isClean | boolean | Whether working tree is clean |
getDiff
Get the diff showing what has changed in the repository.If true, show only staged changes.
Specific files to show diff for. If not specified, shows all.
Number of context lines around changes.
| Field | Type | Description |
|---|---|---|
diffs | Array | Per-file diff information |
diffs[].file | string | File path |
diffs[].additions | number | Lines added |
diffs[].deletions | number | Lines removed |
diffs[].content | string | Unified diff content |
totalAdditions | number | Total lines added |
totalDeletions | number | Total lines removed |
filesChanged | number | Number of files changed |
summary | string | Human-readable summary |
stageFiles
Stage files for the next commit.Array of file paths to stage. Use
["."] to stage all files.| Field | Type | Description |
|---|---|---|
success | boolean | Whether staging succeeded |
stagedFiles | string[] | Files that were staged |
message | string | Status message |
createCommit
Create a new commit with staged changes.The commit message describing the changes.
Stage all tracked modified files before committing (like
git commit -a).| Field | Type | Description |
|---|---|---|
success | boolean | Whether commit succeeded |
hash | string | Full commit hash |
shortHash | string | Short (8 char) hash |
branch | string | null | Branch name |
message | string | Status message |
filesCommitted | number | Number of files in commit |
getLog
Get the commit history.Maximum number of commits to return.
Starting reference (branch, tag, or commit hash).
| Field | Type | Description |
|---|---|---|
commits | Array | Array of commit objects |
commits[].hash | string | Full commit hash |
commits[].shortHash | string | Short hash |
commits[].message | string | Full message |
commits[].subject | string | First line of message |
commits[].author | string | Author name |
commits[].email | string | Author email |
commits[].date | string | ISO date string |
commits[].timestamp | number | Unix timestamp |
totalShown | number | Number of commits returned |
getBranches
List all branches in the repository. Input: None required Returns:| Field | Type | Description |
|---|---|---|
current | string | null | Current branch name |
branches | Array | List of branches |
branches[].name | string | Branch name |
branches[].isCurrent | boolean | Is this the current branch |
branches[].hash | string | Commit hash branch points to |
totalBranches | number | Total branch count |
switchBranch
Switch to a different branch.Name of the branch to switch to.
Create the branch if it doesn’t exist.
| Field | Type | Description |
|---|---|---|
success | boolean | Whether switch succeeded |
previousBranch | string | null | Branch we switched from |
currentBranch | string | Branch we switched to |
message | string | Status message |
wasCreated | boolean | Whether branch was newly created |
workSaved | boolean | Whether uncommitted work was auto-saved |
wit automatically saves uncommitted work when switching branches (auto-stash).
getMergeConflicts
Get information about current merge conflicts. Input: None required Returns:| Field | Type | Description |
|---|---|---|
inProgress | boolean | Whether merge is in progress |
sourceBranch | string | Branch being merged |
targetBranch | string | Branch being merged into |
conflicts | Array | Conflicting files with regions |
conflicts[].file | string | File path |
conflicts[].regions | Array | Conflict regions |
conflicts[].oursContent | string | Our version |
conflicts[].theirsContent | string | Their version |
resolved | string[] | Already resolved files |
unresolved | number | Count of unresolved conflicts |
resolveConflict
Resolve a merge conflict by providing resolved content.Path to the conflicted file.
The resolved content to write.
Whether to mark the file as resolved.
| Field | Type | Description |
|---|---|---|
success | boolean | Whether resolution succeeded |
message | string | Status message |
remainingConflicts | number | Conflicts still to resolve |
canComplete | boolean | Whether merge can be completed |
undo
Undo the last operation(s) using wit’s journal.Number of operations to undo.
Preview what would be undone without actually undoing.
| Field | Type | Description |
|---|---|---|
success | boolean | Whether undo succeeded |
undone | Array | Operations that were undone |
undone[].operation | string | Operation type |
undone[].description | string | What was done |
undone[].timestamp | number | When it was done |
message | string | Status message |
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.Path to the file relative to repository root.
Start reading from this line (1-indexed).
Stop reading at this line (inclusive).
| Field | Type | Description |
|---|---|---|
success | boolean | Whether read succeeded |
content | string | File content (or base64 for binary) |
isBinary | boolean | Whether file is binary |
lineCount | number | Total lines in file |
startLine | number | Actual start line returned |
endLine | number | Actual end line returned |
size | number | File size in bytes |
errorMessage | string | Error message if failed |
writeFile
Create a new file or overwrite an existing file.Path to the file relative to repository root.
Content to write to the file.
Create parent directories if they don’t exist.
| Field | Type | Description |
|---|---|---|
success | boolean | Whether write succeeded |
filePath | string | Path where file was written |
created | boolean | Whether this was a new file |
size | number | Size of written file in bytes |
message | string | Status message |
previousContent | string | Previous content (for undo) |
- Cannot write to
.witor.gitdirectories - Cannot write outside the repository
editFile
Make targeted edits to existing files using search and replace.Path to the file relative to repository root.
Array of edit operations to apply in order.
The exact text to find (must match exactly including whitespace).
The text to replace it with.
Validate edits without applying them.
| Field | Type | Description |
|---|---|---|
success | boolean | Whether all edits succeeded |
filePath | string | File that was edited |
editsApplied | number | Number of successful edits |
editResults | Array | Per-edit results |
editResults[].index | number | Edit index |
editResults[].applied | boolean | Whether edit was applied |
editResults[].errorMessage | string | Error if failed |
message | string | Status message |
diff | string | Preview of changes |
listDirectory
List files and directories in the repository.Directory path relative to repository root.
List subdirectories recursively.
Maximum depth for recursive listing (1-10).
Include hidden files (starting with .).
Filter by glob pattern (e.g.,
*.ts, src/**/*.js).| Field | Type | Description |
|---|---|---|
success | boolean | Whether listing succeeded |
path | string | Directory that was listed |
entries | Array | Directory entries |
entries[].name | string | File/directory name |
entries[].path | string | Relative path |
entries[].type | 'file' | 'directory' | Entry type |
entries[].size | number | File size (for files) |
totalFiles | number | Total file count |
totalDirectories | number | Total directory count |
truncated | boolean | Whether results were truncated |
runCommand
Execute shell commands with safety restrictions.The command to execute.
Command arguments as separate array items.
Timeout in milliseconds (max 120000).
Additional environment variables.
| Field | Type | Description |
|---|---|---|
success | boolean | Whether command succeeded |
exitCode | number | Process exit code |
stdout | string | Standard output |
stderr | string | Standard error |
errorMessage | string | Error message if failed |
timedOut | boolean | Whether command timed out |
truncated | boolean | Whether output was truncated |
duration | number | Execution time in ms |
sandbox | boolean | Whether ran in sandbox |
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.The diff content showing code changes.
Commits included in the PR.
Commit message.
Commit SHA.
Optional title (generated if not provided).
Existing description to enhance.
| Field | Type | Description |
|---|---|---|
title | string | PR title |
description | string | Full markdown description |
labels | string[] | Suggested labels |
summary | string | Brief summary |
changes | string[] | List of changes |
testPlan | string | Suggested test plan |
breakingChanges | string[] | Breaking changes if any |
reviewPR
Perform an AI-powered code review.The diff content to review.
Full file contents for deeper analysis.
Additional context for the review.
Description of the repository.
Style guide to follow.
| Field | Type | Description |
|---|---|---|
summary | string | Review summary |
issues | Array | Found issues |
issues[].severity | 'info' | 'warning' | 'error' | Issue severity |
issues[].file | string | File path |
issues[].line | number | Line number |
issues[].message | string | Issue description |
issues[].suggestion | string | Suggested fix |
suggestions | string[] | General suggestions |
securityConcerns | string[] | Security issues |
overallScore | number | Score 1-10 |
approved | boolean | Whether to approve |
- 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.The version being released (e.g., “v1.2.0”).
Previous version to compare against.
Commits included in this release.
Output style.
| Field | Type | Description |
|---|---|---|
version | string | Release version |
title | string | Release title |
body | string | Full markdown body |
categories.breaking | Array | Breaking changes |
categories.features | Array | New features |
categories.fixes | Array | Bug fixes |
categories.improvements | Array | Improvements |
categories.documentation | Array | Doc changes |
categories.dependencies | Array | Dependency updates |
contributors | string[] | Contributors |
stats | object | Statistics |
Search Tools
search
Search the repository for commits, files, and content.Search query (text pattern or regex).
Search in commit messages.
Search in file names.
Search in file contents.
Case-sensitive search.
Maximum results to return.
Glob pattern to filter files (e.g.,
*.ts).| Field | Type | Description |
|---|---|---|
commits | Array | Matching commits |
files | Array | Matching file names |
content | Array | Content matches with line numbers |
totalResults | number | Total matches |
searchTime | number | Time in ms |
semanticSearch
Search the codebase using natural language queries.Natural language description (e.g., “function that handles user authentication”).
Maximum number of results.
Minimum similarity threshold (0-1).
Filter results to files matching this pattern.
Filter by programming language.
| Field | Type | Description |
|---|---|---|
results | Array | Matching code chunks |
results[].path | string | File path |
results[].startLine | number | Start line |
results[].endLine | number | End line |
results[].content | string | Code content |
results[].score | number | Similarity score |
results[].chunkType | string | Type (function, class, etc.) |
results[].chunkName | string | Name if available |
results[].language | string | Programming language |
totalResults | number | Total matches |
query | string | Original query |
searchTime | number | Time in ms |
indexRepository
Index the repository for semantic search.Force reindex all files.
File patterns to include.
File patterns to exclude.
| Field | Type | Description |
|---|---|---|
filesIndexed | number | Files that were indexed |
filesSkipped | number | Files that were skipped |
chunksCreated | number | Code chunks created |
errorsCount | number | Indexing errors |
duration | number | Time in ms |
success | boolean | Whether indexing succeeded |
message | string | Status message |
getIndexStatus
Get the status of the semantic search index. Input: None required Returns:| Field | Type | Description |
|---|---|---|
vectorCount | number | Number of vectors |
fileCount | number | Number of indexed files |
dimensions | number | Vector dimensions |
lastUpdated | string | Last update time |
isReady | boolean | Whether index is ready |
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.Session ID for the virtual repository.
Path to the file.
Start reading from this line.
Stop reading at this line.
virtualWriteFile (vfs-write-file)
Write a file to the virtual filesystem.Session ID for the virtual repository.
Path to the file.
Content to write.
Create parent directories.
virtualEditFile (vfs-edit-file)
Edit a file using search and replace.Session ID for the virtual repository.
Path to the file.
Text to find.
Text to replace with.
Replace all occurrences.
virtualListDirectory (vfs-list-directory)
List files in the virtual filesystem.Session ID for the virtual repository.
Directory path.
List recursively.
Include hidden files.
virtualCommit (vfs-commit)
Commit changes from the virtual filesystem.Session ID for the virtual repository.
Commit message.
Author name.
Author email.
virtualStatus (vfs-status)
Get the status of changes in the virtual filesystem.Session ID for the virtual repository.
| Field | Type | Description |
|---|---|---|
success | boolean | Whether succeeded |
branch | string | Current branch |
changes | Array | Changed files |
changes[].path | string | File path |
changes[].status | 'added' | 'modified' | 'deleted' | 'untracked' | Change type |
hasChanges | boolean | Whether there are changes |
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