Skip to main content
Glama
fkom13

MCP SFTP Orchestrator

by fkom13

Obtenir les ressources système d'un VPS

get_system_resources

Retrieve vital system metrics including CPU usage, RAM consumption, and disk utilization from a target server for monitoring and resource analysis.

Instructions

Récupère les métriques système vitales (CPU, RAM, Disque) d'un serveur.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aliasYesAlias du serveur cible.

Implementation Reference

  • The handler function queues an SSH job to run 'uptime && free -h && df -h /' on the specified server, waits for completion, parses the output with ssh.parseSystemResources, and returns JSON formatted resources or error.
        async (params) => {
            try {
                const job = queue.addJob({
                    type: 'ssh',
                    alias: params.alias,
                    cmd: "uptime && free -h && df -h /"
                });
                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.parseSystemResources(result.output);
                return { content: [{ type: "text", text: JSON.stringify(parsedOutput, null, 2) }] };
            } catch (e) {
                const errorPayload = {
                    toolName: "get_system_resources",
                    errorCode: "MONITORING_ERROR",
                    errorMessage: e.message
                };
                return { content: [{ type: "text", text: JSON.stringify(errorPayload, null, 2) }], isError: true };
            }
        }
    );
  • Input schema defining the required 'alias' parameter for the target server.
    {
        title: "Obtenir les ressources système d'un VPS",
        description: "Récupère les métriques système vitales (CPU, RAM, Disque) d'un serveur.",
        inputSchema: z.object({
            alias: z.string().describe("Alias du serveur cible.")
        })
    },
  • server.js:230-264 (registration)
    Registration of the 'get_system_resources' tool using server.registerTool, including schema and inline handler function.
    server.registerTool(
        "get_system_resources",
        {
            title: "Obtenir les ressources système d'un VPS",
            description: "Récupère les métriques système vitales (CPU, RAM, Disque) d'un serveur.",
            inputSchema: z.object({
                alias: z.string().describe("Alias du serveur cible.")
            })
        },
        async (params) => {
            try {
                const job = queue.addJob({
                    type: 'ssh',
                    alias: params.alias,
                    cmd: "uptime && free -h && df -h /"
                });
                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.parseSystemResources(result.output);
                return { content: [{ type: "text", text: JSON.stringify(parsedOutput, null, 2) }] };
            } catch (e) {
                const errorPayload = {
                    toolName: "get_system_resources",
                    errorCode: "MONITORING_ERROR",
                    errorMessage: e.message
                };
                return { content: [{ type: "text", text: JSON.stringify(errorPayload, null, 2) }], isError: true };
            }
        }
    );
  • Helper function in ssh.js that parses the raw output from 'uptime && free -h && df -h /' into structured load average, memory, and disk usage data.
    function parseSystemResources(output) {
        const resources = {
            load_average: null,
            memory: null,
            disk: null
        };
        const lines = output.split('\n');
    
        try {
            const uptimeLine = lines.find(line => line.includes('load average:'));
            if (uptimeLine) {
                const parts = uptimeLine.split('load average:')[1];
                resources.load_average = parts.split(',').map(s => s.trim());
            }
    
            const memLine = lines.find(line => line.trim().startsWith('Mem:'));
            if (memLine) {
                const parts = memLine.trim().split(/\s+/);
                resources.memory = {
                    total: parts[1],
                    used: parts[2],
                    free: parts[3],
                    available: parts[6]
                };
            }
    
            const diskLine = lines.find(line => line.startsWith('/dev/'));
            if (diskLine) {
                const parts = diskLine.trim().split(/\s+/);
                resources.disk = {
                    filesystem: parts[0],
                    total: parts[1],
                    used: parts[2],
                    available: parts[3],
                    use_percent: parts[4]
                };
            }
        } catch (e) {
            // En cas d'erreur de parsing, retourner les données brutes
            return { raw_output: output, parsing_error: e.message };
        }
    
        return resources;
    }
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 of behavioral disclosure. It states the tool retrieves metrics, implying a read-only operation, but doesn't specify if it requires authentication, has rate limits, returns real-time or historical data, or what format the output takes. For a tool with no annotations, this leaves significant gaps in understanding its 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 a single, efficient sentence that directly states the tool's purpose without unnecessary words. It front-loads the key action ('Récupère') and specifies the metrics clearly. Every part of the sentence contributes essential information, making it highly concise and well-structured.

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 (simple retrieval with one parameter), no annotations, and no output schema, the description is minimally adequate. It covers what metrics are retrieved but lacks details on output format, error handling, or behavioral constraints. For a tool with no structured support beyond the input schema, it meets basic needs but leaves room for improvement in completeness.

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?

The input schema has 100% description coverage, with the single parameter 'alias' documented as 'Alias du serveur cible.' (Alias of the target server). The description doesn't add any semantic details beyond this, such as examples of valid aliases or how to obtain them. With high schema coverage, the baseline score of 3 is appropriate as the schema handles the parameter documentation adequately.

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 the resource 'métriques système vitales (CPU, RAM, Disque) d'un serveur' (vital system metrics of a server). It specifies what metrics are retrieved (CPU, RAM, disk), making the purpose clear. However, it doesn't explicitly differentiate from sibling tools like 'get_services_status' or 'get_fail2ban_status', which might also retrieve system information but for different aspects.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites, context for usage, or compare it to sibling tools like 'get_services_status' or 'pool_stats', which might overlap in monitoring system resources. Without such guidance, the agent must infer usage based on tool names alone.

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