Skip to main content
Glama

search_hashtag

Find Instagram hashtag IDs to retrieve related media content. Input a hashtag name to obtain the ID required for accessing posts with that tag.

Instructions

Search for an Instagram hashtag and get its ID. Use the returned ID with get_hashtag_media.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hashtag_nameYesHashtag to search for (with or without #)

Implementation Reference

  • The actual implementation of searchHashtag logic that performs the API request.
    async searchHashtag(hashtagName: string): Promise<IGHashtag> {
      const data = await this.request("GET", "ig_hashtag_search", {
        params: {
          q: hashtagName.replace(/^#/, ""),
          user_id: this.aid(),
        },
      });
      const results = data.data ?? [];
      if (!results.length)
        throw new InstagramAPIError(`Hashtag '${hashtagName}' not found`);
      return results[0];
    }
  • src/index.ts:281-291 (registration)
    Tool registration and schema definition for search_hashtag.
    {
      name: "search_hashtag",
      description:
        "Search for an Instagram hashtag and get its ID. Use the returned ID with get_hashtag_media.",
      inputSchema: {
        type: "object" as const,
        properties: {
          hashtag_name: { type: "string", description: "Hashtag to search for (with or without #)" },
        },
        required: ["hashtag_name"],
      },
  • The switch-case handler that invokes searchHashtag from the client.
    case "search_hashtag":
      return JSON.stringify(await c.searchHashtag(args.hashtag_name), null, 2);

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mcpware/instagram-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server