Skip to main content
Glama
following.ts1.51 kB
import { z } from 'zod'; import { InstagramClient } from '../instagram/client.js'; import { formatErrorForMcp } from '../utils/errors.js'; export const followingSchema = { username: z.string().optional().describe('Username to get following list for'), limit: z.number().optional().default(50).describe('Maximum number of accounts to return'), }; export const followingDescription = 'Get the list of accounts a user is following.'; export async function getFollowing( client: InstagramClient, params: { username?: string; limit?: number } ): Promise<{ content: Array<{ type: 'text'; text: string }>; isError?: boolean }> { try { const limit = params.limit ?? 50; const following = await client.getFollowing(params.username, limit); return { content: [ { type: 'text', text: JSON.stringify( { username: params.username || 'me', count: following.length, following: following.map((user: any) => ({ username: user.username, fullName: user.fullName, profilePicUrl: user.profilePicUrl, isPrivate: user.isPrivate, isVerified: user.isVerified, })), }, 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