Skip to main content
Glama
benswel

QR for Agent

create_phone_qr

Generate a QR code that dials a phone number when scanned. Customize colors, dot styles, logo, and frame with optional call-to-action text. Output SVG or PNG.

Instructions

Create a QR code that initiates a phone call when scanned. The phone number is encoded directly in the QR code.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
phone_numberYesPhone number to call.
labelNoLabel for this QR code.
formatNoImage format.svg
foreground_colorNoHex color for dots.
background_colorNoHex color for background.
dot_styleNoDot shape.
corner_styleNoCorner shape.
logo_urlNoLogo URL or data URI.
frame_styleNoFrame style around QR.
frame_textNoCTA text on frame (max 30 chars).
frame_colorNoFrame background color.
frame_text_colorNoFrame text color.

Implementation Reference

  • Handler function for create_phone_qr that extracts phone_number and calls the API route /api/qr with type 'phone' and phone_data.
    handler: async (input: Record<string, unknown>) => {
      const { phone_number, ...rest } = input;
      return apiRequest("/api/qr", {
        method: "POST",
        body: { type: "phone", phone_data: { phone_number }, ...rest },
      });
    },
  • Input schema for create_phone_qr using Zod. Required: phone_number. Optional: label, format, foreground_color, background_color, dot_style, corner_style, logo_url, frame_style, frame_text, frame_color, frame_text_color.
    inputSchema: z.object({
      phone_number: z.string().describe("Phone number to call."),
      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."),
    }),
  • Registration loop that registers all tools (including create_phone_qr) with the MCP server 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,
            };
          }
        }
      );
  • The apiRequest helper function used by create_phone_qr's handler to make HTTP POST requests to the backend API.
    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();
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description must fully disclose behavior. It mentions the phone call initiation but fails to describe the output format, any restrictions (e.g., desktop behavior), or what happens with the label. This lack of detail limits the agent's understanding of the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is very concise with two sentences that convey the core purpose. It is front-loaded but omits important behavioral details; however, for a simple tool, it efficiently communicates the main function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (12 parameters for customization) and lack of output schema, the description is somewhat incomplete. It doesn't mention customization options or return value, though the schema covers parameters. Adequate for a focused tool but could be more helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema has 100% description coverage, providing basic parameter meanings. The description adds no additional semantics beyond restating that the phone number is encoded. Per guidelines, baseline 3 applies since schema coverage is high.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool creates a QR code that initiates a phone call, distinguishing it from sibling tools for other QR types (email, SMS, etc.). The verb 'create' and resource 'phone QR' are specific and unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for phone call QR codes but does not provide explicit guidance on when to use this tool versus alternatives (e.g., using create_qr_code for general purposes or other specialized tools). No exclusions or context about platform limitations are given.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/benswel/qr-agent-core'

If you have feedback or need assistance with the MCP directory API, please join our Discord server