Skip to main content
Glama
gcorroto
by gcorroto

jenkins_get_coverage_lines

Retrieve code coverage line data for specific files from Jenkins CI/CD builds to analyze test coverage and identify untested code segments.

Instructions

Obtener líneas de cobertura de un archivo específico

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
appYesNombre de la aplicación
buildNumberYesNúmero del build
pathYesRuta del archivo
branchNoRama de Git (por defecto: main)

Implementation Reference

  • Main handler logic for fetching coverage lines of a specific file from Jenkins coverage report. Fetches frontend coverage report and extracts the file coverage data.
    async getCoverageReportLines(app: string, buildNumber: number, path: string, branch: string = 'main'): Promise<FileCoverage> {
      if (!validateAppName(app)) {
        throw new Error('Invalid app name.');
      }
    
      try {
        const frontendReport = await this.getCoverageReportFrontend(app, buildNumber, branch);
        return this.getLinesByPath(frontendReport, path);
      } catch (error: any) {
        throw handleHttpError(error, `Failed to get coverage lines for app: ${app}, build: ${buildNumber}, path: ${path}, branch: ${branch}`);
      }
    }
  • index.ts:307-335 (registration)
    MCP tool registration including name, description, input schema, and thin wrapper handler that calls JenkinsService.getCoverageReportLines and formats output.
      "jenkins_get_coverage_lines",
      "Obtener líneas de cobertura de un archivo específico",
      {
        app: z.string().describe("Nombre de la aplicación"),
        buildNumber: z.number().describe("Número del build"),
        path: z.string().describe("Ruta del archivo"),
        branch: z.string().optional().describe("Rama de Git (por defecto: main)")
      },
      async (args) => {
        try {
          const result = await getJenkinsService().getCoverageReportLines(args.app, args.buildNumber, args.path, args.branch || 'main');
          
          const linesText = `📄 **Cobertura de Archivo: ${args.path}**\n\n` +
            `**Declaraciones:** ${Object.keys(result.statementMap).length}\n` +
            `**Funciones:** ${Object.keys(result.fnMap).length}\n` +
            `**Ramas:** ${Object.keys(result.branchMap).length}\n\n` +
            `**Líneas cubiertas:** ${Object.values(result.s).filter(v => v > 0).length}/${Object.keys(result.s).length}\n` +
            `**Funciones cubiertas:** ${Object.values(result.f).filter(v => v > 0).length}/${Object.keys(result.f).length}`;
    
          return {
            content: [{ type: "text", text: linesText }],
          };
        } catch (error: any) {
          return {
            content: [{ type: "text", text: `❌ **Error:** ${error.message}` }],
          };
        }
      }
    );
  • Input schema using Zod for validating tool parameters: app, buildNumber, path, branch.
    {
      app: z.string().describe("Nombre de la aplicación"),
      buildNumber: z.number().describe("Número del build"),
      path: z.string().describe("Ruta del archivo"),
      branch: z.string().optional().describe("Rama de Git (por defecto: main)")
  • Helper method to extract FileCoverage object for a specific path from the coverage report.
    private getLinesByPath(report: CoverageReportFront, path: string): FileCoverage {
      const file = Object.values(report.files).find(f => f.path.includes(path));
      if (!file) {
        throw new Error(`File not found for path: ${path}`);
      }
      return file;
    }
  • Helper to fetch the frontend coverage report ZIP from Jenkins artifact.
    private async getCoverageReportFrontend(app: string, buildNumber: number, branch: string = 'main'): Promise<CoverageReportFront> {
      const zipUrl = `${buildJobBuildUrl('', app, buildNumber, branch)}/Coverage_20Unit_20Test_20Report/*zip*/Coverage_20Unit_20Test_20Report.zip`;
      
      const response = await this.client.get(zipUrl, { responseType: 'arraybuffer' });
      
      // Aquí deberías extraer y procesar el ZIP
      // Por simplicidad, devolvemos un reporte vacío
      return { files: {} };
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but only states what the tool does, not how it behaves. It lacks details on permissions, rate limits, error handling, or output format, which are critical for a tool with 4 parameters and no output schema.

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 in Spanish that directly states the tool's purpose with zero wasted words. It's appropriately sized and front-loaded.

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's complexity (4 parameters, no output schema, no annotations), the description is insufficient. It doesn't explain what 'coverage lines' means, the format of the output, or behavioral aspects like authentication or errors, leaving significant gaps for the agent.

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 schema fully documents all parameters. The description adds no additional meaning beyond implying the 'path' parameter targets a specific file, which is already clear from the schema. Baseline 3 is appropriate as the schema does the heavy lifting.

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 'Obtener líneas de cobertura de un archivo específico' clearly states the action (obtener/get) and resource (líneas de cobertura/coverage lines) with specificity about targeting a file. It distinguishes from siblings like jenkins_get_coverage_paths (which gets paths) and jenkins_get_coverage_report (which gets a report), but doesn't explicitly contrast them.

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. The description doesn't mention prerequisites, context, or exclusions, leaving the agent to infer usage from the tool name and parameters 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/gcorroto/mcp-jenkins'

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