create_sms_qr
Create a QR code that opens a pre-filled SMS message when scanned. Set the phone number and optional message text. Customize with colors, dot style, frame, logo, and label.
Instructions
Create a QR code that opens a pre-filled SMS message when scanned. Set the phone number and optional message text.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| phone_number | Yes | Phone number to send SMS to. | |
| message | No | Pre-filled SMS message text. | |
| 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:423-437 (schema)Input schema for create_sms_qr tool, defining all parameters for the SMS QR code.
inputSchema: z.object({ phone_number: z.string().describe("Phone number to send SMS to."), message: z.string().optional().describe("Pre-filled SMS message text."), 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/tools.ts:438-444 (handler)Handler function that sends a POST request to /api/qr with sms type and sms_data.
handler: async (input: Record<string, unknown>) => { const { phone_number, message, ...rest } = input; return apiRequest("/api/qr", { method: "POST", body: { type: "sms", sms_data: { phone_number, message }, ...rest }, }); }, - packages/mcp/src/tools.ts:420-445 (registration)Tool definition registration for create_sms_qr inside the tools object export.
create_sms_qr: { description: "Create a QR code that opens a pre-filled SMS message when scanned. Set the phone number and optional message text.", inputSchema: z.object({ phone_number: z.string().describe("Phone number to send SMS to."), message: z.string().optional().describe("Pre-filled SMS message text."), 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 { phone_number, message, ...rest } = input; return apiRequest("/api/qr", { method: "POST", body: { type: "sms", sms_data: { phone_number, message }, ...rest }, }); }, }, - packages/mcp/src/server.ts:21-54 (registration)Dynamic registration of all tools (including create_sms_qr) onto the MCP server instance via server.tool().
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)Helper HTTP client used by the handler to make the POST request to the backend /api/qr endpoint.
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(); }