threads_get_post_insights
Retrieve analytics for Threads posts including views, likes, replies, reposts, quotes, and clicks to measure post performance.
Instructions
Get insights/analytics for a specific Threads post (views, likes, replies, reposts, quotes, clicks).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| post_id | Yes | Threads post ID | |
| metric | No | Comma-separated metrics (default: views,likes,replies,reposts,quotes,clicks) |
Implementation Reference
- src/tools/threads/insights.ts:7-23 (handler)The handler function for 'threads_get_post_insights', which calls the meta client to fetch insights for a specific post.
server.tool( "threads_get_post_insights", "Get insights/analytics for a specific Threads post (views, likes, replies, reposts, quotes, clicks).", { post_id: z.string().describe("Threads post ID"), metric: z.string().optional().describe("Comma-separated metrics (default: views,likes,replies,reposts,quotes,clicks)"), }, async ({ post_id, metric }) => { try { const m = metric || "views,likes,replies,reposts,quotes,clicks"; const { data, rateLimit } = await client.threads("GET", `/${post_id}/insights`, { metric: m }); return { content: [{ type: "text", text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Get post insights failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } ); - src/tools/threads/insights.ts:5-5 (registration)The registration function 'registerThreadsInsightTools' that adds the tool to the MCP server.
export function registerThreadsInsightTools(server: McpServer, client: MetaClient): void {