get_pricing
Retrieve domain registration, renewal, and transfer pricing for any TLD. Specify a TLD like 'com' for specific rates, or omit to get pricing for all available TLDs.
Instructions
Get domain registration, renewal, and transfer pricing. Omit tld for all TLDs, or specify one.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tld | No | Specific TLD to get pricing for (e.g., 'com', 'io'). Omit for all TLDs. |
Implementation Reference
- src/tools/pricing.ts:12-60 (handler)Main handler function for the get_pricing tool. Calls GET /domains/pricing or GET /domains/pricing/:tld, formats the response into a human-readable table (single TLD or all TLDs).
export async function getPricing( client: BloomfilterClient, params: { tld?: string }, ): Promise<McpToolResult> { try { const url = params.tld ? `/domains/pricing/${encodeURIComponent(params.tld)}` : "/domains/pricing"; const { data } = await client.http.get(url); // Single TLD if (params.tld) { const p = data as TldPricing; const text = [ `Pricing for .${p.tld}:`, ` Registration: $${p.registration_price_usd}`, ` Renewal: $${p.renewal_price_usd}`, ` Transfer: $${p.transfer_price_usd}`, ].join("\n"); return { content: [{ type: "text", text }] }; } // All TLDs const pricing = (Array.isArray(data) ? data : (data.pricing ?? [])) as TldPricing[]; if (pricing.length === 0) { return { content: [{ type: "text", text: "No pricing data available." }] }; } const header = "TLD Registration Renewal Transfer"; const divider = "\u2500".repeat(header.length); const rows = pricing.map((p) => { const tld = `.${p.tld}`.padEnd(11); const reg = `$${p.registration_price_usd}`.padEnd(15); const renew = `$${p.renewal_price_usd}`.padEnd(15); const transfer = `$${p.transfer_price_usd}`; return `${tld}${reg}${renew}${transfer}`; }); const text = `Domain Pricing:\n\n${header}\n${divider}\n${rows.join("\n")}`; return { content: [{ type: "text", text }] }; } catch (error) { return formatToolError(error); } } - src/types.ts:63-68 (schema)Type definition for TldPricing, used to type the pricing data returned from the API.
export interface TldPricing { tld: string; registration_price_usd: string; renewal_price_usd: string; transfer_price_usd: string; } - src/types.ts:70-73 (schema)PricingResponse type, representing the response shape when querying pricing for all TLDs.
export interface PricingResponse { tld?: string; pricing: TldPricing | TldPricing[]; } - src/index.ts:94-105 (registration)Registers the get_pricing tool with the MCP server, including schema (optional tld string) and handler binding.
// 2. get_pricing server.tool( "get_pricing", "Get domain registration, renewal, and transfer pricing. Omit tld for all TLDs, or specify one.", { tld: z .string() .optional() .describe("Specific TLD to get pricing for (e.g., 'com', 'io'). Omit for all TLDs."), }, async (params) => getPricing(client, params), ); - src/tools/pricing.ts:8-10 (helper)Imports used by the getPricing handler: BloomfilterClient, formatToolError, McpToolResult, and TldPricing.
import type { BloomfilterClient } from "../client.js"; import { formatToolError } from "../client.js"; import type { McpToolResult, TldPricing } from "../types.js";