get_order_book_summary
Retrieve summarized order book data for Polymarket tokens, showing best bid, best ask, and spread to analyze market liquidity and pricing.
Instructions
Get a summarized order book for a Polymarket token: best bid, best ask, and spread.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token_id | Yes | CLOB token ID |
Implementation Reference
- src/tools/clob/orderbook.ts:48-64 (handler)The handler function for the 'get_order_book_summary' tool. It calls the clob API and returns the result as a JSON string.
server.tool( "get_order_book_summary", "Get a summarized order book for a Polymarket token: best bid, best ask, and spread.", { token_id: z.string().describe("CLOB token ID"), }, async (args) => { try { const data = await clob.getOrderBookSummary(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:48-52 (handler)The underlying implementation method that interacts with the CLOB API for 'get_order_book_summary'.
async getOrderBookSummary(tokenId: string): Promise<ClobOrderBookSummary> { return this.client.clob<ClobOrderBookSummary>("/order-book-summary", { token_id: tokenId, }); }