Skip to main content
Glama

taskDelete

Remove tasks by ID from the MCP server to manage workflow and maintain organized project structures.

Instructions

刪除指定ID的任務

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes

Implementation Reference

  • main.ts:687-709 (registration)
    Registration of the taskDelete MCP tool, including input schema { id: z.string() } and the handler function that calls TaskManagerTool.deleteTask(id) and returns formatted response.
    server.tool("taskDelete", "刪除指定ID的任務", { id: z.string() }, async ({ id }) => { try { const result = await TaskManagerTool.deleteTask(id); if (!result) { return { content: [{ type: "text", text: `未找到ID為 ${id} 的任務` }] }; } return { content: [{ type: "text", text: `任務已成功刪除` }] }; } catch (error) { return { content: [{ type: "text", text: `刪除任務失敗: ${error instanceof Error ? error.message : "未知錯誤"}` }] }; } } );
  • Core implementation of task deletion: reads all tasks, filters out the one matching the ID, writes back the list if changed, returns success boolean.
    public static async deleteTask(id: string): Promise<boolean> { const tasks = await this.readTasks(); const initialLength = tasks.length; const filteredTasks = tasks.filter(t => t.id !== id); if (filteredTasks.length === initialLength) { return false; } // 保存所有任務 await this.writeTasks(filteredTasks); return true; }
  • Zod input schema for taskDelete tool: requires 'id' as string.
    { id: z.string() },

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