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
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum number of posts to return | |
| platform | Yes | Social platform (farcaster, twitter, telegram) | |
| userId | Yes | User ID or username on the platform |
Implementation Reference
- src/mcp/tools/contentTools.ts:275-303 (handler)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") },
- src/mcp/tools/contentTools.ts:268-304 (registration)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 }; } } );
- src/mcp/server.ts:26-26 (registration)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}`; }