create_social_qr
Create a customizable QR code that links to multiple social media profiles. Scanning the short URL returns a JSON object with all platform links. Supports customization options like colors, dot style, and frame text.
Instructions
Create a QR code that links to social media profiles. When scanned via the short URL, returns a JSON object with all platform links. Provide at least one platform link.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| No | Facebook profile/page URL. | ||
| No | Instagram profile URL. | ||
| No | Twitter/X profile URL. | ||
| No | LinkedIn profile URL. | ||
| youtube | No | YouTube channel URL. | |
| tiktok | No | TikTok profile URL. | |
| github | No | GitHub profile URL. | |
| website | No | Personal/company website URL. | |
| 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:557-588 (handler)The 'create_social_qr' tool definition including its input schema and handler function. The handler extracts social media links (facebook, instagram, twitter, linkedin, youtube, tiktok, github, website) along with optional styling parameters and sends a POST request to /api/qr with type 'social'.
create_social_qr: { description: "Create a QR code that links to social media profiles. When scanned via the short URL, returns a JSON object with all platform links. Provide at least one platform link.", inputSchema: z.object({ facebook: z.string().optional().describe("Facebook profile/page URL."), instagram: z.string().optional().describe("Instagram profile URL."), twitter: z.string().optional().describe("Twitter/X profile URL."), linkedin: z.string().optional().describe("LinkedIn profile URL."), youtube: z.string().optional().describe("YouTube channel URL."), tiktok: z.string().optional().describe("TikTok profile URL."), github: z.string().optional().describe("GitHub profile URL."), website: z.string().optional().describe("Personal/company website URL."), 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."), }), handler: async (input: Record<string, unknown>) => { const { facebook, instagram, twitter, linkedin, youtube, tiktok, github, website, ...rest } = input; return apiRequest("/api/qr", { method: "POST", body: { type: "social", social_data: { facebook, instagram, twitter, linkedin, youtube, tiktok, github, website }, ...rest }, }); }, }, - packages/mcp/src/tools.ts:560-580 (schema)Input schema for create_social_qr tool using Zod. Defines optional social media links (facebook, instagram, twitter, linkedin, youtube, tiktok, github, website), a label, format (svg/png), and styling options (colors, dot/corner styles, logo, frame settings).
inputSchema: z.object({ facebook: z.string().optional().describe("Facebook profile/page URL."), instagram: z.string().optional().describe("Instagram profile URL."), twitter: z.string().optional().describe("Twitter/X profile URL."), linkedin: z.string().optional().describe("LinkedIn profile URL."), youtube: z.string().optional().describe("YouTube channel URL."), tiktok: z.string().optional().describe("TikTok profile URL."), github: z.string().optional().describe("GitHub profile URL."), website: z.string().optional().describe("Personal/company website URL."), 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-54 (registration)Registration loop in the MCP server. Iterates over all tools (including create_social_qr) and registers each with the McpServer via server.tool(), wiring up the description, inputSchema, and handler.
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 create_social_qr handler to make HTTP POST requests to the backend API with X-API-Key authentication.
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(); }