Endianness / Byte Swap Converter
embedcalc_endian_swapConvert hex byte sequences into big, little, mid-little (BADC), and mid-big (CDAB) endian formats. Useful for debugging Modbus register order and mixed-endian protocols.
Instructions
Show a hex byte sequence in all endianness orderings: big (ABCD), little (DCBA), mid-little/byte-swapped halfwords (BADC), mid-big/halfword-swapped (CDAB).
Args: hex (string) — e.g. '0x12345678' or 'DEADBEEF'; odd nibble counts get a leading zero. Returns (structured): { big, little, mid_little_badc, mid_big_cdab (null when < 4 bytes), bytes }. Example: 12345678 -> little 78563412, BADC 34127856, CDAB 56781234. Useful for Modbus register order and mixed-endian protocol debugging.
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": {
"hex": "<hex>"
},
"name": "embedcalc_endian_swap"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| hex | Yes | Hex byte sequence (with or without 0x) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| big | Yes | ||
| bytes | Yes | Original bytes, big-endian order | |
| little | Yes | ||
| mid_big_cdab | Yes | ||
| mid_little_badc | Yes |