Skip to main content
Glama
jhirono

Microsoft Todo MCP Service

get-task-lists

Retrieve all Microsoft Todo task lists, including names, IDs, and details on default or shared lists, for efficient task organization and management.

Instructions

Get all Microsoft Todo task lists (the top-level containers that organize your tasks). Shows list names, IDs, and indicates default or shared lists.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The complete inline handler function for the 'get-task-lists' tool, registered via server.tool. It authenticates, fetches task lists from Microsoft Graph API (/me/todo/lists), formats them with details like ID, name, default/shared status, and returns formatted text response.
    server.tool( "get-task-lists", "Get all Microsoft Todo task lists (the top-level containers that organize your tasks). Shows list names, IDs, and indicates default or shared lists.", {}, async () => { try { const token = await getAccessToken(); if (!token) { return { content: [ { type: "text", text: "Failed to authenticate with Microsoft API", }, ], }; } const response = await makeGraphRequest<{ value: TaskList[] }>( `${MS_GRAPH_BASE}/me/todo/lists`, token ); if (!response) { return { content: [ { type: "text", text: "Failed to retrieve task lists", }, ], }; } const lists = response.value || []; if (lists.length === 0) { return { content: [ { type: "text", text: "No task lists found.", }, ], }; } const formattedLists = lists.map((list) => { // Add well-known list name if applicable let wellKnownInfo = ""; if (list.wellknownListName && list.wellknownListName !== "none") { if (list.wellknownListName === "defaultList") { wellKnownInfo = " (Default Tasks List)"; } else if (list.wellknownListName === "flaggedEmails") { wellKnownInfo = " (Flagged Emails)"; } } // Add sharing info if applicable let sharingInfo = ""; if (list.isShared) { sharingInfo = list.isOwner ? " (Shared by you)" : " (Shared with you)"; } return `ID: ${list.id}\nName: ${list.displayName}${wellKnownInfo}${sharingInfo}\n---`; }); return { content: [ { type: "text", text: `Your task lists:\n\n${formattedLists.join("\n")}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error fetching task lists: ${error}`, }, ], }; } } );
  • Registration of the 'get-task-lists' tool using McpServer.tool method, including empty input schema {}.
    server.tool( "get-task-lists", "Get all Microsoft Todo task lists (the top-level containers that organize your tasks). Shows list names, IDs, and indicates default or shared lists.", {}, async () => { try { const token = await getAccessToken(); if (!token) { return { content: [ { type: "text", text: "Failed to authenticate with Microsoft API", }, ], }; } const response = await makeGraphRequest<{ value: TaskList[] }>( `${MS_GRAPH_BASE}/me/todo/lists`, token ); if (!response) { return { content: [ { type: "text", text: "Failed to retrieve task lists", }, ], }; } const lists = response.value || []; if (lists.length === 0) { return { content: [ { type: "text", text: "No task lists found.", }, ], }; } const formattedLists = lists.map((list) => { // Add well-known list name if applicable let wellKnownInfo = ""; if (list.wellknownListName && list.wellknownListName !== "none") { if (list.wellknownListName === "defaultList") { wellKnownInfo = " (Default Tasks List)"; } else if (list.wellknownListName === "flaggedEmails") { wellKnownInfo = " (Flagged Emails)"; } } // Add sharing info if applicable let sharingInfo = ""; if (list.isShared) { sharingInfo = list.isOwner ? " (Shared by you)" : " (Shared with you)"; } return `ID: ${list.id}\nName: ${list.displayName}${wellKnownInfo}${sharingInfo}\n---`; }); return { content: [ { type: "text", text: `Your task lists:\n\n${formattedLists.join("\n")}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error fetching task lists: ${error}`, }, ], }; } } );
  • Empty input schema (no parameters required) for the get-task-lists tool.
    {},
  • makeGraphRequest helper function used by the tool to make authenticated HTTP requests to Microsoft Graph API.
    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; } }
  • TaskList TypeScript interface defining the structure of task list objects returned from the API.
    interface TaskList { id: string; displayName: string; isOwner?: boolean; isShared?: boolean; wellknownListName?: string; // 'none', 'defaultList', 'flaggedEmails', 'unknownFutureValue' }

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