domain_update
Update a domain's configuration to change target ports or modify routing settings for Railway.app infrastructure.
Instructions
[API] Update a domain's configuration
⚡️ Best for: ✓ Changing target ports ✓ Updating domain settings ✓ Reconfiguring endpoints
⚠️ Not for: × Changing domain names (delete and recreate instead) × TCP proxy configuration
→ Prerequisites: domain_list
→ Next steps: domain_list
→ Related: service_update
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | ID of the domain to update | |
| targetPort | Yes | New port number to route traffic to |
Implementation Reference
- src/tools/domain.tool.ts:118-120 (handler)The handler function that executes the domain_update tool logic by calling the domain service's update method.async ({ id, targetPort }) => { return domainService.updateServiceDomain({ id, targetPort }); }
- src/tools/domain.tool.ts:114-117 (schema)Zod schema defining the input parameters for the domain_update tool: domain ID and target port.{ id: z.string().describe("ID of the domain to update"), targetPort: z.number().describe("New port number to route traffic to") },
- src/tools/index.ts:16-37 (registration)Function that registers all tools, including domain_update from domainTools, 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 ); }); }
- src/services/domain.service.ts:61-76 (helper)Helper function in domain service that handles the actual API call to update service domain and formats the response.async updateServiceDomain(input: ServiceDomainUpdateInput): Promise<CallToolResult> { try { const result = await this.client.domains.serviceDomainUpdate(input); if (result) { return createSuccessResponse({ text: `Domain with ID ${input.id} updated successfully with new target port: ${input.targetPort}`, data: { success: true } }); } else { return createErrorResponse(`Failed to update domain with ID ${input.id}`); } } catch (error) { return createErrorResponse(`Error updating domain: ${formatError(error)}`); } }
- src/types.ts:257-262 (schema)TypeScript interface used by the service layer for domain update inputs.export interface ServiceDomainUpdateInput { /** ID of the domain to update */ id: string; /** New target port for the domain */ targetPort: number; }