Skip to main content
Glama
pbandreddy

BlazeMeter MCP Server

by pbandreddy

get_test_run_aggregate_data

Retrieve aggregated performance test results for a specific test run to analyze metrics and identify issues.

Instructions

Get the aggregate report data for a specified test run (master).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
masterIdYesThe ID of the test run (master) to retrieve the aggregate report data for.

Implementation Reference

  • Core handler function that performs the HTTP GET request to the BlazeMeter API to retrieve aggregate report data for the given test run master ID, handles errors, and returns the data or error object.
    const executeFunction = async ({ masterId }) => { const baseUrl = process.env.BASE_URL; // loaded from .env const username = process.env.BZM_USERNAME; // loaded from .env const password = process.env.BZM_PASSWORD; // loaded from .env try { // Construct the URL for the aggregate report data const url = new URL(`${baseUrl}/api/v4/masters/${masterId}/reports/aggregatereport/data`); // Set up headers for the request const headers = { 'Authorization': 'Basic ' + Buffer.from(`${username}:${password}`).toString('base64'), 'Accept': 'application/json' }; // Perform the fetch request const response = await fetch(url.toString(), { method: 'GET', headers }); // Check if the response was successful if (!response.ok) { let errorData; try { errorData = await response.json(); } catch (jsonErr) { errorData = await response.text(); } throw new Error(`HTTP ${response.status} ${response.statusText}: ${typeof errorData === 'string' ? errorData : JSON.stringify(errorData)}`); } // Parse and return the response data const data = await response.json(); return data; } catch (error) { if (error instanceof Error) { return { error: error.message }; } else { return { error: 'Unknown error occurred while getting aggregate report data.' }; } } };
  • JSON schema definition for the tool, specifying the name, description, input parameters (masterId as required string), used for MCP tool listing and validation.
    type: 'function', function: { name: 'get_test_run_aggregate_data', description: 'Get the aggregate report data for a specified test run (master).', parameters: { type: 'object', properties: { masterId: { type: 'string', description: 'The ID of the test run (master) to retrieve the aggregate report data for.' } }, required: ['masterId'] } } }
  • lib/tools.js:7-16 (registration)
    Dynamic discovery and loading of all tools by importing apiTool from each file path listed in toolPaths, preparing the tools array for MCP server registration.
    export async function discoverTools() { const toolPromises = toolPaths.map(async (file) => { const module = await import(`../tools/${file}`); return { ...module.apiTool, path: file, }; }); return Promise.all(toolPromises); }
  • mcpServer.js:40-80 (registration)
    Registers the MCP protocol handlers on the server for ListTools (listing tool schemas) and CallTool (executing the selected tool's function with input args, including validation), using the discovered tools.
    async function setupServerHandlers(server, tools) { server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: await transformTools(tools), })); server.setRequestHandler(CallToolRequestSchema, async (request) => { const toolName = request.params.name; const tool = tools.find((t) => t.definition.function.name === toolName); if (!tool) { throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${toolName}`); } const args = request.params.arguments; const requiredParameters = tool.definition?.function?.parameters?.required || []; for (const requiredParameter of requiredParameters) { if (!(requiredParameter in args)) { throw new McpError( ErrorCode.InvalidParams, `Missing required parameter: ${requiredParameter}` ); } } try { const result = await tool.function(args); return { content: [ { type: "text", text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { console.error("[Error] Failed to fetch data:", error); throw new McpError( ErrorCode.InternalError, `API error: ${error.message}` ); } }); }
  • List of all tool file paths relative to tools/, including the path to this tool's implementation file, used by discoverTools for loading.
    export const toolPaths = [ 'blazemeter/new-collection/get-workspace-list.js', 'blazemeter/new-collection/get-project-list.js', 'blazemeter/new-collection/get-test-runs-list.js', 'blazemeter/new-collection/get-test-run-summary.js', 'blazemeter/new-collection/get-test-run-aggregate-data.js', 'blazemeter/new-collection/get-test-run-errors-data.js', 'blazemeter/new-collection/get-test-run-thresholds.js', 'blazemeter/new-collection/get-test-run-timeline-kpis.js', ];

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/pbandreddy/blazemeter-mcp-server'

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