remove-metadata
Remove specific metadata keys from a Todo.txt task by ID to clean up task entries and maintain organized task lists.
Instructions
Remove specific metadata keys from a task by ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| taskId | Yes | ||
| keys | Yes |
Implementation Reference
- src/tools.ts:258-277 (handler)Handler function that loads tasks, finds the task by ID, removes the specified metadata keys using removeExtension, saves tasks, and returns success or error.async ({ taskId, keys }) => { const tasks = await loadTasks(); const idx = getTaskIndex(taskId, tasks); if (idx === null) { return { content: [ { type: "text", text: "Invalid task ID." }, ], isError: true, }; } keys.forEach((key: string) => { tasks[idx].removeExtension(key); }); await saveTasks(tasks); return { content: [ { type: "text", text: "Metadata removed successfully." }, ], };
- src/tools.ts:254-257 (schema)Zod schema defining input parameters: taskId (number) and keys (array of strings).{ taskId: z.number(), keys: z.array(z.string()), },
- src/tools.ts:251-279 (registration)Registration of the 'remove-metadata' tool on the MCP server, including name, description, schema, and handler.server.tool( "remove-metadata", "Remove specific metadata keys from a task by ID.", { taskId: z.number(), keys: z.array(z.string()), }, async ({ taskId, keys }) => { const tasks = await loadTasks(); const idx = getTaskIndex(taskId, tasks); if (idx === null) { return { content: [ { type: "text", text: "Invalid task ID." }, ], isError: true, }; } keys.forEach((key: string) => { tasks[idx].removeExtension(key); }); await saveTasks(tasks); return { content: [ { type: "text", text: "Metadata removed successfully." }, ], }; } );