bulk_update_projects
Apply common settings updates to multiple projects simultaneously, including status changes and reasons, to manage project collections efficiently.
Instructions
Update multiple projects at once with common settings
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_ids | Yes | Array of project IDs to update | |
| updates | Yes | Updates to apply to all projects | |
| reason | No | Reason for bulk update |
Implementation Reference
- src/tools/projects.ts:650-695 (handler)The bulkUpdateProjects function is the core handler that parses arguments, loops through project IDs, updates each project via supabaseService.updateProject, handles errors, and returns a summary with results.export const bulkUpdateProjects = requireAuth(async (args: any) => { const { project_ids, updates, reason } = BulkUpdateProjectsSchema.parse(args) logger.info('Bulk updating projects', { project_count: project_ids.length, updates, reason }) const results = [] const now = new Date().toISOString() for (const project_id of project_ids) { try { const updateData = { ...updates, updated_at: now, // metadata field doesn't exist in the database schema } const result = await supabaseService.updateProject(project_id, updateData) results.push({ project_id, success: true, project: result }) } catch (error) { logger.error(`Failed to update project ${project_id}:`, error) results.push({ project_id, success: false, error: error instanceof Error ? error.message : 'Unknown error' }) } } const successCount = results.filter(r => r.success).length const failureCount = results.filter(r => !r.success).length return { summary: { total_projects: project_ids.length, successful_updates: successCount, failed_updates: failureCount, success_rate: (successCount / project_ids.length) * 100 }, results, applied_updates: updates } })
- src/tools/projects.ts:641-648 (schema)Zod schema used for input validation inside the handler, defining project_ids (required array), updates (object with optional status), and optional reason.const BulkUpdateProjectsSchema = z.object({ project_ids: z.array(z.string().min(1)).min(1), updates: z.object({ status: z.enum(['active', 'completed', 'archived']).optional() // Removed priority, visibility, owner_id as they don't exist in the database schema }), reason: z.string().optional() })
- src/tools/projects.ts:613-639 (registration)MCPTool object registration for 'bulk_update_projects', defining the tool name, description, and JSON input schema for MCP protocol.export const bulkUpdateProjectsTool: MCPTool = { name: 'bulk_update_projects', description: 'Update multiple projects at once with common settings', inputSchema: { type: 'object', properties: { project_ids: { type: 'array', items: { type: 'string' }, description: 'Array of project IDs to update' }, updates: { type: 'object', properties: { status: { type: 'string', enum: ['active', 'completed', 'archived'] } // Removed priority, visibility, owner_id as they don't exist in the database schema }, description: 'Updates to apply to all projects' }, reason: { type: 'string', description: 'Reason for bulk update' } }, required: ['project_ids', 'updates'] } }
- src/tools/projects.ts:778-788 (registration)projectHandlers object that maps tool names to their handler functions, including bulk_update_projects: bulkUpdateProjects, likely used for central registration.export const projectHandlers = { list_projects: listProjects, get_project: getProject, create_project: createProject, update_project: updateProject, get_project_context: getProjectContext, archive_project: archiveProject, duplicate_project: duplicateProject, get_project_timeline: getProjectTimeline, bulk_update_projects: bulkUpdateProjects }
- src/tools/projects.ts:766-776 (registration)projectTools object exporting all project-related MCPTool objects, including bulkUpdateProjectsTool, for collective registration.export const projectTools = { listProjectsTool, getProjectTool, createProjectTool, updateProjectTool, getProjectContextTool, archiveProjectTool, duplicateProjectTool, getProjectTimelineTool, bulkUpdateProjectsTool }