Skip to main content
Glama

jenkins_get_coverage_paths

Retrieve file paths with coverage data from Jenkins builds to analyze test coverage reports for specific applications and build numbers.

Instructions

Obtener todos los paths de archivos con cobertura

Input Schema

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

Implementation Reference

  • index.ts:338-364 (registration)
    Registration of the jenkins_get_coverage_paths tool, including input schema and inline handler function that delegates to JenkinsService and formats the response.
    server.tool( "jenkins_get_coverage_paths", "Obtener todos los paths de archivos con cobertura", { app: z.string().describe("Nombre de la aplicación"), buildNumber: z.number().describe("Número del build"), branch: z.string().optional().describe("Rama de Git (por defecto: main)") }, async (args) => { try { const result = await getJenkinsService().getCoverageReportPaths(args.app, args.buildNumber, args.branch || 'main'); const pathsText = `📂 **Paths de Cobertura - Build #${args.buildNumber}**\n\n` + `**Total de archivos:** ${result.length}\n\n` + result.slice(0, 20).map((path, index) => `${index + 1}. ${path}`).join('\n') + (result.length > 20 ? `\n\n... y ${result.length - 20} archivos más` : ''); return { content: [{ type: "text", text: pathsText }], }; } catch (error: any) { return { content: [{ type: "text", text: `❌ **Error:** ${error.message}` }], }; } } );
  • Core implementation of the coverage paths retrieval in JenkinsService, fetching frontend coverage report and extracting paths.
    async getCoverageReportPaths(app: string, buildNumber: number, branch: string = 'main'): Promise<string[]> { if (!validateAppName(app)) { throw new Error('Invalid app name.'); } try { const frontendReport = await this.getCoverageReportFrontend(app, buildNumber, branch); return this.getAllPaths(frontendReport); } catch (error: any) { throw handleHttpError(error, `Failed to get coverage paths for app: ${app}, build: ${buildNumber}, branch: ${branch}`); } }
  • Helper function to extract all file paths from the coverage report object.
    private getAllPaths(report: CoverageReportFront): string[] { return Object.values(report.files).map(file => file.path); }
  • Zod input schema for the tool parameters.
    { app: z.string().describe("Nombre de la aplicación"), buildNumber: z.number().describe("Número del build"), branch: z.string().optional().describe("Rama de Git (por defecto: main)") },
  • Helper to fetch the frontend coverage report ZIP from Jenkins (currently returns empty).
    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: {} }; }

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