Skip to main content
Glama
followers.ts1.67 kB
import { z } from 'zod'; import { InstagramClient } from '../instagram/client.js'; import { formatErrorForMcp } from '../utils/errors.js'; export const followersSchema = { username: z .string() .optional() .describe('Instagram username to get followers for. Leave empty to get your own followers.'), limit: z .number() .min(1) .max(200) .default(50) .describe('Maximum number of followers to retrieve (1-200). Default is 50.'), }; export const followersDescription = 'Get a list of Instagram followers with their profile information. Can get followers for any public account or your own account.'; export async function getFollowers( client: InstagramClient, params: { username?: string; limit?: number } ): Promise<{ content: Array<{ type: 'text'; text: string }>; isError?: boolean }> { try { const limit = params.limit ?? 50; const followers = await client.getFollowers(params.username, limit); const result = { count: followers.length, followers: followers.map((user) => ({ userId: user.userId, username: user.username, fullName: user.fullName, profilePicUrl: user.profilePicUrl, profileUrl: `https://www.instagram.com/${user.username}/`, isPrivate: user.isPrivate, isVerified: user.isVerified, })), }; return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { return { isError: true, content: [ { type: 'text', text: formatErrorForMcp(error), }, ], }; } }

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/arjun1194/insta-mcp'

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