Skip to main content
Glama
stefanskiasan

Azure DevOps MCP Server for Cline

create_work_item

Create new Azure DevOps work items (Bugs, Tasks, User Stories) by applying JSON patch operations to define fields and properties.

Instructions

Create a new work item using JSON patch operations

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
typeYesWork item type (e.g., "Bug", "Task", "User Story")
documentYesArray of JSON patch operations to apply

Implementation Reference

  • The main handler function `createWorkItem` that executes the tool logic: validates parameters, sets up Azure DevOps connection, creates the work item using the API, and formats the response as MCP content.
    export async function createWorkItem(args: { type: string; document: JsonPatchOperation[] }, config: AzureDevOpsConfig) { if (!args.type || !args.document || !args.document.length) { throw new McpError(ErrorCode.InvalidParams, 'Work item type and patch document are required'); } AzureDevOpsConnection.initialize(config); const connection = AzureDevOpsConnection.getInstance(); const workItemTrackingApi = await connection.getWorkItemTrackingApi(); const workItem = await workItemTrackingApi.createWorkItem( undefined, args.document, config.project, args.type ); return { content: [ { type: 'text', text: JSON.stringify(workItem, null, 2), }, ], }; }
  • Input schema and metadata (name, description) for the 'create_work_item' tool.
    { name: 'create_work_item', description: 'Create a new work item using JSON patch operations', inputSchema: { type: 'object', properties: { type: { type: 'string', description: 'Work item type (e.g., "Bug", "Task", "User Story")', }, document: { type: 'array', items: { type: 'object', properties: { op: { type: 'string', enum: ['add', 'remove', 'replace', 'move', 'copy', 'test'], description: 'The patch operation to perform', }, path: { type: 'string', description: 'The path for the operation (e.g., /fields/System.Title)', }, value: { description: 'The value for the operation', }, }, required: ['op', 'path'], }, description: 'Array of JSON patch operations to apply', }, }, required: ['type', 'document'], }, },
  • Registers the `createWorkItem` handler within the `workItemTools` object, which is used by the MCP server for tool execution and provides definitions for listing tools.
    export const workItemTools = { initialize: (config: AzureDevOpsConfig) => ({ getWorkItem: (args: WorkItemBatchGetRequest) => getWorkItem(args, config), listWorkItems: (args: Wiql) => listWorkItems(args, config), createWorkItem: (args: { type: string; document: JsonPatchOperation[] }) => createWorkItem(args, config), updateWorkItem: (args: { id: number; document: JsonPatchOperation[] }) => updateWorkItem(args, config), definitions, }),
  • src/index.ts:73-90 (registration)
    Top-level initialization of tool instances including workItemTools (which contains create_work_item), and combines definitions from all tool groups for MCP server registration.
    const toolInstances = { workItem: workItemTools.initialize(this.config), board: boardTools.initialize(this.config), wiki: wikiTools.initialize(this.config), project: projectTools.initialize(this.config), pipeline: pipelineTools.initialize(this.config), pullRequest: pullRequestTools.initialize(this.config), }; // Combine all tool definitions this.toolDefinitions = [ ...toolInstances.workItem.definitions, ...toolInstances.board.definitions, ...toolInstances.wiki.definitions, ...toolInstances.project.definitions, ...toolInstances.pipeline.definitions, ...toolInstances.pullRequest.definitions, ];

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/stefanskiasan/azure-devops-mcp-server'

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