Skip to main content
Glama
jhirono

Microsoft Todo MCP Service

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
NameRequiredDescriptionDefault
listIdYesID of the task list to delete

Implementation Reference

  • 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}`,
            },
          ],
        };
      }
    }
  • 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")
    },
  • 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}`,
              },
            ],
          };
        }
      }
    );

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