update-task-list
Modify the name of an existing task list in Microsoft Todo by specifying the list ID and providing a new display name for accurate organization and management.
Instructions
Update the name of an existing task list (top-level container) in Microsoft Todo.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| displayName | Yes | New name for the task list | |
| listId | Yes | ID of the task list to update |
Implementation Reference
- src/todo-index.ts:551-607 (handler)The core handler function that authenticates with Microsoft Graph API using getAccessToken(), constructs the PATCH request body with the new displayName, calls makeGraphRequest to update the task list at /me/todo/lists/{listId}, and returns success or error messages.async ({ listId, 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 update the task list const response = await makeGraphRequest<TaskList>( `${MS_GRAPH_BASE}/me/todo/lists/${listId}`, token, "PATCH", requestBody ); if (!response) { return { content: [ { type: "text", text: `Failed to update task list with ID: ${listId}`, }, ], }; } return { content: [ { type: "text", text: `Task list updated successfully!\nNew name: ${response.displayName}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error updating task list: ${error}`, }, ], }; } }
- src/todo-index.ts:547-550 (schema)Zod schema for input parameters: listId (required string ID of the task list) and displayName (required new name string). Used for input validation in the tool registration.{ listId: z.string().describe("ID of the task list to update"), displayName: z.string().describe("New name for the task list") },
- src/todo-index.ts:544-608 (registration)MCP server tool registration for 'update-task-list', including the tool name, description, input schema with Zod, and reference to the handler function.server.tool( "update-task-list", "Update the name of an existing task list (top-level container) in Microsoft Todo.", { listId: z.string().describe("ID of the task list to update"), displayName: z.string().describe("New name for the task list") }, async ({ listId, 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 update the task list const response = await makeGraphRequest<TaskList>( `${MS_GRAPH_BASE}/me/todo/lists/${listId}`, token, "PATCH", requestBody ); if (!response) { return { content: [ { type: "text", text: `Failed to update task list with ID: ${listId}`, }, ], }; } return { content: [ { type: "text", text: `Task list updated successfully!\nNew name: ${response.displayName}`, }, ], }; } catch (error) { return { content: [ { type: "text", text: `Error updating task list: ${error}`, }, ], }; } } );