Skip to main content
Glama

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 ); }

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