Skip to main content
Glama

taskGetAll

Retrieve all tasks from the task list to manage and track project activities.

Instructions

獲取所有任務列表

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • main.ts:603-619 (registration)
    Registers the 'taskGetAll' tool including its description, empty input schema (no parameters), and inline async handler function that calls TaskManagerTool.getAllTasks() to retrieve all tasks and returns formatted text content or error message.
    server.tool("taskGetAll", "獲取所有任務列表", {}, async () => { try { const tasks = await TaskManagerTool.getAllTasks(); return { content: [{ type: "text", text: `獲取到 ${tasks.length} 個任務:\n${JSON.stringify(tasks, null, 2)}` }] }; } catch (error) { return { content: [{ type: "text", text: `獲取任務失敗: ${error instanceof Error ? error.message : "未知錯誤"}` }] }; } } );
  • Static method getAllTasks() that implements the core logic for fetching all tasks by calling the private readTasks() method.
    public static async getAllTasks(): Promise<Task[]> { return await this.readTasks(); }
  • Private helper method readTasks() that ensures the tasks directory exists and reads/parses the tasks.json file to return the array of Task objects.
    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 : '未知錯誤'}`); } }
  • TypeScript interface definition for Task type, which structures the data returned by getAllTasks(), including related TaskStep, TaskStatus enum.
    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; }

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