threads_get_replies
Retrieve conversation replies for a Threads post using the post ID to view and manage discussion threads.
Instructions
Get replies (conversation) for a specific Threads post.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| post_id | Yes | Threads post ID to get replies for | |
| reverse | No | Reverse chronological order | |
| limit | No | Number of replies | |
| after | No | Pagination cursor |
Implementation Reference
- src/tools/threads/replies.ts:16-29 (handler)The handler logic for 'threads_get_replies' tool.
async ({ post_id, reverse, limit, after }) => { try { const params: Record<string, unknown> = { fields: "id,text,username,permalink,timestamp,media_type,media_url,has_replies,hide_status,is_verified,profile_picture_url", }; if (reverse !== undefined) params.reverse = reverse; if (limit) params.limit = limit; if (after) params.after = after; const { data, rateLimit } = await client.threads("GET", `/${post_id}/replies`, params); return { content: [{ type: "text", text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Get replies failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } - src/tools/threads/replies.ts:7-30 (registration)Tool registration for 'threads_get_replies'.
server.tool( "threads_get_replies", "Get replies (conversation) for a specific Threads post.", { post_id: z.string().describe("Threads post ID to get replies for"), reverse: z.boolean().optional().describe("Reverse chronological order"), limit: z.number().optional().describe("Number of replies"), after: z.string().optional().describe("Pagination cursor"), }, async ({ post_id, reverse, limit, after }) => { try { const params: Record<string, unknown> = { fields: "id,text,username,permalink,timestamp,media_type,media_url,has_replies,hide_status,is_verified,profile_picture_url", }; if (reverse !== undefined) params.reverse = reverse; if (limit) params.limit = limit; if (after) params.after = after; const { data, rateLimit } = await client.threads("GET", `/${post_id}/replies`, params); return { content: [{ type: "text", text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Get replies failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );