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
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | FQDN for the A record (e.g., host.example.com) | |
| ipv4addr | Yes | IPv4 address for the record | |
| view | No | DNS view (defaults to 'default') | |
| ttl | No | TTL in seconds | |
| comment | No | Comment for the record | |
| disable | No | Create in disabled state |
Implementation Reference
- src/tools/dns.ts:167-183 (handler)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); } }, - src/tools/dns.ts:150-166 (schema)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"), }, - src/tools/dns.ts:147-184 (registration)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); } }, ); - src/tools/dns.ts:30-32 (helper)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 }; } - src/infoblox-client.ts:79-84 (helper)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>; }