micropython_exec
Execute multi-line Python code on MicroPython devices for testing or deployment. Returns stdout, stderr, and errors with a configurable timeout.
Instructions
MicroPython インタープリタで Python コードを実行する。 複数行のコードも実行できる。
Args: code: 実行する Python コード (複数行可) timeout: コード送信から Raw REPL 復帰完了までの全体タイムアウト秒数 (デフォルト 10秒)
Returns: ok: 実行に成功したら True stdout: 標準出力 stderr: 標準エラー出力 error: エラー時のメッセージ。成功時は None
Example: code = "import machine\nprint(machine.freq())"
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": {
"code": "<code>"
},
"name": "micropython_exec"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | ||
| timeout | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | ||
| error | Yes | ||
| stderr | Yes | ||
| stdout | Yes |