db.get_statistics
Retrieve test result statistics from the VulneraMCP security platform to analyze vulnerability findings and track bug bounty program performance.
Instructions
Get statistics about test results
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/database.ts:124-137 (handler)Handler function that executes the db.get_statistics tool logic: calls getTestStatistics(), computes summary statistics, and formats the result.async (): Promise<ToolResult> => { try { const stats = await getTestStatistics(); return formatToolResult(true, { statistics: stats, summary: { totalTests: stats.reduce((sum: number, s: any) => sum + parseInt(s.count || 0), 0), totalTypes: stats.length, }, }); } catch (error: any) { return formatToolResult(false, null, error.message); } }
- src/tools/database.ts:115-138 (registration)Registers the db.get_statistics tool on the MCP server within registerDatabaseTools, including name, description, input schema (empty), and handler.server.tool( 'db.get_statistics', { description: 'Get statistics about test results', inputSchema: { type: 'object', properties: {}, }, }, async (): Promise<ToolResult> => { try { const stats = await getTestStatistics(); return formatToolResult(true, { statistics: stats, summary: { totalTests: stats.reduce((sum: number, s: any) => sum + parseInt(s.count || 0), 0), totalTypes: stats.length, }, }); } catch (error: any) { return formatToolResult(false, null, error.message); } } );
- src/tools/database.ts:117-123 (schema)Input schema for db.get_statistics: takes no parameters (empty properties).{ description: 'Get statistics about test results', inputSchema: { type: 'object', properties: {}, }, },
- src/integrations/postgres.ts:227-246 (helper)Helper function getTestStatistics that performs the SQL query to retrieve test statistics grouped by test_type from the test_results table.export async function getTestStatistics(): Promise<any> { const client = await initPostgres().connect(); try { const stats = await client.query(` SELECT COUNT(*) as total_tests, COUNT(*) FILTER (WHERE success = true) as successful_tests, COUNT(*) FILTER (WHERE success = false) as failed_tests, AVG(score) as avg_score, test_type, COUNT(*) as count FROM test_results GROUP BY test_type ORDER BY count DESC `); return stats.rows; } finally { client.release(); } }
- src/index.ts:46-46 (registration)Top-level call to registerDatabaseTools(server) which registers all db.* tools including db.get_statistics.registerDatabaseTools(server);