micropython_write_file
Write or overwrite files on a MicroPython board via USB Serial or WebREPL, enabling MCP clients to deploy code and data directly.
Instructions
MicroPython ボードのファイルに内容を書き込む(上書き)。
Args:
path: 書き込み先ファイルのパス (例: "/main.py")
content: 書き込むテキスト内容。content_base64 とは排他的
timeout: コード送信から Raw REPL 復帰完了までの全体タイムアウト秒数
encoding: content をバイト列に変換するエンコーディング
content_base64: base64 で表した書き込みデータ。content とは排他的
Returns: ok: 書き込みに成功したら True path: 書き込み先パス bytes_written: 書き込んだバイト数 error: エラー時のメッセージ
Notes:
content と content_base64 はどちらか片方のみ指定する。
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": {
"path": "<path>"
},
"name": "micropython_write_file"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | ||
| content | No | ||
| timeout | No | ||
| encoding | No | utf-8 | |
| content_base64 | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | Yes | ||
| path | Yes | ||
| error | Yes | ||
| bytes_written | Yes |