Skip to main content
Glama

setup_swo

Destructive

Configure STM32 TPIU/ITM for SWO printf from the debugger using the core clock and SWO baud, without firmware ITM setup. Returns OpenOCD capture commands and a printf retarget snippet.

Instructions

One-call SWO/ITM printf setup. Configures the target's TPIU+ITM from the debugger (no firmware ITM-init needed) for the given core clock (hclk_hz) and SWO baud, and returns the OpenOCD capture commands + the firmware printf retarget snippet. Then capture with logging(action=start, channel='swo', file=). Requires the SWO pin (e.g. PB3) wired to the probe.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
portNoITM stimulus port for printf (default 0).
outputNoOpenOCD ITM decode output file to tail (default 'swo_itm.log').
swo_hzNoDesired SWO baud (default 2000000; ST-Link V2 max ~2 MHz).
hclk_hzYesCore clock (HCLK) in Hz, e.g. 80000000 for an L4 at 80 MHz.
sessionNoOptional debug-session name. Omit for the default target.
tpiu_nameNoOpenOCD tpiu object name if not the default '$_CHIPNAME.tpiu'.
apply_openocdNoAlso run the OpenOCD capture commands via monitor now (default false).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.15.1

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare destructiveHint=true, readOnlyHint=false, idempotentHint=false, so the safety profile is covered. The description still adds genuine context beyond the schema: no firmware ITM-init is required, it exercises the debugger, it returns OpenOCD capture commands plus a printf retarget snippet, and it needs hardware wiring. It does not explain the destructive aspect in words, which keeps it from a 5.

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?

Front-loaded with the one-line purpose, followed by the essential mechanics, the next-step routing, and the hardware prerequisite. Every sentence carries distinct information with no filler.

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

Completeness4/5

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

With no output schema, the description steps in to say what is returned (capture commands and firmware snippet), plus the workflow and prerequisite. That covers an agent's needs to call and chain it correctly; only a note on side effects on target state 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?

Schema coverage is 100%, so all seven parameters are already documented in the schema. The description references hclk_hz and SWO baud but adds no format or constraint detail beyond what the schema provides, so the baseline of 3 applies.

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?

States a specific verb+resource immediately: 'One-call SWO/ITM printf setup.' It names exactly what is configured (target's TPIU+ITM from the debugger) and the inputs that drive it (hclk_hz, SWO baud), distinguishing it from generic setup or logging siblings.

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?

Gives explicit usage routing: 'Then capture with logging(action=start, channel="swo", file=<output>)' names the follow-on tool and params, and it states the prerequisite (SWO pin wired to probe). It lacks an explicit 'do not use when' clause, so not a full 5.

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