Polymarket Microstructure Statistics
pm_micro_statsRetrieve key statistics from the Polymarket microstructure dataset including total markets analyzed, average spread, thin book count, and last updated timestamp. Free endpoint.
Instructions
Get statistics about the Polymarket microstructure dataset: total markets analyzed, average spread, thin book count, and last updated. Free endpoint.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/tools/pm_micro.ts:191-223 (registration)The tool 'pm_micro_stats' is registered via server.registerTool with name 'pm_micro_stats', title 'Polymarket Microstructure Statistics', and an empty input schema. The handler calls apiGet<PmMicroStatsResponse>('/api/v1/pm/micro/stats') and returns the JSON result.
// ── Dataset stats ───────────────────────────────────────────────────── 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-222 (handler)The async handler function for pm_micro_stats that fetches dataset statistics from the Verilex API endpoint /api/v1/pm/micro/stats. It has no input parameters (empty inputSchema). On success, it returns the stats JSON; on error, it returns an error 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:21-26 (schema)The PmMicroStatsResponse interface defines the shape of the API response: dataset (string), source (string), update_frequency (string), and stats (Record<string, unknown>).
interface PmMicroStatsResponse { dataset: string; source: string; update_frequency: string; stats: Record<string, unknown>; } - src/index.ts:31-31 (registration)Import of registerPmMicroTools from './tools/pm_micro.js' in the main server entry point.
import { registerPmMicroTools } from "./tools/pm_micro.js"; - src/index.ts:58-58 (registration)Registration call: registerPmMicroTools(server) invoked in createMcpServer() to wire up all pm_micro tools including pm_micro_stats.
registerPmMicroTools(server);