Skip to main content
Glama

Generate QR Code for Terminal

generate-qrcode-terminal

Generate QR codes from text or URLs and display them directly in your terminal. This tool converts input data into terminal-formatted QR codes for quick scanning and sharing.

Instructions

Generate a QR code from text or URL and display it in terminal format

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
optionsNoTerminal display options
textYesThe text or URL to encode in the QR code

Implementation Reference

  • Handler function that generates QR code in terminal format using QRCode.toString(type: 'terminal') and returns it as text content.
    async ({ text, options = {} }) => {
      try {
        const terminalQR = await QRCode.toString(text, { 
          type: 'terminal',
          small: options.small || false
        });
        
        return {
          content: [
            {
              type: "text",
              text: `QR code for: "${text}"\n\n${terminalQR}`
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error generating terminal QR code: ${error instanceof Error ? error.message : 'Unknown error'}`
            }
          ],
          isError: true
        };
      }
    }
  • Zod input schema for the tool, requiring text and optional options with small boolean flag.
    inputSchema: {
      text: z.string().min(1).describe("The text or URL to encode in the QR code"),
      options: z.object({
        small: z.boolean().optional().default(false).describe("Use small format for terminal display")
      }).optional().describe("Terminal display options")
    }
  • src/index.ts:139-178 (registration)
    Registration of the 'generate-qrcode-terminal' tool using server.registerTool, including title, description, schema, and handler reference.
    server.registerTool(
      "generate-qrcode-terminal",
      {
        title: "Generate QR Code for Terminal",
        description: "Generate a QR code from text or URL and display it in terminal format",
        inputSchema: {
          text: z.string().min(1).describe("The text or URL to encode in the QR code"),
          options: z.object({
            small: z.boolean().optional().default(false).describe("Use small format for terminal display")
          }).optional().describe("Terminal display options")
        }
      },
      async ({ text, options = {} }) => {
        try {
          const terminalQR = await QRCode.toString(text, { 
            type: 'terminal',
            small: options.small || false
          });
          
          return {
            content: [
              {
                type: "text",
                text: `QR code for: "${text}"\n\n${terminalQR}`
              }
            ]
          };
        } catch (error) {
          return {
            content: [
              {
                type: "text",
                text: `Error generating terminal QR code: ${error instanceof Error ? error.message : 'Unknown error'}`
              }
            ],
            isError: true
          };
        }
      }
    );
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions the tool generates and displays a QR code in terminal format, but lacks details on behavioral traits such as error handling, performance characteristics (e.g., speed), or any limitations (e.g., maximum text length). This is a significant gap for a tool with no annotation coverage.

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

Conciseness5/5

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

The description is a single, efficient sentence that is front-loaded with the core purpose. Every word earns its place, with no redundant or unnecessary information, making it highly concise and well-structured.

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

Completeness2/5

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

Given the complexity (2 parameters, nested objects) and lack of annotations and output schema, the description is incomplete. It does not explain what the output looks like (e.g., ASCII art format), potential errors, or usage constraints, leaving gaps for effective tool invocation by an AI agent.

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?

Schema description coverage is 100%, so the schema already documents both parameters ('text' and 'options' with 'small' boolean). The description adds minimal value by implying the 'text' parameter can be a URL, but does not provide additional syntax, format details, or context beyond what the schema specifies.

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 action ('Generate a QR code'), the resource ('from text or URL'), and the specific output format ('display it in terminal format'). It distinguishes from sibling tools by specifying the terminal output format, unlike batch, data URL, or SVG generation tools.

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 context by specifying 'terminal format,' which suggests this tool is for terminal-based applications. However, it does not explicitly state when to use this tool versus the sibling alternatives (e.g., for CLI vs. web use cases) or any prerequisites, leaving some ambiguity.

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/antoBrugnot/qrcode-mcp'

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