Skip to main content
Glama
leorosignoli

JIRA Zephyr MCP Server

by leorosignoli

generate_test_report

Generate test execution reports in JSON or HTML format from JIRA Zephyr test cycles to track testing progress and results.

Instructions

Generate test execution report

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cycleIdYesTest cycle ID
formatNoReport format (default: JSON)

Implementation Reference

  • Main handler function for generate_test_report tool. Validates input, calls Zephyr client to get report data, generates HTML if requested, and returns formatted report.
    export const generateTestReport = async (input: GenerateTestReportInput) => { const validatedInput = generateTestReportSchema.parse(input); try { const report = await getZephyrClient().generateTestReport(validatedInput.cycleId); if (validatedInput.format === 'HTML') { const htmlReport = generateHtmlReport(report); return { success: true, data: { format: 'HTML', content: htmlReport, generatedOn: report.generatedOn, }, }; } return { success: true, data: { format: 'JSON', content: report, generatedOn: report.generatedOn, }, }; } catch (error: any) { return { success: false, error: error.response?.data?.message || error.message, }; } };
  • Helper function to generate HTML report from the test execution data.
    const generateHtmlReport = (report: any) => { return ` <!DOCTYPE html> <html> <head> <title>Test Execution Report - ${report.cycleName}</title> <style> body { font-family: Arial, sans-serif; margin: 20px; } .header { background-color: #f5f5f5; padding: 20px; border-radius: 5px; } .summary { display: flex; gap: 20px; margin: 20px 0; } .metric { background-color: #e8f4f8; padding: 15px; border-radius: 5px; text-align: center; } .metric h3 { margin: 0 0 10px 0; } .metric .value { font-size: 24px; font-weight: bold; } .executions { margin-top: 30px; } .execution { padding: 10px; border-left: 4px solid #ddd; margin: 10px 0; } .execution.pass { border-left-color: #4caf50; } .execution.fail { border-left-color: #f44336; } .execution.blocked { border-left-color: #ff9800; } .execution.progress { border-left-color: #2196f3; } </style> </head> <body> <div class="header"> <h1>Test Execution Report</h1> <h2>${report.cycleName}</h2> <p>Project: ${report.projectKey}</p> <p>Generated: ${new Date(report.generatedOn).toLocaleString()}</p> </div> <div class="summary"> <div class="metric"> <h3>Total Tests</h3> <div class="value">${report.summary.total}</div> </div> <div class="metric"> <h3>Passed</h3> <div class="value">${report.summary.passed}</div> </div> <div class="metric"> <h3>Failed</h3> <div class="value">${report.summary.failed}</div> </div> <div class="metric"> <h3>Blocked</h3> <div class="value">${report.summary.blocked}</div> </div> <div class="metric"> <h3>Pass Rate</h3> <div class="value">${Math.round(report.summary.passRate)}%</div> </div> </div> <div class="executions"> <h3>Test Executions</h3> ${report.executions.map((exec: any) => ` <div class="execution ${exec.status.toLowerCase()}"> <strong>${exec.key}</strong> - ${exec.status} ${exec.comment ? `<p>${exec.comment}</p>` : ''} ${exec.defects.length > 0 ? `<p>Defects: ${exec.defects.map((d: any) => d.key).join(', ')}</p>` : ''} </div> `).join('')} </div> </body> </html> `; };
  • Zod schema for validating GenerateTestReportInput, used in the handler and MCP dispatch.
    export const generateTestReportSchema = z.object({ cycleId: z.string().min(1, 'Cycle ID is required'), format: z.enum(['JSON', 'HTML']).default('JSON'), });
  • src/index.ts:172-182 (registration)
    Tool registration in the TOOLS array, defining name, description, and inputSchema for MCP.
    name: 'generate_test_report', description: 'Generate test execution report', inputSchema: { type: 'object', properties: { cycleId: { type: 'string', description: 'Test cycle ID' }, format: { type: 'string', enum: ['JSON', 'HTML'], description: 'Report format (default: JSON)' }, }, required: ['cycleId'], }, },
  • src/index.ts:425-435 (registration)
    Dispatch handler in the MCP CallToolRequest switch statement that invokes the generateTestReport function.
    case 'generate_test_report': { const validatedArgs = validateInput<GenerateTestReportInput>(generateTestReportSchema, args, 'generate_test_report'); return { content: [ { type: 'text', text: JSON.stringify(await generateTestReport(validatedArgs), null, 2), }, ], }; }

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/leorosignoli/jira-zephyr-mcp'

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