Skip to main content
Glama
yigitabi5444

Polymarket MCP Server

by yigitabi5444

get_order_books

Retrieve order books for multiple Polymarket prediction market tokens in a single batch request to analyze market depth and liquidity.

Instructions

Get order books for multiple Polymarket tokens in a single batch request.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
token_idsYesArray of CLOB token IDs

Implementation Reference

  • The MCP tool "get_order_books" is registered here, which calls clob.getOrderBooks.
    server.tool(
      "get_order_books",
      "Get order books for multiple Polymarket tokens in a single batch request.",
      {
        token_ids: z
          .array(z.string())
          .min(1)
          .max(20)
          .describe("Array of CLOB token IDs"),
      },
      async (args) => {
        try {
          const data = await clob.getOrderBooks(args.token_ids);
          return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
        } catch (error) {
          return {
            content: [{ type: "text", text: `Error: ${(error as Error).message}` }],
            isError: true,
          };
        }
      },
    );
  • This is the underlying API method used by the "get_order_books" tool.
    async getOrderBooks(tokenIds: string[]): Promise<ClobOrderBook[]> {
      return this.client.clobPost<ClobOrderBook[]>("/books", tokenIds);
    }

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