Skip to main content
Glama

list_guardduty_findings

Retrieve recent high-severity AWS GuardDuty security findings to monitor and respond to potential threats in your cloud environment.

Instructions

Lists recent high-severity GuardDuty findings.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
severityNoMinimum severity level (default: 4).
limitNoNumber of findings to return (default: 10).

Implementation Reference

  • The handler function that implements the core logic for the 'list_guardduty_findings' tool. It retrieves the GuardDuty detector ID, lists findings filtered by minimum severity, fetches detailed findings, and returns a summarized list including title, severity, type, region, and resource ID.
    if (name === "list_guardduty_findings") {
        // first list detectors
        const detectorsCmd = new ListDetectorsCommand({});
        const dResponse = await guardDutyClient.send(detectorsCmd);
        const detectorId = dResponse.DetectorIds?.[0];
    
        if (!detectorId) {
            return { content: [{ type: "text", text: "No GuardDuty detector found." }] };
        }
    
        const severity = (args as any)?.severity || 4;
        const limit = (args as any)?.limit || 10;
    
        const listCmd = new ListFindingsCommand({
            DetectorId: detectorId,
            FindingCriteria: { Criterion: { severity: { Gte: severity } } },
            MaxResults: limit
        });
        const listResponse = await guardDutyClient.send(listCmd);
    
        if (!listResponse.FindingIds || listResponse.FindingIds.length === 0) {
            return { content: [{ type: "text", text: "No findings found." }] };
        }
    
        const getCmd = new GetFindingsCommand({
            DetectorId: detectorId,
            FindingIds: listResponse.FindingIds
        });
        const getResponse = await guardDutyClient.send(getCmd);
    
        const findings = getResponse.Findings?.map(f => ({
            Title: f.Title,
            Severity: f.Severity,
            Type: f.Type,
            Region: f.Region,
            ResourceId: f.Resource?.InstanceDetails?.InstanceId || "N/A"
        })) || [];
    
        return {
            content: [{ type: "text", text: JSON.stringify(findings, null, 2) }]
        };
    }
  • src/index.ts:448-463 (registration)
    Registration of the 'list_guardduty_findings' tool in the ListToolsRequest handler, including its name, description, and input schema definition.
        name: "list_guardduty_findings",
        description: "Lists recent high-severity GuardDuty findings.",
        inputSchema: {
            type: "object",
            properties: {
                severity: {
                    type: "number",
                    description: "Minimum severity level (default: 4)."
                },
                limit: {
                    type: "number",
                    description: "Number of findings to return (default: 10)."
                }
            }
        }
    },
  • Input schema defining optional parameters 'severity' (minimum severity level, default 4) and 'limit' (max findings to return, default 10) for the tool.
    inputSchema: {
        type: "object",
        properties: {
            severity: {
                type: "number",
                description: "Minimum severity level (default: 4)."
            },
            limit: {
                type: "number",
                description: "Number of findings to return (default: 10)."
            }
        }
    }
  • Initialization of the GuardDutyClient instance used throughout the tool handler.
    const guardDutyClient = new GuardDutyClient({});
  • Import of AWS SDK GuardDuty client and commands required for the tool implementation.
    import { GuardDutyClient, ListFindingsCommand, GetFindingsCommand, ListDetectorsCommand } from "@aws-sdk/client-guardduty";

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/bhaveshopss/MCP-server'

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