Skip to main content
Glama

Read a PcbLib

read_pcblib
Read-only

Read Altium .PcbLib files to extract every footprint and its primitives plus mechanical-layer details as structured JSON in millimetres for library study or read-modify-write edits.

Instructions

Read an Altium .PcbLib file: every footprint with its description, height and primitives (pads, vias, tracks, arcs, regions, fills, text, component_bodies) as structured JSON, all coordinates and dimensions in millimetres, plus mechanical_layers: the name, kind (3DBodyTop, AssemblyTop, CourtyardTop and so on) and enabled flag the library's own layer stack gives each mechanical layer it uses, which can differ from the fixed names primitives are reported under (Mechanical 4 is Top Courtyard here, but a library may make it its 3D Body layer). Use it to study a library's footprint style or to fetch data for a read-modify-write. For one footprint whose name you know, get_component is cheaper; to find footprints by name pattern across libraries, search_components; for names alone, list_components. Each footprint is the same JSON shape get_component, export_library and write_pcblib use, so a footprint read here can be passed to write_pcblib or update_component as it is. Fields such as guid, unique_id, raw_tail, raw_block, raw_geometry, raw_contours, raw_layer_id, additional_parameters, param_key_order, primitive_order and storage_name are fidelity carriers: pass them back unchanged and the rewrite is byte-identical to the source; omit them when authoring from scratch. A list with no entries and an optional field with no value are omitted rather than empty or null. compact (default true) omits a pad's per-layer size and shape arrays when its stack_mode is Simple, since they only repeat the top-level values; set it false to see every layer. For a large library, page with limit and offset: the result reports total_count, returned_count, offset and has_more. component_name fetches one footprint and turns paging off.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
limitNoOptional: maximum number of footprints to return, 1 or more (default: all)
offsetNoOptional: skip the first N footprints, 0 or more (default: 0)
compactNoIf true (default), omit per-layer pad data when stack_mode is Simple. Set to false for full output.
filepathYesPath to the .PcbLib file
component_nameNoOptional: fetch only this footprint, by name in any case; a name the library does not hold is an error naming the available footprints

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.6/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, destructiveHint=false and closed-world, so the safety profile is covered; the description goes further by disclosing the fidelity-carrier fields, the byte-identical-rewrite guarantee, the omit-empty-rather-than-null convention, the compact default and the paging shape. It stops short of stating performance/rate considerations for very large libraries, but the operational behaviour is well disclosed.

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?

Purpose and use-case routing are front-loaded and every sentence carries information, so little is wasted. It is nonetheless a dense wall of prose covering several distinct topics (output shape, fidelity fields, omission rules, paging, alternatives) that would read better structured, which costs it a point.

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 no output schema and a 5-parameter read tool, the description carries the full burden and does so: it describes the returned JSON, the mechanical-layer naming caveat, the paging envelope fields and the omission semantics. An agent has everything needed to call it and interpret the result.

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

Parameters4/5

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

With 100% schema coverage the baseline is 3, but the description adds real meaning beyond the schema: component_name 'turns paging off' (the schema never says this), compact's default and rationale, and the returned paging fields. It still doesn't fully document limit/offset edge behaviour, hence a 4 rather than 5.

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 (read) and resource (.PcbLib file) and enumerates exactly what is returned: footprints with description, height and primitives, plus mechanical_layers with kind and enabled flag. It explicitly contrasts itself with get_component, search_components and list_components, so an agent can pick it out without opening a 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?

Gives two positive use cases ('study a library's footprint style', 'fetch data for a read-modify-write') and names the three cheaper alternatives with the conditions that select them (one known footprint, name-pattern search, names alone). Nothing 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.