create_corp_rule
Create corporation-level security rules for Fastly's Next-Gen WAF to protect web applications by defining conditions and actions.
Instructions
Create a corporation-level rule
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| corpName | No | Corporation name (uses context default if not provided) | |
| type | Yes | Rule type | |
| enabled | No | Whether rule is enabled | |
| groupOperator | Yes | Condition group operator | |
| conditions | Yes | Rule conditions | |
| actions | Yes | Rule actions | |
| reason | No | Description of the rule | |
| signal | No | Signal ID for exclusion rules | |
| corpScope | No | Rule scope | |
| siteNames | No | Site names for specific scope |
Implementation Reference
- server.js:959-973 (handler)MCP tool handler implementation for 'create_corp_rule': resolves corporation name from context or arguments, builds rule data object from input, and calls the client helper to execute the API call.case 'create_corp_rule': const { corpName: corpForCorpRule } = resolveContext(typedArgs); const corpRuleData = { type: typedArgs.type, enabled: typedArgs.enabled, groupOperator: typedArgs.groupOperator, conditions: typedArgs.conditions, actions: typedArgs.actions, reason: typedArgs.reason, signal: typedArgs.signal, corpScope: typedArgs.corpScope, siteNames: typedArgs.siteNames, }; result = await client.createCorpRule(corpForCorpRule, corpRuleData); break;
- server.js:118-120 (helper)FastlyNGWAFClient helper method that performs the HTTP POST request to the Fastly NGWAF API endpoint for creating a corporation-level rule.async createCorpRule(corpName, ruleData) { const response = await this.api.post(`/corps/${corpName}/rules`, ruleData); return response.data;
- server.js:565-580 (schema)Input schema for the 'create_corp_rule' tool, defining parameters such as type, conditions, actions, and optional fields like corpScope and siteNames.inputSchema: { type: 'object', properties: { corpName: { type: 'string', description: 'Corporation name (uses context default if not provided)' }, type: { type: 'string', enum: ['request', 'signal'], 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 rules' }, corpScope: { type: 'string', enum: ['global', 'specificSites'], description: 'Rule scope' }, siteNames: { type: 'array', items: { type: 'string' }, description: 'Site names for specific scope' }, }, required: ['type', 'groupOperator', 'conditions', 'actions'], },
- server.js:562-581 (registration)Tool registration object for 'create_corp_rule' in the tools array, which is returned by the ListTools handler to advertise the tool's availability, description, and schema.{ name: 'create_corp_rule', description: 'Create a corporation-level rule', inputSchema: { type: 'object', properties: { corpName: { type: 'string', description: 'Corporation name (uses context default if not provided)' }, type: { type: 'string', enum: ['request', 'signal'], 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 rules' }, corpScope: { type: 'string', enum: ['global', 'specificSites'], description: 'Rule scope' }, siteNames: { type: 'array', items: { type: 'string' }, description: 'Site names for specific scope' }, }, required: ['type', 'groupOperator', 'conditions', 'actions'], }, },