create-task-list
Organize tasks efficiently by creating new task lists in Microsoft Todo. Define clear categories or projects to streamline task management and improve productivity.
Instructions
Create a new task list (top-level container) in Microsoft Todo to help organize your tasks into categories or projects.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| displayName | Yes | Name of the new task list |
Implementation Reference
- src/todo-index.ts:485-541 (handler)The handler function for the 'create-task-list' tool. It authenticates using getAccessToken, prepares a POST request body with the displayName, calls makeGraphRequest to create the list at /me/todo/lists, and returns formatted success or error messages.async ({ displayName }) => { try { const token = await getAccessToken(); if (!token) { return { content: [ { type: "text", text: "Failed to authenticate with Microsoft API", }, ], }; } // Prepare the request body const requestBody = { displayName }; // Make the API request to create the task list const response = await makeGraphRequest<TaskList>( `${MS_GRAPH_BASE}/me/todo/lists`, token, "POST", requestBody ); if (!response) { return { content: [ { type: "text", text: `Failed to create task list: ${displayName}`, }, ], }; } return { content: [ { type: "text", text: `Task list created successfully!\nName: ${response.displayName}\nID: ${response.id}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error creating task list: ${error}`, }, ], }; } }
- src/todo-index.ts:482-484 (schema)Input schema for the 'create-task-list' tool using Zod, defining the required 'displayName' parameter as a string.{ displayName: z.string().describe("Name of the new task list") },
- src/todo-index.ts:479-542 (registration)Registration of the 'create-task-list' tool on the McpServer instance, specifying name, description, input schema, and handler function.server.tool( "create-task-list", "Create a new task list (top-level container) in Microsoft Todo to help organize your tasks into categories or projects.", { displayName: z.string().describe("Name of the new task list") }, async ({ displayName }) => { try { const token = await getAccessToken(); if (!token) { return { content: [ { type: "text", text: "Failed to authenticate with Microsoft API", }, ], }; } // Prepare the request body const requestBody = { displayName }; // Make the API request to create the task list const response = await makeGraphRequest<TaskList>( `${MS_GRAPH_BASE}/me/todo/lists`, token, "POST", requestBody ); if (!response) { return { content: [ { type: "text", text: `Failed to create task list: ${displayName}`, }, ], }; } return { content: [ { type: "text", text: `Task list created successfully!\nName: ${response.displayName}\nID: ${response.id}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error creating task list: ${error}`, }, ], }; } } );
- src/todo-index.ts:360-366 (schema)TypeScript interface definition for TaskList, used as the generic type for the response in makeGraphRequest within the handler.interface TaskList { id: string; displayName: string; isOwner?: boolean; isShared?: boolean; wellknownListName?: string; // 'none', 'defaultList', 'flaggedEmails', 'unknownFutureValue' }