Skip to content

feat: add wit_update_work_item_comment tool#940

Merged
danhellem merged 5 commits intomicrosoft:mainfrom
tusagarwal:feat/update-work-item-comment
Mar 11, 2026
Merged

feat: add wit_update_work_item_comment tool#940
danhellem merged 5 commits intomicrosoft:mainfrom
tusagarwal:feat/update-work-item-comment

Conversation

@tusagarwal
Copy link
Copy Markdown
Contributor

Closes #932

Adds wit_update_work_item_comment — updates an existing work item comment via PATCH on the 7.2-preview.4 comments endpoint. Same pattern as the existing wit_add_work_item_comment.

Per @danhellem's feedback on #932, this is a clean PR with just the update tool (no delete).

Parameters

Param Type Description
project string Project name or ID
workItemId number Work item ID
commentId number Comment ID (from wit_list_work_item_comments)
text string Updated comment text
format string? markdown or html (optional)

Changes

src/tools/work-items.ts

  • Added wit_update_work_item_comment to WORKITEM_TOOLS constant
  • Added handler using PATCH with same auth/fetch pattern as add_work_item_comment

test/src/tools/work-items.test.ts

  • Added 2 test cases (success + error handling)
  • All 103 tests pass

Why

When AI agents add comments (RCA, deployment notes, etc.), typos happen. Right now the only option is adding another comment. The update tool lets you fix mistakes in-place.

PR Checklist

  • I have read the contribution guidelines
  • I have read the code of conduct guidelines
  • Title of the pull request is clear and informative.
  • 🧹 Code hygiene
  • 📈 Telemetry added, updated, or N/A
  • 📖 Documentation added, updated, or N/A
  • 🔵 Automated tests added, or N/A

🔧 How did you test it?

  • npm test -- test/src/tools/work-items.test.ts — 103 passed, 0 failed
  • npm run format — no changes needed
  • Manually tested PATCH endpoint against a live Azure DevOps org

@tusagarwal tusagarwal requested a review from a team as a code owner February 27, 2026 12:41
@tusagarwal
Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

Copy link
Copy Markdown
Collaborator

@danhellem danhellem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the tool to the Toolset.md as well

Comment thread src/tools/work-items.ts Outdated
@tusagarwal tusagarwal force-pushed the feat/update-work-item-comment branch from 0a4078a to 6bc6862 Compare March 2, 2026 06:02
@tusagarwal tusagarwal requested a review from danhellem March 2, 2026 06:06
@danhellem danhellem requested a review from Copilot March 2, 2026 13:41
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 2, 2026

Codecov Report

❌ Patch coverage is 85.71429% with 2 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@c7e91a3). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/tools/work-items.ts 85.71% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #940   +/-   ##
=======================================
  Coverage        ?   93.83%           
=======================================
  Files           ?       16           
  Lines           ?     1607           
  Branches        ?      337           
=======================================
  Hits            ?     1508           
  Misses          ?       23           
  Partials        ?       76           
Flag Coverage Δ
unittests 93.83% <85.71%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new Work Items MCP tool to update an existing Azure DevOps work item comment via the 7.2-preview.4 comments endpoint, mirroring the existing “add comment” tool pattern.

Changes:

  • Added wit_update_work_item_comment tool registration and handler (PATCH to work item comment endpoint).
  • Added Jest tests covering success and error cases for the new tool.
  • Updated toolset documentation to list and describe the new tool.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/tools/work-items.ts Registers wit_update_work_item_comment and implements the PATCH handler using the existing fetch/auth pattern.
test/src/tools/work-items.test.ts Adds tests for the new tool’s success and failure paths.
docs/TOOLSET.md Documents the new tool in the tool index and Work Items section.

Comment thread src/tools/work-items.ts
Comment thread test/src/tools/work-items.test.ts
Comment thread docs/TOOLSET.md
Copy link
Copy Markdown
Collaborator

@danhellem danhellem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot made some good suggestions

@tusagarwal tusagarwal force-pushed the feat/update-work-item-comment branch from e9132c4 to 84125ba Compare March 9, 2026 06:10
@tusagarwal
Copy link
Copy Markdown
Contributor Author

@danhellem Applied all the review feedback:

  1. Renamed text to comment — parameter name now matches wit_add_work_item_comment for consistency. The API body still sends { text: comment } since that is what the REST endpoint expects.
  2. Added markdown format test — new test case verifies format: "markdown" produces format=0 in the URL. All 104 tests pass (was 103).
  3. Updated TOOLSET.md — reflected the renamed parameter.
  4. Rebased on latest main — clean single commit, no conflicts.

Ready for re-review whenever you get a chance. Thanks!

@tusagarwal
Copy link
Copy Markdown
Contributor Author

@danhellem Friendly ping — all Copilot review feedback has been addressed (parameter renamed textcomment, test updated to markdown format). This PR has been open for ~2 weeks now. Could you please take a final look and approve when you get a chance? Thanks!

danhellem
danhellem previously approved these changes Mar 10, 2026
@danhellem
Copy link
Copy Markdown
Collaborator

@tusagarwal you need to run npm run format before we can merge this

@tusagarwal
Copy link
Copy Markdown
Contributor Author

@danhellem Done! Ran npm run format and pushed (c729bb0). All checks passing. Resolved the Copilot review conversation too. Ready to merge whenever you get a chance. Thanks for the approval!

@tusagarwal tusagarwal requested a review from danhellem March 11, 2026 05:19
Copy link
Copy Markdown
Collaborator

@danhellem danhellem left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting started.md should not be changed in this PR. Please remove it

@danhellem danhellem merged commit fc23862 into microsoft:main Mar 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add tools for updating and deleting work item comments

4 participants