Polymarket Resolution Lookup
pm_resolution_lookupRetrieve resolution source and criteria for any Polymarket market. Displays oracle, rules, data sources, and expected timeline.
Instructions
Look up the resolution source and criteria for a Polymarket market. Shows the oracle, resolution rules, data sources, and expected resolution timeline. Cost: $0.02 per query. Source: Polymarket resolution tracking.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| market_id | No | Market ID to look up | |
| query | No | Search markets by title/description | |
| limit | No | Maximum results (default 25) |
Implementation Reference
- src/tools/pm_resolution.ts:38-55 (registration)Zod schema defining the three optional input parameters: market_id, query, and limit (1-100, default 25).
inputSchema: { market_id: z .string() .optional() .describe("Market ID to look up"), query: z .string() .optional() .describe("Search markets by title/description"), limit: z .number() .int() .min(1) .max(100) .optional() .describe("Maximum results (default 25)"), }, }, - src/tools/pm_resolution.ts:56-87 (handler)Handler that calls the Verilex API endpoint /api/v1/pm/resolution/lookup with market_id, q (query), and limit parameters, then returns the JSON results with a summary.
async ({ market_id, query, limit }) => { const res = await apiGet<PmResolutionQueryResponse>( "/api/v1/pm/resolution/lookup", { market_id, q: query, limit: limit ?? 25, }, ); if (!res.ok) { return { content: [ { type: "text" as const, text: `API error (${res.status}): ${JSON.stringify(res.data)}`, }, ], isError: true, }; } const { count, data } = res.data; const warn = stalenessWarning(res); const summary = `${warn}Found ${count} resolution record(s).`; const json = JSON.stringify(data, null, 2); return { content: [{ type: "text" as const, text: `${summary}\n\n${json}` }], }; }, ); - src/tools/pm_resolution.ts:30-87 (registration)Registers the 'pm_resolution_lookup' tool on the MCP server with title, description, input schema, and handler.
server.registerTool( "pm_resolution_lookup", { title: "Polymarket Resolution Lookup", description: "Look up the resolution source and criteria for a Polymarket market. Shows the " + "oracle, resolution rules, data sources, and expected resolution timeline. " + "Cost: $0.02 per query. Source: Polymarket resolution tracking.", inputSchema: { market_id: z .string() .optional() .describe("Market ID to look up"), query: z .string() .optional() .describe("Search markets by title/description"), limit: z .number() .int() .min(1) .max(100) .optional() .describe("Maximum results (default 25)"), }, }, async ({ market_id, query, limit }) => { const res = await apiGet<PmResolutionQueryResponse>( "/api/v1/pm/resolution/lookup", { market_id, q: query, limit: limit ?? 25, }, ); if (!res.ok) { return { content: [ { type: "text" as const, text: `API error (${res.status}): ${JSON.stringify(res.data)}`, }, ], isError: true, }; } const { count, data } = res.data; const warn = stalenessWarning(res); const summary = `${warn}Found ${count} resolution record(s).`; const json = JSON.stringify(data, null, 2); return { content: [{ type: "text" as const, text: `${summary}\n\n${json}` }], }; }, ); - src/index.ts:56-56 (registration)Top-level registration call that wires the pm_resolution tools into the MCP server.
registerPmResolutionTools(server); - src/client.ts:35-41 (helper)Helper function that generates a staleness warning string used by the handler when data may be stale.
export function stalenessWarning(res: ApiResponse): string { if (!res.stale) return ""; const parts = ["[STALE DATA]"]; if (res.lastUpdated) parts.push(`Last updated: ${res.lastUpdated}`); if (res.ageSeconds != null) parts.push(`Age: ${res.ageSeconds}s`); return parts.join(" ") + "\n\n"; }