Skip to main content
Glama
fkom13

MCP SFTP Orchestrator

by fkom13

Récupérer les logs Docker

get_docker_logs

Retrieve Docker container logs from remote servers via SSH/SFTP to monitor application status and troubleshoot issues.

Instructions

Raccourci pour récupérer les logs d'un container Docker.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aliasYesAlias du serveur cible.
containerYesNom ou ID du container Docker.
linesNoNombre de lignes à récupérer.
sinceNoLogs depuis (ex: '5m', '1h', '2024-01-01').
timestampsNoAfficher les timestamps.

Implementation Reference

  • The handler function for get_docker_logs tool. It builds a 'docker logs' command based on input parameters (container, lines, since, timestamps), adds an SSH job to the queue, executes it, waits for completion, and returns the logs or a background task message.
    async (params) => {
        let cmd = `docker logs --tail ${params.lines}`;
        if (params.since) cmd += ` --since ${params.since}`;
        if (params.timestamps) cmd += ' --timestamps';
        cmd += ` ${params.container}`;
    
        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 Docker (${params.container}) - ${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.` }] };
        }
    }
  • Input schema definition for the get_docker_logs tool using Zod, specifying parameters: alias (required), container (required), lines (optional, default 100), since (optional), timestamps (optional, default false).
    inputSchema: z.object({
        alias: z.string().describe("Alias du serveur cible."),
        container: z.string().describe("Nom ou ID du container Docker."),
        lines: z.number().optional().default(100).describe("Nombre de lignes à récupérer."),
        since: z.string().optional().describe("Logs depuis (ex: '5m', '1h', '2024-01-01')."),
        timestamps: z.boolean().optional().default(false).describe("Afficher les timestamps.")
    })
  • server.js:736-766 (registration)
    Registration of the get_docker_logs tool using server.registerTool, including title, description, input schema, and inline handler function.
    server.registerTool(
        "get_docker_logs",
        {
            title: "Récupérer les logs Docker",
            description: "Raccourci pour récupérer les logs d'un container Docker.",
            inputSchema: z.object({
                alias: z.string().describe("Alias du serveur cible."),
                container: z.string().describe("Nom ou ID du container Docker."),
                lines: z.number().optional().default(100).describe("Nombre de lignes à récupérer."),
                since: z.string().optional().describe("Logs depuis (ex: '5m', '1h', '2024-01-01')."),
                timestamps: z.boolean().optional().default(false).describe("Afficher les timestamps.")
            })
        },
        async (params) => {
            let cmd = `docker logs --tail ${params.lines}`;
            if (params.since) cmd += ` --since ${params.since}`;
            if (params.timestamps) cmd += ' --timestamps';
            cmd += ` ${params.container}`;
    
            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 Docker (${params.container}) - ${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. It only states it retrieves logs but doesn't mention important behaviors: whether this requires specific Docker permissions, if it streams or returns static output, potential rate limits, error conditions (e.g., if container doesn't exist), or what format the logs are returned in. For a tool with 5 parameters and no annotation coverage, this is insufficient.

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 extremely concise - a single sentence that gets straight to the point. It's front-loaded with the core purpose and wastes no words. Every word earns its place, making it easy for an AI agent to quickly understand what the tool does.

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?

Given the tool has 5 parameters, no annotations, and no output schema, the description is incomplete. It doesn't address what the tool returns (log format, structure), error conditions, authentication requirements, or performance characteristics. For a Docker log retrieval tool that likely interacts with live containers, this leaves significant gaps in understanding how to use it effectively.

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 schema has 100% description coverage, so all parameters are documented in the structured schema. The description adds no additional parameter information beyond what's already in the schema descriptions. According to the scoring rules, when schema_description_coverage is high (>80%), the baseline is 3 even with no param info in the 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érer' - retrieve) and resource ('logs d'un container Docker'), making the purpose immediately understandable. It distinguishes itself from sibling tools like 'get_pm2_logs' and 'tail_file' by specifying Docker containers. However, it doesn't fully differentiate from 'task_logs' which might also retrieve logs, though for tasks rather than containers.

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 to choose this over 'get_pm2_logs' for PM2 logs, 'tail_file' for general file tailing, or 'task_logs' for task-related logs. The word 'raccourci' (shortcut) hints at convenience but doesn't specify what it's a shortcut for or when it's appropriate.

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