Skip to main content
Glama
olamide-olaniyan

SociaVault MCP Server

get_instagram_posts

Retrieve Instagram posts from a specified user to analyze content, track updates, or gather social media data for research and monitoring purposes.

Instructions

Get Instagram posts from a user

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
handleYesInstagram username

Implementation Reference

  • Handler logic for get_instagram_posts tool: extracts handle from args, calls Sociavault API /instagram/posts endpoint, uses extractInstagramPosts helper to process response, returns JSON with posts data.
    if (name === "get_instagram_posts") {
      const { handle } = args as { handle: string };
      const response = await axios.get(`${BASE_URL}/instagram/posts`, {
        headers: { "X-API-Key": API_KEY },
        params: { handle },
      });
      const extracted = extractInstagramPosts(response.data, 10);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(
              { handle, posts: extracted, total_returned: extracted.length },
              null,
              2
            ),
          },
        ],
      };
    }
  • src/index.ts:256-266 (registration)
    Tool registration in the tools array: defines name, description, and inputSchema for get_instagram_posts.
    {
      name: "get_instagram_posts",
      description: "Get Instagram posts from a user",
      inputSchema: {
        type: "object",
        properties: {
          handle: { type: "string", description: "Instagram username" },
        },
        required: ["handle"],
      },
    },
  • Input schema definition for get_instagram_posts tool: requires 'handle' string parameter.
    inputSchema: {
      type: "object",
      properties: {
        handle: { type: "string", description: "Instagram username" },
      },
      required: ["handle"],
    },
  • Helper function to extract and format up to 10 Instagram posts from API response data.
    function extractInstagramPosts(data: any, limit = 10) {
      const edges = data?.data?.edges || data?.edges || [];
      return edges.slice(0, limit).map((edge: any) => {
        const node = edge.node;
        return {
          shortcode: node.shortcode,
          caption: node.edge_media_to_caption?.edges?.[0]?.node?.text || "",
          likes:
            node.edge_liked_by?.count || node.edge_media_preview_like?.count || 0,
          comments: node.edge_media_to_comment?.count || 0,
          timestamp: node.taken_at_timestamp,
          is_video: node.is_video,
          display_url: node.display_url,
        };
      });

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/olamide-olaniyan/sociavault-mcp'

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