Skip to main content
Glama

analyze_pr

Read-onlyIdempotent

Assess a pull request's risk before submitting to an open-source repo by analyzing repo profile, anti-patterns, and success patterns; returns risk tier, signals, checklist, and recommended action.

Instructions

Detailed PR analysis with signals and checklist. Use analyze_pr for deep analysis, coach_pr for quick pass/fail.

Returns: tier (low_risk/medium_risk/high_risk), signals (positive/negative/neutral), checklist (P0/P1/P2 items), and recommended_action.

Use this before submitting a PR to a large open-source repo to check if your contribution strategy is sound. Combines repo profile data, anti-pattern matching, and success pattern analysis.

Args: title: PR title (e.g. "feat: add new search endpoint") repo: Target repo in org/name format (e.g. "encode/httpx") body: PR body/description text description: Extended description (optional) author: PR author username author_association: Author's association with repo (NONE/CONTRIBUTOR/COLLABORATOR/MEMBER/OWNER) labels: PR labels (e.g. ["bug", "documentation"]) star_count: Repository star count (>= 0; 0 = unknown) repo_merge_rate: Repository's external PR merge rate 0.0-1.0 (0 = unknown) mergeable: Mergeable state (MERGEABLE/CONFLICTING/UNKNOWN) diff_stat: git diff --stat output — populates impact/review and is the authoritative PR-size signal (null when omitted)

Returns: dict with keys: tier, signals, checklist, recommended_action, repo, title, impact, review (impact/review null without diff_stat)

Example: analyze_pr("fix: timeout in connection pool", "encode/httpx", "Fixes #123") → {"tier": "medium_risk", "signals": {...}, "checklist": [...], "recommended_action": "..."}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
bodyNo
repoYes
titleYes
authorNo
labelsNo
diff_statNo
mergeableNoMERGEABLE
star_countNo
descriptionNo
repo_merge_rateNo
author_associationNoNONE

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv2.1.4
  2. Removedv1.3.1
  3. First observedv0.1.0

TDQS

A4.6/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already establish readOnly/idempotent/non-destructive, and the description adds real behavior: it combines repo profile data, anti-pattern matching, and success pattern analysis, and discloses the exact response keys and the diff_stat dependency for impact/review. It stops short of noting limits such as cost, latency, or behavior on missing optional inputs.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loads purpose, alternative, and return shape before the Args list, which is well organized. The Args section partly restates the schema, but each entry adds format or default semantics that justify its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no output schema, the description supplies the return keys and the diff_stat caveat, plus an example call and response. For an 11-parameter read-only analysis tool this is nearly complete, though it does not describe how optional defaults (e.g. mergeable='MERGEABLE') affect results.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description carries the full burden and does it well: it defines formats and sentinel semantics for star_count (0 = unknown), repo_merge_rate (0.0-1.0, 0 = unknown), mergeable enum values, author_association enum values, labels as a string array, and flags diff_stat as the authoritative PR-size signal. This meaningfully exceeds the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb+resource (detailed PR analysis) and immediately differentiates from the sibling coach_pr by intent (deep analysis vs quick pass/fail). Also names what it produces: tier, signals, checklist, recommended_action.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly names the alternative (coach_pr) with the selecting condition, and gives a concrete when-to-use scenario: before submitting a PR to a large open-source repo. Nothing is left to inference.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.