insumer_list_merchants
Browse merchants from the public directory. Filter by accepted token symbol (e.g., UNI) and verification status. Returns company name, website, tokens accepted, and discount info.
Instructions
Browse merchants in the public directory. Filter by accepted token, verification status. Returns company name, website, tokens accepted, and discount info.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| token | No | Filter by accepted token symbol, e.g. 'UNI' | |
| verified | No | Filter by domain verification status | |
| limit | No | Results per page (default 50, max 200) | |
| offset | No | Pagination offset (default 0) |
Implementation Reference
- src/index.ts:360-374 (handler)The handler function for insumer_list_merchants. Builds query params from optional token/verified/limit/offset args, sends a GET request to /merchants, and returns the formatted JSON result.
async (args) => { const params = new URLSearchParams(); if (args.token) params.set("token", args.token); if (args.verified) params.set("verified", args.verified); if (args.limit !== undefined) params.set("limit", String(args.limit)); if (args.offset !== undefined) params.set("offset", String(args.offset)); const qs = params.toString(); const url = `${API_BASE}/merchants${qs ? `?${qs}` : ""}`; const res = await fetch(url, { method: "GET", headers: { "Accept": "application/json" }, }); const result = await res.json() as { ok: boolean; data?: unknown; error?: unknown; meta?: unknown }; return formatResult(result); } - src/index.ts:354-359 (schema)Input schema for insumer_list_merchants: optional token (string), verified (enum 'true'/'false'), limit (1-200 int), offset (non-negative int).
{ token: z.string().optional().describe("Filter by accepted token symbol, e.g. 'UNI'"), verified: z.enum(["true", "false"]).optional().describe("Filter by domain verification status"), limit: z.number().int().min(1).max(200).optional().describe("Results per page (default 50, max 200)"), offset: z.number().int().min(0).optional().describe("Pagination offset (default 0)"), }, - src/index.ts:351-375 (registration)Registration of the insumer_list_merchants tool using server.tool() with name, description, Zod schema, and handler.
server.tool( "insumer_list_merchants", "Browse merchants in the public directory. Filter by accepted token, verification status. Returns company name, website, tokens accepted, and discount info.", { token: z.string().optional().describe("Filter by accepted token symbol, e.g. 'UNI'"), verified: z.enum(["true", "false"]).optional().describe("Filter by domain verification status"), limit: z.number().int().min(1).max(200).optional().describe("Results per page (default 50, max 200)"), offset: z.number().int().min(0).optional().describe("Pagination offset (default 0)"), }, async (args) => { const params = new URLSearchParams(); if (args.token) params.set("token", args.token); if (args.verified) params.set("verified", args.verified); if (args.limit !== undefined) params.set("limit", String(args.limit)); if (args.offset !== undefined) params.set("offset", String(args.offset)); const qs = params.toString(); const url = `${API_BASE}/merchants${qs ? `?${qs}` : ""}`; const res = await fetch(url, { method: "GET", headers: { "Accept": "application/json" }, }); const result = await res.json() as { ok: boolean; data?: unknown; error?: unknown; meta?: unknown }; return formatResult(result); } ); - src/index.ts:61-76 (helper)Helper function formatResult used by the handler to format API responses as MCP text content, setting isError flag when the API returns ok: false.
function formatResult(result: { ok: boolean; data?: unknown; error?: unknown; meta?: unknown; }) { if (result.ok) { return { content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }], }; } return { content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }], isError: true, }; }