domain_delete
Delete a domain from a Railway service to remove unused domains and clean up configurations. Use for permanent domain removal, not temporary disabling.
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 (registration)Registration of the 'domain_delete' MCP tool, including description, input schema (domain ID), and handler function that calls domainService.deleteServiceDomain(id). This tool object is later registered to the MCP server.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/services/domain.service.ts:40-55 (handler)Helper function in domain service that performs the domain deletion by calling the repository's serviceDomainDelete and formats the MCP response.async 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 that executes the GraphQL mutation to delete the service domain via the Railway API.async 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; }
- src/tools/index.ts:16-37 (registration)Global registration function that imports domainTools (containing domain_delete) and registers all tools to the MCP server using server.tool().export 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 ); }); }