renew_domain
Renew an existing domain registration using USDC payment via x402. Specify the domain and renewal period in years (1-10).
Instructions
Renew an existing domain registration. Requires USDC payment via x402.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| domain | Yes | Domain to renew (e.g., 'myproject.com') | |
| years | No | Renewal period in years (1-10, default: 1) |
Implementation Reference
- src/tools/renew.ts:15-61 (handler)The main handler function for the renew_domain tool. Posts to /domains/renew, handles async provisioning via job polling, and formats the result.
export async function renewDomain( client: BloomfilterClient, params: { domain: string; years?: number }, ): Promise<McpToolResult> { const keyError = client.requiresPrivateKey(); if (keyError) return keyError; try { await client.ensureAuth(); const response = await client.http.post<RenewalResponse>( "/domains/renew", { domain: params.domain, years: params.years ?? 1 }, { headers: client.getAuthHeaders() }, ); let result = response.data; // Async provisioning — poll until complete if (response.status === 202 && result.jobId) { console.error(`[bloomfilter-mcp] Renewal queued (job ${result.jobId}), polling...`); const jobResult = await client.pollJobStatus(result.jobId); if (jobResult.result) { result = jobResult.result as RenewalResponse; } } // Format the result const lines = [`Domain renewed: ${result.domain}`]; if (result.newExpiresAt) { lines.push(`New Expiry: ${result.newExpiresAt}`); } if (result.payment) { lines.push(`Cost: $${result.payment.amountUsd}`); if (result.payment.txHash) { lines.push(`Transaction: ${result.payment.txHash}`); } lines.push(`Network: ${result.payment.network}`); } return { content: [{ type: "text", text: lines.join("\n") }] }; } catch (error) { return formatToolError(error); } } - src/types.ts:102-113 (schema)The RenewalResponse type that defines the shape of the API response for domain renewal.
export interface RenewalResponse { domain: string; renewedAt?: string; newExpiresAt?: string; jobId?: string; payment?: { amountUsd: string; txHash?: string; network: string; settled: boolean; }; } - src/index.ts:134-149 (registration)Registration of the 'renew_domain' tool with the MCP server, defining its description, input schema (domain, years), and handler binding.
// 5. renew_domain server.tool( "renew_domain", "Renew an existing domain registration. Requires USDC payment via x402.", { domain: z.string().describe("Domain to renew (e.g., 'myproject.com')"), years: z .number() .int() .min(1) .max(10) .optional() .describe("Renewal period in years (1-10, default: 1)"), }, async (params) => renewDomain(client, params), );