Skip to main content
Glama

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

Implementation Reference

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

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/jason-tan-swe/railway-mcp'

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