Skip to main content
Glama

taskGetById

Retrieve a specific task by its unique ID to access detailed information and manage task-related operations within the GonMCPtool server.

Instructions

根據ID獲取特定任務

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes

Implementation Reference

  • main.ts:622-644 (registration)
    Registration of the taskGetById MCP tool, including input schema { id: z.string() } and thin wrapper handler that calls the core TaskManagerTool.getTaskById method and formats the response.
    server.tool("taskGetById",
        "根據ID獲取特定任務",
        { id: z.string() },
        async ({ id }) => {
            try {
                const task = await TaskManagerTool.getTaskById(id);
    
                if (!task) {
                    return {
                        content: [{ type: "text", text: `未找到ID為 ${id} 的任務` }]
                    };
                }
    
                return {
                    content: [{ type: "text", text: `任務詳情:\n${JSON.stringify(task, null, 2)}` }]
                };
            } catch (error) {
                return {
                    content: [{ type: "text", text: `獲取任務失敗: ${error instanceof Error ? error.message : "未知錯誤"}` }]
                };
            }
        }
    );
  • Core implementation of task retrieval by ID: reads all tasks from JSON file and finds the matching task using Array.find.
    public static async getTaskById(id: string): Promise<Task | null> {
      const tasks = await this.readTasks();
      const task = tasks.find(t => t.id === id);
      return task || null;
    }
  • TypeScript interface defining the Task object structure, used for type safety in input/output of the tool.
    export interface Task {
      /**
       * 任務唯一識別碼
       */
      id: string;
      
      /**
       * 任務標題
       */
      title: string;
      
      /**
       * 任務詳細描述
       */
      description: string;
      
      /**
       * 任務步驟列表
       */
      steps: TaskStep[];
      
      /**
       * 任務標籤列表
       */
      tags: string[];
      
      /**
       * 任務建立時間
       */
      createdAt: string;
      
      /**
       * 任務更新時間
       */
      updatedAt: string;
      
      /**
       * 任務期限時間
       */
      dueDate?: string;
        /**
         * 預計開始時間
         */
        plannedStartDate?: string;
        /**
         * 實際開始時間
         */
        actualStartDate?: string;
          /**
           * 實際完成時間
           */
          actualCompletionDate?: string;
    
      
      
      /**
       * 任務狀態
       */
      status: TaskStatus;
      
      /**
       * 任務優先級 (1-5, 1為最高)
       */
      priority: number;
    }
  • Helper method to read all tasks from the persistent JSON storage file (./task/tasks.json). Called by getTaskById.
    private static async readTasks(): Promise<Task[]> {
      await this.ensureTasksDirectory();
    
      try {
        const tasksFile = this.getTasksFilePath();
        const fileContent = fs.readFileSync(tasksFile, 'utf-8');
        const data = JSON.parse(fileContent);
        return data.tasks || [];
      } catch (error) {
        console.error('Error reading tasks:', error);
        throw new Error(`讀取任務失敗: ${error instanceof Error ? error.message : '未知錯誤'}`);
      }
    }
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. The description only states what the tool does ('get by ID') without disclosing behavioral traits like: what happens if the ID doesn't exist (error vs null return), authentication requirements, rate limits, or response format. For a read operation with no annotation coverage, this is a significant gap.

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 in Chinese that directly states the tool's purpose. There's zero wasted language, and it's appropriately sized for a simple retrieval tool. The structure is front-loaded with the core functionality.

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 this is a read operation with 1 parameter, 0% schema coverage, no annotations, and no output schema, the description is incomplete. It doesn't explain error conditions, response format, or parameter details. For a tool that likely returns structured task data, more context about what information is returned would be helpful.

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

Parameters2/5

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

Schema description coverage is 0% (no parameter descriptions in schema), and the description doesn't provide any parameter information beyond what's implied by 'by ID'. It doesn't explain what format the ID should be (string format, length constraints, etc.), where to find task IDs, or provide examples. With 1 parameter and 0% schema coverage, the description should compensate more.

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 '根據ID獲取特定任務' (Get specific task by ID) clearly states the verb ('獲取' - get/retrieve) and resource ('任務' - task) with the specific mechanism (by ID). It distinguishes from siblings like taskGetAll (get all tasks) and taskSearch (search tasks). However, it doesn't explicitly mention what 'task' refers to in this context.

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 when you have a specific task ID and want to retrieve that single task. It distinguishes from taskGetAll (get all tasks without filtering) and taskSearch (search with criteria). However, it doesn't provide explicit guidance about when NOT to use this tool or mention alternatives like taskSearch if you don't have the exact ID.

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