insumer_create_merchant
Register a new merchant on the insumer platform. Receive 100 free verification credits upon creation. Each API key can own up to 10 merchants. Requires company name and unique merchant ID.
Instructions
Create a new merchant. Receives 100 free verification credits. The API key that creates the merchant owns it. Max 10 merchants per API key.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| companyName | Yes | Company display name | |
| companyId | Yes | Unique merchant ID (alphanumeric, dashes, underscores) | |
| location | No | City or region |
Implementation Reference
- src/index.ts:519-522 (handler)The handler function that executes the tool logic: sends a POST request to /merchants with the provided args (companyName, companyId, location) and returns the formatted result.
async (args) => { const result = await apiCall("POST", "/merchants", args); return formatResult(result); } - src/index.ts:509-518 (schema)The Zod schema defining the input parameters for insumer_create_merchant: companyName (string, max 100), companyId (string, 2-50 chars, alphanumeric/dashes/underscores), location (optional string, max 200).
{ companyName: z.string().max(100).describe("Company display name"), companyId: z .string() .min(2) .max(50) .regex(/^[a-zA-Z0-9_-]+$/) .describe("Unique merchant ID (alphanumeric, dashes, underscores)"), location: z.string().max(200).optional().describe("City or region"), }, - src/index.ts:506-523 (registration)Registration of the tool via server.tool() with the name 'insumer_create_merchant' and a description about creating a merchant with 100 free verification credits.
server.tool( "insumer_create_merchant", "Create a new merchant. Receives 100 free verification credits. The API key that creates the merchant owns it. Max 10 merchants per API key.", { companyName: z.string().max(100).describe("Company display name"), companyId: z .string() .min(2) .max(50) .regex(/^[a-zA-Z0-9_-]+$/) .describe("Unique merchant ID (alphanumeric, dashes, underscores)"), location: z.string().max(200).optional().describe("City or region"), }, async (args) => { const result = await apiCall("POST", "/merchants", args); return formatResult(result); } ); - src/index.ts:17-40 (helper)The apiCall helper function used by the handler to make authenticated HTTP requests to the Insumer API with the API key.
async function apiCall( method: string, path: string, body?: Record<string, unknown> ): Promise<{ ok: boolean; data?: unknown; error?: unknown; meta?: unknown }> { if (!apiKey) { return { ok: false, error: "INSUMER_API_KEY is not set. Call the insumer_setup tool to generate a free API key instantly, then add it to your MCP config as INSUMER_API_KEY and restart." }; } const url = `${API_BASE}${path}`; const res = await fetch(url, { method, headers: { "Content-Type": "application/json", "X-API-Key": apiKey, }, body: body ? JSON.stringify(body) : undefined, }); return res.json() as Promise<{ ok: boolean; data?: unknown; error?: unknown; meta?: unknown; }>; } - src/index.ts:61-76 (helper)The formatResult helper function that wraps the API response into the MCP content format, marking errors with isError: true.
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, }; }