update_message
Modify existing Slack messages by providing channel ID, timestamp, and new text content to correct errors or update information.
Instructions
Update an existing message
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channel | Yes | Channel ID | |
| ts | Yes | Message timestamp | |
| text | Yes | New message text |
Implementation Reference
- src/tools/messages.ts:30-47 (handler)The main execution handler for the 'update_message' tool. It validates input using updateMessageSchema, calls Slack's chat.update method, and returns the updated message details.export async function updateMessage(client: SlackClientWrapper, args: unknown) { const params = updateMessageSchema.parse(args); return await client.safeCall(async () => { const result = await client.getClient().chat.update({ channel: params.channel, ts: params.ts, text: params.text, }); return { ok: true, channel: result.channel, ts: result.ts, message: result.message, }; }); }
- src/utils/validators.ts:53-57 (schema)Zod schema for input validation of the update_message tool, requiring channel ID, message timestamp, and new text.export const updateMessageSchema = z.object({ channel: channelIdSchema, ts: timestampSchema, text: z.string().min(1), });
- src/index.ts:427-427 (registration)Registers the 'update_message' tool handler in the toolHandlers map, delegating to messageTools.updateMessage.update_message: (args) => messageTools.updateMessage(slackClient, args),
- src/index.ts:195-216 (registration)Defines the 'update_message' tool in the tools list for list_tools, including JSON input schema mirroring the Zod schema.{ name: 'update_message', description: 'Update an existing message', inputSchema: { type: 'object', properties: { channel: { type: 'string', description: 'Channel ID', }, ts: { type: 'string', description: 'Message timestamp', }, text: { type: 'string', description: 'New message text', }, }, required: ['channel', 'ts', 'text'], }, },