set-prioity
Update task priority levels (low, medium, high) in a Kanban system to manage workflow and focus on important items.
Instructions
set a task to a different priority
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| task_id | Yes | ||
| new_priority | Yes |
Implementation Reference
- src/index.ts:129-150 (handler)Inline handler function for the 'set-prioity' MCP tool. It calls the helper function setTaskPriority and formats success/error responses.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:119-121 (schema)Zod input schema for the 'set-prioity' tool defining task_id and new_priority parameters.task_id: z.string(), new_priority: z.enum(["low", "medium", "high"]), },
- src/index.ts:115-151 (registration)Registration of the 'set-prioity' tool using server.tool, including name, description, schema, 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)Helper function that performs the actual database update for task priority using Mongoose 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"); } }