Skip to main content
Glama

Generate barcode

generate_barcode
Read-onlyIdempotent

Use this when the user wants a barcode generator: a UPC or EAN-13 barcode for a product, a Code 128 barcode for a SKU or label, GS1-128 with (01) GTIN, (17) expiry and (10) lot, Code 39, an ITF-14 carton code, or a book ISBN barcode. Computes or verifies the check digit (explains a wrong one), applies GS1 quiet zones and sizes, and returns SVG and PNG download links plus calculated print dimensions. One barcode per request; Code 128 up to 80 characters, Code 39 up to 60 characters, and GS1-128 up to 48 data characters including separator FNC1 characters. Does not issue or register GS1 numbers (real UPC/EAN numbers must be licensed from GS1), does not scan images or look up products. Do not use for QR codes.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "symbology": "<symbology>",
      "data": "<data>"
    },
    "name": "generate_barcode"
  }
}

Input Schema

NameRequiredDescriptionDefault
dataYesWhat to encode, e.g. 590123412345 (the check digit is added if missing; spaces, hyphens and a leading spreadsheet apostrophe are ignored in numbers), A-10442 for Code 128 (encoded exactly, plain ASCII), (01)09501101530003(17)261231(10)LOT42 for GS1-128 (parentheses recommended; unbracketed AI strings are also read), 0-306-40615-2 for ISBN.
add_onNoOptional 2- or 5-digit add-on printed to the right of an EAN-13, UPC-A, UPC-E, EAN-8, ISBN or ISSN barcode, e.g. 51299 (book price code for 12.99 USD) or 07 (magazine issue).
show_textNoPrint the human-readable digits/text under the bars, e.g. true (default).
symbologyYesBarcode type, e.g. ean13. ean13 (EAN-13 retail, 12 or 13 digits), ean8 (7 or 8 digits), upca (UPC-A, 11 or 12 digits), upce (UPC-E: 6-8 digits, or a 12-digit UPC-A to compress), code128 (any ASCII text such as SKUs; automatic code set A/B/C switching), gs1_128 (GS1-128 with Application Identifiers), code39 (A-Z, 0-9, - . space $ / + %), itf14 (GTIN-14 carton code with bearer bars, 13 or 14 digits), isbn (book barcode from an ISBN-10 or ISBN-13), issn (magazine barcode from an ISSN).
printer_dpiNoResolution of the label printer, e.g. 203 or 300. Bar widths are snapped to whole printer dots so every bar prints exactly; the PNG is rendered at this resolution.
bar_height_mmNoBar height in millimetres, e.g. 15. Defaults to the GS1 height for retail codes, 31.75 mm for ITF-14 and GS1-128, else the larger of 12.7 mm and 15% of the symbol length.
x_dimension_mmNoWidth of the narrowest bar in millimetres, e.g. 0.33. Overrides magnification. Defaults: 0.33 (EAN/UPC, Code 128, Code 39), 0.495 (GS1-128), 0.635 (ITF-14).
fix_check_digitNoIf the number already has a check digit and it is wrong, replace it with the correct one instead of returning an error, e.g. true. Default false.
code39_check_digitNoCode 39 only: append the optional modulo-43 check character, e.g. true. Default false.
magnification_percentNoEAN/UPC/ISBN/ISSN and ITF-14 size as a percentage of the GS1 nominal size, e.g. 100 (EAN-13 = 37.29 x 25.93 mm; GS1 retail range 80-200).

Output Schema

NameRequiredDescriptionDefault
hriYes
pngYes
dataYes
kindYes
sizeYes
checkYes
labelYes
notesYes
renderYes
code128No
relatedYes
requestYes
guidanceYes
warningsYes
downloadsYes
symbologyYes
gs1_noticeYes
gs1_prefixYes
gs1_elementsNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.6/5.0
Behavior5/5

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

Annotations already establish read-only, idempotent, non-destructive behavior, but the description adds substantial operational context: check-digit calculation/explanation, GS1 quiet zones and sizing, SVG/PNG download links, print dimensions, and symbology-specific character limits. This is well beyond what the annotations alone provide.

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 front-loads the primary use case, then efficiently covers supported symbologies, generated outputs, limits, and exclusions. Despite being dense, every sentence carries relevant selection or invocation information.

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

Completeness5/5

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

For a 10-parameter tool with an output schema, the description is complete enough: it explains the tool's scope, supported formats, output artifacts, check-digit behavior, sizing behavior, limits, and exclusions. The output schema need not be restated in detail.

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

Parameters4/5

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

Schema description coverage is 100% and the schema itself richly documents all 10 parameters with examples and defaults. The description still adds useful constraints beyond the schema, such as one barcode per request and specific limits for Code 128, Code 39, and GS1-128, though it does not map every parameter to usage guidance.

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

Purpose4/5

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

The description states a specific verb and resource: generating UPC/EAN-13, Code 128, GS1-128, Code 39, ITF-14, and ISBN barcodes. It clearly scopes the tool away from QR codes, scanning, product lookup, and GS1 registration, though it does not explicitly name the sibling validate_barcode_number or route validation-only requests to it.

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

Usage Guidelines5/5

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

It gives explicit when-to-use guidance by naming supported symbologies and common use cases, and explicit when-not-to-use guidance: no QR codes, no image scanning, no product lookup, and no issuing/registering GS1 numbers. The length limits and one-barcode-per-request constraint further clarify invocation conditions.

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

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources