discord_edit_message
Edit bot messages in Discord channels by providing channel ID, message ID, and new content to update text.
Instructions
Edit a message sent by the bot.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channel_id | Yes | ||
| message_id | Yes | The message ID to edit (must be a bot message). | |
| content | Yes | New text content for the message. |
Implementation Reference
- src/tools/messages.ts:323-329 (handler)The handler function that executes the `discord_edit_message` logic.
case "discord_edit_message": { const channel = await getTextChannel(args.channel_id as string); const msg = await channel.messages.fetch(args.message_id as string); if (msg.author.id !== discord.user?.id) throw new Error("Can only edit messages sent by the bot."); const edited = await msg.edit(args.content as string); return { content: [{ type: "text", text: `✅ Message ${edited.id} edited in #${channel.name}.` }] }; } - src/tools/messages.ts:44-56 (schema)The input schema definition for `discord_edit_message`.
{ name: "discord_edit_message", description: "Edit a message sent by the bot.", inputSchema: { type: "object", properties: { channel_id: { type: "string" }, message_id: { type: "string", description: "The message ID to edit (must be a bot message)." }, content: { type: "string", description: "New text content for the message." }, }, required: ["channel_id", "message_id", "content"], }, },