Skip to main content
Glama

ig_get_media_list

Retrieve Instagram media posts from an account with pagination controls to manage content lists efficiently.

Instructions

Get list of media published on the Instagram account.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoNumber of results (max 100, default 25)
afterNoPagination cursor for next page
beforeNoPagination cursor for previous page

Implementation Reference

  • Handler implementation of ig_get_media_list tool.
    server.tool(
      "ig_get_media_list",
      "Get list of media published on the Instagram account.",
      {
        limit: z.number().optional().describe("Number of results (max 100, default 25)"),
        after: z.string().optional().describe("Pagination cursor for next page"),
        before: z.string().optional().describe("Pagination cursor for previous page"),
      },
      async ({ limit, after, before }) => {
        try {
          const params: Record<string, unknown> = {
            fields: "id,caption,media_type,media_url,permalink,thumbnail_url,timestamp,like_count,comments_count",
          };
          if (limit) params.limit = limit;
          if (after) params.after = after;
          if (before) params.before = before;
          const { data, rateLimit } = await client.ig("GET", `/${client.igUserId}/media`, params);
          return { content: [{ type: "text", text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] };
        } catch (error) {
          return { content: [{ type: "text", text: `Get media list failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true };
        }
      }
    );

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/mikusnuz/meta-mcp'

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