threads_get_post
Retrieve details of a specific Threads post by post ID. Optionally specify comma-separated fields to customize the returned data.
Instructions
Get details of a specific Threads post.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| post_id | Yes | Threads post ID | |
| fields | No | Comma-separated fields |
Implementation Reference
- src/tools/threads/media.ts:35-52 (handler)The handler function for 'threads_get_post' tool. It makes a GET request to the Meta API for a specific post ID, using optional fields parameter, and returns the post data with rate limit info.
// ─── threads_get_post ──────────────────────────────────────── server.tool( "threads_get_post", "Get details of a specific Threads post.", { post_id: z.string().describe("Threads post ID"), fields: z.string().optional().describe("Comma-separated fields"), }, async ({ post_id, fields }) => { try { const f = fields || "id,media_product_type,media_type,media_url,permalink,text,timestamp,shortcode,is_quote_post,has_replies,reply_audience,topic_tag,link_attachment_url,poll_attachment,gif_attachment,alt_text"; const { data, rateLimit } = await client.threads("GET", `/${post_id}`, { fields: f }); return { content: [{ type: "text", text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Get post failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } ); - src/tools/threads/media.ts:39-42 (schema)Zod schema for the input parameters of 'threads_get_post': post_id (required string) and fields (optional string).
{ post_id: z.string().describe("Threads post ID"), fields: z.string().optional().describe("Comma-separated fields"), }, - src/index.ts:50-50 (registration)Registration call in the main server setup that wires up the 'registerThreadsMediaTools' function (which contains the 'threads_get_post' tool).
registerThreadsMediaTools(server, client); - src/index.ts:22-22 (registration)Import statement for the 'registerThreadsMediaTools' function from './tools/threads/media.js'.
import { registerThreadsMediaTools } from "./tools/threads/media.js"; - src/tools/threads/media.ts:1-3 (helper)Module-level imports for zod (schema validation), McpServer (SDK), and MetaClient (API client) used by the tool handler.
import { z } from "zod"; import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { MetaClient } from "../../services/meta-client.js";