Skip to main content
Glama
fkom13

MCP SFTP Orchestrator

by fkom13

Récupérer les logs PM2

get_pm2_logs

Retrieve PM2 application logs from remote servers to monitor processes, troubleshoot errors, and analyze system performance through SSH/SFTP connections.

Instructions

Raccourci pour récupérer les logs PM2 d'une application spécifique ou de toutes les apps.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aliasYesAlias du serveur cible.
appNoNom de l'application PM2 (optionnel, toutes par défaut).
linesNoNombre de lignes à récupérer.
errorsNoRécupérer uniquement les erreurs (stderr).

Implementation Reference

  • Executes PM2 logs command on remote server via SSH queue, handles parameters for app name, errors only, line count, waits for result and returns formatted output.
    async (params) => {
        let cmd = 'pm2 logs';
        if (params.app) cmd += ` ${params.app}`;
        if (params.errors) cmd += ' --err';
        cmd += ` --lines ${params.lines} --nostream`;
    
        const job = queue.addJob({ type: 'ssh', alias: params.alias, cmd: cmd, streaming: false });
        history.logTask(job);
        ssh.executeCommand(job.id);
    
        const finalJob = await waitForJobCompletion(job.id, config.syncTimeout);
        if (finalJob) {
            return { content: [{ type: "text", text: `📋 Logs PM2${params.app ? ` (${params.app})` : ''} - ${finalJob.lineCount || 0} lignes:\n\n${finalJob.output || '(vide)'}` }] };
        } else {
            return { content: [{ type: "text", text: `Tâche ${job.id} initiée en arrière-plan.` }] };
        }
    }
  • Zod input schema defining parameters: server alias (required), optional app name, lines (default 100), errors flag (default false).
    {
        title: "Récupérer les logs PM2",
        description: "Raccourci pour récupérer les logs PM2 d'une application spécifique ou de toutes les apps.",
        inputSchema: z.object({
            alias: z.string().describe("Alias du serveur cible."),
            app: z.string().optional().describe("Nom de l'application PM2 (optionnel, toutes par défaut)."),
            lines: z.number().optional().default(100).describe("Nombre de lignes à récupérer."),
            errors: z.boolean().optional().default(false).describe("Récupérer uniquement les erreurs (stderr).")
        })
    },
  • server.js:705-734 (registration)
    Registers the get_pm2_logs tool with the MCP server, including schema and inline handler.
    server.registerTool(
        "get_pm2_logs",
        {
            title: "Récupérer les logs PM2",
            description: "Raccourci pour récupérer les logs PM2 d'une application spécifique ou de toutes les apps.",
            inputSchema: z.object({
                alias: z.string().describe("Alias du serveur cible."),
                app: z.string().optional().describe("Nom de l'application PM2 (optionnel, toutes par défaut)."),
                lines: z.number().optional().default(100).describe("Nombre de lignes à récupérer."),
                errors: z.boolean().optional().default(false).describe("Récupérer uniquement les erreurs (stderr).")
            })
        },
        async (params) => {
            let cmd = 'pm2 logs';
            if (params.app) cmd += ` ${params.app}`;
            if (params.errors) cmd += ' --err';
            cmd += ` --lines ${params.lines} --nostream`;
    
            const job = queue.addJob({ type: 'ssh', alias: params.alias, cmd: cmd, streaming: false });
            history.logTask(job);
            ssh.executeCommand(job.id);
    
            const finalJob = await waitForJobCompletion(job.id, config.syncTimeout);
            if (finalJob) {
                return { content: [{ type: "text", text: `📋 Logs PM2${params.app ? ` (${params.app})` : ''} - ${finalJob.lineCount || 0} lignes:\n\n${finalJob.output || '(vide)'}` }] };
            } else {
                return { content: [{ type: "text", text: `Tâche ${job.id} initiée en arrière-plan.` }] };
            }
        }
    );
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. While 'récupérer' implies a read operation, it doesn't address permission requirements, rate limits, output format, or potential side effects. The description adds minimal behavioral context beyond the basic operation.

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. It's appropriately sized and front-loaded with the core functionality, with zero wasted words or unnecessary elaboration.

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 4 parameters, no annotations, and no output schema, the description is inadequate. It doesn't explain what the logs contain, their format, whether they're real-time or historical, or any constraints on retrieval. The description leaves too many contextual gaps for effective agent usage.

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%, so the schema fully documents all 4 parameters. The description mentions retrieving logs for 'une application spécifique ou de toutes les apps' which aligns with the 'app' parameter's optional nature, but adds no additional semantic context beyond what the schema already provides.

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érer' - retrieve) and resource ('logs PM2'), specifying it can target a specific application or all applications. However, it doesn't explicitly differentiate from sibling tools like 'get_docker_logs' or 'tail_file' beyond mentioning PM2 specifically.

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 when PM2 logs would be needed over other log tools like 'get_docker_logs' or 'tail_file', nor does it specify prerequisites or exclusions 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