Skip to main content
Glama
manimohans

Farcaster MCP Server

by manimohans

get-user-casts

Retrieve Farcaster user casts by FID using this tool. Specify user ID and limit to fetch recent posts for analysis or interaction within the Farcaster network.

Instructions

Get casts from a specific Farcaster user by FID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fidYesFarcaster user ID (FID)
limitNoMaximum number of casts to return (default: 10)

Implementation Reference

  • The handler function for the 'get-user-casts' tool. It fetches casts from the Hubble API using the provided FID, limits the results, formats them using formatCasts helper, and returns a formatted text response or an error message.
    async ({ fid, limit = 10 }: { fid: number; limit?: number }) => { try { console.error(`Fetching casts for FID ${fid} with limit ${limit}`); const response = await fetchFromHubble(`/castsByFid`, { fid, pageSize: limit, reverse: 1 // Get newest first }) as FarcasterCastsResponse; console.error(`Got response with ${response.messages?.length || 0} messages`); if (!response.messages || response.messages.length === 0) { return { content: [ { type: "text", text: `No casts found for FID ${fid}` } ] }; } const castsText = await formatCasts(response.messages, limit); return { content: [ { type: "text", text: `# Casts from FID ${fid}\n\n${castsText}` } ] }; } catch (error) { console.error("Error in get-user-casts:", error); return { content: [ { type: "text", text: `Error fetching casts: ${error instanceof Error ? error.message : String(error)}` } ], isError: true }; } }
  • Input schema using Zod for validating the tool parameters: required 'fid' (number) and optional 'limit' (number).
    { fid: z.number().describe("Farcaster user ID (FID)"), limit: z.number().optional().describe("Maximum number of casts to return (default: 10)") },
  • src/index.ts:414-466 (registration)
    Registration of the 'get-user-casts' tool using server.tool(), specifying name, description, input schema, and handler function.
    server.tool( "get-user-casts", "Get casts from a specific Farcaster user by FID", { fid: z.number().describe("Farcaster user ID (FID)"), limit: z.number().optional().describe("Maximum number of casts to return (default: 10)") }, async ({ fid, limit = 10 }: { fid: number; limit?: number }) => { try { console.error(`Fetching casts for FID ${fid} with limit ${limit}`); const response = await fetchFromHubble(`/castsByFid`, { fid, pageSize: limit, reverse: 1 // Get newest first }) as FarcasterCastsResponse; console.error(`Got response with ${response.messages?.length || 0} messages`); if (!response.messages || response.messages.length === 0) { return { content: [ { type: "text", text: `No casts found for FID ${fid}` } ] }; } const castsText = await formatCasts(response.messages, limit); return { content: [ { type: "text", text: `# Casts from FID ${fid}\n\n${castsText}` } ] }; } catch (error) { console.error("Error in get-user-casts:", error); return { content: [ { type: "text", text: `Error fetching casts: ${error instanceof Error ? error.message : String(error)}` } ], isError: true }; } } );

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/manimohans/farcaster-mcp'

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