get_clob_market
Get CLOB market data by condition ID: returns token IDs, current prices, minimum order sizes, and market status for trading.
Instructions
Get CLOB market details by condition ID. Returns token IDs (token_id) with live prices, minimum order/tick sizes, and market status. This is the bridge between on-chain condition IDs and CLOB trading data. Use the returned token_id values with get_live_prices, get_live_spread, get_live_orderbook, get_price_history, or get_market_positions.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| conditionId | Yes | Market condition ID (hex string) |
Implementation Reference
- src/index.ts:1267-1287 (registration)MCP tool registration for 'get_clob_market' tool. Defines the tool name, description, input schema (conditionId string), and handler that calls the getClobMarket function and formats the result.
// --------------------------------------------------------------------------- // Tool 30: get_clob_market // --------------------------------------------------------------------------- server.registerTool( "get_clob_market", { description: "Get CLOB market details by condition ID. Returns token IDs (token_id) with live prices, minimum order/tick sizes, and market status. This is the bridge between on-chain condition IDs and CLOB trading data. Use the returned token_id values with get_live_prices, get_live_spread, get_live_orderbook, get_price_history, or get_market_positions.", inputSchema: { conditionId: z.string().describe("Market condition ID (hex string)"), }, }, async ({ conditionId }) => { try { const market = await getClobMarket(conditionId); return textResult(market); } catch (error) { return errorResult(error); } } ); - src/polymarketApi.ts:211-215 (handler)The actual implementation of the CLOB market data fetcher. Makes a GET request to https://clob.polymarket.com/markets/{conditionId} and returns the parsed JSON as a ClobMarket object.
export async function getClobMarket(conditionId: string): Promise<ClobMarket> { return fetchJson<ClobMarket>( `${CLOB_BASE}/markets/${encodeURIComponent(conditionId)}` ); } - src/polymarketApi.ts:135-154 (schema)TypeScript interface defining the shape of the ClobMarket object returned by the API. Includes condition_id, question_id, tokens array (with token_id/outcome/price/winner), market metadata, and an index signature for additional fields.
export interface ClobMarket { condition_id: string; question_id: string; tokens: Array<{ token_id: string; outcome: string; price: number; winner: boolean; }>; minimum_order_size: string; minimum_tick_size: string; description: string; market_slug: string; end_date_iso: string; active: boolean; closed: boolean; accepting_orders: boolean; accepting_order_timestamp: string; [key: string]: unknown; } - src/index.ts:10-24 (registration)Import of getClobMarket from polymarketApi.ts into the main server file, providing the handler function used by the tool registration.
import { searchMarkets, getMarketBySlug, getMarketByConditionId, listEvents, getEvent, getClobPrice, getClobPricesBatch, getClobMidpoint, getClobSpread, getClobOrderBook, getClobLastTradePrice, getClobPriceHistory, getClobMarket, } from "./polymarketApi.js";