You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: document git_diff_summary and batch_commit in v2.1.0
Add full parameter tables, JSON shapes, and error codes for both new
tools to mcp-tools.md. Update README to drop the "read-only" claim
now that batch_commit ships. Fix AGENTS.md implementation map: remove
unexported symbols (splitPresetFileRaw, getPresetEntry, realPathOrSelf,
uriToPath and friends), remove deleted MCP_JSON_FORMAT_VERSION constant,
add rows for git-diff-summary-tool.ts and batch-commit-tool.ts.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|[`src/server/presets.ts`](src/server/presets.ts)|`PRESET_FILE_PATH`, `splitPresetFileRaw`, `loadPresetsFromGitTop`, `getPresetEntry`, `presetLoadErrorPayload`, `applyPresetNestedRoots`, `applyPresetParityPairs`; Zod schemas must match [`git-mcp-presets.schema.json`](git-mcp-presets.schema.json)|
19
+
|[`src/server/roots.ts`](src/server/roots.ts)|`requireGitAndRoots` — sole public export; session root resolution|
20
+
|[`src/server/presets.ts`](src/server/presets.ts)|`PRESET_FILE_PATH`, `loadPresetsFromGitTop`, `presetLoadErrorPayload`, `applyPresetNestedRoots`, `applyPresetParityPairs`; Zod schemas must match [`git-mcp-presets.schema.json`](git-mcp-presets.schema.json)|
-**No banner paragraphs** in shipped docs. Use normal titles + cross-links.
35
-
-**`MCP_JSON_FORMAT_VERSION`** (currently `"2"`): bump on incompatible JSON changes (renamed/nested/omitted fields). Document migration here + [docs/mcp-tools.md](docs/mcp-tools.md). v2 removed the `rethunkGitMcp` envelope; payloads are minified; optional fields omitted when empty/null/false.
36
-
-**Preset file:** keep `splitPresetFileRaw` + Zod aligned with [`git-mcp-presets.schema.json`](git-mcp-presets.schema.json).
37
+
-**JSON format version** (currently `"2"`, discoverable via MCP `initialize`): bump on incompatible JSON changes (renamed/nested/omitted fields). Document migration here + [docs/mcp-tools.md](docs/mcp-tools.md). v2 removed the `rethunkGitMcp` envelope; payloads are minified; optional fields omitted when empty/null/false.
38
+
-**Preset file:** keep `presets.ts`Zod schemas aligned with [`git-mcp-presets.schema.json`](git-mcp-presets.schema.json).
Read-only **git** tools over MCP (status, multi-root inventory, `HEAD` parity, presets). **Install and MCP client wiring:****[docs/install.md](docs/install.md)** only — do not duplicate those steps elsewhere.
7
+
**git** tools over MCP: read-only status, multi-root inventory, `HEAD` parity, presets, structured diff viewer, and batch commit. **Install and MCP client wiring:****[docs/install.md](docs/install.md)** only — do not duplicate those steps elsewhere.
8
8
9
9
**Repository:**[github.com/Rethunk-AI/mcp-multi-root-git](https://github.com/Rethunk-AI/mcp-multi-root-git) · **npmjs (manual releases):**[`@rethunk/mcp-multi-root-git`](https://www.npmjs.com/package/@rethunk/mcp-multi-root-git) · **GitHub Packages (CI on each tag):**[`@rethunk-ai/mcp-multi-root-git`](https://github.com/Rethunk-AI/mcp-multi-root-git/packages) — see [docs/install.md](docs/install.md) and [HUMANS.md](HUMANS.md) Publishing.
Copy file name to clipboardExpand all lines: docs/mcp-tools.md
+94Lines changed: 94 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,6 +16,8 @@ MCP clients expose tools as `{serverName}_{toolName}`. With the server registere
16
16
|`git_parity`|`rethunk-git_git_parity`| Compare `git rev-parse HEAD` for path pairs. `pairs`, `preset`, `presetMerge`, `format`, plus workspace pick args. |
17
17
|`list_presets`|`rethunk-git_list_presets`| List preset names/counts from `.rethunk/git-mcp-presets.json`; invalid JSON/schema surface as errors. Workspace pick + `format` only. |
18
18
|`git_log`|`rethunk-git_git_log`| Path-filtered, time-windowed `git log` across one or more workspace roots. Returns commit history with author, date, subject, and shortstat. Args: `since`, `paths`, `grep`, `author`, `maxCommits`, `branch`, plus workspace pick args + `format`. |
19
+
|`git_diff_summary`|`rethunk-git_git_diff_summary`| Structured, token-efficient diff viewer. Returns per-file diffs with additions/deletions counts, truncated to configurable line limits, with lock files/dist/vendor excluded by default. Args: `range`, `fileFilter`, `maxLinesPerFile`, `maxFiles`, `excludePatterns`, plus workspace pick args + `format`. **Read-only.**|
20
+
|`batch_commit`|`rethunk-git_batch_commit`| Create multiple sequential git commits in a single call. Each entry stages the listed files then commits with the given message. Stops on first failure. Args: `commits` (array of `{message, files}`), plus workspace pick args + `format`. **Mutating — not idempotent.**|
19
21
20
22
Pass **`format: "json"`** on any tool for structured JSON instead of markdown (default).
21
23
@@ -98,6 +100,98 @@ v2 field-omission rules: `filesChanged`, `insertions`, `deletions` are omitted w
|`root_index_out_of_range`|`rootIndex` exceeds the number of MCP file roots. |
100
102
103
+
### `git_diff_summary` — parameters
104
+
105
+
| Parameter | Type | Default | Notes |
106
+
|-----------|------|---------|-------|
107
+
|`range`| string | unstaged | Diff range. `"staged"` / `"cached"` for index; `"HEAD"` for last commit; `"A..B"` or `"A...B"` for revision ranges; single ref. Default: unstaged working-tree changes. |
108
+
|`fileFilter`| string | — | Glob pattern to restrict output to matching files (e.g. `"*.ts"`, `"src/**"`). |
109
+
|`maxLinesPerFile`| int |`50`| Max diff lines to include per file (1–2000). |
110
+
|`maxFiles`| int |`30`| Max files to include in output (1–500). |
111
+
|`excludePatterns`| string[]| lock files, dist, vendor | Glob patterns to exclude. Defaults to `*.lock`, `*.lockb`, `bun.lock`, `package-lock.json`, `yarn.lock`, `pnpm-lock.yaml`, `*.min.js`, `*.min.css`, `vendor/**`, `node_modules/**`, `dist/**`. Pass an empty array to disable. |
"diff": "@@ -1,3 +1,8 @@\n-const x = 1;\n+const x = 2;"
131
+
}],
132
+
"truncatedFiles": 1,
133
+
"excludedFiles": ["yarn.lock"]
134
+
}
135
+
```
136
+
137
+
`status` is one of `"modified"`, `"added"`, `"deleted"`, `"renamed"`. `oldPath` is present only for renamed files. `truncatedFiles` and `excludedFiles` are omitted when zero/empty (v2 field-omission contract).
138
+
139
+
### `git_diff_summary` — error codes
140
+
141
+
| Code | Meaning |
142
+
|------|---------|
143
+
|`git_not_found`|`git` binary not on `PATH`. |
144
+
|`not_a_git_repository`| The resolved workspace root is not inside a git repository. |
145
+
|`unsafe_range_token`| The `range` string contains characters outside the safe token set. |
146
+
|`git_diff_failed`|`git diff` exited non-zero. |
147
+
148
+
---
149
+
150
+
### `batch_commit` — parameters
151
+
152
+
| Parameter | Type | Notes |
153
+
|-----------|------|-------|
154
+
|`commits`|`{message: string, files: string[]}[]`| Commits to create in order. 1–50 entries. Each `files` entry is a path relative to the git root; all must stay within the git toplevel. |
On first failure `ok` is `false`, `committed` reflects only the entries that succeeded before the error, and the failing entry includes `error` and `detail` fields. Remaining entries are skipped and not included in `results`.
0 commit comments