list-services
Display all services in your current Railway project to manage deployments and configurations.
Instructions
List all services for the currently linked Railway project
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| workspacePath | Yes | The path to the workspace to list services from |
Implementation Reference
- src/tools/list-services.ts:15-55 (handler)The main handler function that executes the list-services tool logic, calling getRailwayServices and formatting success/error responses.handler: async ({ workspacePath }: GetServicesOptions) => { try { const result = await getRailwayServices({ workspacePath }); if (!result.success) { throw new Error(result.error); } const services = result.services || []; if (services.length === 0) { return createToolResponse( "ℹ️ No services found for the currently linked Railway project.\n\n" + "**Next Steps:**\n" + "• Ensure you have a project linked (`railway link`)\n" + "• Check that your project has services created\n" + "• Create a new service through the Railway dashboard or CLI", ); } const formattedList = services .map((service, index) => `${index + 1}. **${service}**`) .join("\n"); return createToolResponse( `✅ Found ${services.length} service(s) in the linked Railway project:\n\n${formattedList}\n\n**Note:** To link to a specific service, use the \`link-service\` tool.`, ); } catch (error: unknown) { const errorMessage = error instanceof Error ? error.message : "Unknown error occurred"; return createToolResponse( "❌ Failed to list Railway services\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 services\n" + "• Try running `railway login` to refresh your authentication", ); } },
- src/tools/list-services.ts:10-14 (schema)Zod input schema defining the workspacePath parameter for the tool.inputSchema: { workspacePath: z .string() .describe("The path to the workspace to list services from"), },
- src/index.ts:21-31 (registration)Registration of all tools (including list-services) into the MCP server via dynamic loop over tools object.Object.values(tools).forEach((tool) => { server.registerTool( tool.name, { title: tool.title, description: tool.description, inputSchema: tool.inputSchema, }, tool.handler, ); });
- src/tools/index.ts:12-12 (registration)Export of the listServicesTool making it available for import in src/index.ts.export { listServicesTool } from "./list-services";