Git Tool Reference for the git default tool: git_status, git_diff, git_commit, git_log, and git_branch.
Script: powers/git.py
Dependencies: pydantic
Interact with Git repositories -- check status, view diffs, commit changes, browse history, and manage branches. All operations use the git CLI under the hood.
Get the current status of a Git repository, including staged, unstaged, and untracked files.
Field Type Default Description working_dirstr"."Path to the Git repository
Field Type Description okbooltrue if status was retrievedbranchstrCurrent branch name stagedlistFiles staged for commit: {file, status} unstagedlistModified but unstaged files: {file, status} untrackedlistUntracked file paths errorstrError message on failure
Status values: "modified", "added", "deleted", "renamed"
// Check status of current repo
{ "working_dir" : "." }
// Check a different repo
{ "working_dir" : "/path/to/repo" }
{
"ok" : true ,
"branch" : "feature/new-tool" ,
"staged" : [
{ "file" : "src/main.py" , "status" : "modified" }
],
"unstaged" : [
{ "file" : "README.md" , "status" : "modified" }
],
"untracked" : [ "new_file.py" ]
}
Show changes in a Git repository. Can show unstaged changes, staged changes, or diff against a specific ref.
Field Type Default Description working_dirstr"."Path to the Git repository stagedboolfalseShow staged (cached) changes instead of unstaged filestrnullLimit diff to a specific file refstrnullDiff against a specific ref (branch, tag, commit)
Field Type Description okbooltrue if diff was retrieveddiff_textstrFull diff output fileslistPer-file statistics: {path, additions, deletions} errorstrError message on failure
// Unstaged changes (default)
{ "working_dir" : "." }
// Staged changes
{ "staged" : true }
// Diff against main branch
{ "ref" : "main" }
// Diff for a specific file
{ "file" : "src/main.py" }
// Staged changes for one file
{ "staged" : true , "file" : "config.yaml" }
Create a Git commit. Can stage specific files or all changes before committing.
Field Type Default Description messagestrrequired Commit message fileslistnullSpecific files to stage and commit allboolfalseStage all changes before committing (git add -A) working_dirstr"."Path to the Git repository
Field Type Description okbooltrue if commit succeededhashstrFull commit hash messagestrCommit message used files_changedintNumber of files changed in the commit errorstrError message on failure
// Commit specific files
{ "message" : "Fix bug in parser" , "files" : [ "src/parser.py" , "tests/test_parser.py" ]}
// Commit all changes
{ "message" : "Update all configs" , "all" : true }
// Commit already-staged changes
{ "message" : "Add new feature" }
If files is provided, those files are staged (git add) before committing
If all is true, git add -A is run before committing
If neither files nor all is set, only already-staged changes are committed
Show the commit history of a Git repository.
Field Type Default Description nint10Number of commits to show refstrnullBranch, tag, or commit ref to start from working_dirstr"."Path to the Git repository
Field Type Description okbooltrue if log was retrievedcommitslistArray of commit objects (see below) errorstrError message on failure
Each commit object:
Field Type Description hashstrFull commit hash authorstrAuthor name datestrCommit date (ISO format) messagestrCommit subject line
// Last 5 commits
{ "n" : 5 }
// Last 20 commits on main
{ "n" : 20 , "ref" : "main" }
// History of a different repo
{ "working_dir" : "/path/to/repo" }
Manage Git branches -- list, create, switch, or delete.
Field Type Default Description actionstr"list"Action to perform: "list", "create", "switch", or "delete" namestrnullBranch name (required for create/switch/delete) working_dirstr"."Path to the Git repository
Field Type Description okbooltrue if operation succeededbrancheslistBranch list (for list action): {name, is_current, is_remote} currentstrCurrent branch name (after any action) errorstrError message on failure
// List all branches
{ "action" : "list" }
// Create and switch to new branch
{ "action" : "create" , "name" : "feature/new-thing" }
// Switch to existing branch
{ "action" : "switch" , "name" : "main" }
// Delete a branch
{ "action" : "delete" , "name" : "old-branch" }
create uses git checkout -b (creates and switches to the new branch)
delete uses git branch -d (safe delete -- fails if branch is not merged)
list includes both local and remote branches
Use git_status before git_commit to see exactly what will be committed
Use git_diff with staged: true to review staged changes before committing
Pair git_log with git_diff using a ref to see what changed between branches
All operations have a 30-second timeout to prevent hanging
These tools require git to be installed and the working directory to be inside a Git repository