Skip to main content
Glama
tarnover
by tarnover

aws_route53

Manage AWS Route53 DNS zones and records, including creation, deletion, listing, and updates, using Ansible automation through the MCP Server.

Instructions

Manage AWS Route53 DNS records and zones

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYes
commentNo
recordNameNo
recordStateNo
recordTtlNo
recordTypeNo
recordValueNo
regionYes
zoneIdNo
zoneNameNo

Implementation Reference

  • Primary handler function that destructures arguments, builds dynamic Ansible playbook YAML based on the specified Route53 action (list_zones, list_records, create_zone, create_record, delete_record, delete_zone), and executes it via executeAwsPlaybook.
    export async function route53Operations(args: Route53Options): Promise<string> {
      await verifyAwsCredentials();
    
      const { action, region, zoneId, zoneName, recordName, recordType, recordTtl, recordValue, recordState, comment } = args;
    
      let playbookContent = `---
    - name: AWS Route53 ${action} operation
      hosts: localhost
      connection: local
      gather_facts: no
      tasks:`;
      
      switch (action) {
        case 'list_zones':
          playbookContent += `
        - name: List Route53 hosted zones
          amazon.aws.route53_info:
            region: "${region}"
            query: hosted_zone
          register: route53_zones
        
        - name: Display hosted zones
          debug:
            var: route53_zones.HostedZones`;
          break;
          
        case 'list_records':
          playbookContent += `
        - name: List Route53 records
          amazon.aws.route53_info:
            region: "${region}"
            query: record_sets
            hosted_zone_id: "${zoneId}"
          register: route53_records
        
        - name: Display records
          debug:
            var: route53_records.ResourceRecordSets`;
          break;
          
        case 'create_zone':
          playbookContent += `
        - name: Create Route53 hosted zone
          amazon.aws.route53_zone:
            region: "${region}"
            zone: "${zoneName}"
            state: present
    ${formatYamlParams({ comment })}
          register: route53_result
        
        - name: Display zone details
          debug:
            var: route53_result`;
          break;
          
        case 'create_record':
          playbookContent += `
        - name: Create Route53 record
          amazon.aws.route53:
            region: "${region}"
            zone: "${zoneName}"
            record: "${recordName}"
            type: "${recordType}"
            ttl: ${recordTtl ?? 300}
            value: ${JSON.stringify(Array.isArray(recordValue) ? recordValue : [recordValue])}
            state: ${recordState ?? 'present'}
    ${formatYamlParams({ comment })}
          register: route53_result
        
        - name: Display record details
          debug:
            var: route53_result`;
          break;
          
        case 'delete_record':
          playbookContent += `
        - name: Delete Route53 record
          amazon.aws.route53:
            region: "${region}"
            zone: "${zoneName}"
            record: "${recordName}"
            type: "${recordType}"
            # Value might be needed for deletion depending on the record type/setup
            value: ${JSON.stringify(Array.isArray(recordValue) ? recordValue : [recordValue])} 
            state: absent
          register: route53_delete
        
        - name: Display deletion result
          debug:
            var: route53_delete`;
          break;
          
        case 'delete_zone':
          playbookContent += `
        - name: Delete Route53 hosted zone
          amazon.aws.route53_zone:
            region: "${region}"
            zone: "${zoneName}"
            state: absent
          register: route53_zone_delete
        
        - name: Display deletion result
          debug:
            var: route53_zone_delete`;
          break;
          
        default:
          throw new AnsibleError(`Unsupported Route53 action: ${action}`);
      }
      
      // Execute the generated playbook
      return executeAwsPlaybook(`route53-${action}`, playbookContent);
    }
  • Zod schema defining input validation for aws_route53 tool, including action enum and optional parameters for zones, records, etc.
    export const Route53Schema = z.object({
      action: Route53ActionEnum,
      region: z.string().min(1, 'AWS region is required'),
      zoneId: z.string().optional(),
      zoneName: z.string().optional(),
      recordName: z.string().optional(),
      recordType: z.string().optional(),
      recordTtl: z.number().optional(),
      recordValue: z.union([z.string(), z.array(z.string())]).optional(),
      recordState: z.string().optional(),
      comment: z.string().optional() // Added based on usage in aws.ts
    });
    
    export type Route53Options = z.infer<typeof Route53Schema>;
  • Tool registration in the toolDefinitions map, linking name 'aws_route53' to its schema and handler.
    aws_route53: {
      description: 'Manage AWS Route53 DNS records and zones',
      schema: aws.Route53Schema,
      handler: aws.route53Operations,
    },
  • Zod enum defining possible actions for the Route53 tool, used in the main Route53Schema.
    export const Route53ActionEnum = z.enum(['list_zones', 'list_records', 'create_zone', 'create_record', 'delete_record', 'delete_zone']);
    export type Route53Action = z.infer<typeof Route53ActionEnum>;
  • Shared helper function used by all AWS handlers (including route53Operations) to execute dynamically generated Ansible playbooks, handling temp files and cleanup.
    async function executeAwsPlaybook(
      operationName: string, 
      playbookContent: string, 
      extraParams: string = '',
      tempFiles: { filename: string, content: string }[] = [] // For additional files like templates, policies
    ): Promise<string> {
      let tempDir: string | undefined;
      try {
        // Create a unique temporary directory
        tempDir = await createTempDirectory(`ansible-aws-${operationName}`);
        
        // Write the main playbook file
        const playbookPath = await writeTempFile(tempDir, 'playbook.yml', playbookContent);
        
        // Write any additional temporary files
        for (const file of tempFiles) {
          await writeTempFile(tempDir, file.filename, file.content);
        }
    
        // Build the command
        const command = `ansible-playbook ${playbookPath} ${extraParams}`;
        console.error(`Executing: ${command}`);
    
        // Execute the playbook asynchronously
        const { stdout, stderr } = await execAsync(command);
        
        // Return stdout, or a success message if stdout is empty
        return stdout || `${operationName} completed successfully (no output).`;
    
      } catch (error: any) {
        // Handle execution errors
        const errorMessage = error.stderr || error.message || 'Unknown error';
        throw new AnsibleExecutionError(`Ansible execution failed for ${operationName}: ${errorMessage}`, error.stderr);
      } finally {
        // Ensure cleanup happens even if errors occur
        if (tempDir) {
          await cleanupTempDirectory(tempDir);
        }
      }
    }
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. It states the tool 'manages' DNS records and zones, implying both read and write operations, but doesn't specify permissions required, rate limits, whether deletions are permanent, or what the response format looks like. This is inadequate for a tool with multiple mutation actions like create and delete.

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 7 words, front-loading the core purpose with zero wasted words. Every element ('Manage AWS Route53 DNS records and zones') directly communicates essential information without redundancy.

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 tool with 10 parameters, multiple mutation actions, no annotations, and no output schema, the description is severely incomplete. It doesn't address authentication requirements, error conditions, return formats, or the scope of operations. The agent would struggle to use this tool effectively based solely on this description.

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

Parameters2/5

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

With 0% schema description coverage for 10 parameters, the description provides no information about parameters beyond what's implied by the tool name. It doesn't explain what 'action' values do, what 'recordState' means, or how parameters interact. The description fails to compensate for the complete lack of schema documentation.

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 tool's purpose as managing AWS Route53 DNS records and zones, providing specific verbs (manage) and resources (DNS records and zones). However, it doesn't differentiate this tool from its sibling AWS tools (like aws_ec2, aws_s3) beyond the Route53 service focus, which is why it doesn't reach 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. It doesn't mention when to choose aws_route53 over other AWS tools or non-AWS DNS management options, nor does it specify any prerequisites or contextual constraints for usage.

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

Related 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/tarnover/mcp-ansible'

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