hyperd.sentiment.token
Retrieve a token's sentiment score (0-100) from recent Farcaster discussions, including band, volume, trend, and sample casts. Cost: $0.05 USDC.
Instructions
Get a token's sentiment score (0-100) from recent Farcaster discussion. Returns score, band (very_negative to very_positive), volume, trend, sample casts. Costs $0.05 in USDC.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token | Yes | Token symbol or name | |
| window | No | Days (1-30) or "24h" / "7d". Default "24h". |
Implementation Reference
- src/server.ts:347-355 (registration)Tool registration for hyperd.sentiment.token using the McpServer.tool() method. Registers it with description, Zod schema (token: string, window: optional string), and a handler that delegates to paidGet('/api/sentiment/token').
server.tool( "hyperd.sentiment.token", "Get a token's sentiment score (0-100) from recent Farcaster discussion. Returns score, band (very_negative to very_positive), volume, trend, sample casts. Costs $0.05 in USDC.", { token: z.string().describe("Token symbol or name"), window: z.string().optional().describe('Days (1-30) or "24h" / "7d". Default "24h".'), }, async (args) => asText(await paidGet("/api/sentiment/token", args)), ); - src/server.ts:354-354 (handler)The handler function — an async lambda that calls paidGet('/api/sentiment/token', args) and wraps the result with asText(). This is the execution logic of the tool.
async (args) => asText(await paidGet("/api/sentiment/token", args)), - src/server.ts:350-353 (schema)Input schema defined with Zod: 'token' (required string, token symbol or name) and 'window' (optional string, days or '24h'/'7d').
{ token: z.string().describe("Token symbol or name"), window: z.string().optional().describe('Days (1-30) or "24h" / "7d". Default "24h".'), }, - src/server.ts:79-92 (helper)The paidGet helper function that constructs the URL, appends query params, and executes an x402-signed HTTP GET to the API endpoint.
async function paidGet( path: string, query: Record<string, string | number | boolean | undefined>, ): Promise<unknown> { if (!httpClient) { throw new Error(WALLET_NOT_CONFIGURED_MSG); } const url = new URL(`${API_BASE}${path}`); for (const [k, v] of Object.entries(query)) { if (v !== undefined && v !== "" && v !== null) url.searchParams.set(k, String(v)); } return paidRequest("GET", url, undefined); } - src/server.ts:155-157 (helper)The asText helper that wraps JSON response into MCP text content format.
function asText(data: unknown) { return { content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }] }; }