Skip to main content
Glama

service_info

Retrieve detailed configuration, status, and health information for a specific service to monitor deployments and ensure proper functionality within your Railway infrastructure.

Instructions

[API] Get detailed information about a specific service

⚡️ Best for: ✓ Viewing service configuration and status ✓ Checking deployment details ✓ Monitoring service health

→ Prerequisites: service_list

→ Next steps: deployment_list, variable_list

→ Related: service_update, deployment_trigger

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
environmentIdYesID of the environment to check (usually obtained from service_list)
projectIdYesID of the project containing the service
serviceIdYesID of the service to get information about

Implementation Reference

  • Handler function that executes the 'service_info' tool logic by calling the service service's getServiceInfo method.
    async ({ projectId, serviceId, environmentId }) => {
      return serviceService.getServiceInfo(projectId, serviceId, environmentId);
    }
  • Zod input schema defining parameters for the 'service_info' tool.
    {
      projectId: z.string().describe("ID of the project containing the service"),
      serviceId: z.string().describe("ID of the service to get information about"),
      environmentId: z.string().describe("ID of the environment to check (usually obtained from service_list)")
    },
  • Tool definition and registration within the serviceTools array using createTool.
    createTool(
      "service_info",
      formatToolDescription({
        type: 'API',
        description: "Get detailed information about a specific service",
        bestFor: [
          "Viewing service configuration and status",
          "Checking deployment details",
          "Monitoring service health"
        ],
        relations: {
          prerequisites: ["service_list"],
          nextSteps: ["deployment_list", "variable_list"],
          related: ["service_update", "deployment_trigger"]
        }
      }),
      {
        projectId: z.string().describe("ID of the project containing the service"),
        serviceId: z.string().describe("ID of the service to get information about"),
        environmentId: z.string().describe("ID of the environment to check (usually obtained from service_list)")
      },
      async ({ projectId, serviceId, environmentId }) => {
        return serviceService.getServiceInfo(projectId, serviceId, environmentId);
      }
    ),
  • Backend service method getServiceInfo that fetches service instance and recent deployments, formats the information, and returns a success response.
      async getServiceInfo(projectId: string, serviceId: string, environmentId: string) {
        try {
          const [serviceInstance, deployments] = await Promise.all([
            this.client.services.getServiceInstance(serviceId, environmentId),
            this.client.deployments.listDeployments({ projectId, serviceId, environmentId, limit: 5 })
          ]);
    
          if (!serviceInstance) {
            return createErrorResponse(`Service instance not found.`);
          }
    
          const deploymentStatus = deployments.length > 0
            ? `\nLatest Deployment: ${deployments[0].status} (${deployments[0].id})`
            : '\nNo recent deployments';
    
          const info = `🚀 Service: ${serviceInstance.serviceName}
    ID: ${serviceInstance.serviceId}
    Region: ${serviceInstance.region || 'Not set'}
    Replicas: ${serviceInstance.numReplicas || 1}
    Root Directory: ${serviceInstance.rootDirectory || '/'}
    Build Command: ${serviceInstance.buildCommand || 'Not set'}
    Start Command: ${serviceInstance.startCommand || 'Not set'}
    Health Check Path: ${serviceInstance.healthcheckPath || 'Not set'}
    Sleep Mode: ${serviceInstance.sleepApplication ? 'Enabled' : 'Disabled'}${deploymentStatus}`;
    
          return createSuccessResponse({
            text: info,
            data: { serviceInstance, deployments }
          });
        } catch (error) {
          return createErrorResponse(`Error getting service details: ${formatError(error)}`);
        }
      }
  • Central registration function that collects all tools including serviceTools (containing service_info) and registers them with the MCP server.
    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
        );
      });
    } 

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