delete_message
Remove unwanted or incorrect messages from Slack channels using channel ID and message timestamp.
Instructions
Delete a message
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channel | Yes | Channel ID | |
| ts | Yes | Message timestamp |
Implementation Reference
- src/tools/messages.ts:49-64 (handler)The main handler function that executes the delete_message tool logic: validates input with schema, calls Slack's chat.delete API, and returns confirmation.export async function deleteMessage(client: SlackClientWrapper, args: unknown) { const params = deleteMessageSchema.parse(args); return await client.safeCall(async () => { await client.getClient().chat.delete({ channel: params.channel, ts: params.ts, }); return { ok: true, channel: params.channel, ts: params.ts, }; }); }
- src/utils/validators.ts:59-62 (schema)Zod input validation schema defining required channel ID and message timestamp for the delete_message tool.export const deleteMessageSchema = z.object({ channel: channelIdSchema, ts: timestampSchema, });
- src/index.ts:217-234 (registration)Tool metadata registration in the list_tools handler: defines name, description, and JSON input schema for delete_message.{ name: 'delete_message', description: 'Delete a message', inputSchema: { type: 'object', properties: { channel: { type: 'string', description: 'Channel ID', }, ts: { type: 'string', description: 'Message timestamp', }, }, required: ['channel', 'ts'], }, },
- src/index.ts:428-428 (registration)Runtime handler binding in the call_tool dispatcher: maps delete_message calls to the messageTools.deleteMessage implementation.delete_message: (args) => messageTools.deleteMessage(slackClient, args),