Skip to main content
Glama

security_gitleaks_scan

Scan directories for exposed secrets and credentials to identify security vulnerabilities before deployment.

Instructions

Scan a directory for leaked secrets and credentials using Gitleaks

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directoryNoDirectory to scan (default: current directory)

Implementation Reference

  • The core logic function executing the gitleaks scan command.
    export async function gitleaksScan(args: Record<string, unknown>): Promise<string> {
      const directory = (args.directory as string) || ".";
    
      try {
        const { stdout } = await execFileAsync(
          "gitleaks",
          ["detect", "--source", directory, "--report-format", "json", "--no-banner", "--exit-code", "0"],
          { timeout: 60000 }
        );
    
        const findings = JSON.parse(stdout || "[]");
        if (findings.length === 0) {
          return `Gitleaks scan: No secrets found in '${directory}'.`;
        }
    
        const headers = ["RULE", "FILE", "LINE", "MATCH"];
        const rows = findings.slice(0, 20).map((f: any) => [
          f.RuleID || "",
          f.File || "",
          String(f.StartLine || ""),
          (f.Match || "").substring(0, 30) + "***",
        ]);
    
        const result = `Gitleaks scan results for '${directory}':\n\n${formatTable(headers, rows)}`;
        if (findings.length > 20) {
          return result + `\n\n... and ${findings.length - 20} more findings`;
        }
        return result;
      } catch (error: any) {
        if (error.code === "ENOENT") {
          throw new Error("Gitleaks is not installed. Install it from https://github.com/gitleaks/gitleaks");
        }
        throw new Error(`Gitleaks scan failed: ${error.stderr || error.message}`);
      }
    }
  • Tool definition and input schema for security_gitleaks_scan.
    {
      name: "security_gitleaks_scan",
      description: "Scan a directory for leaked secrets and credentials using Gitleaks",
      inputSchema: {
        type: "object" as const,
        properties: {
          directory: { type: "string", description: "Directory to scan (default: current directory)" },
        },
      },
    },
  • Tool registration/routing to the handler.
    case "security_gitleaks_scan": return gitleaksScan(a);
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool performs a scan but doesn't describe what happens during execution (e.g., is it read-only or does it modify files?), output format, error handling, performance implications, or security considerations. This leaves significant gaps for an agent to understand the tool's behavior.

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 is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's front-loaded with the core action and tool name, making it easy for an agent to parse quickly. Every word serves a clear purpose.

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 complexity of a security scanning tool with no annotations and no output schema, the description is insufficient. It doesn't explain what the scan returns (e.g., findings, report format), how to interpret results, or any behavioral aspects. For a tool that could have significant operational impact, more context is needed to guide proper usage.

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?

The input schema has 100% description coverage, with the single parameter 'directory' clearly documented in the schema. The description doesn't add any parameter-specific information beyond what's in the schema. According to the rules, when schema coverage is high (>80%), the baseline score is 3 even without param details in the description.

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 clearly states the action ('scan') and target ('directory for leaked secrets and credentials') using the specific tool 'Gitleaks'. It distinguishes itself from sibling tools by focusing on security scanning rather than Docker, Kubernetes, Prometheus, or system operations. However, it doesn't explicitly differentiate from 'security_trivy_scan' (another security tool), which might cause some ambiguity.

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?

The description provides no guidance on when to use this tool versus alternatives like 'security_trivy_scan' or other security tools. It doesn't mention prerequisites, typical use cases, or scenarios where this tool is preferred over others. The agent must infer usage from the tool name and description alone.

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/batu-sonmez/infraclaude'

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