Skip to main content
Glama

pio_port_diagnose

Identify why a serial port is unusable before or after a failed upload: check existence, monitor locks, competing processes, permissions, and list concrete fixes.

Instructions

Explain why a serial port is unusable before or after a failed upload: whether it exists, whether one of our monitor sessions holds it, which other process has it open (lsof/fuser on macOS and Linux), and read/write permission, plus the concrete fix. Port defaults from platformio.ini or the single detected board. Reports only; it never closes anything.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
envNo
portNo
project_dirNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.2.0

TDQS

A4.5/5.0
Behavior5/5

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

No annotations are provided, so the description carries full responsibility. It discloses that the tool is non-destructive ('never closes anything'), which commands it relies on (lsof/fuser on macOS and Linux), and that it checks its own monitor sessions plus external processes. This is comprehensive for a diagnostic read-only tool.

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

Conciseness5/5

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

Three sentences with no filler. The first sentence uses a dense colon list to front-load the entire scope (existence, monitor session, process, permission, fix). Each clause earns its place by adding a distinct fact.

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

Completeness5/5

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

With an output schema present, return values need no extra explanation. The description covers invocation trigger, diagnostic scope, platform-specific behavior, side effects, and port defaulting. For a diagnostic tool with only optional parameters, nothing critical is missing.

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

Parameters3/5

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

All 3 parameters are optional with 0% schema description coverage. The description explains the port parameter's default behavior ('Port defaults from platformio.ini or the single detected board') but says nothing about env or project_dir. These are inferable from their names in a PlatformIO context, but the description does not fully compensate for the schema gap.

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

Purpose5/5

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

Starts with the specific verb 'Explain' and a precise resource ('why a serial port is unusable'), then enumerates concrete diagnostic dimensions (existence, monitor sessions, owning process, permissions, fix). This clearly distinguishes it from siblings like pio_monitor_stop or pio_upload, which manage or perform actions rather than diagnose.

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

Usage Guidelines4/5

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

Provides an explicit trigger context: 'before or after a failed upload'. The line 'Reports only; it never closes anything' implicitly tells the agent not to use this tool for freeing ports (a job for pio_monitor_stop). However, it does not name alternative tools directly or state explicit 'when not to use' scenarios beyond this.

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