Skip to main content
Glama

db.get_test_results

Retrieve vulnerability test results with filtering by target, test type, and success status to analyze security assessments from bug bounty hunting tools.

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

  • Executes the tool logic: fetches test results via helper, computes aggregate stats (count, success/failure counts, avg score), formats 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 defining optional filters for target, testType, success status, and result limit.
      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 MCP tool with MCP Server instance, providing description, input 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);
        }
      }
    );
  • Supporting function that builds and executes dynamic SQL query on test_results table with filters for target, testType, success; returns raw rows.
    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();
      }
    }

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