Skip to main content
Glama
mmruesch12
by mmruesch12

create_work_item

Generate and manage work items in Azure DevOps by specifying project, type, title, description, and assignee to streamline task tracking and project management.

Instructions

Create a new work item

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
assignedToNoUser to assign the work item to
descriptionNoDescription of the work item
projectYesName of the Azure DevOps project
titleYesTitle of the work item
typeYesType of work item (e.g., 'Task', 'Bug')

Implementation Reference

  • The main handler function for the 'create_work_item' tool. Parses input using Zod schema, performs additional validation for 'Feature' type, constructs patch operations for required and optional fields, calls the Azure DevOps Work Item Tracking client to create the work item, and returns the created work item as JSON.
    export async function createWorkItem(rawParams: any) {
      // Parse arguments with defaults from environment variables
      const params = createWorkItemSchema.parse({
        project: rawParams.project || DEFAULT_PROJECT,
        type: rawParams.type,
        title: rawParams.title,
        description: rawParams.description,
        assignedTo: rawParams.assignedTo,
        technologyInvestmentType: rawParams.technologyInvestmentType,
        securityVulnerability: rawParams.securityVulnerability,
      });
    
      console.error("[API] Creating work item:", params);
    
      // Specific validation for 'Feature' type
      if (params.type === "Feature") {
        if (!params.technologyInvestmentType) {
          throw new Error(
            "Field 'technologyInvestmentType' is required for work item type 'Feature'."
          );
        }
        if (!params.securityVulnerability) {
          throw new Error(
            "Field 'securityVulnerability' is required for work item type 'Feature'."
          );
        }
      }
    
      try {
        // Get the Work Item Tracking API client
        const witClient = await getWorkItemClient();
    
        // Create patch operations for the work item
        const patchOperations = [ // Removed explicit type annotation
          {
            op: "add",
            path: "/fields/System.Title",
            value: params.title,
          },
        ];
    
        // Conditionally add optional fields
        if (params.technologyInvestmentType) {
          patchOperations.push({
            op: "add",
            path: "/fields/Technology Investment Type", // Assuming field name
            value: params.technologyInvestmentType,
          });
        }
    
        if (params.securityVulnerability) {
          patchOperations.push({
            op: "add",
            path: "/fields/Security Vulnerability", // Assuming field name
            value: params.securityVulnerability,
          });
        }
    
        if (params.description) {
          patchOperations.push({
            op: "add",
            path: "/fields/System.Description",
            value: params.description,
          });
        }
    
        if (params.assignedTo) {
          patchOperations.push({
            op: "add",
            path: "/fields/System.AssignedTo",
            value: params.assignedTo,
          });
        }
    
        // Create the work item
        const workItem = await witClient.createWorkItem(
          undefined,
          patchOperations,
          params.project,
          params.type
        );
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(workItem, null, 2),
            },
          ],
        };
      } catch (error) {
        logError("Error creating work item", error);
        throw error;
      }
    }
  • Zod schema used for input validation in the createWorkItem handler, defining the expected parameters with types and optionality.
    export const createWorkItemSchema = z.object({
      project: z.string(),
      type: z.string(),
      title: z.string(),
      description: z.string().optional(),
      assignedTo: z.string().optional(),
      technologyInvestmentType: z.string().optional(), // Made optional
      securityVulnerability: z.string().optional(), // Made optional
    });
    
    export type CreateWorkItemParams = z.infer<typeof createWorkItemSchema>;
  • Tool registration in the workItemTools array, defining the name, description, and inputSchema for 'create_work_item' which is later included in the MCP server's tool list.
    {
      name: "create_work_item",
      description: "Create a new work item",
      inputSchema: {
        type: "object",
        properties: {
          project: {
            type: "string",
            description: "Name of the Azure DevOps project",
          },
          type: {
            type: "string",
            description: "Type of work item (e.g., 'Task', 'Bug')",
          },
          title: {
            type: "string",
            description: "Title of the work item",
          },
          description: {
            type: "string",
            description: "Description of the work item",
          },
          assignedTo: {
            type: "string",
            description: "User to assign the work item to",
          },
          technologyInvestmentType: {
            type: "string",
            description:
              "The Technology Investment Type for the work item (Required for Features)", // Updated description
          },
          securityVulnerability: {
            type: "string",
            description:
              "The Security Vulnerability status for the work item (Required for Features)", // Updated description
          },
        },
        required: ["project", "type", "title"], // Removed optional fields from required
      },
    },
  • src/index.ts:73-74 (registration)
    Dispatch handler in the MCP server's CallToolRequest handler that routes calls to 'create_work_item' to the createWorkItem function.
    case "create_work_item":
      return await createWorkItem(request.params.arguments || {});
  • src/index.ts:52-61 (registration)
    MCP server ListToolsRequest handler that includes workItemTools (containing create_work_item) in the advertised tools list.
    tools: [
      // Work Items
      ...workItemTools,
      // Pull Requests
      ...pullRequestTools,
      // Wiki
      ...wikiTools,
      // Projects
      ...projectTools,
    ],
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. 'Create a new work item' implies a write/mutation operation, but it doesn't disclose any behavioral traits like required permissions, whether creation is idempotent, what happens on failure, or what the response contains. For a mutation tool with zero annotation coverage, this is a significant gap.

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

Conciseness5/5

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

The description is extremely concise at just 4 words, front-loading the core purpose without any wasted text. Every word earns its place: 'Create' (action), 'a new' (state), 'work item' (resource). There's no redundancy or unnecessary elaboration.

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 this is a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't cover behavioral aspects (permissions, side effects), response format, or error handling. The schema handles parameters well, but for a creation operation, more context about what happens after invocation is needed for the agent to use it effectively.

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?

Schema description coverage is 100%, so the schema fully documents all 5 parameters. The description adds no parameter information beyond what's in the schema—it doesn't explain relationships between parameters, provide examples, or clarify semantics. With high schema coverage, the baseline score of 3 is appropriate as the description doesn't add value but doesn't need to compensate.

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 clearly states the action ('create') and resource ('work item'), making the purpose immediately understandable. It distinguishes from sibling tools like 'get_work_item' or 'list_work_items' by specifying creation rather than retrieval. However, it doesn't specify what kind of work item system this is (Azure DevOps is only implied by the schema), so it's not fully specific.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an existing project), when not to use it, or how it differs from similar creation tools like 'create_pull_request' or 'create_wiki_page'. The agent must infer usage from the tool name alone.

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

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/mmruesch12/azdo-mcp'

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