domain_update
Modify domain configurations on railway-mcp to update target ports, adjust settings, or reconfigure endpoints. Requires domain ID and new port number for execution.
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 core logic of the domain_update tool by invoking the domain service's update method with the provided domain ID and target port.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 (string) and new target port (number).{ id: z.string().describe("ID of the domain to update"), targetPort: z.number().describe("New port number to route traffic to") },
- src/tools/domain.tool.ts:94-121 (registration)The createTool call that defines, configures, and registers the domain_update tool within the domainTools array, including its name, description, schema, and handler.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/services/domain.service.ts:61-76 (helper)Helper service method that wraps the repository call, handles errors, and formats responses for domain updates.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)}`); } }
- Repository helper that executes the GraphQL mutation to perform the service domain update on the Railway API.async serviceDomainUpdate(input: ServiceDomainUpdateInput): Promise<boolean> { const query = ` mutation serviceDomainUpdate($input: ServiceDomainUpdateInput!) { serviceDomainUpdate(input: $input) } `; const variables = { input }; const response = await this.client.request<{ serviceDomainUpdate: boolean }>(query, variables); return response.serviceDomainUpdate; }