ig_search_hashtag
Find Instagram hashtag IDs by name to enable media queries. Required step before accessing hashtag content through the Instagram Graph API.
Instructions
Search for a hashtag ID by name. Required before querying hashtag media. Limited to 30 unique hashtags per 7-day rolling window.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| q | Yes | Hashtag name to search (without #) |
Implementation Reference
- src/tools/instagram/hashtags.ts:7-24 (handler)The `ig_search_hashtag` tool registration and handler implementation. It uses `client.ig` to call the `/ig_hashtag_search` endpoint.
server.tool( "ig_search_hashtag", "Search for a hashtag ID by name. Required before querying hashtag media. Limited to 30 unique hashtags per 7-day rolling window.", { q: z.string().describe("Hashtag name to search (without #)"), }, async ({ q }) => { try { const { data, rateLimit } = await client.ig("GET", "/ig_hashtag_search", { q, user_id: client.igUserId, }); return { content: [{ type: "text", text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Hashtag search failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );