MCP tools
What your agent can do in a GitDB repository over MCP, grouped by task.
GitDB serves 56 MCP tools: 38 standard tools included on every plan, and 18 premium tools for the paid plans. When your agent connects, GitDB sends it the list of tools it can use and a description of each, so there's nothing to set up per tool. This page is a quick reference to the standard tools and what each one does for you.
A few rules apply to every tool:
- Tools work on the repository your connection names. See Connect your AI agent.
- Every tool is standard or premium — the Class column in each table below, explained under Tool classes. On a paid plan, standard tools are unmetered and each premium call counts as one premium op against your premium allowance for the current 5-hour window. On the free plan, each standard call uses one of your fast calls for the window, then standard tools run at reduced speed. The window is your organization's on an individual plan, your own seat's on Team and Enterprise. See Connect your AI agent.
- Tools that change the repository or save memories need a token with the
repo:writescope and an organization role that can write.
How tools answer
Tools that read — search, read, list, log, diff, status — answer plain text by default: the result itself (for example one @<path> <start>-<end>/<total_lines> header and the file's lines, or one line per match, file, or commit), then, when there's more to say, one empty line followed by lines like next: {...} or truncated: true, each a name and a JSON value. An empty result is one line in parentheses, such as (no matches). Pass view: "json" to any of these tools for the answer as one JSON object instead.
When an answer carries next, call the same tool again with the JSON after next: as its arguments, unchanged, to get the next page. Tools that change something answer JSON, and an error is always a JSON object with error (and code when it has one). Inside gitdb_batch, a text answer comes back as a JSON string.
Tool classes
Every tool is standard or premium. The 38 standard tools — the Git, file, grep, staging, and commit tools in the tables below — are included on every plan. The 18 premium tools cover AST code intelligence, semantic search, and code-aware agent memory: they come with the paid plans, and on the free plan agent-ops credits unlock the AST tools (1 credit per call), so your agent still sees those in its tool list. Semantic search and agent memory need the Pro trial or a paid plan.
Every other tool is standard. gitdb_grep is standard, except that a call with enclosing: true counts as a premium (AST) call. gitdb_batch, which runs up to 10 independent tool calls in one request, in order, is standard and is never counted itself: each call inside it counts as its own tool. A later read, grep, or file listing in the batch sees the earlier calls' staged edits (the AST tools read committed code), and a failed call doesn't stop the rest; more than 10 calls, a nested gitdb_batch, or a tool your agent's role may not call refuses the whole batch before anything runs. On the free plan, if one call inside a batch is answered with QUOTA_THROTTLED, that call's entry is an error and the rest of the batch still runs.
Search and read code
| Tool | Class | What it does |
|---|---|---|
gitdb_grep | Standard | Searches file contents with a regular expression (fixed_strings: true for a literal), keeping files that match include_globs and dropping those that match exclude_globs. A glob without / matches the file name at any depth (*.ts is **/*.ts). Returns up to max_results matches (default 100; more than 500 is treated as 500); when there are more, the answer has has_more: true and a next to resume from. With enclosing: true, each match also names the innermost symbol it sits in, from the AST index of the last indexed commit, and the call counts as a premium (AST) call — its next keeps enclosing: true. |
gitdb_find_files | Standard | Finds files whose paths match a glob, with gitdb_grep's glob rules. Returns up to max_results files (default 200; more than 1,000 is treated as 1,000); past that the answer says truncated: true and how many were left out. |
gitdb_ls_dir | Standard | Lists a directory (path, default the repository root) at ref_name (default HEAD). A path that is a file or doesn't exist answers not_found. |
gitdb_read_lines | Standard | Reads a range of lines from a file, up to 500 lines per call; a clipped window comes with a next for the rest. For several ranges or files, use gitdb_read_many. |
gitdb_read_many | Standard | Reads up to 50 line ranges, from one file or many, in one call (ranges: a list of path, start, end), all at one branch. Up to 500 lines per range and 2,000 lines per call. A range that fails returns its own error entry while the others still answer; no ranges or more than 50 is bad_request, and an unknown branch is not_found. For one range you want to resume with next, use gitdb_read_lines. |
gitdb_list_repos | Standard | Shows details of the repository the connection is working on. |
History and branches
| Tool | Class | What it does |
|---|---|---|
gitdb_git_log | Standard | Shows recent commits from the branch, tag, or commit in ref_name (default HEAD), optionally filtered by author. n is 1 to 1,000 commits (default 20); more than 1,000 is refused with bad_request. |
gitdb_git_show | Standard | Shows one commit — its tree, parents, author, and message — and each file it changed against its first parent, as added, modified, or deleted. It doesn't include the patch: for that, diff the parent to the commit with gitdb_git_diff. An unknown commit answers not_found. |
gitdb_blame | Standard | Shows which commit last changed each line of a file (path), at the branch, tag, or commit in ref_name (default HEAD). Pass start_line and end_line together to blame only those lines. It's refused with blame_budget_exceeded when any version of the file is over 1 MiB, or when the window is over 10,000 lines or has too deep a history — ask for a narrower range. |
gitdb_git_diff | Standard | Shows the diff between two commits or refs as a unified diff, one page at a time: up to 50 files and 2,000 diff lines per call, with next for the rest. Binary files are marked rather than diffed, a file side over 1 MiB is listed without a textual diff, and a file's diff past 500 lines is cut — read the rest with gitdb_read_lines. Asking for an unpaged diff (bounded: false) is refused with GIT_DIFF_UNBOUNDED_UNSUPPORTED. |
gitdb_git_status | Standard | Lists the files that changed between two refs, from from_ref (default HEAD) to to_ref. |
gitdb_list_refs | Standard | Lists branches and tags. |
gitdb_check_status | Standard | Shows CI and check results for a commit (commit_sha), or for a pull request's latest commit (number, used instead of commit_sha when both are given; an unknown pull request is not_found). commit_sha is taken as given, never resolved, so an unknown SHA answers (no checks). Refused on a public-read credential. |
gitdb_create_branch | Standard | Creates branch name at from — a branch, tag, or commit SHA (default HEAD). A name that already exists is refused, so repeating the call doesn't succeed twice. |
gitdb_create_tag | Standard | Tags a commit; commit can be a branch, tag, or SHA. A tag name that already exists is refused — tags never move. |
gitdb_merge_branches | Standard | Merges source_branch into target_branch and commits right away, with no staging step. The answer's status is success (a merge commit), fast_forward, already_up_to_date, or conflicts with the conflicting files — a conflicts answer is not an error, and nothing is written. A protected target, or a repository that requires reviews, is refused with forbidden — use a pull request. ref_contention means retry. |
gitdb_create_pr | Standard | Opens a pull request from branch into the repository's default branch, with a title and body. It's a real pull request: it gets the next pull request number and shows up on the repository's Pull requests page. The answer includes the pull request's pr_number and url, the link to its page on GitDB. In a GitHub-synced repository your commits are on your work branch gitdb/<your id> (gitdb_commit's ref_name), so open the pull request from that branch. A token without a verified identity is refused with forbidden. |
gitdb_revert_commit | Standard | Undoes the last commit of a branch by making a new commit that restores its parent's tree; history isn't rewritten. commit must be the full 40-character SHA of the branch's tip. For a merge commit, pass mainline, the 1-based parent to restore; the merged commits stay in history, so to land that branch again, revert the revert. Protected branches and repositories that require reviews refuse it — use a pull request. In a GitHub-synced repository the revert goes to your work branch gitdb/<your id> (the reply's ref_name). Your staged changes aren't touched. If the call times out, check gitdb_git_log before retrying. |
Stage and commit changes
File changes are staged first and written to a branch only when your agent commits. Staged changes stay saved on GitDB until they're committed or discarded, so they survive a dropped connection.
| Tool | Class | What it does |
|---|---|---|
gitdb_create_file | Standard | Stages a new file. It never overwrites: a path that already exists, or that's already staged, is refused — to create or replace a whole file, use gitdb_write_file. |
gitdb_write_file | Standard | Stages a whole file: creates path if it doesn't exist, or replaces its entire content if it does. content is the complete new file, up to 1 MiB of UTF-8 text. It replaces any earlier staged change to that path, keeps the file's mode (executable bit, symlink) at commit, and refuses a path that is a directory or a submodule. |
gitdb_delete_file | Standard | Stages a file deletion. A file that exists only in your staged changes (a staged new file, say) is dropped from staging instead, answered as dropped_staged. A directory is refused with is_a_directory — use gitdb_delete_dir; a missing file is not_found. |
gitdb_mkdir | Standard | Creates a directory by staging an empty <path>/.gitkeep file (Git doesn't store empty directories). Refused if path already exists. |
gitdb_rmdir | Standard | Stages the removal of an empty directory — one that holds nothing but its .gitkeep. Refused if the directory holds other files — use gitdb_delete_dir for that. |
gitdb_delete_dir | Standard | Stages the deletion of a directory and everything under it in one step. Files that exist only in your staged changes are unstaged. Nothing is staged if it's refused; a directory with too many paths is refused with too_many_paths, so delete narrower directories. |
gitdb_list_staged | Standard | Lists the changes staged on a branch (default the repository's default branch). Each change carries an updated_ns_str stamp; pass it to gitdb_commit paths to commit only the changes you pick. |
gitdb_unstage | Standard | Drops one staged change without committing it; if nothing is staged at that path, it still succeeds. The two halves of a staged move go together: unstaging one half alone is refused, and gitdb_discard_all removes both. |
gitdb_discard_all | Standard | Drops every staged change on a branch without committing. |
gitdb_stash | Standard | Sets staged changes aside and brings them back later. op is push (moves all staged changes on branch into a new stash, optionally labelled with name), list, apply (restores a stash and keeps it), pop (restores it and deletes it), or drop (deletes it); apply, pop, and drop take the stash_id from push or list. A stash applies only to the branch it was pushed from. If a path in the stash is already staged, apply and pop are refused with stash_conflict and the stash is kept. If a push times out, check op: "list" before retrying. |
gitdb_scan_secrets | Standard | Checks the content you pass for leaked secrets before you commit it; nothing stored in the repository is read, and file_path only labels the findings. Each finding is block or warn severity, and blocked is true when any finding is block. Refused on a public-read credential. |
gitdb_commit | Standard | Commits the staged changes to branch, the default branch unless you name another. To commit only some of them, pass paths: a list of path and expected_updated_ns_str, the stamp gitdb_list_staged shows — a stale stamp is refused with staging_changed, so list again. If the changes were staged under a different branch, name it in staging_branch; a file's content can only be committed to the branch it was staged on (provenance_mismatch otherwise). In a GitHub-synced repository, commits go to your work branch gitdb/<your id> (the reply's ref_name). Over 10,000 changes or 64 MiB is refused with commit_too_large — split it with paths. A refusal commits nothing; staging_clear_failed is the exception that did commit, with some changes still staged. If the call times out, check gitdb_git_log and gitdb_list_staged before retrying. |