Skip to main content
Glama

analyze_commit

Identify behavioral change risks in .NET commits by analyzing the HEAD commit with adjustable sensitivity. Returns structured findings for targeted review.

Instructions

Run GauntletCI behavioral change risk analysis on the current HEAD commit in a .NET repository. Returns findings as structured text.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workingDirectoryYesAbsolute path to the .NET repository root.
sensitivityNoRisk sensitivity filter. Default: balanced.balanced

Implementation Reference

  • The handler for the analyze_commit tool: runs GauntletCI in JSON mode, parses the output, and formats findings as text via formatFindingsAsText().
    if (name === "analyze_commit") {
      const { output, exitCode } = runGauntletCI(workingDirectory, sensitivity, "json");
    
      if (exitCode !== 0 && exitCode !== 1) {
        return {
          content: [{ type: "text", text: `GauntletCI error (exit ${exitCode}): ${output}` }],
          isError: true,
        };
      }
    
      try {
        const result = JSON.parse(output) as AnalyzeResult;
        return { content: [{ type: "text", text: formatFindingsAsText(result) }] };
      } catch {
        return {
          content: [{ type: "text", text: `Failed to parse output: ${output.slice(0, 300)}` }],
          isError: true,
        };
      }
    }
  • src/index.ts:84-105 (registration)
    The tool registration in ListToolsRequestSchema: defines name='analyze_commit', description, and inputSchema (workingDirectory required, sensitivity optional).
    tools: [
      {
        name: "analyze_commit",
        description:
          "Run GauntletCI behavioral change risk analysis on the current HEAD commit in a .NET repository. Returns findings as structured text.",
        inputSchema: {
          type: "object",
          properties: {
            workingDirectory: {
              type: "string",
              description: "Absolute path to the .NET repository root.",
            },
            sensitivity: {
              type: "string",
              enum: ["strict", "balanced", "permissive"],
              description: "Risk sensitivity filter. Default: balanced.",
              default: "balanced",
            },
          },
          required: ["workingDirectory"],
        },
      },
  • Helper function formatFindingsAsText() that converts the AnalyzeResult into a human-readable text string.
    export function formatFindingsAsText(result: AnalyzeResult): string {
      if (result.findings.length === 0) {
        return `No findings. ${result.rulesEvaluated} rules evaluated.${result.commitSha ? ` Commit: ${result.commitSha}` : ""}`;
      }
    
      const lines: string[] = [
        `${result.findings.length} finding(s) from ${result.rulesEvaluated} rules.${result.commitSha ? ` Commit: ${result.commitSha}` : ""}`,
        "",
      ];
    
      for (const f of result.findings) {
        const sev = SEVERITY_LABELS[Math.min(f.severity, 3)];
        const loc = f.filePath ? ` [${f.filePath}${f.line ? `:${f.line}` : ""}]` : "";
        lines.push(`[${sev}] ${f.ruleId} - ${f.ruleName}${loc}`);
        lines.push(`  Summary: ${f.summary}`);
        if (f.evidence) lines.push(`  Evidence: ${f.evidence}`);
        if (f.whyItMatters) lines.push(`  Why it matters: ${f.whyItMatters}`);
        if (f.suggestedAction) lines.push(`  Suggested action: ${f.suggestedAction}`);
        lines.push("");
      }
    
      return lines.join("\n");
    }
  • Helper function runGauntletCI() that spawns the 'gauntletci analyze' CLI subprocess.
    export function runGauntletCI(
      workingDir: string,
      sensitivity: string,
      outputFormat: "json" | "sarif" | "text"
    ): { output: string; exitCode: number } {
      const result = spawnSync(
        "gauntletci",
        ["analyze", "--output", outputFormat, "--no-banner", "--sensitivity", sensitivity, "--no-llm"],
        {
          cwd: workingDir,
          encoding: "utf8",
          shell: process.platform === "win32",
        }
      );
    
      return {
        output: result.stdout ?? "",
        exitCode: result.status ?? -1,
      };
    }
  • Type definitions: Finding interface, AnalyzeResult interface, and SEVERITY_LABELS constant used by analyze_commit.
    interface Finding {
      ruleId: string;
      ruleName: string;
      summary: string;
      evidence: string;
      whyItMatters: string;
      suggestedAction: string;
      severity: number;
      filePath?: string;
      line?: number;
    }
    
    interface AnalyzeResult {
      commitSha?: string;
      hasFindings: boolean;
      findings: Finding[];
      rulesEvaluated: number;
    }
Behavior2/5

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

No annotations are provided, so the description must convey behavioral traits. It mentions the tool runs an analysis and returns structured text, but lacks details on side effects (e.g., whether it modifies the repository), required permissions, rate limits, or execution time. The return format 'structured text' is vague.

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?

The description consists of two concise sentences, front-loading the action and purpose. Every sentence adds value with no wasted words.

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

Completeness3/5

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

For a tool with 2 parameters and no output schema, the description provides a high-level purpose but does not specify the structure of the returned text. Given the availability of sibling tools that return JSON/SARIF, the agent may need more detail on the output format to parse 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?

Schema description coverage is 100%, so the baseline is 3. The description does not add any parameter-specific guidance beyond what the schema already provides for 'workingDirectory' and 'sensitivity'.

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?

Description clearly states the action ('Run GauntletCI behavioral change risk analysis'), the scope ('on current HEAD commit in a .NET repository'), and the output ('structured text'). It distinguishes from siblings like get_findings_json and get_sarif which likely retrieve results, while this tool performs the analysis.

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

Usage Guidelines3/5

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

The description implies it is the first step before using sibling tools (get_findings_json, get_sarif) to retrieve specific formats, but it does not explicitly state when to use this tool versus alternatives or any prerequisites.

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/EricCogen/GauntletCI-MCP'

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