get_report
Retrieve penetration testing reports by ID to access security assessment documentation, CVSS 3.1 scoring, and vulnerability details through authenticated API calls.
Instructions
Retrieve a specific report by ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bearerToken | No | Bearer token for authentication (optional if REPORTS_JWT_TOKEN env var is set) | |
| reportId | Yes | The ID of the report to retrieve (24-character MongoDB ObjectId) |
Implementation Reference
- server.js:134-199 (handler)The core handler function that validates the reportId, makes an authenticated GET request to the reports API endpoint using axios, and returns the report data as formatted JSON content or error response.async function getReport(providedToken, reportId) { try { const bearerToken = getBearerToken(providedToken); // Validate reportId format (should be MongoDB ObjectId) if (!reportId || !reportId.match(/^[0-9a-fA-F]{24}$/)) { throw new McpError( ErrorCode.InvalidParams, 'Invalid reportId format. Must be a valid MongoDB ObjectId (24 characters)' ); } const response = await axios.get(`${REPORTS_ENDPOINT}/${reportId}`, { headers: { 'Authorization': `Bearer ${bearerToken}`, 'Content-Type': 'application/json', }, timeout: 10000, }); return { content: [ { type: 'text', text: JSON.stringify({ success: true, status: response.status, data: response.data, timestamp: new Date().toISOString(), message: `Retrieved report ${reportId}`, }, null, 2), }, ], }; } catch (error) { if (error instanceof McpError) { throw error; } if (error.response) { return { content: [ { type: 'text', text: JSON.stringify({ success: false, status: error.response.status, error: error.response.data || error.message, timestamp: new Date().toISOString(), }, null, 2), }, ], }; } else if (error.request) { throw new McpError( ErrorCode.InternalError, `Network error: Unable to reach the API at ${REPORTS_ENDPOINT}/${reportId}` ); } else { throw new McpError( ErrorCode.InternalError, `Request setup error: ${error.message}` ); } } }
- server.js:836-849 (schema)The JSON schema defining the input parameters for the 'get_report' tool: bearerToken (optional string) and required reportId (string). Defines validation rules and descriptions.inputSchema: { type: 'object', properties: { bearerToken: { type: 'string', description: 'Bearer token for authentication (optional if REPORTS_JWT_TOKEN env var is set)', }, reportId: { type: 'string', description: 'The ID of the report to retrieve (24-character MongoDB ObjectId)', }, }, required: ['reportId'], },
- server.js:834-850 (registration)Registration of the 'get_report' tool in the ListTools handler, including name, description, and input schema.name: 'get_report', description: 'Retrieve a specific report by ID', inputSchema: { type: 'object', properties: { bearerToken: { type: 'string', description: 'Bearer token for authentication (optional if REPORTS_JWT_TOKEN env var is set)', }, reportId: { type: 'string', description: 'The ID of the report to retrieve (24-character MongoDB ObjectId)', }, }, required: ['reportId'], }, },
- server.js:1082-1089 (registration)Tool dispatch/registration in the CallToolRequestHandler switch statement: validates reportId and calls the getReport handler function.case 'get_report': if (!args.reportId) { throw new McpError( ErrorCode.InvalidParams, 'Report ID is required' ); } return await getReport(args.bearerToken, args.reportId);