update_projects
Modify Todoist project details like color, favorite status, and view style using ID or name identification.
Instructions
Update projects in Todoist Either 'id' or the 'name' to identify the target.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| items | Yes |
Implementation Reference
- src/utils/handlers.ts:240-311 (handler)Core logic for updating projects: resolves project ID by name if needed, validates path parameter, constructs /projects/{id} path, removes ID from params, performs POST request to Todoist API, and formats response.if (options.mode !== 'create' && options.idField) { let itemId = item[options.idField]; let matchedName = null; let matchedContent = null; // If no ID but name is provided, search by name if (!itemId && item[options.nameField!] && options.findByName) { const searchName = item[options.nameField!]; const matchedItem = options.findByName(searchName, allItems); if (!matchedItem) { return { success: false, error: `Item not found with name: ${searchName}`, item, }; } itemId = matchedItem.id; matchedName = searchName; matchedContent = matchedItem.content; } if (!itemId) { return { success: false, error: `Either ${options.idField} or ${options.nameField} must be provided`, item, }; } // Apply security validation to itemId before using in path const safeItemId = validatePathParameter(itemId, options.idField || 'id'); if (options.basePath && options.pathSuffix) { finalPath = `${options.basePath}${options.pathSuffix.replace('{id}', safeItemId)}`; } else if (options.path) { finalPath = options.path.replace('{id}', safeItemId); } delete apiParams[options.idField]; if (options.nameField) { delete apiParams[options.nameField]; } let result; switch (options.method) { case 'GET': result = await todoistApi.get(finalPath, apiParams); break; case 'POST': result = await todoistApi.post(finalPath, apiParams); break; case 'DELETE': result = await todoistApi.delete(finalPath); break; } const response: any = { success: true, id: itemId, result, }; if (matchedName) { response.found_by_name = matchedName; response.matched_content = matchedContent; } return response; } // Create mode
- src/tools/projects.ts:47-64 (registration)Registers the 'update_projects' MCP tool using the batch API handler factory, defining input schema, HTTP method, path, update mode, ID/name fields, and name matching logic.createBatchApiHandler({ name: 'update_projects', description: 'Update projects in Todoist', itemSchema: { id: z.string().optional().describe('ID of the project to update (preferred over name)'), name: z.string().optional().describe('Name of the project to update'), color: z.string().optional(), is_favorite: z.boolean().optional(), view_style: z.enum(['list', 'board']).optional(), }, method: 'POST', path: '/projects/{id}', mode: 'update', idField: 'id', nameField: 'name', findByName: (name, items) => items.find(item => item.name.toLowerCase().includes(name.toLowerCase())), });
- src/tools/projects.ts:50-56 (schema)Zod schema defining input parameters for updating a project: ID or name (required), optional color, favorite status, and view style.itemSchema: { id: z.string().optional().describe('ID of the project to update (preferred over name)'), name: z.string().optional().describe('Name of the project to update'), color: z.string().optional(), is_favorite: z.boolean().optional(), view_style: z.enum(['list', 'board']).optional(), },