Skip to main content
Glama

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 }; } } );

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