code_changelog
code_changelog returns the commit history for a named function — not the entire file. It filters the git log to only commits that touched the function’s body, giving a precise history of when and why that specific logic changed.
code_changelog(name="PaymentService.charge")code_changelog(name="AuthService.validate", limit=10)Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
name | string | required | Function or method name |
file | string | — | File path hint if the name is ambiguous |
limit | number | 5 | Max commits to return |
Output
Section titled “Output”PaymentService.charge — 3 commits
2024-11-12 alice "add idempotency key to prevent double charges"2024-09-03 bob "increase timeout for slow card networks"2024-07-18 alice "initial payment integration"When to use
Section titled “When to use”- Understand why a function was written the way it is
- Find who last changed a function before a bug appeared
- See the evolution of business logic over time
Difference from git log
Section titled “Difference from git log”| Tool | Scope |
|---|---|
git log src/services/payment.ts | Every commit that touched any line in the file |
code_changelog(name="charge") | Only commits that touched this function’s body |
Function-level history is far more precise — a file may have dozens of commits, but only a few touch the function you care about.