Skip to main content
Glama

explain_history

Read-only

Trace why a symbol or code range looks the way it does by returning authors, commit diffs, and linked pull request details; use it before rewriting odd code.

Instructions

Why code looks the way it does. Use this before removing or rewriting code that looks odd, or to answer "why is it like this?". Give a symbol, or a path with an optional line range. Returns who wrote the current lines, every commit that changed them (with the relevant diff), and the title and description of the pull request behind each commit (GitHub only).

Input Schema

NameRequiredDescriptionDefault
pathNoA file in the repo. Narrow it with start_line and end_line.
repoNoName of an indexed repo, as list_repos shows it. Leave out when only one repo is indexed.
symbolNoA function, class or method, e.g. "unsign" or "Signer.sign". Use this or path.
end_lineNoLast line of the range (with path).
start_lineNoFirst line of the range (with path).
max_commitsNoHow many commits to return, newest first.

Output Schema

NameRequiredDescriptionDefault
repoYes
symbolYes
changesYesCommits that changed these lines, newest first.
citationYes
authorshipYes
instructionsYes
pull_requestsYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed6 schema fields changedv0.2.1
    • addedInput schema / properties / end_line / description
      Added value: +"Last line of the range (with path)."
    • addedInput schema / properties / max_commits / description
      Added value: +"How many commits to return, newest first."
    • addedInput schema / properties / path / description
      Added value: +"A file in the repo. Narrow it with start_line and end_line."
    • addedInput schema / properties / repo / description
      Added value: +"Name of an indexed repo, as list_repos shows it. Leave out when only one repo is indexed."
    • addedInput schema / properties / start_line / description
      Added value: +"First line of the range (with path)."
    • addedInput schema / properties / symbol / description
      Added value: +"A function, class or method, e.g. \"unsign\" or \"Signer.sign\". Use this or path."
  2. First observedv0.2.0

TDQS

A4.1/5.0
Behavior4/5

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

Beyond the readOnlyHint/openWorldHint annotations, the description discloses the concrete payload (author of current lines, every commit that changed them with relevant diffs, and PR title/description) and flags a real caveat — PR metadata is GitHub-only. It does not explain behavior when both symbol and path are supplied, or when neither is, which is the remaining operational ambiguity.

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

Conciseness5/5

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

Three dense sentences with the motivation front-loaded, then usage, then inputs, then outputs. No filler and no repetition of schema text verbatim.

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 six optional parameters, an output schema present, and safety already covered by annotations, the description carries the right load: purpose, trigger, selector modes, and the GitHub caveat. Complete enough to call correctly; only the both-params/neither-param edge cases are unaddressed.

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

Parameters4/5

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

Schema coverage is 100%, so the baseline is 3, but the description adds meaning the schema only hints at: it frames symbol and path as mutually alternative selectors and makes the line range explicitly optional and subordinate to path. The GitHub-only qualifier is also the only place backend support is tied to the output content.

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

Purpose4/5

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

The description opens with a concrete framing ('Why code looks the way it does') and states both input modes (a symbol, or a path with an optional line range) plus the shape of the answer. It is clearly a blast-radius / provenance tool, distinguishable in spirit from search_history, but it never names that sibling or draws an explicit boundary against it.

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

Usage Guidelines4/5

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

Gives an explicit trigger scenario: use it before removing or rewriting code that looks odd, or when answering 'why is it like this?'. That is genuine when-to-use guidance. It stops short of exclusions or naming alternatives such as search_history or impact_of_change, so the agent must infer which history tool to pick.

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