slack_read_thread
Retrieve all replies in a Slack message thread to monitor user responses and maintain conversation continuity for asynchronous workflows.
Instructions
Read all replies in a message thread. Use this to check for user responses to a message you posted.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| channel_id | No | The Slack channel ID. Defaults to configured inbox channel. | |
| thread_ts | Yes | The timestamp of the parent message. |
Implementation Reference
- src/index.js:431-480 (handler)The handler implementation for the 'slack_read_thread' tool, which fetches replies from a thread using the Slack WebClient's conversations.replies method.
case "slack_read_thread": { const channelId = args.channel_id || DEFAULT_CHANNEL; const threadTs = args.thread_ts; if (!channelId) { return { content: [ { type: "text", text: "Error: No channel ID provided and no default channel configured.", }, ], }; } const result = await slack.conversations.replies({ channel: channelId, ts: threadTs, }); const messages = result.messages || []; const botId = await getBotUserId(); // Format messages, marking which are from the bot const formattedMessages = messages.map((msg) => ({ ts: msg.ts, text: msg.text, user: msg.user, is_bot: msg.user === botId, date: new Date(parseFloat(msg.ts) * 1000).toISOString(), })); return { content: [ { type: "text", text: JSON.stringify( { channel: channelId, thread_ts: threadTs, reply_count: formattedMessages.length - 1, // Exclude parent messages: formattedMessages, }, null, 2 ), }, ], }; } - src/index.js:141-160 (registration)Registration of the 'slack_read_thread' tool including its schema definition.
{ name: "slack_read_thread", description: "Read all replies in a message thread. Use this to check for user responses to a message you posted.", inputSchema: { type: "object", properties: { channel_id: { type: "string", description: "The Slack channel ID. Defaults to configured inbox channel.", }, thread_ts: { type: "string", description: "The timestamp of the parent message.", }, }, required: ["thread_ts"], }, },