Skip to main content
Glama
purpleax

Fastly NGWAF MCP Server

by purpleax

create_site_rule

Add a site-level rule to Fastly's Next-Gen WAF for request filtering, signal handling, or rate limiting based on configurable conditions and actions.

Instructions

Create a site-level rule

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
corpNameNoCorporation name (uses context default if not provided)
siteNameNoSite name (uses context default if not provided)
typeYesRule type
enabledNoWhether rule is enabled
groupOperatorYesCondition group operator
conditionsYesRule conditions
actionsYesRule actions
reasonNoDescription of the rule
signalNoSignal ID for exclusion/rate limit rules
thresholdCountNoThreshold count for rate limit rules
thresholdIntervalNoThreshold interval for rate limit rules
blockDurationSecondsNoBlock duration for rate limit rules

Implementation Reference

  • Primary handler for the 'create_site_rule' tool. Resolves corp/site context, validates siteName, constructs ruleData from input arguments, and delegates to the FastlyNGWAFClient's createSiteRule method.
    case 'create_site_rule':
        const { corpName: corpForSiteRule, siteName: siteForRule } = resolveContext(typedArgs);
        if (!siteForRule) {
            throw new Error('Site name is required. Please set context or provide siteName parameter.');
        }
        const siteRuleData = {
            type: typedArgs.type,
            enabled: typedArgs.enabled,
            groupOperator: typedArgs.groupOperator,
            conditions: typedArgs.conditions,
            actions: typedArgs.actions,
            reason: typedArgs.reason,
            signal: typedArgs.signal,
            thresholdCount: typedArgs.thresholdCount,
            thresholdInterval: typedArgs.thresholdInterval,
            blockDurationSeconds: typedArgs.blockDurationSeconds,
        };
        result = await client.createSiteRule(corpForSiteRule, siteForRule, siteRuleData);
        break;
  • Input schema defining parameters and validation for the create_site_rule tool.
    inputSchema: {
        type: 'object',
        properties: {
            corpName: { type: 'string', description: 'Corporation name (uses context default if not provided)' },
            siteName: { type: 'string', description: 'Site name (uses context default if not provided)' },
            type: { type: 'string', enum: ['request', 'signal', 'rateLimit'], description: 'Rule type' },
            enabled: { type: 'boolean', description: 'Whether rule is enabled' },
            groupOperator: { type: 'string', enum: ['all', 'any'], description: 'Condition group operator' },
            conditions: { type: 'array', description: 'Rule conditions' },
            actions: { type: 'array', description: 'Rule actions' },
            reason: { type: 'string', description: 'Description of the rule' },
            signal: { type: 'string', description: 'Signal ID for exclusion/rate limit rules' },
            thresholdCount: { type: 'number', description: 'Threshold count for rate limit rules' },
            thresholdInterval: { type: 'number', description: 'Threshold interval for rate limit rules' },
            blockDurationSeconds: { type: 'number', description: 'Block duration for rate limit rules' },
        },
        required: ['type', 'groupOperator', 'conditions', 'actions'],
    },
  • Helper method in FastlyNGWAFClient class that performs the actual API call to create a site rule via POST to /corps/{corp}/sites/{site}/rules.
    async createSiteRule(corpName, siteName, ruleData) {
        const response = await this.api.post(`/corps/${corpName}/sites/${siteName}/rules`, ruleData);
        return response.data;
  • server.js:814-816 (registration)
    Registration of all tools, including create_site_rule, via the ListToolsRequestSchema handler that returns the complete tools array.
    server.setRequestHandler(ListToolsRequestSchema, async () => {
        return { tools };
    });
  • Helper function used by create_site_rule handler (and others) to resolve corpName and siteName from arguments or context.
    function resolveContext(args) {
        const corpName = args.corpName || context.defaultCorpName;
        const siteName = args.siteName || context.defaultSiteName;
        if (!corpName) {
            throw new Error('Corporation name is required. Please set context or provide corpName parameter.');
        }
        return { corpName, siteName };
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. 'Create' implies a write/mutation operation, but the description doesn't mention permission requirements, whether this is idempotent, what happens on conflict, or any side effects. It also doesn't describe the return value or error conditions, leaving significant behavioral gaps.

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 extremely concise at just three words. It's front-loaded with the essential action and resource. There's zero wasted language or redundancy, making it efficient for quick scanning while still conveying the core function.

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?

For a complex creation tool with 12 parameters (4 required) and no annotations or output schema, the description is inadequate. It doesn't explain what a 'site-level rule' is, doesn't provide context about the rule system, and offers no guidance on parameter relationships or usage patterns. The agent would struggle to understand when and how to use this tool effectively.

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?

Schema description coverage is 100%, so the schema already documents all 12 parameters thoroughly with descriptions and enums. The description adds no additional parameter information beyond what's in the schema. According to guidelines, when schema coverage is high (>80%), the baseline is 3 even with no param info in the description.

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

Purpose3/5

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

The description states the action ('Create') and resource ('site-level rule'), which provides basic purpose. However, it's vague about what a 'site-level rule' entails and doesn't differentiate from sibling tools like 'create_corp_rule' or 'update_site'. The description lacks specificity about what types of rules can be created or their domain context.

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?

No guidance is provided about when to use this tool versus alternatives. The description doesn't mention sibling tools like 'create_corp_rule' for corporation-level rules or 'update_site' for site modifications. There's no indication of prerequisites, appropriate contexts, or when this tool should be avoided.

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/purpleax/FastlyMCP'

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