Skip to main content
Glama
yigitabi5444

Polymarket MCP Server

by yigitabi5444

get_price

Retrieve the best available buy or sell price for a Polymarket prediction market token to inform trading decisions.

Instructions

Get the current price for a Polymarket token on the given side (buy or sell). Returns the best available price.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
token_idYesCLOB token ID (from market's clobTokenIds)
sideYesOrder side: buy or sell

Implementation Reference

  • The MCP tool handler for "get_price", which executes clob.getPrice().
    async (args) => {
      try {
        const data = await clob.getPrice(args.token_id, args.side);
        return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
      } catch (error) {
        return {
          content: [{ type: "text", text: `Error: ${(error as Error).message}` }],
          isError: true,
        };
      }
    },
  • Registration of the "get_price" tool with its schema definition.
    server.tool(
      "get_price",
      "Get the current price for a Polymarket token on the given side (buy or sell). Returns the best available price.",
      {
        token_id: z.string().describe("CLOB token ID (from market's clobTokenIds)"),
        side: z.enum(["buy", "sell"]).describe("Order side: buy or sell"),
      },
  • The underlying API call implementation for fetching the price.
    async getPrice(tokenId: string, side: "buy" | "sell"): Promise<ClobPrice> {
      return this.client.clob<ClobPrice>("/price", {
        token_id: tokenId,
        side,
      });
    }

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