Skip to main content
Glama
fkom13

MCP SFTP Orchestrator

by fkom13

Statistiques de la queue

queue_stats

Monitor task queue performance and status to manage SFTP operations and server workflows effectively.

Instructions

Affiche les statistiques détaillées de la queue de tâches.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • Handler function for the queue_stats tool. Fetches queue statistics and list of crashed jobs using the queue module, aggregates the data, and returns it as formatted JSON text content.
    async () => {
        const stats = queue.getStats();
        const crashed = queue.getCrashedJobs();
        const result = {
            stats,
            crashedJobs: crashed.length,
            canRetry: crashed.map(j => ({ id: j.id, type: j.type, crashedAt: j.crashedAt }))
        };
        return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
    }
  • Input schema for queue_stats tool: empty object (no parameters required). Includes title and description in French.
    {
        title: "Statistiques de la queue",
        description: "Affiche les statistiques détaillées de la queue de tâches.",
        inputSchema: z.object({})
    },
  • server.js:630-647 (registration)
    Registration of the queue_stats tool using server.registerTool, including schema and inline handler.
    server.registerTool(
        "queue_stats",
        {
            title: "Statistiques de la queue",
            description: "Affiche les statistiques détaillées de la queue de tâches.",
            inputSchema: z.object({})
        },
        async () => {
            const stats = queue.getStats();
            const crashed = queue.getCrashedJobs();
            const result = {
                stats,
                crashedJobs: crashed.length,
                canRetry: crashed.map(j => ({ id: j.id, type: j.type, crashedAt: j.crashedAt }))
            };
            return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
        }
    );
  • Helper function getStats() that computes detailed statistics for the job queue: total count, breakdown by status and type, average duration of completed jobs, and success rate.
    function getStats() {
        const stats = {
            total: Object.keys(jobQueue).length,
            byStatus: {},
            byType: {},
            avgDuration: 0,
            successRate: 0
        };
        
        let totalDuration = 0;
        let completedCount = 0;
        
        for (const job of Object.values(jobQueue)) {
            stats.byStatus[job.status] = (stats.byStatus[job.status] || 0) + 1;
            stats.byType[job.type] = (stats.byType[job.type] || 0) + 1;
            
            if (job.duration) {
                totalDuration += job.duration;
                completedCount++;
            }
        }
        
        if (completedCount > 0) {
            stats.avgDuration = Math.round(totalDuration / completedCount);
        }
        
        const totalFinished = (stats.byStatus.completed || 0) + (stats.byStatus.failed || 0);
        if (totalFinished > 0) {
            stats.successRate = Math.round((stats.byStatus.completed || 0) / totalFinished * 100);
        }
        
        return stats;
    }
  • Helper function getCrashedJobs() that filters and returns crashed jobs eligible for retry (status 'crashed', canRetry true, below max retries).
    function getCrashedJobs() {
        return Object.values(jobQueue).filter(job => 
            job.status === 'crashed' && 
            job.canRetry &&
            job.retryCount < job.maxRetries
        );
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. While 'Affiche' (displays) implies a read-only operation, it doesn't specify whether this requires authentication, what format the statistics are returned in, if there are rate limits, or if the data is real-time versus cached. For a stats tool with zero 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 a single, efficient sentence that gets straight to the point with zero wasted words. It's front-loaded with the core purpose and appropriately sized for a no-parameter tool that displays statistics.

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 stats-display tool with no annotations and no output schema, the description is inadequate. It doesn't explain what 'detailed statistics' includes, the format of the output, whether this is a real-time snapshot, or any behavioral characteristics. Given the complexity of queue statistics and lack of structured documentation, more context is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the schema fully documents the absence of inputs. The description appropriately doesn't discuss parameters since none exist, maintaining focus on what the tool does rather than what it accepts.

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 action ('Affiche' - displays/shows) and the resource ('statistiques détaillées de la queue de tâches' - detailed statistics of the task queue), making the purpose immediately understandable. It doesn't explicitly differentiate from sibling tools like 'task_queue' or 'pool_stats', but the specificity of 'detailed statistics' provides some implicit distinction.

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 like 'task_queue' or 'pool_stats'. There's no mention of prerequisites, timing considerations, or comparative context with other queue/task-related tools in the sibling list.

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