projects_getLoadTestRuns
Retrieve load test runs for a project to analyze performance test results and monitor execution data.
Instructions
Retrieve runs for a load test in a project from LoadRunner Cloud.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | The ID of the project. | |
| loadTestId | Yes | The ID of the load test. |
Implementation Reference
- The `executeFunction` handler that performs the HTTP GET request to the LoadRunner Cloud API to retrieve load test runs for the specified project and load test.const executeFunction = async ({ projectId, loadTestId }) => { const baseUrl = process.env.LRC_BASE_URL; const tenantId = process.env.LRC_TENANT_ID; const token = await getAuthToken(); try { // Construct the URL with query parameters const url = new URL(`${baseUrl}/projects/${projectId}/load-tests/${loadTestId}/runs`); url.searchParams.append('TENANTID', tenantId); // Set up headers for the request const headers = { 'Content-Type': 'application/json', 'Authorization': `Bearer ${token}` }; // Perform the fetch request const response = await fetch(url.toString(), { method: 'GET', headers }); // Check if the response was successful if (!response.ok) { const text = await response.text(); try { const errorData = JSON.parse(text); throw new Error(JSON.stringify(errorData)); } catch (jsonErr) { // Not JSON, log the raw text console.error('Non-JSON error response:', text); throw new Error(text); } } // Parse and return the response data const text = await response.text(); try { const data = JSON.parse(text); return data; } catch (jsonErr) { // Not JSON, log the raw text console.error('Non-JSON success response:', text); return { error: 'Received non-JSON response from API', raw: text }; } } catch (error) { console.error('Error retrieving load test runs:', error); return { error: 'An error occurred while retrieving load test runs.' }; } };
- Input schema defining the required parameters `projectId` and `loadTestId` as strings.parameters: { type: 'object', properties: { projectId: { type: 'string', description: 'The ID of the project.' }, loadTestId: { type: 'string', description: 'The ID of the load test.' } }, required: ['projectId', 'loadTestId'] }
- The `apiTool` object that registers the tool with its handler, name 'projects_getLoadTestRuns', description, and schema. This is exported and discovered dynamically.const apiTool = { function: executeFunction, definition: { type: 'function', function: { name: 'projects_getLoadTestRuns', description: 'Retrieve runs for a load test in a project from LoadRunner Cloud.', parameters: { type: 'object', properties: { projectId: { type: 'string', description: 'The ID of the project.' }, loadTestId: { type: 'string', description: 'The ID of the load test.' } }, required: ['projectId', 'loadTestId'] } } } };
- tools/paths.js:10-10 (registration)The tool module path is listed in `toolPaths` array, enabling its discovery and registration via `discoverTools()`.'loadrunner-cloud/load-runner-cloud-api/projects-get-load-test-runs.js'