Skip to main content
Glama
yigitabi5444

Polymarket MCP Server

by yigitabi5444

get_market

Retrieve detailed information about a specific Polymarket prediction market, including outcomes, prices, volume, and liquidity data, using its ID or slug.

Instructions

Get a single Polymarket market by ID or slug. Returns full market details including outcomes, prices, volume, and liquidity.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idNoMarket ID
slugNoMarket slug

Implementation Reference

  • Tool handler for "get_market", which delegates to GammaApi.getMarket.
      async (args) => {
        if (!args.id && !args.slug) {
          return {
            content: [{ type: "text", text: "Error: Either id or slug is required" }],
            isError: true,
          };
        }
        try {
          const data = await gamma.getMarket(args);
          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_market" tool in the Gamma markets toolset.
    "get_market",
    "Get a single Polymarket market by ID or slug. Returns full market details including outcomes, prices, volume, and liquidity.",
    {
      id: z.string().optional().describe("Market ID"),
      slug: z.string().optional().describe("Market slug"),
  • API method that fetches a single market by ID or slug from the Gamma API.
    async getMarket(params: { id?: string; slug?: string }): Promise<GammaMarket> {
      if (params.id) {
        return this.client.gamma<GammaMarket>(
          `/markets/${params.id}`,
          undefined,
          CACHE_TTLS.marketById,
        );
      }
      const results = await this.client.gamma<GammaMarket[]>("/markets", {
        slug: params.slug,
      });
      if (!results || results.length === 0) {
        throw new Error(`Market not found: ${params.slug}`);
      }
      return results[0];
    }

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