Adds two MCP tools so Claude (and other MCP clients) can edit and delete ticket comments, with the same rules as the web UI.
Tools
Tool
Scope
What it does
edit_comment
tickets:write
Replace a comment's text (comment_id, text, optional markdown, default on).
delete_comment
tickets:write
Delete a comment. Its replies are deleted with it, and the result reports replies_removed.
comment_id comes from get_ticket, which already lists each comment's id.
Who can do what: only the comment's author can edit or delete it. Admins can edit or delete any comment, including system comments with no author.
Hidden tickets: a comment on a ticket you can't see reads as "Comment N not found", the same as a missing one, so restricted tickets aren't revealed. This matches how the other tools treat tickets.
Annotations:edit_comment is an idempotent update. delete_comment is marked destructive, like unlink_tickets, so clients can ask before running it.
One code path with the web UI
The access check, the owner-or-admin rule and the audit entry used to sit inline in api/update_comment.php and api/delete_comment.php. They now live in CommentService::updateComment / deleteComment, the way add_comment was shared in #111. The two endpoints and the MCP tools all call the service.
The endpoints' responses and status codes are unchanged, apart from two extra fields on success: ticket_id and replies_removed.
Deleting a comment deletes its replies. This has always been true in the web UI too, through fk_parent_comment ON DELETE CASCADE, but nothing reported it. The delete tool's result and the audit entry now record how many replies went with it.
An author edits their own comment: the text is trimmed and stored, the markdown flag is saved, and the edit is audit-logged.
Empty text is rejected, and a missing comment reads as not found.
Another user can't edit or delete the comment, and its text stays unchanged.
On a confidential ticket the user can't see, both tools say "not found" and the comment is untouched.
An admin can edit a system comment; a non-admin can't.
Deleting a comment with a reply chain two deep removes all three rows and reports replies_removed: 2, in the result and in the audit row. Deleting it again says not found.
edit_comment and delete_comment are both gated by tickets:write.
Tool schemas: built from a real server build. comment_id is an integer, text is required, and markdown defaults to true.
Web endpoints with curl, with a real session and CSRF token:
Request
Response
Edit own comment
200
Empty text
400
Someone else's comment
200 with the permission error
Hidden ticket, edit or delete
403
Delete own comment
200
Bad CSRF token
403
All match the old endpoints.
phpcs is clean.
There's no visual change, so this PR has no screenshots. It doesn't depend on #120.
Adds two MCP tools so Claude (and other MCP clients) can edit and delete ticket comments, with the same rules as the web UI.
## Tools
| Tool | Scope | What it does |
|---|---|---|
| `edit_comment` | `tickets:write` | Replace a comment's text (`comment_id`, `text`, optional `markdown`, default on). |
| `delete_comment` | `tickets:write` | Delete a comment. Its replies are deleted with it, and the result reports `replies_removed`. |
- `comment_id` comes from `get_ticket`, which already lists each comment's id.
- **Who can do what:** only the comment's author can edit or delete it. Admins can edit or delete any comment, including system comments with no author.
- **Hidden tickets:** a comment on a ticket you can't see reads as "Comment N not found", the same as a missing one, so restricted tickets aren't revealed. This matches how the other tools treat tickets.
- **Annotations:** `edit_comment` is an idempotent update. `delete_comment` is marked destructive, like `unlink_tickets`, so clients can ask before running it.
## One code path with the web UI
- The access check, the owner-or-admin rule and the audit entry used to sit inline in `api/update_comment.php` and `api/delete_comment.php`. They now live in `CommentService::updateComment` / `deleteComment`, the way `add_comment` was shared in #111. The two endpoints and the MCP tools all call the service.
- The endpoints' responses and status codes are unchanged, apart from two extra fields on success: `ticket_id` and `replies_removed`.
**Deleting a comment deletes its replies.** This has always been true in the web UI too, through `fk_parent_comment ON DELETE CASCADE`, but nothing reported it. The delete tool's result and the audit entry now record how many replies went with it.
## Verified locally (throwaway `tinker_ui` database, synthetic users)
**MCP tools: 19/19 checks pass.**
- An author edits their own comment: the text is trimmed and stored, the markdown flag is saved, and the edit is audit-logged.
- Empty text is rejected, and a missing comment reads as not found.
- Another user can't edit or delete the comment, and its text stays unchanged.
- On a confidential ticket the user can't see, both tools say "not found" and the comment is untouched.
- An admin can edit a system comment; a non-admin can't.
- Deleting a comment with a reply chain two deep removes all three rows and reports `replies_removed: 2`, in the result and in the audit row. Deleting it again says not found.
- `edit_comment` and `delete_comment` are both gated by `tickets:write`.
**Tool schemas:** built from a real server build. `comment_id` is an integer, `text` is required, and `markdown` defaults to true.
**Web endpoints with curl, with a real session and CSRF token:**
| Request | Response |
|---|---|
| Edit own comment | 200 |
| Empty text | 400 |
| Someone else's comment | 200 with the permission error |
| Hidden ticket, edit or delete | 403 |
| Delete own comment | 200 |
| Bad CSRF token | 403 |
All match the old endpoints.
phpcs is clean.
There's no visual change, so this PR has no screenshots. It doesn't depend on #120.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Two new tickets:write tools, on the same code path as the web UI's comment
edit/delete. The access check, owner-or-admin rule and audit entry moved
out of api/update_comment.php and api/delete_comment.php into
CommentService::updateComment/deleteComment (as add_comment did in #111),
and both endpoints now call it; their responses and status codes are
unchanged apart from extra ticket_id/replies_removed fields.
- edit_comment: replace a comment's text (own comments; admins any).
- delete_comment: delete a comment; replies go with it
(fk_parent_comment ON DELETE CASCADE), so the result and the audit
entry report replies_removed.
- A comment on a ticket the user can't see reads as "Comment N not
found", like a missing one, so restricted tickets stay hidden.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
README: MCP tool table and the CommentService entry, in the PR itself.
get_ticket tool description: now says which tools take a comment_id (commit a819b1c).
Wiki, four pages:
Architecture/mcp-servers: the full Tinker tool table, which was also missing find_similar_tickets, link_tickets and unlink_tickets from #113. Also two troubleshooting rows and a change-log entry.
Services/Productivity/tinkertickets: the MCP bullet, the reply-cascade gotcha, and the deploy row. The deploy row was corrected too: development deploys beta and main deploys prod.
After this reaches prod: two pages mark the new tools as "not deployed yet" / "coming with the next deploy" and should have that wording removed: Architecture/mcp-servers and Services/service-mcp-servers.
Docs updated for this PR:
- **README:** MCP tool table and the `CommentService` entry, in the PR itself.
- **`get_ticket` tool description:** now says which tools take a `comment_id` (commit a819b1c).
- **Wiki, four pages:**
- [Architecture/mcp-servers](https://wiki.lotusguild.org/Architecture/mcp-servers): the full Tinker tool table, which was also missing `find_similar_tickets`, `link_tickets` and `unlink_tickets` from #113. Also two troubleshooting rows and a change-log entry.
- [Services/service-mcp-servers](https://wiki.lotusguild.org/Services/service-mcp-servers) (public): tool list and summary.
- [Services/service-tinker-tickets](https://wiki.lotusguild.org/Services/service-tinker-tickets) (public): the comment edit/delete line, plus a short MCP section.
- [Services/Productivity/tinkertickets](https://wiki.lotusguild.org/Services/Productivity/tinkertickets): the MCP bullet, the reply-cascade gotcha, and the deploy row. The deploy row was corrected too: `development` deploys beta and `main` deploys prod.
**After this reaches prod:** two pages mark the new tools as "not deployed yet" / "coming with the next deploy" and should have that wording removed: `Architecture/mcp-servers` and `Services/service-mcp-servers`.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
jared
merged commit 13ffc51cb7 into development2026-11-25 17:27:57 -05:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Adds two MCP tools so Claude (and other MCP clients) can edit and delete ticket comments, with the same rules as the web UI.
Tools
edit_commenttickets:writecomment_id,text, optionalmarkdown, default on).delete_commenttickets:writereplies_removed.comment_idcomes fromget_ticket, which already lists each comment's id.edit_commentis an idempotent update.delete_commentis marked destructive, likeunlink_tickets, so clients can ask before running it.One code path with the web UI
api/update_comment.phpandapi/delete_comment.php. They now live inCommentService::updateComment/deleteComment, the wayadd_commentwas shared in #111. The two endpoints and the MCP tools all call the service.ticket_idandreplies_removed.Deleting a comment deletes its replies. This has always been true in the web UI too, through
fk_parent_comment ON DELETE CASCADE, but nothing reported it. The delete tool's result and the audit entry now record how many replies went with it.Verified locally (throwaway
tinker_uidatabase, synthetic users)MCP tools: 19/19 checks pass.
replies_removed: 2, in the result and in the audit row. Deleting it again says not found.edit_commentanddelete_commentare both gated bytickets:write.Tool schemas: built from a real server build.
comment_idis an integer,textis required, andmarkdowndefaults to true.Web endpoints with curl, with a real session and CSRF token:
All match the old endpoints.
phpcs is clean.
There's no visual change, so this PR has no screenshots. It doesn't depend on #120.
🤖 Generated with Claude Code
Docs updated for this PR:
CommentServiceentry, in the PR itself.get_tickettool description: now says which tools take acomment_id(commita819b1c).find_similar_tickets,link_ticketsandunlink_ticketsfrom #113. Also two troubleshooting rows and a change-log entry.developmentdeploys beta andmaindeploys prod.After this reaches prod: two pages mark the new tools as "not deployed yet" / "coming with the next deploy" and should have that wording removed:
Architecture/mcp-serversandServices/service-mcp-servers.🤖 Generated with Claude Code