Skip to main content
Glama
fredriksknese

mcp-infoblox

create_host_record

Create DNS host records in Infoblox by combining A and PTR records, with options for auto-assigning IP addresses and configuring DHCP settings.

Instructions

Create a DNS Host record in Infoblox. Host records combine A and PTR records. Use 'func:nextavailableip:<network_ref>' as ipv4addr to auto-assign the next available IP.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesFQDN for the host record
ipv4addrsNoIPv4 addresses for the host
ipv6addrsNoIPv6 addresses for the host
viewNoDNS view
ttlNoTTL in seconds
commentNoComment for the record
configure_for_dnsNoConfigure for DNS

Implementation Reference

  • The handler function for 'create_host_record' tool that builds a data object from input parameters and calls client.create('record:host', data) to create the DNS host record in Infoblox. Returns success message with reference or error message.
    async ({
      name,
      ipv4addrs,
      ipv6addrs,
      view,
      ttl,
      comment,
      configure_for_dns,
    }) => {
      const data: Record<string, unknown> = { name };
      if (ipv4addrs) data.ipv4addrs = ipv4addrs;
      if (ipv6addrs) data.ipv6addrs = ipv6addrs;
      if (view) data.view = view;
      if (ttl !== undefined) {
        data.ttl = ttl;
        data.use_ttl = true;
      }
      if (comment) data.comment = comment;
      if (configure_for_dns !== undefined)
        data.configure_for_dns = configure_for_dns;
    
      try {
        const ref = await client.create("record:host", data);
        return toolResult(
          `Host record created successfully.\nReference: ${ref}`,
        );
      } catch (error) {
        return toolResult(
          `Error creating host record: ${error}`,
          true,
        );
      }
    },
  • Zod schema definition for 'create_host_record' tool inputs including name (FQDN), ipv4addrs array (with ipv4addr, optional mac, configure_for_dhcp), ipv6addrs array, view, ttl, comment, and configure_for_dns parameters.
    {
      name: z.string().describe("FQDN for the host record"),
      ipv4addrs: z
        .array(
          z.object({
            ipv4addr: z
              .string()
              .describe(
                "IPv4 address, or 'func:nextavailableip:<network_ref>' for auto-assign",
              ),
            mac: z
              .string()
              .optional()
              .describe("MAC address for DHCP"),
            configure_for_dhcp: z
              .boolean()
              .optional()
              .describe("Enable DHCP for this address"),
          }),
        )
        .optional()
        .describe("IPv4 addresses for the host"),
      ipv6addrs: z
        .array(
          z.object({
            ipv6addr: z.string().describe("IPv6 address"),
          }),
        )
        .optional()
        .describe("IPv6 addresses for the host"),
      view: z.string().optional().describe("DNS view"),
      ttl: z.number().optional().describe("TTL in seconds"),
      comment: z.string().optional().describe("Comment for the record"),
      configure_for_dns: z
        .boolean()
        .optional()
        .default(true)
        .describe("Configure for DNS"),
    },
  • Complete registration of 'create_host_record' tool using server.tool() with name, description, Zod schema, and async handler function.
    server.tool(
      "create_host_record",
      "Create a DNS Host record in Infoblox. Host records combine A and PTR records. Use 'func:nextavailableip:<network_ref>' as ipv4addr to auto-assign the next available IP.",
      {
        name: z.string().describe("FQDN for the host record"),
        ipv4addrs: z
          .array(
            z.object({
              ipv4addr: z
                .string()
                .describe(
                  "IPv4 address, or 'func:nextavailableip:<network_ref>' for auto-assign",
                ),
              mac: z
                .string()
                .optional()
                .describe("MAC address for DHCP"),
              configure_for_dhcp: z
                .boolean()
                .optional()
                .describe("Enable DHCP for this address"),
            }),
          )
          .optional()
          .describe("IPv4 addresses for the host"),
        ipv6addrs: z
          .array(
            z.object({
              ipv6addr: z.string().describe("IPv6 address"),
            }),
          )
          .optional()
          .describe("IPv6 addresses for the host"),
        view: z.string().optional().describe("DNS view"),
        ttl: z.number().optional().describe("TTL in seconds"),
        comment: z.string().optional().describe("Comment for the record"),
        configure_for_dns: z
          .boolean()
          .optional()
          .default(true)
          .describe("Configure for DNS"),
      },
      async ({
        name,
        ipv4addrs,
        ipv6addrs,
        view,
        ttl,
        comment,
        configure_for_dns,
      }) => {
        const data: Record<string, unknown> = { name };
        if (ipv4addrs) data.ipv4addrs = ipv4addrs;
        if (ipv6addrs) data.ipv6addrs = ipv6addrs;
        if (view) data.view = view;
        if (ttl !== undefined) {
          data.ttl = ttl;
          data.use_ttl = true;
        }
        if (comment) data.comment = comment;
        if (configure_for_dns !== undefined)
          data.configure_for_dns = configure_for_dns;
    
        try {
          const ref = await client.create("record:host", data);
          return toolResult(
            `Host record created successfully.\nReference: ${ref}`,
          );
        } catch (error) {
          return toolResult(
            `Error creating host record: ${error}`,
            true,
          );
        }
      },
    );
  • Helper function toolResult() that formats the tool response with content array and optional error flag.
    function toolResult(text: string, isError = false) {
      return { content: [{ type: "text" as const, text }], isError };
    }

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