Skip to main content
Glama

get-user-content

Retrieve user-generated content from social platforms like Farcaster, Twitter, and Telegram by specifying the user ID and platform. Control the number of posts returned with a customizable limit.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoMaximum number of posts to return
platformYesSocial platform (farcaster, twitter, telegram)
userIdYesUser ID or username on the platform

Implementation Reference

  • The core handler function for the 'get-user-content' tool. It retrieves the appropriate provider based on the platform, fetches the user's content, formats it using formatUserContent, and returns the result or an error.
    async ({ platform, userId, limit = 10 }) => { try { const provider = providerRegistry.getProviderForPlatform(platform); if (!provider) { return { content: [{ type: "text", text: `Provider for platform '${platform}' not found or not enabled` }], isError: true }; } const content = await provider.getUserContent(userId, { limit }); return { content: [{ type: "text", text: formatUserContent(content, platform) }] }; } catch (error) { return { content: [{ type: "text", text: `Error fetching ${platform} content for user '${userId}': ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } }
  • Zod schema defining the input parameters for the tool: platform (required string), userId (required string), limit (optional number).
    { platform: z.string().describe("Social platform (farcaster, twitter, telegram)"), userId: z.string().describe("User ID or username on the platform"), limit: z.number().optional().describe("Maximum number of posts to return") },
  • Direct registration of the 'get-user-content' tool on the MCP server using server.tool(), including schema and handler.
    server.tool( "get-user-content", { platform: z.string().describe("Social platform (farcaster, twitter, telegram)"), userId: z.string().describe("User ID or username on the platform"), limit: z.number().optional().describe("Maximum number of posts to return") }, async ({ platform, userId, limit = 10 }) => { try { const provider = providerRegistry.getProviderForPlatform(platform); if (!provider) { return { content: [{ type: "text", text: `Provider for platform '${platform}' not found or not enabled` }], isError: true }; } const content = await provider.getUserContent(userId, { limit }); return { content: [{ type: "text", text: formatUserContent(content, platform) }] }; } catch (error) { return { content: [{ type: "text", text: `Error fetching ${platform} content for user '${userId}': ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );
  • Top-level registration call within createMcpServer() that invokes registerContentTools to set up the 'get-user-content' tool and others.
    registerContentTools(server, providerRegistry);
  • Helper utility function used by the handler to format the retrieved user content into a readable text string for the tool response.
    function formatUserContent(content: SocialContent[], platform: string): string { if (content.length === 0) { return `No content available for this user on ${platform}.`; } const formattedContent = content.map((item, index) => { return `[${index + 1}] ${item.text} - Posted: ${new Date(item.createdAt).toLocaleString()} - Engagement: ${item.likes || 0} likes, ${item.reposts || 0} reposts, ${item.replies || 0} replies - ID: ${item.id}`; }).join('\n\n'); return `Recent Content on ${platform}:\n\n${formattedContent}`; }

Other Tools

Related Tools

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/Beyond-Network-AI/beyond-mcp-server'

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