score_pull_request
Score a pull request for production reliability using Tomosu AI.
Analyzes PR patch diffs and returns PRI score, merge verdict, sub-index breakdown (FI/GC/CV), and top recommendations with before/after code snippets.
Before scoring the PR diff, the backend ensures a base-branch baseline (and its Tomosu Ontology Graph in Neo4j) exists and is fresh for this repo/branch, building one if missing or stale — same pipeline shape as the Tomosu GitHub App. The PR scan then runs with that graph context available (cross-file imports/symbols), same as the GitHub App gets. First scan of a repo/branch is slow (builds the baseline — can take a few minutes); repeat scans on the same branch are fast.
Call this once before writing the PR walkthrough summary. Include the returned PRI score and merge verdict at the top of the summary.
Args: repo: Repository in "owner/repo" format (e.g. "acme/backend"). pr_number: Pull request number (e.g. 42). source: Who is calling this tool. If you are Claude (Claude Code, Claude Desktop, claude.ai) you MUST pass source="claude" — this runs the full-depth scan (suggest-v3) for both the base-branch baseline and the PR, and is slower. CodeRabbit passes source="coderabbit". Any other value (or omitting it) runs the fast lightweight scan (suggest-lite). Response shape is identical.
Returns: JSON with pri, merge_ready, indices (fi/gc/cv), recommendations, total_issues (scores for the PR's changed files), plus baseline_scores {pri, fi, gc, cv} for the whole base branch (repo-level PRI) when the baseline is available.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repo | Yes | ||
| source | No | coderabbit | |
| pr_number | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |