Skip to main content
Glama
railwayapp

Railway MCP Server

Official
by railwayapp

List Railway Deployments

list-deployments

Retrieve deployment history for a Railway service, showing IDs, statuses, and metadata to monitor application updates and track changes.

Instructions

List deployments for a Railway service with IDs, statuses and other metadata. Requires Railway CLI v4.10.0+.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
workspacePathYesThe path to the workspace to list deployments from
serviceNoService name or ID to list deployments for (defaults to linked service)
environmentNoEnvironment to list deployments from (defaults to linked environment)
limitNoMaximum number of deployments to show (default: 20, max: 1000)
jsonNoReturn deployments as structured JSON data. When true, the output will contain ids, statuses, and other metadata

Implementation Reference

  • The tool's handler function. It calls the listDeployments helper with provided options, handles success/error responses, and returns formatted tool output using createToolResponse.
    handler: async (options: ListDeploymentsOptions) => {
      try {
        const result = await listDeployments(options);
    
        if (!result.success) {
          throw new Error(result.error);
        }
    
        return createToolResponse(result.output);
      } catch (error: unknown) {
        const errorMessage =
          error instanceof Error ? error.message : "Unknown error occurred";
        return createToolResponse(
          "❌ Failed to list Railway deployments\n\n" +
            `**Error:** ${errorMessage}\n\n` +
            "**Next Steps:**\n" +
            "• Ensure you are logged into Railway CLI (`railway login`)\n" +
            "• Check that you have a project linked (`railway link`)\n" +
            "• Verify you have permissions to view deployments\n" +
            "• Try running `railway login` to refresh your authentication"
        );
      }
    },
  • Zod input schema defining validation and descriptions for tool parameters: workspacePath, service, environment, limit, json.
    inputSchema: {
      workspacePath: z
        .string()
        .describe("The path to the workspace to list deployments from"),
      service: z
        .string()
        .optional()
        .describe(
          "Service name or ID to list deployments for (defaults to linked service)"
        ),
      environment: z
        .string()
        .optional()
        .describe(
          "Environment to list deployments from (defaults to linked environment)"
        ),
      limit: z
        .number()
        .min(1)
        .max(1000)
        .default(20)
        .optional()
        .describe(
          "Maximum number of deployments to show (default: 20, max: 1000)"
        ),
      json: z
        .boolean()
        .default(false)
        .optional()
        .describe(
          "Return deployments as structured JSON data. When true, the output will contain ids, statuses, and other metadata"
        ),
    },
  • src/index.ts:21-31 (registration)
    Dynamic registration loop that registers all exported tools (including 'list-deployments') with the MCP server using name, metadata (title, description, inputSchema), and handler.
    Object.values(tools).forEach((tool) => {
    	server.registerTool(
    		tool.name,
    		{
    			title: tool.title,
    			description: tool.description,
    			inputSchema: tool.inputSchema,
    		},
    		tool.handler,
    	);
    });
  • Supporting helper function that constructs and executes the 'railway deployment list' CLI command with input options, checks CLI version support, handles project linking and errors, returning success/output or error.
    export const listDeployments = async ({
      workspacePath,
      service,
      environment,
      limit = 20,
      json = false,
    }: ListDeploymentsOptions): Promise<
      | {
          success: true;
          output: string;
        }
      | {
          success: false;
          error: string;
        }
    > => {
      try {
        await checkRailwayCliStatus();
    
        const featureSupport = await getCliFeatureSupport();
        if (!featureSupport.deployment.list) {
          const version = await getRailwayVersion();
          return {
            success: false,
            error: `Railway CLI version ${
              version || "unknown"
            } does not support 'deployment list' command. Please upgrade to version 4.10.0 or later.`,
          };
        }
    
        const projectResult = await getLinkedProjectInfo({ workspacePath });
        if (!projectResult.success) {
          return {
            success: false,
            error: projectResult.error ?? "Failed to get project info",
          };
        }
    
        let command = "railway deployment list";
    
        if (service) {
          command += ` --service ${service}`;
        }
    
        if (environment) {
          command += ` --environment ${environment}`;
        }
    
        if (limit) {
          command += ` --limit ${limit}`;
        }
    
        if (json) {
          command += " --json";
        }
    
        const { output } = await runRailwayCommand(command, workspacePath);
        return { success: true, output };
      } catch (error: unknown) {
        return analyzeRailwayError(error, `railway deployment list`);
      }
    };
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions a CLI version requirement, which is useful context, but does not disclose other behavioral traits such as whether this is a read-only operation, potential rate limits, authentication needs, or what happens if parameters are invalid. The description lacks details on output format or pagination behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded with the core purpose in the first sentence, and the second sentence adds essential prerequisite information without redundancy. Every sentence earns its place, making it appropriately sized and efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (5 parameters, no output schema, no annotations), the description is minimally adequate. It covers the purpose and a prerequisite but lacks details on behavioral traits, output format, or error handling. Without annotations or output schema, more context would improve completeness for a listing tool with multiple parameters.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all parameters thoroughly. The description adds no additional meaning beyond what the schema provides, such as explaining parameter interactions or default behaviors. Baseline 3 is appropriate as the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('List deployments') and the resource ('for a Railway service'), specifying what information is returned ('IDs, statuses and other metadata'). It distinguishes this from sibling tools like 'deploy' or 'get-logs' by focusing on listing rather than creating or retrieving logs.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage by specifying a prerequisite ('Requires Railway CLI v4.10.0+'), but it does not explicitly state when to use this tool versus alternatives like 'list-services' or 'list-projects'. No exclusions or specific contexts for usage are provided beyond the CLI version requirement.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/railwayapp/railway-mcp-server'

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