Skip to main content
Glama

taskAnalyze

Generate task status analysis reports to monitor progress and identify issues in development workflows.

Instructions

獲取任務狀態分析報告

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • main.ts:837-853 (registration)
    Registration of the 'taskAnalyze' MCP tool, including empty input schema and thin inline handler that delegates to TaskManagerTool.analyzeTaskStatus() and formats the response.
    server.tool("taskAnalyze",
        "獲取任務狀態分析報告",
        {},
        async () => {
            try {
                const analysis = await TaskManagerTool.analyzeTaskStatus();
    
                return {
                    content: [{ type: "text", text: `任務分析報告:\n${JSON.stringify(analysis, null, 2)}` }]
                };
            } catch (error) {
                return {
                    content: [{ type: "text", text: `分析任務失敗: ${error instanceof Error ? error.message : "未知錯誤"}` }]
                };
            }
        }
    );
  • Core handler implementation in TaskManagerTool class. Analyzes tasks: counts by status, overdue tasks, tag distribution, average completion time, average time difference vs estimate, with optional filter.
    public static async analyzeTaskStatus(filter?: TaskFilter): Promise<TaskAnalysis> {
      // 如果提供了篩選條件,先進行篩選;否則使用所有任務
      const tasks = filter ? await this.searchTasks(filter) : await this.readTasks();
    
      // 初始化分析結果
      const analysis: TaskAnalysis = {
        totalTasks: tasks.length,
        completedTasks: 0,
        pendingTasks: 0,
        inProgressTasks: 0,
        cancelledTasks: 0,
        overdueTasksCount: 0,
        tagDistribution: {}
      };
    
      // 計算任務分佈
      tasks.forEach(task => {
        // 根據狀態分類
        switch (task.status) {
          case TaskStatus.COMPLETED:
            analysis.completedTasks++;
            break;
          case TaskStatus.PENDING:
            analysis.pendingTasks++;
            break;
          case TaskStatus.IN_PROGRESS:
            analysis.inProgressTasks++;
            break;
          case TaskStatus.CANCELLED:
            analysis.cancelledTasks++;
            break;
        }
    
        // 檢查過期任務
        if (task.dueDate && task.status !== TaskStatus.COMPLETED && task.status !== TaskStatus.CANCELLED) {
          const dueDate = new Date(task.dueDate);
          const now = new Date();
          if (dueDate < now) {
            analysis.overdueTasksCount++;
          }
        }
    
        // 計算標籤分佈
        task.tags.forEach(tag => {
          if (!analysis.tagDistribution[tag]) {
            analysis.tagDistribution[tag] = 0;
          }
          analysis.tagDistribution[tag]++;
        });
      });
    
      // 計算完成任務的平均完成時間
      const completedTasks = tasks.filter(task => task.status === TaskStatus.COMPLETED);
      if (completedTasks.length > 0) {
        let totalCompletionTime = 0;
        let completedTasksWithTimes = 0;
    
        completedTasks.forEach(task => {
          // 使用工具類計算完成時間
          const completionTimeHours = TaskTimeUtils.calculateTaskWorkTimeHours(task);
    
          if (!isNaN(completionTimeHours)) {
            totalCompletionTime += completionTimeHours;
            completedTasksWithTimes++;
          }
        });
    
        if (completedTasksWithTimes > 0) {
          analysis.averageCompletionTime = totalCompletionTime / completedTasksWithTimes;
        }
      }
    
      // 計算完成任務的實際時間與預計時間的差異
      if (completedTasks.length > 0) {
        let totalTimeDifference = 0;
        let tasksWithTimeDifference = 0;
        const taskTimeDifferences: Array<{
          taskId: string;
          title: string;
          completionDate: string;
          estimatedTotalTime: number;
          actualWorkTime: number;
          timeDifference: number;
        }> = [];
    
        completedTasks.forEach(task => {
          // 只處理有步驟且有預計完成時間的任務
          const stepsWithEstimatedTime = task.steps.filter(step =>
            typeof step.estimatedTime === 'number' && step.estimatedTime > 0
          );
    
          if (stepsWithEstimatedTime.length > 0) {
            // 使用工具類計算任務時間
            const totalEstimatedTime = TaskTimeUtils.calculateTotalEstimatedTime(task);
            const actualCompletionMinutes = TaskTimeUtils.calculateTaskWorkTimeMinutes(task);
            
            // 計算時間差異(正值表示超時,負值表示提前完成)
            const timeDifference = TaskTimeUtils.calculateTimeDifference(task) || 0; // 如果返回null,使用0
    
            // 記錄任務時間差異詳情
            const timeInfo = TaskTimeUtils.getTaskTimeInfo(task);
            taskTimeDifferences.push({
              taskId: task.id,
              title: task.title,
              completionDate: task.actualCompletionDate || task.updatedAt,
              estimatedTotalTime: timeInfo.estimatedTotalTime,
              actualWorkTime: timeInfo.actualWorkTime, // 實際工作時間
              timeDifference: timeInfo.timeDifference || 0 // 如果返回null,使用0
            });
    
            totalTimeDifference += timeDifference;
            tasksWithTimeDifference++;
          }
        });
    
        // 計算平均時間差異
        if (tasksWithTimeDifference > 0) {
          analysis.averageTimeDifference = totalTimeDifference / tasksWithTimeDifference;
          analysis.taskTimeDifferences = taskTimeDifferences;
        }
      }
    
      return analysis;
    }
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. While '獲取' (get) implies a read operation, the description doesn't specify whether this requires authentication, has rate limits, returns real-time vs cached data, or what format the analysis report takes. For a tool with zero annotation coverage, this leaves significant behavioral questions unanswered.

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 Chinese phrase that directly states the tool's purpose. There's zero wasted language - every character earns its place. The structure is front-loaded with the core functionality immediately clear.

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's apparent complexity (providing analysis reports) and the absence of both annotations and output schema, the description is insufficient. It doesn't explain what constitutes a 'status analysis report', what data it includes, whether it's aggregated or detailed, or what format it returns. For an analysis tool with no structured output documentation, the description should provide more context about the return value.

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 doesn't need to compensate for any parameter gaps. The baseline for 0 parameters with complete schema coverage is 4, as there's no parameter information to add beyond what's already structured.

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 '獲取任務狀態分析報告' (Get task status analysis report) states a clear purpose with a specific verb ('獲取' - get) and resource ('任務狀態分析報告' - task status analysis report). However, it doesn't distinguish itself from sibling tools like 'taskGenerateReport' or 'taskGetAll' - the agent must infer this is specifically about status analysis rather than general reporting or retrieval.

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. With multiple task-related siblings (taskGenerateReport, taskGetAll, taskGetById, taskSearch), there's no indication of when this status analysis report is appropriate versus other task operations. The agent receives no usage context or exclusions.

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/GonTwVn/GonMCPtool'

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