Skip to main content
Glama
fkom13

MCP SFTP Orchestrator

by fkom13

Afficher les dernières lignes d'un fichier

tail_file

Display the last lines of a remote file on an SFTP server to monitor logs or check recent file content changes.

Instructions

Équivalent de tail -n pour afficher les dernières lignes d'un fichier distant.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
aliasYesAlias du serveur cible.
filepathYesChemin absolu du fichier à lire.
linesNoNombre de lignes à afficher.

Implementation Reference

  • The handler function for the 'tail_file' tool. It constructs a 'tail -n' command using the provided parameters and executes it via SSH on the specified server alias, queuing the job and waiting for completion.
    async (params) => {
        const cmd = `tail -n ${params.lines} ${params.filepath}`;
        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: `📄 Contenu de ${params.filepath} (${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 schema defining the input parameters for the 'tail_file' tool: server alias, file path, and optional number of lines (default 50).
    inputSchema: z.object({
        alias: z.string().describe("Alias du serveur cible."),
        filepath: z.string().describe("Chemin absolu du fichier à lire."),
        lines: z.number().optional().default(50).describe("Nombre de lignes à afficher.")
    })
  • server.js:768-792 (registration)
    Registration of the 'tail_file' tool on the MCP server, including title, description, input schema, and inline handler function.
    server.registerTool(
        "tail_file",
        {
            title: "Afficher les dernières lignes d'un fichier",
            description: "Équivalent de tail -n pour afficher les dernières lignes d'un fichier distant.",
            inputSchema: z.object({
                alias: z.string().describe("Alias du serveur cible."),
                filepath: z.string().describe("Chemin absolu du fichier à lire."),
                lines: z.number().optional().default(50).describe("Nombre de lignes à afficher.")
            })
        },
        async (params) => {
            const cmd = `tail -n ${params.lines} ${params.filepath}`;
            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: `📄 Contenu de ${params.filepath} (${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. It states the read-only nature through 'afficher' (display) and implies remote execution via 'distant' (remote). However, it doesn't disclose authentication requirements, rate limits, error conditions, or what happens with non-existent files. For a remote file access tool with zero annotation coverage, this leaves significant behavioral gaps.

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 immediately conveys the core functionality. Every word earns its place: establishes the Unix equivalent, specifies the operation, and clarifies it's for remote files. No wasted words or redundant information.

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?

For a 3-parameter tool with no annotations and no output schema, the description provides adequate basic purpose but lacks important context. It doesn't explain return format, error handling, or authentication requirements. The Unix analogy helps, but more behavioral context would be needed for complete understanding of this remote file access tool.

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%, providing complete parameter documentation. The description adds minimal value beyond the schema - it implies 'lines' parameter functionality through 'tail -n' analogy but doesn't elaborate on parameter interactions or constraints. With full schema coverage, baseline 3 is appropriate as the description doesn't significantly enhance parameter understanding.

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

Purpose5/5

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

The description clearly states the tool's function with a specific verb ('afficher' - display/show) and resource ('dernières lignes d'un fichier distant' - last lines of a remote file). It distinguishes from siblings by focusing on file tailing rather than API management, Docker logs, or task execution. The Unix command analogy ('tail -n') provides immediate recognition.

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

Usage Guidelines3/5

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

The description implies usage context through 'fichier distant' (remote file) and the Unix analogy, suggesting this is for viewing remote server logs. However, it doesn't explicitly state when to use this versus alternatives like get_docker_logs or get_pm2_logs, nor does it mention prerequisites or exclusions. Usage is implied rather than explicitly guided.

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