Skip to main content
Glama
aafsar

Task Manager MCP Server

by aafsar

get_task_stats

Retrieve comprehensive statistics about all tasks to analyze workload, track progress, and monitor task management metrics.

Instructions

Get statistics about all tasks

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main execution logic for the 'get_task_stats' tool. Loads tasks from storage, computes comprehensive statistics (total, by status, priority, categories, overdue, due soon, completion rate), and returns a formatted markdown-like text response.
    export async function getTaskStats() {
      const storage = await loadTasks();
      const tasks = storage.tasks;
    
      if (tasks.length === 0) {
        return {
          content: [
            {
              type: "text",
              text: "No tasks yet. Create your first task to get started!",
            },
          ],
        };
      }
    
      // Calculate statistics
      const total = tasks.length;
      const byStatus = {
        pending: tasks.filter((t) => t.status === "pending").length,
        in_progress: tasks.filter((t) => t.status === "in_progress").length,
        completed: tasks.filter((t) => t.status === "completed").length,
      };
    
      const byPriority = {
        high: tasks.filter((t) => t.priority === "high").length,
        medium: tasks.filter((t) => t.priority === "medium").length,
        low: tasks.filter((t) => t.priority === "low").length,
      };
    
      // Category counts
      const categories = new Map<string, number>();
      tasks.forEach((t) => {
        if (t.category) {
          categories.set(t.category, (categories.get(t.category) || 0) + 1);
        }
      });
    
      // Check for overdue and upcoming tasks
      const today = new Date().toISOString().split("T")[0]!;
      const oneWeekFromNow = new Date(Date.now() + 7 * 24 * 60 * 60 * 1000)
        .toISOString()
        .split("T")[0]!;
    
      const overdue = tasks.filter(
        (t) => t.status !== "completed" && t.dueDate && t.dueDate < today
      ).length;
    
      const dueSoon = tasks.filter(
        (t) =>
          t.status !== "completed" &&
          t.dueDate &&
          t.dueDate >= today &&
          t.dueDate <= oneWeekFromNow
      ).length;
    
      const completionRate =
        total > 0 ? ((byStatus.completed / total) * 100).toFixed(1) : "0";
    
      // Format output
      let result = "šŸ“Š Task Manager Statistics\n";
      result += "=".repeat(30) + "\n\n";
      result += `šŸ“ˆ Total Tasks: ${total}\n`;
      result += `āœ… Completion Rate: ${completionRate}%\n\n`;
    
      result += "Status Breakdown:\n";
      result += `  šŸ“‹ Pending: ${byStatus.pending}\n`;
      result += `  ā³ In Progress: ${byStatus.in_progress}\n`;
      result += `  āœ… Completed: ${byStatus.completed}\n\n`;
    
      result += "Priority Breakdown:\n";
      result += `  šŸ”“ High: ${byPriority.high}\n`;
      result += `  🟔 Medium: ${byPriority.medium}\n`;
      result += `  🟢 Low: ${byPriority.low}\n`;
    
      if (categories.size > 0) {
        result += "\nCategories:\n";
        Array.from(categories.entries())
          .sort((a, b) => a[0].localeCompare(b[0]))
          .forEach(([cat, count]) => {
            result += `  šŸ“ ${cat}: ${count}\n`;
          });
      }
    
      if (overdue > 0) {
        result += `\nāš ļø Overdue Tasks: ${overdue}\n`;
      }
      if (dueSoon > 0) {
        result += `šŸ“… Due Within 7 Days: ${dueSoon}\n`;
      }
    
      return {
        content: [
          {
            type: "text",
            text: result,
          },
        ],
      };
    }
  • JSON Schema definition for the tool in the TOOLS array, specifying name, description, and empty input schema (no parameters required).
    {
      name: "get_task_stats",
      description: "Get statistics about all tasks",
      inputSchema: {
        type: "object",
        properties: {},
      },
    },
  • src/index.ts:233-234 (registration)
    Registration in the tool dispatch switch statement within the CallToolRequestSchema handler, mapping the tool name to the getTaskStats function call.
    case "get_task_stats":
      return await getTaskStats();
  • src/index.ts:19-19 (registration)
    Import of the getTaskStats handler function from './tools.js'.
    getTaskStats,
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the tool 'gets statistics' but doesn't clarify what statistics are included (e.g., counts, averages, trends), whether it's read-only or has side effects, or any performance considerations like rate limits. This leaves significant gaps for a tool with no structured safety hints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/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 function without unnecessary words. It's front-loaded with the core action, though it could be slightly more specific (e.g., 'Get aggregated statistics') to enhance clarity without losing conciseness.

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 complexity of statistical tools (which often involve aggregation, time ranges, or filters) and the absence of both annotations and an output schema, the description is incomplete. It doesn't explain what statistics are returned, how data is aggregated, or any prerequisites, making it inadequate for an agent to use effectively without additional context.

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 input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description doesn't add parameter details, which is appropriate, earning a baseline score of 4 for adequately handling the lack of parameters without redundancy.

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

Purpose3/5

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

The description states the action ('Get statistics') and resource ('tasks'), making the purpose clear. However, it doesn't differentiate from sibling tools like 'list_tasks' or 'search_tasks' that also retrieve task information, leaving ambiguity about what distinguishes statistical data from basic listing.

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?

No guidance is provided on when to use this tool versus alternatives like 'list_tasks' or 'search_tasks'. The description implies usage for statistical purposes but doesn't specify contexts (e.g., reporting vs. viewing) or exclusions, leaving the agent to infer based on tool names alone.

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/aafsar/task-manager-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server