create_app_store_qr
Create a QR code that redirects iPhone users to the Apple App Store, Android users to Google Play, and other devices to a fallback URL. Requires at least one store URL.
Instructions
Create a QR code that redirects to the correct app store based on the device. iPhones go to the App Store, Android devices go to Google Play, and other devices go to the fallback URL. Provide at least one store URL.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ios_url | No | Apple App Store URL. | |
| android_url | No | Google Play Store URL. | |
| fallback_url | No | Fallback URL for non-mobile devices. | |
| label | No | Label for this QR code. | |
| format | No | Image format. | svg |
| foreground_color | No | Hex color for dots. | |
| background_color | No | Hex color for background. | |
| dot_style | No | Dot shape. | |
| corner_style | No | Corner shape. | |
| logo_url | No | Logo URL or data URI. | |
| frame_style | No | Frame style around QR. | |
| frame_text | No | CTA text on frame (max 30 chars). | |
| frame_color | No | Frame background color. | |
| frame_text_color | No | Frame text color. |
Implementation Reference
- packages/mcp/src/tools.ts:609-616 (handler)The handler function for create_app_store_qr. Destructures ios_url, android_url, fallback_url from input and sends a POST request to /api/qr with type 'app_store' and the app_store_data payload.
handler: async (input: Record<string, unknown>) => { const { ios_url, android_url, fallback_url, ...rest } = input; return apiRequest("/api/qr", { method: "POST", body: { type: "app_store", app_store_data: { ios_url, android_url, fallback_url }, ...rest }, }); }, }, - packages/mcp/src/tools.ts:593-608 (schema)Input schema for create_app_store_qr using Zod. Defines optional fields: ios_url, android_url, fallback_url, label, format (default svg), foreground_color, background_color, dot_style, corner_style, logo_url, frame_style, frame_text, frame_color, frame_text_color.
inputSchema: z.object({ ios_url: z.string().optional().describe("Apple App Store URL."), android_url: z.string().optional().describe("Google Play Store URL."), fallback_url: z.string().optional().describe("Fallback URL for non-mobile devices."), label: z.string().optional().describe("Label for this QR code."), format: z.enum(["svg", "png"]).default("svg").describe("Image format."), foreground_color: z.string().regex(/^#[0-9A-Fa-f]{6}$/).optional().describe("Hex color for dots."), background_color: z.string().regex(/^#[0-9A-Fa-f]{6}$/).optional().describe("Hex color for background."), dot_style: z.enum(["square", "rounded", "dots", "classy-rounded"]).optional().describe("Dot shape."), corner_style: z.enum(["square", "extra-rounded", "dot"]).optional().describe("Corner shape."), logo_url: z.string().optional().describe("Logo URL or data URI."), frame_style: z.enum(["none", "banner_bottom", "banner_top", "rounded"]).optional().describe("Frame style around QR."), frame_text: z.string().max(30).optional().describe("CTA text on frame (max 30 chars)."), frame_color: z.string().regex(/^#[0-9A-Fa-f]{6}$/).optional().describe("Frame background color."), frame_text_color: z.string().regex(/^#[0-9A-Fa-f]{6}$/).optional().describe("Frame text color."), }), - packages/mcp/src/server.ts:21-53 (registration)Registration of all tools (including create_app_store_qr) via server.tool() in a loop over the tools object. Each tool's name, description, inputSchema, and handler are bound to the MCP server.
for (const [name, tool] of Object.entries(tools)) { server.tool( name, tool.description, tool.inputSchema.shape, async (input: Record<string, unknown>) => { try { const result = await tool.handler(input as any); return { content: [ { type: "text" as const, text: JSON.stringify(result, null, 2), }, ], }; } catch (error) { const message = error instanceof Error ? error.message : String(error); return { content: [ { type: "text" as const, text: JSON.stringify({ error: message, hint: "Check the input parameters and try again. Use list_qr_codes to verify available QR codes.", }), }, ], isError: true, }; } } ); - packages/mcp/src/api-client.ts:13-40 (helper)The apiRequest helper used by the handler to make HTTP requests to the backend API. Uses BASE_URL (default http://localhost:3100) and API_KEY from environment variables.
export async function apiRequest(path: string, options: RequestOptions = {}) { const { method = "GET", body, query } = options; let url = `${BASE_URL}${path}`; if (query) { const params = new URLSearchParams(); for (const [key, value] of Object.entries(query)) { params.set(key, String(value)); } url += `?${params.toString()}`; } const headers: Record<string, string> = { "X-API-Key": API_KEY, }; if (body) { headers["Content-Type"] = "application/json"; } const res = await fetch(url, { method, headers, body: body ? JSON.stringify(body) : undefined, }); return res.json(); }