domain_delete
Remove a domain from a service using the API in Railway MCP. Use this tool to delete unused domains and clean up configurations. Requires the domain ID for operation.
Instructions
[API] Delete a domain from a service
⚡️ Best for: ✓ Removing unused domains ✓ Cleaning up configurations ✓ Domain management
⚠️ Not for: × Temporary domain disabling × Port updates (use domain_update)
→ Prerequisites: domain_list
→ Alternatives: domain_update
→ Related: service_update
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the domain to delete |
Implementation Reference
- src/tools/domain.tool.ts:123-149 (handler)Primary implementation of the domain_delete tool: includes description, input schema, and handler function that delegates to domainService.deleteServiceDomain(id)createTool( "domain_delete", formatToolDescription({ type: 'API', description: "Delete a domain from a service", bestFor: [ "Removing unused domains", "Cleaning up configurations", "Domain management" ], notFor: [ "Temporary domain disabling", "Port updates (use domain_update)" ], relations: { prerequisites: ["domain_list"], alternatives: ["domain_update"], related: ["service_update"] } }), { id: z.string().describe("ID of the domain to delete") }, async ({ id }) => { return domainService.deleteServiceDomain(id); } )
- src/tools/domain.tool.ts:143-145 (schema)Zod input schema for the domain_delete tool requiring the domain ID{ id: z.string().describe("ID of the domain to delete") },
- src/tools/index.ts:16-37 (registration)Registers all tool sets to the MCP server, including domainTools which contains domain_deleteexport function registerAllTools(server: McpServer) { // Collect all tools const allTools = [ ...databaseTools, ...deploymentTools, ...domainTools, ...projectTools, ...serviceTools, ...tcpProxyTools, ...variableTools, ...configTools, ...volumeTools, ...templateTools, ] as Tool[]; // Register each tool with the server allTools.forEach((tool) => { server.tool( ...tool ); }); }
- src/services/domain.service.ts:40-55 (helper)Service layer wrapper for deleting a service domain, calls repository serviceDomainDelete and formats responseasync deleteServiceDomain(id: string): Promise<CallToolResult> { try { const result = await this.client.domains.serviceDomainDelete(id); if (result) { return createSuccessResponse({ text: `Domain with ID ${id} deleted successfully`, data: { success: true } }); } else { return createErrorResponse(`Failed to delete domain with ID ${id}`); } } catch (error) { return createErrorResponse(`Error deleting domain: ${formatError(error)}`); } }
- Repository method executing the GraphQL mutation to delete the service domainasync serviceDomainDelete(id: string): Promise<boolean> { const query = ` mutation serviceDomainDelete($id: String!) { serviceDomainDelete(id: $id) } `; const variables = { id }; const response = await this.client.request<{ serviceDomainDelete: boolean }>(query, variables); return response.serviceDomainDelete; }