service_list
List all services in a Railway project to get an overview, find service IDs, and check service status.
Instructions
[API] List all services in a specific Railway project
⚡️ Best for: ✓ Getting an overview of a project's services ✓ Finding service IDs ✓ Checking service status
→ Prerequisites: project_list
→ Next steps: service_info, deployment_list
→ Related: project_info, variable_list
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | ID of the project to list services from |
Implementation Reference
- src/tools/service.tool.ts:7-29 (registration)Tool definition and local registration of 'service_list' tool using createTool, including formatted description, input schema (projectId), and inline handler function that delegates to serviceService.listServices.createTool( "service_list", // TODO: update this tool to also return the status of the service formatToolDescription({ type: 'API', description: "List all services in a specific Railway project", bestFor: [ "Getting an overview of a project's services", "Finding service IDs", "Checking service status", ], relations: { prerequisites: ["project_list"], nextSteps: ["service_info", "deployment_list"], related: ["project_info", "variable_list"] } }), { projectId: z.string().describe("ID of the project to list services from") }, async ({ projectId }) => { return serviceService.listServices(projectId); } ),
- src/tools/index.ts:16-37 (registration)Global registration of all tools to the MCP server, including serviceTools which contains the service_list tool, via server.tool(...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 ); }); }
- Core implementation of service listing logic in ServiceService.listServices, called by the service_list tool handler. Fetches services via API client, enriches with latest deployment status, and formats response.async listServices(projectId: string) { try { const services = await this.client.services.listServices(projectId); if (services.length === 0) { return createSuccessResponse({ text: "No services found in this project.", data: [] }); } // Get latest deployment status for each service const serviceDetails = await Promise.all(services.map(async (service: Service) => { try { const deployments = await this.client.deployments.listDeployments({ projectId, serviceId: service.id, limit: 1 }); const latestDeployment = deployments[0]; if (latestDeployment) { return `🚀 ${service.name} (ID: ${service.id}) Status: ${latestDeployment.status} URL: ${latestDeployment.url || 'Not deployed'}`; } return `🚀 ${service.name} (ID: ${service.id}) Status: No deployments`; } catch { return `🚀 ${service.name} (ID: ${service.id})`; } })); return createSuccessResponse({ text: `Services in project:\n\n${serviceDetails.join('\n\n')}`, data: services }); } catch (error) { return createErrorResponse(`Error listing services: ${formatError(error)}`); } }