Skip to main content
Glama
hardware-tooling-mcp
by Pheem49

compile_and_flash

Compile firmware and flash it to microcontrollers using Arduino CLI, PlatformIO, or ESP-IDF; auto-detects toolchain from project files and can upload to a serial port.

Instructions

Compile and/or flash firmware to a microcontroller using Arduino CLI, PlatformIO, or ESP-IDF.

Args: project_path: Path to the project directory or sketch file. toolchain: 'auto', 'arduino-cli', 'platformio', or 'esp-idf'. When 'auto', detects from platformio.ini, CMakeLists.txt, or .ino files. port: Serial port for uploading (e.g., '/dev/ttyUSB0'). board_fqbn_or_env: - For arduino-cli: Board FQBN (e.g., 'esp32:esp32:esp32', 'arduino:avr:uno'). - For platformio: Environment name (-e <env>). - For esp-idf: Target chip (e.g., 'esp32', 'esp32s3') if setting target. action: 'compile', 'upload', or 'compile_and_upload'. extra_args: Optional list of extra CLI flags to append. timeout_sec: Maximum execution time in seconds (default 300).

Input Schema

NameRequiredDescriptionDefault
portNo
actionNocompile_and_upload
toolchainNoauto
extra_argsNo
timeout_secNo
project_pathYes
board_fqbn_or_envNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

B3.3/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are supplied, so the description carries the full disclosure burden, and it omits the traits that matter most: the schema default action is 'compile_and_upload', meaning a bare call physically rewrites device firmware, yet nothing warns that this is a mutating, hardware-altering operation. It also says nothing about serial-port contention (relevant to find_port_occupiers/free_serial_port), what happens on compile failure, or whether aborting is possible. Only the 300s default timeout and extra_args pass-through are disclosed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose is front-loaded in one sentence, followed by a clean per-argument list that is justified given the total absence of schema descriptions. No filler or restated boilerplate, though the multi-line nested bullet for board_fqbn_or_env is slightly heavier than needed.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

An output schema exists, so return values need not be explained, and the argument documentation is thorough for a 7-parameter tool. But for a hardware-mutating operation with zero annotations, the definition should say more about risk, required port for upload, and failure behavior; as written an agent could trigger a flash unintentionally via the default action.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the Args block does real work: it explains that project_path may be a directory or a sketch file, that toolchain accepts 'auto' with concrete detection sources, and that board_fqbn_or_env is interpreted differently per toolchain (FQBN vs -e env vs target chip). The gap is interaction semantics — whether port is mandatory for 'upload' and how action and toolchain constrain one another are left implicit.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening sentence names a specific action ('Compile and/or flash firmware') and resource ('to a microcontroller'), and enumerates the three supported toolchains (Arduino CLI, PlatformIO, ESP-IDF). That is far more specific than the sibling names alone, though it does not explicitly distinguish itself from run_custom_toolchain or esptool_command, which cover adjacent ground.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Usage is implied through the 'action' values and the documented 'auto' detection logic (looks for platformio.ini, CMakeLists.txt, or .ino files), which helps an agent pick a toolchain. However, it never says when to prefer this over run_custom_toolchain, esptool_command, check_toolchains, or check_prerequisites, nor does it state prerequisites such as requiring the port before an upload.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.