Skip to main content
Glama

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
NameRequiredDescriptionDefault
idYesID of the domain to update
targetPortYesNew port number to route traffic to

Implementation Reference

  • 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 });
    }
  • 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")
    },
  • 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
        );
      });
    } 
  • 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)}`);
      }
    }
  • 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;
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/epitaphe360/railway-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server