sentinel_compare
Compare price pairs across multiple blockchain networks to identify cross-chain deviations and ensure data consistency.
Instructions
Compare a price pair across all available chains to detect cross-chain deviations
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pair | Yes | Price pair to compare (e.g., BTC/USD, ETH/USD) |
Implementation Reference
- src/mcp/server.ts:207-254 (handler)The 'sentinel_compare' tool handler is registered and implemented within the server.ts file, using a loop to iterate through all chains to compare price feeds.
server.tool( "sentinel_compare", "Compare a price pair across all available chains to detect cross-chain deviations", { pair: z.string().describe("Price pair to compare (e.g., BTC/USD, ETH/USD)"), }, async ({ pair }) => { const results: FeedData[] = []; for (const chain of chains) { const feed = await readFeed(chain, pair); if (feed) results.push(feed); } if (results.length === 0) { return { content: [{ type: "text", text: `No feeds found for ${pair}` }] }; } const prices = results.map((r) => r.price); const min = Math.min(...prices); const max = Math.max(...prices); const spread = ((max - min) / min) * 100; const lines = results.map( (r) => `${r.chain.padEnd(12)} $${r.price.toFixed(4).padStart(12)} | updated ${Math.floor(r.staleness / 60)}m ago` ); return { content: [ { type: "text", text: [ `**${pair} — Cross-Chain Comparison**`, `Chains: ${results.length} | Spread: ${spread.toFixed(3)}%`, `Min: $${min.toFixed(4)} | Max: $${max.toFixed(4)}`, "", "```", ...lines, "```", spread > 2 ? `\n**WARNING**: ${spread.toFixed(2)}% cross-chain spread detected. Possible oracle attack or arbitrage opportunity.` : "", ].join("\n"), }, ], }; } );