get_market
Retrieve detailed information about a specific Polymarket prediction market, including outcomes, prices, volume, and liquidity data, using its ID or slug.
Instructions
Get a single Polymarket market by ID or slug. Returns full market details including outcomes, prices, volume, and liquidity.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | No | Market ID | |
| slug | No | Market slug |
Implementation Reference
- src/tools/gamma/markets.ts:50-67 (handler)Tool handler for "get_market", which delegates to GammaApi.getMarket.
async (args) => { if (!args.id && !args.slug) { return { content: [{ type: "text", text: "Error: Either id or slug is required" }], isError: true, }; } try { const data = await gamma.getMarket(args); return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Error: ${(error as Error).message}` }], isError: true, }; } }, ); - src/tools/gamma/markets.ts:44-48 (registration)Registration of the "get_market" tool in the Gamma markets toolset.
"get_market", "Get a single Polymarket market by ID or slug. Returns full market details including outcomes, prices, volume, and liquidity.", { id: z.string().optional().describe("Market ID"), slug: z.string().optional().describe("Market slug"), - src/api/gamma.ts:99-114 (handler)API method that fetches a single market by ID or slug from the Gamma API.
async getMarket(params: { id?: string; slug?: string }): Promise<GammaMarket> { if (params.id) { return this.client.gamma<GammaMarket>( `/markets/${params.id}`, undefined, CACHE_TTLS.marketById, ); } const results = await this.client.gamma<GammaMarket[]>("/markets", { slug: params.slug, }); if (!results || results.length === 0) { throw new Error(`Market not found: ${params.slug}`); } return results[0]; }