Generate a barcode
generate_barcodeDraw a static barcode: EAN-13, EAN-8, UPC-A, UPC-E, ITF-14 and GS1-128 (check digits added or verified), Code 128, Code 39, Code 93 (its check characters added), Codabar, or the 2D Data Matrix, PDF417 and Aztec. Checks the value against the format's rules (characters, length, check digit) and says what it added. Options: bar and background colors, bar height, quiet zone, scale, the text under the bars and rotation. Returns a PNG and public image URLs (SVG, PNG, JPG, WebP, AVIF, BMP, PDF and EPS) for embedding or printing. No account needed.
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": {
"data": "<data>",
"format": "<format>"
},
"name": "generate_barcode"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bg | No | Background color (default ffffff) as hex, such as 000000 (in URLs leave out the # or encode it as %23) | |
| fg | No | Bar and text color (default 000000) as hex, such as 000000 (in URLs leave out the # or encode it as %23) | |
| data | Yes | The number or text to encode. Retail numbers (EAN, UPC, ITF-14, GS1 GTINs and SSCCs) can leave the check digit off and it's added; a wrong one is an error. | |
| text | No | Print the digits or text under linear barcodes (default true) | |
| scale | No | Pixels per module in raster images (1-10, default 4) | |
| format | Yes | The symbology: ean13, ean8, upca, upce, code128, code39, code93, codabar, itf14, gs1-128, datamatrix, pdf417, aztec (EAN-13 and UPC-A for retail products, ITF-14 for cartons, GS1-128 for logistics labels, Code 128 for your own labels, Data Matrix, PDF417 and Aztec for 2D) | |
| height | No | Bar height of linear barcodes in millimetres at the vector size (5-60; default depends on the format) | |
| rotate | No | Clockwise rotation in degrees: 0, 90, 180 or 270 (default 0) | |
| quietZone | No | Blank margin in modules: left and right of linear barcodes (up to 20), all round 2D codes (up to 10). Defaults to the format's minimum. | |
| include_svg | No | Also return the SVG markup as text, e.g. to save an .svg file |