Skip to main content
Glama

qrcode

Create QR codes from text or URLs for sharing information. This tool generates scannable images to encode data for easy access.

Instructions

Generate a QR code image ($0.001)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
textYesText or URL to encode
sizeNo

Implementation Reference

  • index.js:36-36 (registration)
    The "qrcode" tool is registered in the TOOLS array with its schema and endpoint definition.
    { name: 'qrcode', description: 'Generate a QR code image', inputSchema: { type: 'object', properties: { text: { type: 'string', description: 'Text or URL to encode' }, size: { type: 'number', default: 300 } }, required: ['text'] }, endpoint: '/qrcode', price: '$0.001' },
  • index.js:50-79 (handler)
    The `callTool` function serves as the generic handler that executes the API call for any tool, including "qrcode", based on the endpoint defined in the TOOLS array.
    async function callTool(endpoint, params) {
      const fetch = (await import('node-fetch')).default;
      const isGet = ['GET'].includes((TOOLS.find(t => t.endpoint === endpoint) || {}).method);
      
      const url = isGet 
        ? `${BASE_URL}${endpoint}?${new URLSearchParams(params)}`
        : `${BASE_URL}${endpoint}`;
      
      const res = await fetch(url, {
        method: isGet ? 'GET' : 'POST',
        headers: {
          'Content-Type': 'application/json',
          'Authorization': `Bearer ${API_KEY}`,
        },
        body: isGet ? undefined : JSON.stringify(params),
      });
      
      const text = await res.text();
      let data;
      try { data = JSON.parse(text); } catch { data = { raw: text }; }
      
      if (!res.ok) {
        if (res.status === 402) {
          throw new Error(`Insufficient credits. Add credits at https://iteratools.com. Cost: ${TOOLS.find(t=>t.endpoint===endpoint)?.price || 'see docs'}`);
        }
        throw new Error(`API error ${res.status}: ${text.substring(0, 200)}`);
      }
      
      return data;
    }

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/fredpsantos33/itera-tools-mcp'

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