Skip to main content
Glama
yigitabi5444

Polymarket MCP Server

by yigitabi5444

get_midpoint

Calculate the midpoint price for a Polymarket prediction market token by averaging the best bid and ask prices to determine fair market value.

Instructions

Get the midpoint price for a Polymarket token (average of best bid and ask).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
token_idYesCLOB token ID

Implementation Reference

  • The actual implementation of the getMidpoint API call that fetches data from the CLOB endpoint.
    async getMidpoint(tokenId: string): Promise<ClobMidpoint> {
      return this.client.clob<ClobMidpoint>("/midpoint", {
        token_id: tokenId,
      });
    }
  • Registration and MCP tool handler for "get_midpoint", which calls the clob.getMidpoint method.
    server.tool(
      "get_midpoint",
      "Get the midpoint price for a Polymarket token (average of best bid and ask).",
      {
        token_id: z.string().describe("CLOB token ID"),
      },
      async (args) => {
        try {
          const data = await clob.getMidpoint(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,
          };
        }
      },
    );

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