ig_get_hashtag
Retrieve Instagram hashtag details using a specific ID to analyze performance metrics and content trends.
Instructions
Get hashtag information by ID.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hashtag_id | Yes | Hashtag ID (from ig_search_hashtag) |
Implementation Reference
- src/tools/instagram/hashtags.ts:27-43 (handler)Implementation of the ig_get_hashtag tool, which retrieves hashtag information from the Instagram API using a provided hashtag ID.
server.tool( "ig_get_hashtag", "Get hashtag information by ID.", { hashtag_id: z.string().describe("Hashtag ID (from ig_search_hashtag)"), }, async ({ hashtag_id }) => { try { const { data, rateLimit } = await client.ig("GET", `/${hashtag_id}`, { fields: "id,name,media_count", }); return { content: [{ type: "text", text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Get hashtag failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );