Skip to main content
Glama
jhirono

Microsoft Todo MCP Service

get-checklist-items

Retrieve subtasks and smaller components for a specific Microsoft Todo task to track progress and manage detailed steps.

Instructions

Get checklist items (subtasks) for a specific task. Checklist items are smaller steps or components that belong to a parent task.

Input Schema

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

Implementation Reference

  • Registration of the 'get-checklist-items' MCP tool, including name, description, input schema, and inline handler function that fetches checklist items via Microsoft Graph API.
    server.tool(
      "get-checklist-items",
      "Get checklist items (subtasks) for a specific task. Checklist items are smaller steps or components that belong to a parent task.",
      {
        listId: z.string().describe("ID of the task list"),
        taskId: z.string().describe("ID of the task"),
      },
      async ({ listId, taskId }) => {
        try {
          const token = await getAccessToken();
          if (!token) {
            return {
              content: [
                {
                  type: "text",
                  text: "Failed to authenticate with Microsoft API",
                },
              ],
            };
          }
    
          // Fetch the task first to get its title
          const taskResponse = await makeGraphRequest<Task>(
            `${MS_GRAPH_BASE}/me/todo/lists/${listId}/tasks/${taskId}`,
            token
          );
          
          const taskTitle = taskResponse ? taskResponse.title : "Unknown Task";
    
          // Fetch the checklist items
          const response = await makeGraphRequest<{ value: ChecklistItem[] }>(
            `${MS_GRAPH_BASE}/me/todo/lists/${listId}/tasks/${taskId}/checklistItems`,
            token
          );
          
          if (!response) {
            return {
              content: [
                {
                  type: "text",
                  text: `Failed to retrieve checklist items for task: ${taskId}`,
                },
              ],
            };
          }
    
          const items = response.value || [];
          if (items.length === 0) {
            return {
              content: [
                {
                  type: "text",
                  text: `No checklist items found for task "${taskTitle}" (ID: ${taskId})`,
                },
              ],
            };
          }
    
          const formattedItems = items.map((item) => {
            const status = item.isChecked ? "✓" : "○";
            let itemInfo = `${status} ${item.displayName} (ID: ${item.id})`;
            
            // Add creation date if available
            if (item.createdDateTime) {
              const createdDate = new Date(item.createdDateTime).toLocaleString();
              itemInfo += `\nCreated: ${createdDate}`;
            }
            
            return itemInfo;
          });
    
          return {
            content: [
              {
                type: "text",
                text: `Checklist items for task "${taskTitle}" (ID: ${taskId}):\n\n${formattedItems.join("\n\n")}`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error fetching checklist items: ${error}`,
              },
            ],
          };
        }
      }
    );
  • Handler function that authenticates, fetches the parent task title, retrieves checklist items from Microsoft Graph API endpoint `/me/todo/lists/{listId}/tasks/{taskId}/checklistItems`, formats them with check status and creation date, and returns formatted text response.
    async ({ listId, taskId }) => {
      try {
        const token = await getAccessToken();
        if (!token) {
          return {
            content: [
              {
                type: "text",
                text: "Failed to authenticate with Microsoft API",
              },
            ],
          };
        }
    
        // Fetch the task first to get its title
        const taskResponse = await makeGraphRequest<Task>(
          `${MS_GRAPH_BASE}/me/todo/lists/${listId}/tasks/${taskId}`,
          token
        );
        
        const taskTitle = taskResponse ? taskResponse.title : "Unknown Task";
    
        // Fetch the checklist items
        const response = await makeGraphRequest<{ value: ChecklistItem[] }>(
          `${MS_GRAPH_BASE}/me/todo/lists/${listId}/tasks/${taskId}/checklistItems`,
          token
        );
        
        if (!response) {
          return {
            content: [
              {
                type: "text",
                text: `Failed to retrieve checklist items for task: ${taskId}`,
              },
            ],
          };
        }
    
        const items = response.value || [];
        if (items.length === 0) {
          return {
            content: [
              {
                type: "text",
                text: `No checklist items found for task "${taskTitle}" (ID: ${taskId})`,
              },
            ],
          };
        }
    
        const formattedItems = items.map((item) => {
          const status = item.isChecked ? "✓" : "○";
          let itemInfo = `${status} ${item.displayName} (ID: ${item.id})`;
          
          // Add creation date if available
          if (item.createdDateTime) {
            const createdDate = new Date(item.createdDateTime).toLocaleString();
            itemInfo += `\nCreated: ${createdDate}`;
          }
          
          return itemInfo;
        });
    
        return {
          content: [
            {
              type: "text",
              text: `Checklist items for task "${taskTitle}" (ID: ${taskId}):\n\n${formattedItems.join("\n\n")}`,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error fetching checklist items: ${error}`,
            },
          ],
        };
      }
    }
  • Zod input schema defining required parameters: listId (task list ID) and taskId (task ID).
    {
      listId: z.string().describe("ID of the task list"),
      taskId: z.string().describe("ID of the task"),
    },
  • TypeScript interface defining the structure of a ChecklistItem used in the tool's response typing.
    interface ChecklistItem {
      id: string;
      displayName: string;
      isChecked: boolean;
      createdDateTime?: string;
    }

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