Skip to main content
Glama

PA Power Sweep (Closed-Loop)

pa_sweep
Destructive

Sweeps LoRa TX power settings, measures PA output on a power meter, and returns a configured-versus-measured table with compression and saturation analysis for calibration.

Instructions

Closed-loop PA calibration: step lora.tx_power through powers, measure the PA on the ImmersionRC meter, and return a configured-vs-measured table with a compression/saturation analysis.

Destructive: writes lora.tx_power, keys real ~200 B broadcasts onto the mesh, and reboots between steps with reboot_between_steps. Requires confirm=True, or the user's answer when the client can ask. A failed restore is listed in restore_errors, or named in the error when the sweep itself fails. A step in silent_steps_dbm may be a dead PA or a late TX, so rerun it spaced out. An uncalibrated bench check (about ±0.5 dB). See docs/power-meter.md.

Returns {band, region, requested_center_mhz, meter_cal_mhz, attenuator_db, tx_linger_s, floor_dbm, floor_margin_db, table: [{configured_dbm, measured_avg_dbm, measured_peak_dbm, delta_db, active_samples, total_samples, rf_observed}], curve: {points, saturation_dbm, max_measured_dbm, max_measured_at_configured_dbm, offset_at_min_db, monotonic}, silent_steps_dbm, config_restored, restore_errors, caveat}.

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": {
      "powers": "<powers>"
    },
    "name": "pa_sweep"
  }
}

Input Schema

NameRequiredDescriptionDefault
bandNoA region name or MHz, as in `pa_measure`; defaults to the node's region.
portNoThe node's serial port or `tcp://host[:port]`; omit to auto-select the one likely Meshtastic device.
powersYesThe `lora.tx_power` steps to measure, in dBm.
confirmNo`True` once the user agreed; omitted, a client that can ask prompts the human.
settle_sNoSeconds to wait after each power change, and for the bursts to drain.
meter_portNoThe meter's serial port; omit to find it by USB VID/PID.
tx_linger_sNoSeconds each burst holds the port open; `tx_linger_s=None` derives the per-burst linger from the live preset's airtime.
burst_repeatNoBroadcasts keyed per step.
attenuator_dbNoThe pad before the meter. Pick it so the top power minus the pad stays under the meter's +31 dBm maximum; the sweep refuses otherwise.
channel_indexNoThe channel the bursts go out on.
restore_configNoPut `tx_power` and the override back afterwards; pass `restore_config=False` to keep the last step.
override_duty_cycleNo`override_duty_cycle=True` (default) lifts the duty-cycle limit in every region for the sweep.
reboot_between_stepsNoReboot after each `tx_power` write, for firmware before 2.8.0.

Output Schema

NameRequiredDescriptionDefault
bandYes
curveYesThe gain-curve analysis over the measured steps.
tableYes
caveatYes
regionYes
floor_dbmYes
tx_linger_sYesthe per-burst linger used
attenuator_dbYes
meter_cal_mhzYes
restore_errorsYes
config_restoredYes
floor_margin_dbYes
silent_steps_dbmYesa dead PA or a late TX; rerun spaced out
requested_center_mhzYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4/5.0
Behavior5/5

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

Beyond `destructiveHint=true`, it discloses exact side effects: writes `lora.tx_power`, keys real ~200 B broadcasts on the mesh, optionally reboots between steps, and restores config unless disabled. It also explains `restore_errors` and `silent_steps_dbm` failure modes, giving an agent concrete behavioral context.

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 description is front-loaded with purpose and destructive warning, then organized into behavior and return-summary sections. It is appropriately sized for a 13-parameter destructive calibration tool, though the full return-field enumeration is somewhat redundant given the output schema.

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?

For a destructive, open-world calibration tool with rich annotations and an output schema, the description covers the important missing context: real mesh broadcasts, confirmation requirement, reboot/restore semantics, silent-step caveats, and meter calibration limits. Nothing essential for correct invocation is left implicit.

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?

Schema coverage is 100%, so all 13 parameters already have structured documentation. The description reinforces the roles of `powers`, `confirm`, `reboot_between_steps`, and restore behavior, but adds little parameter meaning that is not already in the schema; baseline 3 is appropriate.

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 first sentence names a specific operation—closed-loop PA calibration—and states the concrete steps: sweep `lora.tx_power` across `powers`, measure via the ImmersionRC meter, and return a configured-vs-measured table. It is clearly a sweep/calibration workflow rather than a simple measurement, though it does not explicitly contrast itself with `pa_measure` or other siblings.

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?

The description identifies the setting (PA calibration) and gives operational caveats such as requiring `confirm=True`, rerunning silent steps spaced out, and the uncalibrated bench check. However, it never states when to choose this over `pa_measure` or when not to run a sweep, so usage is implied by purpose and warnings rather than fully guided.

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