Skip to main content
Glama

lib_add_footprint_text

Add text to a PcbLib footprint and its underlying board, then register the primitive so the placement editor displays it reliably.

Instructions

Add a text primitive to a PcbLib footprint.

Trap baked into this handler: in a PcbLib, adding a primitive only to the footprint does NOT register it with the placement editor -- the text shows up only after a save+reload. This tool adds the text to BOTH the footprint and the underlying board, then broadcasts PCBM_BoardRegisteration to both, which is the pattern that registers the primitive reliably.

Args: text: The string to place. Required. x, y: Coordinates in mils, relative to the FOOTPRINT's origin, which is what the handler has always actually done (Footprint.X + MilsToCoord(x)). The old wording said "board origin" and that was wrong: a PcbLib footprint sits at Altium's library origin, 50000 mils out, so the two readings differ by more than a metre. The pad, track and arc tools wrote absolute board coordinates and produced footprints whose geometry was nowhere near them; they now match this one. size: Text height in mils. 50 is a common silkscreen size; drop to 30-40 for tight footprints. width: Stroke width in mils. 8 reads cleanly at 50 mil size; scale with size. rotation: Rotation in degrees (0, 90, 180, 270 typical). layer: Layer name resolved by GetLayerFromString (TopOverlay, BottomOverlay, TopSolder, BottomSolder, Mechanical1 ... Mechanical32). use_ttfont: True for TrueType; default False is the vector stroke font that fab houses prefer. mirror: Mirror the text. Set this for anything on a BOTTOM layer, or it reads backwards on the finished board; audit_find_mirrored_pcb_text reports both halves of the mistake (bottom text unmirrored, top text mirrored). library_path: Optional .PcbLib to focus before adding. Defaults to the active document. component_name: Optional footprint name to switch to before adding. Defaults to the currently active footprint. units: "mil" (default) or "mm", for every length and coordinate here, kept exact rather than rounded to whole mils.

Returns: Dict with success, footprint, text, layer, x, y.

Input Schema

NameRequiredDescriptionDefault
xNo
yNo
sizeNo
textYes
layerNoTopOverlay
unitsNomil
widthNo
mirrorNo
rotationNo
use_ttfontNo
library_pathNo
component_nameNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.6.1

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations, the description carries the full burden and does so: it discloses that the handler writes to both the footprint and the underlying board and broadcasts PCBM_BoardRegisteration, and that a naive add would require save+reload to appear. The mirror pitfall (bottom-layer text reads backwards unless mirrored) plus the pointer to audit_find_mirrored_pcb_text as the detector is exactly the kind of behavioral context annotations could not provide.

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?

Front-loaded correctly: purpose, then the registration trap, then per-argument detail. Some length is unavoidable given 12 undocumented parameters, but the editorial digression about the old "board origin" wording being wrong and the pad/track/arc tools producing misplaced geometry is history rather than instruction and could be trimmed to a single clause.

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 12-parameter mutation tool with no annotations, the description covers invocation context (library/footprint targeting, units), behavioral side effects, the mirror correctness rule, and coordinate semantics. An output schema exists and the Returns block still names the keys, so nothing an agent needs before calling is absent.

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

Parameters5/5

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

Schema description coverage is 0% across 12 parameters, so the description must compensate entirely and does — every parameter is documented with units, defaults and semantics. The x/y clarification (relative to the footprint origin, not the library origin 50000 mils away) and the note that pad/track/arc tools now match this convention resolve an ambiguity that would otherwise silently misplace geometry.

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?

Opening sentence gives a specific verb and resource ("Add a text primitive to a PcbLib footprint"), which cleanly separates it from board-level text placement (pcb_place_text) and from the other lib_add_footprint_* family members (pad, track, arc). The scope word "PcbLib" is the discriminator an agent needs.

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?

The "trap" paragraph explains precisely why this tool exists rather than a simpler add call — the primitive must be registered with the placement editor, which plain footprint adds do not do. Typography guidance (50 mil default silk size, 30-40 for tight footprints, width 8 at size 50, mirror for bottom layers) gives concrete usage context. It never explicitly names an alternative tool or says when NOT to use it, so it stops short of a 5.

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

Deploy Server

Other Tools