Skip to main content
Glama
ennuiii

Azure DevOps MCP Server with PAT Authentication

by ennuiii

wit_add_work_item_comment

Add comments to Azure DevOps work items using ID, specifying text and format (markdown or HTML) for efficient task collaboration and updates.

Instructions

Add comment to a work item by ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commentYesThe text of the comment to add to the work item.
formatNohtml
projectYesThe name or ID of the Azure DevOps project.
workItemIdYesThe ID of the work item to add a comment to.

Implementation Reference

  • The handler function that implements the tool logic: adds a comment to a work item by making a POST request to the Azure DevOps Comments API.
    async ({ project, workItemId, comment, format }) => {
      const connection = await connectionProvider();
    
      const orgUrl = connection.serverUrl;
      const accessToken = await tokenProvider();
    
      const body = {
        text: comment,
      };
    
      const formatParameter = format === "markdown" ? 0 : 1;
      const response = await fetch(`${orgUrl}/${project}/_apis/wit/workItems/${workItemId}/comments?format=${formatParameter}&api-version=${markdownCommentsApiVersion}`, {
        method: "POST",
        headers: {
          "Authorization": `Bearer ${accessToken.token}`,
          "Content-Type": "application/json",
          "User-Agent": userAgentProvider(),
        },
        body: JSON.stringify(body),
      });
    
      if (!response.ok) {
        throw new Error(`Failed to add a work item comment: ${response.statusText}}`);
      }
    
      const comments = await response.text();
    
      return {
        content: [{ type: "text", text: comments }],
      };
    }
  • Zod input schema defining parameters: project, workItemId, comment, and optional format (markdown or html).
    {
      project: z.string().describe("The name or ID of the Azure DevOps project."),
      workItemId: z.number().describe("The ID of the work item to add a comment to."),
      comment: z.string().describe("The text of the comment to add to the work item."),
      format: z.enum(["markdown", "html"]).optional().default("html"),
    },
  • Registration of the tool using McpServer.tool() call with name from WORKITEM_TOOLS.add_work_item_comment, description, schema, and handler.
    server.tool(
      WORKITEM_TOOLS.add_work_item_comment,
      "Add comment to a work item by ID.",
      {
        project: z.string().describe("The name or ID of the Azure DevOps project."),
        workItemId: z.number().describe("The ID of the work item to add a comment to."),
        comment: z.string().describe("The text of the comment to add to the work item."),
        format: z.enum(["markdown", "html"]).optional().default("html"),
      },
      async ({ project, workItemId, comment, format }) => {
        const connection = await connectionProvider();
    
        const orgUrl = connection.serverUrl;
        const accessToken = await tokenProvider();
    
        const body = {
          text: comment,
        };
    
        const formatParameter = format === "markdown" ? 0 : 1;
        const response = await fetch(`${orgUrl}/${project}/_apis/wit/workItems/${workItemId}/comments?format=${formatParameter}&api-version=${markdownCommentsApiVersion}`, {
          method: "POST",
          headers: {
            "Authorization": `Bearer ${accessToken.token}`,
            "Content-Type": "application/json",
            "User-Agent": userAgentProvider(),
          },
          body: JSON.stringify(body),
        });
    
        if (!response.ok) {
          throw new Error(`Failed to add a work item comment: ${response.statusText}}`);
        }
    
        const comments = await response.text();
    
        return {
          content: [{ type: "text", text: comments }],
        };
      }
    );
  • Definition of the tool name constant in WORKITEM_TOOLS object.
    add_work_item_comment: "wit_add_work_item_comment",
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is an 'Add' operation (implying mutation/write), but doesn't mention authentication requirements, permission levels, whether comments are editable/deletable, rate limits, or what happens on success/failure. For a mutation tool with zero annotation coverage, this is insufficient.

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 a single, efficient sentence with zero wasted words. It's appropriately sized for a simple tool and front-loads the essential action and target.

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?

For a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't explain what happens after adding a comment (success response, error conditions), doesn't mention the Azure DevOps context implied by parameters, and provides no behavioral context. The description alone is inadequate for safe tool invocation.

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 75% (3 of 4 parameters have descriptions), so the baseline is 3. The description mentions 'by ID' which hints at the workItemId parameter, but doesn't add meaningful context beyond what the schema already provides about project, workItemId, comment, or format parameters.

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 ('Add comment') and target resource ('to a work item by ID'), making the purpose immediately understandable. It doesn't differentiate from sibling tools like 'wit_list_work_item_comments' or 'repo_reply_to_comment', but the verb+resource combination is specific enough for basic understanding.

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 sibling tools like 'wit_list_work_item_comments' (for reading comments) or 'repo_reply_to_comment' (for repository comments), nor does it specify prerequisites like needing a work item ID or project context.

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/ennuiii/DevOpsMcpPAT'

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