Skip to main content
Glama
fkom13

MCP SFTP Orchestrator

by fkom13

Obtenir le statut des services d'un VPS

get_services_status

Check the operational status of systemd, Docker, and PM2 services on a remote server to monitor system health and identify potential issues.

Instructions

Récupère le statut de tous les services connus (systemd, Docker, PM2) sur un serveur.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aliasYesAlias du serveur cible.

Implementation Reference

  • The main handler function for the 'get_services_status' tool. It queues an SSH job to execute commands that check running systemd services, Docker containers (docker ps), and PM2 processes (pm2 list), waits for the job to complete, parses the output using ssh.parseServicesStatus, and returns the structured services status as JSON.
    async (params) => {
        try {
            const cmd = "systemctl --type=service --state=running --no-pager ; echo '---DOCKER---' ; docker ps --format '{{.Names}}: {{.Status}}' ; echo '---PM2---' ; pm2 list";
            const job = queue.addJob({
                type: 'ssh',
                alias: params.alias,
                cmd: cmd
            });
            ssh.executeCommand(job.id);
            const result = await waitForJobCompletion(job.id, config.syncTimeout);
    
            if (!result || result.status !== 'completed') {
                throw new Error(result ? result.error : `Timeout de la commande de monitoring pour ${params.alias}`);
            }
    
            const parsedOutput = ssh.parseServicesStatus(result.output);
            return { content: [{ type: "text", text: JSON.stringify(parsedOutput, null, 2) }] };
        } catch (e) {
            const errorPayload = {
                toolName: "get_services_status",
                errorCode: "MONITORING_ERROR",
                errorMessage: e.message
            };
            return { content: [{ type: "text", text: JSON.stringify(errorPayload, null, 2) }], isError: true };
        }
    }
  • server.js:266-301 (registration)
    Registration of the 'get_services_status' tool with the MCP server, specifying the tool name, metadata (title, description), input schema, and handler function.
    server.registerTool(
        "get_services_status",
        {
            title: "Obtenir le statut des services d'un VPS",
            description: "Récupère le statut de tous les services connus (systemd, Docker, PM2) sur un serveur.",
            inputSchema: z.object({
                alias: z.string().describe("Alias du serveur cible.")
            })
        },
        async (params) => {
            try {
                const cmd = "systemctl --type=service --state=running --no-pager ; echo '---DOCKER---' ; docker ps --format '{{.Names}}: {{.Status}}' ; echo '---PM2---' ; pm2 list";
                const job = queue.addJob({
                    type: 'ssh',
                    alias: params.alias,
                    cmd: cmd
                });
                ssh.executeCommand(job.id);
                const result = await waitForJobCompletion(job.id, config.syncTimeout);
    
                if (!result || result.status !== 'completed') {
                    throw new Error(result ? result.error : `Timeout de la commande de monitoring pour ${params.alias}`);
                }
    
                const parsedOutput = ssh.parseServicesStatus(result.output);
                return { content: [{ type: "text", text: JSON.stringify(parsedOutput, null, 2) }] };
            } catch (e) {
                const errorPayload = {
                    toolName: "get_services_status",
                    errorCode: "MONITORING_ERROR",
                    errorMessage: e.message
                };
                return { content: [{ type: "text", text: JSON.stringify(errorPayload, null, 2) }], isError: true };
            }
        }
    );
  • Zod input schema for the tool, requiring a single 'alias' parameter for the target server.
    inputSchema: z.object({
        alias: z.string().describe("Alias du serveur cible.")
    })
  • Helper function that parses the raw output from the SSH services status command, splitting into sections for systemd, Docker, and PM2, and extracting service names and statuses into structured arrays.
    function parseServicesStatus(output) {
        const services = {
            systemd: [],
            docker: [],
            pm2: []
        };
    
        try {
            const sections = output.split(/---DOCKER---|---PM2---/);
            const systemdRaw = sections[0] || '';
            const dockerRaw = sections[1] || '';
            const pm2Raw = sections[2] || '';
    
            // Parse systemd
            if (systemdRaw) {
                const lines = systemdRaw.trim().split('\n');
                lines.forEach(line => {
                    const match = line.match(/^(\S+)\s+loaded\s+active\s+running/);
                    if (match && match[1]) {
                        services.systemd.push({ name: match[1], status: 'running' });
                    }
                });
            }
    
            // Parse Docker
            if (dockerRaw) {
                const lines = dockerRaw.trim().split('\n').filter(Boolean);
                lines.forEach(line => {
                    const parts = line.split(': ');
                    if (parts.length >= 2) {
                        services.docker.push({ name: parts[0].trim(), status: parts.slice(1).join(': ').trim() });
                    }
                });
            }
    
            // Parse PM2
            if (pm2Raw) {
                const lines = pm2Raw.trim().split('\n');
                const tableStartIndex = lines.findIndex(line => line.includes('│ id │'));
                if (tableStartIndex !== -1) {
                    const tableBody = lines.slice(tableStartIndex + 2, -1); // Skip header, separator, and footer
                    tableBody.forEach(line => {
                        const columns = line.split('│').map(s => s.trim()).filter(Boolean);
                        if (columns.length >= 4) { // id, name, namespace, status
                            services.pm2.push({ id: columns[0], name: columns[1], status: columns[3] });
                        }
                    });
                }
            }
        } catch (e) {
            return { raw_output: output, parsing_error: e.message };
        }
    
        return services;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states what the tool does but doesn't describe important behavioral aspects: whether this requires specific permissions, what format the status information returns, whether it's a real-time check or cached data, potential rate limits, or error conditions. The description is minimal and lacks operational context.

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 a single, efficient sentence that clearly states the tool's purpose. Every word contributes to understanding what the tool does without any redundancy or unnecessary elaboration. It's appropriately sized for a simple status retrieval tool.

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

Completeness2/5

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

For a tool with no annotations and no output schema, the description is insufficient. It doesn't explain what the return value looks like (structured data, plain text, success/failure indicators), doesn't mention error handling, and provides no context about the operational environment. Given the complexity of checking multiple service types across different technologies, more completeness is needed.

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% with the single parameter 'alias' fully documented in the schema. The description doesn't add any parameter-specific information beyond what's already in the schema. According to scoring rules, when schema coverage is high (>80%), the baseline is 3 even with no param info in description.

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

Purpose4/5

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

The description clearly states the verb ('Récupère' - retrieves) and resource ('le statut de tous les services connus') with specific service types listed (systemd, Docker, PM2). It distinguishes from siblings like get_docker_logs or get_pm2_logs by focusing on status rather than logs. However, it doesn't explicitly differentiate from get_system_resources which might overlap conceptually.

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

Usage Guidelines2/5

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

No guidance is provided about when to use this tool versus alternatives. While the description implies it's for checking service status, it doesn't specify when to choose this over other monitoring tools like check_api_health or task_status, nor does it mention any prerequisites or constraints for usage.

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/fkom13/mcp-sftp-orchestrator'

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