create_location_qr
Generate a QR code that opens a specific map location when scanned. Encodes geographic coordinates for map apps to parse, enabling direct navigation.
Instructions
Create a QR code that opens a map location when scanned. Encodes geographic coordinates that map apps can parse.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| latitude | Yes | Geographic latitude (-90 to 90). | |
| longitude | Yes | Geographic longitude (-180 to 180). | |
| label | No | Human-readable place name (shown on map). | |
| qr_label | No | Label for this QR code (internal). | |
| 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:548-554 (handler)The handler function for the create_location_qr tool. It extracts latitude, longitude, label, and qr_label from input, then sends a POST request to /api/qr with type 'location' and location_data containing the geographic coordinates.
handler: async (input: Record<string, unknown>) => { const { latitude, longitude, label, qr_label, ...rest } = input; return apiRequest("/api/qr", { method: "POST", body: { type: "location", location_data: { latitude, longitude, label }, label: qr_label, ...rest }, }); }, - packages/mcp/src/tools.ts:532-547 (schema)The input schema for create_location_qr, using Zod validation. Mandatory fields: latitude and longitude. Optional fields include label, qr_label, format (defaults to 'svg'), foreground_color, background_color, dot_style, corner_style, logo_url, frame_style, frame_text, frame_color, and frame_text_color with regex validation for hex colors.
inputSchema: z.object({ latitude: z.number().min(-90).max(90).describe("Geographic latitude (-90 to 90)."), longitude: z.number().min(-180).max(180).describe("Geographic longitude (-180 to 180)."), label: z.string().optional().describe("Human-readable place name (shown on map)."), qr_label: z.string().optional().describe("Label for this QR code (internal)."), 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:529-555 (registration)The tool registration entry in the tools object export from tools.ts. The key 'create_location_qr' is the tool name used by the MCP server registration loop in server.ts.
create_location_qr: { description: "Create a QR code that opens a map location when scanned. Encodes geographic coordinates that map apps can parse.", inputSchema: z.object({ latitude: z.number().min(-90).max(90).describe("Geographic latitude (-90 to 90)."), longitude: z.number().min(-180).max(180).describe("Geographic longitude (-180 to 180)."), label: z.string().optional().describe("Human-readable place name (shown on map)."), qr_label: z.string().optional().describe("Label for this QR code (internal)."), 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 { latitude, longitude, label, qr_label, ...rest } = input; return apiRequest("/api/qr", { method: "POST", body: { type: "location", location_data: { latitude, longitude, label }, label: qr_label, ...rest }, }); }, }, - packages/mcp/src/api-client.ts:13-40 (helper)The apiRequest helper function used by the handler to make HTTP POST requests to /api/qr. It adds X-API-Key header, serializes the body as JSON, and returns the parsed JSON response.
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(); }