introducing_pr
Identify the pull request that introduced a specific line in a file or a particular commit. Uses git blame and local merge commit data, with optional GitHub API fallback.
Instructions
Read-only. Find the pull request that introduced a line or a commit. First resolves the line to a commit via git blame, then reads the local merge-commit message; if that has no PR reference and GH_TOKEN/GITHUB_TOKEN is set, falls back to the GitHub REST API. Without a token the local path still works; pr is null when nothing can be resolved (e.g. rebase-merged with no PR ref). Provide either commit, or both file and line. May make one outbound GitHub API call (subject to the 5000/h authed rate limit).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Path inside the target git repo. Defaults to the server's current working directory. | |
| file | No | File path relative to the repo root. Requires `line`. | |
| line | No | 1-based line number in `file` to blame back to its introducing commit. | |
| commit | No | Commit SHA to look up directly. Use this instead of `file`/`line`. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pr | No | PR details when resolved, else null. | |
| author | No | ||
| commit | No | ||
| source | No | How the PR was resolved: `merge-message`, `github-api`, or `not-found`. | |
| commit_date | No | ||
| commit_message | No |