Generate barcode
generate_barcodeUse 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
| Name | Required | Description | Default |
|---|---|---|---|
| data | Yes | What 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_on | No | Optional 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_text | No | Print the human-readable digits/text under the bars, e.g. true (default). | |
| symbology | Yes | Barcode 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_dpi | No | Resolution 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_mm | No | Bar 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_mm | No | Width 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_digit | No | If 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_digit | No | Code 39 only: append the optional modulo-43 check character, e.g. true. Default false. | |
| magnification_percent | No | EAN/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
| Name | Required | Description | Default |
|---|---|---|---|
| hri | Yes | ||
| png | Yes | ||
| data | Yes | ||
| kind | Yes | ||
| size | Yes | ||
| check | Yes | ||
| label | Yes | ||
| notes | Yes | ||
| render | Yes | ||
| code128 | No | ||
| related | Yes | ||
| request | Yes | ||
| guidance | Yes | ||
| warnings | Yes | ||
| downloads | Yes | ||
| symbology | Yes | ||
| gs1_notice | Yes | ||
| gs1_prefix | Yes | ||
| gs1_elements | No |