Skip to main content
Glama
PaulieB14

graph-polymarket-mcp

list_polymarket_events

Fetch Polymarket events, each bundling multiple Yes/No markets under a topic, with optional filters for active status, tag, and sorting.

Instructions

List Polymarket events (groups of related markets). Events bundle multiple Yes/No markets under one topic (e.g. 'US Presidential Election 2024' contains many candidate markets). Uses the Gamma API.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoNumber of events (1-100)
activeNoFilter: only active events
closedNoFilter: only closed events
tagNoFilter by tag (e.g. 'politics', 'crypto', 'sports')
orderByNoSort field
ascendingNoSort ascending

Implementation Reference

  • src/index.ts:1049-1094 (registration)
    Tool registration for 'list_polymarket_events'. This is where the tool is registered with the MCP server, defining its name, description, input schema, and handler. The handler calls listEvents() from polymarketApi.
    // Tool 23: list_polymarket_events
    // ---------------------------------------------------------------------------
    server.registerTool(
      "list_polymarket_events",
      {
        description:
          "List Polymarket events (groups of related markets). Events bundle multiple Yes/No markets under one topic (e.g. 'US Presidential Election 2024' contains many candidate markets). Uses the Gamma API.",
        inputSchema: {
          limit: z.number().min(1).max(100).default(10).describe("Number of events (1-100)"),
          active: z.boolean().optional().describe("Filter: only active events"),
          closed: z.boolean().optional().describe("Filter: only closed events"),
          tag: z.string().optional().describe("Filter by tag (e.g. 'politics', 'crypto', 'sports')"),
          orderBy: z
            .enum(["volume", "liquidity", "startDate", "endDate", "createdAt"])
            .optional()
            .describe("Sort field"),
          ascending: z.boolean().default(false).describe("Sort ascending"),
        },
      },
      async ({ limit, active, closed, tag, orderBy, ascending }) => {
        try {
          const events = await listEvents({ limit, active, closed, tag, orderBy, ascending });
          return textResult({
            count: events.length,
            events: events.map((e) => ({
              id: e.id,
              title: e.title,
              slug: e.slug,
              description: e.description,
              startDate: e.startDate,
              endDate: e.endDate,
              marketCount: e.markets?.length ?? 0,
              markets: (e.markets ?? []).map((m) => ({
                id: m.id,
                question: m.question,
                outcomePrices: m.outcomePrices,
                volume: m.volume,
                active: m.active,
              })),
            })),
          });
        } catch (error) {
          return errorResult(error);
        }
      }
    );
  • Handler function for the list_polymarket_events tool. Calls listEvents() and formats the response with event metadata including id, title, slug, description, dates, and nested market info.
      async ({ limit, active, closed, tag, orderBy, ascending }) => {
        try {
          const events = await listEvents({ limit, active, closed, tag, orderBy, ascending });
          return textResult({
            count: events.length,
            events: events.map((e) => ({
              id: e.id,
              title: e.title,
              slug: e.slug,
              description: e.description,
              startDate: e.startDate,
              endDate: e.endDate,
              marketCount: e.markets?.length ?? 0,
              markets: (e.markets ?? []).map((m) => ({
                id: m.id,
                question: m.question,
                outcomePrices: m.outcomePrices,
                volume: m.volume,
                active: m.active,
              })),
            })),
          });
        } catch (error) {
          return errorResult(error);
        }
      }
    );
  • Zod input schema for the list_polymarket_events tool: limit (1-100, default 10), optional active/closed/tag filters, optional orderBy enum, and ascending boolean.
      inputSchema: {
        limit: z.number().min(1).max(100).default(10).describe("Number of events (1-100)"),
        active: z.boolean().optional().describe("Filter: only active events"),
        closed: z.boolean().optional().describe("Filter: only closed events"),
        tag: z.string().optional().describe("Filter by tag (e.g. 'politics', 'crypto', 'sports')"),
        orderBy: z
          .enum(["volume", "liquidity", "startDate", "endDate", "createdAt"])
          .optional()
          .describe("Sort field"),
        ascending: z.boolean().default(false).describe("Sort ascending"),
      },
    },
  • Helper function listEvents() that calls the Gamma API to fetch events. Builds query params from the options and returns a Promise of GammaEvent array.
    export async function listEvents(
      opts: { limit?: number; active?: boolean; closed?: boolean; slug?: string; tag?: string; orderBy?: string; ascending?: boolean } = {}
    ): Promise<GammaEvent[]> {
      const params = new URLSearchParams();
      params.set("_limit", String(opts.limit ?? 10));
      if (opts.active !== undefined) params.set("active", String(opts.active));
      if (opts.closed !== undefined) params.set("closed", String(opts.closed));
      if (opts.slug) params.set("slug", opts.slug);
      if (opts.tag) params.set("tag", opts.tag);
      if (opts.orderBy) {
        params.set("_sort", opts.orderBy);
        params.set("_order", opts.ascending ? "asc" : "desc");
      }
      return fetchJson<GammaEvent[]>(`${GAMMA_BASE}/events?${params}`);
    }
  • Type definition for GammaEvent used by listEvents() and the tool handler. Contains id, slug, title, description, dates, and nested markets array.
    export interface GammaEvent {
      id: string;
      slug: string;
      title: string;
      description: string;
      startDate: string;
      endDate: string;
      markets: GammaMarket[];
      [key: string]: unknown;
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must carry the full burden of behavioral disclosure. It only states that the tool uses the Gamma API, but fails to mention pagination, rate limits, data freshness, or behavior when no events match. This is insufficient for safe and effective invocation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise at two sentences, front-loading the key action and clarification of events. It avoids unnecessary detail. However, it sacrifices some informative context for brevity.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With 6 optional parameters, no output schema, and no annotations, the description is incomplete. It lacks information on return format, example usage, or any constraints like minimum/maximum limit. The conceptual explanation partially compensates but overall leaves significant gaps.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema covers all 6 parameters with descriptions, achieving 100% coverage. The description adds no parameter-specific meaning beyond the schema; the conceptual explanation of events is helpful but not tied to parameters. Baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly identifies the action as listing events, explains that events bundle multiple markets, and gives a concrete example (US Presidential Election 2024). This effectively distinguishes it from sibling tools like get_polymarket_event (single event) or search_markets.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description does not provide explicit guidance on when to use this tool versus alternatives. While the purpose is clear, it lacks instructions on filtering scenarios or when to prefer this over search_markets or get_polymarket_event. The context of optional parameters implies usage but does not directly guide the agent.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/PaulieB14/graph-polymarket-mcp'

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