pm_micro_stats
Analyze Polymarket microstructure data to monitor total markets, average spreads, thin book counts, and update timestamps for trading insights.
Instructions
Get statistics about the Polymarket microstructure dataset: total markets analyzed, average spread, thin book count, and last updated. Free endpoint.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/pm_micro.ts:193-223 (handler)The handler function for pm_micro_stats that fetches data from the API and formats it for the MCP tool response.
server.registerTool( "pm_micro_stats", { title: "Polymarket Microstructure Statistics", description: "Get statistics about the Polymarket microstructure dataset: total markets analyzed, " + "average spread, thin book count, and last updated. Free endpoint.", inputSchema: {}, }, async () => { const res = await apiGet<PmMicroStatsResponse>("/api/v1/pm/micro/stats"); if (!res.ok) { return { content: [ { type: "text" as const, text: `API error (${res.status}): ${JSON.stringify(res.data)}`, }, ], isError: true, }; } return { content: [ { type: "text" as const, text: JSON.stringify(res.data, null, 2) }, ], }; }, ); - src/tools/pm_micro.ts:193-223 (registration)Registration of the pm_micro_stats tool within the registerPmMicroTools function.
server.registerTool( "pm_micro_stats", { title: "Polymarket Microstructure Statistics", description: "Get statistics about the Polymarket microstructure dataset: total markets analyzed, " + "average spread, thin book count, and last updated. Free endpoint.", inputSchema: {}, }, async () => { const res = await apiGet<PmMicroStatsResponse>("/api/v1/pm/micro/stats"); if (!res.ok) { return { content: [ { type: "text" as const, text: `API error (${res.status}): ${JSON.stringify(res.data)}`, }, ], isError: true, }; } return { content: [ { type: "text" as const, text: JSON.stringify(res.data, null, 2) }, ], }; }, ); - src/tools/pm_micro.ts:21-26 (schema)The TypeScript interface defining the structure of the response for the pm_micro_stats tool.
interface PmMicroStatsResponse { dataset: string; source: string; update_frequency: string; stats: Record<string, unknown>; }