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 || {});

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