Skip to content

Comments

feat: add message edit and delete tools#200

Open
JAORMX wants to merge 3 commits intokorotovsky:masterfrom
JAORMX:feat/edit-delete-messages
Open

feat: add message edit and delete tools#200
JAORMX wants to merge 3 commits intokorotovsky:masterfrom
JAORMX:feat/edit-delete-messages

Conversation

@JAORMX
Copy link
Contributor

@JAORMX JAORMX commented Feb 11, 2026

Summary

  • Add conversations_edit_message tool — edits an existing Slack message via chat.update API
  • Add conversations_delete_message tool — deletes a Slack message via chat.delete API
  • Both tools are disabled by default and require explicit opt-in for safety
  • Add and edit handlers share a single ConversationsWriteMessageHandler (branches on message_ts presence)

Closes #151

Details

New tools

Tool Parameters Description
conversations_edit_message channel_id, message_ts, text, content_type Edit a message. Supports text/plain and text/markdown content types.
conversations_delete_message channel_id, message_ts Delete a message. Returns confirmation text.

Environment variables

Both tools are gated behind dedicated env vars (disabled by default):

Variable Values
SLACK_MCP_EDIT_MESSAGE_TOOL true, C123,C456 (allowlist), !C123 (denylist)
SLACK_MCP_DELETE_MESSAGE_TOOL true, C123,C456 (allowlist), !C123 (denylist)

Both tools can also be enabled via SLACK_MCP_ENABLED_TOOLS=conversations_edit_message,conversations_delete_message.

Architecture

The add and edit message tools share a single handler (ConversationsWriteMessageHandler) that branches on the presence of message_ts:

  • No message_ts → add mode (posts new message via PostMessageContext)
  • message_ts present → edit mode (updates existing message via UpdateMessageContext)

A shared resolveToolGate helper deduplicates env-var gating, channel ID resolution, and allowlist checking across write and delete parse functions.

Test plan

  • All existing unit tests pass
  • New test cases covering tool registration, ENABLED_TOOLS matrix, param validation, channel scoping, edge cases
  • go build ./..., go vet ./..., go test -run "^Test[^I]" ./... -count=1 all pass

🤖 Generated with Claude Code

Add conversations_edit_message and conversations_delete_message tools
to support editing and deleting Slack messages via chat.update and
chat.delete APIs.

Both tools are disabled by default and require explicit opt-in via
SLACK_MCP_EDIT_MESSAGE_TOOL and SLACK_MCP_DELETE_MESSAGE_TOOL
environment variables. They support channel allow/deny lists
following the existing pattern.

Closes korotovsky#151

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@korotovsky
Copy link
Owner

Hi @JAORMX, Thank you for the PR. From my experience it is very often possible to combine add and edit handlers into one handler with some additional logic. Could you try to explore this option to potentially reduce code duplication?

@JAORMX
Copy link
Contributor Author

JAORMX commented Feb 12, 2026

@korotovsky sure! I'll get to it

JAORMX and others added 2 commits February 12, 2026 12:26
Merge ConversationsAddMessageHandler and ConversationsEditMessageHandler
into a single ConversationsWriteMessageHandler that branches on the
presence of message_ts (edit mode vs add mode).

Extract resolveToolGate helper to deduplicate env-var gating, channel
resolution, and allowlist checking across write and delete parse
functions.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Resolve conflict in pkg/server/server.go: keep both edit/delete
message tool constants and upstream usergroups tool constants.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@JAORMX
Copy link
Contributor Author

JAORMX commented Feb 16, 2026

@korotovsky rebased and fixed the merge conflict.

Copy link

@MaxGhenis MaxGhenis left a comment

Choose a reason for hiding this comment

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

Would love to see this merged — I'm switching to this MCP server from shouting-mcp-slack and edit/delete is the main feature gap. Happy to help test if useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Message Edit and Deletion

3 participants