Skip to main content
Glama

get_posts

Retrieve posts from your Instagram account or Facebook page to manage content and analyze engagement.

Instructions

Get posts from your Instagram account or Facebook page

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
platformYesPlatform to get posts from
limitNoNumber of posts to retrieve (default: 25)

Implementation Reference

  • Zod schema for validating input parameters of the get_posts tool: platform (instagram or facebook) and optional limit.
    const GetPostsSchema = z.object({ platform: z.enum(['instagram', 'facebook']), limit: z.number().optional() });
  • src/index.ts:203-214 (registration)
    Tool registration in the list of available tools returned by ListToolsRequestHandler, including name, description, and input schema.
    { name: 'get_posts', description: 'Get posts from your Instagram account or Facebook page', inputSchema: { type: 'object', properties: { platform: { type: 'string', enum: ['instagram', 'facebook'], description: 'Platform to get posts from' }, limit: { type: 'number', description: 'Number of posts to retrieve (default: 25)' } }, required: ['platform'] } },
  • Handler logic in the CallToolRequestHandler switch statement: parses input with schema, then calls platform-specific API functions getInstagramPosts or getFacebookPosts.
    case 'get_posts': { const params = GetPostsSchema.parse(args); if (params.platform === 'instagram') { result = await api.getInstagramPosts(params.limit); } else { result = await api.getFacebookPosts(params.limit); } break; }
  • Core implementation for fetching Instagram posts using Graph API /media endpoint.
    export async function getInstagramPosts(limit: number = 25): Promise<{ data: Post[] }> { const igAccountId = config.igAccountId || (await getMyInstagramProfile()).id; return makeApiCall({ endpoint: `/${igAccountId}/media`, params: { fields: 'id,caption,media_type,media_url,thumbnail_url,permalink,timestamp,like_count,comments_count', limit } }); }
  • Core implementation for fetching Facebook page posts using Graph API /feed endpoint.
    export async function getFacebookPosts(limit: number = 25): Promise<{ data: Post[] }> { return makeApiCall({ endpoint: `/${config.fbPageId}/feed`, params: { fields: 'id,message,story,created_time,permalink_url,full_picture,attachments{media_type,url,title,description}', limit } }); }

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/osborn1997/instagram-mcp-server'

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