Skip to main content
Glama
yigitabi5444

Polymarket MCP Server

by yigitabi5444

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
NameRequiredDescriptionDefault
token_idYesCLOB token ID

Implementation Reference

  • 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,
          };
        }
      },
    );
  • 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,
      );
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yigitabi5444/yigit_polymarket_mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server