domain_update
Update domain configuration settings like target ports and endpoints for Railway.app infrastructure management.
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:94-121 (registration)Creates the 'domain_update' tool with description, Zod schema, and handler using createTool. This tool object is later registered to the MCP server.createTool( "domain_update", formatToolDescription({ type: 'API', description: "Update a domain's configuration", bestFor: [ "Changing target ports", "Updating domain settings", "Reconfiguring endpoints" ], notFor: [ "Changing domain names (delete and recreate instead)", "TCP proxy configuration" ], relations: { prerequisites: ["domain_list"], nextSteps: ["domain_list"], related: ["service_update"] } }), { id: z.string().describe("ID of the domain to update"), targetPort: z.number().describe("New port number to route traffic to") }, async ({ id, targetPort }) => { return domainService.updateServiceDomain({ id, targetPort }); } ),
- src/tools/index.ts:16-37 (registration)Aggregates all tools including domainTools (containing domain_update) and registers them 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/tools/domain.tool.ts:118-120 (handler)MCP tool handler for 'domain_update': extracts id and targetPort from args and delegates to domainService.updateServiceDomain.async ({ id, targetPort }) => { return domainService.updateServiceDomain({ id, targetPort }); }
- src/services/domain.service.ts:61-76 (handler)Service layer implementation of domain update: calls Railway client API, handles success/error responses, and returns formatted CallToolResult.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 defining ServiceDomainUpdateInput used by the service layer for domain_update.export interface ServiceDomainUpdateInput { /** ID of the domain to update */ id: string; /** New target port for the domain */ targetPort: number; }