threads_get_user_threads
Retrieve all threads published by a specific user on Threads, with options to filter by date range, limit results, or paginate through content.
Instructions
Get all threads published by the user (alias for threads_get_posts with user context).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Number of results | |
| since | No | Start date (ISO 8601 or Unix timestamp) | |
| until | No | End date (ISO 8601 or Unix timestamp) | |
| after | No | Pagination cursor |
Implementation Reference
- src/tools/threads/profile.ts:23-48 (handler)The handler for `threads_get_user_threads` is registered directly within the `registerThreadsProfileTools` function in `src/tools/threads/profile.ts`. It includes both the tool definition (schema) and the asynchronous logic to fetch threads from the Meta client.
// ─── threads_get_user_threads ──────────────────────────────── server.tool( "threads_get_user_threads", "Get all threads published by the user (alias for threads_get_posts with user context).", { limit: z.number().optional().describe("Number of results"), since: z.string().optional().describe("Start date (ISO 8601 or Unix timestamp)"), until: z.string().optional().describe("End date (ISO 8601 or Unix timestamp)"), after: z.string().optional().describe("Pagination cursor"), }, async ({ limit, since, until, after }) => { try { const params: Record<string, unknown> = { fields: "id,media_product_type,media_type,text,permalink,timestamp,shortcode,is_quote_post,topic_tag", }; if (limit) params.limit = limit; if (since) params.since = since; if (until) params.until = until; if (after) params.after = after; const { data, rateLimit } = await client.threads("GET", `/${client.threadsUserId}/threads`, params); return { content: [{ type: "text", text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Get user threads failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );