get_test_runs
Retrieve performance test runs for a specific test to analyze results and track execution history.
Instructions
Get test runs (masters) for a specified test.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| testId | Yes | The ID of the test to retrieve runs for. |
Implementation Reference
- The main handler function 'executeFunction' that makes an authenticated GET request to the BlazeMeter /api/v4/masters endpoint with testId query param to retrieve the list of test runs.const executeFunction = async ({ testId }) => { 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 with query parameters const url = new URL(`${baseUrl}/api/v4/masters`); url.searchParams.append('testId', testId); // 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 test runs.' }; } } };
- Schema definition for the tool, specifying the name, description, and required 'testId' string parameter.function: { name: 'get_test_runs', description: 'Get test runs (masters) for a specified test.', parameters: { type: 'object', properties: { testId: { type: 'string', description: 'The ID of the test to retrieve runs for.' } }, required: ['testId'] } } }
- tools/blazemeter/new-collection/get-test-runs-list.js:60-81 (registration)The 'apiTool' export that registers the tool by associating the handler with its OpenAI-compatible tool definition (schema). This is dynamically loaded by lib/tools.js#discoverTools().const apiTool = { function: executeFunction, definition: { type: 'function', function: { name: 'get_test_runs', description: 'Get test runs (masters) for a specified test.', parameters: { type: 'object', properties: { testId: { type: 'string', description: 'The ID of the test to retrieve runs for.' } }, required: ['testId'] } } } }; export { apiTool };
- lib/tools.js:7-16 (helper)Helper function that discovers all tools by dynamically importing the apiTool from each file listed in tools/paths.js, enabling registration in the MCP server.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); }