Skip to main content
Glama

delete_message

Remove unwanted or incorrect messages from Slack channels using channel ID and message timestamp.

Instructions

Delete a message

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
channelYesChannel ID
tsYesMessage timestamp

Implementation Reference

  • 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,
        };
      });
    }
  • 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),

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/Hais/slack-bot-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server