get_global_stats
Retrieve comprehensive protocol statistics including total markets, trades, volume, users, splits, merges, and redemptions across all market types.
Instructions
Get combined protocol-wide stats across both simple and negrisk markets. Returns total markets, trades, volume, users, splits, merges, redemptions with per-type breakdown.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- mcp-server/src/index.ts:47-92 (handler)The implementation of the `get_global_stats` tool. It queries both subgraphs, sums up the statistics, and returns them as a JSON result.
server.registerTool( "get_global_stats", { description: "Get combined protocol-wide stats across both simple and negrisk markets. Returns total markets, trades, volume, users, splits, merges, redemptions with per-type breakdown.", }, async () => { try { const { simple, negrisk } = await queryBoth( `{ globalStats(id: "0x73696d706c65") { totalMarkets resolvedMarkets totalTradesCount totalVolumeUSD totalFeesUSD totalUsers totalSplits totalMerges totalRedemptions } _meta { block { number } hasIndexingErrors } }`, `{ globalStats(id: "0x6e65677269736b") { totalMarkets resolvedMarkets totalTradesCount totalVolumeUSD totalFeesUSD totalUsers totalSplits totalMerges totalRedemptions } _meta { block { number } hasIndexingErrors } }` ); const s = simple.globalStats || {}; const n = negrisk.globalStats || {}; return textResult({ combined: { totalMarkets: (s.totalMarkets || 0) + (n.totalMarkets || 0), resolvedMarkets: (s.resolvedMarkets || 0) + (n.resolvedMarkets || 0), totalTradesCount: BigInt(s.totalTradesCount || "0") + BigInt(n.totalTradesCount || "0"), totalVolumeUSD: parseFloat(s.totalVolumeUSD || "0") + parseFloat(n.totalVolumeUSD || "0"), totalFeesUSD: parseFloat(s.totalFeesUSD || "0") + parseFloat(n.totalFeesUSD || "0"), totalUsers: (s.totalUsers || 0) + (n.totalUsers || 0), totalSplits: BigInt(s.totalSplits || "0") + BigInt(n.totalSplits || "0"), totalMerges: BigInt(s.totalMerges || "0") + BigInt(n.totalMerges || "0"), totalRedemptions: BigInt(s.totalRedemptions || "0") + BigInt(n.totalRedemptions || "0"), }, simpleMarkets: s, negriskMarkets: n, sync: { simple: simple._meta, negrisk: negrisk._meta, }, }); } catch (e) { return errorResult(e); } } );