Skip to main content
Glama

get_waf_sampled_requests

Retrieve sampled web requests from AWS WAF Web ACLs to analyze traffic patterns and identify potential security threats for monitoring and troubleshooting purposes.

Instructions

Retrieves sampled requests from a Web ACL.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
web_acl_arnYesThe ARN of the Web ACL.
rule_metric_nameYesThe metric name of the rule to sample.
scopeNoThe scope (default: REGIONAL).
time_window_secondsNoTime window in seconds (e.g., 3600 for 1 hour).

Implementation Reference

  • Handler function that executes the AWS WAFv2 GetSampledRequestsCommand to retrieve sampled requests from a specified Web ACL rule.
    if (name === "get_waf_sampled_requests") {
        const aclArn = (args as any)?.web_acl_arn;
        const metricName = (args as any)?.rule_metric_name;
        const scope = (args as any)?.scope || "REGIONAL";
        const timeWindow = (args as any)?.time_window_seconds || 3600;
    
        // WAFv2 Sampled Requests requires a time window
        const endTime = new Date();
        const startTime = new Date(endTime.getTime() - timeWindow * 1000);
    
        const command = new GetSampledRequestsCommand({
            WebAclArn: aclArn,
            RuleMetricName: metricName,
            Scope: scope,
            TimeWindow: { StartTime: startTime, EndTime: endTime },
            MaxItems: 100
        });
        const response = await wafv2Client.send(command);
    
        const requests = response.SampledRequests?.map(r => ({
            ClientIP: r.Request?.ClientIP,
            Country: r.Request?.Country,
            URI: r.Request?.URI,
            Method: r.Request?.Method,
            Headers: r.Request?.Headers,
            Action: r.Action,
            Timestamp: r.Timestamp
        })) || [];
        return { content: [{ type: "text", text: JSON.stringify(requests, null, 2) }] };
    }
  • src/index.ts:621-646 (registration)
    Tool registration in the ListTools response, including name, description, and input schema definition.
        name: "get_waf_sampled_requests",
        description: "Retrieves sampled requests from a Web ACL.",
        inputSchema: {
            type: "object",
            properties: {
                web_acl_arn: {
                    type: "string",
                    description: "The ARN of the Web ACL."
                },
                rule_metric_name: {
                    type: "string",
                    description: "The metric name of the rule to sample."
                },
                scope: {
                    type: "string",
                    enum: ["CLOUDFRONT", "REGIONAL"],
                    description: "The scope (default: REGIONAL)."
                },
                time_window_seconds: {
                    type: "number",
                    description: "Time window in seconds (e.g., 3600 for 1 hour)."
                }
            },
            required: ["web_acl_arn", "rule_metric_name"]
        }
    },
  • Input schema for validating tool arguments: web_acl_arn, rule_metric_name (required), scope, time_window_seconds.
        name: "get_waf_sampled_requests",
        description: "Retrieves sampled requests from a Web ACL.",
        inputSchema: {
            type: "object",
            properties: {
                web_acl_arn: {
                    type: "string",
                    description: "The ARN of the Web ACL."
                },
                rule_metric_name: {
                    type: "string",
                    description: "The metric name of the rule to sample."
                },
                scope: {
                    type: "string",
                    enum: ["CLOUDFRONT", "REGIONAL"],
                    description: "The scope (default: REGIONAL)."
                },
                time_window_seconds: {
                    type: "number",
                    description: "Time window in seconds (e.g., 3600 for 1 hour)."
                }
            },
            required: ["web_acl_arn", "rule_metric_name"]
        }
    },
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('Retrieves') but does not clarify aspects like whether this is a read-only operation, potential rate limits, authentication requirements, or the format of returned data. This leaves significant gaps for an agent to understand how the tool behaves in practice.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, direct sentence that efficiently conveys the core purpose without unnecessary words. It is front-loaded with the main action and resource, making it easy to parse and understand quickly, which is ideal for conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of annotations and output schema, the description is insufficient for a tool with 4 parameters and no behavioral context. It does not address return values, error handling, or operational constraints, making it incomplete for an agent to reliably use this tool in complex scenarios.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, providing clear details for all parameters (e.g., ARN, metric name, scope, time window). The description adds no additional semantic context beyond what the schema already specifies, such as examples or usage notes, so it meets the baseline for adequate but not enhanced parameter understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Retrieves') and resource ('sampled requests from a Web ACL'), making the purpose specific and understandable. However, it does not explicitly differentiate from sibling tools like 'list_web_acls' or 'list_access_denied_events', which might offer related but distinct functionality, preventing a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives, such as 'list_access_denied_events' or other AWS WAF-related tools. It lacks context on prerequisites, typical use cases, or exclusions, leaving the agent to infer usage based on the tool name and parameters alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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