Skip to main content
Glama
jonmatum

Git Metrics MCP Server

by jonmatum

get_author_metrics

Retrieve per-author git metrics including commit statistics and activity timelines within a date range to analyze individual contributions.

Instructions

Get detailed metrics per author

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_pathYesPath to git repository
sinceYesStart date (YYYY-MM-DD)
untilNoEnd date (YYYY-MM-DD), optional

Implementation Reference

  • Main handler for get_author_metrics. Parses git log output with numstat and author info, aggregating commits, additions, deletions, and files changed per author.
    export function handleGetAuthorMetrics(args: any) {
      const { repo_path, since, until } = args;
      
      validateRepoPath(repo_path);
      validateDate(since, "since");
      if (until) validateDate(until, "until");
      
      let cmd = `git log --since="${since}"`;
      if (until) cmd += ` --until="${until} 23:59:59"`;
      cmd += ` --pretty=format:"%an <%ae>" --numstat`;
    
      const output = runGitCommand(repo_path, cmd);
      const lines = output.trim().split("\n");
      
      const authors: Record<string, any> = {};
      let currentAuthor = "";
      
      for (const line of lines) {
        if (line.includes("<") && line.includes(">")) {
          currentAuthor = line;
          if (!authors[currentAuthor]) {
            authors[currentAuthor] = { commits: 0, additions: 0, deletions: 0, files: 0 };
          }
          authors[currentAuthor].commits++;
        } else if (line.match(/^\d+\s+\d+/) && currentAuthor) {
          const [add, del] = line.split(/\s+/);
          authors[currentAuthor].additions += parseInt(add) || 0;
          authors[currentAuthor].deletions += parseInt(del) || 0;
          authors[currentAuthor].files++;
        }
      }
      
      return authors;
    }
  • Input schema for get_author_metrics tool registration in the ListToolsRequestSchema handler.
    {
      name: "get_author_metrics",
      description: "Get detailed metrics per author",
      inputSchema: {
        type: "object",
        properties: {
          repo_path: { type: "string", description: "Path to git repository" },
          since: { type: "string", description: "Start date (YYYY-MM-DD)" },
          until: { type: "string", description: "End date (YYYY-MM-DD), optional" },
        },
        required: ["repo_path", "since"],
      },
    },
  • Dispatch/call-site where get_author_metrics is routed to the handler function.
    } else if (request.params.name === "get_author_metrics") {
      result = handlers.handleGetAuthorMetrics(args);
Behavior2/5

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

No annotations provided. Description does not disclose behavioral traits such as read-only nature, output format, or any limitations. For a read operation, it should at least indicate it is safe and does not modify data.

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?

Single sentence, no fluff. However, it is overly brief given the complexity; could add more detail without becoming verbose.

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

Completeness2/5

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

With no output schema and 10 sibling tools, the description is insufficient. It does not explain what 'detailed metrics' entails or provide context on the scope of the data returned.

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

Parameters3/5

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

Input schema covers all parameters with descriptions (100% coverage). Description adds no extra meaning beyond the schema, but baseline 3 is appropriate since schema already explains parameters.

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

Purpose3/5

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

Description states verb+resource ('Get detailed metrics per author') but is vague about what metrics are included. Does not differentiate from siblings like get_commit_stats or get_team_summary, which could overlap.

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

Usage Guidelines2/5

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

No guidance on when to use this tool vs alternatives. For example, it does not clarify the difference from get_collaboration_metrics or when to prefer this over other metric tools.

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/jonmatum/git-metrics-mcp-server'

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