Skip to main content
Glama

pcb_calc_length_match

Convert a timing or skew budget into a length-match tolerance and per-net serpentine compensation for PCB buses or differential pairs, using routed lengths to report mismatch and skew.

Instructions

Length-match tolerance and serpentine compensation for a bus / pair.

Turns a timing budget into the length-match window the routing must hold, and -- given the routed lengths -- the serpentine copper each net needs. The complement of Altium's pcb_tune_length (which executes the meander) and pcb_get_trace_lengths (which reads lengths back). Pure math, no Altium. Rests on the ns/in == ps/mil identity, so skew maps to length exactly; propagation speed uses the effective dielectric constant (stripline = Er, the usual inner-layer bus case; microstrip reduced).

The skew budget is taken from skew_budget_ps if > 0, else from match_fraction * rise_time_ns (the "match to within 10-20 % of the edge" rule).

Args: lengths: Optional {net: length_mils} of routed lengths; when given, returns a per-net match report targeting the longest net. skew_budget_ps: Allowed skew in ps (e.g. a DDR byte-lane budget). rise_time_ns: Edge rate, used with match_fraction if no ps budget. match_fraction: Fraction of the rise time allowed as skew (default 0.1). dielectric_constant: er (default 4.2 FR-4). geometry: stripline (default) or microstrip. width_mils, dielectric_height_mils: Microstrip geometry for the Hammerstad Er_eff (optional).

Returns: {"ok": True, "er_eff", "t_pd_ps_per_mil", "skew_budget_ps", "tolerance_mils", "members"?: [{net, length_mils, mismatch_mils, skew_ps, compensation_mils, within_tolerance}], "target_length_mils"?, "worst_skew_ps"?, "all_matched"?, "summary"}.

Input Schema

NameRequiredDescriptionDefault
lengthsNo
geometryNostripline
width_milsNo
rise_time_nsNo
match_fractionNo
skew_budget_psNo
dielectric_constantNo
dielectric_height_milsNo

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.6.1

TDQS

A4.7/5.0
Behavior4/5

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

With no annotations, the description must carry the full behavioral burden, and it does: 'Pure math, no Altium' tells the agent this is a side-effect-free computation that needs no open board, and it discloses the underlying model (ns/in == ps/mil identity, stripline vs microstrip Er_eff, Hammerstad). It stops short of stating determinism or error behavior for invalid geometry/zero inputs, which is the only material gap.

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 with the one-line purpose, then the sibling routing, then the physical model, then Args/Returns. Well structured and mostly earns its space, though the propagation-speed rationale runs slightly longer than needed for selection and invocation.

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 an eight-parameter pure-math tool with a 0% schema description coverage, the description closes every gap an agent needs: purpose, alternatives, model assumptions, per-parameter semantics with defaults, and the shape of both return modes. An output schema exists, so the Returns block is a bonus rather than a crutch.

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%, so the description must compensate entirely, and it names all eight parameters with meaning and defaults: lengths as {net: length_mils}, match_fraction default 0.1, dielectric_constant default 4.2 FR-4, geometry stripline/microstrip, width_mils and dielectric_height_mils flagged as microstrip-only. The interaction between skew_budget_ps, rise_time_ns, and match_fraction is spelled out rather than left to the schema.

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 and resource ('Length-match tolerance and serpentine compensation for a bus/pair') and immediately differentiates itself from the two nearest siblings, pcb_tune_length (executes the meander) and pcb_get_trace_lengths (reads lengths back). An agent can tell exactly what class of operation this is without opening the schema.

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

Usage Guidelines5/5

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

Explicitly positions the tool as the complement of two named siblings and describes both modes: budget-only (returns the tolerance window) versus with routed lengths (returns a per-net compensation report targeting the longest net). It also states the precedence rule for the skew budget (skew_budget_ps if > 0, else match_fraction * rise_time_ns). Little is left to inference.

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