Skip to main content
Glama
jhirono

Microsoft Todo MCP Service

get-tasks

Retrieve tasks from a Microsoft Todo list with options to filter, sort, and select specific properties for task management.

Instructions

Get tasks from a specific Microsoft Todo list. These are the main todo items that can contain checklist items (subtasks).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
listIdYesID of the task list
filterNoOData $filter query (e.g., 'status eq \'completed\'')
selectNoComma-separated list of properties to include (e.g., 'id,title,status')
orderbyNoProperty to sort by (e.g., 'createdDateTime desc')
topNoMaximum number of tasks to retrieve
skipNoNumber of tasks to skip
countNoWhether to include a count of tasks

Implementation Reference

  • Handler function that authenticates with Microsoft Graph, constructs the API URL with optional OData query parameters (filter, select, orderby, top, skip, count), fetches tasks from /me/todo/lists/{listId}/tasks, formats each task with ID, title, status indicator, due date, importance, categories, and description preview, and returns formatted text response with optional total count.
    async ({ listId, filter, select, orderby, top, skip, count }) => {
      try {
        const token = await getAccessToken();
        if (!token) {
          return {
            content: [
              {
                type: "text",
                text: "Failed to authenticate with Microsoft API",
              },
            ],
          };
        }
    
        // Build the query parameters
        const queryParams = new URLSearchParams();
        
        if (filter) queryParams.append('$filter', filter);
        if (select) queryParams.append('$select', select);
        if (orderby) queryParams.append('$orderby', orderby);
        if (top !== undefined) queryParams.append('$top', top.toString());
        if (skip !== undefined) queryParams.append('$skip', skip.toString());
        if (count !== undefined) queryParams.append('$count', count.toString());
        
        // Construct the URL with query parameters
        const queryString = queryParams.toString();
        const url = `${MS_GRAPH_BASE}/me/todo/lists/${listId}/tasks${queryString ? '?' + queryString : ''}`;
        
        console.error(`Making request to: ${url}`);
    
        const response = await makeGraphRequest<{ value: Task[], '@odata.count'?: number }>(
          url,
          token
        );
        
        if (!response) {
          return {
            content: [
              {
                type: "text",
                text: `Failed to retrieve tasks for list: ${listId}`,
              },
            ],
          };
        }
    
        const tasks = response.value || [];
        if (tasks.length === 0) {
          return {
            content: [
              {
                type: "text",
                text: `No tasks found in list with ID: ${listId}`,
              },
            ],
          };
        }
    
        // Format the tasks based on available properties
        const formattedTasks = tasks.map((task) => {
          // Default format
          let taskInfo = `ID: ${task.id}\nTitle: ${task.title}`;
          
          // Add status if available
          if (task.status) {
            const status = task.status === "completed" ? "✓" : "○";
            taskInfo = `${status} ${taskInfo}`;
          }
          
          // Add due date if available
          if (task.dueDateTime) {
            taskInfo += `\nDue: ${new Date(task.dueDateTime.dateTime).toLocaleDateString()}`;
          }
          
          // Add importance if available
          if (task.importance) {
            taskInfo += `\nImportance: ${task.importance}`;
          }
          
          // Add categories if available
          if (task.categories && task.categories.length > 0) {
            taskInfo += `\nCategories: ${task.categories.join(', ')}`;
          }
          
          // Add body content if available and not empty
          if (task.body && task.body.content && task.body.content.trim() !== '') {
            const previewLength = 50;
            const contentPreview = task.body.content.length > previewLength 
              ? task.body.content.substring(0, previewLength) + '...' 
              : task.body.content;
            taskInfo += `\nDescription: ${contentPreview}`;
          }
          
          return `${taskInfo}\n---`;
        });
    
        // Add count information if requested and available
        let countInfo = '';
        if (count && response['@odata.count'] !== undefined) {
          countInfo = `Total count: ${response['@odata.count']}\n\n`;
        }
    
        return {
          content: [
            {
              type: "text",
              text: `Tasks in list ${listId}:\n\n${countInfo}${formattedTasks.join("\n")}`,
            },
          ],
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error fetching tasks: ${error}`,
            },
          ],
        };
      }
    }
  • Zod input schema defining parameters for the get-tasks tool: required listId, optional OData filter, select, orderby, top, skip, and count.
    {
      listId: z.string().describe("ID of the task list"),
      filter: z.string().optional().describe("OData $filter query (e.g., 'status eq \\'completed\\'')"),
      select: z.string().optional().describe("Comma-separated list of properties to include (e.g., 'id,title,status')"),
      orderby: z.string().optional().describe("Property to sort by (e.g., 'createdDateTime desc')"),
      top: z.number().optional().describe("Maximum number of tasks to retrieve"),
      skip: z.number().optional().describe("Number of tasks to skip"),
      count: z.boolean().optional().describe("Whether to include a count of tasks")
    },
  • Registration of the get-tasks tool on the MCP server using server.tool(), specifying name, description, input schema, and inline handler function.
    server.tool(
      "get-tasks",
      "Get tasks from a specific Microsoft Todo list. These are the main todo items that can contain checklist items (subtasks).",
      {
        listId: z.string().describe("ID of the task list"),
        filter: z.string().optional().describe("OData $filter query (e.g., 'status eq \\'completed\\'')"),
        select: z.string().optional().describe("Comma-separated list of properties to include (e.g., 'id,title,status')"),
        orderby: z.string().optional().describe("Property to sort by (e.g., 'createdDateTime desc')"),
        top: z.number().optional().describe("Maximum number of tasks to retrieve"),
        skip: z.number().optional().describe("Number of tasks to skip"),
        count: z.boolean().optional().describe("Whether to include a count of tasks")
      },
      async ({ listId, filter, select, orderby, top, skip, count }) => {
        try {
          const token = await getAccessToken();
          if (!token) {
            return {
              content: [
                {
                  type: "text",
                  text: "Failed to authenticate with Microsoft API",
                },
              ],
            };
          }
    
          // Build the query parameters
          const queryParams = new URLSearchParams();
          
          if (filter) queryParams.append('$filter', filter);
          if (select) queryParams.append('$select', select);
          if (orderby) queryParams.append('$orderby', orderby);
          if (top !== undefined) queryParams.append('$top', top.toString());
          if (skip !== undefined) queryParams.append('$skip', skip.toString());
          if (count !== undefined) queryParams.append('$count', count.toString());
          
          // Construct the URL with query parameters
          const queryString = queryParams.toString();
          const url = `${MS_GRAPH_BASE}/me/todo/lists/${listId}/tasks${queryString ? '?' + queryString : ''}`;
          
          console.error(`Making request to: ${url}`);
    
          const response = await makeGraphRequest<{ value: Task[], '@odata.count'?: number }>(
            url,
            token
          );
          
          if (!response) {
            return {
              content: [
                {
                  type: "text",
                  text: `Failed to retrieve tasks for list: ${listId}`,
                },
              ],
            };
          }
    
          const tasks = response.value || [];
          if (tasks.length === 0) {
            return {
              content: [
                {
                  type: "text",
                  text: `No tasks found in list with ID: ${listId}`,
                },
              ],
            };
          }
    
          // Format the tasks based on available properties
          const formattedTasks = tasks.map((task) => {
            // Default format
            let taskInfo = `ID: ${task.id}\nTitle: ${task.title}`;
            
            // Add status if available
            if (task.status) {
              const status = task.status === "completed" ? "✓" : "○";
              taskInfo = `${status} ${taskInfo}`;
            }
            
            // Add due date if available
            if (task.dueDateTime) {
              taskInfo += `\nDue: ${new Date(task.dueDateTime.dateTime).toLocaleDateString()}`;
            }
            
            // Add importance if available
            if (task.importance) {
              taskInfo += `\nImportance: ${task.importance}`;
            }
            
            // Add categories if available
            if (task.categories && task.categories.length > 0) {
              taskInfo += `\nCategories: ${task.categories.join(', ')}`;
            }
            
            // Add body content if available and not empty
            if (task.body && task.body.content && task.body.content.trim() !== '') {
              const previewLength = 50;
              const contentPreview = task.body.content.length > previewLength 
                ? task.body.content.substring(0, previewLength) + '...' 
                : task.body.content;
              taskInfo += `\nDescription: ${contentPreview}`;
            }
            
            return `${taskInfo}\n---`;
          });
    
          // Add count information if requested and available
          let countInfo = '';
          if (count && response['@odata.count'] !== undefined) {
            countInfo = `Total count: ${response['@odata.count']}\n\n`;
          }
    
          return {
            content: [
              {
                type: "text",
                text: `Tasks in list ${listId}:\n\n${countInfo}${formattedTasks.join("\n")}`,
              },
            ],
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error fetching tasks: ${error}`,
              },
            ],
          };
        }
      }
    );
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions that tasks 'can contain checklist items,' which adds some context about the data structure, but fails to describe key behaviors like pagination (implied by 'top'/'skip' parameters), rate limits, authentication needs, or what the output looks like (e.g., list of tasks). This is a significant gap for a read operation with multiple parameters.

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

Conciseness4/5

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

The description is appropriately sized with two sentences that are front-loaded and efficient. The first sentence states the core purpose, and the second adds useful context about checklist items without redundancy. It earns its place but could be slightly more structured for clarity.

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

Completeness2/5

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

Given the complexity (7 parameters, no annotations, no output schema), the description is incomplete. It lacks behavioral details (e.g., output format, pagination), usage guidelines, and doesn't fully leverage the opportunity to add value beyond the schema. For a tool with rich filtering options, more context is needed to guide effective use.

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 fully documents all 7 parameters. The description adds no parameter-specific information beyond implying tasks relate to checklist items, which doesn't clarify any parameters. Baseline 3 is appropriate as the schema handles the heavy lifting, but the description doesn't compensate with additional semantic context.

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

Purpose4/5

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

The description clearly states the verb ('Get') and resource ('tasks from a specific Microsoft Todo list'), and distinguishes tasks from checklist items by noting they 'can contain checklist items (subtasks).' However, it doesn't explicitly differentiate from sibling tools like 'get-task-lists' or 'get-checklist-items' beyond the resource scope.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a list ID), exclusions, or comparisons to siblings like 'get-task-lists' for listing lists or 'get-checklist-items' for subtasks, leaving usage context implied at best.

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