get_market_info
Retrieve comprehensive Polymarket market data including description, prices, outcomes, and CLOB token IDs by providing a market slug or condition ID.
Instructions
Get detailed Polymarket market info by slug or condition ID. Returns full market metadata from the Gamma API including description, prices, outcomes, and CLOB token IDs. Use the returned conditionId to query get_clob_market for live CLOB data, get_market_open_interest for OI, or get_market_resolution for oracle status.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| slug | No | Market slug (e.g. 'will-trump-win-2024') | |
| conditionId | No | Market condition ID (hex string) |
Implementation Reference
- src/index.ts:1017-1046 (registration)Tool registration for 'get_market_info' using server.registerTool. Defines the input schema (slug or conditionId) and delegates to getMarketBySlug or getMarketByConditionId.
// --------------------------------------------------------------------------- // Tool 22: get_market_info // --------------------------------------------------------------------------- server.registerTool( "get_market_info", { description: "Get detailed Polymarket market info by slug or condition ID. Returns full market metadata from the Gamma API including description, prices, outcomes, and CLOB token IDs. Use the returned conditionId to query get_clob_market for live CLOB data, get_market_open_interest for OI, or get_market_resolution for oracle status.", inputSchema: { slug: z.string().optional().describe("Market slug (e.g. 'will-trump-win-2024')"), conditionId: z.string().optional().describe("Market condition ID (hex string)"), }, }, async ({ slug, conditionId }) => { try { if (!slug && !conditionId) { return errorResult("Provide either slug or conditionId"); } const markets = slug ? await getMarketBySlug(slug) : await getMarketByConditionId(conditionId!); if (markets.length === 0) { return textResult({ error: "Market not found", slug, conditionId }); } return textResult(markets.length === 1 ? markets[0] : markets); } catch (error) { return errorResult(error); } } ); - src/index.ts:1030-1046 (handler)Handler function for get_market_info. Takes slug or conditionId, validates at least one is provided, then calls getMarketBySlug or getMarketByConditionId from polymarketApi.ts, returning the market data.
async ({ slug, conditionId }) => { try { if (!slug && !conditionId) { return errorResult("Provide either slug or conditionId"); } const markets = slug ? await getMarketBySlug(slug) : await getMarketByConditionId(conditionId!); if (markets.length === 0) { return textResult({ error: "Market not found", slug, conditionId }); } return textResult(markets.length === 1 ? markets[0] : markets); } catch (error) { return errorResult(error); } } ); - src/index.ts:1025-1029 (schema)Input schema for get_market_info. Accepts optional slug (string) and conditionId (string) fields.
inputSchema: { slug: z.string().optional().describe("Market slug (e.g. 'will-trump-win-2024')"), conditionId: z.string().optional().describe("Market condition ID (hex string)"), }, }, - src/polymarketApi.ts:87-95 (helper)Helper function getMarketBySlug — fetches market data from Gamma API by slug.
export async function getMarketBySlug(slug: string): Promise<GammaMarket[]> { return fetchJson<GammaMarket[]>(`${GAMMA_BASE}/markets?slug=${encodeURIComponent(slug)}`); } export async function getMarketByConditionId(conditionId: string): Promise<GammaMarket[]> { return fetchJson<GammaMarket[]>( `${GAMMA_BASE}/markets?conditionId=${encodeURIComponent(conditionId)}` ); } - src/polymarketApi.ts:91-95 (helper)Helper function getMarketByConditionId — fetches market data from Gamma API by condition ID.
export async function getMarketByConditionId(conditionId: string): Promise<GammaMarket[]> { return fetchJson<GammaMarket[]>( `${GAMMA_BASE}/markets?conditionId=${encodeURIComponent(conditionId)}` ); }