get_all_reports
Retrieve all penetration testing reports from the API to manage security assessments, vulnerabilities, and documentation with CVSS scoring and authentication support.
Instructions
Retrieve all reports from the API
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bearerToken | No | Bearer token for authentication (optional if REPORTS_JWT_TOKEN env var is set) |
Implementation Reference
- server.js:202-258 (handler)The handler function that executes the tool: fetches all reports via API GET request using provided or env bearer token, handles errors, returns MCP-formatted content with JSON data.async function getAllReports(providedToken) { try { const bearerToken = getBearerToken(providedToken); const response = await axios.get(REPORTS_ENDPOINT, { 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 ${response.data?.length || 0} reports`, }, 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}` ); } else { throw new McpError( ErrorCode.InternalError, `Request setup error: ${error.message}` ); } }
- server.js:852-864 (schema)Input schema definition for the tool in the ListTools response: accepts optional bearerToken.name: 'get_all_reports', description: 'Retrieve all reports from the API', inputSchema: { type: 'object', properties: { bearerToken: { type: 'string', description: 'Bearer token for authentication (optional if REPORTS_JWT_TOKEN env var is set)', }, }, required: [], }, },
- server.js:1128-1129 (registration)Tool dispatch/registration in the CallToolRequestSchema handler switch statement: calls the getAllReports handler.case 'get_all_reports': return await getAllReports(args.bearerToken);