set-prioity
Update task priority in Kanban-style workflows. Specify task ID and new priority (low, medium, high) to streamline task management and enhance productivity.
Instructions
set a task to a different priority
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| new_priority | Yes | ||
| task_id | Yes |
Implementation Reference
- src/index.ts:129-150 (handler)The inline handler function for the 'set-prioity' tool. It calls the utility function setTaskPriority and returns a success or error message.async (params) => { try { await mongooseUtils.setTaskPriority(params.task_id, params.new_priority); return { content: [ { type: "text", text: `Set task "${params.task_id}" Priority to "${params.new_priority}" successfully!`, }, ], }; } catch { return { content: [ { type: "text", text: `Failed to set task "${params.task_id}" priority to "${params.new_priority}".`, }, ], }; } }
- src/index.ts:118-121 (schema)Zod input schema defining parameters for the 'set-prioity' tool: task_id (string) and new_priority (enum: low, medium, high).{ task_id: z.string(), new_priority: z.enum(["low", "medium", "high"]), },
- src/index.ts:115-151 (registration)Full registration of the 'set-prioity' tool using server.tool(), including description, input schema, metadata hints, and handler.server.tool( "set-prioity", "set a task to a different priority", { task_id: z.string(), new_priority: z.enum(["low", "medium", "high"]), }, { title: "set a task to a different priority", readonlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: true, }, async (params) => { try { await mongooseUtils.setTaskPriority(params.task_id, params.new_priority); return { content: [ { type: "text", text: `Set task "${params.task_id}" Priority to "${params.new_priority}" successfully!`, }, ], }; } catch { return { content: [ { type: "text", text: `Failed to set task "${params.task_id}" priority to "${params.new_priority}".`, }, ], }; } } );
- src/utils/mongoose.ts:121-136 (helper)Core utility function that updates the priority of a task by ID in the MongoDB database using the Task model.export async function setTaskPriority( taskId: string, priority: "low" | "medium" | "high" ) { try { const task = await Task.findById(taskId); if (!task) { throw new Error("Task not found"); } task.priority = priority; await task.save(); } catch { throw new Error("Failed to set priority"); } }