wit_update_work_item
Modifies specific fields of a work item in Azure DevOps using its ID. Supports add, replace, and remove operations for field updates via PAT authentication.
Instructions
Update a work item by ID with specified fields.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | The ID of the work item to update. | |
| updates | Yes | An array of field updates to apply to the work item. |
Implementation Reference
- src/tools/workitems.ts:507-522 (handler)The handler function that updates the specified work item ID with the provided patch operations using the Azure DevOps WorkItemTrackingApi.updateWorkItem method.async ({ id, updates }) => { const connection = await connectionProvider(); const workItemApi = await connection.getWorkItemTrackingApi(); // Convert operation names to lowercase for API const apiUpdates = updates.map((update) => ({ ...update, op: update.op, })); const updatedWorkItem = await workItemApi.updateWorkItem(null, apiUpdates, id); return { content: [{ type: "text", text: JSON.stringify(updatedWorkItem, null, 2) }], }; }
- src/tools/workitems.ts:490-506 (schema)Zod input schema defining parameters: id (number) and updates (array of patch operations with op, path, value).{ id: z.number().describe("The ID of the work item to update."), updates: z .array( z.object({ op: z .string() .transform((val) => val.toLowerCase()) .pipe(z.enum(["add", "replace", "remove"])) .default("add") .describe("The operation to perform on the field."), path: z.string().describe("The path of the field to update, e.g., '/fields/System.Title'."), value: z.string().describe("The new value for the field. This is required for 'Add' and 'Replace' operations, and should be omitted for 'Remove' operations."), }) ) .describe("An array of field updates to apply to the work item."), },
- src/tools/workitems.ts:487-523 (registration)The server.tool call that registers the 'wit_update_work_item' tool, referencing WORKITEM_TOOLS.update_work_item, with description, schema, and handler.server.tool( WORKITEM_TOOLS.update_work_item, "Update a work item by ID with specified fields.", { id: z.number().describe("The ID of the work item to update."), updates: z .array( z.object({ op: z .string() .transform((val) => val.toLowerCase()) .pipe(z.enum(["add", "replace", "remove"])) .default("add") .describe("The operation to perform on the field."), path: z.string().describe("The path of the field to update, e.g., '/fields/System.Title'."), value: z.string().describe("The new value for the field. This is required for 'Add' and 'Replace' operations, and should be omitted for 'Remove' operations."), }) ) .describe("An array of field updates to apply to the work item."), }, async ({ id, updates }) => { const connection = await connectionProvider(); const workItemApi = await connection.getWorkItemTrackingApi(); // Convert operation names to lowercase for API const apiUpdates = updates.map((update) => ({ ...update, op: update.op, })); const updatedWorkItem = await workItemApi.updateWorkItem(null, apiUpdates, id); return { content: [{ type: "text", text: JSON.stringify(updatedWorkItem, null, 2) }], }; } );
- src/tools/workitems.ts:18-18 (registration)Constant mapping the handler name 'update_work_item' to the tool name 'wit_update_work_item' in WORKITEM_TOOLS object.update_work_item: "wit_update_work_item",