get_order_book
Retrieve the full order book for a Polymarket prediction market token to analyze market depth, liquidity, and price levels.
Instructions
Get the full order book (bids and asks) for a Polymarket token. Shows market depth and liquidity at each price level.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token_id | Yes | CLOB token ID |
Implementation Reference
- src/tools/clob/orderbook.ts:6-23 (registration)Tool registration and handler definition for "get_order_book" in the CLOB tools module.
server.tool( "get_order_book", "Get the full order book (bids and asks) for a Polymarket token. Shows market depth and liquidity at each price level.", { token_id: z.string().describe("CLOB token ID"), }, async (args) => { try { const data = await clob.getOrderBook(args.token_id); 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/api/clob.ts:36-42 (handler)The actual API client method implementation for "get_order_book".
async getOrderBook(tokenId: string): Promise<ClobOrderBook> { return this.client.clob<ClobOrderBook>( "/book", { token_id: tokenId }, CACHE_TTLS.orderBook, ); }