Skip to main content
Glama
fredriksknese

mcp-infoblox

create_a_record

Create DNS A records in Infoblox by specifying hostnames and IPv4 addresses to map domain names to IP addresses for network resolution.

Instructions

Create a DNS A record in Infoblox

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesFQDN for the A record (e.g., host.example.com)
ipv4addrYesIPv4 address for the record
viewNoDNS view (defaults to 'default')
ttlNoTTL in seconds
commentNoComment for the record
disableNoCreate in disabled state

Implementation Reference

  • Handler function that creates a DNS A record by constructing data object with name, ipv4addr, and optional fields (view, ttl, comment, disable), then calls client.create() and returns success/error result
    async ({ name, ipv4addr, view, ttl, comment, disable }) => {
      const data: Record<string, unknown> = { name, ipv4addr };
      if (view) data.view = view;
      if (ttl !== undefined) {
        data.ttl = ttl;
        data.use_ttl = true;
      }
      if (comment) data.comment = comment;
      if (disable) data.disable = disable;
    
      try {
        const ref = await client.create("record:a", data);
        return toolResult(`A record created successfully.\nReference: ${ref}`);
      } catch (error) {
        return toolResult(`Error creating A record: ${error}`, true);
      }
    },
  • Zod schema defining input validation for create_a_record tool with fields: name (required string), ipv4addr (required string), view (optional string), ttl (optional number), comment (optional string), and disable (optional boolean, defaults to false)
    {
      name: z
        .string()
        .describe("FQDN for the A record (e.g., host.example.com)"),
      ipv4addr: z.string().describe("IPv4 address for the record"),
      view: z
        .string()
        .optional()
        .describe("DNS view (defaults to 'default')"),
      ttl: z.number().optional().describe("TTL in seconds"),
      comment: z.string().optional().describe("Comment for the record"),
      disable: z
        .boolean()
        .optional()
        .default(false)
        .describe("Create in disabled state"),
    },
  • Complete tool registration using server.tool() with name "create_a_record", description, schema, and handler function. This is called within registerDnsTools function.
    server.tool(
      "create_a_record",
      "Create a DNS A record in Infoblox",
      {
        name: z
          .string()
          .describe("FQDN for the A record (e.g., host.example.com)"),
        ipv4addr: z.string().describe("IPv4 address for the record"),
        view: z
          .string()
          .optional()
          .describe("DNS view (defaults to 'default')"),
        ttl: z.number().optional().describe("TTL in seconds"),
        comment: z.string().optional().describe("Comment for the record"),
        disable: z
          .boolean()
          .optional()
          .default(false)
          .describe("Create in disabled state"),
      },
      async ({ name, ipv4addr, view, ttl, comment, disable }) => {
        const data: Record<string, unknown> = { name, ipv4addr };
        if (view) data.view = view;
        if (ttl !== undefined) {
          data.ttl = ttl;
          data.use_ttl = true;
        }
        if (comment) data.comment = comment;
        if (disable) data.disable = disable;
    
        try {
          const ref = await client.create("record:a", data);
          return toolResult(`A record created successfully.\nReference: ${ref}`);
        } catch (error) {
          return toolResult(`Error creating A record: ${error}`, true);
        }
      },
    );
  • Helper utility function that formats tool results in MCP format with content array and error flag
    function toolResult(text: string, isError = false) {
      return { content: [{ type: "text" as const, text }], isError };
    }
  • InfobloxClient.create method that makes POST request to Infoblox API to create objects, used by the handler to create A records
    async create(
      objectType: string,
      data: Record<string, unknown>,
    ): Promise<string> {
      return this.request("POST", objectType, data) as Promise<string>;
    }

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/fredriksknese/mcp-infoblox'

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