Skip to main content
Glama

parse_metrics

Analyze test results or security findings by parsing JUnit XML or SARIF JSON metrics files from devpipe runs.

Instructions

Parse JUnit or SARIF metrics from a devpipe run to analyze test results or security findings.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
metricsPathYesPath to metrics file (JUnit XML or SARIF JSON)
formatYesMetrics format

Implementation Reference

  • Main handler for the 'parse_metrics' tool. Validates input parameters (metricsPath and format), dispatches to appropriate parser (parseJUnitMetrics or parseSARIFMetrics), and returns parsed metrics as JSON.
    case 'parse_metrics': {
      const metricsPath = args?.metricsPath as string;
      const format = args?.format as string;
      
      if (!metricsPath || !format) {
        throw new Error('metricsPath and format are required parameters');
      }
      let metrics;
    
      if (format === 'junit') {
        metrics = await parseJUnitMetrics(metricsPath);
      } else if (format === 'sarif') {
        metrics = await parseSARIFMetrics(metricsPath);
      } else {
        throw new Error(`Unsupported metrics format: ${format}`);
      }
    
      return {
        content: [
          {
            type: 'text',
            text: JSON.stringify(metrics, null, 2),
          },
        ],
      };
    }
  • Input schema definition for the parse_metrics tool, defining required parameters metricsPath and format (junit or sarif).
    {
      name: 'parse_metrics',
      description: 'Parse JUnit or SARIF metrics from a devpipe run to analyze test results or security findings.',
      inputSchema: {
        type: 'object',
        properties: {
          metricsPath: {
            type: 'string',
            description: 'Path to metrics file (JUnit XML or SARIF JSON)',
          },
          format: {
            type: 'string',
            enum: ['junit', 'sarif'],
            description: 'Metrics format',
          },
        },
        required: ['metricsPath', 'format'],
      },
    },
  • Helper function to parse JUnit XML metrics. Currently reads the file content and returns raw data with a note about needing a proper XML parser.
    export async function parseJUnitMetrics(metricsPath: string): Promise<any> {
      try {
        const content = await readFile(metricsPath, 'utf-8');
        // Simple parsing - in production you'd use a proper XML parser
        return { raw: content, note: 'JUnit parsing requires XML parser' };
      } catch (error) {
        throw new Error(`Failed to read JUnit metrics: ${error instanceof Error ? error.message : String(error)}`);
      }
    }
  • Helper function to parse SARIF JSON metrics. Reads the file and parses it as JSON.
    export async function parseSARIFMetrics(metricsPath: string): Promise<any> {
      try {
        const content = await readFile(metricsPath, 'utf-8');
        return JSON.parse(content);
      } catch (error) {
        throw new Error(`Failed to parse SARIF metrics: ${error instanceof Error ? error.message : String(error)}`);
      }
    }

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/drewkhoury/devpipe-mcp'

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