gray_code
Convert binary values to Gray code or back, and generate n-bit Gray code sequences by specifying bit width and optional value.
Instructions
Convert between binary and Gray code, or generate n-bit Gray code sequences.
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": {
"n": "<n>"
},
"name": "gray_code"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| n | Yes | Bit width (1-20) | |
| value | No | Optional value to convert (omit for full sequence) | |
| to_gray | No | If true convert binary to Gray; if false convert Gray to binary (default true) |