Skip to main content
Glama

search_history

Query Git commit history to understand changes, debug regressions, and find commit context. Search by keyword, file, or blame.

Instructions

USE THIS TOOL for Git history queries: understanding WHY changes were made, debugging regressions, or finding commit context. This tool operates on the local Git repository.

TRIGGER - Call this tool when the user asks:

  • "Why was this code changed?" / "Who changed this?"

  • "When was X introduced?" / "Find commits about X"

  • "Debug this regression" / "What broke this?"

  • "Show me the history of this file"

  • "Who wrote this line?" (blame)

  • "What changed in commit X?"

This tool does NOT require indexing - it queries Git directly.

WHEN TO USE EACH search_type:

  1. "commits" - USE WHEN:

    • User asks "find commits about X" or "search commit messages"

    • Query is a keyword or phrase to search in commit messages

    • Optionally set target_file to filter commits touching that file

    • Args: query (required), target_file (optional)

  2. "file_history" - USE WHEN:

    • User asks "show history of file X" or "what happened to this file?"

    • Shows commit log for a specific file (follows renames)

    • target_file is REQUIRED; query is ignored

    • Args: target_file (required)

  3. "blame" - USE WHEN:

    • User asks "who wrote this line?" or "who last modified this?"

    • Shows line-by-line commit attribution

    • target_file is REQUIRED; optionally limit to line range

    • Args: target_file (required), line_start/line_end (optional)

  4. "commit_detail" - USE WHEN:

    • User asks "show me commit X" or "what changed in this commit?"

    • Query is the commit hash (full or abbreviated)

    • Optionally set target_file to show only changes to that file

    • Args: query=commit_hash (required), target_file (optional)

Do NOT use this tool for:

  • Finding code definitions (use search_code)

  • Reading documentation (use search_docs)

  • Non-Git questions

Args: query: Search term for commits, or commit hash for commit_detail. directory: Path to the project directory (git repository). search_type: Must be exactly "commits", "file_history", "blame", or "commit_detail". target_file: File path (required for file_history and blame). line_start/line_end: Line range for blame (optional).

Returns: Varies by search_type. All include status and structured results.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYes
line_endNo
directoryYes
line_startNo
search_typeNocommits
target_fileNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

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

With no annotations, the description covers behavior thoroughly: operates on local Git repo, no indexing needed, explains each search type's behavior (e.g., blame shows line-by-line attribution, file_history follows renames). It does not contradict any annotations.

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?

The description is well-structured with clear sections (TRIGGER, WHEN TO USE EACH, DO NOT USE) and front-loaded purpose. While somewhat lengthy, each part adds value, and the format aids readability.

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

Completeness5/5

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

Given the tool has 4 search types and an output schema, the description covers all necessary aspects: usage scenarios, parameter roles, return variations. It is fully adequate for an agent to invoke correctly.

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?

Despite 0% schema coverage, the description adds rich meaning for each parameter per search type, including required/optional context, examples, and argument details. This far exceeds baseline.

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?

The description clearly states the tool is for Git history queries with specific verb and resource, and explicitly distinguishes from sibling tools (search_code, search_docs) by listing what not to use it for.

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?

Provides explicit triggers (e.g., 'Why was this code changed?') and detailed when-to-use guidance for each search_type, including when not to use and alternatives.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/kapillamba4/code-memory'

If you have feedback or need assistance with the MCP directory API, please join our Discord server