get_probability
Get real-time probability, odds, and likelihood for prediction market outcomes from Kalshi and Polymarket. Use for elections, crypto prices, sports, economics, weather, and entertainment forecasts.
Instructions
Get real-time probability, odds, and likelihood for any prediction market outcome.
Returns YES/NO probabilities (0-100%), trading volume, liquidity depth, and market metadata from Kalshi (CFTC-regulated) and Polymarket. Use this when asked about chances, odds, likelihood, forecasts, or predictions for any event — elections, crypto prices, sports, economics, weather, entertainment.
Example queries:
"What are the odds Trump wins 2028?" → election forecasting
"What's the probability BTC hits $200K?" → crypto price prediction
"Will the Fed cut rates?" → economic forecasting, interest rates
"What's the chance of rain in NYC?" → weather betting
"Who will win the Super Bowl?" → sports odds
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| market_id | No | The market UUID or external_id (ticker) to query | |
| query | No | Natural language query to search for a market (alternative to market_id) |
Implementation Reference
- worker/src/tools.ts:295-333 (handler)The core handler function implementing the logic for retrieving probability data.
async function getProbability( supabase: SupabaseClient, args: { market_id?: string; query?: string }, ): Promise<ToolResult> { if (!args.market_id && !args.query) return err("Provide market_id or query"); const market = await findMarket(supabase, args.market_id, args.query); if (!market) return err("Market not found"); const yesProb = Math.round((market.external_odds?.yes || 0.5) * 100); const volume = market.raw_data?.volume_24h || market.raw_data?.volume || 0; const liquidity = market.raw_data?.liquidity || 0; const confidence = computeConfidence({ volume, liquidity, yesProbability: yesProb, closesAt: market.closes_at, }); const jurisdictionInfo = SOURCE_JURISDICTION[market.source] || SOURCE_JURISDICTION.demo; return json({ market_id: market.id, title: market.title, source: market.source, yes_probability: yesProb, no_probability: Math.round((market.external_odds?.no || 0.5) * 100), volume_24h: volume, liquidity, status: market.status, closes_at: market.closes_at, last_updated: market.updated_at, confidence, jurisdiction: jurisdictionInfo, }); } async function listMarkets( supabase: SupabaseClient, args: { - worker/src/tools.ts:154-158 (registration)The registration/invocation of getProbability inside the tool dispatch switch statement.
case "get_probability": return getProbability( supabase, args as { market_id?: string; query?: string }, ); - worker/src/schema.ts:118-133 (schema)Schema definition for the get_probability tool including input parameters and description.
{ name: "get_probability", description: `Get real-time probability for any prediction market outcome. Returns YES/NO probabilities (0-100%), volume, liquidity, and market metadata from Kalshi and Polymarket.`, inputSchema: { type: "object", properties: { market_id: { type: "string", description: "Market UUID or external_id", }, query: { type: "string", description: "Natural language search query (alternative to market_id)", }, },