stackchan-mcp

v0.20.0
stackchan-mcp Checked 8 hours ago Published 1 month ago

Two-faced MCP gateway for StackChan (xiaozhi-esp32): bridges stdio MCP clients to the ESP32 over WebSocket + HTTP.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

get_status

Get the gateway's connection status: whether ESP32 is connected, device info, and list of available device tools.

list_devices

List ESP32 devices currently connected to the gateway. Returns each device_id (from the Device-Id header), connection time, and which one is the default routing target. Use set_default_device to change the default; pass optional device_id on other tools to target a specific unit.

set_default_device

Set the default ESP32 destination used when tools omit device_id. Until set, the default is the first device that connected. Returns an error if the device_id is not connected.

ParameterTypeDescription
device_id *stringDevice-Id of a currently connected ESP32 (see list_devices).

get_device_info

Get real-time device information from ESP32: battery level, speaker volume, screen brightness, network status, etc.

ParameterTypeDescription
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

take_photo

Take a photo with the robot's camera and ask a question about it. The device captures an image and returns an AI-generated description.

ParameterTypeDescription
question *stringQuestion to ask about the photo (e.g. 'What do you see?')
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

set_volume

Set the speaker volume (0-100).

ParameterTypeDescription
volume *integerVolume level (0-100)
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

set_brightness

Set the screen brightness (0-100).

ParameterTypeDescription
brightness *integerBrightness level (0-100)
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

set_off_timeout

Set the idle screen-off timeout in seconds (0-86400). Default: 300; 0 disables screen-off. Saved in NVS and preserved across reboots. Requires firmware 1.17.0 or later.

ParameterTypeDescription
seconds *integer
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

get_off_timeout

Get the persistent idle screen-off timeout in seconds. 0 means disabled; default: 300. Requires firmware 1.17.0 or later.

ParameterTypeDescription
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

set_external_power_auto_off

Persist and immediately apply whether the device also dims (60 s idle) and powers off (300 s idle) while on external power. Off by default: on external power it never does this automatically; on battery it always does. Requires firmware-v1.18.0 or later.

ParameterTypeDescription
enabled *booleanTrue to dim and power off on idle even on external power; false to stay on while powered.
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

get_external_power_auto_off

Get the persistent external_power_auto_off setting, whether the battery is discharging, and whether the idle dim/power-off timer is running. Requires firmware-v1.18.0 or later.

ParameterTypeDescription
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

set_charge_protection

Persist and immediately apply battery charge protection. Protection is opt-in by default and uses the persisted ON/OFF thresholds. Disable it temporarily before going out to allow the AXP2101 charger to reach its own full-charge termination; enable it again to resume protection.

ParameterTypeDescription
enabled *booleanTrue for persistent threshold protection; false to allow charging to the PMIC's full-charge termination.
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

get_charge_protection

Get the persistent and effective charge_protection setting, thresholds, and current charger-enable state. The setting is opt-in when it has never been saved.

ParameterTypeDescription
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

set_charge_thresholds

Persist and immediately apply charge-protection thresholds. on_below must be lower than off_above.

ParameterTypeDescription
off_above *integerDisable charging at or above this percentage.
on_below *integerEnable charging at or below this percentage.
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

move_head

Move the robot's head to safe, recommended angles. yaw: horizontal (-90 to 90), pitch: vertical (5 to 85, the M5Stack-recommended operating range). Out-of-range requests are rejected at this MCP layer; for advanced callers that need the firmware hard clamp (pitch 0..88), use the firmware-side `set_head_angles` device tool, which exposes a permissive schema and the authoritative two-tier guard described in the README.

ParameterTypeDescription
pitch *integerVertical angle in degrees (5 to 85, M5Stack-recommended operating range). For the wider firmware hard clamp (0..88), use the `set_head_angles` device tool instead.
yaw *integerHorizontal angle in degrees (-90 to 90)
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.
speedspeed (optional): How fast to move the head. - "low" — slow, deliberate, ~30°/s. Good for curious tilts or gentle look-toward. - "mid" — default natural turn, ~120°/s. Use for conversation…

stackchan_follow_pose_stream

