Skip to main content
Glama

db.get_test_results

Retrieve vulnerability test results with success/failure status and scores from bug bounty security assessments. Filter by target, test type, or success status to analyze security findings.

Instructions

Retrieve test results with success/failure and scores

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
targetNoFilter by target
testTypeNoFilter by test type
successNoFilter by success status
limitNoMaximum number of results

Implementation Reference

  • The handler function for the 'db.get_test_results' tool. It calls the getTestResults helper, computes statistics (count, successCount, failureCount, avgScore), and returns formatted ToolResult.
    async ({ target, testType, success, limit = 100 }: any): Promise<ToolResult> => { try { const results = await getTestResults(target, testType, success, limit); return formatToolResult(true, { testResults: results, count: results.length, successCount: results.filter((r: any) => r.success).length, failureCount: results.filter((r: any) => !r.success).length, avgScore: results.reduce((sum: number, r: any) => sum + (r.score || 0), 0) / results.length || 0, }); } catch (error: any) { return formatToolResult(false, null, error.message); } }
  • Input schema and description defining optional filters (target, testType, success, limit) for retrieving test results.
    { description: 'Retrieve test results with success/failure and scores', inputSchema: { type: 'object', properties: { target: { type: 'string', description: 'Filter by target' }, testType: { type: 'string', description: 'Filter by test type' }, success: { type: 'boolean', description: 'Filter by success status' }, limit: { type: 'number', description: 'Maximum number of results', default: 100 }, }, }, },
  • Registers the db.get_test_results tool with the MCP server, including schema and handler.
    server.tool( 'db.get_test_results', { description: 'Retrieve test results with success/failure and scores', inputSchema: { type: 'object', properties: { target: { type: 'string', description: 'Filter by target' }, testType: { type: 'string', description: 'Filter by test type' }, success: { type: 'boolean', description: 'Filter by success status' }, limit: { type: 'number', description: 'Maximum number of results', default: 100 }, }, }, }, async ({ target, testType, success, limit = 100 }: any): Promise<ToolResult> => { try { const results = await getTestResults(target, testType, success, limit); return formatToolResult(true, { testResults: results, count: results.length, successCount: results.filter((r: any) => r.success).length, failureCount: results.filter((r: any) => !r.success).length, avgScore: results.reduce((sum: number, r: any) => sum + (r.score || 0), 0) / results.length || 0, }); } catch (error: any) { return formatToolResult(false, null, error.message); } } );
  • Database helper function that executes the SQL query to retrieve test results from the 'test_results' table, applying dynamic WHERE conditions based on provided filters.
    export async function getTestResults( target?: string, testType?: string, success?: boolean, limit: number = 100 ): Promise<any[]> { const client = await initPostgres().connect(); try { let query = 'SELECT * FROM test_results'; const conditions: string[] = []; const params: any[] = []; let paramCount = 0; if (target) { paramCount++; conditions.push(`target = $${paramCount}`); params.push(target); } if (testType) { paramCount++; conditions.push(`test_type = $${paramCount}`); params.push(testType); } if (success !== undefined) { paramCount++; conditions.push(`success = $${paramCount}`); params.push(success); } if (conditions.length > 0) { query += ' WHERE ' + conditions.join(' AND '); } query += ' ORDER BY timestamp DESC LIMIT $' + (paramCount + 1); params.push(limit); const result: QueryResult = await client.query(query, params); return result.rows; } finally { client.release(); } }
  • src/index.ts:46-46 (registration)
    Top-level call to registerDatabaseTools which registers all database tools including 'db.get_test_results'.
    registerDatabaseTools(server);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/telmon95/VulneraMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server