Skip to main content
Glama

add-work-item-comment

Add comments to Azure DevOps work items to provide updates, context, or feedback directly within the DevOps Enhanced MCP environment.

Instructions

Add a comment to an existing work item in Azure DevOps

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesWork item ID to add comment to
commentYesComment text to add

Implementation Reference

  • The main handler function that executes the 'add-work-item-comment' tool. It validates the work item ID and comment text, constructs the API endpoint for comments using version 6.0-preview.4, makes a POST request via makeApiRequest, and returns the created comment details.
    private async addWorkItemComment(args: any): Promise<any> {
      if (!args.id) {
        throw new Error('Work item ID is required');
      }
    
      if (!args.comment) {
        throw new Error('Comment text is required');
      }
    
      try {
        const commentData = {
          text: args.comment
        };
    
        // Use API version 6.0-preview.4 for comments - required for work item comments endpoint
        const endpoint = `/wit/workitems/${args.id}/comments?api-version=6.0-preview.4`;
        console.log(`[DEBUG] Adding comment to work item ${args.id} with endpoint: ${endpoint}`);
        
        const result = await this.makeApiRequest(
          endpoint,
          'POST',
          commentData
        );
    
        return {
          content: [{
            type: 'text',
            text: JSON.stringify({
              success: true,
              comment: {
                id: result.id,
                workItemId: args.id,
                text: result.text,
                createdBy: result.createdBy?.displayName || result.createdBy,
                createdDate: result.createdDate,
                url: result.url
              },
              message: `Successfully added comment to work item ${args.id}`
            }, null, 2),
          }],
        };
      } catch (error) {
        // Provide specific guidance for API version issues
        if (error instanceof Error && error.message.includes('preview')) {
          throw new Error(`Failed to add work item comment - API version issue: ${error.message}. Try using a different API version.`);
        }
        throw new Error(`Failed to add work item comment: ${error instanceof Error ? error.message : 'Unknown error'}`);
      }
    }
  • src/index.ts:211-228 (registration)
    Registers the 'add-work-item-comment' tool in the MCP server's listTools response, including its name, description, and input schema definition.
    {
      name: 'add-work-item-comment',
      description: 'Add a comment to an existing work item in Azure DevOps',
      inputSchema: {
        type: 'object',
        properties: {
          id: {
            type: 'number',
            description: 'Work item ID to add comment to',
          },
          comment: {
            type: 'string',
            description: 'Comment text to add',
          },
        },
        required: ['id', 'comment'],
      },
    },
  • Defines the input schema for the 'add-work-item-comment' tool, specifying required parameters 'id' (number) and 'comment' (string).
    inputSchema: {
      type: 'object',
      properties: {
        id: {
          type: 'number',
          description: 'Work item ID to add comment to',
        },
        comment: {
          type: 'string',
          description: 'Comment text to add',
        },
      },
      required: ['id', 'comment'],
  • Dispatches calls to the 'add-work-item-comment' handler method in the toolHandlers.handleToolCall switch statement.
    case 'add-work-item-comment':
      return await this.addWorkItemComment(args || {});
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 the tool adds a comment but lacks critical details: whether this requires specific permissions, if it's a write operation (implied but not explicit), what happens on success/failure, or any rate limits. This is inadequate for a mutation tool with zero annotation coverage.

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 that directly states the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly, with every part earning its place.

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 explain behavioral aspects like authentication needs, error handling, or return values, leaving significant gaps for an AI agent to understand how to invoke it correctly in context.

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 schema description coverage is 100%, with both parameters ('id' and 'comment') clearly documented in the schema. The description doesn't add any meaningful semantic context beyond what the schema provides (e.g., format of ID, comment length limits), so it meets the baseline for high schema coverage without compensating value.

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 a comment') and target resource ('to an existing work item in Azure DevOps'), making the purpose immediately understandable. However, it doesn't distinguish this tool from potential sibling tools like 'update-work-item' that might also handle comments, missing explicit differentiation.

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 work item ID), exclusions, or comparisons to sibling tools like 'update-work-item' that might overlap in functionality, leaving usage context unclear.

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/wangkanai/devops-enhanced-mcp'

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