delete-task-list
Remove a task list and all its tasks from Microsoft Todo to declutter your workspace and manage project containers.
Instructions
Delete a task list (top-level container) from Microsoft Todo. This will remove the list and all tasks within it.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| listId | Yes | ID of the task list to delete |
Implementation Reference
- src/todo-index.ts:616-660 (handler)The async handler function that executes the 'delete-task-list' tool logic. Authenticates using getAccessToken(), constructs the Microsoft Graph API DELETE URL `/me/todo/lists/${listId}`, calls makeGraphRequest, and returns success or error message.async ({ listId }) => { try { const token = await getAccessToken(); if (!token) { return { content: [ { type: "text", text: "Failed to authenticate with Microsoft API", }, ], }; } // Make a DELETE request to the Microsoft Graph API const url = `${MS_GRAPH_BASE}/me/todo/lists/${listId}`; console.error(`Deleting task list: ${url}`); // The DELETE method doesn't return a response body, so we expect null await makeGraphRequest<null>( url, token, "DELETE" ); // If we get here, the delete was successful (204 No Content) return { content: [ { type: "text", text: `Task list with ID: ${listId} was successfully deleted.`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error deleting task list: ${error}`, }, ], }; } }
- src/todo-index.ts:613-615 (schema)Zod input schema validation for the tool, requiring a 'listId' string parameter with description."{ listId: z.string().describe("ID of the task list to delete") },
- src/todo-index.ts:610-661 (registration)Registers the 'delete-task-list' tool with the MCP server instance using server.tool(name, description, inputSchema, handlerFn).server.tool( "delete-task-list", "Delete a task list (top-level container) from Microsoft Todo. This will remove the list and all tasks within it.", { listId: z.string().describe("ID of the task list to delete") }, async ({ listId }) => { try { const token = await getAccessToken(); if (!token) { return { content: [ { type: "text", text: "Failed to authenticate with Microsoft API", }, ], }; } // Make a DELETE request to the Microsoft Graph API const url = `${MS_GRAPH_BASE}/me/todo/lists/${listId}`; console.error(`Deleting task list: ${url}`); // The DELETE method doesn't return a response body, so we expect null await makeGraphRequest<null>( url, token, "DELETE" ); // If we get here, the delete was successful (204 No Content) return { content: [ { type: "text", text: `Task list with ID: ${listId} was successfully deleted.`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error deleting task list: ${error}`, }, ], }; } } );