update-tasklist
Modify the title of an existing Google Tasks list to reflect changes in project scope or organization needs.
Instructions
Update an existing task list
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tasklist | Yes | Task list ID | |
| title | Yes | New title for the task list |
Implementation Reference
- src/index.ts:354-399 (handler)The handler function for the 'update-tasklist' tool. It checks authentication, calls the Google Tasks API to update the tasklist title, and returns success or error response.async ({ tasklist, title }) => { if (!isAuthenticated()) { return { isError: true, content: [ { type: "text", text: "Not authenticated. Please use the 'authenticate' tool first.", }, ], }; } try { const response = await tasks.tasklists.update({ tasklist, requestBody: { title, }, }); return { content: [ { type: "text", text: `Task list updated successfully:\n\n${JSON.stringify( response.data, null, 2 )}`, }, ], }; } catch (error) { console.error("Error updating task list:", error); return { isError: true, content: [ { type: "text", text: `Error updating task list: ${error}`, }, ], }; } }
- src/index.ts:350-353 (schema)Zod schema defining the input parameters: tasklist ID and new title.{ tasklist: z.string().describe("Task list ID"), title: z.string().describe("New title for the task list"), },
- src/index.ts:347-400 (registration)Registration of the 'update-tasklist' tool using server.tool(), including name, description, schema, and handler.server.tool( "update-tasklist", "Update an existing task list", { tasklist: z.string().describe("Task list ID"), title: z.string().describe("New title for the task list"), }, async ({ tasklist, title }) => { if (!isAuthenticated()) { return { isError: true, content: [ { type: "text", text: "Not authenticated. Please use the 'authenticate' tool first.", }, ], }; } try { const response = await tasks.tasklists.update({ tasklist, requestBody: { title, }, }); return { content: [ { type: "text", text: `Task list updated successfully:\n\n${JSON.stringify( response.data, null, 2 )}`, }, ], }; } catch (error) { console.error("Error updating task list:", error); return { isError: true, content: [ { type: "text", text: `Error updating task list: ${error}`, }, ], }; } } );