You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Generate the MCP tools from the Bridge API instead of transcribing them
mcp/tools.py hand-wrote 919 lines that re-declared the signature and
re-worded the docstring of methods that already existed, and still only
covered 85 of the 127 sub-API methods: there were no rmt_*, i2s_*, watch_*
or wifi_link_* tools at all.
Tools are now derived from the API. Every public sub-API method becomes
<subapi>_<method> carrying that method's own signature and docstring, with
bytes travelling as hex in both directions; only the exceptions are written
out (SKIP for callbacks and live objects, plus a handful of composites).
esp.i2c.read(addr, n) IS the i2c_read tool, so the two can no longer drift,
and a new peripheral method is a new tool with nothing to write.
108 -> 136 tools, no name lost. Generated tools return the method's own
value, so gpio_write gives the read-back level (1) rather than
{"level": 1, "ok": true} and i2c_read gives "010203" rather than
{"hex": "010203"}.
Deletions that fell out of it:
- dac.cosine_stop(): the firmware's DAC_DISABLE already calls stop_cosine(),
and so does dac.write() -- the method could only do a subset of disable().
- BridgeManager.note_i2c/forget_i2c/i2c_buses: esp.i2c.buses records the bus
configuration where it belongs, and board_status reads it from there.
- BridgeManager.open_uart/uart_port/close_uart: esp.uart already cached its
ports; it only needed a port() accessor.
PinStatus.pwm becomes a field rather than a property, so it survives
serialisation, and the loose atten/callback parameters on adc.config and
watch.add are annotated.
Verified on two ESP32 DevKits: hw_stress 130/130 over 5 iterations with no
heap drift, plus the generated tools driven over a real link (gpio, adc,
dac, pwm, i2c, nvs, fs, watch, rmt, i2s, radio_off, board_status).
0 commit comments