Skip to main content
Glama
jhirono

Microsoft Todo MCP Service

delete-checklist-item

Remove a specific subtask from a Microsoft Todo task while keeping the parent task intact. Delete checklist items to clean up completed or unnecessary subtasks.

Instructions

Delete a checklist item (subtask) from a task. This removes just the specific subtask, not the parent task.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
listIdYesID of the task list
taskIdYesID of the task
checklistItemIdYesID of the checklist item to delete

Implementation Reference

  • The handler function for the 'delete-checklist-item' tool. It authenticates, constructs the Microsoft Graph API DELETE URL for the specific checklist item, calls makeGraphRequest to delete it, and returns success or error messages.
    async ({ listId, taskId, checklistItemId }) => {
      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}/checklistItems/${checklistItemId}`;
        console.error(`Deleting checklist item: ${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: `Checklist item with ID: ${checklistItemId} was successfully deleted from task: ${taskId}`,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error deleting checklist item: ${error}`,
            },
          ],
        };
      }
    }
  • Zod input schema defining the required parameters: listId, taskId, and checklistItemId for identifying the checklist item to delete.
    {
      listId: z.string().describe("ID of the task list"),
      taskId: z.string().describe("ID of the task"),
      checklistItemId: z.string().describe("ID of the checklist item to delete")
    },
  • The server.tool registration for the 'delete-checklist-item' tool, including name, description, input schema, and handler function.
    server.tool(
      "delete-checklist-item",
      "Delete a checklist item (subtask) from a task. This removes just the specific subtask, not the parent task.",
      {
        listId: z.string().describe("ID of the task list"),
        taskId: z.string().describe("ID of the task"),
        checklistItemId: z.string().describe("ID of the checklist item to delete")
      },
      async ({ listId, taskId, checklistItemId }) => {
        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}/checklistItems/${checklistItemId}`;
          console.error(`Deleting checklist item: ${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: `Checklist item with ID: ${checklistItemId} was successfully deleted from task: ${taskId}`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error deleting checklist item: ${error}`,
              },
            ],
          };
        }
      }
    );
  • Helper function makeGraphRequest used by the handler to make authenticated HTTP requests to Microsoft Graph API, including the DELETE call.
    async function makeGraphRequest<T>(url: string, token: string, method = "GET", body?: any): Promise<T | null> {
      const headers = {
        "User-Agent": USER_AGENT,
        "Accept": "application/json",
        "Authorization": `Bearer ${token}`,
        "Content-Type": "application/json"
      };
    
      try {
        const options: RequestInit = { 
          method, 
          headers 
        };
    
        if (body && (method === "POST" || method === "PATCH")) {
          options.body = JSON.stringify(body);
        }
    
        console.error(`Making request to: ${url}`);
        console.error(`Request options: ${JSON.stringify({
          method,
          headers: {
            ...headers,
            Authorization: 'Bearer [REDACTED]'
          }
        })}`);
    
        const response = await fetch(url, options);
        
        if (!response.ok) {
          const errorText = await response.text();
          console.error(`HTTP error! status: ${response.status}, body: ${errorText}`);
          
          // Check for the specific MailboxNotEnabledForRESTAPI error
          if (errorText.includes('MailboxNotEnabledForRESTAPI')) {
            console.error(`
    =================================================================
    ERROR: MailboxNotEnabledForRESTAPI
    
    The Microsoft To Do API is not available for personal Microsoft accounts 
    (outlook.com, hotmail.com, live.com, etc.) through the Graph API.
    
    This is a limitation of the Microsoft Graph API, not an authentication issue.
    Microsoft only allows To Do API access for Microsoft 365 business accounts.
    
    You can still use Microsoft To Do through the web interface or mobile apps,
    but API access is restricted for personal accounts.
    =================================================================
            `);
            
            throw new Error("Microsoft To Do API is not available for personal Microsoft accounts. See console for details.");
          }
          
          throw new Error(`HTTP error! status: ${response.status}, body: ${errorText}`);
        }
        
        const data = await response.json();
        console.error(`Response received: ${JSON.stringify(data).substring(0, 200)}...`);
        return data as T;
      } catch (error) {
        console.error("Error making Graph API request:", error);
        return null;
      }
  • Helper function getAccessToken used by the handler to obtain a valid access token, handling refresh if necessary.
    async function getAccessToken(): Promise<string | null> {
      try {
        console.error('getAccessToken called');
        
        // First check if we have a valid current access token in memory
        if (currentAccessToken) {
          return currentAccessToken;
        }
        
        // Check for tokens in environment variables or file
        try {
          // Read token file
          const tokenData = readTokens();
          
          if (tokenData) {
            // Check if token is expired
            const now = Date.now();
            if (now > tokenData.expiresAt) {
              console.error(`Token is expired. Current time: ${now}, expires at: ${tokenData.expiresAt}`);
              
              // If we have a refresh token, try to refresh the access token
              if (tokenData.refreshToken || currentRefreshToken) {
                console.error('Attempting to refresh token...');
                const refreshTokenToUse = currentRefreshToken || tokenData.refreshToken;
                const newTokenData = await refreshAccessToken(refreshTokenToUse);
                if (newTokenData) {
                  console.error('Token refreshed successfully');
                  return newTokenData.accessToken;
                }
                console.error('Token refresh failed');
              }
              
              return null;
            }
            
            // Success - return the token and update current state
            currentAccessToken = tokenData.accessToken;
            currentRefreshToken = tokenData.refreshToken;
            console.error(`Successfully retrieved valid token (${tokenData.accessToken.substring(0, 10)}...)`);
            return tokenData.accessToken;
          }
        } catch (readError) {
          console.error(`Direct token read error: ${readError}`);
          return null;
        }
        
        return null;
      } catch (error) {
        console.error("Error getting access token:", error);
        return null;
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states this is a deletion operation, implying mutation, but does not disclose behavioral traits such as whether deletion is permanent, requires specific permissions, has side effects (e.g., affecting task completion status), or error conditions. This is a significant gap for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two concise sentences with zero waste: the first states the action and resource, and the second clarifies scope. It is front-loaded and appropriately sized, earning its place efficiently.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given this is a mutation tool with no annotations and no output schema, the description is incomplete. It covers purpose and scope but lacks details on behavior, permissions, or return values. However, the schema fully documents parameters, and the description differentiates from siblings, making it minimally adequate but with clear gaps for a deletion operation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all three parameters (listId, taskId, checklistItemId) with clear descriptions. The description does not add any parameter-specific details beyond what the schema provides, such as format examples or relationships between parameters, meeting the baseline for high schema coverage.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the specific action ('Delete a checklist item') and resource ('from a task'), distinguishing it from siblings like delete-task or delete-task-list by specifying it removes only the subtask, not the parent task. This provides precise differentiation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage context by stating it deletes 'just the specific subtask, not the parent task,' which helps differentiate from delete-task. However, it does not explicitly mention when to use alternatives like update-checklist-item or get-checklist-items, nor does it specify prerequisites like needing the listId and taskId first.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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