Skip to main content
Glama

get_instagram_user

Retrieve Instagram user information using URL, alias, or ID to access profile data and details through data scraping.

Instructions

Get Instagram user information by URL, alias or ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
timeoutNoMax scrapping execution timeout (in seconds)
userYesUser ID, alias or URL

Implementation Reference

  • Handler function that executes the get_instagram_user tool logic. Prepares request data with user and timeout, calls makeRequest to the Instagram user API endpoint, and returns the JSON response or an error message.
    async ({ user, timeout }) => { const requestData = { timeout, user }; log("Starting Instagram user lookup for:", user); try { const response = await makeRequest(API_CONFIG.ENDPOINTS.INSTAGRAM_USER, requestData); return { content: [ { type: "text", text: JSON.stringify(response, null, 2) } ] }; } catch (error) { log("Instagram user lookup error:", error); return { content: [ { type: "text", text: `Instagram user API error: ${formatError(error)}` } ], isError: true }; } }
  • Zod input schema defining parameters: user (string, required), timeout (number, optional default 300). Used in tool registration.
    user: z.string().describe("User ID, alias or URL"), timeout: z.number().default(300).describe("Timeout in seconds") },
  • src/index.ts:301-334 (registration)
    Registration of the get_instagram_user tool on the MCP server, specifying name, description, input schema, and handler function.
    server.tool( "get_instagram_user", "Get Instagram user information", { user: z.string().describe("User ID, alias or URL"), timeout: z.number().default(300).describe("Timeout in seconds") }, async ({ user, timeout }) => { const requestData = { timeout, user }; log("Starting Instagram user lookup for:", user); try { const response = await makeRequest(API_CONFIG.ENDPOINTS.INSTAGRAM_USER, requestData); return { content: [ { type: "text", text: JSON.stringify(response, null, 2) } ] }; } catch (error) { log("Instagram user lookup error:", error); return { content: [ { type: "text", text: `Instagram user API error: ${formatError(error)}` } ], isError: true }; } } );
  • Helper function makeRequest used by the handler to perform authenticated HTTPS POST requests to the AnySite.io API endpoints.
    const makeRequest = (endpoint: string, data: any, method: string = "POST"): Promise<any> => { return new Promise((resolve, reject) => { const url = new URL(endpoint, API_CONFIG.BASE_URL); const postData = JSON.stringify(data); const options = { hostname: url.hostname, port: url.port || 443, path: url.pathname, method: method, headers: { "Content-Type": "application/json", "Content-Length": Buffer.byteLength(postData), "access-token": API_KEY, ...(ACCOUNT_ID && { "x-account-id": ACCOUNT_ID }) } }; const req = https.request(options, (res) => { let responseData = ""; res.on("data", (chunk) => { responseData += chunk; }); res.on("end", () => { try { const parsed = JSON.parse(responseData); if (res.statusCode && res.statusCode >= 200 && res.statusCode < 300) { resolve(parsed); } else { reject(new Error(`API error ${res.statusCode}: ${JSON.stringify(parsed)}`)); } } catch (e) { reject(new Error(`Failed to parse response: ${responseData}`)); } }); }); req.on("error", (error) => { reject(error); }); req.write(postData); req.end(); }); };
  • API endpoint path definition for Instagram user data in the API_CONFIG.ENDPOINTS object.
    INSTAGRAM_USER: "/api/instagram/user",

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/anysiteio/hdw-mcp-server'

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