Skip to main content
Glama
jonmatum

Git Metrics MCP Server

by jonmatum

get_collaboration_metrics

Analyze team collaboration patterns in a git repository by specifying a date range to identify contribution distribution and teamwork dynamics.

Instructions

Analyze team collaboration patterns

Input Schema

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

Implementation Reference

  • The handler function `handleGetCollaborationMetrics` that executes the tool logic. It runs a git log command to find files modified by multiple authors, then computes pairwise collaboration counts (number of shared files between author pairs). Returns collaborative files count and top 10 collaborations.
    export function handleGetCollaborationMetrics(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>" --name-only`;
      
      const output = runGitCommand(repo_path, cmd);
      const lines = output.trim().split("\n");
      
      const fileAuthors: Record<string, Set<string>> = {};
      let currentAuthor = "";
      
      for (const line of lines) {
        if (line.includes("<") && line.includes(">")) {
          currentAuthor = line;
        } else if (line.trim() && currentAuthor) {
          if (!fileAuthors[line]) fileAuthors[line] = new Set();
          fileAuthors[line].add(currentAuthor);
        }
      }
      
      const collaborations: Record<string, number> = {};
      for (const authors of Object.values(fileAuthors)) {
        if (authors.size > 1) {
          const authorList = Array.from(authors).sort();
          for (let i = 0; i < authorList.length; i++) {
            for (let j = i + 1; j < authorList.length; j++) {
              const pair = `${authorList[i]} <-> ${authorList[j]}`;
              collaborations[pair] = (collaborations[pair] || 0) + 1;
            }
          }
        }
      }
      
      return {
        collaborativeFiles: Object.values(fileAuthors).filter(a => a.size > 1).length,
        topCollaborations: Object.entries(collaborations)
          .sort(([, a], [, b]) => b - a)
          .slice(0, 10)
          .map(([pair, sharedFiles]) => ({ pair, sharedFiles })),
      };
    }
  • Tool registration with input schema for `get_collaboration_metrics`. Defines name, description, and input parameters (repo_path, since, until) with required fields.
    {
      name: "get_collaboration_metrics",
      description: "Analyze team collaboration patterns",
      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"],
      },
    },
  • Routing of the tool request to the handler. When `get_collaboration_metrics` is called, it invokes `handlers.handleGetCollaborationMetrics(args)`.
    } else if (request.params.name === "get_collaboration_metrics") {
      result = handlers.handleGetCollaborationMetrics(args);
Behavior2/5

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

With no annotations provided, the description carries the full burden of disclosing behavior. It only states 'analyze' but does not specify whether it is read-only, what computations are performed, or what the response contains. Critical behavioral traits like resource usage or side effects are absent.

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

Conciseness2/5

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

The description is a single sentence with no wasted words, but it is under-specified. True conciseness balances brevity with sufficient information; here, the lack of detail makes it inadequate for agent understanding. The structure is minimal but not effective.

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?

Given the tool has 3 parameters, no output schema, and 10 sibling tools, the description is incomplete. It does not explain the output format, scope of analysis, or how it differs from similar tools. More context is needed for an agent to use it correctly.

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 coverage is 100%, with each parameter having a description (repo_path, since, until). The description adds no additional meaning beyond the schema. Since the schema already documents parameters clearly, a baseline score of 3 is appropriate.

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?

The description 'Analyze team collaboration patterns' provides a general verb ('analyze') and resource ('team collaboration patterns'), but lacks specificity. It does not differentiate from siblings like 'get_team_summary' or 'get_author_metrics', which could also analyze collaboration. The purpose is clear but vague.

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 is provided on when to use this tool versus alternatives. There is no mention of prerequisites, context, or exclusions. The single sentence implies use for analyzing collaboration, but without comparisons to sibling tools, the agent has no decision support.

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