Skip to main content
Glama
ennuiii

Azure DevOps MCP Server with PAT Authentication

by ennuiii

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
NameRequiredDescriptionDefault
idYesThe ID of the work item to update.
updatesYesAn array of field updates to apply to the work item.

Implementation Reference

  • 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) }], }; }
  • 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."), },
  • 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) }], }; } );
  • 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",

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ennuiii/DevOpsMcpPAT'

If you have feedback or need assistance with the MCP directory API, please join our Discord server