get_events
List and filter Polymarket prediction events with pagination, sorting, and status/tag filtering to analyze market data.
Instructions
List and filter Polymarket prediction events. Supports pagination, sorting, and filtering by status/tag.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Number of results to return | |
| offset | No | Pagination offset | |
| order | No | Sort field: volume, liquidity, startDate, endDate, createdAt | |
| ascending | No | Sort ascending (default: false) | |
| slug | No | Filter by event slug | |
| tag | No | Filter by tag label | |
| closed | No | Filter by closed status | |
| active | No | Filter by active status |
Implementation Reference
- src/tools/gamma/events.ts:22-32 (handler)Tool handler implementation for 'get_events' in src/tools/gamma/events.ts, which calls the underlying GammaApi.getEvents method.
async (args) => { try { const data = await gamma.getEvents(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, }; } }, - src/tools/gamma/events.ts:6-21 (registration)Registration of 'get_events' tool including Zod schema validation in src/tools/gamma/events.ts.
server.tool( "get_events", "List and filter Polymarket prediction events. Supports pagination, sorting, and filtering by status/tag.", { limit: z.number().min(1).max(100).default(20).describe("Number of results to return"), offset: z.number().min(0).default(0).describe("Pagination offset"), order: z .string() .optional() .describe("Sort field: volume, liquidity, startDate, endDate, createdAt"), ascending: z.boolean().optional().describe("Sort ascending (default: false)"), slug: z.string().optional().describe("Filter by event slug"), tag: z.string().optional().describe("Filter by tag label"), closed: z.boolean().optional().describe("Filter by closed status"), active: z.boolean().optional().describe("Filter by active status"), }, - src/api/gamma.ts:16-38 (helper)The underlying GammaApi method 'getEvents' that executes the request logic for the 'get_events' tool.
async getEvents(params?: { limit?: number; offset?: number; order?: string; ascending?: boolean; slug?: string; tag?: string; closed?: boolean; active?: boolean; archived?: boolean; }): Promise<GammaEvent[]> { const query: Record<string, string | undefined> = {}; if (params?.limit !== undefined) query.limit = String(params.limit); if (params?.offset !== undefined) query.offset = String(params.offset); if (params?.order) query.order = params.order; if (params?.ascending !== undefined) query.ascending = String(params.ascending); if (params?.slug) query.slug = params.slug; if (params?.tag) query.tag = params.tag; if (params?.closed !== undefined) query.closed = String(params.closed); if (params?.active !== undefined) query.active = String(params.active); if (params?.archived !== undefined) query.archived = String(params.archived); return this.client.gamma<GammaEvent[]>("/events", query); }