dynadot_order
Manage domain orders and reseller operations with Dynadot, including checking order status, listing coupons, and verifying reseller WHOIS information.
Instructions
Orders, coupons, processing status, reseller operations
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| action | Yes | Action to perform: list: List recent orders | status: Get order status | is_processing: Check if operations pending | coupons: List available coupons | reseller_verification: Set reseller WHOIS verification status | |
| orderId | No | Order ID | |
| contactId | No | Contact ID | |
| status | No |
Implementation Reference
- src/schema.ts:1092-1127 (schema)Schema definition for the 'dynadot_order' tool, specifying description, actions (list, status, is_processing, coupons, reseller_verification), their commands, params, and transforms.{ name: 'dynadot_order', description: 'Orders, coupons, processing status, reseller operations', actions: { list: { command: 'order_list', description: 'List recent orders', }, status: { command: 'get_order_status', description: 'Get order status', params: z.object({ orderId: p.orderId }), transform: (_, input) => ({ order_id: input.orderId as string }), }, is_processing: { command: 'is_processing', description: 'Check if operations pending', }, coupons: { command: 'list_coupons', description: 'List available coupons', }, reseller_verification: { command: 'set_reseller_contact_whois_verification_status', description: 'Set reseller WHOIS verification status', params: z.object({ contactId: p.contactId, status: z.enum(['verified', 'unverified']), }), transform: (_, input) => ({ contact_id: input.contactId as string, status: input.status as string, }), }, }, },
- src/register.ts:42-62 (handler)Handler function for composite tools including 'dynadot_order': determines action, transforms parameters if needed, executes the corresponding Dynadot API command via client, and returns JSON-formatted result.async (input) => { const action = input.action as string; const actionDef = tool.actions[action]; if (!actionDef) { throw new Error(`Unknown action: ${action}. Valid actions: ${actionKeys.join(', ')}`); } const client = getClient(); const params = actionDef.transform ? actionDef.transform(action, input as Record<string, unknown>) : (input as ApiParams); // Remove 'action' from params sent to API delete params.action; const result = await client.execute(actionDef.command, params); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; }
- src/register.ts:6-65 (registration)Registers the 'dynadot_order' tool (and other composite tools) with the MCP server, dynamically building input schema from actions and attaching the generic handler.export function registerAllTools(server: McpServer): void { for (const tool of compositeTools) { // Build action enum from keys const actionKeys = Object.keys(tool.actions) as [string, ...string[]]; // Build combined input schema with action + all possible params const actionDescriptions = actionKeys .map((k) => { const actionDef = tool.actions[k]; return actionDef ? `${k}: ${actionDef.description}` : k; }) .join(' | '); const inputSchema: Record<string, z.ZodTypeAny> = { action: z.enum(actionKeys).describe(`Action to perform: ${actionDescriptions}`), }; // Collect all unique params across actions for (const action of Object.values(tool.actions)) { if (action?.params) { const shape = action.params.shape; for (const [key, schema] of Object.entries(shape)) { if (!inputSchema[key]) { // Make optional since not all actions need all params inputSchema[key] = (schema as z.ZodTypeAny).optional(); } } } } server.registerTool( tool.name, { description: tool.description, inputSchema, }, async (input) => { const action = input.action as string; const actionDef = tool.actions[action]; if (!actionDef) { throw new Error(`Unknown action: ${action}. Valid actions: ${actionKeys.join(', ')}`); } const client = getClient(); const params = actionDef.transform ? actionDef.transform(action, input as Record<string, unknown>) : (input as ApiParams); // Remove 'action' from params sent to API delete params.action; const result = await client.execute(actionDef.command, params); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }], }; } ); } }
- src/client.ts:116-134 (helper)Core API execution method called by handlers: sends command and params to Dynadot API, handles authentication, retries, and errors.async execute(command: string, params: ApiParams = {}): Promise<ApiResponse> { const searchParams = new URLSearchParams(); searchParams.set('key', this.apiKey); searchParams.set('command', command); for (const [key, value] of Object.entries(params)) { if (value !== undefined) { searchParams.set(key, String(value)); } } const response = await this.client.get('api3.json', { searchParams }).json<ApiResponse>(); if (response.Status === 'error') { throw new Error(`Dynadot API error: ${response.Error || 'Unknown error'}`); } return response; }