Subscribes to an arbitrary upstream WebSocket pose-stream using action=start, stop, or status. Sensor yaw is forwarded 1:1 and clamped to +/-90 degrees; sensor pitch is shifted by pitch_center_deg (default 45) so sensor neutral maps to head neutral, then clamped to 5..85 degrees. Inputs beyond the head's mechanical range saturate at the limit without scaling. The subscriber applies moving-average smoothing, a downsample cap, and an angular-velocity clamp. Only one subscription is active at a time; a new start cancels the previous task. Connections reconnect with exponential backoff and are sto…

ParameterTypeDescription
actionstringLifecycle control. Default is 'start'.
downsample_hznumberCap servo command rate. Recent frames are smoothed; commands are issued at most this frequently. Capped at 20 to match the SCS0009 servo's observed sustained WritePos rate; higher continuous rates can…
flip_pitchinteger
flip_yawintegerMultiplier applied to sensor yaw before clamping. Use -1 if the upstream IMU yaw convention is reversed.
frame_filterstringOptional: ignore frames whose top-level 'frame' field does not equal this string (e.g. 'calibrated').
max_step_degnumberPer-tick angular delta limit. With downsample_hz=20 and max_step_deg=12 the effective angular velocity is bounded by 240 dps.
pitch_center_degintegerServo pitch (deg) treated as the sensor-pitch=0 anchor. Defaults to the head's neutral pose.
smoothing_windowintegerMoving-average window size for incoming sensor frames. 1 = passthrough (disable gateway-side smoothing). Default 5.
source_filterstringOptional: ignore frames whose top-level 'source' field does not equal this string.
speed_dpsintegerspeed_dps forwarded to set_head_angles per command. Capped at the SCS0009 datasheet working speed (240).
urlstringWebSocket URL (ws:// or wss://) to subscribe to. Required when action=start.

stackchan_follow_led_stream

Subscribes to an arbitrary upstream WebSocket LED-frame stream using action=start, stop, or status, then forwards validated color frames to either the 12-LED base ring or a Port B or Port C WS2812 strip. Frames contain ts, kind, and colors; kind='continuous' is capped by max_fps while kind='event' bypasses the rate gate for beat flashes. Only one LED subscription is active at a time; a new start cancels the previous task. Connections reconnect with exponential backoff and are stopped cleanly when the gateway shuts down.

ParameterTypeDescription
actionstringLifecycle control. Default is 'start'.
color_orderstringWS2812 strip color order for target=port_b or target=port_c. Use rgb for RGB-wired LEDs; the gateway swaps R/G before forwarding to the firmware. base_ring only supports grb.
frame_filterstringOptional: ignore frames whose top-level 'frame' field does not equal this string.
led_countintegerRequired for target=port_b or target=port_c. For base_ring, omit or pass 12.
max_fpsnumberMaximum rate for kind='continuous' frames. kind='event' frames bypass this gate. Practical guidance from on-device measurement: wire round-trip is ~40-50 ms per frame on a typical home WLAN, so ~20 fp…
reconnect_initial_backoff_snumberInitial reconnect backoff in seconds.
reconnect_max_backoff_snumberMaximum reconnect backoff in seconds.
source_filterstringOptional: ignore frames whose top-level 'source' field does not equal this string.
targetstringLED target. base_ring uses the built-in 12 LEDs; port_b uses a WS2812 strip on Port B; port_c uses a WS2812 strip on Port C.
urlstringWebSocket URL (ws:// or wss://) to subscribe to. Required when action=start.

get_head_angles

Get the robot's current head angles: yaw and pitch in degrees.

ParameterTypeDescription
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

gpio_test

Test GPIO6 pin by toggling HIGH/LOW 5 times. Check if servo reacts.

ParameterTypeDescription
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

uart_diag

Send raw servo bytes via UART and report write result.

ParameterTypeDescription
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

check_vm_en

Diagnostic: read PY32 REG_GPIO_O_L and report whether VM EN (pin 0 = servo power) is currently HIGH. Returns {io_expander_present, i2c_read_ok, raw, vm_en_high}.

ParameterTypeDescription
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

gateway_config_get

Read the device's NVS-backed WebSocket gateway connection settings. Returns url, fallback_url, token_set (never the token value), forced_keys, force_mode, discovery_enabled, and connected_url when the current WebSocket candidate is connected. Empty url enables mDNS discovery when firmware discovery support is compiled in and the primary URL is not forced; fallback_url is tried after discovery and is suitable for an out-of-LAN relay. forced_keys lists any of url, fallback_url, and token that a non-empty Kconfig default overrides at connect time; force_mode=true means at least one key is forced.

ParameterTypeDescription
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

gateway_config_set

Update the device's NVS-backed WebSocket gateway connection settings. Optional string fields: url, fallback_url, token; at least one must be provided. Passing an empty string clears that key. Leave url empty to enable mDNS discovery on the next reconnect when firmware discovery support is compiled in and the primary URL is not forced; fallback_url is tried after discovery and is suitable for an out-of-LAN relay. The change is persisted but does not disconnect, reconnect, or reboot the device; it takes effect on the next reconnect. forced_keys lists any of url, fallback_url, and token that a no…

ParameterTypeDescription
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.
fallback_urlstringFallback NVS WebSocket URL. Tried after discovery and suitable for an out-of-LAN relay. Empty string clears websocket.fallback_url.
tokenstringBearer token stored in NVS and sent to the gateway. Empty string clears the token. The token value is never returned by gateway_config_get.
urlstringPrimary NVS WebSocket URL. Empty string clears websocket.url, which enables mDNS discovery on the next reconnect when discovery is compiled in and the primary URL is not forced.

get_touch_sensor_enabled

Read the device's NVS-backed head-touch sensor enable flag. When disabled, the firmware stops both the local motion response and the MCP stackchan/event emission; the setting persists across reboot.

ParameterTypeDescription
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

set_touch_sensor_enabled

Enable or disable the device's head-touch sensor at runtime. The NVS-backed setting persists across reboot. Disabling stops both the firmware local motion response and the MCP stackchan/event emission.

ParameterTypeDescription
enabled *booleanTrue to enable tap/stroke detection; false to disable local reactions and event emission.
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

set_avatar

Switch the avatar face shown on the LCD. Choose one of the supported faces; this is the robot's actual visible expression, not just a label. Pass 'off' to hide the avatar and disable blink, exposing the underlying xiaozhi-esp32 screens (WiFi config UI, OTA, settings); any other face brings the avatar back and restores blink.

ParameterTypeDescription
face *stringOne of: idle, happy, thinking, sad, surprised, embarrassed, off.
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

set_mouth

Set the avatar mouth shape for lip-sync. The shape is held until the next set_avatar / set_mouth call, or until an autonomous blink restores the resting face. Calling this while a set_mouth_sequence is in flight interrupts the sequence.

ParameterTypeDescription
mouth *stringOne of: closed, half, open, e, u.
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

set_mouth_sequence

Queue a lip-sync sequence and play it on the device. Each step holds 'shape' for 'duration_ms' before advancing. The firmware walks the queue locally so there is no per-step network RTT (use this instead of issuing many set_mouth calls back-to-back from a TTS loop). Returns immediately with the queued step count and estimated total duration. Calling set_mouth, set_avatar, or this tool again interrupts the in-flight sequence and replaces it. Autonomous blink is paused while a sequence is playing and resumed when it ends. The final shape is held until the next set_mouth / set_avatar call, or unt…

ParameterTypeDescription
steps *arrayOrdered list of mouth shapes with hold durations (1..256 steps).
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

set_servo_torque

Enable or disable SCS0009 servo torque on the yaw / pitch axes independently. Disabling torque stops motor current on that axis; the head holds via static friction (no motion is commanded). On disable, the firmware also cancels any in-flight MotionDriver interpolation and marks the axis position unknown so a subsequent same-target set_head_angles is re-dispatched rather than no-op-optimized. Re-enabling torque does NOT trigger a move; the next set_head_angles or wobble call will. Diagnostic / power-management primitive used to observe physical head behavior under torque-off (Issue #163; auto r…

ParameterTypeDescription
pitch_enabled *booleanTrue to enable pitch axis torque, false to disable.
yaw_enabled *booleanTrue to enable yaw axis torque, false to disable.
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

set_auto_torque_release

Enable or disable firmware-side automatic SCS0009 torque release after motion idle timeout. timeout_ms is clamped by the firmware to 500..600000 ms. Disabling this setting does not re-enable torque if it is already released; the next set_head_angles, wobble, or explicit set_servo_torque(true, true) call re-engages torque.

ParameterTypeDescription
enabled *booleanTrue to enable idle auto-release, false to disable it.
timeout_ms *integerIdle timeout in milliseconds. Values outside 500..600000 are clamped by the firmware handler.
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

get_touch_state

Read the head-touch (Si12T) sensor state and the most recent gesture event (tap/stroke/idle). Returns per-zone booleans, the raw output byte, and how long ago the last event fired.

ParameterTypeDescription
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

set_led

Set a single RGB LED on the StackChan base. There are 12 LEDs arranged in two rows of 6 (index 0..11). Updates immediately.

ParameterTypeDescription
b *integerBlue 0..255
g *integerGreen 0..255
index *integerLED index (0..11)
r *integerRed 0..255
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

set_all_leds

Set all 12 RGB LEDs on the StackChan base to the same color. Updates immediately.

ParameterTypeDescription
b *integerBlue 0..255
g *integerGreen 0..255
r *integerRed 0..255
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

set_leds

Set multiple RGB LEDs in one shot. 'colors' is an array of [r,g,b] triples starting at index 0 (e.g. [[255,0,0],[0,255,0]]). Up to 12 entries; extras are ignored, missing entries keep their previous color. Use this for animations / patterns to avoid 12x I2C round-trips.

ParameterTypeDescription
colors *arrayArray of [r,g,b] triples, each 0..255
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

clear_leds

Turn off all 12 RGB LEDs on the StackChan base.

ParameterTypeDescription
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

port_b_ws2812_init

Initialize a WS2812-compatible LED strip connected to Port B (CoreS3 HY2.0-4P digital OUTPUT, GPIO 9). led_count is the number of LEDs in the strip (1..256). Repeated calls with the same led_count are no-ops; a different led_count rebuilds the strip handle. Port B outputs 3.3 V CMOS data on GPIO 9; older strict 5 V WS2812 variants may require a level shifter.

ParameterTypeDescription
led_count *integerNumber of LEDs in the strip (1..256).
color_orderstringLogical LED color order. Use grb for standard WS2812/NeoPixel strips, or rgb for RGB-wired LEDs; the gateway swaps R/G before forwarding colors to the firmware.
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

port_b_ws2812_set_pixel

Set one LED in the Port B WS2812 strip buffer. Call port_b_ws2812_init first. index is 0..255, with the effective range bounded by led_count. r, g, and b are 0..255. By default the color is buffered only; pass refresh=true to latch it immediately, or call port_b_ws2812_refresh after several buffered updates. Port B outputs 3.3 V CMOS data on GPIO 9; older strict 5 V WS2812 variants may require a level shifter.

ParameterTypeDescription
b *integerBlue 0..255.
g *integerGreen 0..255.
index *integerLED index (0..255).
r *integerRed 0..255.
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.
refreshbooleanTrue to latch the update immediately.

port_b_ws2812_set_strip

Set multiple LEDs in the Port B WS2812 strip and refresh immediately. Call port_b_ws2812_init first. colors is an array of [r,g,b] integer triples applied from LED index 0; up to led_count entries are written, extras are ignored, and missing trailing entries preserve the previous buffer. The firmware validates the full payload before writing. Port B outputs 3.3 V CMOS data on GPIO 9; older strict 5 V WS2812 variants may require a level shifter.

ParameterTypeDescription
colors *arrayArray of [r,g,b] triples, each integer 0..255.
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

port_b_ws2812_refresh

Refresh the Port B WS2812 strip, latching the current buffered colors out on CoreS3 HY2.0-4P digital OUTPUT GPIO 9. Call port_b_ws2812_init first. Use this after one or more port_b_ws2812_set_pixel calls made with refresh=false. Port B outputs 3.3 V CMOS data; older strict 5 V WS2812 variants may require a level shifter.

ParameterTypeDescription
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

port_b_ws2812_clear

Turn off every LED in the Port B WS2812 strip and refresh immediately on CoreS3 HY2.0-4P digital OUTPUT GPIO 9. Call port_b_ws2812_init first. This clears the driver's per-pixel buffer. Port B outputs 3.3 V CMOS data; older strict 5 V WS2812 variants may require a level shifter.

ParameterTypeDescription
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

port_c_ws2812_init

Initialize a WS2812-compatible LED strip connected to Port C (CoreS3 HY2.0-4P digital OUTPUT, GPIO 17). led_count is the number of LEDs in the strip (1..256). Repeated calls with the same led_count are no-ops; a different led_count rebuilds the strip handle. Port C outputs 3.3 V CMOS data on GPIO 17; older strict 5 V WS2812 variants may require a level shifter.

ParameterTypeDescription
led_count *integerNumber of LEDs in the strip (1..256).
color_orderstringLogical LED color order. Use grb for standard WS2812/NeoPixel strips, or rgb for RGB-wired LEDs; the gateway swaps R/G before forwarding colors to the firmware.
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

port_c_ws2812_set_pixel

Set one LED in the Port C WS2812 strip buffer. Call port_c_ws2812_init first. index is 0..255, with the effective range bounded by led_count. r, g, and b are 0..255. By default the color is buffered only; pass refresh=true to latch it immediately, or call port_c_ws2812_refresh after several buffered updates. Port C outputs 3.3 V CMOS data on GPIO 17; older strict 5 V WS2812 variants may require a level shifter.

ParameterTypeDescription
b *integerBlue 0..255.
g *integerGreen 0..255.
index *integerLED index (0..255).
r *integerRed 0..255.
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.
refreshbooleanTrue to latch the update immediately.

port_c_ws2812_set_strip

Set multiple LEDs in the Port C WS2812 strip and refresh immediately. Call port_c_ws2812_init first. colors is an array of [r,g,b] integer triples applied from LED index 0; up to led_count entries are written, extras are ignored, and missing trailing entries preserve the previous buffer. The firmware validates the full payload before writing. Port C outputs 3.3 V CMOS data on GPIO 17; older strict 5 V WS2812 variants may require a level shifter.

ParameterTypeDescription
colors *arrayArray of [r,g,b] triples, each integer 0..255.
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

port_c_ws2812_refresh

Refresh the Port C WS2812 strip, latching the current buffered colors out on CoreS3 HY2.0-4P digital OUTPUT GPIO 17. Call port_c_ws2812_init first. Use this after one or more port_c_ws2812_set_pixel calls made with refresh=false. Port C outputs 3.3 V CMOS data; older strict 5 V WS2812 variants may require a level shifter.

ParameterTypeDescription
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

port_c_ws2812_clear

Turn off every LED in the Port C WS2812 strip and refresh immediately on CoreS3 HY2.0-4P digital OUTPUT GPIO 17. Call port_c_ws2812_init first. This clears the driver's per-pixel buffer. Port C outputs 3.3 V CMOS data; older strict 5 V WS2812 variants may require a level shifter.

ParameterTypeDescription
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

say

Speak the given text on the device speaker via gateway-side TTS. The gateway synthesises audio, encodes it to Opus, and pushes frames over the existing WebSocket; the device firmware does not change. Engine is selectable via 'voice' (default 'voicevox'). If the text contains a supported expression emoji, say first switches the avatar face in the same call: happy (😊 😄 😀 😁 🙂 😆 🥰 😍 😋 🤗), sad (😢 😭 😞 😔 ☹️ 🙁 😿), surprised (😲 😮 😯 😱 🤯), embarrassed (😳 😅 🫣), thinking (🤔 🧐 💭). The first mapped emoji wins; unmapped emoji…

ParameterTypeDescription
text *stringText to speak. Must be non-empty.
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.
reference_audiostringPath to a reference audio file used by voice-cloning engines (e.g. Irodori). Ignored by engines that do not support it.
speaker_idintegerEngine-specific numeric speaker identifier (e.g. a VOICEVOX speaker ID).
speaker_namestringEngine-specific string speaker/voice identifier (e.g. an Edge TTS voice name such as 'en-US-AriaNeural'). Distinct from 'voice', which selects the engine itself (e.g. 'edge-tts'); use speaker_name for…
voicestringEngine identifier (e.g. 'voicevox', 'irodori', 'elevenlabs'). Default 'voicevox'.

listen

Capture a short utterance from the device microphone and transcribe it via a gateway-side STT engine (Phase 4, Issue #91). The gateway sends a 'listen' notification over the existing WebSocket to put the device firmware into listening mode, buffers the Opus frames the device streams up during the capture window, then decodes and transcribes them once the window closes. Requires a minimal firmware change to handle the inbound 'listen' wire type (paired with this gateway release). Engine is selectable via 'engine' (default 'faster-whisper', local). Optional 'motion' feedback can switch the avata…

ParameterTypeDescription
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.
duration_msintegerCapture window in milliseconds. Clamped to [100, 30000].
enginestringEngine identifier (e.g. 'faster-whisper', 'openai-whisper'). Default 'faster-whisper'.
languagestringISO 639-1 language code (e.g. 'ja', 'en'). Omit this field to use STACKCHAN_LISTEN_LANGUAGE, or 'ja' when that env is unset. Do not rely on a schema default — many clients send defaults even when th…
look_up_pitchnumberPitch angle for motion='look-up'. Must be between 5 and 85 degrees.
modelstringEngine-specific model identifier (e.g. 'base' / 'small' / 'medium' for faster-whisper, 'whisper-1' for OpenAI). Engines fall back to their default when omitted.
motionstringOptional visible feedback during capture. 'none' preserves the previous behaviour. 'face-only' shows the thinking avatar during capture and restores idle at the end. 'look-up' preserves yaw, tilts pit…

beat_mode_start

Start gateway-side beat mode. The gateway reuses the existing listen wire path to capture ambient device audio, decodes it to 16 kHz mono PCM, estimates beat/BPM locally, and drives a free-running beat-synced head sway plus base ring LED flash. While active, listen() calls fail fast because beat mode owns the microphone capture slot. say() is allowed to interrupt; beat mode re-sends listen.start after speech or reconnect when audio frames stop arriving. Requires the Opus decoder from the STT extra.

ParameterTypeDescription
colorarrayOptional base-ring flash color as [r, g, b]. Defaults to cyan-blue.
duration_secintegerOptional auto-stop duration in seconds. Omit to keep beat mode running until stopped.
motion_intensitynumberHead sway intensity. 0 keeps motion near center; 1 uses the maximum v1 sway template.
sensitivitynumberOnset sensitivity for venue tuning. Log-scale anchors: 0.0 => min_onset_rms 0.025 (least sensitive), 0.5 => 0.004 (default verified on device), 1.0 => about 0.001 (most sensitive).

beat_mode_stop

Stop beat mode, send listen.stop best-effort, and keep the last rolling audio buffer available for beat_clip_save until the next beat mode start or gateway restart.

beat_mode_update

Update beat mode VJ parameters without restarting capture: motion intensity, onset sensitivity, base-ring flash color, blink-rate multiplier, and motion/LED enable toggles.

ParameterTypeDescription
blink_ratenumberLED flash cadence multiplier relative to the detected beat period.
colorarray
led_enabledboolean
motion_enabledboolean
motion_intensitynumber
sensitivitynumberOnset sensitivity for venue tuning. Log-scale anchors: 0.0 => min_onset_rms 0.025 (least sensitive), 0.5 => 0.004 (default verified on device), 1.0 => about 0.001 (most sensitive).

beat_meta_snapshot

Return the latest beat mode snapshot: active state, BPM, confidence, last beat/audio monotonic timestamps, capture health, rolling-buffer duration, counters, current motion/LED parameters, and the active sensitivity with its effective min_onset_rms floor. This is a polling snapshot; beat mode does not push notifications.

beat_clip_save

Save the most recent beat-mode audio window as a WAV file (16 kHz mono signed 16-bit PCM) and return the absolute temp-file path plus actual captured duration. Works while beat mode is active and against the retained buffer after stop, until a new beat mode starts or the gateway restarts. The file persists on disk; the caller is responsible for deleting it when no longer needed.

ParameterTypeDescription
secondsnumberHow many recent seconds to write, capped by the rolling capture window.

i2c_scan

Scan the external I2C bus on Grove Port A and return all 7-bit addresses (probe range 0x08..0x77, excluding I2C reserved ranges) that ACK a probe. Use this to discover attached M5Stack Unit modules (ENV III, ToF, gas sensor, PaHub, etc.). On-board ICs on the internal bus are NOT included (this tool operates on a physically separate bus). Returns {"ok": true, "addresses": [...]}.

ParameterTypeDescription
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.

i2c_read

Read n_bytes from an I2C device at 7-bit address `addr` on Grove Port A. Use this for protocols that read the device's current register / output without a preceding write. For typical 'write register address, then read' patterns, use `i2c_write_read` instead. Returns {"ok": true, "bytes": [...]} or {"ok": false, "error": "ESP_ERR_TIMEOUT"} on NACK. Optional `scl_speed_hz` (default 400000) sets the I2C clock for this transaction; lower it (e.g. 100000 or 200000) for slower Units such as the RCWL-9620 ultrasonic ranger that fail at 400 kHz with ESP_ERR_INVALID_STATE.

ParameterTypeDescription
addr *integer7-bit I2C address; range 0x08..0x77 (I2C reserved ranges excluded — matches the i2c_scan probe range).
n_bytes *integerBytes to read (1..256).
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.
scl_speed_hzintegerI2C clock for this transaction. Default 400000; lower it (e.g. 100000 or 200000) for slower Units such as the RCWL-9620 ultrasonic ranger that fail at 400 kHz with ESP_ERR_INVALID_STATE.

i2c_write

Write bytes to an I2C device at 7-bit address `addr` on Grove Port A. `bytes` is an array of integers (0..255). This tool operates on the external Port A bus only; on-board ICs (PMIC, AW9523, touch, etc.) on the internal bus are not reachable. Optional `scl_speed_hz` (default 400000) sets the I2C clock for this transaction; lower it (e.g. 100000 or 200000) for slower Units such as the RCWL-9620 ultrasonic ranger that fail at 400 kHz with ESP_ERR_INVALID_STATE.

ParameterTypeDescription
addr *integer7-bit I2C address; range 0x08..0x77 (I2C reserved ranges excluded — matches the i2c_scan probe range).
bytes *arrayBytes to write (each 0..255).
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.
scl_speed_hzintegerI2C clock for this transaction. Default 400000; lower it (e.g. 100000 or 200000) for slower Units such as the RCWL-9620 ultrasonic ranger that fail at 400 kHz with ESP_ERR_INVALID_STATE.

i2c_write_read

Write `write_bytes` to an I2C device at 7-bit address `addr` on Grove Port A, then read `n_bytes` back in a single Repeated Start transaction. Common 'set register pointer, then read' idiom: pass write_bytes=[reg_addr] to read from a specific register. Optional `scl_speed_hz` (default 400000) sets the I2C clock for this transaction; lower it (e.g. 100000 or 200000) for slower Units such as the RCWL-9620 ultrasonic ranger that fail at 400 kHz with ESP_ERR_INVALID_STATE.

ParameterTypeDescription
addr *integer7-bit I2C address; range 0x08..0x77 (I2C reserved ranges excluded — matches the i2c_scan probe range).
n_bytes *integerBytes to read (1..256).
write_bytes *arrayBytes to write before reading (each 0..255).
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.
scl_speed_hzintegerI2C clock for this transaction. Default 400000; lower it (e.g. 100000 or 200000) for slower Units such as the RCWL-9620 ultrasonic ranger that fail at 400 kHz with ESP_ERR_INVALID_STATE.

load_avatar_set

Load a dynamic avatar set onto the connected ESP32 (Phase 4.5 avatar pipeline). The gateway stages the payload on its HTTP server, notifies the device via WebSocket, and the device fetches + SHA256-verifies + loads it into PSRAM. ``archive_path`` must point to a raw RGB565 file on the gateway host: layered mode = 14 frames (face 6 + eyes 3 + mouth 5) totalling 537,600 bytes; matrix mode = 90 frames (6 × 3 × 5) totalling 3,456,000 bytes. Returns ok / checksum / bytes_transferred / error.

ParameterTypeDescription
archive_path *stringFilesystem path on the gateway host to the raw RGB565 payload.
mode *string'layered' (14 frames, ~525 KB) or 'matrix' (90 frames, ~3.3 MB).
device_idstringOptional Device-Id of the connected ESP32 to target (see list_devices). Omit to use the default device.
timeoutnumberMax seconds to wait for the device's avatar_set_loaded reply.