Skip to main content
Glama
Tiberriver256

Azure DevOps MCP Server

create_work_item

Automate creation of Azure DevOps work items. Specify type, title, description (HTML), assignee, area, iteration, priority, parent, and custom fields.

Instructions

Create a new work item

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectIdNoThe ID or name of the project (Default: MyProject)
organizationIdNoThe ID or name of the organization (Default: mycompany)
workItemTypeYesThe type of work item to create (e.g., "Task", "Bug", "User Story")
titleYesThe title of the work item
descriptionNoWork item description in HTML format. Multi-line text fields (i.e., System.History, AcceptanceCriteria, etc.) must use HTML format. Do not use CDATA tags.
assignedToNoThe email or name of the user to assign the work item to
areaPathNoThe area path for the work item
iterationPathNoThe iteration path for the work item
priorityNoThe priority of the work item
parentIdNoThe ID of the parent work item to create a relationship with
additionalFieldsNoAdditional fields to set on the work item. Multi-line text fields (i.e., System.History, AcceptanceCriteria, etc.) must use HTML format. Do not use CDATA tags.

Implementation Reference

  • The core handler function that creates a work item via Azure DevOps API. Builds a JSON patch document with title (required), plus optional fields (description, assignedTo, areaPath, iterationPath, priority, parentId, additionalFields), then calls witApi.createWorkItem().
    export async function createWorkItem(
      connection: WebApi,
      projectId: string,
      workItemType: string,
      options: CreateWorkItemOptions,
    ): Promise<WorkItem> {
      try {
        if (!options.title) {
          throw new Error('Title is required');
        }
    
        const witApi = await connection.getWorkItemTrackingApi();
    
        // Create the JSON patch document
        const document = [];
    
        // Add required fields
        document.push({
          op: 'add',
          path: '/fields/System.Title',
          value: options.title,
        });
    
        // Add optional fields if provided
        if (options.description) {
          document.push({
            op: 'add',
            path: '/fields/System.Description',
            value: options.description,
          });
        }
    
        if (options.assignedTo) {
          document.push({
            op: 'add',
            path: '/fields/System.AssignedTo',
            value: options.assignedTo,
          });
        }
    
        if (options.areaPath) {
          document.push({
            op: 'add',
            path: '/fields/System.AreaPath',
            value: options.areaPath,
          });
        }
    
        if (options.iterationPath) {
          document.push({
            op: 'add',
            path: '/fields/System.IterationPath',
            value: options.iterationPath,
          });
        }
    
        if (options.priority !== undefined) {
          document.push({
            op: 'add',
            path: '/fields/Microsoft.VSTS.Common.Priority',
            value: options.priority,
          });
        }
    
        // Add parent relationship if parentId is provided
        if (options.parentId) {
          document.push({
            op: 'add',
            path: '/relations/-',
            value: {
              rel: 'System.LinkTypes.Hierarchy-Reverse',
              url: `${connection.serverUrl}/_apis/wit/workItems/${options.parentId}`,
            },
          });
        }
    
        // Add any additional fields
        if (options.additionalFields) {
          for (const [key, value] of Object.entries(options.additionalFields)) {
            document.push({
              op: 'add',
              path: `/fields/${key}`,
              value: value,
            });
          }
        }
    
        // Create the work item
        const workItem = await witApi.createWorkItem(
          null,
          document,
          projectId,
          workItemType,
        );
    
        if (!workItem) {
          throw new Error('Failed to create work item');
        }
    
        return workItem;
      } catch (error) {
        if (error instanceof AzureDevOpsError) {
          throw error;
        }
        throw new Error(
          `Failed to create work item: ${error instanceof Error ? error.message : String(error)}`,
        );
      }
    }
  • Zod schema definition for the create_work_item tool input. Defines projectId, organizationId, workItemType (required), title (required), and optional fields: description, assignedTo, areaPath, iterationPath, priority, parentId, additionalFields.
    export const CreateWorkItemSchema = z.object({
      projectId: z
        .string()
        .optional()
        .describe(`The ID or name of the project (Default: ${defaultProject})`),
      organizationId: z
        .string()
        .optional()
        .describe(`The ID or name of the organization (Default: ${defaultOrg})`),
      workItemType: z
        .string()
        .describe(
          'The type of work item to create (e.g., "Task", "Bug", "User Story")',
        ),
      title: z.string().describe('The title of the work item'),
      description: z
        .string()
        .optional()
        .describe(
          'Work item description in HTML format. Multi-line text fields (i.e., System.History, AcceptanceCriteria, etc.) must use HTML format. Do not use CDATA tags.',
        ),
      assignedTo: z
        .string()
        .optional()
        .describe('The email or name of the user to assign the work item to'),
      areaPath: z.string().optional().describe('The area path for the work item'),
      iterationPath: z
        .string()
        .optional()
        .describe('The iteration path for the work item'),
      priority: z.number().optional().describe('The priority of the work item'),
      parentId: z
        .number()
        .optional()
        .describe('The ID of the parent work item to create a relationship with'),
      additionalFields: z
        .record(z.string(), z.any())
        .optional()
        .describe(
          'Additional fields to set on the work item. Multi-line text fields (i.e., System.History, AcceptanceCriteria, etc.) must use HTML format. Do not use CDATA tags.',
        ),
    });
  • Tool registration entry in tool-definitions.ts defining the tool name 'create_work_item' with description and inputSchema derived from CreateWorkItemSchema.
      {
        name: 'create_work_item',
        description: 'Create a new work item',
        inputSchema: zodToJsonSchema(CreateWorkItemSchema),
      },
      {
        name: 'update_work_item',
        description: 'Update an existing work item',
        inputSchema: zodToJsonSchema(UpdateWorkItemSchema),
      },
      {
        name: 'manage_work_item_link',
        description: 'Add or remove links between work items',
        inputSchema: zodToJsonSchema(ManageWorkItemLinkSchema),
      },
    ];
  • Request handler routing in the work-items feature index. The 'create_work_item' case parses arguments via CreateWorkItemSchema, then invokes the createWorkItem handler function with the connection, projectId, workItemType, and options.
        case 'create_work_item': {
          const args = CreateWorkItemSchema.parse(request.params.arguments);
          const result = await createWorkItem(
            connection,
            args.projectId ?? defaultProject,
            args.workItemType,
            {
              title: args.title,
              description: args.description,
              assignedTo: args.assignedTo,
              areaPath: args.areaPath,
              iterationPath: args.iterationPath,
              priority: args.priority,
              parentId: args.parentId,
              additionalFields: args.additionalFields,
            },
          );
          return {
            content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
          };
        }
        case 'update_work_item': {
          const args = UpdateWorkItemSchema.parse(request.params.arguments);
          const result = await updateWorkItem(connection, args.workItemId, {
            title: args.title,
            description: args.description,
            assignedTo: args.assignedTo,
            areaPath: args.areaPath,
            iterationPath: args.iterationPath,
            priority: args.priority,
            state: args.state,
            additionalFields: args.additionalFields,
          });
          return {
            content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
          };
        }
        case 'manage_work_item_link': {
          const args = ManageWorkItemLinkSchema.parse(request.params.arguments);
          const result = await manageWorkItemLink(
            connection,
            args.projectId ?? defaultProject,
            {
              sourceWorkItemId: args.sourceWorkItemId,
              targetWorkItemId: args.targetWorkItemId,
              operation: args.operation,
              relationType: args.relationType,
              newRelationType: args.newRelationType,
              comment: args.comment,
            },
          );
          return {
            content: [{ type: 'text', text: JSON.stringify(result, null, 2) }],
          };
        }
        default:
          throw new Error(`Unknown work items tool: ${request.params.name}`);
      }
    };
  • TypeScript interface 'CreateWorkItemOptions' defining the typed options object for creating work items (title, description, assignedTo, areaPath, iterationPath, priority, parentId, additionalFields).
    export interface CreateWorkItemOptions {
      title: string;
      description?: string;
      assignedTo?: string;
      areaPath?: string;
      iterationPath?: string;
      priority?: number;
      parentId?: number;
      additionalFields?: Record<string, string | number | boolean | null>;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden but only states 'Create a new work item'. It does not disclose behavioral traits like what the response contains, whether the operation is idempotent, whether it requires specific authentication, or any side effects.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence, which is too short for a tool with 11 parameters and no annotations. It fails to provide sufficient detail while being concise, crossing into under-specification.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (11 parameters, no annotations, no output schema, and many sibling tools), the description is insufficient. It lacks information about return values, error behavior, and usage context beyond the schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, so the baseline is 3. The description adds no additional parameter information beyond what the schema already provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Create a new work item' clearly states verb and resource, but it does not differentiate from sibling tools like update_work_item or manage_work_item_link. It is specific enough to convey the core purpose.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives (e.g., update_work_item, search_work_items). There is no indication of prerequisites or context such as required permissions or relationships.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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