Skip to main content
Glama
jhirono

Microsoft Todo MCP Service

delete-task

Remove a task and its subtasks from a Microsoft Todo list using the task ID and list ID.

Instructions

Delete a task from a Microsoft Todo list. This will remove the task and all its checklist items (subtasks).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
listIdYesID of the task list
taskIdYesID of the task to delete

Implementation Reference

  • The handler function for the 'delete-task' tool. It authenticates with Microsoft Graph API using getAccessToken, constructs the DELETE URL for the specific task, calls makeGraphRequest to delete it, and returns a success or error message.
    async ({ listId, taskId }) => { 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}/tasks/${taskId}`; console.error(`Deleting task: ${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 with ID: ${taskId} was successfully deleted from list: ${listId}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error deleting task: ${error}`, }, ], }; } }
  • Zod input schema defining the required parameters: listId (string) and taskId (string).
    { listId: z.string().describe("ID of the task list"), taskId: z.string().describe("ID of the task to delete") },
  • Registration of the 'delete-task' tool using server.tool, including name, description, schema, and inline handler function.
    server.tool( "delete-task", "Delete a task from a Microsoft Todo list. This will remove the task and all its checklist items (subtasks).", { listId: z.string().describe("ID of the task list"), taskId: z.string().describe("ID of the task to delete") }, async ({ listId, taskId }) => { 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}/tasks/${taskId}`; console.error(`Deleting task: ${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 with ID: ${taskId} was successfully deleted from list: ${listId}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error deleting task: ${error}`, }, ], }; } } );

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/jhirono/todoMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server