create_security_group_rule
Add an ingress rule to a security group on the CloudStack MCP Server by specifying protocol, port range, CIDR list, or user security group list.
Instructions
Create a security group ingress rule
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cidrlist | No | CIDR list (comma-separated) | |
| endport | No | End port | |
| protocol | Yes | Protocol (TCP, UDP, ICMP) | |
| securitygroupid | Yes | Security group ID | |
| startport | No | Start port | |
| usersecuritygrouplist | No | User security group list |
Implementation Reference
- src/handlers/security-handlers.ts:72-83 (handler)The main handler function that implements the tool logic by authorizing a security group ingress rule via the CloudStack client and returning a formatted response.async handleCreateSecurityGroupRule(args: any) { const result = await this.cloudStackClient.authorizeSecurityGroupIngress(args); return { content: [ { type: 'text', text: `Created security group rule. Job ID: ${result.authorizesecuritygroupingressresponse?.jobid}\nRule ID: ${result.authorizesecuritygroupingressresponse?.id}` } ] }; }
- The tool definition object including name, description, and input schema (parameters with types and requirements) for validating tool inputs.{ name: 'create_security_group_rule', description: 'Create a security group ingress rule', inputSchema: { type: 'object', properties: { securitygroupid: { type: 'string', description: 'Security group ID', }, protocol: { type: 'string', description: 'Protocol (TCP, UDP, ICMP)', }, startport: { type: 'number', description: 'Start port', }, endport: { type: 'number', description: 'End port', }, cidrlist: { type: 'string', description: 'CIDR list (comma-separated)', }, usersecuritygrouplist: { type: 'string', description: 'User security group list', }, }, required: ['securitygroupid', 'protocol'], additionalProperties: false, }, },
- src/server.ts:206-207 (registration)The dispatch case in the main tool request handler that routes 'create_security_group_rule' calls to the appropriate security handler method.case 'create_security_group_rule': return await this.securityHandlers.handleCreateSecurityGroupRule(args);