MCP ScannerCustom audit
All servers

salitronic/eda-agent

Open-source MCP server that lets an AI drive a live session of Altium Designer, and optionally KiCad or EasyEDA Pro, editing the open design in place while you watch. 560+ tools: schematic, PCB, library and project automation, design review, audits, rendering, auto-placement, panelization, autonomou

Packageeda-agent
Version0.8.2 in pyproject.toml
Publishersalitronic community
MCP Registryio.github.salitronic/eda-agent
Scanned2026-11-25
Scannerv1.3.0
Methodologyv1.2
Stars 366Forks 81Last push 2026-11-16
Python 99.3%Rust 0.6%JavaScript 0.1%by source files the scanner reads
Code safetypartly tracedExposure0.0Prompts10.0Supply chain6.4Secrets10.0Transparency10.0
Analysis confidence80%
How much of the server the scanner could read: tools analyzed, files parsed, limits hit.
Code Safetypartly traced—

Paths from tool input into commands, SQL, files and URLs

Capability Exposure0.0/10Poor

How much power the tools give an agent over the machine

Prompt Integritynothing published yet10.0/10

Hidden instructions and poisoning in text for the model

Supply Chain6.4/10Fair

Known vulnerabilities in the packages the server uses

Secrets & Credentialsnothing published yet10.0/10

How the server reads credentials and where they can go

Behavior Transparencynothing published yet10.0/10

Whether the tools do only what their descriptions say

How far the analysis went

The scanner traces each tool from its input to the operations its code performs, and here it could not follow every path. Code Safety is shown as partly traced instead of a score: no finding there is not a clean result. The score of Capability Exposure counts only what it could follow.

  • Some paths pass through more than 8 functions one inside another; the scanner stops there
  • In 5,808 places a tool's input is handed to a function whose name matches several definitions in the code; the scanner could not tell which one runs, so it stopped there
  • 2 files reached by the taint walk exceeded the 524288 byte size limit and were read and parsed only up to it
  • 2 files exceeded the 524288 byte size limit and were parsed only up to it
  • 2 source files could be read only in part
  • 28 of 1,158 tools, prompts and resources could not be followed through the code
  • 4 places in the code register tools whose names are computed at run time; how many tools that makes cannot be read from the code
  • 41 tools, prompts and resources registered only in the repository's tests are not counted on this page

Top risks in plain words

  • HIGHTools altium365_publish_library_file, app_screenshot, design_read_rules_export, design_session_report and 55 more read or write any file path by design: an agent steered by prompt injection can use them that way.
  • HIGHTool part_fetch requests any address by design: an agent steered by prompt injection can use it that way.
  • HIGH1 production dependency has known vulnerabilities (worst: high).

How to use it safely

Practical steps from what we found in this server. They lower the risk; they do not replace a review of the code.

  • Give it only the folder it needs

    altium365_publish_library_file, app_screenshot, design_read_rules_export, design_session_report and 55 more can read or write any file path. Mount a single project folder, read-only where you can.

  • Limit where it can connect

    part_fetch can request any address. Block access to internal hosts and cloud metadata endpoints.

  • Turn off the tools you do not use

    Most MCP clients let you disable single tools. If you do not need altium365_publish_library_file, app_screenshot, design_read_rules_export and 57 more, switch them off.

  • Give it a narrowly scoped token

    Its code reads credentials or environment variables. Use a key limited to what this server needs, not your main one.

  • Update its vulnerable packages

    Use pyo3 0.29.0 or later.

  • Keep confirmations on

    Leave your MCP client's confirmation prompt on for tools that change files, run commands or send data.

What its tools can do on your machine

The server offers 1113 tools, 3 prompts, 1 resource. When an AI agent calls them, this is what their code can do on the machine where the server runs, as traced in the source. Tools that call code the scanner could not follow may do more.

Start other programs on the machinecan run commands or launch programs
design_visual_review, lib_create_footprint_from_package, lib_generate_ipc_batch, pcb_build_from_project, proj_export_image
5 of 1117
Read or write filesopen, create, change or delete files
altium365_check_setup, altium365_describe_type, altium365_get_component, altium365_get_project, altium365_list_library_folders, altium365_list_projects and 218 more
224 of 1117
Connect to the internet or other hostssend requests or open connections
altium365_check_setup, altium365_describe_type, altium365_get_component, altium365_get_project, altium365_list_library_folders, altium365_list_projects and 234 more
240 of 1117
Read passwords, tokens or keysload secrets such as API keys
kicad_generate_pcb, kicad_generate_project, kicad_generate_schematic
3 of 1117
Read environment variablesoften where API keys are kept
app_context, app_ping, autonomous_design, design_apply_policy, design_autonomy_guide, design_check_company_rules and 246 more
252 of 1117
Touch sensitive locationssuch as ~/.ssh, cloud credentials or browser data
kicad_generate_pcb, kicad_generate_project, kicad_generate_schematic
3 of 1117

Where its requests and secrets go

Read from the names along each tool's calls, not from a run: what the code says, not every address it may reach at run time.

Hosts written in the code

The literal addresses the tools' requests name.

  • None: no request names a fixed host.
Addresses from settings

Constants or settings that start an address; the value comes from configuration.

  • None seen.
Secrets it reads

Credential-like environment variables. Give the server a key with the least access it needs.

  • None: no credential-like variable is read by the tools.

230 request addresses could not be settled from the code (built at run time).

Text it brings in from outside

Text that reaches the model from outside: an instruction hidden in it can steer the agent (prompt injection). Treat what these tools return as data, not as orders.

  • files177 tools · altium365_check_setup, altium365_describe_type, altium365_get_component +174
  • web or API responses231 tools · easyeda_activate_document, easyeda_add_arc, easyeda_add_bus +228

Tool annotations

No tool declares MCP annotations (readOnlyHint, destructiveHint and the rest). Clients use them to decide what to confirm; directories such as Anthropic's and OpenAI's ask for them.

Tools, prompts and resources (1117: 1113 tools, 3 prompts, 1 resource)

Open a row for its full description. Chips show what its code can reach, and which risky capability its own description declares.

altium365_publish_library_filetool Publish a symbol (.SchLib) or footprint (.PcbLib) into a folder of aReads/writes files
Publish a symbol (.SchLib) or footprint (.PcbLib) into a folder of a
        workspace's managed library.

        Without ``confirm`` this shows what would be sent. With it the file
        is uploaded and the item created, and its ``id`` comes back.
app_screenshottool Capture Altium, or one dialog, to a PNG.Filesoutside textReads/writes files
Capture Altium, or one dialog, to a PNG.

        THE AGENT COULD NOT SEE THE UI. ui/ocr.py has been able to
        capture and read a window since it was written and none of it
        was exposed, so every judgement about what was on screen came
        from an accessible tree that omits anything drawn rather than
        placed. A picture settles what a tree cannot: which page is in
        front, whether a control is greyed, what a rendered dialog
        actually says.

        Args:
            path: where to write the PNG. Defaults to the workspace
                directory, so the file is somewhere findable.
            dialog_title: capture that dialog rather than the main
                window.

        Returns:
            ``ok``, ``path``, ``hwnd``, and the picture's ``width`` and
            ``height`` in pixels; it is the window at its real size, so
            things can be measured on it. ``window_left`` /
            ``window_top`` place it on the screen. Read the file to look
            at it.
design_read_rules_exporttool Read an Altium design-rules export (.RUL): one record per rule,Filesoutside textReads/writes files
Read an Altium design-rules export (.RUL): one record per rule,
        with its fields as Altium wrote them (they differ by rule kind and
        version). Reads only the file; the open board's own rules come from
        pcb_get_design_rules.
design_session_reporttool Write up a design run from its session journal, as markdown.FilesReads/writes files
Write up a design run from its session journal, as markdown.

        Assembled only from what the run recorded: the requirement, each
        stage's outcome with the gate numbers logged for it, decisions,
        audit results, simulations and open issues. The body sections come
        in a fixed order: placement strategy, stack-up and impedance,
        critical routes (lengths, skews, layer changes, return vias,
        exceptions), power paths, planes and fan-out (where via-in-pad was
        used and why), silkscreen policy, verification results, simulations,
        open issues. A section nothing was logged for says so in one line.
        Notes reach a section through their ``topic`` (see
        ``design_session_log``).

        Args:
            session_id: the session to report; blank uses the most recently
                active one.
            output_path: also write the markdown to this file. Its folder
                must exist, and a path inside the installed eda_agent
                package is refused. Blank writes nothing.

        Returns:
            ``{"session_id", "markdown", "path"}`` (``path`` is "" when
            nothing was written), or ``{"error": ...}``.
design_simulate_loopstool Loop gain, crossover, phase and gain margin of every feedbackFilesoutside textReads/writes files
Loop gain, crossover, phase and gain margin of every feedback
        loop in a plan, simulated in ngspice. Changes nothing.

        The loops come from design_find_loops. Each is broken at the
        driving pin (an op-amp's output) and measured by Middlebrook
        double injection, so the real load on the output counts. A
        switching regulator's FB loop runs only when its model is marked
        ``"averaged": true``: a vendor's switching (transient) model has
        no small-signal loop gain.

        Models are the manufacturer's: ``models`` maps refdes to
        ``{"file": path, "subckt": name, "pins": [plan pins in the
        subckt's node order]}``. Without ``pins`` the .SUBCKT node names
        are matched to the plan's pin names (and ``pin_names``). R, C and
        L are SPICE primitives from their values. A part with no model is
        listed in ``missing_models`` and nothing runs; nothing is ever
        approximated. Rails take ``supplies`` ({net: volts}) or the
        voltage in the net name (+12V, 3V3).

        No ngspice: the reply carries the install offer and runs nothing.

        A phase margin under 45 degrees is flagged ``low``: a common
        design convention, not a datasheet limit; loops are ranked by
        margin either way.
easyeda_import_routingtool Import an autorouter or autolayout result back onto the board.FilesNetworkEnv varsoutside textReads/writes files
Import an autorouter or autolayout result back onto the board.

        CLOSES THE ROUND TRIP that ``easyeda_export_dsn`` opens. The
        classic flow is: export a DSN, route it in an external
        autorouter, import the SES back. Only the outward half existed,
        so the loop stopped halfway.

        DESTRUCTIVE, and differently so per kind. A session file or an
        autoroute JSON replaces the board's ROUTING; an autolayout JSON
        replaces the PLACEMENT of every component. Whatever is there is
        discarded. Take an ``easyeda_checkpoint`` first.

        The file is read here and sent as base64, because the editor
        runs in a sandbox with no path this server can name. The
        extension rebuilds it as a File. The NAME travels with it, since
        the editor identifies the format by extension, and a name whose
        extension does not match the kind is refused rather than passed
        on: the wrong format is accepted by the editor and produces a
        board nobody asked for.

        NEVER RUN AGAINST A LIVE EDITOR. Built from the published
        signatures, which settle what the call expects and not what the
        editor does with it.

        Args:
            kind: one of "ses", "route_json", "layout_json".
            path: the file to send.
            confirm: must be true. Nothing happens without it.
kicad_create_footprinttool Create a footprint (.kicad_mod) in a .pretty library from a list ofFilesoutside textReads/writes files
Create a footprint (.kicad_mod) in a .pretty library from a list of
        pads. Each pad: {number, x_mm, y_mm, w_mm, h_mm, shape (rect/roundrect/
        circle/oval), type (smd/thru_hole), drill_mm (thru_hole only)}.

        Writes a new file (does not touch the open board). Set render=true to
        validate it by exporting an SVG via kicad-cli.
kicad_create_footprint_from_packagetool Create a COMPLETE .kicad_mod footprint from a package drawing.Filesoutside textReads/writes files
Create a COMPLETE .kicad_mod footprint from a package drawing.

        Written into a .pretty library. The lands come from IPC-7351B for the package's terminal
        dimensions and tolerances (the engine behind
        lib_create_footprint_from_package). Writes pads (roundrect with
        roundrect_rratio, circle, oval, rect; drills, oval slots,
        np_thru_hole), paste windows over an exposed pad as unnumbered
        F.Paste pads with the pad's own paste left out, silkscreen kept
        clear of copper with a pin 1 dot on F.SilkS, the body outline and
        ${REFERENCE} on F.Fab, and the courtyard on F.CrtYd. Origin at
        the package centroid; KiCad's Y axis points down, so Y is flipped.
        No 3D body: KiCad draws one only from a model file.

        The written file is parsed back and every pad compared with the
        model (count, centre, size, drill, slot); a difference makes ok
        false.

        Args:
            library_path: the .pretty directory (created if missing).
            package: the PackageSpec as an object or JSON text, in mm,
                the same schema as lib_create_footprint_from_package.
            name: footprint name; default the package's name.
            density: L, N or M; default the package's own (N).
            description: appended to the generated description.
            tags: KiCad keyword tags.
            drafting: drafting rule overrides.
            overwrite: replace an existing footprint of the same name.
                Off by default: a footprint in a library may already be
                on boards.
            render: export an SVG with kicad-cli to look at.
kicad_create_symboltool Create a schematic symbol in a .kicad_sym library. Each pin:Filesoutside textReads/writes files
Create a schematic symbol in a .kicad_sym library. Each pin:
        {number, name, x_mm, y_mm, angle (0/90/180/270), type (input/output/
        bidirectional/passive/power_in/...), length}. If the library file
        exists the symbol is inserted into it, otherwise a new library is
        created. Writes a file (does not touch the open design). render=true
        validates it via kicad-cli.
kicad_export_drilltool Generate Excellon drill files into a directory.Reads/writes files
Generate Excellon drill files into a directory.
kicad_export_dxftool Plot the given board layers to DXF (mechanical CAD) files.Reads/writes files
Plot the given board layers to DXF (mechanical CAD) files.
kicad_export_gerberstool Plot Gerber files for every board layer into a directory.Reads/writes files
Plot Gerber files for every board layer into a directory.
kicad_export_postool Generate a component position (pick-and-place) file.Reads/writes files
Generate a component position (pick-and-place) file.
kicad_export_stackup_csvtool Write the board stackup (layer, type, material, thickness, Er,Reads/writes files
Write the board stackup (layer, type, material, thickness, Er,
        loss tangent) to a CSV file and return its path and rows.
kicad_generate_fab_packagetool Write a fabrication package from the board as it stands in theReads/writes files
Write a fabrication package from the board as it stands in the
        editor (unsaved edits included): Gerbers and Excellon drill files
        (zipped with zip_gerbers), a position file (CSV, mm) and a BOM (CSV,
        from the schematic file). Returns every file written and any step
        that failed.
kicad_generate_pcbtool Generate a KiCad board (.kicad_pcb) from a DesignPlan: declares theFilesCredentialsSensitive pathsoutside textReads/writes files
Generate a KiCad board (.kicad_pcb) from a DesignPlan: declares the
        nets and places a footprint per part with pads assigned to those nets.
        The PCB side of design-execution; the output opens in pcbnew with the
        ratsnest ready to route. Writes a new file.

        A part whose footprint is not found in KiCad's libraries gets a
        generated placeholder box instead; those parts are listed in
        ``placeholder_footprints`` and named in ``warning``.
kicad_generate_projecttool Generate a complete, openable KiCad project from a DesignPlan:FilesCredentialsSensitive pathsoutside textReads/writes files
Generate a complete, openable KiCad project from a DesignPlan:
        <name>.kicad_pro + <name>.kicad_sch + <name>.kicad_pcb in output_dir.
        The full design-execution deliverable (real symbols/footprints where
        resolvable, placement, net assignment, board outline). Parts given a
        placeholder footprint box are listed in ``placeholder_footprints``.
kicad_generate_schematictool Generate a KiCad schematic (.kicad_sch) from a DesignPlan: embeds aFilesCredentialsSensitive pathsoutside textReads/writes files
Generate a KiCad schematic (.kicad_sch) from a DesignPlan: embeds a
        box symbol per part, places every part on a grid, and carries net
        connectivity via global labels. The KiCad counterpart of Altium's
        design-execution (schematic side); the output opens in Eeschema.
        Writes a new file. render=true validates it via kicad-cli.
kicad_get_board_texttool The whole board in KiCad's file format as it stands in the editor,Reads/writes files
The whole board in KiCad's file format as it stands in the editor,
        unsaved edits included. With output_path it is written there and
        only the path and size come back.
kicad_lib_copytool Copy a symbol or footprint (kind) within a library or into anotherReads/writes files
Copy a symbol or footprint (kind) within a library or into another
        (to_library, an existing .kicad_sym or .pretty, by nickname or
        path), as new_name (default: the same name).
kicad_lib_deletetool Delete symbols or footprints (kind) from a library. A symbol thatReads/writes files
Delete symbols or footprints (kind) from a library. A symbol that
        others extend is refused.
kicad_lib_list_itemstool The symbols in a .kicad_sym library, or the footprints in aReads/writes files
The symbols in a .kicad_sym library, or the footprints in a
        .pretty library (kind), by nickname or path: name, description,
        keywords, footprint (symbols), pad count, and pin count. filter keeps
        names containing it (case-insensitive).
kicad_lib_renametool Rename a symbol or footprint (kind) in its library. Symbols thatReads/writes files
Rename a symbol or footprint (kind) in its library. Symbols that
        extend it follow. Placed copies in schematics and boards keep the
        old name until updated from the library.
kicad_lib_set_symbol_propertiestool Set properties of library symbols. Each item: library, name,Reads/writes files
Set properties of library symbols. Each item: library, name,
        properties {name: value, or null to remove}: Value, Footprint,
        Datasheet, Description, ki_keywords, ki_fp_filters, or any field
        (MPN, Manufacturer: added hidden).
lib_build_integrated_librarytool Package libraries into a LibPkg and compile it to an IntLib.Reads/writes files
Package libraries into a LibPkg and compile it to an IntLib.

        Through Altium, end to end: the .LibPkg is created when it does
        not exist, each source library (.SchLib, .PcbLib, ...) is added to
        it, and the package is compiled. The IntLib Altium writes to
        "Project Outputs for <package>" is then looked for, and
        ``built`` is true only when a NEW file is there, so a compile
        that produced nothing is not reported as done. ``install`` adds
        the IntLib to the installed libraries.

        Args:
            package_path: the .LibPkg to create or update (full path).
            source_libraries: full paths of the libraries to package.
            install: install the compiled IntLib.
lib_easyeda_importtool Convert an EasyEDA / LCSC part to KiCad files or an Altium planFilesNetworkEnv varsoutside textReads/writes files
Convert an EasyEDA / LCSC part to KiCad files or an Altium plan
        (own converter, from EasyEDA's published format).

        Args:
            lcsc_id: fetch online, e.g. "C7420".
            payload_path: or read a saved component JSON (offline).
            target: "inspect" parses only (use first on an unfamiliar
                part); "kicad" writes ``.kicad_sym`` and ``.kicad_mod``
                into ``output_dir``; "altium" returns an ordered plan of
                this server's lib_* tools that recreates the part in
                ``schlib_path`` / ``pcblib_path``. Nothing is written to
                Altium; review the plan, then run the steps
                (tool_invoke).
            schlib_path, pcblib_path: required for target="altium".
            output_dir: required for target="kicad".
            symbol_name, footprint_name: override the part's own names.
            include_body_art: also draw the symbol body; False gives
                pins only.
            fetch_3d: kicad only; fetch the 3D model as a ``.wrl`` the
                footprint references (Altium needs STEP, not VRML).

        An imported footprint is a vendor drawing, not ground truth:
        audit it with ``lib_audit_footprint_vs_datasheet``. Polygon pads
        and slotted holes are reported in ``warnings``.

        Returns:
            {"ok": ..., "component": {...}, "warnings": [...]} plus
            "files" (kicad) or "steps"/"summary" (altium).
lib_export_3d_modeltool Write the STEP model of a footprint's 3D body to a file, through Altium.Reads/writes files
Write the STEP model of a footprint's 3D body to a file, through Altium.

        Altium re-encodes the model, so this gives the GEOMETRY, not the
        vendor's file: lib_extract_embedded_models gives the original
        bytes. Use this one for an unsaved library or a linked model.

        Args:
            footprint_name: The footprint whose model to write.
            out_path: Full path of the .step file to write.
            library_path: The .PcbLib. Defaults to the focused library.
            body_index: Which STEP body, 1-based, when a footprint has
                several.

        Returns:
            ``written`` (a new file is at out_path), ``model`` (the model
            file name Altium holds), ``footprint`` and ``out_path``.
lib_extract_cse_ziptool Extract a Component Search Engine zip and build its install plan.Filesoutside textReads/writes files
Extract a Component Search Engine zip and build its install plan.

        Writes the .SchLib, .PcbLib and STEP into ``dest_dir`` and returns
        an ordered ``install_plan`` of ``lib_install_library`` /
        ``lib_link_footprint`` / ``lib_link_3d_model`` calls; run them in
        order. A member with an absolute path, drive letter or ``..``
        rejects the WHOLE archive before anything is written.

        Args:
            zip_path: Absolute path to the downloaded zip.
            dest_dir: Where to stage the files. Default:
                ``<workspace>/cse_imports/<zip stem>``.

        Returns:
            ``{"ok": True, "mpn", "files": [abs paths], "extracted":
            {"schlib"/"pcblib"/"step": abs path or None}, "install_plan":
            [{"tool", "params"}]}`` or ``{"ok": False, "reason": "..."}``.
lib_generate_ipc_batchtool Make PcbLibs from an IPC footprint batch table with Altium'sProcessesFilesEnv varsoutside textReads/writes files
Make PcbLibs from an IPC footprint batch table with Altium's
        own batch generator, for any package family it has a template
        for (lib_ipc_batch_template gives the columns).

        A .csv or .xls table is checked against its family's template
        first: the family in A1, every column name, the required package
        columns filled. Every footprint is then read back: pad count, the
        table's row count, errors in Altium's report, and with
        require_step its STEP body, extracted and checksummed. Naming
        follows Altium's saved batch preferences.

        Args:
            input_file: Absolute path of the .csv, .xls or .xlsx table.
            output_dir: A new or empty folder; nothing is overwritten.
            require_step: Ask for STEP bodies and fail without them.
            remove_designator: Delete the Designator text, refused when
                other text shares its layer.
            timeout: Seconds, 10 to 600.

        Returns:
            ``ok``, ``stage`` (where it stopped), ``libraries`` with each
            footprint, and the ``reports``.
lib_kicad_importtool Convert a KiCad .kicad_sym / .kicad_mod into an Altium plan.Filesoutside textReads/writes files
Convert a KiCad .kicad_sym / .kicad_mod into an Altium plan.

        target="altium" returns an ORDERED PLAN of this server's library
        tools, like lib_easyeda_import; nothing is written until you run
        the steps. target="inspect" only parses. A multi-unit symbol
        becomes one Altium multi-part symbol; hidden pins stay hidden;
        derived symbols take their parent's geometry. Audit a converted
        footprint with ``lib_audit_footprint_vs_datasheet`` before
        trusting it.

        Args:
            symbol_path, footprint_path: the KiCad files; give either or
                both.
            symbol_name: one symbol of a multi-symbol library; default
                the first.
            target: "altium" (default) or "inspect".
            schlib_path, pcblib_path: destination libraries, required
                for target="altium".
            include_body_art: also draw the symbol body; False gives
                pins only.
            unit: convert only this sub-part (0 = all).
            model_3d_path: a resolved 3D model file to link (for example
                from part_fetch).

        Returns:
            ``{"ok": ..., "component": {...}, "warnings": [...]}`` plus
            "steps"/"summary" for target="altium".
lib_library_managertool Ask Altium's own library manager about a library or a part.Reads/writes files
Ask Altium's own library manager about a library or a part.

        Args:
            action: ``locate`` (where Altium finds ``component``, in
                ``library`` or across the installed ones when it is
                empty), ``contents`` (the parts of the library at
                ``library``, a full path, with model counts, whether each
                has a footprint and its first datafile; Altium reads only
                a library it has installed or an open project uses, and
                ``known_to_manager`` says which), or ``extract``
                (an IntLib at ``library`` back into its source libraries,
                in ``destination``).
            library: A library name for locate, a full path otherwise.
            component: The part, for locate.
            destination: The folder for extract.
            limit: The most parts contents lists (default 500).
lib_save_footprint_librarytool Write one footprint of a PCB library to a new .PcbLib of its own.Reads/writes files
Write one footprint of a PCB library to a new .PcbLib of its own.

        Args:
            footprint_name: The footprint.
            out_path: Full path of the .PcbLib to write; never the source.
                On Altium 25 and later an existing file is written over; on
                older versions it must be a new file.
            library_path: The source library. Defaults to the focused one.

        Returns:
            ``written`` (a new file is at out_path) and ``reported``
            (whether the new destination was saved).
part_fetchtool Fetch one part's detail, by the ``ref`` a search returned.FilesNetworkEnv varsoutside textRequests any address
Fetch one part's detail, by the ``ref`` a search returned.

        The ``ref`` is ``provider:part_id``; pass it through. A bare id
        with no ``provider`` and no known prefix is refused, never
        guessed; ``provider`` wins over a prefix.

        ``download_dir`` also writes the provider's library files there.
        A downloaded KiCad file in a newer format than the local KiCad
        reads comes back with a ``*_warning`` entry.

        Returns the provider's own detail plus a normalised summary
        (mpn, manufacturer, datasheet, provenance, license) where the
        provider supplies one, and ``files`` when a download was asked
        for.
pcb_apply_geometry_maptool Move and reshape thousands of free primitives in ONE pass, from aFilesoutside textReads/writes files
Move and reshape thousands of free primitives in ONE pass, from a
        JSON map of each object's CURRENT geometry and its new one.

        Use it past a few hundred objects, where obj_modify with items is
        slow.
        Each entry is matched to exactly one object within the tolerance;
        none, several, or one object named twice is reported, never
        guessed, and an object changed since the dump is left alone. Free
        primitives only (not in a component, pour or dimension): move
        components with pcb_move_components.

        The map (mils, absolute board coordinates)::

            {"tracks":   [{"layer", "width", "key": [x1,y1,x2,y2],
                           "new": [x1,y1,x2,y2], "new_width"?}],
             "arcs":     [{"layer", "width", "key": [cx,cy,r,start,end],
                           "new": [cx,cy,r,start,end], "new_width"?}],
             "vias":     [{"key": [x,y], "new": [x,y]}],
             "texts":    [{"layer", "key": [x,y,text], "new": [x,y,text?]}],
             "fills":    [{"layer", "key": [x1,y1,x2,y2], "new": [...]}],
             "regions":  [{"layer", "key": {"n", "first": [x,y], "holes"},
                           "contour": [[x,y],...], "holes": [[[x,y],...],...]}],
             "polygons": [{"layer", "key_first": [vx,vy], "segments": [seg]}],
             "board_outline": [seg] or {"segments": [seg]},
             "delete":   [{"kind": "track"|"arc", "layer", "width", "key"}
                          | {"kind": "region", "layer", "key": {"n", "first", "holes"}}
                          | {"kind": "via", "key": [x,y]}
                          | {"kind": "polygon", "layer", "key_first": [vx,vy]}],
             "create":   [{"kind": "track"|"arc", "layer", "width",
                           "geom": [x1,y1,x2,y2] | [cx,cy,r,start,end],
                           "net"?, "keepout"? (default true on KeepOutLayer), "stub"?}
                          | {"kind": "region", "layer", "contour": [[x,y],...],
                           "net"?, "teardrop"?, "keepout"?}
                          | {"kind": "via", "x", "y", "size", "hole", "net"?}
                          | {"kind": "polygon", "layer", "contour": [[x,y],...],
                           "net"?, "name"?, "order"?, "pour_over"? (true)}]}

        A seg is {"kind": 0, "vx", "vy"} (line) or {"kind": 1, "vx", "vy",
        "cx", "cy", "r", "sa", "ea"} (arc). Track ends match in either
        order. A region's outline and holes are replaced whole: any
        number of holes, each of any vertex count. Polygons match by layer and
        first vertex. A repour also deletes free regions lying in the pour,
        teardrops included, so create those after the last repour. ``components`` entries
        are counted and ignored. A delete is matched like a move (an
        object both moved and deleted is refused). Identical objects need
        one identical entry per copy; fewer entries than copies is
        ambiguous and deletes none. Creates are free, on
        the layer named, each with an optional ``net``; a net the board
        lacks creates nothing and is listed in ``apply.create_refused``
        with the map ``entry``. A via is a through via. A polygon pour is made but NOT poured: pour many
        with pcb_repour_polygons afterwards (small ones first); ``order``
        sets its pour index (``pour_order_off`` counts any that did not
        take). Copper fills that are rotated or not rectangular are best
        sent as regions. A created region takes, with ``teardrop``,
        Altium's teardrop flag. THIS IS THE BULK COPPER CREATE: one file,
        one transaction. A value past +/-214,748 mil (an arc's
        centre plus radius included) stops the whole apply before anything
        is sent, since Altium's coordinates cannot hold it; ``out_of_range``
        counts them per kind. Draw a near-straight arc as a line.

        Args:
            map_path: The JSON map.
            board_path: The .PcbDoc to change (required; refused unless
                that file is the board Altium opens).
            tolerance_mil: Allowed distance per coordinate and width.
            angle_tolerance_deg: The same for arc angles, modulo 360.
            dry_run: Dump and match only. Run this first.
            repour: Repour each reshaped polygon. False leaves pours for
                pcb_repour_polygons (small ones first, big hatched once).
            region_shape: For regions that carry shape segments (what
                Altium draws): "rebuild" (default) rewrites them from the
                new outline; "clear" drops them; "keep" leaves the OLD
                shape on screen.
            kinds: Dump only these kinds, comma-separated (track, arc,
                via, text, fill, region, polygon); empty is every kind.
                A map that edits one layer's tracks need not have the
                whole board dumped first.
            layer: Dump only these layers, comma-separated (any layer
                name, Mechanical17 and up included); empty is every layer.
                The apply pass walks the same kinds and layers, so
                entries outside them are unmatched, never applied
                elsewhere.
            nets: Dump only objects on these nets, comma-separated (an
                object with no net is left out).
            selected: Dump only selected objects.
            name: Dump only polygons of this name (exact, or a prefix
                ending in ``*``); other kinds are not affected.
            bounds: Dump only objects whose box touches this area,
                ``"x1,y1,x2,y2"``.
            nets, selected, name and bounds only decide what is written
            of the walk: the ordinals still count every walked object, so
            the apply pass needs nothing for them.

        Returns:
            {"board", "dry_run", "match": {kind: {entries, matched,
            unmatched, ambiguous, refused, samples?}}, "apply": {applied,
            stale, missing, region_readback_off, track_arc_readback_off,
            region_bbox_off, region_shapes_changed, deleted, created,
            create_failed, create_readback_off, teardrops_created,
            by_kind}}. Any nonzero ``*_off`` means something did not read
            back as written (a track's or arc's ends, radius or width
            included); ``by_kind.O.open`` 1 means the
            outline's closing vertex did not read back on its first. A dry run keyed on the new
            geometry shows what landed.
pcb_autoroute_applytool Write a finished ``pcb_autoroute`` job's tracks and vias to the board.Filesoutside textReads/writes files
Write a finished ``pcb_autoroute`` job's tracks and vias to the board.

        Refuses while the job has findings (its review's rules measured on
        the copper, and the judgements that are yours) you have not
        answered: route again, or accept each with ``accept``. An answer
        given before on this board to the same finding stands. With
        Routing discipline advisory on the Config tab (the user's choice)
        it writes and lists them in ``unanswered``; off, it writes.

        Refuses unless the focused board is ``expect_file``. With
        ``checkpoint`` (default), first snapshots the board's folder as it
        is ON DISK, so it can be restored with ``app_restore_checkpoint``.
        Nothing is saved first: unsaved edits in the editor are not in the
        checkpoint, so save the board yourself beforehand if it has any.
        Coordinates, widths and via sizes keep their decimals.

        Args:
            job_id: a ``layout_route`` job that has finished.
            expect_file: full path of the board the job routed.
            checkpoint: take a checkpoint first (default True).
            repour: repour the board's polygons afterwards when the job
                relied on them, as planes or as pours joining a net, or
                routed through their old poured copper (default True). A
                poured net's connections are not there, and the new copper
                is not cleared, until the polygons are repoured round it.
            accept: answers to findings, each {id, reason}. {check,
                reason} answers every finding of a judgement check
                (detour, vias, angle, pad_entry) or of unrouted / held; a
                brief rule the copper breaks is answered by id. The
                reason is kept with the board's brief.

        Returns:
            ``{"tracks": {placed, failed}, "vias": {placed, failed},
            "checkpoint": ..., "repoured": bool, "via_in_pad": [...],
            "decisions": [...], "notes": [...]}``, ``{"error": ...,
            "unanswered": [...]}`` or ``{"error": ...}``. ``via_in_pad`` lists the
            vias written into pads (BGA balls, exposed pads), which the
            fabrication notes must ask to be filled and capped.
pcb_build_from_projecttool Build the PCB's net set and pad connectivity from the netlist.ProcessesFilesoutside textReads/writes files
Build the PCB's net set and pad connectivity from the netlist.

        The scripted stand-in for the ECO's netlist transfer: creates the
        missing nets and binds every pad from the compiled netlist, in two
        calls. It does NOT place footprints: place parts with
        `pcb_place_components` first, then run this, then check with
        `proj_compare_sch_pcb`.

        Args:
            netlist_csv_path: Optional path to a tabular netlist CSV
                written by ``proj_export_netlist(net_format="tabular")``
                (``component,pin,pin_name,net`` rows). Empty (default) =
                pull the compiled netlist from the open project directly.

        Returns:
            Dict with ``components`` (distinct designators in the
            netlist), ``nets_created``, ``nets_existing``, ``pads_bound``,
            ``failed``, plus the ``missing_components`` /
            ``missing_pads`` / ``missing_nets`` lists from the bind step.
pcb_cleanup_trackstool Tidy stray track geometry: delete slivers and/or merge collinear runs.Filesoutside textReads/writes files
Tidy stray track geometry: delete slivers and/or merge collinear runs.

        Modes:
        - "slivers" (default): delete every track shorter than
          min_length_mils. Catches the zero/near-zero stubs left behind by
          editing.
        - "merge": join two collinear, same-layer, same-width, same-net tracks
          that meet end to end into a single track. The merge only fires when
          the shared point is a clean degree-2 junction (exactly those two
          track ends, with no via, pad, arc, or third track present), so it is
          safe to run on routed copper without breaking connectivity.
        - "both": slivers pass, then merge pass.

        A straight chain of any number of tracks becomes one track. Free
        tracks on every layer are taken; a footprint's own, a pour's and a
        dimension's are not. The whole change is one edit in Altium.
        Stepped runs are pcb_tidy_tracks' work, not this tool's.

        Args:
            mode: "slivers", "merge", or "both" (default "slivers").
            min_length_mils: Sliver threshold (default 1).
            dry_run: Work the change out and match it to the board
                without writing it.

        Returns:
            {"slivers_deleted", "merged", "mode", "tracks" (looked at),
            "joints_kept" (straight joints left alone, by why: junction,
            pad, via, arc, third_track, net_unknown), "map" (what was
            matched and applied)}.
pcb_export_component_3dtool Write a placed part's 3D model to a STEP file.Reads/writes files
Write a placed part's 3D model to a STEP file.

        The part's own bodies as placed on the board, through Altium.

        Args:
            designator: The part, e.g. "U3".
            out_path: Full path of the .step file.

        Returns:
            ``written`` (a new file is at out_path) and ``reported``
            (what Altium said).
pcb_export_component_modeltool Write one placed part's 3D model, as it sits on the board, toReads/writes files
Write one placed part's 3D model, as it sits on the board, to
        a STEP file. No dialog.

        proj_export_step writes the whole board; lib_export_3d_model
        writes a model from a library footprint.

        Args:
            designator: The part, e.g. "U1".
            out_path: Full path of the .step file to write.

        Returns:
            ``saved`` (what Altium answered) and ``written`` (a file is
            at out_path that was not there before, or is newer).
pcb_make_librarytool Make a PCB library of every footprint on a board, and save it.Reads/writes files
Make a PCB library of every footprint on a board, and save it.

        Altium's Design > Make PCB Library, which runs with no dialog.
        Altium names the library after the board, with a digit added
        when that name is taken, and leaves an empty file of that name
        until it is saved; with ``out_path`` the library is saved there
        instead and that empty file is removed. The saved library is then
        closed, because until it is reopened its footprints read in the
        board's frame.

        Args:
            out_path: Full path of the .PcbLib to write. Empty keeps
                Altium's name beside the board. An existing file is
                refused.
            add_to_project: Add the library to the board's project.
            board_path: The .PcbDoc. Defaults to the focused board.

        Returns:
            ``library`` (where it was saved), ``saved``, ``bytes``,
            ``footprint_count``, ``footprints``, ``made_as`` (Altium's
            name for it), ``added_to_project`` and ``closed``.
pcb_make_pad_via_librarytool Write a board's pad and via templates to a new .PvLib file.Reads/writes files
Write a board's pad and via templates to a new .PvLib file.

        A new pad/via library is made, each template of the board's own
        library is copied into it, and it is saved; Altium puts one
        default template in every new pad/via library, so that one is
        there too. The saved library is closed, and ``install`` then adds
        it to the installed pad/via libraries, read back from that list.

        Args:
            out_path: Full path of the .PvLib to write; an existing file
                is refused.
            install: Install the new library.
            board_path: The .PcbDoc. Defaults to the focused board.

        Returns:
            ``board_templates``, ``copied``, ``saved``, ``closed``,
            ``installed`` and ``templates`` (the new library's, read back).
pcb_place_trackstool Place many track segments on the active PCB in ONE IPC round-trip.Filesoutside textReads/writes files
Place many track segments on the active PCB in ONE IPC round-trip.

        One Altium transaction for the whole list. Past a few hundred,
        pass ``file`` instead, or create them with pcb_apply_geometry_map.

        Args:
            tracks: List of track dicts. Each dict supports:
                x1, y1, x2, y2 (required, mils; decimals are kept)
                width (default 10, mils; decimals are kept, so a 0.1 mm
                rule stays 3.937), layer (default "TopLayer"; "current" =
                the editor's current layer, see pcb_layer_view),
                net_name (optional, empty = no net; a net the board does
                not have skips the track), stub (true marks a track
                shorter than its width as a real stub into a pad or via)
            board_path: The board to place on, taken by its path and
                refused when it is not open; empty acts on the board in
                front, which another session can change between calls.
            file: A JSON file holding the same list, or an object with it
                under "tracks"; in place of tracks.

            Example:
                [
                  {"x1": 5010, "y1": 4785, "x2": 5070, "y2": 4785,
                   "width": 10, "net_name": "NetC8_2"},
                  {"x1": 5070, "y1": 4785, "x2": 5070, "y2": 4862,
                   "width": 10, "net_name": "NetC8_2"},
                ]

        Returns:
            Dictionary with "placed" and "failed" counts, "zero_length"
            (tracks not placed because both ends are the same point),
            "unknown_layers" and "unknown_nets" naming what did not
            resolve, and, when any track took "current", "current_layer"
            and "on_current_layer". Nothing is placed, with error
            STAIRCASE_TRACKS or SHORT_TRACKS, when the tracks on a net
            hold a run drawn as a chain of tiny steps, or a track shorter
            than its own width that is not marked a stub.
pcb_render_3dtool A photographic picture of the active board, raytraced: solderReads/writes files
A photographic picture of the active board, raytraced: solder
        mask over raised copper, finish, silkscreen, drills, edges, the
        parts with their solder joints, studio light, shadows and a lens.

        This is eda-agent's 3D picture; flat 2D pictures of the board
        are pcb_render_png and pcb_render_svg. Ask the user which backdrop
        they want before the first render: called without ``background``
        it reads nothing and returns ``choices`` to put to them.

        Read-only. The parts come from Altium's STEP export of the board,
        written to the renders folder and read with CadQuery's kernel
        (``pip install eda-agent[models3d]``). Angled views need the path
        tracer (``pip install eda-agent[render3d]``); top and bottom work
        without it, flat-shaded.

        Args:
            view: top, bottom, iso, iso_back, iso_bottom, front, back,
                left or right.
            output_path: PNG path; default the workspace renders folder.
            width, height: Pixels.
            quality: draft (fast), normal or high (smooth shadows).
            azimuth, elevation: Degrees, overriding the view's camera:
                azimuth 0 looks along +Y, elevation 90 straight down.
            zoom: 1 (default) shows everything drawn, in the middle of
                the picture with an even margin; above 1 frames closer.
            mask_color: green, black, blue, red, white, purple, yellow,
                matte_black or matte_green.
            finish: enig, hasl, osp or bare.
            silk_color: white, black or yellow.
            background: The backdrop, the user's choice: studio (a white
                sweep), charcoal (the dark fibre mat of a photo bench),
                desk (an oak-melamine worktop), esd_mat (a blue-grey bench
                mat), black (matte), transparent, a colour like
                "#202428", or the path of the user's own photo of a
                surface, seen from above.
            backdrop_width_mm: How wide the area in that photo is, so it
                is laid at its real size.
            show_components: Draw the fitted parts and their solder.
            depth_of_field: 0 all sharp; 0.15 (default) as a phone
                camera sees a board, and up to 2 blur what
                is nearer or farther than the board's middle, more as
                ``zoom`` comes closer, as a macro lens does.

        Returns:
            ``ok``, ``path``, ``renderer``, ``seconds``, ``board_mm``,
            ``thickness_mm``, ``parts`` (how many were drawn), ``notes``,
            and for the review: ``realism_checks``, ``models``
            (``parts_without_a_model``, ``placeholder_models``) and
            ``next_step``. Look at the picture against the checks and
            propose what would make it more real; ask the user before
            changing any 3D model.
pcb_render_pngtool Draw the board as Altium itself draws it, into a PNG file.Reads/writes files
Draw the board as Altium itself draws it, into a PNG file.

        Altium's own renderer, so the picture is the board as the editor
        shows it (layers, colours, the view configuration), not a redraw
        from read-back data like ``pcb_render_svg``.

        Args:
            path: Full path of the .png to write.
            dpi: 25 to 2400 (default 300).
            side: ``top`` or ``bottom``.
            config_type, config: A view configuration to draw with; empty
                uses the board's current one.

        Returns:
            ``written`` (a new file is there), ``size_bytes``,
            ``return_code`` (Altium's) and ``problem``.
pcb_save_board_texttool Write the whole board to a JSON or ASCII text file, for diffs.Reads/writes files
Write the whole board to a JSON or ASCII text file, for diffs.

        Altium's own text form of the board, written to a separate file:
        the board document is not saved, renamed or marked changed
        (``board_name_kept`` confirms it). Two dumps of the same board
        compare line by line, which a binary PcbDoc does not.

        Args:
            path: Full path of the file to write; never the board itself.
            format: ``json`` or ``ascii``.
pcb_save_copy_astool Write the open board to another path, as File > Save Copy As.Reads/writes files
Write the open board to another path, as File > Save Copy As.

        The target gets the board as it is in Altium, unsaved edits
        included; the open document keeps its path, project and modified
        state. An existing target is overwritten, after Altium saves it
        as ``<target>.bak`` with ``backup`` (default); a target open in
        Altium is refused. The copy joins no project.

        Args:
            target_path: Full path of the .PcbDoc to write.
            source_path: The open board to copy. Empty uses the focused
                board, or the only one open; several open with none
                focused is refused rather than guessed.
            backup: Keep the overwritten target as ``<target>.bak``.

        Returns:
            {"source", "target", "target_existed", "written",
            "open_board_path", "backup"} or an error. ``written`` is read
            from the target's file time, not assumed.
pcb_tidy_trackstool Lay the board's free tracks again as the shortest clean 45/90 runs.Filesoutside textReads/writes files
Lay the board's free tracks again as the shortest clean 45/90 runs.

        Each run between fixed points (pads, vias, arcs, junctions, width
        changes) becomes the shortest octilinear path that turns 90 degrees
        or less, leaves and enters a surface pad from its centre along a pad
        axis, crosses no other pad of its net, keeps every join it had, and
        clears every other net, the board edge and keep-outs by the board's
        rules. A run is changed only when it gets shorter, or as short with
        fewer bends. The board's pcb_route_brief holds too: its areas,
        spacings and barriers, and each net's region and keep-outs. Footprint tracks and arcs are left as they are. Altium's
        own Gloss is pcb_gloss.

        Args:
            board_path: The .PcbDoc; refused if another board is focused.
            nets: Only these nets (default every net).
            layers: Only these copper layers (default every signal layer).
            dry_run: Work out and match the changes without writing them.

        Returns:
            ``gloss`` (runs, relaid, length and bends before and after,
            nets), ``removed`` and ``added`` track counts, and ``map``:
            what matched on the board and, when written, what was applied.
proj_convert_to_kicadtool Export a KiCad copy of an Altium project, for sharing or review.Reads/writes files
Export a KiCad copy of an Altium project, for sharing or review.

        For handing a design to someone who works in KiCad, or reading it
        there; the Altium project stays the design. KiCad's own Altium
        importer brings the project in (kicad.exe is driven through its
        import dialogs). The copy is then tidied so it can be used as it
        is:
        - one symbol per part in project libraries;
        - power ports as power symbols;
        - Value, Footprint and Datasheet filled in;
        - sheets on the 1.27 mm grid, wire stubs trimmed;
        - a flat project given a root sheet;
        - board nets named as the schematic names them;
        - rules, stack-up and net classes read from the open Altium board;
        - footprints in project libraries, mechanical layers mapped by kind;
        - pours filled with Altium's neck width and island removal;
        - Altium's variants as KiCad variants (not fitted = DNP, varied
          values as field values).
        The Altium files are only read.

        Every step is checked against the pin-to-net map. ``ok`` is true
        only when the schematic, the board and Altium's own compiled
        netlist put the same pins together. Takes a few minutes: KiCad
        opens on screen while it imports.

        Args:
            output_dir: An empty folder for the KiCad project.
            project_path: The .PrjPcb; empty = the focused project.
            board_path: Its .PcbDoc; empty = the project's only board.
            kicad_cli: kicad-cli.exe; empty = the newest KiCad installed.
            remove_title_block: Take out what each sheet's Altium template
                drew (border, title block, logo), found by the template
                objects' own boxes, so what the user drew stays; KiCad
                draws its own.

        Returns:
            ``ok``, ``project`` (the .kicad_pro), ``steps`` (what each step
            did, with the ``check_*`` pin comparisons, ERC and DRC counts
            and the rules not ported), and ``stage`` / ``reason`` when a
            step stopped it.
proj_export_imagetool Export a schematic sheet or a board to PDF, PNG, JPG or BMP.ProcessesFilesoutside textReads/writes files
Export a schematic sheet or a board to PDF, PNG, JPG or BMP.

        WITH ``document_path``: that .SchDoc or .PcbDoc is printed by
        Altium whatever is in front, loaded or not, with no dialog. A
        temporary one-output OutJob in the bridge's workspace is added to
        the document's project, its PDF container is run, and it is taken
        out again; the project's file and folder are not written, and the
        document in front is put back. Altium may still show the project
        as modified. A board gives two pages, top and bottom mirrored;
        png / jpg / bmp are ``page`` of that PDF at ``dpi``. The project
        must be open; a free document has no route here.

        WITHOUT it: the FOCUSED document, PDF only, through Altium's
        Print, which on some builds opens the print preview and waits.
        An old file at ``output_path`` is deleted first.

        Args:
            output_path: Full path of the file to write; its folder must
                exist. An old file there is replaced.
            format: "pdf" (default), "png", "jpg" or "bmp".
            width, height: Unused.
            document_path: Full path of the .SchDoc / .PcbDoc to print.
            project_path: Its open .PrjPcb, when more than one open
                project lists the document.
            dpi: Picture resolution, 20 to 1200.
            page: The PDF page to draw, from 1.

        Returns:
            With ``document_path``: ``success``, ``output_path``,
            ``format``, ``kind``, ``project_path``, ``pages``,
            ``file_size_bytes``, ``width_px`` / ``height_px`` for a
            picture, ``outjob_removed``, ``restored_front``; ``error`` and
            ``details`` when nothing was written, with ``outjob_left``
            when the temporary OutJob could not be taken out. Without:
            the path, ``file_exists`` and ``file_size_bytes``.
proj_export_jlc_assemblytool Write the BOM and pick-and-place (CPL) files JLCPCB assembly takes.Filesoutside textReads/writes files
Write the BOM and pick-and-place (CPL) files JLCPCB assembly takes.

        BOM: Comment, Designator, Footprint, LCSC Part #, one row per part
        kind. CPL: Designator, Mid X, Mid Y (mm, from the board origin, as
        Altium's own pick-and-place and the Gerbers), Layer (Top/Bottom),
        Rotation (degrees, as Altium shows it). Read from the board and the
        compiled project, so nothing is copied by hand.

        Mid X/Y is each part's ORIGIN: right for a footprint whose origin
        is its centre (every footprint lib_create_footprint_from_package
        makes); a part with its origin elsewhere is placed off by that much.
        Rotations follow Altium; JLC's preview shows each part on its pads,
        so check polarised and bottom-side parts there before ordering.

        Args:
            output_dir: folder for the two files (made when missing).
            lcsc_parameter: the parameter holding the LCSC number. Empty
                tries "LCSC Part #", "LCSC Part Number", "LCSC", "LCSC Part",
                "JLCPCB Part #".
            name: file name stem; default the board's name.
            not_placed: designators meant to be left off the assembly
                (fitted by hand, not fitted). Any other part without an
                LCSC number refuses the export.
            board_path: the .PcbDoc to export. Empty uses the only open
                board; with several open the export is refused until one
                is named.

        Returns:
            ``bom_path``, ``cpl_path``, ``parts``, ``bom_rows``,
            ``without_lcsc`` (designators with no LCSC number) and
            ``origin_mils``.
proj_export_steptool Export a board to a STEP 3D model with Altium's own exporter.Filesoutside textReads/writes files
Export a board to a STEP 3D model with Altium's own exporter.

        First with no dialog, on the options last used in File > Export >
        STEP 3D (``route: "exporter"``). If that writes nothing, through
        File > Export > STEP 3D, answering its three dialogs (``route:
        "dialogs"``, with ``exporter_reason``); any other dialog stops it.
        ``generated`` is true only when a new file is at output_path.

        Args:
            output_path: Full path for the .step file.
            board_path: Focus this .PcbDoc first; it must then be the
                board in front, since the export acts on the front view.
                Omit it to export the board already in front.
            overwrite: Replace an existing file. Off by default, so an
                earlier export is never lost by accident.
            options: Exporter settings to apply first, by the names
                ``proj_step_export_options`` reads (``folded``,
                ``fold_rate``, ``copper_option``, ``holes_option`` ...).
                Altium keeps them for later exports, as the dialog does.
                Applied on the exporter route only.

        Returns:
            ``generated``, ``output_path``, ``size_bytes``, the board that
            was exported (``front_document``) and every dialog answered.
proj_generate_fab_packagetool Generate a fabrication package from an OutJob (Gerbers, NC drill,Filesoutside textReads/writes files
Generate a fabrication package from an OutJob (Gerbers, NC drill,
        IPC-356, pick-and-place, assembly, BOM) and report every file produced.

        Those formats exist only as OutJob containers, so this runs every
        container in the OutJob and lists the files each wrote; STEP and
        DXF are optional extra exports. The OutJob's outputs must already
        be enabled: a script cannot switch them on.

        Args:
            outjob_path: path to the .OutJob; omit to use the first one in the
                focused project.
            include_step: also export a STEP 3D model of the active PCB.
            include_dxf: also export a DXF of the active PCB.
            fresh_window_seconds: files modified within this window before a
                container ran still count as newly produced.
            fab, fab_tier, outer_oz: as proj_run_outjob; nothing is
                generated while the board is outside the fab's limits.

        Returns:
            {"ok", "outjob_path", "containers_run", "results" (per-container
             with output_dir + files), "extras" (step/dxf results),
             "all_files" (flat list of newly-produced file paths)}.
proj_make_schematic_librarytool Make a schematic library of every symbol placed in the project.Reads/writes files
Make a schematic library of every symbol placed in the project.

        Altium's Make Schematic Library, run without its dialogs, then
        saved. One sheet of the project must be loaded
        (proj_load_sheets). The new library stays open in Altium.

        Args:
            out_path: Full path of the new .SchLib.
            add_to_project: Add the library to the project.
            project_path: The .PrjPcb. Defaults to the focused project.

        Returns:
            ``saved``, ``written`` (a new file is at out_path),
            ``sheet`` (the one it ran from) and ``in_project``.
proj_print_all_variantstool Export a PDF for every project variant.Reads/writes files
Export a PDF for every project variant.

        One ``<variant>.pdf`` per variant, each made active in turn; the
        original variant is restored at the end.

        Args:
            output_dir: Folder for the per-variant PDFs. Defaults to the
                workspace directory.
            project_path: Optional project path. If None, uses the focused
                project.

        Returns:
            {"exported": [{variant, output_path, ok, error}], "count"} plus
            ``restored``: the variant put back, or null if putting it
            back FAILED: the project is then on another variant, and any
            variant-sensitive call (a BOM, an export,
            ``pcb_apply_dnp_paste_exclusion``) acts on the wrong set. A
            failure also carries ``restore_error`` and a ``note``.
sch_preview_templatetool Check a schematic template and draw it to a PNG, withoutFilesoutside textReads/writes files
Check a schematic template and draw it to a PNG, without
        touching any sheet. Read the PNG to look at it.

        A template is the sheet planned by hand, every coordinate on the
        grid (mils):

            {"parts": [{"designator": "U1", "lib_reference": "TPS62130",
                        "library_path": "C:/.../Power.SchLib",
                        "x": 3000, "y": 4000, "rotation": 0,
                        "value": "TPS62130"}],
             "wires": [{"net": "VIN",
                        "path": [[2000, 4600], "U1.PVIN"]}],
             "ports": [{"net": "+12V", "at": [2000, 4600], "style": "bar"}],
             "labels": [{"net": "PG", "at": [4200, 3700]}],
             "nets": {"VIN": ["U1.PVIN", "C1.1"]}}

        A path point is [x, y] or a pin anchor "U1.11" / "U1.EN" (the pin's
        wire end, from the symbol). Two points off-axis get one corner,
        horizontal first ("corner": "vh" for vertical first). A part's
        ``"mirror": true`` flips it left to right. Altium adds the junction dots itself
        where a wire ends on another; do not plan any. Ports default to
        style "bar" pointing up, or "gnd_power" pointing down for a net
        containing GND. ``nets`` is the netlist the sheet must produce,
        checked pin by pin.

        REDRAWING a sheet whose parts are on a board: give each part its
        old ``"unique_id"`` (obj_query eSchComponent,
        "Designator.Text,UniqueId", before clearing). sch_draw_template
        sets it and reads it back (``unique_ids``), so the board stays
        linked; without it the redrawn parts are new to the board.

        A MULTI-PART symbol takes one entry per
        part on this sheet, the same designator and symbol with ``"part": 2``
        and so on (absent means 1). Anchors name the designator only:
        "U2.B22" finds the pin on whichever drawn part shows it. With plan
        nets, pins of parts not drawn here are warnings, not errors.

        Args:
            template: as above.
            png_path: where to write the picture; default the workspace's
                renders folder.
            grid: the grid in mils every vertex should sit on.
            plan_json: the DesignPlan, if there is one. Parts then need
                only designator and position (symbol, library and value
                come from the plan) and the plan's nets are checked pin
                by pin. A part the plan lacks is an error.
            sheet: the plan sheet this template draws, to list the plan
                parts it leaves out.
            template_path: a JSON file holding the template, instead of
                passing it inline (a big sheet's template is tens of KB).

        Returns:
            ``ok``, ``errors`` (shorts, overlapping wires, bad anchors,
            netlist differences, a port touching nothing), ``warnings``
            (crossings, a wire through a body, dangling ends, off-grid
            points, stacked labels), ``netlist``, ``unconnected_pins``,
            ``auto_junctions`` and ``preview_png``.
sim_attach_modeltool Attach an external SPICE model file (.mdl / .ckt / .lib) to a component.Filesoutside textReads/writes files
Attach an external SPICE model file (.mdl / .ckt / .lib) to a component.

        Use this after fetching a vendor SPICE model file from the
        manufacturer and saving it locally. The model_name parameter
        must be the exact ``.SUBCKT <name>`` declaration from inside
        the file, not the file name.

        Args:
            designator: Component reference (e.g. "U1").
            file_path: Full path to the locally-saved .mdl / .ckt / .lib.
            model_name: Subcircuit / model name declared inside the
                file. Open the file and look for ``.SUBCKT <name>``
                or ``.MODEL <name>``.
            primitive: SPICE prefix letter. Default "X" (subcircuit).
                Use "D"/"Q"/"M" when the file declares a .MODEL of
                that kind instead of a subcircuit.

        The file is checked first: the model must be declared in it
        (a .SUBCKT for "X", a .MODEL of the element's type otherwise),
        its header comments must name the publisher, and a subcircuit
        may not have more nodes than the part has pins.

        Returns:
            Dict with success, designator, file_path, model_name and
            ``model_check`` (kind, nodes, publisher).
sim_get_resultstool Read a simulation's results: every wave, with sampled points.Filesoutside textReads/writes files
Read a simulation's results: every wave, with sampled points.

        Reads the .sdf that sim_run saved (the last one by default). Each
        wave comes with its unit, point count, min/max/first/last over
        every point, and up to max_points samples evenly spaced from first
        to last. An AC wave reports magnitude and phase in degrees against
        frequency. The sweep variable (time, frequency, the swept source)
        is marked independent.

        Args:
            results_document: path of a .sdf; empty uses the last sim_run.
            analysis: one analysis by name ("Transient Analysis", "AC
                Analysis", "Operating Point", "DC Sweep", ...); empty
                returns all.
            waves: wave names to keep, e.g. ["v(out)", "i(v1)"]; empty
                keeps all.
            max_points: samples per wave; 0 returns statistics only.
            all_runs: a document run more than once holds every run; by
                default only the latest run of each analysis is returned.

        Returns:
            Dict with results_document and analyses: a list of
            {analysis, waves: [...]}, or an error naming what is missing.
sim_get_setuptool What a simulation run would do: the analyses on and their settings.Filesoutside textReads/writes files
What a simulation run would do: the analyses on and their settings.

        Reads the project's .simcfg as Altium last saved it (its edits in
        the dashboard are saved first). Altium uses a sheet's own settings
        when ``affect`` is Document and the project's when it is Project;
        ``source`` says which were read.

        Args:
            sheet: the schematic to report for; empty uses the sheet in
                front.
            project_path: the project; empty uses the focused one.

        Returns:
            Dict with simcfg, affect, source, enabled (of op, dc,
            transient, ac), other_enabled (any other analysis switched
            on), settings (per enabled analysis: its sweep or times and
            its output expressions), sheets with settings of their own,
            and results (each recorded run: name, type, date, locked).
sim_run_decktool Run a SPICE deck in Altium's simulator; the waves open as a chart.Filesoutside textReads/writes files
Run a SPICE deck in Altium's simulator; the waves open as a chart.

        The way to simulate a circuit that is not a schematic of parts with
        simulation models: a hot-plug, an inrush, a supply under a load
        step. Write it as plain SPICE (elements, models, one analysis such
        as .TRAN, a .PLOT line per analysis naming the waves to chart, and
        .END). Altium opens the results as a chart in front, and the reply
        gives each wave's figures. Passive and source values are yours to
        state; an IC's behaviour needs its vendor's model (SPICE_MODEL_RULES).

        A schematic of your own symbols does not run through sim_run: each
        part needs a simulation model link, and the parameters
        sim_attach_primitives writes are not one (Altium answers "Missing
        component models").

        Args:
            deck: the SPICE text, e.g. "* hot-plug\\nV1 in 0 PULSE(0 5 10u
                1u)\\nR1 in out 0.25\\nC1 out 0 22u\\n.TRAN 1u 2m\\n.PLOT TRAN
                V(out)\\n.END".
            file_path: where to write it: a full path ending in .nsx, in
                the project's folder. An existing deck there is replaced.

        Returns:
            ``ran``, ``deck``, ``results_document`` (the .sdf), and
            ``results`` per analysis per wave (unit, points, min, max,
            first, last); sim_get_results gives the traces.
sim_setup_analysistool Set the analyses sim_run will use, in the project's .simcfg.Filesoutside textReads/writes files
Set the analyses sim_run will use, in the project's .simcfg.

        Values are SPICE values: a number in SI units, or a string with a
        SPICE suffix ("5u", "10n", "1k", "100meg").

        Args:
            transient: {"stop", "step", "start" (default 0),
                "max_step" (default step)}.
            ac: {"start", "stop", "points", "sweep": "dec" | "oct" | "lin"}.
                Points are per decade or octave, or in total for lin.
            dc: {"source" (a source designator such as "V1", or "Temp"),
                "start", "stop", "step"}.
            outputs: expressions to plot in each analysis set here, e.g.
                ["v(out)", "i(v1)"].
            project_path: the project; empty uses the focused one.

        Each analysis set here is switched on; one already on stays on
        and runs on its last settings. sim_run(analyses=[...]) runs only
        the ones named, and sim_get_setup shows what is on. Dashboard
        changes are saved first and kept; a project without a .simcfg
        gets one.

        Returns:
            Dict with simcfg (the file), set (the keys written), reloaded,
            and created when the file is new.
(name computed at run time)prompt
No description.
(name computed at run time)prompt
No description.
autonomous_designprompt Drive a full spec-to-board design run with the harness.FilesEnv varsoutside text
Drive a full spec-to-board design run with the harness.
(name computed at run time)resource
No description.
(name computed at run time)tool
No description.
altium365_check_setuptool Which Altium 365 route is set up, whether the live schema has theFilesNetworkoutside text
Which Altium 365 route is set up, whether the live schema has the
        fields the read tools use, and which changes it offers.

        Routes: the workspace's own API (EDA_AGENT_ALTIUM365_DOMAIN, and a
        token made under Admin > Developer in EDA_AGENT_ALTIUM365_TOKEN), or
        Nexar (EDA_AGENT_NEXAR_APP_ID, then ``eda-agent altium365-login``).
altium365_describe_typetool One type of the live Altium 365 schema with its fields, theirFilesNetworkoutside text
One type of the live Altium 365 schema with its fields, their
        arguments and types: start at "Query" and follow the types named.
altium365_get_componenttool One managed component and its parameters.FilesNetworkoutside text
One managed component and its parameters.
altium365_get_projecttool One Altium 365 project by id.FilesNetworkoutside text
One Altium 365 project by id.
altium365_list_componentstool Managed components of a workspace (id, name), and their parameters
Managed components of a workspace (id, name), and their parameters
        when asked, the whole library in one call.
altium365_list_library_folderstool Folders of a workspace's managed library (id, name, path); publishingFilesNetworkoutside text
Folders of a workspace's managed library (id, name, path); publishing
        names its folder by id.
altium365_list_projectstool Projects of one workspace (id, name, description), optionally thoseFilesNetworkoutside text
Projects of one workspace (id, name, description), optionally those
        whose name contains a text.
altium365_list_workspacestool The Altium 365 workspaces the token sees (url, id, name,FilesNetworkoutside text
The Altium 365 workspaces the token sees (url, id, name,
        description); with EDA_AGENT_ALTIUM365_WORKSPACES set, only those.
altium365_read_objecttool Any object a ``des...ById`` query returns (a release, a part choice,FilesNetworkoutside text
Any object a ``des...ById`` query returns (a release, a part choice,
        a comment thread), asking for the fields the live schema lists, never
        guessed ones. altium365_describe_type("Query") lists the queries.

        Returns:
            ``type``, ``fields``, and ``nested_fields`` to read with
            altium365_run_query.
altium365_release_componenttool Release a managed component (desReleaseComponent). ``release`` is
Release a managed component (desReleaseComponent). ``release`` is
        that operation's input as Altium documents it, with at least
        ``workspaceUrl`` and ``componentItemName``. Without ``confirm`` this
        shows what would be sent.
altium365_run_querytool Run a reading GraphQL query against Altium 365. Queries that change
Run a reading GraphQL query against Altium 365. Queries that change
        anything (mutation, subscription) are refused; library changes are
        altium365_publish_library_file, altium365_release_component and
        altium365_set_component_parameters.
altium365_set_component_parameterstool Add or change a managed component's parameters as a new revision.
Add or change a managed component's parameters as a new revision.

        ``parameters`` is [{"name", "value"}]; ``replace_existing`` drops
        every parameter the component has first. The new revision has a new
        component id, which comes back. Without ``confirm`` this shows what
        would be sent.
app_activate_rowtool Invoke a row, rather than merely selecting it.Filesoutside text
Invoke a row, rather than merely selecting it.

        ``app_set_dialog_control(select_row=...)`` highlights a row.
        This ACTS on it, which in a panel is the difference between
        pointing at a document and opening it.

        A click has no read-back, so the reply reports what was done and
        not what it caused.
app_attachtool Connect to a running Altium Designer instance.
Connect to a running Altium Designer instance.

        This verifies Altium is running and the polling script is responding.
        The Altium_API.PrjScr script must be running (StartMCPServer) in Altium.

        Returns:
            Dictionary with attachment status
app_autosavetool Read, or set, Altium's auto-save: whether it saves backup
Read, or set, Altium's auto-save: whether it saves backup
        copies of open documents, and how often.

        Call with nothing to read. Both values are read back.

        Args:
            enabled: Auto-save on (True) or off (False).
            interval_minutes: Minutes between saves, 1 or more.

        Returns:
            ``enabled``, ``interval_minutes`` and ``changed``.
app_canvastool Click or drag on the editor canvas, at screen coordinates.Filesoutside text
Click or drag on the editor canvas, at screen coordinates.

        THE CANVAS HAS NO NAMED CONTROLS, so every other tool here could
        not touch it. Placing, moving, rubber-band selecting and routing
        are pointer gestures and there was no way to make one.

        With ``to_x``/``to_y`` this DRAGS, moving in steps rather than
        jumping, because a jump reads as a click at the destination.
        Without them it clicks.

        NO READ-BACK IS POSSIBLE. The reply says what gesture was made
        and never what it did. Confirm with a bridge read, which can see
        the document, rather than trusting this.

        ``relative_to="window"`` takes the points as pixels of the main
        window, as app_screenshot pictures it.
app_checkpointtool Snapshot a project so the session can be rolled back.Files
Snapshot a project so the session can be rolled back.

        Altium saves a copy of each design document in the project folder
        into a content-addressed store under the workspace, an open one as
        it is in the editor; the project file and other files are stored
        as they are on disk. Unchanged files are stored once, and a closed
        document unchanged since the last checkpoint is not opened again.
        Take one before any risky autonomous edit; restore with
        `app_restore_checkpoint`. This is the undo the live bridge otherwise
        lacks.

        Args:
            label: optional human note ("before routing pass").
            save_first: save the project first, so the project file holds
                what Altium holds (default True).
            project_path: the .PrjPcb to snapshot. Left empty, the focused
                project is taken; with several open that may not be the one
                you are editing, so the reply names it and lists the rest.

        Returns:
            The checkpoint manifest summary (id, created, file_count,
            ``not_written``: documents Altium did not copy, with why),
            ``project`` (the one snapshotted) and ``other_open_projects``.
            With ``save_first``, also ``saved``: True when the save
            worked, False with ``save_error`` and a ``note`` when it did
            not.
app_claim_documenttool Take a document over from the session editing it.
Take a document over from the session editing it.

        Only when the user says so: the other session's next write to it
        is then refused instead of this one's.

        Args:
            file_path: The document's full path.

        Returns:
            ``document``, ``session`` (this one) and ``previous_owner``.
app_click_menutool Invoke ANY Altium menu command by clicking the real menu. UnlikeFilesoutside text
Invoke ANY Altium menu command by clicking the real menu. Unlike
        ``app_run_menu``, which can report success for commands it never
        ran, this either runs the command or says why not. A last resort:
        try ``tool_guide`` first.

        Path by name, e.g. "Design|Rules" (accelerators and "..."
        ignored). Give the English names on any language: a translated
        Altium's own captions are matched from its install, and the
        reply's ``ui_language`` says which it was. It needs the
        foreground: it brings Altium forward and
        briefly moves the pointer, so ``may_steal_focus`` must be True.
        The menu bar depends on the focused editor, so focus the right
        document first. Read any dialog it opens with
        ``app_list_open_dialogs``.

        Args:
            menu_path: Pipe-separated path, top level first.
            may_steal_focus: Required to click anything.
            list_only: Only list the top-level menus on screen.
            expect_dialog: Part of the title the command should open;
                ``ok`` then means that dialog appeared.

        Returns:
            ``ok``, ``opened`` (dialog titles); on failure ``reason`` and
            ``offered`` (what that level contained). A path ending at a
            submenu is a failure. ``retried`` and ``first_read`` show a
            level read twice.
app_close_documenttool Close ONE open document, found by its full path, whatever has focus.
Close ONE open document, found by its full path, whatever has focus.

        Unlike closing through the workspace manager, which acts on the
        FOCUSED object, this closes the named document itself. It refuses a
        document that reads modified, and says whether it is really gone
        afterwards. The modified read can miss edits held in the editor, so
        save anything you care about first; a close of an edited document
        may still raise Altium's save prompt.

        Args:
            file_path: the document's full path, as app_list_documents
                reports it.
            discard_changes: close it even when it reads modified, and
                LOSE the unsaved edits: the modified flag is cleared first
                so no save prompt appears. For scratch copies and documents
                Altium changed by merely opening them, never for work. A
                schematic an open project lists may keep the edit in the
                project after its tab closes: ``discarded`` is then false
                and ``project_may_hold_edit`` true; proj_close with
                save=False drops it.

        Returns:
            ``{"closed": bool, "discarded": bool, "project_may_hold_edit":
            bool, "file_path": ...}``; an
            error when the path is not open, or when the document reads
            modified and ``discard_changes`` is not set.
app_close_opened_documentstool Close the documents this session's commands opened, and no other.Filesoutside text
Close the documents this session's commands opened, and no other.

        Each reply names the documents its command loaded that were not
        open before it, and the session keeps that list. This closes the
        ones still open. A document open before (yours, or one another
        session opened) is never on the list, nor is a project. One that
        reads modified is kept and named: save it or close it yourself.

        Args:
            dry_run: Only say what would close (default True).
            keep: Full paths to leave open although this session opened
                them, such as the board still being worked on.

        Returns:
            ``would_close`` (dry run) or ``closed``; ``kept_modified``,
            ``kept``, ``already_closed`` (closed since, dropped from the
            list), ``failed`` (path and reply) and ``remaining`` (what
            stays on the list).
app_contexttool Where you are, in one call. Run this before anything else.FilesEnv varsoutside text
Where you are, in one call. Run this before anything else.

        Reports the facts behind most "why didn't that work": which
        document is focused and its kind (most tools act on it, and a
        pcb_ tool aimed at a focused library can act on another board);
        whether the running script matches the deployed one (a deployed
        fix does nothing until reloaded); what is unsaved; and whether
        the bridge answers at all.

        It cannot tell which library component is current; if a lib_add_*
        call lands somewhere unexpected, set it with
        ``lib_set_current_component``.

        Returns:
            ``{"backend", "bridge_answering", "script_version_match",
            "running_script_version", "deployed_script_version",
            "altium_version", "active_document", "open_document_count",
            "unsaved": [paths], "warnings", "next_step"}``.

            ``warnings`` is empty when nothing needs attention.
            ``next_step`` is the single thing worth doing first, or empty.
app_context_menutool Right click at a point: read the context menu, or pick from it.Filesoutside text
Right click at a point: read the context menu, or pick from it.

        CONTEXT MENUS WERE ENTIRELY UNREACHABLE, and Altium puts a great
        deal in them that no top-level menu duplicates: what you can do
        to a component, a net, a polygon, a row in a panel. Driving the
        menu bar while ignoring these leaves most of the editor shut.

        With no ``item`` this OPENS the menu, reads what it offers and
        CLOSES it again, invoking nothing. Leaving a popup dropped
        blocks the next operation and looks to a user like a hang.

        Args:
            x, y: screen coordinates to right click. Panel and control
                rectangles from app_list_panels and
                app_set_dialog_control(list_only=true) give you these.
            item: the entry to choose. Nested entries take a '|' path,
                matched by name at each level like the menu bar.
            relative_to: "window" takes x, y as pixels of the main
                window, as app_screenshot pictures it.

        Returns:
            Reading: ``{"ok": true, "items": [...], "count": N}``.
            Choosing: ``{"ok": true, "item": ...}``, or ``ok: false``
            with ``offered`` listing what was actually there.
app_create_documenttool Create a new blank document of a given kind and save it to disk.
Create a new blank document of a given kind and save it to disk.

        Saved to `file_path` and, by default, added to the focused
        project, or to ``project_path`` when given. With several projects
        open, name the project: the focused one is whichever was clicked
        last, and a scratch sheet added to a production project stays in
        it. ``member_of`` reads back which projects now list the file.

        Args:
            kind: Document kind, 'PCB', 'SCH', 'PCBLIB', 'SCHLIB',
                'OUTPUTJOB', 'HarnessWiringDiagram' (a .WirDoc in a
                .PrjHar), or any other kind Altium's server module
                registers under.
            file_path: Absolute path where the new document should live.
                Use Windows backslashes.
            name: Optional display name. Defaults to the filename.
            add_to_project: Attach the new file to a project. Default
                True. Set False to leave it as a free document.
            project_path: The .PrjPcb to attach it to. An unknown path is
                refused before anything is created.

        The new document is focused, and ``focused`` says whether that
        took, since the next tool acts on the focused one. A save that
        fails is an error naming the cause.

        A path that is already OPEN is refused (``ALREADY_OPEN``): creating
        over an open document crashed Altium's PCB editor. Focus it with
        app_set_active_document instead. A file that exists on disk but is
        not open is replaced by the blank document.

        Returns:
            Dictionary with kind, file_path, saved, focused,
            added_to_project and member_of (project paths).
app_detachtool Stop the Altium MCP polling loop. CALL THIS WHEN YOU'RE FINISHED.
Stop the Altium MCP polling loop. CALL THIS WHEN YOU'RE FINISHED.

        While the loop runs it holds Altium's scripting engine, so some of
        Altium's own script-backed commands may not respond. This saves
        edited and modified documents, leaves clean ones alone, and stops
        the loop. Afterwards the user must run StartMCPServer again (File
        > Run Script) before any more tools work, so detach only when done.

        Returns:
            attached False always; stopped True only when Altium answered
            that its loop stopped, with edited_saved and clean_left_alone
            counts. Otherwise stopped False and the reason: the loop may
            still be running.
app_diag_workspacetool Diagnostic: enumerate workspace files via Altium's FindFiles helper.
Diagnostic: enumerate workspace files via Altium's FindFiles helper.

        Reports workspace_dir, the pattern used, match_count and the first
        10 matching filenames. Used to validate the per-request file
        enumeration that the dispatcher relies on.
app_dialog_tabtool List a dialog's tab pages, or switch to one.Filesoutside text
List a dialog's tab pages, or switch to one.

        PROPERTY DIALOGS HIDE MOST OF THEMSELVES BEHIND TABS. Nothing
        could switch one, so app_set_dialog_control only ever saw the
        front page and reported it as the whole dialog: a control on any
        other page read as a control the dialog does not have.

        With no ``name`` this lists the pages and which is selected.
app_document_ownerstool Which Claude session is editing which open document.
Which Claude session is editing which open document.

        Sessions share one Altium. A tool that writes claims the document
        it acts on; another session's write to it is refused
        (DOCUMENT_IN_USE) while the owner has written within the last
        ``idle_release_seconds``. Reads are never refused, and neither is
        the person at the dashboard.

        Returns:
            ``documents`` (each ``document``, ``session``, ``last_command``,
            ``seconds_since_write``, ``held``, ``yours``) and ``session``,
            this session's tag.
app_drive_dialogstool Answer dialogs reactively until none is left.Filesoutside text
Answer dialogs reactively until none is left.

        Reads what is on screen, classifies it, decides a press and
        repeats, so dialogs in any order are handled. It STOPS on a
        dialog it cannot classify or one that needs a person. Dry run by
        default: it reports each decision and presses nothing.

        Two separate gates: ``allow_confirm`` answers a yes/no that moves
        an operation along; ``allow_commit`` permits the press that
        changes the design.

        Args:
            intent: "proceed" to carry the operation forward, or
                "cancel" to back out of whatever is open.
            allow_commit: permit the design-changing press.
            allow_confirm: permit answering a confirmation.
            dry_run: decide and report, press nothing. Default True.
            wait_first: seconds to wait for the first dialog, since a
                caller fires a command and then drives.
            budget: seconds before giving up on a wedged editor.

        Returns:
            Every observation and decision, plus ``committed``,
            ``stopped_for_a_human`` and why it finished.
app_exit_active_commandtool Close a transaction a crashed handler left open in Altium.
Close a transaction a crashed handler left open in Altium.

        THE TOOL FOR "A command is currently active and save cannot be
        completed at this time", when every save is refused. The state
        lives in Altium, so it survives restarting the polling loop and
        Escape does not clear it; it is left by a handler that died
        mid-transaction. Harmless when nothing is open. It saves nothing:
        run ``app_save_all`` afterwards and check ``still_dirty``.

        Returns:
            Dict reporting whether each server accepted the unwind, plus
            the count of still-modified documents before and after.
app_expand_tree_nodetool Open or close a node in a tree, and verify the state changed.Filesoutside text
Open or close a node in a tree, and verify the state changed.

        Trees were readable and could not be OPENED, so anything nested
        inside one did not exist as far as a caller was concerned.

        Args:
            control_label: the tree's label.
            node_name: the node to open, matched by name.
            expand: True to open, False to close.
            dialog_title: which dialog, when several are open.

        Returns:
            ``{"ok": true, "node": ..., "expanded": bool,
            "changed": bool}``. ``changed`` is false when it was already
            in that state, which is a success rather than a no-op to
            worry about.
app_find_menu_commandtool Search every Altium menu item and the command behind it.
Search every Altium menu item and the command behind it.

        Read from Altium's own menu definitions in its install, so it
        answers without Altium's window, in any language Altium ships
        (words may be English, 中文, 日本語, Deutsch, ...). Each hit gives
        the menu ``path`` (English), the ``command`` and ``params`` it
        runs, and its ``shortcut``. Run one with ``app_run_menu`` (no
        menu walk) or ``app_click_menu`` (the real menu).

        Args:
            query: words to find, all of which must match.
            editor: PCB, SCH, PCBLIB or SCHLIB; empty searches all four.
            limit: how many hits to return.
app_format_valuetool Read, write or clean up a component value. HOW IT IS WRITTEN ISFilesoutside text
Read, write or clean up a component value. HOW IT IS WRITTEN IS
        THE USER'S CHOICE on the Config tab of the bridge panel in Altium,
        read on every call: RKM (IEC 60062, a letter where the decimal
        point would be: 4K7, 0R005, 2u2, 10uF, 3V3), SI (4.7k, 0.005, 2.2u,
        3.3V), SI with the unit (2.2uF, 100nF, 10uH; never on resistors), or
        None, which leaves values as written: cleanup returns the text
        unchanged and tostring is refused. The reply's ``value_format``
        says which applied. Do not pick a form for the user.

        Done by the bridge's own value engine (no document is read or
        touched), so a script can use the same rules. NO ROUNDING: a value
        is digits and a power of ten, exact to the last digit.

        Reading is tolerant: 4.7k, 4,7 kOhm, 10 000uF, 2.2uF, 0.1 uF,
        3,3 V, 125 degC. The unit letter decides the kind; without one,
        p / n / u is a capacitor and G / M / m / K a resistor. Letters
        that could read two ways are blocked: on a resistor m is MEGA
        (milli and micro are written 0R005, 0R0005); on volts and amperes
        M is milli; femto is never read (100 fF is 0p1). The value ends at
        the first space or character that is not part of it ("10uF 50V"
        and "10uF/50V" read 10uF, the rest comes back in ``rest``); a value
        that runs on into digits or letters it cannot use ("10.1.1k") is
        refused.

        Args:
            action: ``cleanup`` (text -> the proper text), ``fromstring``
                (text -> value and kind) or ``tostring`` (kind + value ->
                text).
            text: The value as written, for cleanup / fromstring.
            value: The value in the base unit (ohm, farad, henry, volt,
                ampere, %, ppm, degree C) for tostring: a string such as
                "0.0000022" or "1e3", or a number.
            kind: ohm, farad, henry, volt, ampere, percent, ppm or
                celsius (also R, C, L, V, A). Takes precedence over the
                text; a unit in the text that disagrees is a note.
            decimal: The decimal separator of the SOURCE text, "." or
                ",", for "1,000" / "1.000"; default this machine's.

        Returns:
            ``text`` (cleanup, tostring), ``value`` as an exact decimal
            string and ``kind`` (cleanup, fromstring), ``rest`` (what
            followed the value), ``notes`` (every guess made) and
            ``value_format`` (cleanup, tostring).
app_get_active_documenttool Get information about the currently active (focused) document.
Get information about the currently active (focused) document.

        Several Claude sessions can share one Altium. Each command runs on
        its own session's document (the last one it focused), which Altium
        puts back in front first if anything else moved the focus. So by
        default this answers what is REALLY in front, which may be another
        session's document or one a person has just opened. To work on that
        document, focus it (app_set_active_document); it then becomes this
        session's.

        Args:
            session: True for this session's own document instead, brought
                back to the front first if something else is there.

        Returns:
            Dictionary with active document information:
            - file_name: Document file name
            - file_path: Full file path
            - document_kind: Type of document (SchDoc, PcbDoc, etc.)
            - modified: True if the editor holds unsaved edits. A false
              is a floor rather than a clean bill, since the flag does
              not always propagate from ProcessControl.
            Returns empty dict if no document is active.
app_get_clipboardtool Get text content from the Windows clipboard.
Get text content from the Windows clipboard.

        Returns whatever text is currently on the clipboard, which can be
        useful for reading data copied from Altium dialogs or reports.

        Returns:
            Dictionary with "text" containing the clipboard content.
            Returns empty string if clipboard is empty or non-text.
app_get_preferencestool Get key Altium Designer preferences.
Get key Altium Designer preferences.

        Returns PCB preferences (snap grid, display unit) from the active board
        and schematic preferences (visible/snap grid) from the active schematic.
        Values are null if no PCB or schematic is currently open.

        Returns:
            Dictionary with "pcb" and "schematic" sub-objects containing
            grid and unit settings
app_get_reporttool Report the health of the MCP bridge, workspace, and Altium link.Filesoutside text
Report the health of the MCP bridge, workspace, and Altium link.

        One call to diagnose the plumbing without touching the design:
        package version, the script version on disk vs. what Altium has
        compiled, whether Altium is up, the live IPC round-trip time, the
        workspace location, and how many request/response/stop files are
        sitting in it (a backlog of stale request_*.json usually means a
        dead or wedged poller).

        Returns:
            Dictionary with mcp_server_version, bundled_script_version,
            altium_running, altium_script_version, version_match,
            round_trip_ms (None if Altium is down), workspace_dir,
            workspace_exists, and a file_counts breakdown.
app_get_statustool Check if Altium Designer is running and get status information.Filesoutside text
Check if Altium Designer is running and get status information.

        Returns information about the Altium Designer process including:
        - Whether Altium is running
        - Process ID
        - Executable path
        - Whether the MCP bridge is attached

        MORE THAN ONE ALTIUM. ``candidate_count`` and ``candidate_pids``
        list every instance, and ``selected_by`` says how ``pid`` was
        chosen: the instance owning the bridge's status window, or the
        only one with a visible window. When neither decides it, ``pid``
        is None, ``ambiguous`` is True and ``reason`` explains, and every
        UI tool refuses rather than read the wrong process's dialogs.

        MORE THAN ONE eda-agent SERVER. ``other_servers`` lists the other
        servers recorded on this workspace (pid and start time), and
        ``warnings`` says so when there are any. A warning only: several
        sessions at once are allowed, and nothing is stopped.

        Returns:
            Dictionary with status information
app_get_versiontool Get the version of Altium Designer.
Get the version of Altium Designer.

        Uses Client.GetProductVersion internally. If that API is unavailable
        (older builds or restricted script context), the returned dictionary
        will omit "version" and include a "note" field instead.

        Returns:
            Dictionary with product_name and either:
            - version: Full version string (when Client.GetProductVersion works)
            - note: Explanation when the version API is unavailable
app_invoke_elementtool Press, set or expand an element through UI Automation patterns.Filesoutside text
Press, set or expand an element through UI Automation patterns.

        Not a simulated click: Invoke presses, Value sets text and
        ExpandCollapse opens a node, so no pointer moves, no focus is
        taken and nothing under the cursor is hit. The right tool for WPF
        dialogs and for work while the user keeps working. A client that
        does not list it can call it through ``tool_invoke``.

        Args:
            name: the element's name or automation id. A Button of that
                name is preferred over a label carrying the same text.
            dialog_title: which dialog. Empty uses the frontmost open
                dialog, or the main window when no dialog is open.
            text: set this value instead of pressing.
            expand: "true" or "false" to open or close a node instead.

        Returns:
            ``ok`` with what was done and, for a press in a dialog,
            ``dialog_closed``; or a refusal naming which pattern the
            element lacks and its rectangle, so a real click remains
            possible as a fallback.
app_list_checkpointstool List saved checkpoints for the current workspace, newest first.
List saved checkpoints for the current workspace, newest first.
app_list_documentstool List all documents known to the current Altium workspace.
List all documents known to the current Altium workspace.

        Returns both project members and any free documents. Each entry
        carries a `loaded` flag that distinguishes "listed as project
        member on disk" from "actually resident in the editor".
        Project-scope queries (query_objects, batch_modify, ...) only
        iterate loaded sheets, if `loaded` is false for sheets you need
        to hit, call load_project_sheets first.

        Returns:
            List of document information dictionaries containing:
            - file_name: Document file name
            - file_path: Full file path
            - document_kind: Type of document (SCH, PCB, etc.)
            - loaded: True if the doc is resident in the editor server.
              False means it's a project member on disk whose editor
              state hasn't been opened yet.
            - modified: True if the editor holds unsaved edits. A false
              is a floor rather than a clean bill, since the flag does
              not always propagate from ProcessControl. app_save_all
              measures file timestamps instead of trusting it.
app_list_open_dialogstool What Altium has on screen, what it says, and if it is stuck.Filesoutside text
What Altium has on screen, what it says, and if it is stuck.

        The tool for a quiet bridge: it reads the Windows process, not
        the bridge, so it answers while a modal blocks everything else.
        ``blocked`` means the main window is disabled; ``blocked: false``
        does not prove the UI is alive (a crashed UI read that way).

        Per dialog: caption, message, buttons and a ``kind``: ``error``,
        ``warning`` or ``confirm`` (set ``needs_a_human``),
        ``nothing_to_do`` (a success with no work, e.g. "No
        Differences"), ``engineering_change_order``, ``wizard``,
        ``progress`` or ``unknown``. Grids and owner-drawn lists can't be
        read (``has_unreadable_content``). Presses nothing.
        ``needs_a_human`` means no driver answers it blindly: read the
        message and press the answer the task calls for with
        app_press_dialog_button. Ask the user only when the choice is
        theirs, never to click a button for you.

        Returns:
            Dict with ``blocked``, ``dialog_count``, ``dialogs``,
            ``needs_a_human``, and a one-sentence ``summary``.
app_list_panelstool Altium's dockable panels that are currently on screen.Filesoutside text
Altium's dockable panels that are currently on screen.

        PANELS ARE NOT DIALOGS and were unreachable until now. A dialog
        is a top-level window; a docked panel is a child of the main
        frame, so ``app_list_open_dialogs`` never saw one. Projects,
        Navigator, PCB, Properties and Messages all live here.

        Args:
            offered_too: also read what View > Panels lists, which is
                what COULD be opened rather than what is open. That
                needs a real menu click and steals focus, so it is off
                by default.

        Returns:
            ``{"ok": true, "panels": [{name, rect, button_hwnd,
            content_count}], "count": N}``, plus ``offered`` when asked
            for. A panel is found by the tab it carries, so an empty list
            comes with a ``note``: it has been reported empty on AD 25
            while Properties was open.
app_open_paneltool Open a dockable panel by name, and confirm it appeared.Filesoutside text
Open a dockable panel by name, and confirm it appeared.

        Goes through View > Panels, because Altium exposes no scripted
        way to show a panel and ``application.execute_menu`` reports
        success while invoking nothing. So this STEALS FOCUS, like every
        menu click. Reading a panel afterwards does not.

        A panel that is already open is reported as such and NOT clicked.
        Those menu entries are toggles, so clicking one you already have
        would close it, and asking for a panel is not a request to lose
        it. When the panel cannot be seen after the click (it may have
        been open with no tab the scan reads), the entry is clicked once
        more so the panel is left as it was, and the reply says so with
        ``toggled_back``. Calling again does not help in that case.

        Args:
            name: the panel's name as View > Panels spells it, e.g.
                "Projects", "Messages", "PCB", "Properties".
            settle: how long to allow for it to appear.

        Returns:
            ``{"ok": true, "name": ..., "opened": bool, "rect": ...}``.
            ``opened`` is false when it was already there.
app_pingtool Check that Altium and its bridge script answer, and that theFilesEnv varsoutside text
Check that Altium and its bridge script answer, and that the
        running script is the version on disk. A mismatch or a non-empty
        ``stale_units`` means Altium runs an old compile: close and reopen
        the script project to recompile.

        Returns:
            ``success``, ``mcp_server_version``, ``altium_script_version``,
            ``bundled_script_version`` and ``bundled_script_path``,
            ``version_match``, ``altium_version``, ``message``,
            ``script_projects_open`` and ``script_location_match`` (False:
            Altium loaded scripts from elsewhere), ``loop_workspace_dir``
            (the folder the answering loop takes requests from) and
            ``server_workspace_dir`` (this server's), ``unit_stamps``,
            ``stale_units``, ``unstamped_units``, ``saving_allowed`` (False
            while the dashboard's Saving switch is off), ``other_servers``
            (other eda-agent servers on this workspace) and ``warnings``.
app_press_dialog_buttontool Press ONE named button in an open Altium dialog.Filesoutside text
Press ONE named button in an open Altium dialog.

        By caption, ignoring ampersands and a trailing ellipsis ("Report
        Changes" finds "&Report Changes..."). It works while a modal
        blocks the bridge, since it presses through Win32. A caption that
        commits a change order or applies a wizard needs
        ``allow_irreversible``. For a sequence use ``app_drive_dialogs``.

        Args:
            button_caption: the visible caption.
            dialog_title: substring picking one dialog when several are
                open. Empty uses the first.
            allow_irreversible: permit a committing press.
            button: the same as ``button_caption``, the name clients reach
                for first.

        Returns:
            ``ok``, the dialog and button actually matched, and whether
            the dialog closed afterwards.
app_read_paneltool Read what is inside an open panel.Filesoutside text
Read what is inside an open panel.

        Takes no focus and moves nothing, so it is safe while a user is
        working. The panel must already be open: use ``app_open_panel``
        first, or ``app_list_panels`` to see what is there.

        Reads the WHOLE panel. It is not fast: Altium materialises its
        accessible tree lazily, so the first touch of a node costs about
        116 ms and 162 rows is roughly thirty seconds. Slow and complete
        beats fast and partial.

        Returns:
            ``{"ok": true, "name": ..., "row_total": N,
            "grids": [{control, hwnd, row_count, rows}]}``. Grids are
            reported separately because a panel holds more than one and
            they mean different things.
app_read_windowtool Read a window through UI Automation, which sees what MSAA cannot.Filesoutside text
Read a window through UI Automation, which sees what MSAA cannot.

        THE LAYER THAT WAS MISSING. This project read Altium three ways:
        window text, which returns nothing for anything without a handle;
        MSAA, which handles the VCL dialogs well and the WPF ones not at
        all; and OCR on the pixels. UIA sits between the second and the
        third.

        It matters most for the case that forced OCR into existence.
        Altium's newer WPF dialogs have buttons that are NOT child
        windows, so EnumChildWindows finds nothing and MSAA has nothing
        to press. WPF is UIA-native, so those same buttons are ordinary
        elements here, with names, and they can be pressed properly with
        app_invoke_element.

        WHAT IT STILL WILL NOT SEE. Delphi's TLabel owns no handle and
        publishes no accessible object, so its text exists only as
        pixels. Use app_screenshot there; that is what OCR is for and
        why it stays.

        Returns:
            ``{"ok": true, "count": N, "elements": [{name, type,
            automation_id, enabled, rect}], "text": [...]}``.
app_recover_scripttool Clear a crashed bridge script and restart the loop.Filesoutside text
Clear a crashed bridge script and restart the loop.

        A call that crashes the script does this by itself. This is for a
        script found halted later: the Script IDE holding a line, or
        "Another script executing now". It screenshots and answers OK on a
        script error box, screenshots the halted line, stops the script
        (Run > Stop, Ctrl+F3) and restarts the loop, with other sessions'
        calls waiting through it. Screenshots and a record go to
        logs/crashes in the workspace.

        Args:
            force: restart even when Altium's title does not name the
                script project and the loop answers a ping. Without it a
                loop that does not answer, while no session's call is
                running, is restarted.

        Returns:
            ``halted`` (whether a restart ran), ``screenshots``,
            ``dialog``, ``title``, ``restart`` {restarted, output} and
            ``record``.
app_release_documenttool Give up a document this session is editing.
Give up a document this session is editing.

        Another session can then write to it at once, instead of after
        ``idle_release_seconds``. Call it when done with a document that
        another session may want. A document another session holds is
        refused (NOT_YOURS); taking one over is app_claim_document.

        Args:
            file_path: The document's full path. Empty releases every
                document this session holds.

        Returns:
            ``released`` (the documents given up) and ``session``.
app_restore_checkpointtool Restore the focused project's files from a checkpoint.Filesoutside text
Restore the focused project's files from a checkpoint.

        Only files that differ from the checkpoint are restored. The
        project is closed WITHOUT SAVING, so edits since the checkpoint
        are dropped, and opened again afterwards. Altium opens each
        changed design document's snapshot and saves it under its own
        name; the project file and other files are put back while the
        project is closed. With `prune_added=True` this is a true revert:
        files created after the checkpoint are deleted; the default leaves
        newer files untouched.

        Args:
            checkpoint_id: id from `app_list_checkpoints`.
            prune_added: delete files absent at checkpoint time (default False).

        Returns:
            {restored, unchanged, removed, missing_blobs, not_restored
            (file: why), not_in_checkpoint, reopened, were_open (the
            project's documents open before; the project reopens with
            none of them open)}.
app_run_menutool Dispatch a menu command by path. DISPATCH IS NOT EXECUTION:Filesoutside text
Dispatch a menu command by path. DISPATCH IS NOT EXECUTION:
        Altium accepts an unknown or unavailable process in silence, so
        the reply says ``dispatched`` with ``outcome_verified: false``.
        Use ``app_click_menu`` when the command must actually run; it
        clicks the real menu and fails on a path that does not exist.

        Any path in the focused editor's menu bar works, in English or
        in any language Altium ships: it is looked up in Altium's own
        menu definitions (``app_find_menu_command`` searches them) and
        the command behind it is run, with no menu walk and no focus
        taken. The reply names the ``command`` and ``params`` used. A
        path the install does not declare is refused with
        UNMAPPED_MENU_PATH and the nearest matches.

        Args:
            menu_path: Menu path using pipe separators (e.g., "File|Save All")

        Returns:
            Dictionary with dispatched, outcome_verified (always false),
            menu_path, and the process used. A reply the bridge could not
            parse is reported as a failure, not smoothed into a success.
app_run_ui_commandtool Invoke a menu command and answer the dialogs it raises, in oneFilesoutside text
Invoke a menu command and answer the dialogs it raises, in one
        call (a modal blocks the scripting engine, so the two cannot be
        separate bridge calls). Prefer an API tool when one exists.

        The gates are app_drive_dialogs': confirmations are answered by
        default, a design-changing press (a change order) is not, and
        unlike app_drive_dialogs ``dry_run`` defaults off.

        Args:
            menu_path: pipe-separated, for example
                "Tools|Annotation|Force Annotate All Schematics...".
                Discover paths with app_click_menu(list_only=True).
            allow_commit: permit a design-changing press.
            allow_confirm: permit answering confirmations.
            dry_run: invoke the command but press nothing.
            may_steal_focus: opening a menu needs real input.
            wait_first: seconds to wait for the first dialog.
            budget: seconds before giving up.
            expect_dialog: part of the title of the dialog the command
                should open. When a different dialog (or none) appears,
                the reply fails at the menu stage and nothing is driven.

        Returns:
            ``ok``, the ``menu`` result, and the full ``dialogs`` record.
            ``ok`` is true only when the menu click AND the drive both
            succeeded, so a command that opened something nobody could
            answer does not read as a success.
app_save_alltool Flush every dirty Altium document to disk.
Flush every dirty Altium document to disk.

        Edit tools change documents in memory only; call this at
        checkpoints (after routing, before DRC, before closing). Detach
        saves too. A library no tool edited is not written (listed in
        ``libraries_left_unedited``); hand edits are not tracked, so save
        those with ``app_save_document``.

        CHECK ``still_dirty``: Altium declines to save, silently, while a
        command is active in the editor, and ``saved`` is false then. Run
        ``app_exit_active_command`` and retry.

        Returns:
            Dict with ``saved``, ``still_dirty``, ``libraries_left_unedited``,
            and a ``reason`` when documents remain unsaved.
app_save_documenttool Save ONE open document: ``file_path``, or the focused one.
Save ONE open document: ``file_path``, or the focused one.

        ``app_save_all`` writes every open document, so one that cannot
        be written, a sheet in a read-only folder say, stops a save you
        never asked for. This touches only the named document, never
        changes focus and never walks the workspace.

        ``saved`` is measured from the file's age on disk: Altium does
        not report a declined save. ``was_modified`` says whether Altium
        thought there was anything to write, and it misses edits made
        through scripts: a board changed only by this server's tools read
        false and was saved all the same. A save Altium declines while
        a command is active reads ``saved`` false; run
        ``app_exit_active_command`` and retry.

        Args:
            file_path: Absolute path of an open document. Empty saves the
                focused document.

        Returns:
            ``file_path``, ``saved``, ``was_modified`` and a ``reason``
            when it was not saved. NOT_OPEN when the document is not open,
            since only an open document can hold unsaved edits.
app_scroll_controltool Scroll a list, grid or tree so more of it comes into view.Filesoutside text
Scroll a list, grid or tree so more of it comes into view.

        A LONG LIST HIDES ITS OWN CONTENTS. A virtualised DevExpress
        grid exposes roughly what is on screen, so a row further down
        did not exist as far as a caller was concerned, and the reply
        gave no hint that anything was missing.

        Positive scrolls down, negative up. The reply reports whether
        the rows actually changed: ``moved: false`` at the end of a list
        is a real answer rather than a failure.
app_send_keystool Send a key sequence to whatever currently has focus.Filesoutside text
Send a key sequence to whatever currently has focus.

        THE THINGS THAT TAKE NEITHER A CONTROL NOR A MENU: a canvas
        shortcut, a grid that commits on Enter, a dialog answered with
        Escape, a chord like Ctrl+Shift+D. Every other tool here
        addresses a control; this addresses the keyboard.

        Space separated, each item a key or a '+' chord:

            "escape"              one key
            "ctrl+s"              a chord
            "tab tab enter"       three in order

        Modifiers: ctrl, alt, shift. Keys: letters a to z, digits 0 to
        9, enter, escape, tab, space, backspace, delete, insert, the
        arrows, home, end, pageup, pagedown and F1 to F12. An unknown
        name is refused and the known ones listed, rather than sent as
        nothing. For literal text use app_type_text.

        THIS GOES WHEREVER FOCUS IS. Establish focus first, with
        app_click_menu or app_open_panel, and check the result
        afterwards: a keystroke has no read-back, so the reply says what
        was sent and never that it worked.
app_set_active_documenttool Set a specific document as the active (focused) document,
Set a specific document as the active (focused) document,
        opening it first when it is a file Altium has not loaded yet (a
        member of a project just opened, say).

        Args:
            file_path: Full path to the document to activate

        Returns:
            Dictionary with result of the operation; ``opened`` true when
            the document had to be opened first.
app_set_dialog_controltool Read or change a checkbox, radio, field or list row in the openFilesoutside text
Read or change a checkbox, radio, field or list row in the open
        dialog, found by its label (e.g. ``"Include Variants"``). Buttons
        are pressed by the dialog driver instead.

        Every change is read back; a click that did nothing is a
        failure. It refuses a disabled control and a request to switch
        a radio off. Asking for the current state clicks nothing
        (``changed: false``), so repeating a call is safe.

        Args:
            control_label: the control's visible label.
            checked: desired state for a checkbox.
            text: desired contents for an edit field.
            select_row: for a list, grid or tree, the row to select by
                name.
            dialog_title: substring to pick one dialog when several are
                open. Empty uses the first.
            list_only: change nothing, just report every control in the
                dialog with its role, state and whether it is enabled.

        Returns:
            For a read, the control list. For a change, ``ok``,
            ``changed`` and the state read back afterwards.
app_set_dropdowntool Choose an option in a combo box or drop list, and verify it.Filesoutside text
Choose an option in a combo box or drop list, and verify it.

        THESE WERE READABLE AND UNSETTABLE. combobox and droplist have
        been reported by ``app_list_open_dialogs`` from the start, so a
        caller could see a combo and its current value with no way to
        change it, which is the same shape as a property that reads and
        will not write.

        Three routes are tried, cheapest first: the option's own default
        action, an accessible selection, then a real click on it. The
        value is READ BACK afterwards, so a route that runs and changes
        nothing is reported rather than believed.

        Args:
            control_label: the combo's label.
            option: the option to choose, matched by name.
            dialog_title: which dialog, when several are open.
            list_only: report the options and change nothing.

        Returns:
            ``{"ok": true, "value": ..., "how": ..., "was": ...}``, or
            ``ok: false`` with ``offered`` listing what is there.
app_set_grid_celltool Type into one cell of a grid, and read it back.Filesoutside text
Type into one cell of a grid, and read it back.

        How Altium's rule and property editors take input. The cell is
        activated, typed into, and read back from the cell itself.

        Args:
            control_label: the grid's label.
            row: the row, matched by name.
            column: the column name, or an index for unnamed cells.
            text: what to type.
            dialog_title: which dialog, when several are open.
            list_only: report the row's cells and change nothing; do it
                first to see the column names.

        Returns:
            ``{"ok": true, "row": ..., "column": ..., "value": ...}``,
            or ``ok: false`` when the cell reads back differently, which
            happens on read-only columns and on ones that validate and
            revert.
app_set_intenttool Tell the dashboard what high-level task the agent is working on.Files
Tell the dashboard what high-level task the agent is working on.

        The text is written to ``workspace/intent.txt`` where the web
        dashboard polls it and shows a banner. Purely informational --
        does not affect tool dispatch in any way. Call this once at the
        start of a long task ("reviewing buck-converter feedback divider",
        "auto-placing the analog front-end on sheet B") so the user
        watching the dashboard knows what's happening between IPC
        events. Pass an empty string to clear the banner.

        Args:
            intent: Short human-readable description (one line, <=240 chars).

        Returns:
            ``{"ok": true, "intent": "<truncated text>"}``.
app_toolbartool List toolbar buttons, or press one by name.Filesoutside text
List toolbar buttons, or press one by name.

        Toolbars are the other half of the bar framework the menus use
        and were not addressed at all. Many carry a command with no menu
        equivalent, or reach in one click what the menu takes three to.

        With no ``name`` this lists every button it can see with its
        rectangle. With one, it presses that button and reports whether
        a menu dropped as a result, since many toolbar buttons open one
        rather than acting.
app_type_texttool Type literal text into whatever has focus.Filesoutside text
Type literal text into whatever has focus.

        For a field that HAS a handle, app_set_dialog_control is better:
        it addresses the control by name and reads the value back. This
        is for the places with no handle to address, where typing is the
        only route in.

        Carries punctuation and case, since it sends characters rather
        than virtual keys. No read-back, for the same reason as
        app_send_keys.
app_ui_snapshottool Everything on screen, in one call: menus, panels, dialogs, toolbars.Filesoutside text
Everything on screen, in one call: menus, panels, dialogs, toolbars.

        ORIENTATION IS THE EXPENSIVE PART. Finding out what is available
        took four calls and knowing which four to make, and a caller who
        guessed wrong concluded a capability was missing. This is the UI
        equivalent of app_context: one call that answers "what am I
        looking at".

        Reads only. Takes no focus, moves no pointer, changes nothing,
        so it is safe while somebody is working. The menu BAR is listed
        because reading it needs no click; menu contents are not,
        because opening one does.
app_update_from_librariestool Drive Tools > Update From Libraries, ECO included, from the GUI.Filesoutside text
Drive Tools > Update From Libraries, ECO included, from the GUI.

        proj_update_from_libraries does the same through the bridge, with
        no menu or focus taken; use this for a wizard already open. Each
        dialog is read and answered by the role of its buttons; it STOPS
        on an error, an unexpected question or unknown buttons. The end
        presses EXECUTE CHANGES on the ECO, which is not undoable here:
        take app_checkpoint first, and run dry (the default) first. The
        reply lists dialogs and buttons, not the change list; read the
        Messages panel for that.

        Args:
            target: "schematic" (Update From Libraries) or "pcb" (Update
                From PCB Libraries).
            launch: "already_open" (default; attach to a wizard you
                opened) or "menu" (open it via the menu bar).
            dry_run: Report what it would press, press nothing (default).
            confirm_execute_eco: Must be True for a real run.
            answer_confirmations: Answer routine "continue?" prompts,
                needed to finish; prompts about deleting or overwriting
                are never answered.
            menu_may_steal_focus: Required for launch="menu", which brings
                Altium to the front and moves the pointer.
            first_step_timeout: Seconds to wait for the first dialog.

        Returns:
            ``ok``, ``dry_run``, ``committed``, ``stopped_for_a_human``,
            ``finished`` (how it ended) and ``steps`` (each dialog, what it
            offered, what was pressed and why).
app_wait_for_dialogtool Block until a dialog appears, and report which one.Filesoutside text
Block until a dialog appears, and report which one.

        A COMMAND THAT RAISES A DIALOG RETURNS BEFORE THE DIALOG EXISTS.
        A caller that acted and then looked found nothing and concluded
        none was coming; the alternative was a fixed sleep long enough
        to be safe, which is the pattern this layer spent the day
        removing everywhere else.
audit_component_param_visibilitytool Check that every placed component shows the parameters its class
Check that every placed component shows the parameters its class
        requires for a legible schematic and a procurable BOM.

        Per class, by designator: C* shows a value ending in ``F`` and a
        voltage ending in ``V``; R* a value ending in ``R``, ``k``, ``M``
        or ``m``; L* an inductance ending in ``H`` and a saturation
        current ending in ``A``; U* a visible parameter whose name starts
        with ``Manufacturer Part Number``.

        A visible parameter or the Comment satisfies a rule; a hidden one
        does not. Runs on the compiled (flattened) tree, so hierarchical
        and multichannel designs are covered.

        Returns:
            Dict with:
              - ``checked``: how many components matched a known class
              - ``violations``: how many of those have at least one
                missing required value
              - ``items``: list of `{designator, class, missing[]}`
                violation entries. ``missing`` enumerates which required
                fields are absent (``capacitance``, ``voltage``,
                ``resistance``, ``inductance``, ``saturation_current``,
                ``mpn``).
audit_find_acute_anglestool Find pairs of same-net tracks meeting at < 90° interior
Find pairs of same-net tracks meeting at < 90° interior
        angle.

        An acute inside corner can over-etch. Pure geometry on signal
        layers, independent of Altium's acute-angle rule, which is often
        off; at most 100 are listed.

        Returns:
            Dict with ``{checked, violations, items[]}`` where each
            item carries ``{net, layer, x_mils, y_mils, angle_deg}``.
audit_find_bad_connectionstool Find PCB tracks / arcs with endpoints that are close to another
Find PCB tracks / arcs with endpoints that are close to another
        same-net primitive but don't actually touch.

        An end of a signal-layer track or arc with no same-net track,
        arc, pad or via within ``tolerance_mils`` is dangling: it can look
        connected and still be an open on the fabricated board, and DRC
        does not reliably catch it. Teardrops, component primitives,
        unnetted copper and full circles are skipped.

        Args:
            tolerance_mils: Coord tolerance in mils. 0 = exact match required
                (rare, since router can place tracks on sub-mil grid).
                Defaults to 1 mil; bump to 5 or 10 to surface
                gross misalignments only.

        Returns:
            Dict with:
              - ``checked``: track + arc primitives inspected
              - ``violations``: primitives with at least one dangling endpoint
              - ``tolerance_mils``: echo of the tolerance used
              - ``items``: per-violation `{kind, layer, net, at}` where
                ``at`` is the dangling endpoint's "(x,y)" in mils
audit_find_components_outside_board_outlinetool Find PCB components whose origin sits outside the board outline.
Find PCB components whose origin sits outside the board outline.

        Editing accident catch: the user grabbed a component and moved
        it off the PCB by mistake. Usually invisible during normal
        review because the component is off-canvas; DRC doesn't catch it
        (DRC is between primitives, not "is this object on the board").

        Uses ``IPCB_BoardOutline.PrimitiveInsidePoly`` for the actual
        polygon-inside test, so non-rectangular boards are handled
        correctly.

        Pattern: brett's SelectCMPInOutSideBOL.pas.

        Returns:
            Dict with:
              - ``checked``: total components inspected
              - ``violations``: components outside the outline
              - ``items``: per-violation `{designator, layer, at}` with
                ``at`` = "(x,y)" mils.
audit_find_designator_collisionstool Find schematic components that share a designator across sheets.
Find schematic components that share a designator across sheets.

        Annotation should make every designator unique across the project,
        but paste-from-another-sheet operations and post-annotate edits
        can leave duplicates that the agent / reviewer want to surface
        before they hit ERC.

        Walks source schematic sheets (not compiled docs: compiled
        flattening would auto-disambiguate multichannel instances with
        channel suffixes, hiding the real source-level collision).

        Returns:
            Dict with:
              - ``checked``: total components inspected
              - ``violations``: count of distinct designators that occur
                more than once
              - ``items``: per-collision `{designator, count, sheets}`
                where ``sheets`` is a comma-joined sheet-filename list
audit_find_floating_portstool Find schematic ports that aren't actually connected to anything.
Find schematic ports that aren't actually connected to anything.

        On each schematic sheet a port is "floating" if its net does not
        appear on any component pin OR any sheet-symbol entry on the same
        sheet. A floating port is usually an editing leftover (renamed a
        net but forgot to retag the port) or a never-completed hookup --
        ERC can miss these when the port carries a valid net-label tag
        that just doesn't connect to anything physically.

        Walks the compiled / flattened doc tree so multichannel /
        hierarchical designs are covered.

        Returns:
            Dict with:
              - ``checked``: total port objects inspected
              - ``violations``: floating-port count
              - ``items``: per-violation `{net, sheet, location}`
audit_find_inconsistent_track_widthstool Find nets where the maximum and minimum track widths differ
Find nets where the maximum and minimum track widths differ
        by more than 2×.

        Classic bug pattern: a power rail (VCC / VDD / GND) is routed
        at 20 mil to handle the expected current, then later someone
        adds a connection using the editor's default 8 mil width and
        moves on. The result is a thin orphan stub welded to a wide
        bus -- under load that thin section becomes a thermal hotspot
        and eventually a fab rework. Most agents and human
        reviewers miss it because the bulk of the net looks fine.

        Algorithm: per net, collect min/max track widths on signal
        layers. Ratio > 2.0 → flag. Per-violation reports the actual
        widths and the (x, y) of the *thinnest* track on the net so
        the agent can jump straight to the questionable section.

        Pattern: SDK-derived. No community-script reference.

        Returns:
            Dict with ``{checked, violations, items[]}`` where each
            item carries ``{net, min_width_mils, max_width_mils,
            ratio, thin_x_mils, thin_y_mils}``.
audit_find_invalid_regionstool Find PCB polygon regions whose area is zero or unset.
Find PCB polygon regions whose area is zero or unset.

        These are leftover from cancelled polygon-pour operations or
        corrupted file imports. They don't render visibly but can throw
        DRC violations under "Modified Polygon" rules and bloat board
        size. Read-only: this tool only surfaces them. Auto-delete
        belongs in a separate user-confirmed mutating flow because
        misclassification could remove a real (legitimately small)
        region.

        Returns:
            Dict with:
              - ``checked``: regions inspected (skips primitives owned
                by components or dimensions)
              - ``violations``: invalid-region count
              - ``items``: per-violation `{layer, at}`
audit_find_mirrored_pcb_texttool Find free-floating PCB text (eTextObject) that's mirrored
Find free-floating PCB text (eTextObject) that's mirrored
        on the wrong overlay.

        Rule: top-overlay text must read normally; bottom-overlay
        text must be mirrored. When the assembled board is flipped to
        access the bottom side, the bottom text reads correctly. A
        normally-oriented bottom-side text reads backwards on the
        physical board -- the kind of thing that gets caught only at
        the fab-review stage by the customer's QA, then triggers
        a respin.

        Note: this checks free-floating text (revision strings, layer
        labels, copyright notices) -- NOT component designators or
        comments, which Altium auto-flips with the component.

        Returns:
            Dict with `{checked, violations, items[]}` where each item
            carries `{text, layer, reason}`. ``reason`` is one of
            `top_overlay_text_is_mirrored` or
            `bottom_overlay_text_is_not_mirrored`.
audit_find_missing_datasheetstool Find ICs (designator U*) with no fetchable datasheet URL in
Find ICs (designator U*) with no fetchable datasheet URL in
        any of their parameters.

        Checks the standard Altium slots:
          - HelpURL, Datasheet, DatasheetURL
          - ComponentLink1URL..ComponentLink4URL

        At least one of those needs to carry an ``http(s)://`` value
        for the IC to count as covered. The agent's review discipline
        requires fetching the actual manufacturer datasheet before
        making any device-related claim: ICs without a stored URL
        force the agent to web-search the part name, which is slower
        and more error-prone than a direct link.

        Pattern: ports the dashboard's pickDatasheetLinks heuristic to
        an authoritative Pascal-side audit.

        Returns:
            Dict with `{checked, violations, items[]}` where each item
            carries `{designator, comment, lib_ref}` for an IC missing
            any datasheet link.
audit_find_missing_decouplingtool Find ICs whose power pins lack a nearby decoupling cap.
Find ICs whose power pins lack a nearby decoupling cap.

        For every IC, identify its power pins (by net name or by pin
        name pattern). For each power pin, check if any capacitor
        (designator C*) shares the same net. Buckets:

          - ``missing``: no power pin has any cap on its net (worst)
          - ``partial``: some power pins covered, some not

        ICs with full coverage are not surfaced (no problem to fix).
        ICs with NO recognised power pins are skipped (we can't
        distinguish "no power needed" from "couldn't detect").

        Catches the single most-skipped pre-release review check: a
        missing local bypass doesn't fail ERC, doesn't fail DRC, but
        bites at first power-on with brown-outs / random resets.

        Pattern: ports the dashboard's JS-side analyzeDecoupling.

        Returns:
            Dict with `{checked, violations, items[]}` where each item
            is `{designator, status, covered_pin_count, uncovered_pins[]}`.
            ``status`` is ``missing`` or ``partial``. ``uncovered_pins[]``
            lists each `{pin, name, net}` that needs a cap.
audit_find_mixed_designator_rotationtool Find PCB silkscreens where designators face BOTH 0 and 180
Find PCB silkscreens where designators face BOTH 0 and 180
        (or both 90 and 270) -- the assembly-readability check.

        Assembly inspectors and pick-and-place operators read silkscreen
        from a fixed angle. If half the designators on the top overlay
        read normally and the other half are upside-down (0 vs 180),
        QC has to physically rotate the board between parts -- slow,
        error-prone, and the kind of thing fab houses charge extra to
        deal with. Orthogonal mixes (0 + 90) are fine because the
        inspector turns their head, not the board.

        The check runs per overlay layer (top, bottom) independently --
        a top side with mixed 0/180 doesn't excuse a clean bottom.

        Returns:
            Dict with `{checked, violations, top_mixed_0_180,
            top_mixed_90_270, bottom_mixed_0_180, bottom_mixed_90_270,
            items[]}`. Each item carries `{designator, layer,
            rotation_deg}` for a component contributing to a flagged
            pair, so the agent can rotate those specifically.
audit_find_mpn_inconsistenciestool Find groups of ICs with the same (lib_ref, comment) but
Find groups of ICs with the same (lib_ref, comment) but
        DIFFERENT Manufacturer Part Numbers.

        Two presumably-identical parts pointing at different MPNs is
        almost always a bug: either a typo / accidental override
        during a sub-circuit clone, or means the design genuinely wants
        two sources but lost the alternates table somewhere. The agent
        reviewing the BOM should see this before purchase.

        Pattern: ports the dashboard's analyzeMpnConsistency JS
        heuristic to an authoritative Pascal-side audit.

        Returns:
            Dict with `{checked, violations, items[]}`. Each item
            carries `{lib_ref, comment, mpns, designators}` where
            ``mpns`` is a comma-joined list of the conflicting part
            numbers and ``designators`` lists the components involved.
audit_find_net_label_conflictstool Find net labels that silently merge, short, or do nothing.
Find net labels that silently merge, short, or do nothing.

        All three look correct on a printed sheet:

        1. ``conflicting_labels``: different text at the same point.
           Altium merges the nets under one name, a real short; the
           symptom is a net with zero pins.
        2. ``labels_on_pin_root``: a label on a pin's body-side root
           instead of its electrical end, so it connects nothing. Each
           item gives ``connect_x_mils`` / ``connect_y_mils`` to move it
           to.
        3. ``duplicate_labels``: the same text twice at one point;
           harmless, but it can hide a conflict.

        ``audit_find_orphan_net_labels`` checks only for a wire under
        the label, so it calls a label on a pin end an orphan.

        Returns:
            Dict with ``{checked, conflicts, on_pin_root, duplicates,
            conflicting_labels[], labels_on_pin_root[],
            duplicate_labels[]}``.
audit_find_non_embedded_imagestool Find schematic images that are NOT embedded -- they hold
Find schematic images that are NOT embedded -- they hold
        only a path reference to the original file.

        Non-embedded images render fine on the designer's own machine
        but show a red X / placeholder box on every other machine that
        opens the schematic, because the path doesn't resolve. Common
        offenders are company-logo title-blocks dragged in from a
        network share and never re-saved with EmbedImage=True. The
        manufacturer / customer sees broken images on the SCH PDFs.

        Returns:
            Dict with `{checked, violations, items[]}` where each item
            carries `{sheet, x_mils, y_mils}` for a non-embedded image.
            ``checked`` counts ALL images (embedded + not), ``violations``
            counts only the non-embedded ones.
audit_find_off_grid_componentstool Find schematic components placed off the snap grid.
Find schematic components placed off the snap grid.

        Schematic best practice: components sit on a 100-mil (or whatever
        the project standard is) grid so pins land predictably on wire
        endpoints. Off-grid placement is the classic "I edited around it
        and never resnapped" trap: the symbol LOOKS wired but the pin
        doesn't actually touch the wire, ERC silently passes (no visible
        net) and the connection is missing on the netlist.

        Args:
            grid_mils: Grid size to check against (default 100). Use 50
                if your sheets are set to a half-step grid.

        Returns:
            Dict with:
              - ``checked``: total placed components inspected
              - ``violations``: off-grid component count
              - ``grid_mils``: echo of the grid used
              - ``items``: per-violation `{designator, sheet, at, dx,
                dy}` where ``dx``/``dy`` are the off-grid magnitudes in
                mils. Snap to ``-dx`` / ``-dy`` (or whichever direction
                is closer) to restore grid alignment.
audit_find_orphan_net_labelstool Find schematic net labels whose location is NOT on any
Find schematic net labels whose location is NOT on any
        wire or bus.

        In Altium, a net label labels whichever wire passes through
        its (x, y). If the label sits in empty space (because the
        wire was moved during a layout pass, or was never placed),
        the compile produces a phantom net -- the label looks correct
        on paper but the signal it "names" connects to nothing under
        the label. ERC sometimes catches this (no driver / no load)
        but not always -- the other end of the same-named net often
        provides a load, so the violation never fires.

        Spatial-iterates a 1-mil square at each net label's location
        for any ``eWire`` / ``eBus`` object. Absence → orphan.

        Pattern: SDK-derived. No community-script reference; surfaced
        by reviewing the ``ISch_NetLabel`` interface in the Altium
        Schematic API docs.

        Returns:
            Dict with ``{checked, violations, items[]}`` where each
            item carries ``{label, sheet, x_mils, y_mils}`` for an
            orphan net label.
audit_find_orphan_power_objectstool Find schematic power-port markers (GND, VCC, +3V3 etc.)
Find schematic power-port markers (GND, VCC, +3V3 etc.)
        sitting off-wire.

        Symmetric cousin to ``audit_find_orphan_net_labels``. A power
        port carries its net name (from the marker's Style); the
        marker has to sit ON a wire for the wire to actually adopt
        that net. Markers in empty space create phantom power
        connections -- the schematic LOOKS like the rail is hooked
        up, but the wire underneath is unrelated.

        ERC sometimes catches this when the wire ends up with no
        driver, but power rails frequently have multiple drivers
        (the real connection elsewhere, plus this phantom), so ERC
        sees a valid net and stays quiet.

        Spatial-iterates a 1-mil square at each ``ePowerObject``
        location for any ``eWire``; absence → orphan.

        Pattern: SDK-derived, mirrors the orphan-net-label check.

        Returns:
            Dict with ``{checked, violations, items[]}`` where each
            item carries ``{net, sheet, x_mils, y_mils}`` for an
            orphan power object. ``net`` comes from the marker's
            ``Text`` (its visible net name).
audit_find_pads_near_board_edgetool Find PCB pads / vias closer than ``clearance_mils`` to the
Find PCB pads / vias closer than ``clearance_mils`` to the
        board outline (depaneling damage hazard).

        Copper near a routed or scored edge can be damaged when the board
        is separated; take the limit from the fab's rules. The gap is
        measured from the outline's lines and arcs to the pad's copper
        at any rotation.

        Args:
            clearance_mils: Minimum gap to flag (default 25).

        Returns:
            Dict with:
              - ``checked``: total pads + vias inspected
              - ``violations``: how many are within the clearance
              - ``unmeasured``: pads that could not be measured, which
                are therefore neither passed nor flagged
              - ``clearance_mils``: echo of the threshold used
              - ``items``: per-violation `{kind, designator,
                distance_mils, at}` where ``at`` is "(x,y)" mils.
audit_find_pin_net_name_mismatchestool Find IC pins whose NAME looks like a power / ground pin but
Find IC pins whose NAME looks like a power / ground pin but
        whose connected NET is not actually a power / ground rail.

        Examples flagged:
          - pin "VCC" wired to a non-power net (swapped rail bug)
          - pin "GND" or "VSS" wired to a non-ground net (broken
            reference plane)
        ERC won't catch these: the wire is connected, the names just
        disagree on intent. A class of bug that ships when the user
        copied a sub-circuit and forgot to re-tag the rail.

        Pattern: ports the dashboard's JS-side analyzePinNetMismatch
        as an authoritative MCP audit.

        Returns:
            Dict with `{checked, violations, items[]}` where each item
            carries `{designator, mismatches[]}` with one entry per
            offending pin: `{pin, name, net, kind}`. `kind` is
            ``power_pin_on_non_power_net`` or
            ``ground_pin_on_non_ground_net``.
audit_find_placeholder_valuestool Find SCH component parameters containing obvious "I'll
Find SCH component parameters containing obvious "I'll
        fix this later" placeholder strings that escaped a release.

        Matched values (case-insensitive, whole-string after trim):
          - ``TBD``, ``TBA``
          - ``TODO``, ``FIXME``, ``XXX``
          - ``?``, ``??``, ``???``
          - ``PLACEHOLDER``, ``FILLER``, ``ASK``, ``UNKNOWN``
          - ``N/A``, ``NA``

        Every parameter of every component in the project; empty values
        are left to other audits such as ``audit_find_missing_datasheets``.

        Returns:
            Dict with ``{checked, violations, items[]}`` where each
            item carries ``{designator, parameter, value}`` for a
            component parameter that matched a placeholder pattern.
            ``checked`` counts ALL parameters inspected.
audit_find_removed_pad_shapestool Find pads / vias whose copper annular ring has been removed
Find pads / vias whose copper annular ring has been removed
        on layers where it's still needed.

        Altium's "Tools → Remove Unused Pad Shapes" optimization
        deletes per-layer pad copper where a primitive isn't electrically
        used on that layer. Applied too aggressively, it leaves a via
        that drills through an inner layer with NO annular ring there:
        any later trace edit on that inner layer that tries to land on
        the via will silently fail to connect at fab.

        Detection:
          - Vias: ``Via.SizeOnLayer(L) <= Via.HoleSize`` means no copper
            left, just the drilled hole.
          - Pads: ``Pad.IsPadRemoved(L)`` is True.

        Pattern: brett's PadShapeRemoved.pas (read-only; we surface
        coordinates rather than highlight on canvas).

        Returns:
            Dict with:
              - ``checked``: total pads + vias inspected
              - ``violations``: how many layer-instances are flagged
                (one via removed on 3 layers counts as 3)
              - ``items``: per-violation `{kind, designator, net,
                layer, at}` where ``at`` is "(x,y)" mils.
audit_find_signal_vias_without_returntool Find signal vias that have no nearby ground / power via for
Find signal vias that have no nearby ground / power via for
        return-current flow.

        A signal via changing layers needs its return current to cross
        too; this flags signal vias with no ground or power via within
        ``radius_mils``. Ground and power are guessed from the name
        (starts with GND, V, + or -, or contains GND). A proximity check
        only, not aware of the stackup.

        Args:
            radius_mils: How close a return via must be. Default 50.

        Returns:
            Dict with:
              - ``checked``: signal vias inspected (non-power/ground)
              - ``violations``: signal vias with no return via in range
              - ``radius_mils``: echo of radius used
              - ``items``: per-violation `{net, at}` where ``at`` is
                "(x,y)" mils of the offending signal via
audit_find_single_pin_netstool Find nets that have EXACTLY ONE pin AND at least one
Find nets that have EXACTLY ONE pin AND at least one
        net-label / port / power-object on them.

        A single-pin net is normal for unused / no-connect pins.
        A single-pin net **with a named label** is a broken connection:
        the designer asserted "this signal goes somewhere" by naming it
        but the other end never made it onto the schematic. Common
        causes are a typo in a net-label that doesn't match its peer,
        a sheet-entry vs port-name mismatch on a hierarchical block,
        or an off-page connector that was deleted while routing was
        being re-arranged.

        The flat hierarchy is queried (`DM_DocumentFlattened`) so nets
        spanning multiple sheets via off-page connectors are counted
        as one net.

        Returns:
            Dict with `{checked, violations, items[]}`. Each item
            carries `{net, designator, pin}` for the lonely pin.
audit_find_stale_read_pathstool Find board objects a search by area or a net's list misses.
Find board objects a search by area or a net's list misses.

        A write that reported success can still leave one of the ways of
        finding an object behind, hiding it from a later read, the DRC or
        a pour.

        Per object: the spatial index holds it over its own bounding box
        (searches by area, Altium's online DRC, pours and picking use the
        index), and an object reporting a net is in that net's list
        (connectivity, the ratsnest and pours use the list). Per type: the
        index holds as many objects as a board walk finds.

        Args:
            board_path: The board to check; the focused board when empty.
            types: Comma-separated type names to check (track, arc, via,
                pad, fill, region, text, component_body, component,
                polygon); all of them when empty.
            limit: Most items to list.

        Returns:
            ``checked``, ``violations`` (the sum of the three below),
            ``stale_index``, ``stale_net``, ``count_mismatches``,
            ``counts`` (``{type, board, index}`` per type) and ``items``
            (``read_path`` "index" or "net", type, layer, box in mils).
audit_find_unconnected_ic_pinstool Find IC pins with an empty / unset net (excluding pins
Find IC pins with an empty / unset net (excluding pins
        intentionally named NC / DNC / RSVD / RESERVED).

        Walks the project BOM (cheap: uses the already-cached
        ``project.get_bom`` snapshot, no extra Altium round-trip) and,
        for every component whose designator starts with ``U``, counts
        pins whose `net` is empty / null / "?". Pins whose NAME marks
        them as no-connect by convention are skipped because those
        aren't bugs.

        Same heuristic the Components tab's "unconnected IC pins" chip
        runs in JS, but now exposed as a first-class MCP tool so the
        agent can drill in from one call and the result is consistent
        between the dashboard and the lint sweep.

        Returns:
            Dict with:
              - ``checked``: ICs inspected
              - ``violations``: ICs with at least one unconnected pin
                (the COUNT here is per-IC, not per-pin)
              - ``unconnected_pin_total``: sum of unconnected pins
                across all flagged ICs
              - ``items``: per-IC `{designator, unconnected_pins[]}`
                listing pin numbers + names that were flagged.
audit_find_unlocked_component_primitivestool Find placed components whose internal primitives are NOT
Find placed components whose internal primitives are NOT
        locked. Unlocked primitives are a silent fab-bug class --
        a stray click + drag in the PCB editor moves a single pad
        off-center within the footprint without any warning. The
        gerbers look fine, just slightly off, and the part doesn't
        solder properly because the pad no longer aligns with the
        device's lead.

        Library footprints ship with PrimitiveLock=True by default;
        components show up unlocked when someone clicked Component
        Properties and toggled the flag off (sometimes deliberately
        to nudge silkscreen, more often accidentally).

        Returns:
            Dict with `{checked, violations, items[]}` where each item
            carries `{designator}` for an unlocked component. Pair
            with `obj_modify` and `items` to re-lock at scale.
audit_find_unmatched_portstool Find schematic nets with port-direction mismatches across sheets.
Find schematic nets with port-direction mismatches across sheets.

        Catches the two cases that matter most:

          - **multi_output**: a net has MORE THAN ONE Output port. Two
            drivers fighting for the same net: almost always a wiring
            error or copy-paste mistake.
          - **no_driver**: a net has Input ports but ZERO Output (or
            Bidirectional) ports anywhere in the project. Orphan signal:
            something is listening but nothing is talking.

        Walks compiled docs so multichannel designs are covered. Ports
        are grouped by their flattened net name, so net-label renames
        keep ports correctly clustered.

        Returns:
            Dict with:
              - ``checked``: total port objects inspected
              - ``violations``: net count with at least one issue
              - ``items``: per-net `{net, issue, output_count,
                input_count}`. ``issue`` is ``multi_output`` or
                ``no_driver``.
audit_find_via_antennastool Find vias connected on only one layer (resonating stubs).
Find vias connected on only one layer (resonating stubs).

        A via connected on one layer is an open stub, often left when the
        trace on its other side was rerouted. Connected means copper
        touching it on a signal layer, or a plane connection. Lists them;
        selects nothing.

        Returns:
            Dict with:
              - ``checked``: total vias inspected
              - ``violations``: antenna-via count
              - ``items``: per-violation `{net, at, connected_layers}`
                where ``at`` is "(x,y)" mils and ``connected_layers``
                will always be 1.
audit_find_visible_supplier_pntool Find schematic components with a VISIBLE supplier-PN
Find schematic components with a VISIBLE supplier-PN
        parameter.

        BOM hygiene rule: only the manufacturer's MPN should appear
        on the SCH PDF. Supplier part numbers (Digi-Key, Mouser,
        Newark, Arrow, RS, Farnell) change over time -- a Digi-Key
        bin gets retired, the part is re-binned under a new
        Digi-Key SKU, and an SCH PDF saying "Digi-Key 296-1234-1-ND"
        sends the next person picking the BOM five years from now
        on a wild goose chase. Manufacturer + MPN is stable;
        supplier PNs are not.

        Detects any component parameter whose name starts with
        "supplier" (case-insensitive) AND ``IsHidden=False``. Catches
        the legacy "Supplier Part Number 1" along with any free-text
        "Supplier" / "Supplier 1" variants designers create.

        Returns:
            Dict with `{checked, violations, items[]}` where each item
            carries `{designator, parameter, value}` for a visible
            supplier-PN parameter. Pair with `sch_set_components_parameters`
            to hide them in bulk.
audit_power_port_orientationtool Check that schematic power-symbol orientations follow the standard
Check that schematic power-symbol orientations follow the standard
        convention so reviewers' eyes can scan the sheet quickly.

        Rules:
          - Ground symbols (``ePowerGndPower``, ``ePowerGndSignal``,
            ``ePowerGndEarth``) MUST face down (Orientation = 270deg).
          - Power bars (``ePowerBar``, used for VCC/VDD/V+ rails)
            MUST face up (Orientation = 90deg).

        Stylistic but high signal: a flipped ground symbol or a sideways
        rail is invariably an editing accident, and one violation can hide
        a real wiring issue under it because the eye keeps wanting to fix
        the orientation first.

        Returns:
            Dict with:
              - ``checked``: total power-symbols inspected (grounds + bars)
              - ``violations``: count with wrong orientation
              - ``items``: list of ``{text, style, expected, actual, sheet}``
audit_tented_via_ratiotool Count tented vs untented via SURFACES on the active board and
Count tented vs untented via SURFACES on the active board and
        report the tented ratio.

        Untented vias expose the via barrel through solder mask; in humid
        or salt-spray environments that risks acid traps and copper
        corrosion. For consumer boards spec is usually "all vias tented
        top + bottom"; for prototyping boards a lower ratio is fine.

        Counts top and bottom surfaces separately (a via reaching only the
        top layer contributes one surface, a through-via two). Buried /
        blind via surfaces that don't reach an outer layer are ignored.

        Returns:
            Dict with:
              - ``total_surfaces``: tented + untented (denominator)
              - ``tented``: surfaces with tenting on
              - ``untented``: surfaces with tenting off
              - ``ratio``: tented / total (0.0 - 1.0; 1.0 = all tented)
              - ``violation_pct``: untented / total * 100
audit_variant_not_fittedtool List components marked Not Fitted in the project's CURRENT variant.
List components marked Not Fitted in the project's CURRENT variant.

        Not-fitted parts should get no stencil paste.
        ``pcb_apply_dnp_paste_exclusion`` removes it, after this list has
        been reviewed.

        Returns:
            Dict with:
              - ``variant``: the current variant's description (empty
                when the project has no variant selected: DNP only
                applies to a variant)
              - ``checked``: total flattened-project components
              - ``violations``: how many are NotFitted in this variant
              - ``items``: per-violation `{designator, comment, unique_id}`
datasheet_fetchtool Download a datasheet PDF into the workspace and return its path.
Download a datasheet PDF into the workspace and return its path.

        Read the ``path`` yourself; nothing here parses the PDF. Files are
        cached under ``<workspace>/datasheets`` with a sidecar (URL, part
        number, SHA-256), so a repeat call is a ``cache: "hit"``; a copy
        whose hash no longer matches is fetched again. Refused, storing
        nothing: a non-http(s) URL, over 50 MB, no answer in 60 s, or a
        reply that is not a PDF (a login page); download those in a
        browser instead.

        Args:
            url: the datasheet's http or https URL, ideally the
                manufacturer's own.
            part_number: recorded in the sidecar, for the citation.

        Returns:
            ``{ok, path, sidecar, cache, url, final_url, sha256, size,
            pages, pages_approximate, pages_method, fetched_at}``. ``pages``
            is counted from the page objects in the file without a PDF
            parser and can be None or off for a compressed file.
datasheet_find_pagestool List the pages of a datasheet PDF that mention given words.
List the pages of a datasheet PDF that mention given words.

        With no ``terms`` it looks for where a manufacturer publishes its
        land pattern (land pattern, footprint, PCB layout, solder pad,
        stencil, ...). That is often far from the package outline, so call
        it before deciding a datasheet gives none, then read those pages.
        A scanned page has no text and is not found.

        Args:
            path: the PDF on disk (from datasheet_fetch, or a local file).
            terms: words or phrases to find, case ignored.

        Returns:
            ``{ok, path, pages_searched, terms, pages: [{page, lines}]}``,
            pages 1-based with up to three matching lines each.
datasheet_view_pagetool Render part of a datasheet page as a zoomed image, to read a
Render part of a datasheet page as a zoomed image, to read a
        drawing's small numbers.

        A land-pattern figure read as a whole page is too small: a 0.75
        among 0.5 spacings or a stepped land corner is lost. Read the image
        it writes. Numbers printed as text in the region are also listed.

        Args:
            path: the PDF on disk.
            page: 1-based.
            region: [left, top, right, bottom] as fractions of the page
                from its top left, e.g. [0.3, 0.2, 0.75, 0.6]; empty is the
                whole page.
            dpi: 72 to 800 (default 400).

        Returns:
            ``{ok, png, width, height, region, dpi, numbers: [{value, at}]}``,
            ``at`` the number's place as fractions of the image.
design_add_circuit_blocktool Add a standard sub-circuit to a DesignPlan, wired, in one call.
Add a standard sub-circuit to a DesignPlan, wired, in one call.

        It sets the topology (unique refdes, every pin on its net, power
        and ground tagged) and re-validates the plan. You choose every
        part: lib_ref, value, footprint, mpn, datasheet_url in ``params``.
        Nets the block only touches (a pull-up's signal, a divider's rail)
        should already exist in the plan.

        Blocks and required params (all accept pins, refdes_prefix, sheet;
        design_list_circuit_blocks gives the full contract):
          ``decoupling``: power_net, ground_net, lib_ref [count, value]
          ``pullup``: signal_net, rail_net, lib_ref
          ``pulldown``: signal_net, ground_net, lib_ref
          ``series_resistor``: net_a, net_b, lib_ref
          ``voltage_divider``: rail_net, ground_net, lib_ref_top,
            lib_ref_bottom [output_net]
          ``rc_lowpass`` / ``rc_highpass``: input_net, ground_net,
            lib_ref_r, lib_ref_c [output_net]
          ``led_indicator``: anode_net, cathode_net, lib_ref_r,
            lib_ref_led
          ``crystal``: xin_net, xout_net, ground_net, lib_ref, cap_lib_ref
          ``pi_filter``: input_net, ground_net, lib_ref_l, lib_ref_c
          ``mosfet_low_side``: control_net, load_net, ground_net,
            lib_ref_r, lib_ref_fet
          ``mosfet_high_side``: control_net, load_net, rail_net,
            lib_ref_r, lib_ref_fet

        Args:
            plan_json: the DesignPlan as a JSON string or dict.
            block: block name from the list.
            params: block parameters.

        Returns:
            {ok, plan, added: {refdes, nets, extended_nets}, notes,
            validation}; ``plan`` is ready for the next block or for
            drawing. ``ok`` False comes with ``errors``.
design_add_parttool Add one part and wire its pins to named nets, in one call.
Add one part and wire its pins to named nets, in one call.

        ``connections`` maps pin to net, as a datasheet pinout reads;
        pins on the same net merge onto it. With
        ``design_add_circuit_block`` and ``design_connect_bus`` this
        builds a whole netlist without raw net JSON. You choose the part
        and the net names.

        Args:
            plan_json: the DesignPlan as a JSON string or dict.
            refdes: the new part's designator (must be free in the plan).
            lib_ref: its library symbol name.
            connections: ``{pin: net_name}`` -- a net is created if absent
                or merged into if present.
            value / footprint / lib_path / sheet / manufacturer / mpn /
                datasheet_url / role: standard Part fields.
            power_nets / ground_nets: net names to flag power / ground when
                this call creates them (an existing net keeps its flags).
            net_roles: ``{net_name: role}`` for nets created here.

        Returns:
            ``{ok, plan, added: {refdes, nets, extended_nets}, notes,
            validation}`` -- same shape as ``design_add_circuit_block``.
            ``ok`` is False on a duplicate refdes / empty connections /
            schema error.
design_apply_hierarchytool Rewrite a DesignPlan onto the sheets a hierarchy proposes.
Rewrite a DesignPlan onto the sheets a hierarchy proposes.

        Stage 6 of the autonomous flow (schematic emit,
        reference/autonomy-roadmap.md), the second half of the hierarchy
        step: take the result of ``design_plan_hierarchy`` and produce a
        NEW plan with ``sheets`` = [top sheet, *child sheets], every
        part's ``sheet`` re-homed per the hierarchy, and every zone moved
        with its parts (part-less zones park on the top sheet). The input
        plan is never mutated; a non-split hierarchy returns the plan
        unchanged. Feed the returned plan to ``design_validate_plan`` and
        draw each sheet with ``sch_draw_template``; emit the hierarchy's
        ``top_sheet_ops`` separately to draw the top sheet. Pure Python.

        Args:
            plan_json: DesignPlan as a JSON string or dict.
            hierarchy: The dict returned by ``design_plan_hierarchy``.

        Returns:
            ``{"ok": True, "plan": {...rewritten DesignPlan...},
            "sheets": [names], "summary": "..."}`` or
            ``{"ok": False, "reason": "..."}`` on a malformed plan or
            hierarchy.
design_apply_policytool Run every part of the policy folder that can be applied: theFilesEnv varsoutside text
Run every part of the policy folder that can be applied: the
        board rules (needs a board open) and the ERC set (needs a project).
        A part the policy does not define is ``skipped``; one that fails
        does not stop the other.

        Args:
            apply: False (default) only reports.
            erc_set: The ERC set's name; "" for erc_levels.json.
            project_path: The .PrjPcb for the ERC set.

        Returns:
            ``board_rules`` and ``erc_levels`` replies, and ``skipped``,
            ``failed`` and ``ok`` (no part failed).
design_audit_schematictool Structured visual/layout audit of the active schematic.
Structured visual/layout audit of the active schematic.

        Call AFTER ``sch_draw_template`` and BEFORE ``design_validate``
        so layout problems are fixed first; ERC violations downstream are
        less noisy. Detects three classes of issue, each with enough
        geometry for the planner to compute a corrective move:

          * overlaps        - pairs of components whose bboxes intersect
          * wire_crossings  - wire segments that cross a component body
                              (excluding pin-to-pin connections)
          * stacked_ports   - 3+ power/ground glyphs of the same net
                              huddled inside ``cluster_radius_mils``

        Args:
            project_path: Optional .PrjPcb path. None uses the focused
                project.
            cluster_radius_mils: Radius for stacked-port clustering.
                Default 600 mils.

        Returns:
            SchematicAuditReport dict: ``{ok, project_path, overlaps[],
            wire_crossings[], stacked_ports[], notes[]}``.
            ``ok=True`` iff every list is empty.
design_autonomy_guidetool The autonomous spec-to-board loop protocol, in one call.FilesEnv varsoutside text
The autonomous spec-to-board loop protocol, in one call.

        Returns how to drive a full design run with the harness: the loop
        (start session → design_next_action → execute → log → repeat), the
        13 pipeline stages with their tools and exit gates, the hard
        constraints, and how to resume after context loss. Read this once
        before an autonomous run; `design_next_action` then guides each step.
design_check_company_rulestool Check the open design against one of the company's rules files.FilesEnv varsoutside text
Check the open design against one of the company's rules files.

        Rules files are JSON in ``rules/`` under EDA_AGENT_POLICY_DIR; an
        empty ``rules`` lists them. Rules given as an object are checked
        for mistakes and then run, so a file can be tried before it is
        saved. Check kinds: params_present, param_matches, param_not_in,
        prefix_for_symbol, net_names, no_lone_pins, net_has_part,
        board_rule_present, parts_on_side, and note (guidance that never
        passes or fails).

        The design is read through Altium (BOM, parameters, nets, and the
        board's parts and rules when a board is open); ``data`` stands in
        for that read. A check whose input could not be read is listed in
        ``not_run`` and never counts as passed.

        Returns:
            ``passed`` (no error-level finding), ``tally``, ``findings``,
            ``notes``, ``not_run``, and ``remarks`` about the read.
design_compare_planstool Compare two DesignPlans: parts new, dropped or edited (library
Compare two DesignPlans: parts new, dropped or edited (library
        reference, value, footprint, maker, part number, sheet), nets new,
        dropped or rewired, and pins that changed net.

        Review an edit before drawing it, or hold a plan read back from the
        sheets (design_plan_from_sheet) against the plan it was drawn from.
design_compose_netlisttool Apply many authoring operations to a plan in ONE call.
Apply many authoring operations to a plan in ONE call.

        Runs the operations in order, each seeing the last one's result,
        and validates once at the end: a whole netlist in one call.

        Args:
            plan_json: the DesignPlan as a JSON string or dict.
            operations: ordered list of op dicts, each with an ``"op"`` key:

                * ``{"op": "add_part", "refdes", "lib_ref", "connections",
                  ...}`` -- plus any optional add-part field (``value``,
                  ``footprint``, ``lib_path``, ``power_nets``,
                  ``ground_nets``, ``net_roles``, ...).
                * ``{"op": "add_block", "block", "params"}`` -- see
                  ``design_list_circuit_blocks`` for each block's params.
                * ``{"op": "connect_bus", "endpoints", "net_names"?,
                  "net_prefix"?, "start_index"?}``.

        Returns:
            ``{ok, plan, added: {refdes, nets, extended_nets}, notes,
            validation}`` for the FINAL plan -- same shape as the single-op
            tools. On a bad operation, ``{ok: False, errors: [...]}`` where
            the message names the failing operation's index.
design_compute_component_valuetool Compute a component value snapped to an E-series, with the value
Compute a component value snapped to an E-series, with the value
        actually achieved and its error. Use it instead of hand arithmetic.

        Args:
            kind and what it needs:
              nearest: value
              feedback_divider: v_out, v_ref [r_bottom_ohms]
              resistor_divider: v_in, v_out
              led_resistor: v_supply, v_forward, i_led_ma
              rc_lowpass: f_cutoff_hz and one of r_ohms / c_farads
              crystal_load_caps: c_load_pf [c_stray_pf, default 5]
              i2c_pullup: v_bus, c_bus_pf, t_rise_ns (1000/300/120)
              divider_tolerance: v_in, r_top_ohms, r_bottom_ohms [tol_pct]
              opamp_gain: gain, config (inverting / non_inverting)
              buck_inductor: v_in, v_out, i_out_a, f_sw_khz [ripple_pct]
              capacitor_energy: c_farads, voltage
              holdup_cap: i_load_a, t_s, v_drop
              discharge_resistor: c_farads, v_initial, v_final, t_s
              junction_temp: power_w, theta_ja [t_ambient, default 25]
              max_power: tj_max, theta_ja [t_ambient]
              required_theta_ja: power_w, tj_max [t_ambient]
            series: E6/E12/E24/E48/E96 (default E96; E24 for jellybean).

        Returns:
            {"ok": True, ...values..., "summary"} or {"ok": False, "error"}.
design_connect_bustool Wire a parallel bus across two+ parts in one call.
Wire a parallel bus across two+ parts in one call.

        Joins the i-th pin of every endpoint into one net per bit, so
        bits cannot be misaligned. Creates no parts. A bus of 4 or more
        bits is drawn as a bus.

        Args:
            plan_json: the DesignPlan as a JSON string or dict.
            endpoints: one dict per part on the bus, ``{"refdes": str,
                "pins": [pin, ...]}``. Every endpoint must list the same
                number of pins (the bus width); bit i joins ``pins[i]`` of
                each endpoint.
            net_names: explicit name per bit (length must equal the width);
                omitted -> ``f"{net_prefix}{start_index+i}"`` (D0, D1, ...).
            net_prefix: prefix for auto-named bits.
            start_index: first bit number for auto-naming.

        Returns:
            ``{ok, plan, added: {nets, extended_nets}, notes, validation}``
            -- same shape as ``design_add_circuit_block``. ``ok`` is False
            on a bad endpoint / width mismatch / schema error.
design_datasheet_checklisttool Return the datasheet-first discipline checklist for design review.
Return the datasheet-first discipline checklist for design review.

        Use this when you need the rules without pulling the full
        snapshot. The rules also ship inside the _review_guidance
        block of design_review_snapshot - no need to call this
        separately if you already ran a snapshot.

        Returns:
            Dict with datasheet_rules (list of rules) and a short
            action_required summary.
design_describe_circuitstool Report the electrical behaviour of each recognised sub-circuit.
Report the electrical behaviour of each recognised sub-circuit.

        Recognises the parametric blocks in a ``DesignPlan`` (voltage / feedback
        dividers, RC low/high-pass filters, crystal load networks) and computes
        each one's characteristic from the chosen component values: a divider's
        ratio, a filter's cut-off, a crystal's load capacitance. Use it to
        verify a block does what you intended -- it catches the
        wrong-but-consistent value error (a divider of two valid resistors that
        produces the wrong ratio) that connectivity and equality checks miss.

        Most parameters are ratios / time-constants that need only the values,
        not a supply voltage, so this works on the plan alone. No Altium.

        Returns ``{"ok": True, "circuits": [{motif, parts, summary, params}]}``;
        blocks whose values are missing or unparseable are skipped.
design_edit_plantool Edit an existing plan instead of re-emitting it. The tool does
Edit an existing plan instead of re-emitting it. The tool does
        the bookkeeping (a deleted part leaves every net; merged nets
        de-dupe pins). Ops run in order and the result is validated once
        at the end, so a newly floating net surfaces.

        Operations (each a dict keyed by ``"op"``):

          * ``{"op": "set_part", "refdes", <field>: <value>, ...}`` --
            change ``value`` / ``footprint`` / ``mpn`` / ``manufacturer`` /
            ``lib_ref`` / ``status`` / ``sheet`` / ``role`` / ... on a part.
          * ``{"op": "delete_part", "refdes"}`` -- remove a part; nets it
            emptied are dropped, nets left with one pin are flagged in
            ``notes`` as floating.
          * ``{"op": "set_net", "net", <flag>: <value>, ...}`` -- change a
            net's ``is_power`` / ``is_ground`` / ``role`` / ``force_label``
            / ``force_wires`` (fix a forgotten power/ground flag).
          * ``{"op": "connect_pin", "net", "refdes", "pin"}`` -- tie a
            part's pin to a net (fix an unconnected pin); makes the net if
            new.
          * ``{"op": "disconnect_pin", "net", "refdes", "pin"}`` -- remove a
            pin from a net.
          * ``{"op": "rename_net", "old", "new"}`` -- rename a net.
          * ``{"op": "merge_nets", "into", "from"}`` -- fold ``from`` into
            ``into`` (keeping ``into``'s flags), then drop ``from``.

        Args:
            plan_json: the DesignPlan as a JSON string or dict.
            operations: the ordered edit ops.

        Returns:
            ``{ok, plan, notes, validation}`` for the edited plan -- same
            validation shape as the add tools. On a bad op,
            ``{ok: False, errors: [...]}`` naming the operation's index.
design_export_spice_decktool Write a plan's circuit as a SPICE deck for ngspice or LTspice.Filesoutside text
Write a plan's circuit as a SPICE deck for ngspice or LTspice.

        The same netlist design_simulate_loops runs: R, C and L from their
        values, everything else from the manufacturer's model (``models``,
        as there), rails as DC sources. ``dialect`` "ltspice" writes a
        .net LTspice opens and runs as it is; "ngspice" writes a .cir. A
        plan read off a live sheet comes from design_plan_from_sheet.

        A part without its model is never approximated: the deck is not
        written and ``gaps`` names what is missing. ``allow_partial``
        writes it anyway with every gap listed in comments at the top, so
        the file cannot pass for the whole circuit.

        Args:
            plan_json: a DesignPlan (object or JSON).
            dialect: "ngspice" or "ltspice".
            analyses: {"op": true}, {"tran": {"step", "stop"}},
                {"ac": {"points", "start", "stop"}} (decade) or {"dc":
                {"source", "start", "stop", "step"}}; default .op.
            models / supplies / pin_names: as design_simulate_loops.
            path: file to write; default <workspace>/sim/<title>.cir|.net.
            allow_partial: write a deck that is missing parts.
design_fab_vendor_profiletool A fab profile for one build at a fab, ready forFilesoutside text
A fab profile for one build at a fab, ready for
        ``design_synthesize_rules``, with every value's source.

        Minimums depend on the build: JLCPCB's track is 4 mil on two
        layers, 3.5 mil on four, and grows with copper weight. The
        profile is built for the layer count and outer copper given.
        A figure the fab does not publish is never filled in here: the
        profile is refused, naming each one, until ``fill`` supplies it
        (recorded as yours, not the fab's). PCBWay's standard table, for
        one, gives no hole-to-hole or mask bridge; its ``advanced_normal``
        tier does.

        With ``copper_layers`` 0, returns the vendor's raw figures with
        their quotes instead.

        Args:
            vendor: a fab from design_list_fab_vendors ("JLCPCB",
                "Eurocircuits", "Sierra Circuits", ...)
            copper_layers: copper layer count of the board
            outer_oz: outer copper weight, oz
            tier: the vendor's tier, "standard" by default
            fill: {FabProfile field: mils} for figures the fab does not
                publish, e.g. {"min_hole_to_hole_mils": 10}

        Returns:
            ``{"ok": True, "profile": {...}, "provenance": {field:
            {quote, ...}}, "age": {...}}`` or ``{"ok": False, "missing":
            [{field, reason}], ...}``.
design_find_loopstool Find the circuit loops whose physical size matters, and measureFilesoutside text
Find the circuit loops whose physical size matters, and measure
        them on a placed board. Changes nothing.

        Loops: a switching converter's HOT loop (input cap, switch, low side,
        ground back to the cap; boost: switch, diode, output cap), its
        output loop and bootstrap cap, a MOSFET gate drive, a decoupling cap
        with the IC pins it serves, a crystal with its load caps, a
        regulator FB divider or op-amp feedback network, and a current-sense
        Kelvin connection. Each loop lists its parts and pins IN PATH ORDER
        and says what found it: ``role`` (plan tags), ``pin_name`` (SW,
        BOOT, FB, G/S/D, IN-/OUT, SENSE+) or ``structure`` (netlist shape).

        Give ONE source:
        - ``plan_json``: a DesignPlan; loops only, no geometry.
        - ``board_json_path``: a saved LayoutBoard; loops measured on the
          placement (area and an inductance estimate, or path length),
          worst first.
        - ``expect_file``: the focused board, read live (full path).

        A board carries pad numbers, not pin functions, so pin-function loops
        need ``pin_names``: {refdes: {pad_number: pin_name}}, e.g. from
        lib_get_pin_list. Without them a board gives decoupling, crystal,
        switching and shunt loops from structure alone.

        Args:
            kinds: restrict to these loop kinds.
            limit: loops listed; counts are never cut.
design_generate_bomtool Derive the bill of materials from a plan's parts in one call.
Derive the bill of materials from a plan's parts in one call.

        Every design needs a BOM, and it is mechanical to build from parts
        you already authored -- this rolls them up so you do not hand-group
        refdes (redundant with the parts, and easy to miscount). Parts with
        an ``mpn`` consolidate by ``(manufacturer, mpn)`` -- one orderable
        line each; parts without an mpn consolidate by ``(lib_ref, value,
        footprint)`` -- so every 100 nF 0402 cap is one line. Deterministic
        (natural-sorted, R2 before R10). Pure Python, no Altium.

        ``lines_without_mpn`` flags lines that still need a manufacturer
        part number before the BOM is orderable -- the gaps to fill.

        Args:
            plan_json: the DesignPlan as a JSON string or dict.
            set_on_plan: when True (default), the returned ``plan`` carries
                the generated BOM in its ``bom`` field, ready for
                ``sch_draw_template``; the parts are unchanged.

        Returns:
            ``{ok, bom: [{refdes_list, manufacturer, mpn, description,
            qty}], summary: {line_count, total_parts, lines_without_mpn},
            plan?}``.
design_get_disciplinetool Read the design discipline, and on request the DesignPlan schema.Env vars
Read the design discipline, and on request the DesignPlan schema.

        ALWAYS call this first when starting a design task. The result
        contains the hard rules the planner must follow (datasheet-first
        part choice, NDA isolation, the template method for schematics,
        placement and routing discipline).

        Args:
            include_schema: Also return the DesignPlan JSON schema, which
                the plan tools (design_validate_plan, design_review_plan,
                design_compose_netlist) take. A schematic drawn from
                templates does not need it.

        Returns:
            A dict with ``discipline`` (markdown text) and, when asked,
            ``schema`` (DesignPlan JSON schema as a dict).
design_get_laminatetool A laminate's datasheet figures and the Dk to design with.Filesoutside text
A laminate's datasheet figures and the Dk to design with.

        Makers publish different kinds of Dk: Rogers a process value (a QC
        test) AND a design value 5 % higher, Isola and Panasonic typical
        values by frequency. Each figure here says which it is, with its
        frequency, method and datasheet. The returned design Dk is the
        design value when there is one, else the typical value nearest
        ``frequency_ghz``; never a process value.

        Args:
            name: e.g. "RO4350B", "370HR", "MEGTRON 6" (prefix matches)
            frequency_ghz: the frequency to pick a typical Dk at (0: the
                highest listed)

        Returns:
            The laminate record plus the design Dk it chose and why.
design_get_stackuptool One fab stack-up ply by ply, with optional trace widths forFilesoutside text
One fab stack-up ply by ply, with optional trace widths for
        target impedances and an optional comparison against a board.

        Widths: outer layers as microstrip over the dielectric to the next
        copper; an inner layer only when it sits near the middle of its
        two planes (the closed form is symmetric; otherwise it is reported
        and not sized). Closed forms are +/-10 %, so these are starting
        widths for the fab's solver to confirm.

        Args:
            name: stack-up name, e.g. "JLC04161H-7628"
            impedance_targets: e.g. [{"ohms": 50}, {"ohms": 90,
                "spacing_mils": 6}] (spacing makes it differential)
            board_stackup: a ``pcb_get_layer_stackup`` result to compare
                with; the template's plies are first collapsed to one
                dielectric per copper gap, as Altium keeps them

        Returns:
            ``{"ok": True, "stackup": {...}, "plies": [...], "source":
            {...}, "impedance": {...}?, "comparison": {...}?}``.
design_job_canceltool Cancel a background job.
Cancel a background job.

        One still waiting never starts. A running one stops at the
        engine's next step (a net routed, a progress line), usually within
        seconds: design_job_status shows ``cancel_requested`` until then,
        and ``cancelled`` after. Nothing a cancelled job made is kept.
        To keep what a long route has made, give it a time limit instead
        (pcb_route_round time_limit_s).

        Args:
            job_id: the job.
design_job_resulttool Fetch a finished job's result payload (None until it's done).Files
Fetch a finished job's result payload (None until it's done).

        A router result lists every track and via, which ran to 250,000
        characters on a 61-LED board; the client set it aside in a file
        instead of reading it. So any list longer than a few dozen
        entries comes back as its count and first entries, and the whole
        result is written to ``full_path`` (pcb_autoroute_apply takes the
        tracks from the job itself, not from this reply).

        Args:
            job_id: the job.
            full: return every entry inline, however long.
design_job_starttool Start a long engine run as a background job; returns its id.
Start a long engine run as a background job; returns its id.

        For work that can exceed the MCP tool timeout (routing a dense
        board). Call `design_job_status` with ``wait_seconds`` until it is
        done (nothing notifies you), then `design_job_result`.

        Args:
            kind: registered job kind. Currently: ``route`` (route_plan as
                a job; ``params`` needs a ``geometry`` dict, optional
                ``rules`` / ``nets`` / ``net_classes``).
            params: keyword arguments for the engine.

        Returns:
            ``{"job_id": ..., "kind": ...}`` or ``{"error": ...}`` for an
            unknown kind.
design_job_statustool Status of a background job (or all jobs if ``job_id`` is blank).
Status of a background job (or all jobs if ``job_id`` is blank).

        Nothing tells you when a job finishes, so keep calling this until
        it is done rather than ending your turn: a session that stopped to
        "check when it finishes" was never woken again.

        A running job shows ``elapsed_s`` and ``progress``, the engine's
        latest line (a router's: the round, nets routed, conflicts).

        Args:
            job_id: the job; blank lists every job.
            wait_seconds: hold the call until the job finishes or this
                many seconds pass (capped at 100, inside the client's
                two-minute limit). 0 answers at once.
design_lint_reporttool Run every design-lint audit and return one report.
Run every design-lint audit and return one report.

        Runs the schematic and PCB audits (the same ones as the
        standalone ``audit_*`` tools) plus the BOM-side pin and
        decoupling checks, each section in the shape its audit tool
        returns.

        Args:
            run_drc: Also run Altium's DRC (off by default; it rewrites
                the .DRC report).
            bad_connection_tolerance_mils: Tolerance for
                ``find_bad_connections`` (default 1.0).
            checks: Run only these section names, e.g.
                ``["find_floating_ports", "find_missing_decoupling"]``;
                None runs all. Unknown names come back in
                ``_unknown_checks``.

        Returns:
            ``summary`` (per check ``{checked, violations, severity}``),
            ``sections`` (raw results), ``totals`` (violations, by
            severity, checks run and failed; DRC not counted),
            ``_failed``.
design_list_circuit_blockstool List the canonical circuit blocks and their parameter contracts.
List the canonical circuit blocks and their parameter contracts.

        Discoverability for `design_add_circuit_block`: returns every block
        with its summary, required params, optional params (already folding
        in the universal `sheet` / `lib_path` / `pins`), and which nets it
        creates. Call this to author with the exact parameter names instead
        of guessing -- a mistyped optional key is silently ignored by the
        block, so getting the names right up front avoids an incomplete
        part the ERC can't catch. Pure Python, no Altium.

        Returns:
            ``{ok, blocks: [{name, summary, required, optional,
            creates_nets}]}``.
design_list_fab_vendorstool Fab houses whose published capabilities ship with this server.Filesoutside text
Fab houses whose published capabilities ship with this server.

        Each has its capability page, the day it was read, whether that
        is over a year ago (``stale``), its tiers and how many stack-ups
        it has. Nothing here is recalled: every figure was read off the
        fab's page and carries the fab's own words.

        Returns:
            ``{"ok": True, "vendors": [...], "laminates": [...]}``; each
            laminate with its design Dk.
design_list_stackupstool The fabs' own stack-ups that ship with this server.Filesoutside text
The fabs' own stack-ups that ship with this server.

        JLCPCB's are parsed ply by ply from its impedance page (36 at
        1.6 mm, 4 and 6 layers), so every height and Dk is JLCPCB's.

        Args:
            vendor: limit to one fab ("" for all)
            copper_layers: limit to one copper count (0 for all)

        Returns:
            ``{"ok": True, "stackups": [{name, vendor, copper_layers,
            total_mm, dielectrics}]}``.
design_live_notetool Log a decision to the live view, before acting on it.
Log a decision to the live view, before acting on it.

        The Layout tab lists decisions newest first next to the board, so
        the user sees what is about to happen and why, and can stop it.
        Call this BEFORE the step it describes, one decision per call, in
        a sentence or two: what you will do and the reason (the datasheet
        figure, the rule, the measurement).

        Args:
            section: what the decision is about, a short label such as
                ``placement``, ``routing``, ``rules`` or a block's name.
            text: the decision and its reason.

        Returns:
            The logged entry ``{"seq", "time", "ts", "section", "text"}``,
            or ``{"error": ...}`` when ``text`` is empty.
design_live_snapshottool Publish a board to the live view as its next version.
Publish a board to the live view as its next version.

        Placement and routing jobs publish on their own; use this for any
        other state: the live board (``expect_file``, a few seconds on a
        large board, and never done unasked because reading some boards
        has crashed Altium's scripting engine), a LayoutBoard JSON file,
        or the last board again with a note.

        Args:
            note: what this snapshot shows; also logged as a decision.
            board_json_path: a LayoutBoard JSON file.
            expect_file: full path of the focused board, to read it from
                Altium as it is now. The read refuses if another board is
                focused.
            (Neither: republish the board the last engine job, apply or
            snapshot in this server published.)

        Returns:
            ``{"version", "board", "status": {nets, routed, partly,
            not_started}, "changes": {added, moved, removed}, "seconds",
            "url"}``, or ``{"error": ...}``.
design_live_viewtool Open the live layout view and return its URL.Filesoutside text
Open the live layout view and return its URL.

        Makes sure the local dashboard is running (it usually is, started
        with the MCP server) and points at its Layout tab, which draws the
        board as the in-house placer and router change it: parts, pads,
        tracks per layer, vias, pours, blocks and planned lanes, with new
        and moved items glowing for 30 s and removed copper fading out.
        Next to it is the decision log, newest first, and a status line
        (routed n / N nets, k partly). Give the URL to the user so they can
        watch while you work. Reads files only; no bridge call.

        Args:
            open_browser: also open the URL in the default browser.

        Returns:
            ``{"url", "dashboard": "running"|"started"|"disabled"|"failed",
            "version", "board", "status"}``, plus ``"reason"`` when the
            dashboard is not up. ``version`` is 0 until a board has been
            published.
design_load_fab_profiletool Validate a fab capability profile and echo the normalized form.Filesoutside text
Validate a fab capability profile and echo the normalized form.

        Stage 8 of the autonomous flow (rules & stackup,
        reference/autonomy-roadmap.md): before synthesizing design rules,
        the fab's published limits are captured as a ``FabProfile`` dict --
        transcribed from the fab's capability page (cite it in ``source``),
        NEVER recalled from memory. This tool is the schema gate: it
        validates the dict (all dimensions MILS, copper weight oz/ft^2,
        stackups with copper outer layers and no adjacent copper plies) and
        returns the normalized profile for ``design_synthesize_rules``.

        Args:
            profile: FabProfile as a JSON object/dict: ``name``, optional
                ``source`` citation, ``copper_layer_counts``, the seven
                ``min_*_mils`` floors, and optional ``stackups``.

        Returns:
            ``{"ok": True, "profile": {...}, "stackups": [names],
            "summary": "..."}`` or ``{"ok": False, "reason": "..."}``.
design_next_actiontool Decide the single next action for an autonomous design run.FilesEnv varsoutside text
Decide the single next action for an autonomous design run.

        Reads the session journal and returns the next 13-stage pipeline step
        server-side, so a client need not memorize the workflow: loop
        "call design_next_action -> do what it says -> design_session_log the
        result" until ``status`` is ``complete`` or ``blocked``.

        Returns a dict with ``status`` (proceed | retry | blocked | complete),
        the ``stage``, its ``goal``, ``suggested_tools`` (exact tool names),
        the ``exit_gate`` that marks it done, and, on ``blocked``, the
        ``open_question`` to put to the user. Bounded retries: a stage that
        fails repeatedly escalates to ``blocked`` instead of looping forever.

        The layout stages (placement, routing, pours_tuning, verification)
        have measured gates: the reply also carries ``gate``, the numbers
        and the values that pass, and ``last_gate``, the verdict on numbers
        already logged for the stage. A stage logged ok whose logged numbers
        fail its gate comes back as ``retry``, with the failing numbers in
        ``guidance``. A stage logged with no numbers is taken as logged.
design_phase_answertool Record the answer to one stage check in the product's ledger.Filesoutside text
Record the answer to one stage check in the product's ledger.

        The ledger is only appended to: a new answer replaces the old one in
        reviews and both stay on file. A waiver needs a ``detail``; months
        later an unexplained waiver cannot be told from a skipped check.

        Args:
            key: The check's key from design_phase_gate, e.g. "prototype:drc".
            outcome: met, unmet, waived or open.
            detail: The evidence: a count, a measurement, a document.
            source: The tool that answered, or the person who confirmed it.
            revision: The board revision it applies to.
            product: Whose ledger.

        Returns:
            The check's stage reviewed again: ``stage_cleared``, ``tally``
            and ``holding``.
design_phase_gatetool The checks that close one stage on the way to production, and howFilesoutside text
The checks that close one stage on the way to production, and how
        the product stands against them.

        The stages in order: feasibility, prototype, evt, dvt, pvt. Each check
        says what it asks, why at this stage, what counts as done, which tools
        here answer it, and its outcome from the answers recorded so far. It
        runs nothing: call ``tools_to_run``, then record each result with
        design_phase_answer. ``for_people`` are the holding checks no tool
        can answer.

        Args:
            stage: feasibility, prototype, evt, dvt or pvt (also "design
                validation" and similar).
            revision: The board revision in question; answers given for
                another revision stop counting, and the check says so.
            product: Whose ledger, when there are several products.
            with_reasons: Include each check's ``why_now``.

        Returns:
            ``cleared``, ``tally``, ``checks``, ``holding``, ``tools_to_run``
            and ``for_people``.
design_phase_standingtool Which stage the product is in, and what that stage still needs.Filesoutside text
Which stage the product is in, and what that stage still needs.

        A product is in the FIRST stage that does not clear, however much
        work exists beyond it: a board whose feasibility checks never closed
        is in feasibility.

        Returns:
            ``stage``, ``title``, ``in_production`` (every stage cleared),
            that stage's ``holding`` and ``tools_to_run``, and ``stages``
            (each one's ``cleared``, ``tally`` and ``holding``).
design_plan_from_sheettool Read a DesignPlan back off a schematic so an edit becomes a
Read a DesignPlan back off a schematic so an edit becomes a
        plan edit. Parts come from the components, nets from the compiled
        netlist, rails from the power ports; the plan is validated.

        A schematic does not record, so you supply:

        - ``role`` on each part (decoupling, crystal, op-amp motif...).
        - ``zone`` on each part, for functional blocks.
        - Single-pin nets, which a plan cannot express; they come back
          in ``dropped_pins``.

        Edit the plan, then redraw the block on a fresh sheet with
        ``sch_preview_template`` and ``sch_draw_template`` (plan_json).

        Args:
            project_path: The .PrjPcb the sheet belongs to. Its compiled
                netlist is what supplies the nets.
            sheet_document: Full path to the .SchDoc to read. Defaults to
                the active document.

        Returns:
            ``ok`` / ``plan`` (a DesignPlan dict, or None on a refusal) /
            ``parts_read`` / ``nets_read`` / ``dropped_pins`` / ``notes``,
            and ``complete``: false when anything on the sheet is not in
            the plan. ``interfaces_not_in_plan`` lists each lost
            connection as ``{refdes, pin, net, why, is_rail}`` and
            ``skipped_components`` the parts left out. A redraw from an
            incomplete plan drops them: restore each one and compare the
            netlists before keeping it.
design_plan_hierarchytool Propose a multi-sheet hierarchy for a dense DesignPlan.
Propose a multi-sheet hierarchy for a dense DesignPlan.

        Splits the parts by signal connectivity (min-cut, zones kept
        whole), names each sheet from its main zone, makes ports from the
        signal nets the cut severs (rails stay power ports), and returns
        top-sheet ops shaped for ``sch_place_sheet_symbol``,
        ``sch_place_sheet_entry`` and ``sch_generate_toc``. Apply with
        ``design_apply_hierarchy`` before drawing the sheets. Pure
        Python, deterministic.

        Args:
            plan_json: DesignPlan as a JSON string or dict.
            max_parts_per_sheet: Split threshold (default 20). At or below
                it the plan stays single-sheet (``split=False``).

        Returns:
            ``{"ok": True, "split": bool, "top_sheet": str, "sheets":
            [{name, refdes, zones, part_count}], "ports": [{net,
            from_sheet, to_sheet, io_type}], "top_sheet_ops": [{tool,
            params}], "cut_nets": int}`` (op coordinates are MILS) or
            ``{"ok": False, "reason": "..."}``.
design_review_plantool One-call offline pre-flight: bundle every plan-level analysis.
One-call offline pre-flight: bundle every plan-level analysis.

        Runs, on the plan alone (no Altium), the checks and reports the agent
        would otherwise call one by one, so the planner can vet a design in a
        single step before emit:

          - ``stats``: part counts by kind, IC / passive split, power & ground
            rails, average net degree, the widest signal net (a routing
            hotspot).
          - ``erc``: the ERC-lite report (floating nets, unconnected parts,
            missing decoupling, malformed values, matched-value mismatches);
            ``passed`` is False only on a hard error.
          - ``circuits``: the computed behaviour of each recognised block
            (divider ratios, filter cut-offs, crystal load).
          - ``placement_constraints``: the match / keepout groups that would be
            auto-derived for ``pcb_plan_placement(plan_json=...)``.
          - ``net_classes``: each net's class (power / ground / differential /
            clock / analog / ... / signal) grouped for PCB net-class setup.

        Returns ``{"ok": True, "passed": <erc.passed>, ...sections...}`` or
        ``{"ok": False, "errors"/"error": ...}`` on a schema problem.
design_review_plantool One-call offline pre-flight for a DesignPlan: bundles stats, ERC-lite,
One-call offline pre-flight for a DesignPlan: bundles stats, ERC-lite,
        recognised circuit behaviour, auto-derived placement constraints, and
        net classes -- everything the planner would otherwise call one by one.
design_review_snapshottool Fetch a whole design-review snapshot in ONE call: the compiled
Fetch a whole design-review snapshot in ONE call: the compiled
        netlist and part data that are the BASIS of a review. Judge
        connectivity, values and pin functions from this and the
        datasheets, never from a render (renders are geometry only).

        CRITICAL: read the datasheet of every part in ``_unique_parts``
        before concluding anything about its pins or ratings, and cite it.
        Turn ERC/DRC output into traced findings, not relayed lists, and
        never hand back "verify X". The full rules come in
        ``_review_guidance`` and must be followed.

        Args:
            sections: Sections to include. Default: project_info,
                design_stats, components, nets, design_rules, unrouted,
                diff, messages, board_stats, fab_stats. Extras: "bom",
                "drc", "erc", "unconnected_pins", "project_options".
            include_bom: Add "bom" (default True; best source of MPNs).
            run_drc: Run DRC too (slow, 30-90 s; default off).
            run_erc: Run ERC too (default off).
            force_recompile: Save, drop the compile cache and recompile
                first (~5-10 s) when the user has edited in Altium.

        Returns:
            One key per section, plus ``_review_guidance``,
            ``_unique_parts`` [{manufacturer, part_number, designators}]
            and ``_sections_failed`` (the rest is still usable).
design_session_logtool Append one event to a design-session journal.Filesoutside text
Append one event to a design-session journal.

        ``event`` is one of: ``stage_enter`` (needs ``stage``),
        ``stage_result`` (``stage`` + ``status`` = ok|blocked|failed),
        ``plan_revision`` (``revision``), ``artifact`` (``path``, ``kind``),
        ``blocked`` (``question``), ``resolved`` (``text`` = answer),
        ``note`` (``text``). Returns the updated derived state.

        ``data`` (a dict, or JSON text) goes with a ``stage_result`` or a
        ``note``. On a stage_result it is the evidence for the exit gate:
        for placement, routing, pours_tuning and verification, pass the
        ``pcb_layout_audit`` result (and the ``pcb_calc_length_match`` or
        ``proj_run_erc`` reply under its own tool name) and the reply
        carries ``gate``, the verdict on those numbers. A stage logged ok
        whose numbers fail its gate is sent back by
        ``design_next_action``. ``topic`` files a note under a section of
        ``design_session_report``: placement, stackup, critical_routes,
        power, planes (fan-out and via-in-pad too), silkscreen,
        verification, simulation, issue, or decision.
design_session_resumetool Resume a design run: state plus a plain-language next-action hint.Filesoutside text
Resume a design run: state plus a plain-language next-action hint.

        Surfaces any open blocking question first (answer it before
        proceeding), otherwise names the next pipeline stage to work on. Use
        this at the start of a fresh client session to pick up where the last
        one stopped.
design_session_starttool Open a durable design-session journal for an autonomous run.Filesoutside text
Open a durable design-session journal for an autonomous run.

        The journal is append-only state that survives context compaction,
        client restarts, and model switches, so any later client can resume
        the run from recorded fact instead of chat history. Call this once at
        the start of a spec-to-board task, then log stage results as you go
        and read `design_session_resume` to know what's next.

        Args:
            requirement: the design requirement text this run implements.
            session_id: optional explicit id; defaults to a timestamp.

        Returns:
            ``{"session_id": ..., "state": {...}}``.
design_session_statustool Read a design session's derived state (stage map, artifacts, ...).Filesoutside text
Read a design session's derived state (stage map, artifacts, ...).

        With no ``session_id`` the most recently active session is used.
design_simulate_decktool Simulate a SPICE deck in ngspice or LTspice on this machine and
Simulate a SPICE deck in ngspice or LTspice on this machine and
        return its .meas values, errors and waveforms.

        ``engine`` "auto" uses ngspice when it is installed and LTspice
        when only LTspice is; name "ltspice" or "ngspice" to choose. Both
        return the same shape. Altium's own simulator runs a deck through
        sim_run_deck instead.

        The deck is screened first: .ferret is refused, and .include/.lib
        may only name a bare file or one in the workspace or
        EDA_AGENT_SPICE_MODEL_DIRS. An IC needs its manufacturer's model
        (SPICE_MODEL_RULES); this simulates whatever it is given. LTspice
        refuses a .control block, which is ngspice's.

        Args:
            deck: The SPICE text, with an analysis (.tran, .ac, .dc, .op)
                and any .meas lines.
            engine: "auto", "ngspice" or "ltspice".
            waves: Traces to report (e.g. ["V(out)"]); empty reports all.
            points: Also return this many samples of each trace in
                ``waves`` (AC traces in dB and degrees).
            timeout_s: Stop the simulator after this many seconds.

        Returns:
            ``engine`` and ``why``, ``measures`` ({name: value}),
            ``errors``, ``warnings``, ``plots`` (per analysis, each trace's
            min, max, first and last), ``run_folder`` and ``log_tail``;
            ``install_offers`` when no simulator is installed.
design_simulatorstool Which circuit and field simulators are installed: ngspice
Which circuit and field simulators are installed: ngspice
        (batch build; KiCad's copy is a DLL only) and openEMS with its
        Python bindings, with versions. Changes nothing, installs nothing.

        A missing one comes back with an install offer (source, and the
        scoop command where scoop is present). Put the offer to the user
        and install only after they approve; a missing simulator never
        fails a design, it only skips the simulation.
design_snapshot_inventorytool Open a list of SchLib files and return what components live in them.Files
Open a list of SchLib files and return what components live in them.

        NDA scope: pass only the user's own neutral standard libraries,
        never project-local libraries from another client engagement.

        The returned set is filtered and capped; the full inventory is
        always written to ``<workspace>/inventory.json``.

        Args:
            library_paths: Absolute paths to .SchLib files to scan.
            name_filter: Case-insensitive substring; keep only components
                whose lib_ref or description contains it (e.g. ``"10k"``,
                ``"NE555"``). Empty = no filter.
            limit_per_library: Cap components returned per library
                (default 60; 0 = unlimited). Each library reports
                ``total`` and ``returned`` so you know if it was capped.
            include_descriptions: False drops the (often long)
                ``description`` from each row. Default True.

        Returns:
            Inventory dict: ``{"libraries": [{"path", "total",
            "returned", "components": [...]}]}``. Each component carries
            lib_ref, designator_prefix, pin_count, description (unless
            suppressed), and footprint when available.
design_suggest_diff_pair_tracestool Recommend a controlled-impedance trace width for every differential
Recommend a controlled-impedance trace width for every differential
        pair in a plan.

        Detects the differential pairs (nets with role ``differential``) and
        sizes each to ``target_ohms`` (90 USB / 100 HDMI/LVDS) for the supplied
        stackup and edge-to-edge ``spacing_mils`` via the IPC-2141 impedance
        inverse -- the trace geometry for every pair in one call instead of
        identifying pairs and running ``pcb_calc_trace_width_for_impedance`` by
        hand. The stackup and target are board-level decisions you supply; pure
        Python, no Altium.

        Returns ``{"ok": True, "pairs": [{nets, endpoints, width_mils,
        spacing_mils, target_ohms, feasible}]}`` or ``{"ok": False, ...}``.
design_suggest_partitiontool Split a plan's parts into ``n_groups`` balanced groups with the
Split a plan's parts into ``n_groups`` balanced groups with the
        fewest nets crossing between them (min-cut, Kernighan-Lin style),
        for PCB rooms or schematic sheets. Pure data; touches nothing.
        Assign the groups to part ``sheet`` or ``zone`` yourself.

        A hub-centric design (one IC wired to everything) does not split
        cleanly; check ``cut_nets`` and ``group_sizes`` before acting.

        Args:
            plan_json: A DesignPlan (dict or JSON string).
            n_groups: Number of groups.
            max_fanout: Nets touching more than this many parts are
                treated as rails and ignored.

        Returns:
            ``{ok, n_groups, groups: {idx: [refdes...]}, cut_nets,
            boundary_nets: [names...], group_sizes, summary}``. ``cut_nets``
            is how many nets cross the boundary (lower is cleaner);
            ``boundary_nets`` names them -- those become cross-sheet labels or
            off-sheet connectors if you split there.
design_synthesize_rulestool Synthesize PCB design rules + stackup ops from a fab profile.Filesoutside text
Synthesize PCB design rules + stackup ops from a fab profile.

        Returns ``pcb_create_design_rule`` and ``pcb_modify_layer``
        parameter dicts to send as they are, after
        ``pcb_create_net_class`` creates the classes they name. Every
        number comes from a profile field or a calculator (IPC-2221
        width, IPC-2141 impedance); a rule missing an input is skipped
        with a note. Pure Python, no Altium.

        Args:
            profile: FabProfile as a dict (see ``design_load_fab_profile``).
            plan_json: Optional DesignPlan (JSON string or dict). When given
                and ``net_class_map`` is not, net classes are derived from
                the plan (flags + net roles, naming-agnostic).
            net_class_map: Optional explicit ``{net_name: class}`` map;
                takes precedence over ``plan_json`` derivation.
            options: Optional synthesis targets: ``stackup`` (name, default
                first), ``class_current_a`` ({class: amps} -> per-class
                width rules), ``delta_t_c``, ``track_margin``, ``layer``,
                ``copper_oz``, ``geometry``, ``diff_pair_target_ohms``
                (required for differential rules),
                ``diff_pair_spacing_mils``.

        Returns:
            ``{"ok": True, "rules": [...], "stackup_ops": [...],
            "notes": [...], "stackup": name|None, "net_classes": {...}}``
            -- rule values are INTEGER MILS -- or
            ``{"ok": False, "reason": "..."}``.
design_validatetool ERC + connectivity sanity report on the focused project.
ERC + connectivity sanity report on the focused project.

        Runs run_erc, project.get_messages, and get_unconnected_pins,
        then bundles the output into a structured ValidationReport that
        the planner can read and respond to. Schematic-only in this
        slice, PCB validation is a separate later slice.

        Args:
            project_path: Optional absolute path to a .PrjPcb. If omitted,
                uses the focused project.

        Returns:
            ValidationReport dict: ``{passed, project_path, errors,
            warnings, notes}`` where each error/warning is an Issue with
            ``{category, severity, text, refdes, pin, net, sheet}``.
design_validate_plantool Validate a candidate DesignPlan JSON against the schema + cross-check.
Validate a candidate DesignPlan JSON against the schema + cross-check.

        Run this before drawing to catch schema problems and
        cross-references that ``sch_draw_template`` would reject. Cheap;
        no Altium round-trip.

        Args:
            plan_json: Either a JSON string of the DesignPlan, or the
                DesignPlan as a JSON object/dict. The MCP framework
                auto-deserializes JSON-object literals to dicts before
                the tool sees them, so both shapes are accepted.

        Returns:
            ``{"ok": True, "summary": "..."}`` on success, or
            ``{"ok": False, "errors": [...]}`` listing the specific
            problems. The planner can read these and revise.
design_validate_plantool Validate a candidate DesignPlan JSON against the schema, cross-check
Validate a candidate DesignPlan JSON against the schema, cross-check
        references, and run offline ERC-lite. Returns ``{"ok": True,
        "summary": ...}`` or ``{"ok": False, "errors": [...]}``.
design_validate_requirementtool Validate a DesignRequirement before part selection and planning
Validate a DesignRequirement before part selection and planning
        (stage 1 of the autonomous flow). Pure Python, no Altium.

        A fact the requirement does not state goes into ``open_questions``
        for the user, never guessed; validation fails while any remain.
        Also fails on: no outputs, no power source, inverted temperature or
        IO-voltage ranges, comms IO without a protocol, and a rail or power
        output larger than every power input (a boost or inverting stage
        the user must confirm).

        ``board_intent`` (stackup, impedance, peak currents, edges,
        enclosure, assembly, finish, test) is optional; when one matters
        and is missing, ``notes`` suggests a question.

        Args:
            requirement: DesignRequirement as a JSON object/dict. Units are
                SI with the unit in the field name (``voltage_v``,
                ``current_a``, ``temp_min_c``); mechanical dimensions are
                MILLIMETRES (``board_size_mm``, ``height_max_mm``).

        Returns:
            ``{"ok": True, "issues": [], "notes": [...], "summary": "..."}``
            when the requirement is planning-ready (``summary`` is the
            labelled-line block to embed in ``DesignPlan.summary``), or
            ``{"ok": False, "issues": [...]}`` / ``{"ok": False,
            "errors": [...]}`` (schema problems) listing what to resolve.
design_visual_reviewtool Render the active sheet or board to a PNG you can Read, with aProcessesFilesoutside text
Render the active sheet or board to a PNG you can Read, with a
        critique ``rubric`` naming the audit tool that measures each item.

        SCOPE: layout and placement only (readability, spacing, overlaps,
        silkscreen). Never judge connectivity, values or wiring from the
        image: use ``design_review_snapshot`` and the netlist tools. Loop:
        render, Read ``png_path``, critique, run the named audits, fix,
        render again.

        Args:
            target: "auto" (the active document), "schematic" or "pcb".
            output_path: SVG path (PNG beside it); default the workspace
                renders folder.
            rasterize: Also make the PNG (default True; ``rasterize_note``
                if no browser).
            width: PNG width in pixels.
            margin_mils: Render margin.
            layers: PCB only: these layers.

        Returns:
            ``ok``, ``target``, ``doc``, ``svg_path``, ``png_path``,
            ``counts``, ``bbox``, ``rubric``, ``loop_protocol``,
            ``next_step``.
easyeda_activate_documenttool Switch to an already-open TAB, by its tab id.NetworkEnv varsoutside text
Switch to an already-open TAB, by its tab id.

        Different from opening a document: this brings a tab that is
        already there to the front, and it is how a session moves
        between the schematic and the board.

        That matters more here than it would elsewhere. EasyEDA serves a
        different API depending on which document is focused, so most
        pcb_* reads answer nothing at all from a schematic tab and the
        reverse. Switching first is the fix for a whole family of
        "returned nothing" results.

        A TAB ID IS NOT A DOCUMENT UUID, and nothing converts one to the
        other. ``easyeda_open_document`` returns ``tab_id``, which is
        the only place in the API one can be obtained; if you have only
        a uuid, open the document instead. This previously passed a
        document uuid, which the call does not accept.

        Args:
            tab_id: from ``easyeda_open_document``.
easyeda_add_arctool Draw one arc on the current PCB.NetworkEnv varsoutside text
Draw one arc on the current PCB.

        The arc runs from start to end sweeping ``angle`` degrees, so the
        two endpoints and the angle together fix the radius. A full
        circle is not expressible as one arc: draw two of 180.

        Args:
            start_x: start x.
            start_y: start y.
            end_x: end x.
            end_y: end y.
            angle: swept angle in degrees. Sign sets the direction.
            layer: layer name.
            net: net, if the arc is copper.
            width: line width. The editor's default when omitted.
easyeda_add_bustool Draw a bus on the current schematic.NetworkEnv varsoutside text
Draw a bus on the current schematic.

        Args:
            name: the bus name, and what carries its members, e.g.
                ``D[0..7]``. Required: a bus drawn without one is a
                thick line. It looks like a bus, groups nothing, and the
                signals a reader assumes are in it are not.
            points: the path, as at least two ``[x, y]`` pairs in mils.
easyeda_add_dimensiontool Draw a measured dimension on the current PCB.NetworkEnv varsoutside text
Draw a measured dimension on the current PCB.

        What a fabrication drawing is read from: board size, cutout
        positions, hole spacing. A board sent without them is one where
        the fab measures from the Gerbers and guesses the tolerance.

        Args:
            dimension_type: LENGTH, RADIUS or ANGLE. Each takes a
                different number of points and reads them differently,
                so they are not interchangeable.
            points: ``[x, y]`` pairs in mils. LENGTH takes four: first
                measurement end, first arrow end, second arrow end,
                second measurement end. RADIUS takes three: a point on
                the arc, the dimension line tail, the text corner.
                ANGLE takes three: one edge end, the vertex, the other
                edge end. A wrong count is refused rather than sent,
                since a dimension drawn from the wrong points still
                draws and reads as a measurement.
            layer: which layer to draw on. DOCUMENT by default, since a
                dimension is drawing rather than copper.
            width: line width. The editor's default when omitted.
            precision: decimal places on the measurement.
easyeda_add_filltool Fill a polygon with solid copper on the current PCB.NetworkEnv varsoutside text
Fill a polygon with solid copper on the current PCB.

        Different from a poured zone: a fill is solid and does not flow
        around what it meets, so it will short anything inside it that
        is on another net. Use a zone (``easyeda_add_zone``) for a
        ground plane that has to keep clearance; use a fill for a
        deliberate slab, a thermal pad or a shield.

        Args:
            points: the outline, as at least three ``[x, y]`` pairs in
                mils.
            layer: layer name.
            net: net the copper belongs to.
            width: outline width. The editor's default when omitted.
            locked: lock against interactive edits.
easyeda_add_linetool Draw one line on the current PCB.NetworkEnv varsoutside text
Draw one line on the current PCB.

        Copper on a copper layer, so this is also how a track is drawn:
        EasyEDA has no separate track primitive, a routed segment is a
        line on TOP, BOTTOM or an inner layer with a net on it.

        Args:
            start_x: start x, in mils. The PCB canvas counts in mils
                one to one, unlike the schematic one.
            start_y: start y.
            end_x: end x.
            end_y: end y.
            layer: layer name, e.g. TOP, BOTTOM, TOP_SILKSCREEN,
                BOARD_OUTLINE. Rejected by the editor if unknown, with
                the known names in the message.
            net: net the line belongs to. Empty for silkscreen and
                outline, which have no net.
            width: line width. The editor's default when omitted.
            locked: lock the primitive against interactive edits.
easyeda_add_nets_to_length_match_grouptool Add nets to an existing equal-length group.NetworkEnv varsoutside text
Add nets to an existing equal-length group.

        Args:
            name: the group.
            nets: nets to add.
easyeda_add_nets_to_net_classtool Add nets to an existing net class.NetworkEnv varsoutside text
Add nets to an existing net class.

        Args:
            name: the class.
            nets: nets to add.
easyeda_add_padtool Place a pad on the current PCB or footprint.NetworkEnv varsoutside text
Place a pad on the current PCB or footprint.

        The piece that makes footprint authoring real: open a footprint
        with ``easyeda_open_footprint`` and the drawing tools give it an
        outline and silkscreen, but only pads give it something to
        solder.

        SMD or through-hole is decided by ``hole_diameter``. Leave it at
        zero for surface mount. A through-hole pad usually wants
        ``layer="MULTI"`` so its copper reaches both sides; putting a
        drilled pad on TOP alone leaves the bottom unconnected, which
        looks right on screen and fails on the board.

        Args:
            pad_number: what ties this pad to a symbol pin. Required and
                a string, because "0" and "" are different pads and an
                unnumbered pad is copper the netlist cannot reach.
            x: centre x, in mils.
            y: centre y, in mils.
            width: pad width. For REGULAR_POLYGON this is the diameter.
            height: pad height. Square with the width when omitted.
            shape: ELLIPSE, RECTANGLE, OBLONG or REGULAR_POLYGON.
            layer: TOP, BOTTOM, or MULTI for a through-hole pad.
            net: net the pad belongs to.
            rotation: degrees.
            corner_radius: rounded corners, RECTANGLE only.
            sides: number of sides, REGULAR_POLYGON only. Must exceed 2.
            hole_diameter: drill diameter. Zero means surface mount.
            hole_length: for a slotted hole, the slot length. Ignored
                when it does not exceed the diameter, which is how a
                round hole is asked for.
easyeda_add_padstool Place many pads on the current PCB or footprint in one call.NetworkEnv varsoutside text
Place many pads on the current PCB or footprint in one call.

        A QFP-64 is sixty-four pads, and one call each is sixty-four
        round trips over a socket.

        Coordinates are in mils and take NO conversion. The PCB canvas
        already counts in mils, unlike the schematic canvas, which is
        the difference this backend keeps having to be careful about.

        Stops at the first failure and marks the rest skipped, so a
        part-padded footprint is never mistaken for a finished one.

        Args:
            pads: a list of ``{"pad_number": ..., "x": ..., "y": ...,
                "width": ..., "height": ..., "shape": ..., "layer": ...,
                "rotation": ..., "hole_diameter": ...}``.
easyeda_add_pintool Place a pin on the current symbol.NetworkEnv varsoutside text
Place a pin on the current symbol.

        The symbol counterpart of ``easyeda_add_pad``, and the piece
        that makes a symbol connectable rather than merely drawn. Open a
        symbol with ``easyeda_open_symbol`` first; on an ordinary sheet
        this places a loose pin.

        Args:
            pin_number: what ties this pin to a footprint pad. Required
                and a string, since "0" and "" are different pins and a
                symbol whose pins carry no numbers cannot be matched to
                a package.
            x: the ELECTRICAL end, in mils, which is where a wire
                connects. Not the end at the symbol body: getting them
                the wrong way round leaves wires attaching to thin air
                at a point that looks like a pin.
            y: electrical end y, in mils.
            name: the pin's name, e.g. VCC or RESET.
            pin_type: BI, GROUND, HIZ, IN, OPEN_COLLECTOR, OPEN_EMITTER,
                OUT, PASSIVE, POWER, TERMINATOR or UNDEFINED. This is
                what ERC checks, and it does not change how the pin
                draws: two outputs tied together look exactly like an
                output driving an input.
            rotation: degrees. Which way the pin points out of the body.
            length: pin length. The editor's default when omitted.
easyeda_add_pinstool Place many pins on the current symbol in one call.NetworkEnv varsoutside text
Place many pins on the current symbol in one call.

        A symbol is the worst case for one-call-per-primitive: an SOIC-8
        costs eight round trips and a 100-ball BGA costs a hundred.

        Coordinates are the ELECTRICAL end in mils, the same as the
        single-pin tool, converted once here.

        Stops at the first failure and marks the rest skipped, so a
        half-pinned symbol is never mistaken for a finished one.

        Args:
            pins: a list of ``{"pin_number": ..., "x": ..., "y": ...,
                "name": ..., "pin_type": ..., "rotation": ...,
                "length": ...}``.
easyeda_add_polylinetool Draw a connected run of segments on the current PCB.NetworkEnv varsoutside text
Draw a connected run of segments on the current PCB.

        One call instead of a line per segment, which matters for a
        routed run: every extra round trip is a chance for the board to
        be half-drawn if something fails partway.

        Args:
            points: at least two ``[x, y]`` pairs, in mils.
            layer: layer name.
            net: net the run belongs to.
            width: line width. The editor's default when omitted.
            locked: lock against interactive edits.
easyeda_add_regiontool Mark a keepout or constraint area on the current PCB.NetworkEnv varsoutside text
Mark a keepout or constraint area on the current PCB.

        The area under a connector, beneath a mounting screw, or around
        an antenna, where something must NOT go.

        ``rules`` is required and has no default. A region with no rule
        is just an outline: it draws, it constrains nothing, and the
        board routes straight through the area somebody meant to
        protect, which looks exactly like a region that is working.

        Args:
            points: the outline, as at least three ``[x, y]`` pairs in
                mils.
            rules: one or more of NO_COMPONENTS, NO_WIRES, NO_FILLS,
                NO_POURS, NO_INNER_ELECTRICAL_LAYERS,
                FOLLOW_REGION_RULE.
            layer: layer name.
            name: a name for the region.
            width: outline width. The editor's default when omitted.
            locked: lock against interactive edits.
easyeda_add_schematic_arctool Draw an arc on the current schematic, through three points.NetworkEnv varsoutside text
Draw an arc on the current schematic, through three points.

        Three points on the curve, NOT a centre and a sweep. The middle
        pair is a point the arc passes through. Passing a centre there
        draws a plausible-looking curve in the wrong place, which is the
        kind of mistake that survives a glance at the sheet.

        Args:
            start_x: start x, in mils.
            start_y: start y, in mils.
            reference_x: x of a point the arc passes THROUGH.
            reference_y: y of that point.
            end_x: end x, in mils.
            end_y: end y, in mils.
easyeda_add_schematic_circletool Draw a circle on the current schematic.NetworkEnv varsoutside text
Draw a circle on the current schematic.

        Args:
            x: centre x, in mils.
            y: centre y, in mils.
            radius: radius, in mils. Must be greater than zero: the
                editor would take a zero and draw nothing, which is a
                primitive that exists and cannot be seen.
easyeda_add_schematic_polygontool Draw a closed polygon on the current schematic.NetworkEnv varsoutside text
Draw a closed polygon on the current schematic.

        Args:
            points: at least three ``[x, y]`` pairs, in mils.
easyeda_add_schematic_rectangletool Draw a rectangle on the current schematic.NetworkEnv varsoutside text
Draw a rectangle on the current schematic.

        Used to box a functional block on a sheet, the same job the
        Altium side's ``sch_place_rectangle`` does.

        Args:
            x: TOP-LEFT corner x, in mils. Not a centre and not a
                bottom-left corner. Reading it as either puts the box a
                full height from where it was asked for, which still
                looks like a deliberate drawing.
            y: top-left corner y, in mils.
            width: width, in mils.
            height: height, in mils.
            corner_radius: rounded corner radius, in mils. Square when 0.
            rotation: degrees.
easyeda_add_schematic_texttool Place a text note on the current schematic.NetworkEnv varsoutside text
Place a text note on the current schematic.

        Args:
            text: the string to place.
            x: anchor x, in mils.
            y: anchor y, in mils.
            font_size: text size. The editor's default when omitted.
            rotation: degrees.
            font: font family. The editor's default when empty.
            bold: bold.
            italic: italic.
            underline: underline.
easyeda_add_texttool Place one text string on the current PCB.NetworkEnv varsoutside text
Place one text string on the current PCB.

        Args:
            text: the string to place.
            x: anchor x. Which corner of the text this is depends on
                ``align``.
            y: anchor y.
            font_size: text height, in mils.
            width: stroke width.
            layer: layer name, e.g. TOP_SILKSCREEN.
            align: one of LEFT_TOP, LEFT_MIDDLE, LEFT_BOTTOM, CENTER_TOP,
                CENTER, CENTER_BOTTOM, RIGHT_TOP, RIGHT_MIDDLE,
                RIGHT_BOTTOM.
            rotation: degrees.
            font: font family name.
            mirror: mirror the text. What bottom-side text needs so it
                reads correctly from the bottom.
            locked: lock against interactive edits.
easyeda_add_viatool Place one via on the current PCB.NetworkEnv varsoutside text
Place one via on the current PCB.

        Refused when ``diameter`` does not exceed ``hole_diameter``: the
        editor would accept it and produce a via with no annular ring,
        which is an unmanufacturable board rather than anything visible
        on screen.

        Args:
            x: centre x.
            y: centre y.
            hole_diameter: drill diameter.
            diameter: pad diameter. Must exceed the hole.
            net: net the via connects.
easyeda_add_wiretool Draw a wire on the current schematic.NetworkEnv varsoutside text
Draw a wire on the current schematic.

        THE SCHEMATIC Y AXIS POINTS DOWN. Measured: every wire already
        on a live sheet reports geometry like
        ``[[400, -200, 300, -200]]``, and the editor stores exactly what
        it is given, applying no transformation of its own. So content
        above the origin has NEGATIVE y, and a wire meant to sit beside
        existing content needs coordinates in that same space.

        This is not converted for you, because
        ``easyeda_get_schematic_wires`` reports the editor's own
        geometry and silently flipping the sign here would make a
        read-modify-write land somewhere else. Note that
        ``sch_PrimitiveComponent`` reports POSITIVE y, so the two spaces
        differ and component coordinates cannot be used directly as wire
        coordinates.

        Args:
            points: the path, as at least two ``[x, y]`` pairs in MILS.
                More than two draws a polyline in one call rather than a
                wire per segment. Whole ``[x1, y1, x2, y2]`` segments
                are accepted too, which is the form the editor reports,
                so geometry read back can go straight in again.
            net: net to put the wire on. The editor infers one from what
                the wire touches when this is empty.
easyeda_add_wirestool Draw many wires on the schematic in one call.NetworkEnv varsoutside text
Draw many wires on the schematic in one call.

        The connections pass draws a wire per net segment, so a design
        of any size pays a round trip for each. This is that pass in one
        call.

        Coordinates are in mils and converted once here, the same as the
        single-wire tool.

        Stops at the first failure and reports the rest as skipped, so
        the sheet ends up in the state a sequence of single calls would
        leave it in.

        Args:
            wires: a list of ``{"points": [[x, y], ...], "net": ...}``.
                Each needs at least two points. The net may be empty,
                and then the editor infers one from what the wire
                touches.
easyeda_add_zonetool Pour a copper zone over a polygon on the current PCB.NetworkEnv varsoutside text
Pour a copper zone over a polygon on the current PCB.

        Args:
            points: the outline, as at least three ``[x, y]`` pairs.
                Repeating the first point at the end is accepted and
                dropped: EasyEDA's own polygon example does not repeat
                its start point, so passing the closing point through
                would add a zero-length segment.
            layer: copper layer name: TOP, BOTTOM or an inner layer.
            net: net the pour connects, e.g. GND.
            priority: pour priority, where overlapping pours resolve.
                The editor's default when omitted.
            name: pour name.
            width: outline width. The editor's default when omitted.
            preserve_islands: keep copper islands the pour cuts off
                instead of removing them.
easyeda_align_componentstool Line placed components up along one edge or centre.NetworkEnv varsoutside text
Line placed components up along one edge or centre.

        ALIGNS ORIGINS, not visible edges. EasyEDA reports a
        component's position as its origin and nothing readable gives
        its extent on the board, so for a row of identical parts this is
        exactly edge alignment and for a mixed row it is not. Worth
        knowing before using it on parts of different sizes.

        Moves ONE axis. Aligning left changes x and leaves y alone,
        which is what makes it an alignment rather than a stacking.

        One read and one bulk write, whatever the count.

        Args:
            designators: comma separated, for example "R1,R2,R3".
            alignment: left, right, top, bottom, center_x or center_y.
                The centre modes use the midpoint of the outermost two,
                so the group keeps its position rather than drifting
                toward wherever most of the parts happen to be.
easyeda_audit_acute_anglestool Track joints that meet at an acute angle.NetworkEnv varsoutside text
Track joints that meet at an acute angle.

        An acute joint leaves a sliver of gap the etchant cannot clear
        reliably (an acid trap): some boards of a batch come back with a
        short or a spur there and others do not.

        Segments are grouped by NET and LAYER and compared only where
        they SHARE an endpoint, because two tracks of different nets
        meeting at any angle is a different problem, and a crossing is
        not a joint. The angle measured is between the two directions
        LEAVING the shared point, so a straight continuation reads as
        180 degrees and a hairpin as near zero.

        Field names are measured: every line carries
        ``startX``, ``startY``, ``endX``, ``endY``, ``net`` and
        ``layer``. Segments missing any are counted unreadable rather
        than skipped silently.

        Args:
            threshold_degrees: report joints tighter than this. The
                default of 90 reports everything acute; some fabs only
                care below 60.
easyeda_audit_capacitor_voltage_margintool Capacitors rated too close to the rail they sit on.NetworkEnv varsoutside text
Capacitors rated too close to the rail they sit on.

        A ceramic capacitor loses capacitance under DC bias, and an
        X5R or X7R part run near its rating can be down to a fraction
        of its marked value. The part meets its specification and the
        circuit still misbehaves, which is why this is worth checking
        on the schematic rather than discovering on the bench.

        The default asks for twice the rail voltage. That is the
        common working rule for ceramics rather than a figure from any
        one datasheet, so it is a parameter: a tantalum or an
        electrolytic is usually derated harder, a film part less.

        WHAT IS NOT CHECKED. The actual capacitance under bias, which
        needs the manufacturer's bias curve and cannot be derived from
        a description. This flags the parts whose curve is worth
        reading, and does not pretend to have read it.

        Rails are only judged when their NAME states a voltage. A rail
        called +VBAT or +VSYS has a voltage set by the design, and
        inventing one would produce a confident wrong verdict, so those
        are reported as unknown instead.
easyeda_audit_components_outside_outlinetool Components whose origin falls outside the board outline.NetworkEnv varsoutside text
Components whose origin falls outside the board outline.

        A part off the board is not a drawing mistake to fix later: it
        is not manufactured. The panel is cut to the outline, so the
        part exists in the design, appears in the BOM, is bought and
        placed by nobody.

        Tested by counting how many outline edges a ray from the part
        crosses, which works on an unordered set of segments. That
        matters here because the outline is drawn as loose lines and
        arcs with no guaranteed order, so anything that assumed a walked
        polygon would silently mis-handle a board drawn out of sequence.

        Reports the component ORIGIN, not its body. A part whose origin
        is just inside while half its footprint hangs over the edge is
        not reported, so a clean result is not a promise that everything
        fits.
easyeda_audit_crystal_load_capstool Crystals whose load capacitors are missing or mismatched.NetworkEnv varsoutside text
Crystals whose load capacitors are missing or mismatched.

        A crystal oscillates against the capacitance the circuit
        presents to it. Get that wrong and the part still works, which
        is what makes it worth checking on the schematic: the oscillator
        starts, the frequency is off, and it shows up as a serial link
        that fails only against certain peers or a clock that drifts
        with temperature.

        WHAT IS CHECKED. Each crystal pin reaches a capacitor to ground,
        and the two capacitors carry the SAME value. An unbalanced pair
        pulls the crystal off frequency and is the commoner mistake,
        because both capacitors are present so nothing looks wrong.

        WHAT IS NOT CHECKED. Whether the value is RIGHT. That needs the
        crystal's specified load capacitance from its datasheet and an
        estimate of stray capacitance, neither of which is in the
        schematic. The arithmetic is CL = (C1 C2)/(C1 + C2) + Cstray, so
        the numbers here are reported for that calculation rather than
        judged against a guess.

        A two pin crystal is assumed. A three or four pin oscillator has
        a supply and an output instead of a second load pin, and is
        reported as skipped rather than judged by a rule that does not
        apply to it.
easyeda_audit_dangling_track_endstool Track ends that touch nothing else on their own net.NetworkEnv varsoutside text
Track ends that touch nothing else on their own net.

        Port of the Altium bad-connections audit. A segment whose end
        sits near, but not on, the next thing looks connected on
        screen at any sane zoom, and the photoplot does not bridge it:
        a real open, found at test rather than at review.

        NETS WITH A POUR ARE SKIPPED, and that decision is what makes
        the result readable. A ground track legitimately ends inside
        poured copper, and whether an endpoint lands in a polygon is
        not something this can test from the measured outline, so
        every ground track would be reported. Skipping those nets
        loses coverage on exactly the nets least likely to be broken,
        and keeps the report to signal nets where a dangling end is
        unambiguous. The count of skipped nets is returned rather than
        hidden.

        Fields are the measured ones: lines carry ``startX``,
        ``startY``, ``endX``, ``endY``, ``net`` and ``layer``; pads and
        vias carry ``x``, ``y`` and ``net``; pours carry ``net``. Arcs
        are excluded because no measured arc carried a net at all.

        Args:
            tolerance: how close counts as touching, in mils. The
                router places tracks on a sub-mil grid, so an exact
                match is the wrong test.

        Returns:
            {ok, checked, violation_count, violations: [{net, layer,
             x, y, primitive_id}], nets_skipped_for_pours}.
easyeda_audit_decoupling_schematictool Integrated circuits without a decoupling capacitor.NetworkEnv varsoutside text
Integrated circuits without a decoupling capacitor.

        The check a schematic review exists for. An IC whose supply pin
        has no local capacitor draws its switching current through the
        whole rail, which shows up as a board that works on the bench
        and fails intermittently, or fails emissions.

        The sibling audit ``missing_decoupling`` asks the same question
        of the BOARD, through the engine the Altium backend uses, so
        the two agree across backends. This one reads the SCHEMATIC,
        which differs in two ways that matter: it can be run before a
        board exists, and it counts capacitors against supply PINS
        rather than parts, so an IC with four supply pins and one
        capacitor is reported rather than passed.

        WHAT IS CHECKED. For each IC, every supply net it touches, and
        whether any capacitor sits on that same net with its other end
        on ground. Values are reported so the split between bulk and
        high-frequency decoupling is visible: a rail with a single 22uF
        and nothing small is a different finding from a rail with
        nothing at all.

        WHAT IS NOT CHECKED. Proximity. A schematic cannot say whether
        the capacitor is near the pin, and on a board it is the loop
        area that matters. This finds the missing capacitor, not the
        badly placed one.

        Supply and ground nets are recognised by name, since the
        netlist reports pin numbers without pin functions. Nets that
        match neither convention are listed as unrecognised so a
        non-standard rail name is visible rather than silently ignored.
easyeda_audit_degenerate_coppertool Fills and pours whose outline cannot enclose an area.NetworkEnv varsoutside text
Fills and pours whose outline cannot enclose an area.

        Port of the Altium invalid-regions audit. A region left behind
        by a cancelled pour, or mangled by an import, renders as
        nothing: the board LOOKS as though it has that ground plane
        and does not. Nothing on screen shows the difference, which is
        what makes it worth a check rather than a glance.

        Counting is deliberately conservative. The outline is a flat
        list mixing coordinates with segment markers, measured as
        ``[546.9685, 341.063, "L", 547.0866, ...]``, and only the
        numbers are counted: three points need six of them. If a
        marker like an arc carries extra numeric parameters the count
        comes out HIGH, so a real degenerate could be missed, but a
        healthy region is never flagged. Missing the odd defect is
        recoverable; a review tool that cries wolf is not.

        REPORTS, does not delete. Removing a region that turns out to
        be legitimately tiny is worse than listing it.

        Returns:
            {ok, checked, violation_count, violations: [{kind, layer,
             net, name, points_seen, primitive_id}]}.
easyeda_audit_designator_collisionstool Footprints on the board sharing one designator.NetworkEnv varsoutside text
Footprints on the board sharing one designator.

        Two footprints with the same designator are a real defect, not a
        matter of taste: the BOM counts one part, the netlist binds to
        one of them, and pick-and-place gets two positions for a line
        item that has one. It usually arrives from a copied placement or
        from an annotation that did not finish.

        BOARD ONLY, and that is deliberate. On a schematic a multi-part
        symbol puts the same designator on each of its parts by design,
        so the same check there would report every multi-part IC on the
        sheet. One footprint per designator is the rule that holds.

        Components with no readable designator are counted separately
        rather than grouped together, since an unannotated board would
        otherwise report as one enormous collision.
easyeda_audit_device_pin_paritytool Do a device's symbol and footprint agree on their connections?FilesNetworkEnv varsoutside text
Do a device's symbol and footprint agree on their connections?

        ``easyeda_create_device`` refuses a device bound to neither
        half, but nothing checks the two against each other. An 8-pin
        symbol bound to a 4-pad footprint binds without complaint and
        fails at the netlist or at assembly.

        Compares pin NUMBERS, not counts. A symbol with pins 1 to 8 and
        a footprint with pads 1 to 7 plus 9 has matching counts and is
        wrong.

        REPORTS, does not judge. A footprint legitimately carries
        mounting pads, thermal pads and shield tabs that no symbol pin
        stands behind, so an extra pad is often correct. A pin with no
        pad is the direction that is nearly always a fault: it is a
        connection the schematic makes and the board cannot.

        CHANGES THE OPEN DOCUMENT. Counting means opening the symbol and
        then the footprint, and the footprint is left open when this
        returns. That side effect is the reason this is a separate tool
        rather than a check inside create_device.

        Args:
            uuid: the device's uuid.
            library_uuid: the library holding it.
easyeda_audit_mirrored_texttool Bottom-side text that will read backwards on the real board.NetworkEnv varsoutside text
Bottom-side text that will read backwards on the real board.

        Text on a bottom layer is viewed through the board, so it has to
        be mirrored to come out readable. Unmirrored bottom silkscreen
        looks perfectly correct in the editor, where you are looking at
        it from the top, and comes back from the fab reversed. That is a
        respin of the silkscreen for a defect nothing on screen shows.

        The reverse is reported too: mirrored text on a TOP layer reads
        backwards for the same reason in the other direction.

        Text whose layer or mirror flag cannot be read is listed as
        unchecked rather than assumed correct, since an assumption in
        either direction here is one that gets manufactured.
easyeda_audit_missing_datasheetstool ICs with no fetchable datasheet URL among their parameters.NetworkEnv varsoutside text
ICs with no fetchable datasheet URL among their parameters.

        Port of the Altium audit, checking the same slots it does:
        ``HelpURL``, ``Datasheet``, ``DatasheetURL`` and any
        ``ComponentLink*URL``. A slot counts only when its value
        contains ``://``, which is what separates a real link from a
        placeholder.

        That test earns its keep here. A live schematic reported
        ``ComponentLink1URL`` as the literal string ``=HelpURL``, an
        unresolved display formula rather than an address, and a
        presence check would have called that part documented.

        Reads the SCHEMATIC, because that is where parameters live: a
        schematic tab has to be active or the editor refuses, and the
        refusal is passed through rather than reported as a clean
        board. Component classification uses the same helper as the
        Altium side, so an IC is an IC on both.

        A MEASUREMENT GAP worth knowing before trusting a run. The
        only ``sch.components`` sample captured so far is a mounting
        hole, whose parameters are unresolved templates. The same
        board's ``sch.netlist`` reports a real IC with a fully
        resolved ``ComponentLink1URL`` pointing at a manufacturer PDF.
        So it is not yet established whether ``sch.components``
        resolves parameters for ordinary parts or returns templates
        for all of them, and if it returns templates this audit will
        report documented ICs as missing. Confirming that needs one
        sample of a real IC from ``sch.components``; until then, cross
        a surprising result against ``easyeda_get_schematic_netlist``.

        Returns:
            {ok, checked, violation_count, violations: [{designator,
             name, links_seen}]}. An IC with no parameters at all is a
            violation; a part that is not an IC is not checked.
easyeda_audit_missing_decouplingtool ICs whose power pins have no capacitor on the same net.NetworkEnv varsoutside text
ICs whose power pins have no capacitor on the same net.

        The single most-skipped pre-release check: a missing local
        bypass passes ERC, passes DRC, and bites at first power-on as
        brown-outs and random resets.

        Runs the SAME engine as the Altium audit
        (find_missing_decoupling_from_bom), fed from measured EasyEDA
        data rather than a reimplementation, so the two backends put an
        IC in the same bucket. Components carry their pads nested, and
        each pad carries its net, so one read is enough.

        ONE LIMITATION, and it is the honest direction to fail in: a
        PCB pad has a NUMBER but no pin NAME, so a power pin is
        recognised by its NET name only (VCC / VDD / GND and the rest),
        never by a pin called "VDD" sitting on an oddly-named net. The
        shared engine SKIPS an IC with no recognised power pins rather
        than guessing, so such a part is left unreported instead of
        being reported wrongly. Reading pin names needs the schematic,
        which is a different document context.

        Returns:
            {ok, checked, violations, items: [{designator, status,
             uncovered_pins, covered_pin_count}]} where status is
            "missing" (no power pin has a cap) or "partial". Fully
            covered ICs are not listed: there is nothing to fix.
easyeda_audit_mpn_inconsistenciestool The same library part placed with different part numbers.NetworkEnv varsoutside text
The same library part placed with different part numbers.

        Two presumably-identical components pointing at different MPNs
        is almost always a defect: a typo, or an override made while
        cloning a sub-circuit. Occasionally it means the design wants
        two sources and lost its alternates table. Either way a
        reviewer should see it before the BOM is bought.

        Port of the Altium audit, which groups by library reference.
        Here that is ``Design Item ID`` plus ``Library Name`` from the
        component's parameters, falling back to the library item's
        uuid, which every component carries. The part number is
        ``Partnumber``. All three names are measured from a live
        schematic rather than assumed, which matters because the
        neighbouring ``PP Comment`` holds the formula ``=Comment`` and
        would have made a plausible-looking grouping key that groups
        nothing.

        Blank part numbers are counted separately, not compared: an
        unfilled field is a different problem from a contradictory one,
        and mixing them buries the contradiction.

        Returns:
            {ok, checked, violation_count, violations: [{library_item,
             part_numbers, designators}], blank_part_numbers}.
easyeda_audit_off_grid_componentstool Components whose origin does not sit on the placement grid.NetworkEnv varsoutside text
Components whose origin does not sit on the placement grid.

        Off-grid parts are not wrong, they are awkward: every later
        alignment, array and length-match works from the grid, so one
        part off it turns tidy work into hand-nudging, and the offset
        propagates into whatever gets aligned to that part.

        Reports the offset rather than judging it. A part deliberately
        placed to a mechanical dimension is off-grid on purpose, and
        nothing here can tell that from a slip.

        Args:
            grid: the placement grid pitch, in mils.
easyeda_audit_open_drain_pullupstool Open-drain buses with a missing or badly sized pull-up.NetworkEnv varsoutside text
Open-drain buses with a missing or badly sized pull-up.

        An I2C or SMBus line is driven low and released, never driven
        high. Without a resistor to the rail it stays low, the bus
        never idles, and nothing on it answers. That part is not a
        margin question: the bus does not work.

        The SIZE is arithmetic rather than opinion. UM10204 section 7.1
        derives the rise between the 0.3 and 0.7 thresholds as 0.8473
        RC, so the rise time ceiling in Table 10 fixes a maximum
        resistance: Rp(max) = tr / (0.8473 Cb). Too large and the line
        cannot return high inside the bit period; too small and the
        driver cannot pull it down, since the same section sets
        Rp(min) from the 3mA sink current the specification requires.

        Bus capacitance is the one term a schematic cannot supply: it
        is wire, pins and connectors, and it belongs to the board. So
        rather than assume a figure and report a confident verdict,
        this reports the CROSSOVER capacitance at which each fitted
        resistor stops meeting the rise time, which is a number the
        layout can be checked against. Pass bus_capacitance_pf to get
        a straight verdict once that figure is known.

        The default speed is 100kHz because it is the most forgiving,
        so anything reported at the default is a finding at every
        speed. Set bus_speed_khz to the real bus rate to tighten it.
easyeda_audit_pads_near_board_edgetool Pads too close to the board edge to be made reliably.NetworkEnv varsoutside text
Pads too close to the board edge to be made reliably.

        Distance is measured to the OUTLINE SEGMENTS, not to a bounding
        box. A box overstates a rounded or routed-out board, and it
        overstates it in the dangerous direction: a pad that sits close
        to a real curved edge reads as comfortably inside the box, so
        the check would miss exactly the violations it exists to find.

        Pad SIZE is a different matter. EasyEDA carries it in a shape
        object whose structure is not published, so where a width and
        height can be read the distance is copper-to-edge, and where
        they cannot it is centre-to-edge and understates the risk. Every
        result says which it is, and the summary counts them, so a run
        that could read no sizes is visible rather than quietly
        optimistic.

        Args:
            clearance: the minimum acceptable distance, in mils.
easyeda_audit_parts_excluded_from_bomtool Placed components that will not appear on the BOM.NetworkEnv varsoutside text
Placed components that will not appear on the BOM.

        The EasyEDA analogue of the Altium not-fitted audit, which has
        no direct counterpart here because EasyEDA has no assembly
        variants. The DEFECT is the same and it is expensive: a part
        sits on the board, gets a footprint and gets routed, and
        nobody orders it, which is discovered at assembly.

        REPORTS, does not judge. Mounting holes, fiducials, test
        points and shield cans are excluded from the BOM on purpose
        and are the majority of what this finds on a healthy board.
        What it exists to surface is the ONE resistor somebody
        unticked while copying a block. So the list is grouped by
        whether the part carries a part number: an excluded component
        WITH a Partnumber is the interesting case, since a part
        deliberately off the BOM rarely has one.

        Fields are the measured ones: ``addIntoBom`` on each
        component, and ``Partnumber`` among its parameters.

        Returns:
            {ok, checked, violation_count, violations, excluded_total,
             source}. ``violations`` holds only the excluded parts that
            carry a part number; ``excluded_total`` counts them all.
easyeda_audit_placeholder_valuestool Components still carrying an "I'll fix this later" string.NetworkEnv varsoutside text
Components still carrying an "I'll fix this later" string.

        A part goes down as a placeholder, TBD goes in its value, and
        six months later the assembly drawing says TBD and the fab
        calls. Cheap to find here and expensive to find there.

        Matched whole-string after trimming, case-insensitive: tbd, tba,
        todo, fixme, xxx, xx, ?, ??, ???, -, --, placeholder, filler,
        ask, unknown, n/a, na, none, null, value, changeme.

        Whole-string on purpose. A substring rule would flag a resistor
        valued "1k" for containing "1" and a part named "NAND" for
        containing "na".

        EMPTY values are not reported. A connector, a mounting hole and
        most ICs carry no value by design, so flagging them would bury
        the real findings.

        Scans every readable string field rather than one named value,
        because EasyEDA's published reference lists methods and not the
        shape of what they return. That also catches a placeholder left
        in a manufacturer or part-number field, which is where it does
        the most damage.

        Args:
            scope: "both" (default), "pcb" or "schematic".
easyeda_audit_placeholder_values_schematictool Parts still carrying a placeholder instead of a real value.NetworkEnv varsoutside text
Parts still carrying a placeholder instead of a real value.

        Two kinds, and the first is the one that hides.

        An UNRESOLVED FORMULA is a field left as "=Partnumber" or
        "=HelpURL", where the parameter it points at was never
        supplied. The editor shows the formula rather than an error, so
        it reads as filled in, and it survives all the way into a BOM
        as a part number nobody can order.

        A PLACEHOLDER WORD is TBD, TODO or similar, left during design
        and never revisited.

        A blank Value is reported only for parts whose value is their
        identity, which is resistors, capacitors, inductors and beads.
        A connector or a test point has no value and never will, so
        reporting those would bury the ones that matter.

        The sibling ``placeholder_values`` asks this of the BOARD. This
        reads the schematic, where the parameter is actually set and
        where the fix belongs.
easyeda_audit_placement_collisionstool Placed components whose extents overlap or nearly touch.NetworkEnv varsoutside text
Placed components whose extents overlap or nearly touch.

        REPORTS, does not judge. A bounding box encloses a footprint's
        silkscreen as well as its copper, and silkscreen crossing a
        neighbour is routine. What actually decides whether two parts
        can be assembled is a courtyard, and nothing readable on this
        backend reports one. So a pair here is a place to look.

        Two reads whatever the board size: every component, then every
        bounding box in one batch.

        Args:
            clearance: report pairs closer than this, in mils. Zero
                reports only true overlaps. A small positive value finds
                the near misses, which are often the real problem: parts
                two mils apart pass an overlap test and cannot be hand
                soldered.
easyeda_audit_power_port_orientationtool Power and ground glyphs pointing the wrong way.NetworkEnv varsoutside text
Power and ground glyphs pointing the wrong way.

        A ground symbol drawn upside down, or a rail flag turned
        sideways, is invariably an editing accident. It matters beyond
        tidiness: a VCC glyph pointing down reads as a ground at a
        glance, and one wrong-looking symbol holds the eye long enough
        to hide a real wiring fault underneath it.

        REPORTED AS INCONSISTENCY, NOT AGAINST A FIXED CONVENTION, and
        the difference is deliberate. The Altium check asserts absolute
        angles because Altium's power symbols carry a style
        (``ePowerBar``, ``ePowerGndPower``) that says which way each is
        meant to face. EasyEDA has no such style: a net flag is a net
        flag, and which rotation value points down has never been
        measured here. Asserting one would be a guess, and a guess in an
        audit produces confident findings about nothing.

        So this compares each glyph against the OTHERS OF ITS OWN KIND
        on the same sheet. Grounds are judged against grounds and rails
        against rails, because the two point opposite ways by
        convention. Where a group agrees except for one or two, those
        are reported. Where a group is evenly split, nothing is
        reported and the split is stated: with no majority there is no
        evidence of which way is right.

        Mirroring is reported alongside rotation, since a mirrored
        glyph can read wrongly at the same angle.

        Returns:
            Dict with ``checked``, ``violations``, ``items`` (each with
            ``net``, ``kind``, ``rotation``, ``mirror``, ``expected``
            and ``x``/``y``), and ``groups`` describing what each kind
            agreed on.
easyeda_audit_signal_vias_without_returntool Signal vias with no nearby ground / power via for returnNetworkEnv varsoutside text
Signal vias with no nearby ground / power via for return
        current.

        Port of the Altium audit, same heuristic on both backends: for
        every via NOT on a power/ground net, look for at least one
        power/ground via within ``radius_mils``. When a high-speed
        signal changes layers the return current has to cross the
        dielectric somewhere; a nearby reference via carries it
        cleanly, and without one it detours through the plane.

        Net classification mirrors the Altium side's
        IsPowerOrGroundNetName exactly (GND vocabulary, any name
        containing GND, and the V/+/- rail prefixes), so the two
        backends flag the same boards the same way. This is a
        SIMPLIFIED proximity heuristic, not a stackup-aware analyser;
        for first-pass review it catches the obvious cases.

        Via fields are the measured ones from a live session
        measured: every via carries ``net``, ``x``, ``y`` and
        ``primitiveId``. The PCB canvas is mils, so the radius needs no
        conversion. A via with unreadable coordinates is counted as
        unreadable rather than passed.

        Args:
            radius_mils: how close a return via must be. Default 50
                mils; typical good practice is within 1-2 mm.

        Returns:
            {ok, checked, violations, unreadable, radius_mils,
             items: [{primitive_id, net, x, y}]}.
easyeda_audit_single_pad_netstool Nets that reach exactly one pad on the board.NetworkEnv varsoutside text
Nets that reach exactly one pad on the board.

        A net with one pad connects nothing. It is the shape a dropped
        wire leaves behind, and it survives layout because a one-pad net
        has nothing to route and so never appears as unrouted.

        REPORTS, does not judge. A test point, a mounting hole and a
        shield tab are all legitimately one pad on their own net, and
        nothing readable here separates those from a connection that was
        meant to exist.

        Counted over PADS, not the netlist. A net can carry tracks and
        vias and still reach one pad, so counting copper would hide
        exactly the case this looks for.
easyeda_audit_track_widthstool Nets routed at more than one width.NetworkEnv varsoutside text
Nets routed at more than one width.

        REPORTS, does not judge. A net at several widths is often a
        mistake, a segment drawn before a rule was set or a rework that
        picked up the default. It is also how a deliberate taper into a
        fine-pitch pad looks, and nothing here can tell those apart, so
        the widths are listed and the call is left to a human.

        Counted per net per LAYER. The same net legitimately changes
        width when it moves between an inner layer and an outer one, so
        folding the layers together would report that as a defect on
        every multi-layer board. (The Altium audit folds them; this one
        deliberately does not.)

        This is also the ONLY width check that works here. The per-net
        rules measured on a live board carry the string "default"
        rather than a width, so nothing can be compared against a rule
        without first resolving a fab capability matrix; internal
        consistency needs no rule at all.

        Args:
            ignore_below: treat widths differing by less than this as
                the same, in mils. Rounding in a unit conversion can
                leave two nominally equal segments differing in the last
                decimal, which is noise rather than a finding.
            ratio: when above 1, report only nets whose widest and
                narrowest differ by more than this factor. 2.0 is the
                Altium audit's threshold and isolates the bug worth
                acting on: a rail routed wide for its current, then
                extended at the editor's default, leaving a thin stub
                welded to a wide bus. 0 (the default) keeps the
                report-everything behaviour.
easyeda_audit_unconnected_component_padstool Components with pads on no net, counted per component.NetworkEnv varsoutside text
Components with pads on no net, counted per component.

        The shared unconnected-pins tool names loose pins board-wide;
        this groups them by OWNER, which is what a reviewer acts on: an
        IC with four floating pads is one finding, not four.

        ONE read. Components carry their pads nested (measured live
        measured: every component reported a ``pads`` array whose
        entries carry ``net`` and ``padNumber``), so there is no second
        query and no positional matching between two lists.

        REPORTS, does not judge: a mounting pad, a heatsink tab and a
        deliberately floating shield all look identical here. Two-pad
        parts are excluded by default because a decoupling cap mid-
        placement is noise, not news.

        Args:
            minimum_pads: only components with at least this many pads
                are examined. The default skips passives.
easyeda_audit_via_annular_ringtool Vias whose copper ring around the drill is too thin to make.NetworkEnv varsoutside text
Vias whose copper ring around the drill is too thin to make.

        The ring is (diameter - holeDiameter) / 2. Too thin and drill
        wander breaks out of the pad: an open circuit that appears on
        some boards of a batch and not others, which is the most
        expensive kind of fault to chase.

        Field names are measured rather than assumed: a session on
        reported every via carrying ``diameter``,
        ``holeDiameter``, ``net``, ``x``, ``y`` and ``primitiveId``.
        A via missing either number is counted as unreadable rather
        than passed, since a ring nobody computed is not a ring that
        passed.

        Args:
            minimum_ring: smallest acceptable ring, in mils. The
                default is a common fab floor; check the chosen fab's
                capability table rather than trusting it.
easyeda_audit_via_antennastool Vias whose net has copper on fewer than two layers.NetworkEnv varsoutside text
Vias whose net has copper on fewer than two layers.

        A via joins layers. When everything its net owns sits on ONE
        layer, the via joins that layer to nothing: a stub into the
        board that radiates and reflects instead of connecting. It
        usually survives from a rerouted track whose via nobody deleted.

        Copper is counted from TRACKS, PADS, POURS and FILLS together,
        because a via legitimately lands in a plane pour that carries no
        tracks at all. A pad whose layer reads as MULTI reaches every
        layer by construction, so its net is never an antenna candidate.

        REPORTS, does not judge: a via placed for a plane that has not
        been poured yet looks exactly like a mistake until the pour
        exists.

        Field names are measured across all five reads.
easyeda_audit_vias_near_board_edgetool Vias too close to the board edge to survive routing.NetworkEnv varsoutside text
Vias too close to the board edge to survive routing.

        The same measurement as the pad check and the same reason for
        it, applied to vias: distance to the outline SEGMENTS, never to
        a bounding box, because a box overstates a rounded or routed-out
        board and hides the violations nearest a real curved edge.

        A via close to the edge is worse than a pad there. Depanelling
        cuts through the barrel, and the resulting open circuit is
        intermittent rather than dead, so it survives a functional test.

        Distance is measured to the via's copper where its diameter can
        be read, and to its centre otherwise, and each result says
        which.

        Args:
            clearance: the minimum acceptable distance, in mils.
easyeda_auto_routetool Run the editor's autorouter over the current PCB.NetworkEnv varsoutside text
Run the editor's autorouter over the current PCB.

        Replaces existing routing decisions across the board, so it is
        refused unless ``confirm`` is true. Not destructive the way
        clearing routing is, but it overwrites human work wholesale and
        an agent should have to mean it.

        KNOWN NOT TO WORK on EasyEDA Pro with pro-api 0.2.29:
        ``pcb_Document.autoRouting`` is declared in the published types
        and absent at runtime, measured and matching
        upstream pro-api-sdk issue #28 (the method is @alpha and
        unimplemented). The call fails as "is not a function". Kept
        rather than removed so an editor update that implements it
        starts working here without a change; the capability guard in
        tests flags the day that happens.

        Args:
            confirm: must be true for anything to happen.
easyeda_checkpointtool Save the open document so a later change can be undone.FilesNetworkEnv varsoutside text
Save the open document so a later change can be undone.

        Worth taking before ``easyeda_run_plan`` or any of the
        confirm-guarded tools, which is the whole reason it exists.

        Captures ONE document, the open one, not the project. The Altium
        side snapshots a whole project directory; this backend has no
        directory the server can reach, so what is saved is the document
        the editor currently has.

        Args:
            label: a note to recognise it by later.
easyeda_cleanup_track_sliverstool Delete near-zero track stubs left behind by editing.NetworkEnv varsoutside text
Delete near-zero track stubs left behind by editing.

        Dragging and re-routing leaves fragments a fraction of a mil
        long. They are invisible at any sane zoom, they carry no
        current, and they generate DRC noise that hides real findings,
        which is the actual cost: a violation list nobody reads.

        DRY RUN BY DEFAULT, which is the opposite of most tools here and
        deliberate. This deletes copper. Seeing the list first, and how
        long the "slivers" actually are, is how you find out the
        threshold was wrong BEFORE the tracks are gone rather than
        after. Pass dry_run=False and confirm=True to apply.

        THE THRESHOLD IS CAPPED. Nothing above 10 mils is accepted: at
        that size a segment is real routing, and a cleanup that quietly
        removes real routing is far worse than one that leaves litter.
        A caller who wants to delete longer tracks should select them
        and say so.

        Altium offers a second mode, merging collinear runs into one
        track. That is NOT here: it creates copper as well as deleting
        it, and it needs to know that the shared point is a clean
        two-track junction with no via, pad or arc on it. Neither the
        creation nor that check is settled on this backend, and half of
        a merge is a broken net.

        Args:
            min_length_mils: delete tracks shorter than this. Default 1
                mil. Capped at 10.
            confirm: must be true to delete anything.
            dry_run: report what would go without touching the board.
                On by default.
easyeda_clear_findingstool Remove every marker drawn by ``easyeda_mark_findings``.NetworkEnv varsoutside text
Remove every marker drawn by ``easyeda_mark_findings``.

        Clears the whole overlay rather than one marker: the API
        removes them as a set and offers no per-marker handle.

        Args:
            tab_id: which tab. Defaults to the active one.
easyeda_clear_routingtool Remove existing routing from the current PCB.NetworkEnv varsoutside text
Remove existing routing from the current PCB.

        DESTRUCTIVE, and not undoable through this channel. Refused
        unless ``confirm`` is true, the same guard the Altium side puts
        on a delete-everything call: an agent that can erase every track
        by accident eventually will.

        Args:
            confirm: must be true for anything to happen.
easyeda_clear_schematic_selectiontool Deselect everything on the current schematic.NetworkEnv varsoutside text
Deselect everything on the current schematic.
easyeda_clear_selectiontool Deselect everything in the editor.NetworkEnv varsoutside text
Deselect everything in the editor.
easyeda_close_documenttool Close an open document without deleting anything.NetworkEnv varsoutside text
Close an open document without deleting anything.

        The counterpart to ``easyeda_open_document``, and deliberately
        not confirm-guarded: nothing is removed, and what happens to
        unsaved changes is the editor's own business.

        Args:
            uuid: the document to close.
easyeda_compare_schematic_pcbtool Do the schematic and the board hold the same components?NetworkEnv varsoutside text
Do the schematic and the board hold the same components?

        Compared by designator, which is the only identifier both sides
        carry. Two lists that disagree mean the board has not been
        updated from the schematic, or has been updated and edited
        since.

        This is this project's comparison, not the editor's, and the
        reason is narrower than "EasyEDA has none".

        The editor does carry comparison calls. ``sys_Tool`` documents
        ``netlistComparison(netlist1, netlist2)``, marked beta with an
        unspecified return, and a live capture also shows
        ``pcbComparison`` and ``schematicComparison``, which the
        published reference does not describe at all. All three take
        two artefacts the CALLER supplies rather than reading the open
        design, so they answer a different question from this one.

        The other candidate, ``import_schematic_changes``, APPLIES the
        schematic rather than reporting on it: running it to find out
        what differs would change the board to answer a question about
        it.

        So this compares designator lists itself. Reaching for
        ``netlistComparison`` would mean exporting both netlists first
        and trusting an unspecified reply shape.
easyeda_copy_devicetool Copy a device into another library.NetworkEnv varsoutside text
Copy a device into another library.

        The usual way to adopt a vendor part: copy it into your own
        library, then edit the copy, so the original stays as shipped
        and an update to the vendor library cannot silently change your
        board.

        The device is what gets placed, so copying only its symbol and
        footprint leaves nothing placeable behind.

        Args:
            uuid: the device to copy.
            library_uuid: the library it currently lives in.
            target_library_uuid: where the copy goes.
            new_name: name for the copy. Keeps the original when empty.
easyeda_copy_footprinttool Copy a footprint into another library.NetworkEnv varsoutside text
Copy a footprint into another library.

        Args:
            uuid: the footprint to copy.
            library_uuid: the library it currently lives in.
            target_library_uuid: where the copy goes.
            new_name: name for the copy. Keeps the original name when
                empty.
easyeda_copy_symboltool Copy a symbol into another library.NetworkEnv varsoutside text
Copy a symbol into another library.

        The usual way to start from a vendor part rather than a blank
        one: copy it into your own library first, then edit the copy, so
        the original stays as shipped.

        Args:
            uuid: the symbol to copy.
            library_uuid: the library it currently lives in.
            target_library_uuid: where the copy goes.
            new_name: name for the copy. Keeps the original name when
                empty.
easyeda_create_devicetool Bind a symbol and a footprint into a placeable device.NetworkEnv varsoutside text
Bind a symbol and a footprint into a placeable device.

        This is the object the rest of this backend places. It is also
        where this project's atomic-parts standard lands: symbol,
        footprint and 3D model bound at the part level, so the BOM and
        the layout come out complete on the first pass rather than
        needing a footprint chosen again later.

        Refused with neither a symbol nor a footprint. The API accepts
        that and returns a uuid, so the empty shell would read as a
        created part until somebody tried to place it.

        Args:
            library_uuid: which library the device goes in.
            name: the device name.
            symbol_uuid: the symbol to bind.
            footprint_uuid: the footprint to bind.
            model_3d_uuid: the 3D model to bind.
            description: free text.
            symbol_library_uuid: the symbol's library, when it differs
                from the device's.
            footprint_library_uuid: likewise for the footprint.
            model_3d_library_uuid: likewise for the 3D model.
easyeda_create_differential_pairtool Declare a differential pair on the current PCB.NetworkEnv varsoutside text
Declare a differential pair on the current PCB.

        Declaring the pair is what makes the router treat the two nets
        together. This project can also infer pairs from a netlist, but
        an inferred pair the editor has not been told about routes as two
        unrelated nets.

        Args:
            name: pair name.
            positive_net: the P net.
            negative_net: the N net. Must differ from the P net: a pair
                of one net with itself routes as a pair and is not one.
easyeda_create_footprinttool Create an empty footprint in a library, and return its uuid.NetworkEnv varsoutside text
Create an empty footprint in a library, and return its uuid.

        Args:
            library_uuid: which library.
            name: the footprint name.
            description: free text.
easyeda_create_footprint_from_packagetool Create a COMPLETE footprint from a datasheet package drawing.FilesNetworkEnv varsoutside text
Create a COMPLETE footprint from a datasheet package drawing.

        The EasyEDA twin of ``lib_create_footprint_from_package``, from the
        same engine: the lands come from IPC-7351B for the package's
        terminal dimensions and tolerances, not from a pad list typed in.
        Draws the pads (rounded rectangles with their corner radius,
        circles, ovals, holes and slots), silkscreen kept clear of copper
        with a pin 1 dot, the body outline and a reference text on
        TOP_ASSEMBLY, the courtyard, and paste windows over an exposed
        pad on TOP_PASTE_MASK. Then it reads the pads back from the
        editor and compares count, centres and sizes.

        What the extension cannot express is REFUSED before anything is
        created, not drawn wrong: a non-plated hole (its pad call passes
        no plating flag) and a manual paste or mask expansion. The
        exposed pad's own full paste opening cannot be closed from here
        either; the reply says so and names the pad.

        DATASHEET DISCIPLINE: transcribe the package from the
        manufacturer's drawing fetched in this conversation, each
        dimension as min/nom/max with its page, and name the datasheet
        in ``source``.

        Args:
            library_uuid: the library, from ``easyeda_list_libraries``.
            package: the PackageSpec as an object or JSON text, in mm.
                The same schema as lib_create_footprint_from_package:
                ``family`` plus the dimensions it needs; two-row parts
                have their rows left and right, ``lead_span_x`` across
                them, ``lead_length`` the terminal along the span and
                ``lead_width`` across it.
            name: footprint name; default the package's name.
            density: L, N or M; default the package's own (N).
            description: appended to the generated description.
            courtyard_layer: where the courtyard goes. DOCUMENT by
                default, where easyeda_create_standard_footprint puts it;
                nothing readable on this backend reports a courtyard, so
                pick another layer only if your library uses one.
            drafting: drafting rule overrides, as for the Altium tool.

        Returns:
            ``{ok, name, uuid, pad_count, drawn, readback, layers,
            warnings, notes, steps}``. Coordinates go to the editor in
            mils, converted from the model's mm.
easyeda_create_ic_symboltool Create a COMPLETE IC symbol in one call.FilesNetworkEnv varsoutside text
Create a COMPLETE IC symbol in one call.

        STANDARD SYMBOLS FIRST: a single op-amp, comparator, current-sense
        or instrumentation amplifier is drawn as a TRIANGLE (inputs left
        with + and -, output at the apex, supplies top and bottom) when
        ``body="auto"`` and the pin names form IN+/IN-/OUT. A dual or quad
        stays a rectangle here, and the reply says so; multi-part symbols
        are drawn as triangles on the Altium side. ``body="rectangle"``
        forces the box.

        You decide the functional grouping, inputs and power on the
        LEFT, outputs on the RIGHT. This lays the pins out on the grid,
        sizes the body to clear the pin names, and emits the whole
        symbol: create, then every pin in one batch, then the body.

        The geometry comes from the SAME module the Altium side uses, so
        a symbol drawn here follows the same discipline rules and the
        two backends cannot drift apart on what a good symbol looks
        like.

        Args:
            library_uuid: the library to create it in, from
                ``easyeda_list_libraries``.
            name: the component name.
            left_pins: pins on the left, top to bottom. Each a dict with
                ``designator``, ``name`` and optional
                ``electrical_type`` (input, output, power, passive and
                so on).
            right_pins: pins on the right, top to bottom, same shape.
            description: the component description.
easyeda_create_length_match_grouptool Create an equal-length net group on the current PCB.NetworkEnv varsoutside text
Create an equal-length net group on the current PCB.

        The editor's own grouping, which is what its length tuning acts
        on. ``pcb_calc_length_match`` computes a target offline; this is
        how the board is told to hold it.

        Args:
            name: group name.
            nets: nets to match.
            color: as for a net class. The editor chooses when omitted.
easyeda_create_net_classtool Create a net class on the current PCB.NetworkEnv varsoutside text
Create a net class on the current PCB.

        Args:
            name: class name.
            nets: nets to put in it.
            color: how the class is drawn, as ``{"r":.., "g":.., "b":..}``
                with an optional ``alpha``. The editor chooses when
                omitted, which is why there is no default here: a colour
                invented on this side would silently restyle a board.
easyeda_create_net_flagtool Place a power or ground rail glyph on the schematic.NetworkEnv varsoutside text
Place a power or ground rail glyph on the schematic.

        Args:
            name: the net the glyph carries, e.g. GND or V3V3.
            x: placement x, in mils.
            y: placement y, in mils.
            kind: Power, Ground, AnalogGround or ProtectGround. Analog
                ground is a separate glyph on purpose: drawing AGND with
                the plain ground symbol loses the distinction the
                schematic exists to show.
            rotation: degrees.
            mirror: mirror the glyph.
easyeda_create_net_labeltool Place a net label on the schematic, at a point.NetworkEnv varsoutside text
Place a net label on the schematic, at a point.

        The coordinates are not decoration. A label connects whatever it
        sits on, so one placed away from a pin names a net that touches
        nothing, and the schematic still looks labelled.

        Args:
            name: the net the label carries.
            x: placement x, in mils. Put it at the pin.
            y: placement y, in mils.
easyeda_create_net_porttool Place a net port on the schematic, at a point.NetworkEnv varsoutside text
Place a net port on the schematic, at a point.

        A sheet-level connector. For a power or ground rail glyph use
        ``easyeda_create_net_flag`` instead: EasyEDA treats those as a
        different object, and a port standing in for a rail symbol
        connects correctly while reading wrong to anyone used to the
        convention, so nothing catches it.

        Args:
            name: the net the port carries.
            x: placement x, in mils.
            y: placement y, in mils.
            direction: IN, OUT or BI.
            rotation: degrees.
            mirror: mirror the glyph.
easyeda_create_paneltool Create a panel document.NetworkEnv varsoutside text
Create a panel document.

        This is where a panelised fabrication starts on EasyEDA, and it
        is NOT the same thing as Altium's step-and-repeat: it makes the
        document, and nothing here arranges boards inside it. dmt_Panel
        has no add, insert or place method and neither does dmt_Board,
        so populating the panel appears not to be exposed to extensions
        at all. Treat this as document management.

        NAMING IS A SECOND STEP. ``createPanel()`` takes no arguments,
        so the panel is created with the editor's default name and then
        renamed. The reply reports ``created`` and ``named`` separately,
        because a panel that exists under the wrong name is a different
        outcome from one that was never made. Before this the name was
        passed to a method that does not accept it and was silently
        dropped, so the rename never happened at all.

        Args:
            name: what to call it. Applied by a follow-up rename. Left
                empty, the editor's default name stands.
easyeda_create_passive_symboltool Create a complete 2-pin passive symbol in one call.FilesNetworkEnv varsoutside text
Create a complete 2-pin passive symbol in one call.

        The companion to ``easyeda_create_ic_symbol``, using the same
        shared geometry module, so a resistor drawn here matches one
        drawn on the Altium side.

        ONLY resistor and inductor for now, and the reason is a genuine
        limit rather than unfinished work. EasyEDA's schematic
        primitives are arc, circle, polygon, rectangle, text, wire, pin
        and bus, with no LINE among them. A resistor is a rectangle and
        an inductor is a row of arcs. A capacitor is two plates, a diode a bar, a crystal
        two plates and a fuse a lead through a body, and every one of
        those is an open segment.

        A wire would draw the shape and would also be electrical, so the
        symbol would carry connectivity nobody asked for and the fault
        would surface later as a net joining two unrelated things.

        Args:
            library_uuid: the library to create it in, from
                ``easyeda_list_libraries``.
            name: the component name.
            kind: resistor or inductor. The other kinds
                ``generate_passive_symbol`` knows are refused here with
                an explanation.
            description: the component description.
easyeda_create_pcbtool Add a board to the open project.NetworkEnv varsoutside text
Add a board to the open project.

        Args:
            name: what to call it. The editor picks a default when
                empty.
easyeda_create_projecttool Create a project.NetworkEnv varsoutside text
Create a project.

        Args:
            name: the display name.
            internal_name: the short name, if it should differ from the
                display name.
            description: free text.
            team_uuid: create it under a team rather than personally.
            folder_uuid: put it in a folder.
easyeda_create_schematictool Add a schematic to the open project.NetworkEnv varsoutside text
Add a schematic to the open project.

        Part of the from-scratch path: create the project, then a
        schematic and a board inside it. Without these the backend can
        only work on something a human made first, which is the
        difference between editing a design and authoring one.

        Args:
            name: what to call it. The editor picks a default when
                empty.
easyeda_create_schematic_pagetool Add a page to an existing schematic.NetworkEnv varsoutside text
Add a page to an existing schematic.

        Args:
            uuid: the schematic, from ``easyeda_list_schematics``.
easyeda_create_standard_footprinttool Create a COMPLETE standard footprint in one call.FilesNetworkEnv varsoutside text
Create a COMPLETE standard footprint in one call.

        The board-side companion to ``easyeda_create_ic_symbol``, using
        the same shared geometry module the Altium backend uses, so a
        land pattern generated here matches one generated there.

        Emits the pads in one batch, then the silkscreen outline and the
        courtyard.

        THIS IS A STARTING POINT, NOT A LAND PATTERN FROM A DATASHEET.
        It computes a regular geometry from the numbers given; it does
        not know the part. Check it against the manufacturer's
        recommended land pattern before using it on a board.

        Args:
            library_uuid: the library to create it in, from
                ``easyeda_list_libraries``.
            name: the footprint name.
            family: chip, sip, dual, header, tab, quad or bga.
            pin_count: total pads; the signal pins for tab; ignored for
                bga, whose count is rows x cols.
            pitch: centre-to-centre within a row, in mils.
            pad_width: pad width, in mils. The shared generator's pad_w,
                with its two meanings kept: the pad's X size in every
                family but quad (so ACROSS the row in dual), and ALONG
                the row in quad. For a land pattern from a package
                drawing use easyeda_create_footprint_from_package.
            pad_height: pad height, in mils.
            row_span: centre-to-centre between opposing rows, in mils.
                Required for dual and quad.
            corner_radius: rounding for rectangular pads, in mils. The
                shared geometry asks for a roundrect and EasyEDA carries
                the rounding separately, so the radius is chosen here
                rather than invented.
            hole_diameter: drill diameter, in mils. Zero means surface
                mount. A header is through-hole by nature and comes out
                unsolderable without this, so it is not optional in
                practice for the header family.
            description: the footprint description.
            rows, cols: the ball grid, for bga.
            skip: ball names to leave out of a bga, e.g. ["A1"].
            tab_width, tab_height: the tab pad, for tab, in mils; the
                tab takes the next number after the signal pins.
            exposed_pad: a square centre pad for quad, in mils; 0 for
                none. It takes the next number after the pins.
            courtyard: courtyard clearance past the pads, in mils; 0
                leaves the courtyard out.
            body_width, body_height: the body for the silkscreen
                outline, in mils; 0 draws it round the pads.
easyeda_create_symboltool Create an empty symbol in a library, and return its uuid.NetworkEnv varsoutside text
Create an empty symbol in a library, and return its uuid.

        A drawing, not a placeable part. Placing needs a DEVICE, which
        binds a symbol to a footprint: see
        ``easyeda_create_device``. Creating symbols and footprints and
        stopping there leaves a library nobody can place from, which
        looks like progress.

        Args:
            library_uuid: which library, from
                ``easyeda_list_libraries``. There is no default: a part
                created in the wrong library is found by nobody looking
                for it.
            name: the symbol name.
            description: free text.
easyeda_cross_probetool Reveal parts, pins or nets in the editor by NAME.NetworkEnv varsoutside text
Reveal parts, pins or nets in the editor by NAME.

        The counterpart to a query: having found something, put it in
        front of the human rather than describing where it is. This is
        the schematic-to-board link, so it works in the vocabulary a
        review speaks, designators and net names, rather than in
        internal ids.

        NOT BY PRIMITIVE ID. Use ``easyeda_select_primitives`` for
        those; the two identifier spaces are separate and this call
        matches nothing when handed an id. It previously passed
        primitive ids here and reported a count of whatever it was
        given, so it looked successful while selecting nothing.

        Args:
            designators: comma-separated, e.g. "U1,R4".
            pins: comma-separated ``designator_pin``, e.g. "U1_1,U1_2".
            nets: comma-separated net names.
            highlight: highlight the matches. On by default.
            select: select the matches. On by default.
easyeda_delete_devicetool Remove a device from a library.NetworkEnv varsoutside text
Remove a device from a library.

        DESTRUCTIVE. Refused unless ``confirm`` is true, and the
        extension refuses independently.

        It does not touch boards already using the part: those keep the
        placed copy, so a design can keep working while the library
        entry it came from no longer exists.

        Args:
            uuid: the device.
            library_uuid: the library it lives in.
            confirm: must be true for anything to happen.
easyeda_delete_footprinttool Remove a footprint from a library.NetworkEnv varsoutside text
Remove a footprint from a library.

        DESTRUCTIVE. Refused unless ``confirm`` is true, and the
        extension refuses independently.

        The same warning as ``easyeda_delete_symbol``: a footprint bound
        to a device leaves that device pointing at a land pattern that
        is gone, and nothing readable here reports the binding.

        Args:
            uuid: the footprint.
            library_uuid: the library it lives in.
            confirm: must be true for anything to happen.
easyeda_delete_paneltool Delete a panel document. There is no undo.NetworkEnv varsoutside text
Delete a panel document. There is no undo.

        Checkpoints on this backend save ONE open document, so a deleted
        panel is not something this side can put back.

        Args:
            uuid: the panel's identifier.
            confirm: must be true. Nothing is sent without it.
easyeda_delete_pcbtool Delete a board, including its routing.NetworkEnv varsoutside text
Delete a board, including its routing.

        DESTRUCTIVE. The routing is the expensive part: a board deleted
        by mistake is hours of work, and nothing on this side can
        restore it.

        Args:
            uuid: the board; list them with ``easyeda_list_boards``.
            confirm: must be true for anything to happen.
easyeda_delete_primitivestool Delete primitives from the current PCB by id.NetworkEnv varsoutside text
Delete primitives from the current PCB by id.

        DESTRUCTIVE. Refused unless ``confirm`` is true, and the
        extension refuses independently, because that channel is
        reachable by anything speaking this protocol and cannot assume a
        caller already checked.

        Args:
            kind: which primitive class the ids belong to: line, arc,
                via, text, pad, fill, region, pour or component. Each
                class deletes only its own kind, and the caller knows
                what it created.
            primitive_ids: ids to delete.
            confirm: must be true for anything to happen.
easyeda_delete_projecttool NOT POSSIBLE on EasyEDA. Delete the parts, or use the UI.
NOT POSSIBLE on EasyEDA. Delete the parts, or use the UI.

        EasyEDA'S API CANNOT DELETE A PROJECT. ``dmt_Project`` offers
        create, open, move and the info reads, and no other class
        deletes one either: the document tree can remove a board, a
        folder, a panel, a PCB, a schematic and a schematic page, but
        never the project itself.

        This previously called a method that does not exist, so it threw
        a TypeError AFTER the caller had confirmed a destructive
        operation. It now refuses up front and says what can be deleted.

        Use ``easyeda_delete_schematic``, ``easyeda_delete_pcb`` or
        ``easyeda_delete_panel`` for the contents, and the EasyEDA UI
        for the project.

        Args:
            uuid: accepted and unused, so an existing caller gets the
                explanation rather than a signature error.
            confirm: accepted and unused, for the same reason.
easyeda_delete_schematictool Delete a schematic and every page in it.NetworkEnv varsoutside text
Delete a schematic and every page in it.

        DESTRUCTIVE. Refused unless ``confirm`` is true, and the
        extension refuses independently, so a caller that forgets on one
        side is still stopped on the other.

        Take a checkpoint first: ``easyeda_checkpoint`` saves the open
        document, and this removes a whole schematic, which no
        checkpoint here can put back.

        Args:
            uuid: the schematic to delete; list them with
                ``easyeda_list_schematics``.
            confirm: must be true for anything to happen.
easyeda_delete_schematic_pagetool Delete one page of a schematic.NetworkEnv varsoutside text
Delete one page of a schematic.

        DESTRUCTIVE, and the narrower of the two: this removes a single
        sheet rather than the whole schematic.

        Args:
            uuid: the page; list them with
                ``easyeda_list_schematic_pages``.
            confirm: must be true for anything to happen.
easyeda_delete_schematic_primitivestool Delete primitives from the current schematic by id.NetworkEnv varsoutside text
Delete primitives from the current schematic by id.

        DESTRUCTIVE. Refused unless ``confirm`` is true, and the
        extension refuses independently.

        Args:
            kind: which primitive class the ids belong to: wire, text,
                rectangle, component or attribute.
            primitive_ids: ids to delete.
            confirm: must be true for anything to happen.
easyeda_delete_symboltool Remove a symbol from a library.NetworkEnv varsoutside text
Remove a symbol from a library.

        DESTRUCTIVE. Refused unless ``confirm`` is true, and the
        extension refuses independently.

        A symbol can be BOUND to a device, and deleting it leaves that
        device pointing at a drawing that no longer exists. Nothing
        readable on this backend reports which devices use which symbol,
        so this cannot check and does not pretend to. Delete the device
        first if the whole part is going.

        Boards already using the part keep their placed copies, so a
        design keeps working while the library entry is gone.

        Args:
            uuid: the symbol.
            library_uuid: the library it lives in.
            confirm: must be true for anything to happen.
easyeda_distribute_componentstool Space placed components evenly between the outermost two.NetworkEnv varsoutside text
Space placed components evenly between the outermost two.

        The outermost two do not move: they define the span. Everything
        between them is spread at equal spacing, in the order their
        current positions put them, not the order they were named.
        Sorting by the given order would let a mistyped list reorder the
        board.

        Like the alignment tool, this works on ORIGINS rather than
        visible edges, so equal origin spacing means equal gaps only
        when the parts are the same size.

        Args:
            designators: comma separated, for example "R1,R2,R3,R4".
                At least three, since two are already as evenly spaced
                as two things can be.
            axis: x to spread horizontally, y vertically.
easyeda_emit_templatetool Placement calls for a hand template: THE way to draw a sheet.
Placement calls for a hand template: THE way to draw a sheet.

        The template is the sheet planned by hand, as for Altium's
        sch_preview_template: parts by designator at grid positions in
        mils, wires through pin anchors (``"U1.3"``), power ports and
        labels. This first pass places the parts where the template says,
        resolving each through the plan: an unresolved part becomes a
        search step and ``runnable`` stays false until resolved_parts
        names its library part. Run the calls, read the pins back with
        easyeda_get_schematic_pins (multiply its units by 10 for mils),
        then call easyeda_emit_template_connections.

        Args:
            template: the hand template; every plan part needs a position.
            plan_json: the DesignPlan, as JSON text or a dict.
            resolved_parts: refdes to ``{"library_uuid", "uuid"}``.
easyeda_emit_template_connectionstool The wiring calls for a hand template, checked against the pins
The wiring calls for a hand template, checked against the pins
        as placed. Second pass after easyeda_emit_template.

        The template's wires, ports and labels are checked the same way
        as on Altium (shorts, overlapping wires, crossings, dangling
        ends, off-grid points, and with the plan its nets pin by pin)
        and emitted only if there is no error.

        Args:
            template: the same hand template.
            pin_positions: ``"REFDES.PIN"`` to ``[x, y]`` in MILS, read
                back from the editor (its units times 10). Anchors in the
                template must use pin numbers here.
            plan_json: the DesignPlan, to check its nets.
            grid: grid in mils for the off-grid check.
easyeda_export_3dtool The 3D model of the assembled board.FilesNetworkEnv varsoutside text
The 3D model of the assembled board.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_altiumtool Export the design as an Altium Designer file.FilesNetworkEnv varsoutside text
Export the design as an Altium Designer file.

        Worth knowing about on this project specifically: it is a route
        out of EasyEDA into the primary backend, done by EasyEDA's own
        exporter rather than by a converter written here. Check the
        result before trusting it; a vendor's own export is a better
        starting point than a third-party translation, not a guarantee.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_bomtool The BOM file, as the editor generates it.FilesNetworkEnv varsoutside text
The BOM file, as the editor generates it.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_bom_htmltool Export the board's BOM as a self-contained interactive page.FilesNetworkEnv varsoutside text
Export the board's BOM as a self-contained interactive page.

        One HTML file with no external CSS, JavaScript or EasyEDA
        dependency: sortable columns, a free-text filter, and a toggle
        between grouped (one row per value and footprint) and
        per-component views. Made for mailing to a manufacturer or
        filing with a board release, where the reader has no EDA tool.

        PARTS TICKED OFF THE BOM ARE LEFT OUT, and the count of what was
        left out is reported rather than the list quietly being shorter.
        Mounting holes, fiducials and test points are excluded on
        purpose and are most of what a healthy board excludes.

        A part that does not report the flag is INCLUDED. Absence is not
        a decision to leave it off, and defaulting the other way would
        drop parts from a purchase order on the strength of a missing
        key.

        Reads design.snapshot rather than the components list directly.
        The snapshot handler already resolves the trap that produced a
        measured bug on a live board: footprint and component arrive as
        OBJECTS carrying a name, not as strings, and reading them as
        strings returned an empty value for all 111 parts. Repeating
        that mapping here would reopen the same hole.

        Args:
            output_path: where to write the HTML. Defaults to
                ``bom.html`` in the workspace directory.
            title: heading and page title.
            include_excluded: keep parts marked off the BOM, flagged
                with a column rather than dropped. For checking what
                was excluded, not for sending to a manufacturer.
easyeda_export_dsntool The board as a Specctra DSN file.FilesNetworkEnv varsoutside text
The board as a Specctra DSN file.

        The input format external autorouters take. The route comes back
        as a SES file, which the editor imports.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_dxftool The board outline and copper as DXF.FilesNetworkEnv varsoutside text
The board outline and copper as DXF.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_flying_probetool The flying probe test file.FilesNetworkEnv varsoutside text
The flying probe test file.

        Electrical test for a run too small to justify a bed-of-nails
        fixture.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_gerbertool Gerber fabrication data.FilesNetworkEnv varsoutside text
Gerber fabrication data.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_ipc2581tool IPC-2581 fabrication data, the format that carries intent.FilesNetworkEnv varsoutside text
IPC-2581 fabrication data, the format that carries intent.

        Preferred over Gerber where the fabricator accepts it: netlist
        and stackup travel with the geometry instead of being inferred.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_ipcd356tool IPC-D-356A netlist for bare-board electrical test.FilesNetworkEnv varsoutside text
IPC-D-356A netlist for bare-board electrical test.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_netlisttool The PCB netlist file.FilesNetworkEnv varsoutside text
The PCB netlist file.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_padstool The design in PADS format.FilesNetworkEnv varsoutside text
The design in PADS format.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_pcb_infotool The board's fabrication parameters, as a file.FilesNetworkEnv varsoutside text
The board's fabrication parameters, as a file.

        Stackup, finish and the rest of what a quote needs, in the
        editor's own summary rather than one assembled here.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_pdftool The board as a PDF, as the editor renders it.FilesNetworkEnv varsoutside text
The board as a PDF, as the editor renders it.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_pick_and_placetool Component centroids for assembly.FilesNetworkEnv varsoutside text
Component centroids for assembly.

        What a fab house needs to populate the board, alongside the
        Gerbers and the BOM.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_schematic_bomtool The BOM as the schematic generates it.FilesNetworkEnv varsoutside text
The BOM as the schematic generates it.

        Distinct from the PCB BOM on purpose: the two disagree when a
        part is placed on one and not the other, and that disagreement
        is a finding rather than something to hide by picking one.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_schematic_documenttool The schematic as a document file.FilesNetworkEnv varsoutside text
The schematic as a document file.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_schematic_netlisttool The netlist as the schematic editor generates it.FilesNetworkEnv varsoutside text
The netlist as the schematic editor generates it.

        Different from the PCB netlist export: this one is what the
        schematic says, which is the side to compare against when the
        two disagree.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_simulation_netlisttool The SPICE netlist for simulation.FilesNetworkEnv varsoutside text
The SPICE netlist for simulation.

        Note the standing rule on this project: a simulation model comes
        from the vendor, never generated. This exports the netlist the
        editor built from models already attached, and does not invent
        any.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_test_pointstool The test point list.FilesNetworkEnv varsoutside text
The test point list.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_find_componenttool Find components whose designator or value contains the query.NetworkEnv varsoutside text
Find components whose designator or value contains the query.

        Answers "where is R47", which otherwise means reading every
        component and filtering by hand.

        Searches the BOARD and the SCHEMATIC and says which side each
        hit came from. A part present on one and not the other is
        usually the reason someone is looking, so reporting only the
        board would answer half the question.

        Case-insensitive substring, not a pattern. A designator search
        for "R4" finds R4, R40 and R47, which is the useful behaviour
        when the exact name is what is being looked for.

        Field names are read defensively. EasyEDA's published reference
        lists methods rather than the shape of what they return, so
        several spellings are tried and a component that carries none of
        them is counted as unreadable rather than silently skipped.

        Args:
            query: substring to look for, matched against the
                designator and the value or name.
            scope: "both" (default), "pcb" or "schematic".
easyeda_generate_fab_packagetool Everything a fab house needs, in one folder, with a manifest.FilesNetworkEnv varsoutside text
Everything a fab house needs, in one folder, with a manifest.

        Runs the fabrication exports in turn and writes them side by
        side, then reports every file with its size and every export
        that did not produce one.

        THE PACKAGE IS NOT REPORTED COMPLETE UNLESS IT IS. A folder
        missing the pick-and-place looks exactly like a finished one to
        anybody who did not run it, and that is how a board reaches a
        fab house and comes back with questions a week later. If any
        required export fails, ``ok`` is false and ``missing`` names
        what is not there, even though the other files were written and
        are perfectly good.

        Everything written is listed either way. A partial package is
        worth keeping; it just must not be mistaken for a whole one.

        Drill data is inside the gerber zip on this backend rather than
        being its own export, which is where it differs from Altium.

        Args:
            output_dir: folder to write into. Created if absent.
            include: extras beyond the standard set, any of "pdf",
                "step", "dxf", "ipc2581". These are choices rather than
                omissions, so leaving one out never makes the package
                incomplete.
easyeda_get_arcstool Arc primitives on the current PCB.NetworkEnv varsoutside text
Arc primitives on the current PCB.
easyeda_get_assembly_variantstool Assembly variant configurations.NetworkEnv varsoutside text
Assembly variant configurations.

        Which parts are fitted in which build. The same question the
        Altium variant tools answer, and the reason a BOM alone is not
        enough to order a board.

        KNOWN NOT TO ANSWER. Measured twice against a live schematic
        holding 111 parts: the editor accepts the call and never
        returns. It is not a missing class and not an empty project,
        because the same document answers ``sch.components`` and
        ``sch.netlist``. The refusal arrives after a short budget rather
        than the full timeout, and it is a refusal, NOT an empty variant
        list: nothing was read, so nothing can be concluded about which
        parts are fitted.
easyeda_get_attributestool Text attributes on the current PCB.NetworkEnv varsoutside text
Text attributes on the current PCB.

        Designators, values and free text. What silkscreen audits read,
        and where placeholder values hide.
easyeda_get_board_outlinetool The board outline, as the segments drawn on its layer.NetworkEnv varsoutside text
The board outline, as the segments drawn on its layer.

        EasyEDA has no outline object and no call that returns one: the
        outline is ordinary lines and arcs on the BOARD_OUTLINE layer.
        So this reports those segments and their extent rather than a
        shape, and the extent is a bounding box, not the board area. A
        rounded or cut-out board is smaller than its box.

        An empty result means nothing is drawn on that layer, which is a
        board with no outline rather than an error.
easyeda_get_board_statisticstool Counts and extents for the whole board, in one call.NetworkEnv varsoutside text
Counts and extents for the whole board, in one call.

        What a review opens with and what a fab quote needs: how many
        components, nets, pads, vias and track segments, how much copper
        is routed, how many layers, and how big the board is.

        Five reads bundled into one round trip. The board extent comes
        out of the same track list rather than a sixth read, since the
        outline on this backend is just lines on a particular layer.

        A section whose read fails is reported as UNAVAILABLE with the
        reason, never as zero. "No vias on this board" and "the via list
        could not be read" are different statements, and quoting a fab
        from the second one mistaken for the first is how a board comes
        back missing its drills.

        Track length is the sum of the segments the editor reports and
        is only as good as those coordinates. Segments whose endpoints
        cannot be read are counted separately rather than treated as
        zero length.
easyeda_get_bounding_boxtool Bounding box enclosing the named primitives.NetworkEnv varsoutside text
Bounding box enclosing the named primitives.

        Args:
            primitive_ids: comma-separated ids from any query result.
easyeda_get_bounding_boxestool One bounding box per primitive, in a single call.NetworkEnv varsoutside text
One bounding box per primitive, in a single call.

        Different from ``easyeda_get_bounding_box``, which returns ONE
        box enclosing everything it is given. That is the right answer
        for "how big is this group" and the wrong one for "where is each
        of these", and getting each separately used to cost a round trip
        apiece.

        A box that cannot be measured comes back as null rather than
        stopping the batch: this is a read, and the answers already
        gathered are worth keeping.

        Args:
            primitive_ids: comma separated, from any query result.
easyeda_get_capabilitiestool Which parts of the EasyEDA API exist in the CURRENT context.NetworkEnv varsoutside text
Which parts of the EasyEDA API exist in the CURRENT context.

        EasyEDA loads its API per document type: its own pro-api
        manifest declares separate services for default, sch, symbol,
        pcb and panel. On the start page only the reduced default
        surface is present, so every pcb_* and sch_* class is undefined
        and every read fails with "Cannot read properties of
        undefined". Those failures look like defects in this project
        and are not.

        Read this FIRST when commands fail in a way that makes no
        sense. One call reports which classes the editor actually
        injected and what each can do, which sixty-four failing probes
        can only hint at.

        The answer depends on the open document, so it is a measurement
        of this moment rather than a property of the editor.
easyeda_get_componentstool Every component placed on the current PCB.NetworkEnv varsoutside text
Every component placed on the current PCB.

        Designator, footprint, layer, position and rotation as the
        editor reports them.
easyeda_get_current_paneltool The panel document currently open, if one is.NetworkEnv varsoutside text
The panel document currently open, if one is.

        No panel open is a normal answer rather than a failure, and it
        comes back as ``open: false`` so a caller can tell it apart from
        a read that went wrong.
easyeda_get_devicetool One library device: what it is and what it is bound to.NetworkEnv varsoutside text
One library device: what it is and what it is bound to.

        THE 3D MODEL IS NOT IN THE DEVICE RECORD. ``lib_Device.get``
        returns an association carrying only symbol, footprint and
        images, while ``lib_Device.search`` reports ``model3DUuid`` for
        the same uuid. Read straight, the record says every device is
        unmodelled. So the model is looked up separately and reported as
        ``model_3d``, with ``model_3d_source`` saying where it came
        from:

        - ``get``: the record carried it after all.
        - ``search``: recovered from the search row. ``model_3d`` of
          None here means the device genuinely has no model.
        - ``unresolved``: the search did not reach this device, because
          searches cap at ten results and a common name hides the row.
          ``model_3d`` of None here means UNKNOWN, not absent, and must
          not be reported as a missing model.

        Args:
            uuid: the device.
            library_uuid: the library it lives in.

        Returns:
            Dict with ``device``, ``model_3d`` and ``model_3d_source``.
easyeda_get_devices_by_lcsctool Look devices up by LCSC part number.NetworkEnv varsoutside text
Look devices up by LCSC part number.

        The one lookup that starts from a number on a BOM rather than
        from a name someone chose.

        NOT ENOUGH TO PLACE A PART. Measured against a live library:
        each entry carries ``uuid``, ``symbolUuid`` and
        ``footprintUuid`` and NO ``libraryUuid``, while placing needs
        the library and device pair. So this identifies a part and
        cannot position one; search by MPN when the next step is
        placement.

        A part the library does not hold is named in ``missing`` rather
        than left as a gap in a shorter list. Asking for three and
        receiving two tells a caller nothing about which BOM line
        failed, and quietly resolving a BOM one part short is how a
        board gets built without it.

        Args:
            lcsc_ids: comma-separated LCSC ids, for example "C25804,C1525".
easyeda_get_differential_pairstool Differential pairs the editor knows about.NetworkEnv varsoutside text
Differential pairs the editor knows about.

        The editor's own list, not this project's naming-based
        inference, so it reflects what the router will actually treat
        as a pair.
easyeda_get_dimensionstool Dimension objects on the current PCB.NetworkEnv varsoutside text
Dimension objects on the current PCB.

        What a fabricator reads off the drawing, so a board whose
        dimensions disagree with its outline is worth catching here.
easyeda_get_embedded_objectstool Binary embedded objects on the current PCB.NetworkEnv varsoutside text
Binary embedded objects on the current PCB.

        Not the same as ``easyeda_get_images``, despite the name.
        EasyEDA keeps colour-silkscreen artwork as embedded binary
        objects whose payload is data rather than geometry, and they
        are a fabrication question of their own: a fabricator who
        cannot process them prints nothing where the artwork was.
easyeda_get_environmenttool Which EasyEDA this is, and whether it is online.NetworkEnv varsoutside text
Which EasyEDA this is, and whether it is online.

        Worth reading FIRST when something behaves oddly. Pro, JLCEDA
        Pro and the private edition do not expose the same API surface,
        and offline mode changes what a library call can reach, so a
        failure that looks like a bug here is often an edition or a
        connectivity difference. Reporting it lets that be attributed
        rather than guessed at.
easyeda_get_fillstool Solid fill primitives on the current PCB.NetworkEnv varsoutside text
Solid fill primitives on the current PCB.
easyeda_get_footprint_imagetool Render one footprint to an image.NetworkEnv varsoutside text
Render one footprint to an image.

        Check it against the manufacturer land pattern before trusting
        it, the same way ``lib_audit_footprint_vs_datasheet`` does on the
        Altium side. A rendered footprint is evidence of what was drawn,
        not of what is correct.

        BOTH UUIDS ARE REQUIRED, for the same reason as
        ``easyeda_get_symbol_image``: the call takes one source object,
        ``{footprintUuid, libraryUuid}``. A bare uuid was mistaken for
        the editor refusing to answer.

        Args:
            uuid: the footprint's identifier, from a search result.
            library_uuid: the library holding it, from the same hit.
easyeda_get_imagestool Images placed on the current PCB.NetworkEnv varsoutside text
Images placed on the current PCB.

        Worth checking before release: a linked rather than embedded
        image renders as a blank on any machine without the source file,
        which the Altium side audits for too.
easyeda_get_layerstool Layers on the current PCB.NetworkEnv varsoutside text
Layers on the current PCB.
easyeda_get_length_match_groupstool Equal-length net groups defined on the current PCB.NetworkEnv varsoutside text
Equal-length net groups defined on the current PCB.
easyeda_get_library_classificationstool The category tree of one library.NetworkEnv varsoutside text
The category tree of one library.

        Worth reading before creating a part: a symbol or footprint made
        with no classification lands uncategorised, where it is found
        only by someone who already knows its name.

        Args:
            library_uuid: which library.
            kind: what the library holds: CBB, SYMBOL, DEVICE,
                FOOTPRINT, MODEL or PANEL_LIBRARY.
easyeda_get_linestool Line primitives (tracks and graphics) on the current PCB.NetworkEnv varsoutside text
Line primitives (tracks and graphics) on the current PCB.
easyeda_get_net_classestool Net classes defined on the current PCB.NetworkEnv varsoutside text
Net classes defined on the current PCB.
easyeda_get_net_lengthtool Routed length of one net, as the editor measures it.NetworkEnv varsoutside text
Routed length of one net, as the editor measures it.

        Read from the editor rather than computed here: a length this
        project calculated could disagree with what the user sees, and
        two numbers for one net is worse than one.

        A reply carrying no length is a FAILURE here, not a success
        with a missing field. Measured on a schematic tab, where net
        reads answer from either document: the editor returned the net
        name and nothing else, and passing that through as ``ok`` left
        a caller reading ``length`` as absent. Absent is one careless
        line away from being treated as zero, and zero length is the
        definition of an unrouted net.

        Args:
            net: exact net name. Required; an empty name is refused
                rather than defaulting to some net.
easyeda_get_net_lengthstool Routed copper length of every net, in one call.NetworkEnv varsoutside text
Routed copper length of every net, in one call.

        The per-net tool asked net by net would cost a round trip each,
        so the loop runs inside the editor.

        A net the editor cannot measure comes back as ``null`` rather
        than zero, because zero means "carries no copper" and that is a
        finding, not a missing measurement.

        An EMPTY list is called out rather than returned as a count of
        zero. Net data is reachable from either document, so asking
        from a schematic tab answers with no entries instead of
        refusing, and "0 nets measured" reads as "no net carries any
        copper" when it means the board was never consulted.
easyeda_get_net_rulestool Per-net rule values in force on the current PCB.NetworkEnv varsoutside text
Per-net rule values in force on the current PCB.

        The widths and clearances the editor will actually enforce, as
        opposed to what a calculator here suggests.
easyeda_get_netlisttool The schematic netlist, parsed.NetworkEnv varsoutside text
The schematic netlist, parsed.

        The editor returns this as a JSON STRING, measured on a live
        schematic, not as an object. Handing that through unchanged
        meant every caller received one long string where it expected a
        mapping: no iteration, no lookup, and no error either, because
        a string is perfectly valid JSON to whatever received it.

        The parsed shape, measured: keyed by a component's uniqueId,
        each entry carrying ``props`` (Designator, Device, Footprint,
        Datasheet and the rest) and ``pins`` as pin number to net name.

        ``netlist_raw`` keeps the original string, since the export
        tools deal in file content and a caller writing it out should
        not have to re-serialise what the editor already formatted.
easyeda_get_netstool Nets in the design, with the pins on each.NetworkEnv varsoutside text
Nets in the design, with the pins on each.

        The board read is tried first, then the schematic netlist.

        THE SCHEMATIC PATH EXISTS BECAUSE THE OBVIOUS ONE RETURNS
        NOTHING. Measured on a schematic with 332 connected
        pins: sch_Net.getAllNets, getAllNetsName and
        getCurrentProjectAllNets each returned an EMPTY LIST. Not an
        error, not a refusal, just zero, which reads as a design with
        no nets and is the quietest way to be wrong.

        The netlist has them: every part carries pin number to net
        name, so the nets and their members can be rebuilt exactly.
        That also gives something the raw net list would not, the pins
        on each net, which is what a fanout or single-pin check needs.
easyeda_get_padstool Pads on the current PCB.NetworkEnv varsoutside text
Pads on the current PCB.
easyeda_get_paneltool One panel by uuid, from easyeda_list_panels.NetworkEnv varsoutside text
One panel by uuid, from easyeda_list_panels.

        Args:
            uuid: the panel's identifier.
easyeda_get_pathstool Where the editor keeps documents, projects and libraries.NetworkEnv varsoutside text
Where the editor keeps documents, projects and libraries.

        Read from the editor rather than inferred. The extension runs
        sandboxed and the server has no way to know these, so a guessed
        path is how an export ends up somewhere nobody looks.
easyeda_get_pouredtool Copper actually filled in by pouring.NetworkEnv varsoutside text
Copper actually filled in by pouring.
easyeda_get_pourstool Copper pour outlines on the current PCB.NetworkEnv varsoutside text
Copper pour outlines on the current PCB.

        The shape the user drew, not the copper it produced. Compare
        with ``easyeda_get_poured``: an outline with no poured copper is
        a pour that was never executed, which looks fine on screen and
        ships as a missing plane.
easyeda_get_primitives_in_regiontool Everything inside a rectangle on the current PCB.NetworkEnv varsoutside text
Everything inside a rectangle on the current PCB.

        The way to inspect one area without pulling the whole board
        across the link. A zero-area rectangle is refused rather than
        returning an empty list, because "nothing is there" and "you
        asked about nothing" are different answers.

        Args:
            x1, y1: one corner.
            x2, y2: the opposite corner.
easyeda_get_projecttool One project's details, by uuid.NetworkEnv varsoutside text
One project's details, by uuid.

        Args:
            uuid: the project.
easyeda_get_project_infotool The open project: name, uuid, and what it contains.NetworkEnv varsoutside text
The open project: name, uuid, and what it contains.
easyeda_get_regionstool Filled regions (copper pours) on the current PCB.NetworkEnv varsoutside text
Filled regions (copper pours) on the current PCB.
easyeda_get_rule_configurationstool Rule configurations on the current PCB, and which is active.NetworkEnv varsoutside text
Rule configurations on the current PCB, and which is active.

        A board can hold several rule sets and route against one. Which
        one is current decides what DRC means, so a violation count is
        only meaningful alongside it.
easyeda_get_schematic_attributestool Text attributes on the current schematic.NetworkEnv varsoutside text
Text attributes on the current schematic.
easyeda_get_schematic_busestool Buses on the current schematic.NetworkEnv varsoutside text
Buses on the current schematic.
easyeda_get_schematic_componentstool Every component on the current schematic.NetworkEnv varsoutside text
Every component on the current schematic.

        Separate from the PCB list on purpose: the two disagree while a
        design is mid-edit, and that disagreement is a finding rather
        than something to paper over by merging them.

        COUNTED BY KIND, because the raw number misleads on a
        hierarchical design. A live top page returned five rows for a
        111-part design: one page FRAME (reported as componentType
        "sheet", which is not a child sheet), two ordinary parts, and
        two block symbols standing in for child schematics. A reviewer
        reading "5 components" against a netlist of 111 has no way to
        tell a hierarchy from a broken read.

        Every row is still returned. The blocks and the frame are real
        objects a caller may want; what changes is that the counts now
        say which is which.
easyeda_get_schematic_hierarchytool The sheet hierarchy: which blocks the open schematic contains.NetworkEnv varsoutside text
The sheet hierarchy: which blocks the open schematic contains.

        The vocabulary is not obvious and getting it wrong misreads the
        whole structure. A schematic page reports three kinds of
        component and only one of them is a part:

          sheet          the PAGE FRAME itself, at 0,0 with no
                         designator. Not a child sheet, despite the
                         name, which is the trap here.
          block_symbol   a hierarchical BLOCK, backed by its own
                         schematic document. subPartName carries the
                         block's name, measured as "ESP32.1" and
                         "Power.1".
          part           an ordinary component.

        Each block_symbol corresponds to a child schematic document
        rather than to a library symbol.

        This matters for a review because counting components on a top
        page returns the frame and the block outlines, not the parts
        inside them. The netlist is flattened and does cover the whole
        design, so netlist-based checks are correct; anything reading
        components directly is not.
easyeda_get_schematic_pinstool Every schematic pin, with its part and the net it sits on.NetworkEnv varsoutside text
Every schematic pin, with its part and the net it sits on.

        Built from the NETLIST, and that is a measured decision rather
        than a preference.

        sch_PrimitivePin.getAll() returns only pins placed loose on a
        sheet, which is a symbol-editor thing: a live schematic with 89
        components reported zero. The per-component route the board
        side uses does not work here either. Measured:
        sch_PrimitiveComponent.getAllPinsByPrimitiveId,
        .getComponentDetail, .get and sch_PrimitivePin.getAllPrimitiveId
        ALL failed on a live schematic, the last of those taking no
        argument at all, so it is not a question of passing the wrong
        id. Only getAll() works on that class.

        The netlist has what those cannot give: each entry carries
        ``pins`` as pin number to net name, alongside the props that
        hold the designator. That is the whole of what a connectivity
        review needs.

        A pin on no net is reported with an empty net rather than
        dropped, because an unconnected pin is the finding.
easyeda_get_schematic_selectiontool What is selected on the current schematic.NetworkEnv varsoutside text
What is selected on the current schematic.

        The schematic counterpart of ``easyeda_get_selection``. Kept
        separate because the two editors hold their own selections, and
        merging them would report objects from a sheet the caller is not
        looking at.
easyeda_get_schematic_wirestool Wires on the current schematic.NetworkEnv varsoutside text
Wires on the current schematic.
easyeda_get_selectiontool What the user currently has selected in the editor.NetworkEnv varsoutside text
What the user currently has selected in the editor.

        The bridge between a human pointing at something and a tool
        acting on it, without either having to name coordinates.
easyeda_get_stringstool Text primitives on the current PCB.NetworkEnv varsoutside text
Text primitives on the current PCB.

        Silkscreen and copper text: designators, values, legends. What a
        mirrored-text or off-board-text audit reads.
easyeda_get_symbol_imagetool Render one symbol to an image.NetworkEnv varsoutside text
Render one symbol to an image.

        Worth using rather than skipping: geometry that scores well and
        looks wrong is a recurring failure in this project's own library
        work, and a picture is the only thing that catches it.

        BOTH UUIDS ARE REQUIRED. ``getRenderImage`` takes one source
        object, ``{symbolUuid, libraryUuid}``, and cannot resolve a
        symbol from its own uuid alone. Passing a bare uuid was recorded
        as the editor never answering, and the call was written off on
        that basis; the ids were good and the argument was the wrong
        shape. Both uuids come back on every search hit.

        Args:
            uuid: the symbol's identifier, from a search result.
            library_uuid: the library holding it, from the same hit.
            sub_part_name: one part of a multi-part symbol. Optional.
easyeda_get_unconnected_pinstool Which pins on the current PCB sit on no net.NetworkEnv varsoutside text
Which pins on the current PCB sit on no net.

        The shared ``review_design`` reports how many; this names them,
        which is the difference between knowing there is a problem and
        being able to go and look at it.

        A pin with no net is not automatically a fault. A mechanical
        mounting pad, a no-connect leg and a genuinely forgotten
        connection all look identical here, so this reports and does not
        judge.
easyeda_get_unrouted_netstool Nets with no routed copper at all.NetworkEnv varsoutside text
Nets with no routed copper at all.

        WHAT THIS CATCHES, precisely: a net that carries zero routed
        length. That is the common case worth finding before ordering,
        a connection nobody drew.

        WHAT IT DOES NOT CATCH: a net that is PARTLY routed. EasyEDA
        reports a length per net and no ratline list, so a net with one
        segment drawn and one pin still floating measures non-zero and
        reads as routed here. Run the editor's own DRC for that; this is
        a cheap first pass, not a replacement for it.

        A net whose length could not be measured is listed separately
        rather than counted as unrouted, since "no answer" and "no
        copper" are different and only one of them is a defect.
easyeda_get_viastool Vias on the current PCB.NetworkEnv varsoutside text
Vias on the current PCB.
easyeda_get_workspacestool Workspaces the editor knows about, and which is current.NetworkEnv varsoutside text
Workspaces the editor knows about, and which is current.

        Worth checking before creating anything: a project made in the
        wrong workspace is found by nobody looking for it.
easyeda_highlight_nettool Highlight one net in the editor, to show a human where it is.NetworkEnv varsoutside text
Highlight one net in the editor, to show a human where it is.

        Args:
            net: exact net name.
easyeda_import_schematic_changestool Apply the schematic to the board: EasyEDA's ECO.NetworkEnv varsoutside text
Apply the schematic to the board: EasyEDA's ECO.

        DESTRUCTIVE. A component the schematic no longer has is removed
        from the board along with its routing, so this is refused unless
        ``confirm`` is true.

        Fails rather than guessing on an orphaned PCB with no schematic
        of its own, which is why ``schematic_uuid`` exists.

        Args:
            confirm: must be true for anything to happen.
            schematic_uuid: which schematic to take changes from. The
                one belonging to this board when empty.
easyeda_increment_designatorstool Offset the trailing number of schematic designators.NetworkEnv varsoutside text
Offset the trailing number of schematic designators.

        delta=100 turns R5 into R105. What it is for is copying a block:
        the copy arrives with the same designators as the original, and
        moving them out of the way is what makes re-annotation possible
        without every part colliding.

        COLLISIONS ARE CHECKED BEFORE ANYTHING IS SENT. A delta that
        lands one part on another leaves two components claiming one
        designator, which the netlist then reads as one part, and it is
        the kind of error that survives to fabrication. If any target
        name is already taken by a part that is not itself moving, the
        whole operation is refused and the clashes are named.

        THE ORDER OF APPLICATION MATTERS and is handled here. Shifting
        R1 to R5 up by one has to start at R5, or R1 becomes R2 while
        the real R2 still exists. Renames go descending for a positive
        delta and ascending for a negative one, so no intermediate state
        has two parts sharing a name.

        Parts whose designator has no trailing number are left alone and
        counted, not silently skipped: a sheet of them means the delta
        did nothing and the caller should know that rather than read a
        cheerful zero.

        Args:
            delta: non-zero integer added to each designator's number.
            prefix: restrict to one letter prefix, e.g. "R". Matched
                exactly and case-sensitively, so "R" does not touch
                "RN".
            dry_run: work out the renames and report them without
                sending anything.
easyeda_invoketool Call any EasyEDA API method directly.NetworkEnv varsoutside text
Call any EasyEDA API method directly.

        The escape hatch, and the reason new capability no longer costs
        an extension re-import. Everything else here is a named tool
        over one or two of these calls; this reaches the rest of the 92
        classes without new extension code.

        WHAT IT IS FOR: measuring. A method whose arguments or reply
        shape nobody has seen can be tried here, once, and what it
        answers decides whether a proper tool is worth writing. Several
        features currently rest on a guessed reply shape precisely
        because there was no way to ask.

        WHAT IT IS NOT FOR: routine work. A named tool validates its
        arguments, reports what the editor answered rather than
        assuming, and carries the accumulated knowledge of what goes
        wrong. This has none of that, so anything worth doing twice is
        worth a tool.

        DESTRUCTIVE METHODS NEED confirm. Any method starting delete,
        remove, clear, destroy or reset is refused without it, on both
        sides. Otherwise this would be a hole straight through every
        confirm guard in the surface.

        The value comes back exactly as the editor gave it, including
        null and false. Those are how this API declines, and reading a
        falsey answer as success is the single most common bug this
        backend has produced.

        Args:
            class_name: an API class, e.g. "pcb_Layer". Call
                easyeda_get_capabilities for what exists in the current
                document.
            method: the method on it, e.g. "getAllLayers".
            args: positional arguments, in order.
            confirm: required for a destructive-looking method.
easyeda_invoke_batchtool Several easyeda_invoke calls in one round trip.NetworkEnv varsoutside text
Several easyeda_invoke calls in one round trip.

        What makes the generic path usable for real work. A per-item
        loop over a hundred primitives is a hundred round trips; this
        is one, and the editor runs them in order.

        Each result is reported individually. A failure in the middle
        does not lose the answers either side of it, because a partial
        result naming what failed is usable and an exception is not.

        Args:
            calls: a list of ``{"class_name", "method", "args",
                "confirm"}`` dicts, same fields as easyeda_invoke.
easyeda_link_3d_modeltool Bind a 3D model, footprint or symbol to a device.NetworkEnv varsoutside text
Bind a 3D model, footprint or symbol to a device.

        The EasyEDA counterpart to ``lib_link_3d_model`` on the Altium
        side. ``lib_Device.modify`` takes an ``association`` object
        carrying ``model3D``, ``footprint`` and ``symbol``, each as a
        uuid plus the library holding it, and that is how a 3D model
        reaches a part here.

        Recorded previously as a gap on the assumption the extension API
        might not expose it. It does, and ``LIB_3DModel`` carries a full
        create, get, search, modify, copy and delete surface besides.
        Find a model with ``easyeda_search_3d_models``.

        ONLY WHAT YOU NAME IS SENT. The footprint and model slots are
        explicitly nullable in the API, so passing a blank one would
        UNBIND that part while reporting success. Omitted arguments are
        left out of the call entirely rather than sent empty.

        Args:
            uuid: the device to bind to.
            library_uuid: the library holding the device. Also the
                default library for any binding whose own library is
                not given.
            model_uuid: the 3D model to attach.
            model_library_uuid: its library, if it differs.
            footprint_uuid: rebind the footprint, in the device's
                library unless another is implied.
            symbol_uuid: rebind the symbol, likewise.

        Returns:
            Dict with ``linked`` and ``bound``, the slots written.
easyeda_list_boardstool Every PCB in the open project, with the current one marked.NetworkEnv varsoutside text
Every PCB in the open project, with the current one marked.
easyeda_list_boards_dmttool Boards in the workspace, at the document-manager level.NetworkEnv varsoutside text
Boards in the workspace, at the document-manager level.

        Distinct from ``easyeda_list_boards``, which lists the PCBs in
        the open project.
easyeda_list_checkpointstool Checkpoints taken on this machine, newest first.Filesoutside text
Checkpoints taken on this machine, newest first.
easyeda_list_librariestool Libraries available in the editor: system, personal, project.NetworkEnv varsoutside text
Libraries available in the editor: system, personal, project.

        THE ENUMERATION IS EMPTY. ``getAllLibrariesList`` returns no
        entries even against an editor holding a populated system
        library, so ``libraries`` being empty says nothing about what is
        installed. ``enumeration_empty`` flags that, rather than letting
        an empty list read as an empty workspace.

        What does work is ``known_library_uuids``, which carries the
        four uuids the named getters answer with. Those are what a
        search scopes to.

        Returns:
            Dict with ``libraries``, ``enumeration_empty`` and
            ``known_library_uuids`` (system, personal, project,
            favorite).
easyeda_list_panelstool Panels in the workspace.NetworkEnv varsoutside text
Panels in the workspace.

        A panel is how several boards are stepped and repeated for
        fabrication, so it is where an array that differs from the board
        it was built from would show up.
easyeda_list_projectstool Every project uuid the editor lists.NetworkEnv varsoutside text
Every project uuid the editor lists.

        Uuids only. Pair with ``easyeda_get_project`` for names, which is
        two calls rather than one but avoids a list that goes stale in a
        different way from the editor's own.

        AN EMPTY LIST DOES NOT MEAN NO PROJECTS. Measured on a live
        editor with a team project open and working: the list came back
        empty while the project's own uuid answered
        ``easyeda_get_project`` perfectly. So when the list is empty this
        also reports the OPEN project separately, because "0 projects"
        while the user is looking at one reads as a broken tool.
easyeda_list_schematic_pagestool Pages of the current schematic.NetworkEnv varsoutside text
Pages of the current schematic.

        A multi-page schematic is the normal case on anything real, and
        a tool that only ever saw page one would silently report a
        fraction of the design.
easyeda_list_schematicstool Every schematic in the open project.NetworkEnv varsoutside text
Every schematic in the open project.
easyeda_mark_findingstool Draw review findings ON the board, where the reader is looking.NetworkEnv varsoutside text
Draw review findings ON the board, where the reader is looking.

        The thing a review has been unable to do on this backend: point
        at the defect instead of describing where it is. Altium
        highlights violations in the editor; this is EasyEDA's
        equivalent, and it was left unbuilt while its arguments were
        unknown.

        AN OVERLAY, NOT GEOMETRY. Markers draw on top of the design,
        change nothing in it, and ``easyeda_clear_findings`` removes
        them all. That is why this is not confirm-guarded when
        everything else that draws is.

        Each marker needs the fields ITS OWN TYPE uses, and the wrong
        ones are refused rather than sent, because a marker the editor
        accepts and draws in the wrong place is a review pointing
        confidently at nothing:

        * ``point``     x, y
        * ``line``      startX, startY, endX, endY
        * ``rectangle`` left, right, top, bottom
        * ``circle``    x, y, r
        * ``arc``       startX, startY, endX, endY, angle

        Args:
            markers: list of shape dicts, each with ``type`` plus its
                fields. A JSON string is accepted.
            color: ``{r, g, b, alpha}``, 0-255 with alpha 0-1. The
                editor's default is used when omitted.
            line_width: stroke width in mils. Editor default when 0.
            zoom: frame the markers after drawing them.
            tab_id: which tab to draw on, from
                ``easyeda_open_document``. Defaults to the active one.

        Returns:
            Dict with ``marked`` and ``count``.
easyeda_modify_componenttool Change properties of one placed component on the PCB.NetworkEnv varsoutside text
Change properties of one placed component on the PCB.

        This is how a footprint is moved, rotated, flipped to the other
        side or locked: there is no separate move or rotate call, they
        are all properties.

        An empty ``changes`` is refused rather than sent. The editor
        would accept it and report success, which reads as "the change
        was applied" when nothing was.

        Args:
            primitive_id: from a component query.
            changes: property names to new values. Recognised: x, y,
                rotation, layer (TOP or BOTTOM, which is the side the
                part sits on), primitiveLock, addIntoBom, designator,
                name, uniqueId, manufacturer, manufacturerId, supplier,
                supplierId, and otherProperty for anything else.
easyeda_modify_layertool Rename or restyle one layer.NetworkEnv varsoutside text
Rename or restyle one layer.

        An empty change is refused rather than sent: the editor would
        report success, which reads as the change having been applied.

        Args:
            layer: which layer.
            name: new display name.
            color: new colour.
            transparency: new transparency.
easyeda_modify_pcb_componentstool Change properties on many PCB components at once.NetworkEnv varsoutside text
Change properties on many PCB components at once.

        The board counterpart of the schematic bulk edit, and how a
        placement pass applies: move, rotate and flip in one call
        instead of one per part.

        Args:
            changes: a list of ``{"primitive_id": ..., "changes": {...}}``.
                The inner keys are the ones ``easyeda_modify_component``
                accepts: x, y, rotation, layer, primitiveLock and the
                rest.
easyeda_modify_schematic_componentstool Change properties on many schematic components at once.NetworkEnv varsoutside text
Change properties on many schematic components at once.

        Each result is reported individually rather than as one verdict.
        A partial failure is the case that matters: knowing THAT
        something failed is no use without knowing which, because the
        rest did apply and the design is now half-edited.

        Args:
            changes: a list of ``{"primitive_id": ..., "changes": {...}}``.
                The inner keys are the same ones
                ``easyeda_set_schematic_component_properties`` accepts:
                x, y, rotation, mirror, designator, name, manufacturer
                and the rest.
easyeda_navigatetool Scroll the editor to a coordinate, to show a human where.NetworkEnv varsoutside text
Scroll the editor to a coordinate, to show a human where.

        Pairs with a violation or a net query: report the finding, then
        put it on screen.

        Args:
            x: x to centre on, in mils. A PCB coordinate, so it takes no
                unit conversion, unlike everything schematic here.
            y: y to centre on, in mils.
easyeda_open_documenttool Open a document in the editor by uuid.NetworkEnv varsoutside text
Open a document in the editor by uuid.

        Args:
            uuid: from a schematic, PCB or project listing.
easyeda_open_footprinttool Open a library footprint for editing.NetworkEnv varsoutside text
Open a library footprint for editing.

        The PCB counterpart of ``easyeda_open_symbol``: open it, then
        the ordinary PCB drawing tools act on the footprint.

        Args:
            uuid: the footprint.
            library_uuid: the library it lives in.
easyeda_open_projecttool Open a project in the editor.NetworkEnv varsoutside text
Open a project in the editor.

        Changes what every other tool here is looking at, so a command
        sent immediately after may land on a document that is still
        loading.

        Args:
            uuid: the project.
easyeda_open_symboltool Open a library symbol for editing, and make it the activeNetworkEnv varsoutside text
Open a library symbol for editing, and make it the active
        document.

        This is how a symbol gets its geometry on this backend. There is
        no separate library-drawing API: open the symbol, then use the
        ordinary schematic drawing tools (``easyeda_add_wire``,
        ``easyeda_add_schematic_rectangle``, and the rest), which now
        act on the symbol rather than on a sheet.

        It changes what every other tool is looking at, so anything sent
        straight after may land on a document still loading.

        Args:
            uuid: the symbol.
            library_uuid: the library it lives in.
easyeda_pingtool Is an EasyEDA editor connected, and to which document?FilesNetworkEnv varsoutside text
Is an EasyEDA editor connected, and to which document?

        The editor dials out to this server rather than being driven by
        it, so a failure here usually means the extension is not running
        rather than that EasyEDA is closed. The reply names the current
        document kind, because a PCB command aimed at a schematic tab is
        meaningless and finding that out from a confusing error is worse
        than being told.

        It also reports whether the editor is running THIS tree's build
        of the extension. That is not housekeeping: an extension that
        is installed, enabled and months old is indistinguishable from
        a current one in EasyEDA's Extensions Manager, same name, same
        uuid, same size. A whole session was once spent reading "the
        export fix is broken" off an editor that was simply running a
        build from before the fix.

        Returns:
            The editor's reply plus ``build_matches`` (True, False, or
            None when either side cannot say) and, when it does not
            match, ``build_warning`` naming both builds and the remedy.
easyeda_place_pcb_componenttool Place a footprint on the current PCB.NetworkEnv varsoutside text
Place a footprint on the current PCB.

        Args:
            library_uuid: the library the footprint lives in.
            uuid: the footprint.
            x: placement x.
            y: placement y.
            layer: TOP or BOTTOM.
            rotation: degrees.
            locked: lock against interactive edits.
easyeda_place_pcb_componentstool Place many footprints on the board in one call.NetworkEnv varsoutside text
Place many footprints on the board in one call.

        The board counterpart of the schematic bulk placement, and the
        same reason: placing forty footprints one at a time is forty
        round trips over a socket.

        Coordinates are in mils and take NO conversion here. The PCB
        canvas already counts in mils, unlike the schematic one, which
        is the difference this backend keeps having to be careful about.

        Stops at the first failure and reports the rest as skipped, so a
        batch leaves the board in the same knowable state a sequence of
        single calls would.

        Args:
            components: a list of ``{"library_uuid": ..., "uuid": ...,
                "x": ..., "y": ..., "layer": "TOP"|"BOTTOM",
                "rotation": ..., "locked": ...}``.
easyeda_place_schematic_componenttool Place a library part on the current schematic.NetworkEnv varsoutside text
Place a library part on the current schematic.

        The part is identified by the uuid pair that
        ``easyeda_search_devices`` returns, never by name: two libraries
        can hold the same name, and choosing one silently is how a board
        ends up with the wrong footprint under a BOM line that reads
        correctly.

        Args:
            library_uuid: the library the part lives in.
            uuid: the part.
            x: placement x, in mils.
            y: placement y, in mils.
            rotation: degrees.
            sub_part: which section, for a multi-part symbol such as one
                gate of a quad. The whole part when empty.
            mirror: mirror the symbol.
            add_to_bom: include it in the BOM. False for a part that is
                drawn but not fitted.
            add_to_pcb: give it a footprint on the board. False for a
                schematic-only symbol.
easyeda_place_schematic_componentstool Place many library parts on the schematic in one call.NetworkEnv varsoutside text
Place many library parts on the schematic in one call.

        The bulk form of ``easyeda_place_schematic_component``, and what
        a plan of any size should use: placing forty parts one at a time
        is forty round trips over a socket.

        Each placement is reported individually. A batch that
        half-succeeds is the case worth designing for, because the parts
        that landed are on the sheet and a caller needs to know which so
        a retry does not place them twice.

        Args:
            components: a list of ``{"library_uuid": ..., "uuid": ...,
                "x": ..., "y": ..., "rotation": ...}``. Coordinates are
                in mils, as everywhere else here, and converted once on
                the way out.
easyeda_place_stitching_viastool Stitch a rectangle with vias on one net, usually ground.NetworkEnv varsoutside text
Stitch a rectangle with vias on one net, usually ground.

        The standard EMC move: tie the reference planes together
        alongside a fast signal so return current has a short path, and
        around connectors and clock sources for the same reason. A
        return path that has to go the long way round is what turns a
        working board into one that fails emissions.

        DRY RUN BY DEFAULT, like the sliver cleanup and for the same
        reason: this adds copper in bulk, and seeing where before
        committing is how a wrong rectangle gets caught while it is
        still free to fix.

        A GRIDPOINT IS SKIPPED WHEN ANYTHING NOT ON THE NET IS WITHIN
        REACH. Reach is the via radius plus the clearance, measured
        against pads, other vias and track segments. Placing a ground
        via on top of a signal is not a DRC warning to clean up later;
        it is a short, and it is invisible on a plane pour.

        Same-net objects do not block, because a ground via next to a
        ground pad is the point of the exercise.

        WHAT THIS CANNOT SEE, and it matters: copper whose layer the
        editor will not resolve is left out of the check entirely and
        counted. Vias are through-holes and hit every layer, so any
        unchecked copper is a real risk rather than a formality.

        Args:
            net: the net to stitch, e.g. "GND".
            x1, y1, x2, y2: the rectangle, in mils, any corner order.
            spacing: grid pitch. A quarter of the shortest wavelength
                of interest is the usual rule; 50 mils is a common
                default for digital work.
            diameter: via pad diameter.
            hole_diameter: drill diameter. Must be smaller.
            clearance: extra space demanded around each via.
            dry_run: report the positions without placing. On by
                default.
            max_vias: refuse rather than place more than this. A
                mistyped rectangle is how a board gets a thousand vias.
easyeda_plan_placementtool Work out a better arrangement of the parts on the board.NetworkEnv varsoutside text
Work out a better arrangement of the parts on the board.

        The solver is the same one the Altium side uses and has no EDA
        dependency at all: it takes components, nets and a region, and
        returns centroids that shorten total connection length while
        keeping parts from overlapping. Only the reading and writing is
        specific to this backend.

        PROPOSES BY DEFAULT. Nothing moves unless ``apply`` is true, so
        the normal use is to look at the numbers first: hpwl_before
        against hpwl_after says whether the arrangement is actually
        better, and overlap counts say whether it is legal.

        SIZES COME FROM THE BOUNDING BOX WHERE ONE CAN BE READ. A
        measured EasyEDA component reports position, rotation, layer and
        its pads, and no box, so the box is fetched separately. Where
        that fails the extent of the PADS is used instead, and the reply
        says so through ``size_source``, because pads understate a
        footprint: silkscreen and courtyard sit outside them, and
        courtyard is what collision is really about. A placement solved
        from understated sizes packs parts too tightly, and without the
        field nothing in the answer would reveal it.

        EasyEDA positions a part by its ORIGIN and the solver works in
        CENTROIDS, so both conversions happen here.

        Args:
            designators: only move these. Everything else still holds
                its place and pulls on its nets.
            fixed: never move these. Connectors, mounting holes,
                anything mechanically constrained.
            region: ``{"x1","y1","x2","y2"}`` in mils. Taken from the
                board outline when omitted.
            iterations: solver effort.
            grid_mils: snap resolution for the result.
            clearance_mils: breathing room between parts.
            apply: move the parts. Off by default.
easyeda_rename_devicetool Rename a library device or change its description.NetworkEnv varsoutside text
Rename a library device or change its description.

        The device is the placeable object, so this is the name a
        designer searches for. Renaming the symbol and the footprint
        leaves that name unchanged, which is why the matrix needed this
        one to be complete.

        Args:
            uuid: the device.
            library_uuid: the library it lives in.
            name: the new name. Left alone when empty.
            description: the new description. Left alone when empty.
easyeda_rename_footprinttool Rename a library footprint or change its description.NetworkEnv varsoutside text
Rename a library footprint or change its description.

        Args:
            uuid: the footprint.
            library_uuid: the library it lives in.
            name: the new name. Left alone when empty.
            description: the new description. Left alone when empty.
easyeda_rename_paneltool Rename a panel document.NetworkEnv varsoutside text
Rename a panel document.

        Args:
            uuid: the panel's identifier.
            name: the new name.
easyeda_rename_symboltool Rename a library symbol or change its description.NetworkEnv varsoutside text
Rename a library symbol or change its description.

        Args:
            uuid: the symbol.
            library_uuid: the library it lives in.
            name: the new name. Left alone when empty.
            description: the new description. Left alone when empty.
easyeda_render_imagetool Render what the editor is currently showing, as an image.FilesNetworkEnv varsoutside text
Render what the editor is currently showing, as an image.

        Use it. A board can pass every numeric check and still be
        visibly wrong, and this project's own library and placement work
        repeatedly found geometry bugs that scores hid. Looking is the
        check that catches those.

        The editor hands back a Blob, which does not survive JSON, so
        the extension packs it. An unpacked reply is reported as a
        FAILURE rather than as a successful render of nothing: this is
        the one tool whose whole purpose is to put a picture in front of
        someone, and succeeding without one defeats it entirely.

        Args:
            save_to: where to write the image. Without it the encoded
                bytes come back in the reply, which is fine for a small
                view and wasteful for a large one.
easyeda_restore_checkpointtool Put a saved document back, replacing what is open.FilesNetworkEnv varsoutside text
Put a saved document back, replacing what is open.

        DESTRUCTIVE: it replaces the whole open document. Refused
        unless ``confirm`` is true.

        Refused as well when the open document is not the one the
        checkpoint came from. Restoring a snapshot of board A over board
        B destroys B and looks like a successful restore, which is the
        worst shape a safety net can fail in. ``force`` overrides that
        for the case where the document was legitimately renamed.

        Args:
            checkpoint_id: from ``easyeda_list_checkpoints``.
            confirm: must be true for anything to happen.
            force: restore even onto a different document.
easyeda_route_plantool Route the board offline and return tracks and vias to place.NetworkEnv varsoutside text
Route the board offline and return tracks and vias to place.

        The router is the one the Altium side uses (route_plan,
        pcb_autoroute) and has no EDA dependency: it takes pads, existing
        copper and a board outline, and returns segments checked by the
        exact DRC. Only the reading is specific to this backend.

        PLANS ONLY. Nothing is drawn. The result is in the shape
        easyeda_add_track and easyeda_add_via take, so applying it is a
        separate, visible step.

        LAYER SIDES COME FROM THE EDITOR, not from a table here. PCB
        reads carry a numeric layer, and which integer is top copper is
        not measured; getting it wrong would route on the wrong side of
        the board. The editor's own layer list is consulted, and
        anything it cannot resolve is EXCLUDED from the obstacle map
        with a count, rather than guessed onto a layer.

        That exclusion is the one thing to watch in the result. Copper
        left out of the obstacle map is copper the router will happily
        route through, so a non-zero ``obstacles_skipped`` means the
        plan may collide with something real.

        Args:
            nets: only route these. Everything else stays an obstacle.
            clearance_mils: copper-to-copper spacing.
            track_width_mils: width for new track.
            via_size_mils: via pad diameter.
            via_drill_mils: via hole diameter.
easyeda_run_drctool Run the editor's own design rule check and read the result.NetworkEnv varsoutside text
Run the editor's own design rule check and read the result.

        The editor's checker, never a reimplementation. A second opinion
        that disagreed with the tool the user is looking at would be
        worse than no opinion.

        A check that produced no report is reported as a FAILURE. Zero
        violations is only good news when something was actually
        examined.
easyeda_run_erctool Run the editor's own electrical rule check and read it back.NetworkEnv varsoutside text
Run the editor's own electrical rule check and read it back.

        A check that produced no report is reported as a FAILURE rather
        than as a clean schematic. Measured on a live editor: the
        schematic checker answers with the boolean ``false``, which is
        not a violation list, and treating it as an empty one announced
        a clean bill of health nothing had established.
easyeda_run_plantool Run a sequence produced by the emit tools, in order.
Run a sequence produced by the emit tools, in order.

        DESTRUCTIVE: it places parts and draws on the open document.
        Refused unless ``confirm`` is true.

        Takes the ``calls`` list from ``easyeda_emit_template`` or
        ``easyeda_emit_template_connections`` rather than a plan, so what runs is
        exactly what was reviewed. Passing a plan here instead would
        re-emit it, and a sequence that was read and a sequence that
        ran would be two different things.

        STOPS AT THE FIRST FAILURE. Continuing would leave a design that
        is part-built and looks built: the remaining steps would place
        parts around a hole where one is missing, and the result reads
        as a finished schematic with a mistake in it rather than as a
        run that stopped.

        Args:
            calls: the ordered ``{"tool": ..., "arguments": {...}}``
                entries from an emit tool.
            confirm: must be true for anything to happen.
easyeda_savetool Save the current PCB document.NetworkEnv varsoutside text
Save the current PCB document.
easyeda_save_schematictool Save the current schematic document.NetworkEnv varsoutside text
Save the current schematic document.

        Separate from ``easyeda_save``, which saves the PCB. Saving one
        does not save the other, and assuming it does is how edits get
        lost.
easyeda_search_3d_modelstool Search the editor's 3D model library.NetworkEnv varsoutside text
Search the editor's 3D model library.

        A footprint without a model leaves a hole in the assembled view,
        which is where mechanical clashes are actually spotted.

        TEN PER PAGE, AND THERE ARE MORE PAGES. Ten is the editor's
        default page size, not a ceiling: the documented signature
        carries ``itemsOfPage`` and ``page``, which this backend never
        used to pass. ``more_likely`` in the reply means a full page
        came back, and ``next_page`` says which page to ask for.

        Args:
            query: Substring matched by the editor's own search. Empty
                returns the editor's default first page rather than
                nothing.
            library_uuid: Restrict to one library. Read the reachable
                uuids from ``easyeda_list_libraries``.

        Returns:
            Dict with ``models``, ``result_count``, ``page``,
            ``capped`` and ``library_uuid``.
easyeda_search_circuit_blockstool Find reusable circuit blocks in the libraries.NetworkEnv varsoutside text
Find reusable circuit blocks in the libraries.

        A circuit block (EasyEDA calls it 复用模块) is a saved piece of
        schematic placed into a design. It is what this editor has
        INSTEAD of hierarchy: schematic pages here are siblings with an
        order, and nothing exposes a sheet symbol or a parent link, so
        reuse happens by placing a block rather than by nesting a sheet.

        Pair with ``easyeda_place_circuit_block``.

        Args:
            query: free text. Empty lists what the library holds.
            library_uuid: scope to one library.
            page: which page of results, from 1.
            items_of_page: results per page. The editor's default is
                ten when this is left at 0.
easyeda_search_devicestool Search the editor's device libraries.NetworkEnv varsoutside text
Search the editor's device libraries.

        A device is symbol plus footprint plus metadata, which is what
        you place. Searching symbols alone finds drawings that may have
        no land pattern behind them.

        TEN RESULTS, ALWAYS. See ``easyeda_search_footprints``.

        Args:
            query: Substring matched by the editor's own search. Empty
                returns the editor's default first page rather than
                nothing.
            library_uuid: Restrict to one library. Read the reachable
                uuids from ``easyeda_list_libraries``.

        Returns:
            Dict with ``devices``, ``result_count``, ``page``,
            ``capped`` and ``library_uuid``.
easyeda_search_footprintstool Search the editor's footprint libraries.NetworkEnv varsoutside text
Search the editor's footprint libraries.

        TEN PER PAGE, AND THERE ARE MORE PAGES. Ten is the default page
        size, not a ceiling. The earlier note that no page argument
        exists came from a numeric SECOND argument matching nothing,
        and the second argument is a library uuid; paging sits further
        along the signature. Ask for ``next_page`` when ``more_likely``
        is true, or raise ``items_of_page``.

        Args:
            query: What to search for. Empty returns the editor's
                default first page rather than nothing.
            library_uuid: Restrict to one library. Read the reachable
                uuids from ``easyeda_list_libraries``.

        Returns:
            Dict with ``footprints``, ``result_count``, ``page``,
            ``capped`` and ``library_uuid``.
easyeda_search_symbolstool Search the editor's symbol libraries.NetworkEnv varsoutside text
Search the editor's symbol libraries.

        THE ONLY SEARCH THAT NEEDS A QUERY. The device, footprint and 3D
        model searches answer an empty one with a default page.
        ``lib_Symbol.search`` does not answer it at all: measured twice,
        the editor accepted the call and never returned. So the query is
        required here, and refusing it early is what keeps a blank
        search from hanging the connection.

        TEN RESULTS, ALWAYS. See ``easyeda_search_footprints``.

        Args:
            query: What to search for. Required.
            library_uuid: Restrict to one library. Read the reachable
                uuids from ``easyeda_list_libraries``.

        Returns:
            Dict with ``symbols``, ``result_count``, ``page``,
            ``capped`` and ``library_uuid``.
easyeda_select_layertool Make one layer the active one in the editor.NetworkEnv varsoutside text
Make one layer the active one in the editor.

        Args:
            layer: layer name.
easyeda_select_primitivestool Select primitives on the current PCB, by id.NetworkEnv varsoutside text
Select primitives on the current PCB, by id.

        Args:
            primitive_ids: ids to select. Replaces the current
                selection rather than adding to it.
easyeda_select_schematic_primitivestool Select primitives on the current schematic, by id.NetworkEnv varsoutside text
Select primitives on the current schematic, by id.

        Args:
            primitive_ids: ids to select. Replaces the current
                selection rather than adding to it.
easyeda_set_copper_layer_counttool Set how many copper layers the board has.NetworkEnv varsoutside text
Set how many copper layers the board has.

        DESTRUCTIVE when the count goes down: anything on a layer that
        disappears goes with it. Refused unless ``confirm`` is true.

        Args:
            count: an even number from 2 to 32. EasyEDA accepts no
                others, so an odd or larger value is refused here with
                the list rather than sent.
            confirm: must be true for anything to happen.
easyeda_set_layer_locktool Lock or unlock layers against editing.NetworkEnv varsoutside text
Lock or unlock layers against editing.

        Args:
            layers: layer names.
            locked: lock them. False unlocks.
easyeda_set_layer_visibilitytool Show or hide layers in the editor.NetworkEnv varsoutside text
Show or hide layers in the editor.

        Display only. Nothing on a hidden layer is removed, and DRC still
        sees it.

        Args:
            layers: layer names, e.g. ["TOP", "TOP_SILKSCREEN"].
            visible: show them. False hides them.
            exclusive: also invert every other layer, so showing one
                layer hides the rest. What you want before a screenshot
                of a single layer.
easyeda_set_netlisttool REPLACE the board's entire connectivity from a netlist.NetworkEnv varsoutside text
REPLACE the board's entire connectivity from a netlist.

        THE MOST DESTRUCTIVE OPERATION ON THIS BACKEND. Every net on the
        board comes from the text you supply, and whatever it had before
        is gone. Take an ``easyeda_checkpoint`` first.

        The counterpart to reading the netlist, and the way an
        externally generated connectivity reaches the board.

        NOT A FILE IMPORT, despite sitting beside the autorouter
        imports. ``pcb_Net.setNetlist(type, netlist)`` takes a plain
        STRING, so no file plumbing is involved. It also lives on
        ``pcb_Net`` rather than ``pcb_Document``.

        NEVER RUN AGAINST A LIVE EDITOR. Every argument here comes from
        the published reference. The reference settles what the call
        expects, not what the editor does with it, and this one
        rewrites a board.

        Args:
            netlist: the netlist text.
            netlist_type: one of Allegro, DISA, DSNET, EasyEDA, JLCEDA,
                PADS. Leave empty to let the editor decide.
            confirm: must be true. Nothing happens without it.

        Returns:
            Dict with ``applied``, read from the editor's own answer
            rather than assumed.
easyeda_set_schematic_component_propertiestool Change properties of one placed schematic component.NetworkEnv varsoutside text
Change properties of one placed schematic component.

        Args:
            primitive_id: the component, from a schematic component
                listing.
            changes: properties to set. Recognised: x, y, rotation,
                mirror, addIntoBom, addIntoPcb, designator, name,
                uniqueId, manufacturer, manufacturerId, supplier,
                supplierId, and otherProperty for anything else.
easyeda_set_title_blocktool Fill in the current schematic page's title block.NetworkEnv varsoutside text
Fill in the current schematic page's title block.

        What a printed sheet is identified by: title, author, revision,
        date. A design that reaches a fabricator with an empty title
        block is a real problem and an easy one to leave until last.

        Args:
            fields: field name to ``{"value": ..., "showTitle": bool,
                "showValue": bool}``. The field names are the editor's
                own, so read an existing sheet before guessing them.
            show: whether the title block is displayed at all. Setting
                fields while this is false fills in a block nobody sees.
easyeda_snap_components_to_gridtool Move placed components onto the nearest grid point.NetworkEnv varsoutside text
Move placed components onto the nearest grid point.

        The other half of ``easyeda_audit_off_grid_components``, which
        reports offsets and cannot correct them.

        DESTRUCTIVE, and quietly so. Every part moves a fraction of a
        grid step, so the board looks the same afterwards and a mistake
        does not show in a screenshot. A connector aligned to a panel
        cutout, a mounting hole on a customer's pattern and a part
        placed to a mechanical dimension are all off-grid deliberately,
        and nothing here can tell them from a slip. Name the parts
        rather than snapping everything unless the board really is
        meant to be entirely on-grid.

        Reports each move with its before and after, so a wrong snap can
        be undone by hand.

        Args:
            designators: comma separated, for example "R1,R2,C7". Empty
                means EVERY component on the board.
            grid: the grid pitch in mils. Must be positive.
            confirm: must be true for anything to move.
easyeda_tune_lengthtool Add routed length to a net with a square serpentine.NetworkEnv varsoutside text
Add routed length to a net with a square serpentine.

        For matching a bus or a differential pair to a target length: a
        meander is laid at the point you choose, sized to add roughly
        the length you asked for, and the net's length is reported
        before and after.

        OPEN LOOP AND NOT DRC CHECKED, exactly as the Altium
        counterpart is, and for the same reason: neither editor offers
        a scriptable interactive tuner, so this is the approximation
        that is available rather than the tool anyone would design. You
        pick the spot; run a DRC afterwards.

        THE LENGTH IT ADDS IS NOT THE LENGTH YOU ASK FOR. A serpentine
        adds length in whole teeth, so the result is quantised to
        2*amplitude a tooth. Both numbers are reported, requested and
        achieved, because a tuner that silently rounds is a tuner that
        quietly misses a matching window.

        DRY RUN BY DEFAULT. This draws copper on a routed board.

        Args:
            net: the net to lengthen.
            add_length: how much to add, in mils. Achieved to the
                nearest tooth.
            x, y: where the meander starts.
            layer: layer to draw on.
            amplitude: how far each tooth reaches. Bigger teeth mean
                fewer of them and a coarser result.
            pitch: spacing between teeth along the run.
            width: track width. Match the net's existing width, or the
                meander is an impedance discontinuity.
            dry_run: report the geometry without drawing. On by default.
easyeda_zoom_to_alltool Frame everything in the current document.NetworkEnv varsoutside text
Frame everything in the current document.

        Worth doing before easyeda_render_image: the render captures
        what the editor is showing, so a zoomed-in view produces a
        picture of one corner and nothing says the rest was cropped.
easyeda_zoom_to_boardtool Fit the board outline in the editor view.NetworkEnv varsoutside text
Fit the board outline in the editor view.

        Display only. Worth calling before ``easyeda_render_image`` so
        the picture shows the board rather than wherever the user was
        last zoomed.
easyeda_zoom_to_selectiontool Frame the current selection.NetworkEnv varsoutside text
Frame the current selection.

        Pairs with the select tools to put a finding on screen: select
        what an audit named, zoom to it, then render.
fntool
No description.
footprint_check_packagetool Check a package description for numbers that cannot be right.
Check a package description for numbers that cannot be right.

        Run this on every package transcribed from a datasheet, before
        drawing a footprint from it. Offline.

        Sanity checks (each finding names the dimensions, their values and
        citations, and why the combination is impossible or unusual):
        limits in order; lead width below the pitch; each row of pins fits
        the body it comes out of; lead span larger than the body for
        leaded parts; the foot shorter than the lead's reach and two
        terminals fitting the span; the exposed pad inside the body and
        clear of the terminals; ball diameter below the pitch; values 25.4
        times off their neighbours (mils typed as mm); pin counts the
        family can have; the vendor land pattern consistent with itself.
        ``error`` is impossible, ``warning`` unusual.

        Cross-check, when the package carries the datasheet's recommended
        land pattern as ``vendor``: the IPC pattern computed from the
        package against it, per quantity (pitch, span, land length and
        width, tab, exposed pad, grid land), with both numbers, both
        citations and the difference. Beyond the tolerance measured
        between real vendor patterns and IPC, or a factor of two apart,
        the pair is reported as a likely transcription error in one of the
        two sources.

        Args:
            package: the PackageSpec as an object or JSON text, the same
                schema lib_create_footprint_from_package takes.

        Returns:
            ``{ok, errors, warnings, findings, cross_check, examined,
            notes}``. ``ok`` is true when no sanity finding is an error and
            the cross-check (if it ran) agreed.
footprint_compare_drawingtool Set the land-pattern figure beside the lands a package builds,
Set the land-pattern figure beside the lands a package builds,
        to compare them by eye before the footprint is drawn.

        The figure is source.page of source.path, zoomed to ``region``;
        beside it the lands are drawn alike, each numbered, the gap between
        every pair of neighbouring rows and columns written in red, land
        sizes listed. Read the image and compare every land, gap, size and
        shape with the figure; correct the package for any difference.
        lib_create_footprint_from_package takes custom_pads only with the
        ``compared`` id this returns for those same lands. The package body
        is drawn dashed over the lands.

        Lands named like balls (A1, H8) need their names checked against a
        figure that prints them: when the land figure does not, give the
        ball map (pinout) as names_page and names_region; it is set beside
        the lands drawn as the map is (names_view). Names the map prints as
        text are matched to the lands by position, and a mismatch withholds
        the id.

        Args:
            package: the PackageSpec as for lib_create_footprint_from_package.
            region: the figure on its page, [left, top, right, bottom] as
                fractions of the page from its top left.
            view: "top", or "bottom" when the figure is drawn from below
                (the lands are mirrored to match it).
            dpi: 72 to 800 (default 400).
            names_page: the ball map's page in the same PDF.
            names_region: the ball map on that page, as ``region``.
            names_view: "top" or "bottom", the side the ball map is drawn
                from (default ``view``).

        Returns:
            ``{ok, png, compared, printed_numbers, not_built, ball_names}``:
            ``not_built`` lists numbers printed as text in the figure that no
            land size, gap or span of the built lands shows; ``ball_names``
            ``{checked, mismatched}`` for names the figures print as text.
footprint_read_ipc_nametool Decode an IPC-7351 footprint name into its package, in mm.
Decode an IPC-7351 footprint name into its package, in mm.

        CAPC1005X55N: a 1.0 x 0.5 mm chip, 0.55 mm high. SOT95P280X130-5N:
        five pins at 0.95 mm pitch across 2.80 mm, 1.30 mm high.
        QFN50P400X400X100-21N: 21 pads at 0.50 mm on a 4 x 4 mm body.

        Returns:
            ``ipc_name`` (whether it decodes) and the numbers: ``family``
            (chip, two-sided, four-sided), ``pins``, ``pitch``, ``span``,
            ``length``/``width``, ``height`` and ``density``.
footprint_render_packagetool Draw the land pattern a package gives, to compare with its datasheet.Files
Draw the land pattern a package gives, to compare with its datasheet.

        Offline. Renders the footprint the engine would build (lands with
        their numbers, paste windows, silkscreen with the pin 1 dot,
        assembly outline, courtyard, origin and a 1 mm scale bar) and draws
        the package's terminals over the lands as dashed green outlines,
        so a land that misses its terminal shows. A caption gives the
        pattern's pitch, span and land sizes. Read the returned image next
        to the datasheet's package drawing and recommended land pattern.

        Args:
            package: the PackageSpec as an object or JSON text.
            density: L, N or M (least, nominal, most).
            path: where to write the SVG; default
                ``<workspace>/renders/<name>_<density>.svg``.
            png: also write a PNG beside it through the headless browser
                the board renders use, when one is installed.

        Returns:
            ``{ok, svg_path, png_path, name, density, metrics, warnings}``,
            with ``rasterize_note`` when no PNG could be made.
get_board_infotool Object counts and net-class summary for the open board, from theEnv vars
Object counts and net-class summary for the open board, from the
        active backend (or the one named by ``backend``).
kicad_add_arctool Add a graphic arc through start, mid and end points (mm) on a layer,
Add a graphic arc through start, mid and end points (mm) on a layer,
        with a stroke width (mm).
kicad_add_circletool Add a graphic circle at a centre (mm) with a radius (mm) on a
Add a graphic circle at a centre (mm) with a radius (mm) on a
        layer, with a stroke width (mm).
kicad_add_drc_markerstool Put review markers on the board among KiCad's DRC markers. Each
Put review markers on the board among KiCad's DRC markers. Each
        item: message, x_mm, y_mm, ids (items it concerns), severity
        (warning, error, info).
kicad_add_linetool Add a graphic line between two points (mm) on a layer (default
Add a graphic line between two points (mm) on a layer (default
        "F.Silkscreen") with a stroke width (mm).
kicad_add_rectangletool Add a graphic rectangle from top-left to bottom-right (mm) on a
Add a graphic rectangle from top-left to bottom-right (mm) on a
        layer, with a stroke width (mm).
kicad_add_texttool Add a text label at a position (mm) on a layer (default
Add a text label at a position (mm) on a layer (default
        "F.Silkscreen").
kicad_add_tracktool Add a copper track segment on a layer ("F.Cu", "B.Cu", "In1.Cu"),
Add a copper track segment on a layer ("F.Cu", "B.Cu", "In1.Cu"),
        assigned to a net, between two points (mm) at a given width (mm).
kicad_add_viatool Add a through via at a position (mm) with pad diameter and drill
Add a through via at a position (mm) with pad diameter and drill
        diameter (mm), assigned to a net.
kicad_add_zonetool Add a copper zone (pour) on a layer, assigned to a net, with an
Add a copper zone (pour) on a layer, assigned to a net, with an
        outline given as a list of [x_mm, y_mm] points (at least 3).
kicad_arrange_componentstool Align or distribute footprints with KiCad's own tools. action:
Align or distribute footprints with KiCad's own tools. action:
        align_top, align_bottom, align_left, align_right, align_center_x,
        align_center_y, distribute_horizontally_centers,
        distribute_horizontally_gaps, distribute_vertically_centers,
        distribute_vertically_gaps. Returns the new positions.
kicad_check_placement_collisiontool Footprints whose bodies overlap (bounding boxes without text,
Footprints whose bodies overlap (bounding boxes without text,
        grown by clearance_mm), among the references given or all.
kicad_cleanup_trackstool Remove zero-length tracks, tracks that duplicate another (same
Remove zero-length tracks, tracks that duplicate another (same
        ends, layer and net) and vias stacked on another via of the same
        net. dry_run lists them without deleting.
kicad_clitool Run an arbitrary kicad-cli command -- an escape hatch for anything
Run an arbitrary kicad-cli command -- an escape hatch for anything
        not covered by a dedicated tool (e.g. pcb import, version formats).

        args is the argument list after the executable, e.g.
        ["version", "--format", "json"] or ["pcb", "import", ...]. Only
        kicad-cli's own subcommands run; it cannot invoke other programs.
kicad_compare_sch_pcbtool Compare the schematic netlist against the open PCB and report
Compare the schematic netlist against the open PCB and report
        components and nets present in one but not the other (the schematic/PCB
        sync differences an ECO would resolve).
kicad_copy_itemstool Copy items (tracks, arcs, vias, shapes, text, zones, dimensions)
Copy items (tracks, arcs, vias, shapes, text, zones, dimensions)
        count times, each copy offset by dx_mm, dy_mm and turned by
        rotate_deg about about_mm from the one before; net and layer
        override the copies'. One commit.
kicad_delete_componenttool Delete a component from the board.
Delete a component from the board.
kicad_delete_itemstool Delete board items by id, or every item matching where (the
Delete board items by id, or every item matching where (the
        filters of kicad_query_items, e.g. {"nets": ["SDA"], "kinds":
        ["track", "arc", "via"]} unroutes a net). Each result says whether
        the item is gone, checked after the commit.
kicad_export_3dpdftool Export an interactive 3D PDF of the board.
Export an interactive 3D PDF of the board.
kicad_export_bomtool Generate a Bill of Materials (CSV) from the schematic.
Generate a Bill of Materials (CSV) from the schematic.
kicad_export_footprint_svgtool Export a footprint (or a whole .pretty library) to SVG.
Export a footprint (or a whole .pretty library) to SVG.

        library_path is a .pretty directory (or a single .kicad_mod file);
        footprint optionally names one footprint within the library.
kicad_export_glbtool Export the board as a GLB (binary glTF) 3D model.
Export the board as a GLB (binary glTF) 3D model.
kicad_export_ipc2581tool Export the board in IPC-2581 format.
Export the board in IPC-2581 format.
kicad_export_ipcd356tool Generate an IPC-D-356 netlist (bare-board electrical test).
Generate an IPC-D-356 netlist (bare-board electrical test).
kicad_export_netlisttool Export a netlist from the schematic.
Export a netlist from the schematic.
kicad_export_odbtool Export the board in ODB++ format.
Export the board in ODB++ format.
kicad_export_pcbtool Run any kicad-cli PCB export format not covered by a dedicated tool
Run any kicad-cli PCB export format not covered by a dedicated tool
        (e.g. gencad, brep, ply, xao, u3d, stpz, ps, hpgl, stats).

        fmt is the export format; directory-based formats (gerbers, drill, dxf,
        svg, odb) write into the output directory, others write a single file.
        Pass layers (comma-separated) for the layer-based formats.
kicad_export_pdftool Plot the given board layers to a PDF (comma-separated layer names).
Plot the given board layers to a PDF (comma-separated layer names).
kicad_export_schtool Run any kicad-cli schematic export format not covered by a dedicated
Run any kicad-cli schematic export format not covered by a dedicated
        tool (e.g. dxf, ps, hpgl, python-bom).

        fmt is the export format; multi-sheet formats (svg, dxf, ps, hpgl) write
        into the output directory, others write a single file.
kicad_export_schematic_pdftool Export the schematic sheets to a PDF.
Export the schematic sheets to a PDF.
kicad_export_schematic_svgtool Export the schematic sheets to SVG (one per sheet).
Export the schematic sheets to SVG (one per sheet).
kicad_export_spicetool Export a SPICE netlist from the schematic (the input to an ngspice
Export a SPICE netlist from the schematic (the input to an ngspice
        simulation; requires SPICE models/directives on the schematic).
kicad_export_steptool Export the board as a STEP 3D model.
Export the board as a STEP 3D model.
kicad_export_stltool Export the board as an STL 3D model (3D printing / mechanical).
Export the board as an STL 3D model (3D printing / mechanical).
kicad_export_symbol_svgtool Export a symbol (or a whole .kicad_sym library) to SVG.
Export a symbol (or a whole .kicad_sym library) to SVG.

        symbol optionally names one symbol within the library.
kicad_export_vrmltool Export the board as a VRML 3D model.
Export the board as a VRML 3D model.
kicad_find_componenttool Find components whose reference or value contains the query
Find components whose reference or value contains the query
        (case-insensitive).
kicad_flip_componentstool Turn footprints over to the other side with KiCad's own Flip,
Turn footprints over to the other side with KiCad's own Flip,
        which mirrors their pads, graphics and text. One undo step.
kicad_full_reviewtool One-call comprehensive review of the open design: board stats, PCBFilesoutside text
One-call comprehensive review of the open design: board stats, PCB
        connectivity review, schematic review, schematic-vs-PCB comparison, and
        (optionally) geometric DRC and schematic ERC. Sections that fail are
        reported under sections_failed rather than aborting the whole review.
kicad_get_board_outlinetool Board edge bounding box (mm), from Edge.Cuts graphics.
Board edge bounding box (mm), from Edge.Cuts graphics.
kicad_get_board_summarytool One-call board overview: object counts, board size (mm), layer
One-call board overview: object counts, board size (mm), layer
        count, distinct via sizes, and net/component counts.
kicad_get_board_viewtool The PCB editor's view state: visible layers, active layer,
The PCB editor's view state: visible layers, active layer,
        inactive-layer display, net colouring, ratsnest mode, board flip,
        and the grid and drill/place origins (mm).
kicad_get_bomtool Consolidated Bill of Materials from the schematic netlist: one line
Consolidated Bill of Materials from the schematic netlist: one line
        per value+footprint with quantity and the reference designators.
kicad_get_component_detailstool Full detail for one component: value, footprint, position (mm),
Full detail for one component: value, footprint, position (mm),
        layer, lock state, and its pads with net assignments.
kicad_get_component_padstool Pads of footprints by reference: number, net, type, shape, size,
Pads of footprints by reference: number, net, type, shape, size,
        drill, position, angle, layers, tenting. with_polygons adds each
        pad's copper outline on its first copper layer (mm).
kicad_get_connected_itemstool Copper connected to the given items (by id, or a footprint's pad
Copper connected to the given items (by id, or a footprint's pad
        by reference and pad number), as KiCad's connectivity sees it:
        tracks, arcs, vias, pads and zones touching it physically.
kicad_get_design_rulestool The board's design rules from the project files: the board-setup
The board's design rules from the project files: the board-setup
        constraints (mm) in the .kicad_pro, the net-class patterns that
        assign nets to classes, and each custom rule in the .kicad_dru with
        its name, layer, condition and constraints. Net-class values are
        read live with kicad_get_net_classes.
kicad_get_diff_pairstool Differential pairs inferred from net naming (X_P/X_N, X+/X-),
Differential pairs inferred from net naming (X_P/X_N, X+/X-),
        naming-agnostic beyond the universal polarity suffix convention.
kicad_get_drc_violationstool Run KiCad's DRC on the board as it stands in the editor (a copyFilesoutside text
Run KiCad's DRC on the board as it stands in the editor (a copy
        saved with the project's rules, so unsaved edits count). Lists each
        violation with its type, severity, description, position and items,
        and the unconnected items grouped by net.
kicad_get_fab_statstool Board fabrication statistics (component / pad / hole / track counts,Filesoutside text
Board fabrication statistics (component / pad / hole / track counts,
        board area) via kicad-cli. Runs on the board file on disk.
kicad_get_layer_usagetool Per-layer routing usage: track count and total track length (mm),
Per-layer routing usage: track count and total track length (mm),
        sorted by length.
kicad_get_layerstool Enabled board layer names.
Enabled board layer names.
kicad_get_nettool All pads on a given net: reference and pin number.
All pads on a given net: reference and pin number.
kicad_get_net_classestool Per-net net-class assignment and each class's routing rules
Per-net net-class assignment and each class's routing rules
        (clearance, diff-pair gap/width, bus width) in mm.
kicad_get_netlisttool Structured schematic netlist: components (reference, value,
Structured schematic netlist: components (reference, value,
        footprint) and nets (name, class, pin nodes). This is the schematic's
        intended connectivity, from ``kicad-cli sch export netlist``.
kicad_get_project_infotool Open project's name, directory, and net-class names.
Open project's name, directory, and net-class names.
kicad_get_selectiontool Items currently selected in the KiCad PCB editor: type and, for
Items currently selected in the KiCad PCB editor: type and, for
        footprints, reference.
kicad_get_stackuptool Board stackup: layer name, type, material, thickness (mm).
Board stackup: layer name, type, material, thickness (mm).
kicad_get_text_variablestool Project text (substitution) variables.
Project text (substitution) variables.
kicad_get_title_blocktool Title-block fields (title, date, revision, company, comments).
Title-block fields (title, date, revision, company, comments).
kicad_get_trace_lengthstool Total routed track length per net (mm), summed from the copper
Total routed track length per net (mm), summed from the copper
        tracks. Useful for length-matching and impedance work.
kicad_get_unconnected_pinstool Pads with no net assigned (potentially unconnected pins).
Pads with no net assigned (potentially unconnected pins).
kicad_get_via_summarytool Via count and the distinct via sizes (pad diameter / drill) in use,
Via count and the distinct via sizes (pad diameter / drill) in use,
        each with a count. Fewer via types is cheaper to fabricate.
kicad_get_zone_filltool The filled copper of zones (by id or name; all zones when none
The filled copper of zones (by id or name; all zones when none
        given): per layer, each polygon's outline and holes in mm, plus its
        area in mm2. Empty when the zone is unfilled: refill first.
kicad_lib_add_footprint_itemstool Add pads and graphics to a library footprint (mm from its origin,
Add pads and graphics to a library footprint (mm from its origin,
        Y down). Each item: kind pad (number, type smd/pth/npth, shape
        roundrect/rect/circle/oval, position_mm, size_mm, drill_mm,
        angle_deg, layers), line or arc (points), rect (points: corners,
        filled), circle (center_mm, radius_mm), polygon (points), text (text,
        position_mm, size_mm); graphics take layer (default F.SilkS) and
        width_mm.
kicad_lib_add_pinstool Add pins to a library symbol's unit. Each pin: number, name, type
Add pins to a library symbol's unit. Each pin: number, name, type
        (input, output, bidirectional, passive, power_in, power_out,
        open_collector, no_connect...), x_mm, y_mm (its connection end,
        library coordinates, Y up), angle_deg (0 for a pin on the body's
        left, 180 on its right), length_mm, shape, hidden. A number the unit
        already has is refused.
kicad_lib_add_symbol_graphicstool Draw on a library symbol's unit (library mm, Y up). Each item:
Draw on a library symbol's unit (library mm, Y up). Each item:
        shape rectangle (points: two corners), polyline (points), circle
        (center_mm, radius_mm), arc (points: start, mid, end) or text (text,
        position_mm, size_mm); with width_mm and fill (none, outline,
        background).
kicad_lib_checktool Check a symbol or footprint library (kind) for common faults.
Check a symbol or footprint library (kind) for common faults.
        Symbols: no pins, duplicate pin numbers in a unit, pins off the 1.27
        mm grid, empty Reference or Value. Footprints: no pads, duplicate
        pad numbers of different shapes, no courtyard, no F.Fab or silk
        outline, no Reference text. Lists each finding with its item.
kicad_lib_get_footprinttool One library footprint: description, tags, properties, attributes,
One library footprint: description, tags, properties, attributes,
        every pad's number, type, shape, position, angle, size, drill and
        layers (mm from the footprint origin), graphic counts per layer, and
        its 3D model paths.
kicad_lib_get_symboltool One library symbol: properties, units, whether it is a power
One library symbol: properties, units, whether it is a power
        symbol, the symbol it extends, and every pin's number, name, type,
        unit, position (library mm, Y up), angle and length.
kicad_lib_list_librariestool The symbol or footprint libraries (kind) the open project sees:
The symbol or footprint libraries (kind) the open project sees:
        nickname, path, scope (project or global), disabled. Project rows
        come first; KiCad takes a nickname from the project table first.
kicad_lib_searchtool Search every library the project sees for symbols or footprints
Search every library the project sees for symbols or footprints
        (kind) whose name, description or keywords hold every word of
        query. Returns "Library:Name" ids ready for placing.
kicad_lib_set_footprint_propertiestool Set a library footprint's description, tags, mounting (smd,
Set a library footprint's description, tags, mounting (smd,
        through_hole, unspecified), and 3D models: add_models [{path,
        offset_mm, rotation_deg, scale}] and remove_models (paths, or "*"
        for all).
kicad_lib_set_tabletool Add (action "add", with path) or remove (action "remove") a
Add (action "add", with path) or remove (action "remove") a
        library in the project's or the global (scope) symbol or footprint
        table. A path inside the project folder is stored as ${KIPRJMOD}.
        KiCad reads the tables when a library is next opened.
kicad_list_dimensionstool Dimension annotations: layer, override text, height (mm).
Dimension annotations: layer, override text, height (mm).
kicad_list_documentstool Documents currently open in KiCad (PCB and schematic) withFilesoutside text
Documents currently open in KiCad (PCB and schematic) with
        filename and project.
kicad_list_groupstool Item groups on the board: name and member count.
Item groups on the board: name and member count.
kicad_list_padstool All pads on the board: number, net, position (mm), pad type.
All pads on the board: number, net, position (mm), pad type.
kicad_list_shapestool Graphic shapes: type (segment/arc/circle/rect/polygon), layer, net,
Graphic shapes: type (segment/arc/circle/rect/polygon), layer, net,
        and geometry points (mm).
kicad_list_texttool Free board text items: value, layer, position (mm).
Free board text items: value, layer, position (mm).
kicad_list_trackstool Copper tracks and arcs: net, layer, width, endpoints, length (mm).
Copper tracks and arcs: net, layer, width, endpoints, length (mm).
kicad_list_viastool Vias: net, position, diameter and drill (mm).
Vias: net, position, diameter and drill (mm).
kicad_list_zonestool Copper zones and rule areas: name, net, layers, fill, priority.Files
Copper zones and rule areas: name, net, layers, fill, priority.
kicad_lock_componenttool Lock or unlock a component's placement.
Lock or unlock a component's placement.
kicad_measure_clearancetool Edge-to-edge copper distance (mm) between two items: tracks,
Edge-to-edge copper distance (mm) between two items: tracks,
        arcs, vias, pads (their true outline) and filled zones. 0 means
        touching or overlapping.
kicad_modify_itemstool Change fields of board items in one commit, keeping the rest.
Change fields of board items in one commit, keeping the rest.

        Each item names its target by id, by reference (a footprint), or by
        reference and pad, with the fields to set beside it. Or give where
        (the filters of kicad_query_items) and set (the fields) to change
        every match. Fields use the names the query returns: net, layer,
        width_mm, start_mm, end_mm, mid_mm, position_mm, locked,
        diameter_mm, drill_mm, via_type, start_layer, end_layer, tented,
        solder_mask_margin_mm; pad number, size_mm, shape, clearance_mm,
        angle_deg; text text, size_mm, thickness_mm, angle_deg, visible,
        mirrored, knockout; footprint reference, value, datasheet,
        description, dnp, exclude_from_bom, exclude_from_pos, rotation_deg,
        reference_visible, reference_size_mm, reference_thickness_mm,
        reference_position_mm, reference_layer (and value_...); zone name,
        priority, layers, outline, clearance_mm, min_width_mm, connection,
        fill_mode, thermal_gap_mm, thermal_spoke_width_mm, keepout; shape
        filled; dimension override_text, prefix, suffix. Each reply item
        is the item as KiCad kept it; a value KiCad changed is reported.
kicad_move_componenttool Move a component to an absolute board position (mm).
Move a component to an absolute board position (mm).
kicad_move_itemstool Move items (by id, or footprints by reference) by dx_mm, dy_mm,
Move items (by id, or footprints by reference) by dx_mm, dy_mm,
        and/or turn them by rotate_deg counter-clockwise about about_mm
        (default: the centre of their positions). One commit.
kicad_pingtool Check the live connection to a running KiCad; returns KiCad and API
Check the live connection to a running KiCad; returns KiCad and API
        versions, or a reason (enable the API server, open a board).
kicad_place_arcstool Draw copper arc tracks. Each item: start_mm, mid_mm, end_mm, or
Draw copper arc tracks. Each item: start_mm, mid_mm, end_mm, or
        center_mm, radius_mm, start_deg, end_deg (counter-clockwise from
        +X); and net, layer, width_mm. One commit.
kicad_place_componentstool Move and turn footprints to absolute positions in one commit. Each
Move and turn footprints to absolute positions in one commit. Each
        item: reference, x_mm, y_mm, rotation_deg, locked. Pads, graphics
        and text follow. Change side with kicad_flip_components.
kicad_place_dimensionstool Place dimensions. Each item: start_mm, end_mm (centre and a point
Place dimensions. Each item: start_mm, end_mm (centre and a point
        on the circle for radial and center), style (aligned, orthogonal,
        leader, center, radial), height_mm (line offset), layer,
        text_size_mm, unit (mm, mils, in, auto). One commit.
kicad_place_shapestool Draw graphics on any layer. Each item: shape segment (start_mm,
Draw graphics on any layer. Each item: shape segment (start_mm,
        end_mm), rectangle (start_mm, end_mm corners), circle (center_mm,
        radius_mm), arc (start_mm, mid_mm, end_mm, or center_mm, radius_mm,
        start_deg, end_deg) or polygon (points); and layer, width_mm,
        filled, net. A filled copper rectangle or polygon is a fill. One
        commit.
kicad_place_texttool Place board text. Each item: text, x_mm, y_mm, and layer,
Place board text. Each item: text, x_mm, y_mm, and layer,
        size_mm, thickness_mm, angle_deg, knockout. Back-layer text reads
        mirrored; variables like ${REVISION} expand. One commit.
kicad_place_trackstool Draw copper tracks. Each item: points [[x_mm, y_mm], ...] (a
Draw copper tracks. Each item: points [[x_mm, y_mm], ...] (a
        polyline), and net, layer, width_mm, locked. One commit.
kicad_place_via_arraytool Stitch vias on a grid at pitch_mm inside area_mm [x1,y1,x2,y2]
Stitch vias on a grid at pitch_mm inside area_mm [x1,y1,x2,y2]
        or a zone's outline, on a net. A grid point is skipped when the via
        would come within clearance_mm of a pad, track or via of another net,
        or of the board edge. dry_run lists the points without placing.
kicad_place_viastool Place vias. Each item: x_mm, y_mm, and net, diameter_mm,
Place vias. Each item: x_mm, y_mm, and net, diameter_mm,
        drill_mm, via_type (through, blind, buried, micro), start_layer,
        end_layer. One commit.
kicad_place_zonestool Add copper zones (pours) or rule areas. Each item: points
Add copper zones (pours) or rule areas. Each item: points
        [[x_mm, y_mm], ...] or outline "board" (the board edge; inset_mm
        shrinks it); net, layers (default ["F.Cu"]), name, priority,
        clearance_mm, min_width_mm, connection (thermal, solid, none,
        pth_thermal). keepout {copper, vias, tracks, pads, footprints:
        bool} makes a rule area. fill refills the zones afterwards.
kicad_query_itemstool Find board items in the open PCB and read them (mm, degrees).
Find board items in the open PCB and read them (mm, degrees).

        kinds: footprint, pad, track, arc, via, zone, shape, text, textbox,
        dimension, group, barcode. Filters combine: ids, nets, net_classes,
        references (footprints, or their pads with kinds=["pad"]), layers,
        selected (the editor's selection), inside_mm [x1,y1,x2,y2] (wholly
        inside). count_only returns counts per kind. Each item carries its
        id, which the modify, move, copy and delete tools take.
kicad_refill_zonestool Refill every copper zone (KiCad 10.0 cannot refill only some), or
Refill every copper zone (KiCad 10.0 cannot refill only some), or
        unfill them all with unfill. Waits for the fill and reports each
        zone's filled state.
kicad_render_3dtool Render the board's 3D view to a PNG image.
Render the board's 3D view to a PNG image.
kicad_revert_boardtool Throw away unsaved board edits and reload the board file.
Throw away unsaved board edits and reload the board file.
kicad_review_schematictool Design review of the SCHEMATIC's intended connectivity: annotation,
Design review of the SCHEMATIC's intended connectivity: annotation,
        single-pin nets, shorts, unconnected parts, missing decoupling, net
        classes -- from the netlist, independent of PCB layout. Complements
        review_design (which reviews the PCB copper).
kicad_rotate_componenttool Set a component's orientation (degrees).
Set a component's orientation (degrees).
kicad_run_actiontool Run an arbitrary KiCad tool action by name (e.g. a TOOL_ACTION such
Run an arbitrary KiCad tool action by name (e.g. a TOOL_ACTION such
        as "pcbnew.Control.zoomFitScreen"). Escape hatch equivalent to Altium's
        run-process/run-menu.

        NOTE: this is KiCad's unstable, non-guaranteed action API -- it may have
        side effects on the open design. Use deliberately.
kicad_run_jobsettool Run a KiCad jobset (a saved batch of output jobs -- KiCad's
Run a KiCad jobset (a saved batch of output jobs -- KiCad's
        equivalent of an Altium OutJob) against the open project. Leave output
        blank to generate every output the jobset defines.
kicad_run_spicetool Run a SPICE simulation on the schematic via a standalone ngspice.
Run a SPICE simulation on the schematic via a standalone ngspice.

        Exports the schematic's SPICE netlist and runs it in ngspice batch
        mode. Requires ngspice on PATH -- KiCad bundles only ngspice.dll (used
        by its GUI simulator), not a runnable executable -- so this reports a
        clear reason when no standalone ngspice is installed.
kicad_save_boardtool Write the open board to disk.Files
Write the open board to disk.
kicad_save_board_copytool Save a copy of the board as it stands in the editor to path
Save a copy of the board as it stands in the editor to path
        (.kicad_pcb). The open board keeps its own file.
kicad_sch_annotatetool Number symbols across every sheet of the project (sheet: any of
Number symbols across every sheet of the project (sheet: any of
        its files, default the open one). References ending "?" get the
        lowest free number for their prefix, ordered by position (order x:
        rows; y: columns). reset renumbers all but power ports. Each
        unannotated unit gets its own number.
kicad_sch_delete_itemstool Delete schematic items by uuid (any item: symbol, wire, label,
Delete schematic items by uuid (any item: symbol, wire, label,
        junction, sheet...) or symbols by reference, from one sheet file.
kicad_sch_get_itemstool Read a schematic sheet from its file (default the root). kinds:
Read a schematic sheet from its file (default the root). kinds:
        symbols, wires, buses, labels, junctions, no_connects, texts,
        sheets, page; all by default. Symbols carry their fields, flags,
        position, angle, mirror, unit and each pin's number, name, type and
        sheet position (mm) for wiring. Lists the project's sheet files.
kicad_sch_modify_symbolstool Change placed symbols, each named by reference (which_unit picks
Change placed symbols, each named by reference (which_unit picks
        one unit of a multi-unit part) or uuid, with the changes beside it:
        new_reference, value, footprint, datasheet,
        properties {name: value, or null to remove}, x_mm, y_mm (moves
        fields with it), angle_deg, mirror (x, y, or ""), unit, dnp, in_bom,
        on_board, exclude_from_sim. Wires are not moved.
kicad_sch_place_graphicstool Place notes and drawing. Each item: shape text (text, x_mm,
Place notes and drawing. Each item: shape text (text, x_mm,
        y_mm, size_mm, angle_deg), text_box (text, points: two corners),
        line (points), rectangle (points: two corners) or circle (x_mm,
        y_mm, radius in size_mm).
kicad_sch_place_labelstool Place net labels. Each item: text (the net), x_mm, y_mm (on a
Place net labels. Each item: text (the net), x_mm, y_mm (on a
        wire end or pin), angle_deg, kind (local, global, hierarchical),
        shape (input, output, bidirectional, tri_state, passive), size_mm.
kicad_sch_place_markerstool Place junctions, no-connect flags or bus entries. Each item: x_mm,
Place junctions, no-connect flags or bus entries. Each item: x_mm,
        y_mm, kind (junction, no_connect, bus_entry); a bus entry takes
        size_mm [dx, dy] (default [2.54, 2.54]).
kicad_sch_place_powertool Place power ports. Each item: name (the net: GND, +3V3), x_mm,
Place power ports. Each item: name (the net: GND, +3V3), x_mm,
        y_mm (its pin), angle_deg, lib_id (default "power:<name>").
        References are numbered #PWR.
kicad_sch_place_sheettool Add a hierarchical sheet: name, file (a .kicad_sch in the project
Add a hierarchical sheet: name, file (a .kicad_sch in the project
        folder, made empty when missing), position and size (mm), and pins
        [{name, shape (input, output, bidirectional, tri_state, passive),
        side (left, right), offset_mm (from the top)}]. Pins on the sheet
        symbol pair with hierarchical labels of the same name inside.
kicad_sch_place_symbolstool Place library symbols on a sheet (default the root). Each item:
Place library symbols on a sheet (default the root). Each item:
        lib_id ("Device:R", from the symbol tables), x_mm, y_mm, and
        reference (default: next free for the prefix), value, angle_deg
        (0/90/180/270), mirror (x, y), unit, footprint, properties {name:
        value}, dnp, in_bom, on_board. Returns uuids, references and pin
        positions.
kicad_sch_place_wirestool Draw wires. Each item: points [[x_mm, y_mm], ...] (a polyline),
Draw wires. Each item: points [[x_mm, y_mm], ...] (a polyline),
        bus (true for a bus). With junctions, one is added where a wire end
        lands mid-wire.
kicad_sch_set_pagetool Set a sheet's paper size (A4, A3, A2, A1, A0, A, B, C, D, E,
Set a sheet's paper size (A4, A3, A2, A1, A0, A, B, C, D, E,
        USLetter, USLegal) and title block: title, date, revision, company,
        comments {"1": "..."} for comments 1 to 9. Fields not given are
        kept.
kicad_select_itemstool Select items in the PCB editor: by id, footprints by reference,
Select items in the PCB editor: by id, footprints by reference,
        or every track, via, pad and zone of nets. mode: replace, add,
        remove, clear. highlight also highlights the selected items' nets
        (clear mode clears the highlight).
kicad_set_board_layerstool Set the board's copper layer count and enable or disable the
Set the board's copper layer count and enable or disable the
        technical and user layers (e.g. "User.1", "F.Adhes"). Copper layers
        are added or removed at the inside of the stack.
kicad_set_board_outlinetool Replace the board edge: every Edge.Cuts graphic is removed and one
Replace the board edge: every Edge.Cuts graphic is removed and one
        closed outline drawn. Give points (a polygon), rect_mm [x1,y1,x2,y2],
        or fit_components_margin_mm to wrap all footprints' bodies plus a
        margin.
kicad_set_board_viewtool Change what the PCB editor shows: visible_layers (the full set),
Change what the PCB editor shows: visible_layers (the full set),
        or show and hide some; active_layer; inactive_layers (normal,
        dimmed, hidden); net_colors (all, ratsnest, off); ratsnest
        (all_layers, visible_layers); board_flip (normal, flipped_x).
        Returns the view as it is afterwards.
kicad_set_component_sidetool Place a component on the top or bottom copper layer ("top"/"bottom").Filesoutside text
Place a component on the top or bottom copper layer ("top"/"bottom").
kicad_set_component_valuetool Set a component's value field.Filesoutside text
Set a component's value field.
kicad_set_design_rulestool Write design rules to the project files.
Write design rules to the project files.

        rules go to the .kicad_dru, read by every DRC run: each {name,
        condition (e.g. "A.NetClass == 'POWER'"), layer (outer, inner,
        F.Cu), constraints (e.g. ["clearance (min 0.3mm)"])}; a rule of the
        same name is replaced. delete_rules removes rules by name.

        constraints (board-setup minimums in mm: min_clearance,
        min_track_width, min_via_diameter...) and netclass_patterns
        [{netclass, pattern}] (added, or all replaced with
        replace_patterns) go to the .kicad_pro. The open editor does not
        reread it: reopen the project before saving in KiCad.
kicad_set_net_classestool Add or change net classes (each item: name, and clearance_mm,
Add or change net classes (each item: name, and clearance_mm,
        track_width_mm, diff_pair_width_mm, diff_pair_gap_mm,
        via_diameter_mm, via_drill_mm, priority) live in the editor, or
        delete them by name from the .kicad_pro (read on reopening the
        project). Assign nets with kicad_set_design_rules
        netclass_patterns.
kicad_set_origintool Set the board's grid origin or its drill/place origin (kind
Set the board's grid origin or its drill/place origin (kind
        "drill"), which position files and Gerbers can be measured from.
kicad_set_text_variabletool Set a project text (substitution) variable, e.g. key "REV" value
Set a project text (substitution) variable, e.g. key "REV" value
        "B". Other variables are preserved.
kicad_set_title_blocktool Set the board's title block: title, date, revision, company, and
Set the board's title block: title, date, revision, company, and
        comments {"1": "...", ...} for comment1 to comment9. Fields not
        given are kept.
kicad_snap_components_to_gridtool Move footprints (the references given, or all) to the nearest
Move footprints (the references given, or all) to the nearest
        point of a grid_mm grid measured from the grid origin. One commit.
kicad_upgrade_boardtool Upgrade the open board's file format to the current KiCad version.
Upgrade the open board's file format to the current KiCad version.
        Rewrites the .kicad_pcb on disk in place.
kicad_upgrade_footprint_librarytool Upgrade a footprint (.pretty) library to the current KiCad format.
Upgrade a footprint (.pretty) library to the current KiCad format.
kicad_upgrade_schematictool Upgrade the open schematic's file format to the current KiCad
Upgrade the open schematic's file format to the current KiCad
        version. Rewrites the .kicad_sch on disk in place.
kicad_upgrade_symbol_librarytool Upgrade a symbol (.kicad_sym) library to the current KiCad format.
Upgrade a symbol (.kicad_sym) library to the current KiCad format.
length_unitstool Read, or set, the unit this session gives and reads lengths in.Filesoutside text
Read, or set, the unit this session gives and reads lengths in.

        One rule on every tool: a length whose name has no unit (x,
        width, hole_size) is in this unit, in arguments and replies alike.
        A name with a unit always means it: thickness_mils is mils, and
        thickness_mm may be given instead. Replies rename such keys to
        this unit and say ``length_units``. One call can use the other
        unit by giving ``length_units`` beside its own arguments.

        The setting is this session's own; other sessions keep theirs. A
        new session starts in the unit chosen on the Config tab of the
        Altium panel (mil unless changed there).

        Args:
            to: "mil" or "mm" to set it; omit to read it.

        Returns:
            ``length_units`` (this session's) and ``default`` (the Config
            tab's, for new sessions).
lib_add_footprint_arctool Add an arc to the current footprint.
Add an arc to the current footprint.

        Args:
            x_center: Center X in mils
            y_center: Center Y in mils
            radius: Arc radius in mils
            start_angle: Start angle in degrees
            end_angle: End angle in degrees
            width: Line width in mils
            layer: Layer name. Default "TopOverlay" (silkscreen). Any
                Altium layer accepted, e.g. "Mechanical1".."Mechanical16"
                for pin-1 / assembly markers.
            footprint_name: footprint to write into. Empty uses the
                editor's current footprint; a name makes that footprint
                current first and refuses if it cannot.
            units: "mil" (default) or "mm", for every length and
                coordinate here, kept exact rather than rounded to
                whole mils.
            keepout, keepout_for: make the arc a keepout, as in
                lib_add_footprint_regions.

        Returns:
            Dictionary confirming arc addition; for a keepout also
            keepout_verified, keepout and keepout_for as read back.
lib_add_footprint_bodiestool Add extruded 3D bodies to a PcbLib footprint in ONE call.Filesoutside text
Add extruded 3D bodies to a PcbLib footprint in ONE call.

        THE FALLBACK BODY. A part's 3D body should be its STEP model:
        the vendor's, linked with lib_link_3d_model, or one generated from
        the package description (lib_create_footprint_from_package does
        that first). Use this for a part with neither, or for a clearance
        or keep-in volume: an outline lifted from standoff_height to
        overall_height.

        Args:
            bodies: list of ``{"points": [[x, y], ...], "overall_height":
                ..}``, the outline relative to the footprint origin, with
                optional ``standoff_height`` (default 0), ``layer``
                (default TopLayer, the side the body projects from; a
                mechanical layer such as Mechanical13 is common),
                ``identifier`` (a name to find the body again by),
                ``color`` (Altium TColor integer) and ``opacity`` (0-1).
            footprint_name: footprint to write into; empty uses the
                current one.
            units: "mil" (default) or "mm", for outline and heights.

        Returns:
            Dict with added, failed, bad_points, bad_height,
            unknown_layers, total and ``bodies``, each read back
            (outline, heights, identifier, layer) with which optional
            properties were applied. Unless the Config tab allows basic
            3D models, ``basic_3d_models`` says to ask the user before
            these stand in for the part's model.
lib_add_footprint_fillstool Add rectangular fills to a PcbLib footprint in ONE call.
Add rectangular fills to a PcbLib footprint in ONE call.

        A fill stays an Altium fill, not a four-point region, so it reads
        back and edits as one. Use it for a grid of paste windows over an
        exposed pad, or a solid block on a mechanical or overlay layer.
        For any other outline use lib_add_footprint_regions.

        Args:
            fills: list of ``{"layer": ..., "x1": .., "y1": .., "x2": ..,
                "y2": ..}``, opposite corners relative to the footprint
                origin, with an optional ``"rotation"`` in degrees about
                the fill's centre. The layer is REQUIRED: there is no
                default, because a solid shape defaulted onto copper is a
                short. A fill with no area is refused. ``keepout`` and
                ``keepout_for`` as in lib_add_footprint_regions.
            footprint_name: footprint to write into. Empty uses the
                editor's current footprint; a name makes that footprint
                current first and refuses if it cannot.
            units: "mil" (default) or "mm", for every corner, kept exact.

        Returns:
            Dict with added, failed, bad_extent, unknown_layers, total,
            keepouts, keepout_failures, bad_keepouts. A
            fill refused here before sending is listed in ``refused`` with
            the reason.
lib_add_footprint_padtool Add a pad to a footprint: the named one, or the current one.Filesoutside text
Add a pad to a footprint: the named one, or the current one.

        A footprint new from lib_create_footprint takes lands only with
        ``compared``, the id footprint_compare_drawing returned for them.

        Args:
            designator: Pad designator (e.g., "1", "2")
            x, y: Pad position.
            x_size, y_size: Pad size (default 60 mil).
            hole_size: Drill size; 0 for SMD. A drilled pad is
                through-hole (MultiLayer); a hole-less one is SMD on
                ``layer``.
            shape: "round", "rectangular", "octagonal" or "roundrect".
                An oval is "round" with x_size != y_size. Another word
                (e.g. "rectangle") is refused and no pad is added.
            layer: SMD pad layer ("TopLayer"/"BottomLayer").
            rotation: Pad rotation in degrees
            corner_radius: roundrect corner radius, % (Altium's unit).
            corner_radius_length: or the radius as a length, converted to
                that % of half the shortest side (so resizing the pad
                later changes it).
            footprint_name: footprint to write into; empty uses the
                current one. A name is made current first, refusing if
                it cannot.
            units: "mil" (default) or "mm", for every length and
                coordinate here; mm values are kept exact.

        Returns:
            Dictionary confirming pad addition
lib_add_footprint_padstool Add pads to the current footprint in ONE call (a list of one addsFilesoutside text
Add pads to the current footprint in ONE call (a list of one adds
        a single pad). Coordinates are not snapped. A footprint new from
        lib_create_footprint takes lands only with ``compared``, the id
        footprint_compare_drawing returned for them.

        Args:
            pads: List of pad dicts, each with:
                - designator (required), e.g. "1", "A1"
                - x, y: pad centre
                - x_size, y_size (default 60 mil)
                - hole_size (default 0 = SMD; drilled pads are MultiLayer)
                - shape: round, rectangular (default), octagonal or
                  roundrect; oval is round with unequal sizes. Another
                  word refuses the whole call, no pad added
                - corner_radius: roundrect corner in % (default 25), or
                  corner_radius_length as a length
                - rotation: degrees
                - layer: SMD side, "TopLayer" (default) or "BottomLayer"
                - optional: hole_length (slot), hole_rotation (the
                  slot's turn from the pad's X axis; left out, the slot
                  runs along the pad's longer side),
                  plated (false = NPTH, which may have no designator),
                  unnumbered (true: copper with no designator, a fiducial),
                  paste_expansion, mask_expansion (minus the larger side
                  closes the paste); refused writes show in
                  ``property_failures``
            footprint_name: Footprint to write into; empty uses the
                current one, a name makes it current or refuses.
            units: "mil" (default) or "mm" for every pad, kept exact.

        Returns:
            Dict with added, failed, total counts.
lib_add_footprint_regionstool Add solid polygon regions to a PcbLib footprint in ONE call.
Add solid polygon regions to a PcbLib footprint in ONE call.

        For example, paste windows over an exposed pad (on TopPaste, with
        the pad's own paste closed by a negative paste_expansion in
        lib_add_footprint_pads), or a filled shape on any layer.

        Args:
            regions: list of ``{"layer": ..., "points": [[x, y], ...]}``,
                three or more points each, relative to the footprint
                origin. The layer is REQUIRED: there is no default,
                because a solid shape defaulted onto copper is a short.
                A point ``[x, y, sweep]`` makes the edge to the next point
                a true arc of ``sweep`` degrees, counterclockwise when
                positive (a slot's round end is 180 or -180); other edges
                are straight. ``"keepout": true`` makes the region a
                keepout on its own layer, and ``"keepout_for"`` lists
                what it keeps out ("copper", "track", "via", "smd_pad",
                "th_pad"; all five when left out). ``["copper"]`` on a
                signal layer keeps pours off that layer alone while
                tracks may cross; KeepOutLayer acts on every layer, and
                a region there is always made a keepout.
            footprint_name: footprint to write into; empty uses the
                current one, and a name that cannot be made current is
                refused.
            units: "mil" (default) or "mm", for every point, kept exact.

        Returns:
            Dict with added, failed, bad_points, unknown_layers, total,
            and arc_edges: the arc edges the created regions read back
            as holding; keepouts (made keepouts whose flags read back as
            asked), keepout_failures and bad_keepouts. A region refused
            here before sending is listed
            in ``refused`` with the reason.
lib_add_footprint_texttool Add a text primitive to a PcbLib footprint.
Add a text primitive to a PcbLib footprint.

        Args:
            text: The string to place. Required.
            x, y: Position relative to the footprint's origin.
            size: Text height (default 50 mil).
            width: Stroke width (default 8 mil); scale with ``size``.
            rotation: Degrees.
            layer: Layer name (``TopOverlay``, ``BottomOverlay``,
                ``Mechanical1`` ...).
            use_ttfont: TrueType instead of the stroke font.
            mirror: Mirror the text; set it for a BOTTOM layer.
            library_path: .PcbLib to focus first; default the active one.
            component_name: Footprint to switch to first; default the
                current one.
            units: "mil" (default) or "mm", kept exact.

        Returns:
            ``success``, ``footprint``, ``text``, ``layer``, ``x``, ``y``.
lib_add_footprint_tracktool Add a track to the current footprint (for silkscreen/courtyard).
Add a track to the current footprint (for silkscreen/courtyard).

        Args:
            x1: Start X in mils
            y1: Start Y in mils
            x2: End X in mils
            y2: End Y in mils
            width: Track width in mils
            layer: Layer name. Default "TopOverlay" (silkscreen). Any
                Altium layer is accepted, e.g. "BottomOverlay" or
                "Mechanical1".."Mechanical16" for courtyard / assembly
                outlines.
            footprint_name: footprint to write into. Empty uses the
                editor's current footprint; a name makes that footprint
                current first and refuses if it cannot.
            units: "mil" (default) or "mm", for every length and
                coordinate here, kept exact rather than rounded to
                whole mils.

        Returns:
            Dictionary confirming track addition
lib_add_footprint_trackstool Add MANY tracks to the current footprint in ONE call.
Add MANY tracks to the current footprint in ONE call.

        One call, one undo step and one save for a whole outline; a list
        of one adds a single track.

        Args:
            tracks: ``{x1, y1, x2, y2, width (default 10), layer
                (default "TopOverlay")}`` each; any layer name, e.g.
                "Mechanical13" for an assembly outline. ``keepout`` and
                ``keepout_for`` as in lib_add_footprint_regions.

        ``footprint_name`` picks the footprint; empty uses the current
        one, and a name that cannot be made current is refused.
        ``units`` is "mil" (default) or "mm", kept exact.

        Returns:
            Dict with added, failed, total counts, and keepouts,
            keepout_failures, bad_keepouts as for regions.
lib_add_footprint_viatool Add a through-stack via to a footprint: the named one, or the current one.
Add a through-stack via to a footprint: the named one, or the current one.

        The via spans top to bottom. Its position is relative to the
        footprint origin, like a pad's. It goes into the focused PCB
        library; give ``library_path`` to refuse when that is not the one
        you mean.

        Args:
            x, y: Via centre, relative to the footprint origin.
            size: Via diameter (default 40 mil).
            hole_size: Drill diameter (default 20 mil). Must be below size.
            footprint_name: footprint to write into; empty uses the
                current one.
            units: "mil" (default) or "mm", for every length here.
            library_path: Full path to the .PcbLib. When given, the call
                refuses unless that library is the focused one.

        Returns:
            Dictionary confirming the via was added
lib_add_footprint_viastool Add many through-stack vias to a footprint in ONE call.
Add many through-stack vias to a footprint in ONE call.

        One call for a whole via grid; a list of one adds a single via.
        Positions are relative to the footprint origin; the via spans top
        to bottom.

        Args:
            vias: list of ``{"x": .., "y": ..}``, each with an optional
                ``size`` and ``hole_size`` overriding the defaults below,
                and optionally its solder mask, set as it is made:
                ``tenting_top`` / ``tenting_bottom`` /
                ``mask_from_hole_edge`` / ``mask_separate`` (bool),
                ``mask_expansion`` / ``mask_bottom_expansion`` (length;
                the bottom follows the top unless given). Any of them
                makes the mask manual.
            size: Via diameter for vias that give none (default 40 mil).
            hole_size: Drill for vias that give none (default 20 mil).
            footprint_name: footprint to write into; empty uses the
                current one.
            units: "mil" (default) or "mm", for every length here.
            library_path: Full path to the .PcbLib. When given, the call
                refuses unless that library is the focused one.

        Returns:
            Dict with added, failed, bad_size (hole not inside the
            diameter), bad_number, masked (vias whose mask fields all
            read back), property_failures, total; a via refused here
            before sending is listed in ``refused`` with the reason.
lib_add_pinstool Add MANY pins to the current symbol in ONE call (there is noFilesoutside text
Add MANY pins to the current symbol in ONE call (there is no
        single-pin variant).

        The current symbol is the one created, copied, renamed or made
        current LAST in this library this session (lib_set_current_component,
        or any "lib_component:NAME" scope, a read-only obj_query
        included), else the one on screen; ``lib_get_pin_list()`` with no
        name reads it. Make a symbol and add its pins before making the
        next: a batch of lib_create_symbol followed by lib_add_pins puts
        every pin on the last symbol. To add pins to an existing symbol,
        lib_set_current_component first. lib_create_ic_symbol makes the
        symbol and its pins together.

        Args:
            pins: List of pin dicts, each with:
                - designator, name (required)
                - x, y: where the pin meets the BODY (Altium's
                  Location), mils. The wire connects at the other end,
                  ``length`` away in the rotation's direction.
                - length: mils (default 200)
                - rotation: the way the pin points out of the body:
                  0 right, 90 up, 180 left, 270 down (default 0). A
                  left-side pin at the body edge x=0 is rotation 180 and
                  connects at x=-length; a top pin at y=0 is 90.
                - electrical_type: input, output, bidirectional, passive
                  (default), open_collector, open_emitter, power, hiz, io
                - hidden: hide the pin (default False)
                - owner_part_id: sub-part of a multi-part symbol; 0 shares
                  the pin across all parts (power pins).
                - symbol_outer_edge / symbol_inner_edge: IEEE decoration,
                  e.g. "dot" (active low) outside, "clock" inside, or any
                  TIeeeSymbol name.
                - show_name / show_designator: draw the pin's name or
                  number (a resistor shows neither).
            pins_on_part: The part a pin without its own owner_part_id
                goes on (0 puts it on every part). Left out, such pins
                go on the symbol's current part.
            datasheet: ``{path, page}`` of the pin table. Needed for pins
                going into a symbol lib_create_symbol has just made: they
                are checked as lib_create_ic_symbol checks its pins
                (``package_column`` too).
            grid: the grid the pins' x, y and length snap to (default
                100 mils); 0 keeps them exactly as given.

        Returns:
            Dict with added, failed, total counts.
lib_add_symbol_arctool Add an arc to the current library symbol.
Add an arc to the current library symbol.

        Args:
            x_center: Center X coordinate in mils
            y_center: Center Y coordinate in mils
            radius: Arc radius in mils
            start_angle: Start angle in degrees (0 = right, 90 = up)
            end_angle: End angle in degrees
            width: Line width (0=zero, 1=small, 2=medium, 3=large)
            grid: snap grid (mils); arcs are glyph detail and don't need
                the 100-mil pin grid (rule 15), so the default is a finer
                25 mils (e.g. inductor coils). Pass 100 mils for coarse,
                0 for none.
            color: line colour (Altium colour integer); omit for the
                default.
            owner_part_id: the part of a multi-part symbol it belongs to;
                omit for the current part.

        Returns:
            Dictionary confirming arc addition, with ``color`` and
            ``line_width`` read back
lib_add_symbol_linestool Add MANY lines to the current symbol body in ONE call.
Add MANY lines to the current symbol body in ONE call.

        One Altium transaction for the whole list.

        Args:
            lines: list of dicts, each with keys ``x1``, ``y1``,
                ``x2``, ``y2`` (mils, int), ``width`` (int 0-3,
                default 1), an optional ``color`` (Altium colour
                integer) and ``owner_part_id`` (as in ``lib_add_pins``).
            grid: snap grid (mils) for the line endpoints. Glyph lines do
                NOT need the 100-mil pin grid (rule 15), so the default is
                a finer 25 mils for clean glyph detail; pass 100 mils for
                the coarse grid or 0 to disable snapping.

        Returns:
            Dict with ``added``, ``failed``, ``total`` counts.
lib_add_symbol_polygontool Add a polygon (filled shape) to the current library symbol.
Add a polygon (filled shape) to the current library symbol.

        Args:
            vertices: Comma-separated x,y coordinate pairs.
                Example: "0,0,100,0,100,100,0,100" creates a square with
                vertices at (0,0), (100,0), (100,100), (0,100).
                Minimum 3 vertices (6 values) required.
            grid: snap grid (mils) for the vertices. A filled polygon is
                glyph detail (e.g. a diode triangle) and doesn't need the
                100-mil pin grid (rule 15), so the default is a finer 25
                mils; pass 100 mils for coarse or 0 to disable snapping.
            fill_color: omit for a solid glyph in the line colour (a diode
                triangle); a colour such as 8454143, Altium's block yellow,
                makes it a filled BODY (an amplifier triangle); -1 draws
                an outline only.
            owner_part_id: the part of a multi-part symbol to draw on;
                omit for the current part.
            color: border colour (Altium colour integer).
            line_width: border width, 0 (smallest) to 3 (large).
            is_solid: fill (True) or outline only (False), over what
                ``fill_color`` implies.

        Returns:
            Dictionary confirming polygon addition with vertex count, and
            the style it now holds read back: ``color``, ``area_color``,
            ``line_width``, ``is_solid``
lib_add_symbol_rectangletool Add a rectangle to the current symbol body.
Add a rectangle to the current symbol body.

        ADD THE BODY BEFORE THE PINS: drawing order is insertion order,
        and a filled rectangle added after the pins paints over their
        names (the only fix is rebuilding the symbol).

        Args:
            x1: First corner X in mils
            y1: First corner Y in mils
            x2: Opposite corner X in mils
            y2: Opposite corner Y in mils
            fill_color: Fill color index (-1 = no fill)
            border_color: Border color index
            line_width: Border width, 0 (smallest) to 3 (large); omit
                for Altium's default.
            is_solid: Fill (True) or outline only (False); omit and a
                fill colour makes it solid.
            owner_part_id: the part of a multi-part symbol it belongs to;
                omit for the current part.
            grid: the grid the corners snap to (default 100 mils); 0
                keeps them exactly as given.

        Returns:
            Dictionary confirming rectangle addition, with the style it
            now holds read back: ``color``, ``area_color``,
            ``line_width``, ``is_solid``.
lib_add_symbol_texttool Add MANY body-text items to the current symbol in ONE call.
Add MANY body-text items to the current symbol in ONE call.

        Free text such as polarity marks, pin-group headings and "NC".

        Args:
            texts: List of text dicts, each with:
                - text     (str, required; empty is refused)
                - x, y     (int, mils)
                - rotation (int, default 0), 0/90/180/270
                - font_size (int, default 10): Altium's font size, not
                  mils and not converted
                - font_name (str, default "Arial")
                - bold, italic (bool, default False)
                - owner_part_id (int, optional): as in ``lib_add_pins``,
                  1..part_count picks a sub-part, 0 shares it
            grid: the grid x and y snap to (default 100 mils); 0 keeps
                them.

        Returns:
            Dict with ``added``, ``failed``, ``total`` counts.
lib_audit_footprint_policiestool Sweep a PcbLib and flag footprints that break the library's ownFilesoutside text
Sweep a PcbLib and flag footprints that break the library's own
        conventions: inconsistent layer usage, pad rules, pin-1 markings,
        courtyard, silkscreen, 3D models, designator style.

        Each convention is the library's most common one, so any house
        style works; ``policy`` pins one instead, e.g.
        ``{"silk_layer": "Top Overlay", "courtyard": true}``. Each finding
        gives footprint, dimension, expected and actual. Designators must
        sit on the average pad centre, within
        ``policy={"designator_center_tol": <mils>}``. One library pass.

        Args:
            library_path: Optional .PcbLib to focus first; defaults to the
                focused library.
            policy: Optional explicit conventions to enforce; omitted
                dimensions are inferred from the library.

        Returns ``{library_path, footprint_count, conventions, findings,
        summary}``, and ``basic_3d_models`` when footprints have only
        extruded, cylinder or sphere bodies and the Config tab does not
        allow basic 3D models: tell the user and ask before replacing any.
lib_audit_footprint_vs_datasheettool Audit a footprint against the manufacturer's land pattern.
Audit a footprint against the manufacturer's land pattern.

        Compares the live pads (count, position, size, shape, drill,
        numbering, thermal pad and its paste) with a spec transcribed
        from the manufacturer datasheet fetched in this conversation and
        cited in ``spec.source``. Origin and 90-degree rotation are
        aligned out; a mirrored pattern is reported, not compensated.

        The spec (JSON object or string):
          source: {datasheet_url, reference, part_number}   REQUIRED
          pads: [{name, x, y, w, h, shape?, hole?}]         explicit, mm
          dual_row: {count, pitch, span, pad_w, pad_h, shape?}
          quad: {count, pitch, span_x, span_y, pad_w, pad_h, shape?}
          thermal_pad: {name, x, y, w, h, shape?}
          thermal_paste: 'full' | 'windowed'
          position_tol / size_tol: mm, default 0.05

        dual_row numbers like SOIC and quad like QFN (pin 1 top-left,
        CCW); otherwise give ``pads``. pad_w runs ACROSS the row in
        dual_row but ALONG it in quad. span / span_x / span_y are pad
        CENTRE to pad CENTRE (C on a vendor land pattern), never the
        outer extent Z or the package's lead span.

        Whatever the spec says, pads of different names whose copper
        overlaps are an error and a gap under 0.1 mm a warning
        (check ``pad_clearance``): a footprint that faithfully matches a
        misread spec still shorts.

        Returns:
            {ok, rotation_applied_deg, findings: [{check, severity,
             message, pad?, expected?, actual?}]} plus the footprint
            geometry under 'footprint' for reference. ok is true only
            with zero error-severity findings.
lib_audit_footprint_vs_packagetool Audit an existing PcbLib footprint against its package drawing.Filesoutside text
Audit an existing PcbLib footprint against its package drawing.

        Takes the PackageSpec (as lib_create_footprint_from_package does).
        Reads only. Checks pad count, numbering and pin 1 (names a
        mirror-image footprint), pitch, lands against IPC-7351B within
        vendor tolerances, holes, exposed-pad paste, solder mask, origin,
        courtyard, silkscreen, assembly outline and height. Unread items
        are in ``not_examined``. Run footprint_check_package on the
        package first.

        Args:
            footprint_name: the footprint in the library.
            package: the PackageSpec as an object or JSON text.
            density: L, N or M, the IPC pattern compared against.
            library_path: optional .PcbLib path; default the focused one.
            assembly_layer, courtyard_layer: the mechanical layers for
                those roles; empty picks them by the library's layer kind
                ("Assembly Top" / "Courtyard Top"), then by name.

        Returns:
            ``{ok, errors, warnings, findings: [{check, severity, message,
            pad?, expected?, actual?}], examined, not_examined, alignment,
            metrics, notes, package_check}``. ``ok`` is true with no
            error-severity finding.
lib_audit_stylestool Audit label styles across every symbol of a library in one call.
Audit label styles across every symbol of a library in one call.

        Reports each symbol's designator style; comment, parameter styles
        and pins are opt-in. With an ``expect_designator_*`` filter only
        the symbols that do NOT match come back.
        ``check_standard_symbols`` adds ``standard_symbol_warnings``:
        amplifiers drawn as a rectangle instead of a triangle (warns only).

        Args:
            library_path: .SchLib (default: the focused one).
            with_comment: Add the comment style.
            with_parameters: Add parameter styles (slower).
            with_pins: Add pins, ``body`` (rectangle and polygon counts)
                and description.
            check_standard_symbols: Flag rectangular amplifiers (implies
                with_pins).
            expect_designator_font_id: Keep only symbols whose designator
                font differs.
            expect_designator_color: Keep only symbols whose designator
                colour differs (BGR int, e.g. 8388608 for navy).
            limit: Cap on symbols returned (default 5000).
            timeout: Poll timeout in seconds.
            refresh: SAVE the library and read it back in first. Symbols
                are listed from the saved file, so ones created or changed
                since the last save are otherwise missing or stale.

        Returns:
            library_path, count, mismatch_count, limit, truncated,
            filter_applied, refreshed, ``components`` [{name, designator,
            mismatched, comment?, pins?, parameter_styles?}].
lib_auto_link_3d_modelstool Batch-link STEP models to footprints by matching file names.
Batch-link STEP models to footprints by matching file names.

        Enumerates every footprint in the PcbLib, scans `model_dir` for
        .step/.stp files, and links each footprint whose name matches a model
        file's stem (case-insensitive). No offset or rotation is set.

        Args:
            model_dir: Folder containing .step/.stp model files.
            library_path: Optional .PcbLib to focus first; uses the focused
                document otherwise.

        Returns:
            {"linked": [{footprint, model}], "unmatched_footprints": [...],
             "unused_models": [...]}.
lib_batch_renametool Batch rename components in a schematic library.Filesoutside text
Batch rename components in a schematic library.

        What ``lib_rename_component(items=[...])`` runs by name, kept under
        this name for callers that use it.

        Each assignment renames one component from old_name to new_name.

        Args:
            assignments: List of dicts with keys:
                - old_name: Current name of the component in the library
                - new_name: New name for the component
            library_path: Path to library (uses active library if not specified)

        Returns:
            Dictionary with counts of renamed and failed assignments
lib_batch_set_paramstool Batch set parameters on library components.Filesoutside text
Batch set parameters on library components.

        Each assignment updates or creates one parameter. Three names set
        properties instead: ``"Description"``, ``"Designator"`` (the
        default, e.g. ``"U?"``) and ``"Comment"`` (e.g. ``"=Partnumber"``).
        A created parameter is hidden; ``lib_set_label_formats`` shows,
        hides or moves it.

        Args:
            assignments: List of dicts with keys:
                - component_name: Name of the component in the library
                - param_name: Parameter name (e.g., "Partnumber", "Manufacturer"),
                  or the special "Description" / "Designator" / "Comment" keys
                - param_value: Value to set
            library_path: Path to library (uses active library if not specified)

        Returns:
            Dictionary with counts of updated, created, and failed assignments
lib_check_namingtool Check names against the company naming policy (naming.json in
Check names against the company naming policy (naming.json in
        EDA_AGENT_POLICY_DIR); without one nothing is enforced.

        Args:
            kind: footprint, symbol or component.
            names: The names to check; or library_path to take them from a
                .PcbLib (footprints) or .SchLib (symbols).
            library_path: The library to take names from.

        Returns:
            ``checked``, ``off_policy`` ({name, why}) and the ``pattern``.
lib_check_pcblibtool Check a PCB library's footprints, as Altium's Component Rule Check.Filesoutside text
Check a PCB library's footprints, as Altium's Component Rule Check.

        The same checks, run here without the dialog: duplicate_pads (one pad name used
        twice), duplicate_primitives (the same object drawn twice on one
        layer), missing_pad_names, mirrored_component (primitives on the
        bottom side only), offset_reference (the origin outside the
        footprint), shorted_copper (pads of different names joined by
        copper), unconnected_copper (copper touching no pad) and
        duplicate_footprints (two footprints with one name). Copper
        touches when Altium measures no gap between two pieces on a
        shared layer; a through-hole pad or via is on every copper layer.
        Each footprint is shown in turn to measure it, and the one shown
        before is shown again at the end. Nothing is changed.

        Args:
            library_path: The .PcbLib. Defaults to the focused library.
            checks: Only these, from the names above. ``None`` runs all.
            footprint_name: Only this footprint.

        Returns:
            ``footprints_checked``, ``footprints_with_problems`` and
            ``footprints`` [{footprint, pieces, problems [{check,
            detail}]}]; positions in a detail are mil from the
            footprint's origin. ``basic_3d_models`` names the footprints
            whose 3D model is only extruded, cylinder or sphere bodies
            when the Config tab does not allow basic 3D models: tell the
            user and ask before replacing any.
lib_check_schlibtool Run Altium's own component rule check on a schematic library.Filesoutside text
Run Altium's own component rule check on a schematic library.

        Checks every symbol for duplicate pins, duplicate parts, missing
        pin numbers, names, designator, footprint or description, and
        gaps in the pin numbering. No report window opens; Altium writes
        its report as <library>.ERR beside the library, and that is
        read back.

        Args:
            library_path: The .SchLib. Defaults to the focused library.
            checks: Only these: duplicate_pins, duplicate_component,
                missing_pin_number, missing_default_designator,
                missing_footprint, missing_description, missing_pin_name,
                missing_pins_in_sequence. ``None`` runs all.

        Returns:
            ``ran``, ``report`` (the .ERR file Altium wrote beside the
            library, None when it wrote none), ``symbols_with_problems``
            and ``problems`` (``symbol`` and the ``problems`` Altium
            named, such as "No Footprint").
lib_clear_source_librarytool Unpin a SchLib's symbols from their source-library provenance.
Unpin a SchLib's symbols from their source-library provenance.

        Symbols copied from another library keep pointing at it, and
        placements land in <Not Found>. This clears SourceLibraryName,
        sets TargetFileName to '*' and DesignItemId to LibReference.
        Save with app_save_all.

        Args:
            library_path: absolute .SchLib path; empty = focused library.
            component_names: restrict to these LibReferences; None/empty
                = every component in the library.
            clear_target_file_name: reset TargetFileName to '*'.
            sync_design_item_id: set DesignItemId = LibReference where
                they differ.

        Returns:
            {"library_path": ..., "total": inspected,
             "cleared_source_library": n, "cleared_target_file_name": n,
             "synced_design_item_id": n}.
lib_compare_footprintstool What differs between two footprints, pad by pad and layer by layer.
What differs between two footprints, pad by pad and layer by layer.

        Both read live, from one library or two (a vendor's footprint
        against yours, an old revision against the new). Pads are matched
        by number: position, size, shape, corner radius, rotation, hole,
        plating, paste and mask expansion are compared. Silkscreen,
        assembly, courtyard and the other layers are compared by count and
        extent. ``same`` is true only when nothing differs over the
        tolerance.

        Args:
            footprint_a / footprint_b: footprint names.
            library_a / library_b: their .PcbLib files; empty = focused
                library (library_b defaults to library_a).
            tolerance_mm: smallest difference reported.
            courtyard_layer / assembly_layer: layer names to use when the
                layer kinds do not say.
lib_convert_designators_to_stroketool Convert every TrueType ``.Designator`` in a PcbLib to a stroke font.
Convert every TrueType ``.Designator`` in a PcbLib to a stroke font.

        A TrueType designator's position reverts on reload, so it cannot be
        centred. This clears ``UseTTFonts``, ``Bold`` and ``Italic``, reads
        back, saves and reloads; ``lib_fix_designators`` can then centre
        them.

        Returns ``{library_path, designators, converted, names, saved}``.
lib_copy_componenttool Copy a component WITHIN or BETWEEN schematic libraries.
Copy a component WITHIN or BETWEEN schematic libraries.

        Copies pins, graphics and parameters. The destination ends
        focused with the copy selected; save with ``app_save_all``.

        Args:
            source_name: lib_ref of the component to copy.
            new_name: lib_ref for the clone. Defaults to ``source_name``
                (natural choice for cross-library copies that should
                keep their identity).
            source_library: .SchLib path to read from. Defaults to the
                currently focused document.
            dest_library: .SchLib path to write to. Omit (or pass the
                same path as ``source_library``) for a same-library
                duplicate.
            overwrite: When True, a component already named ``new_name``
                in the destination is removed first. Default False
                returns ``NAME_EXISTS`` and changes nothing.

        Returns:
            Dictionary with ``success``, ``source``, ``new_name``,
            ``source_library``, ``dest_library``, ``same_library`` and
            ``overwrote`` flags. ``source_holder`` true: the source held
            one symbol, so a temporary one was shown and removed; the
            source library is left modified, not saved.
lib_copy_footprinttool Copy one footprint (all pads/primitives) into a PcbLib, optionally renaming.
Copy one footprint (all pads/primitives) into a PcbLib, optionally renaming.

        A same-library copy needs a different new_name; an existing
        new_name in dest is refused unless overwrite. A library that is
        not open is opened as a document, so the copy can be saved; the
        copy is read back before success.

        Args:
            source_name: the footprint to copy.
            new_name: name for the copy (default source_name).
            source_library: source .PcbLib path (default the focused lib).
            dest_library: destination .PcbLib path (default source).
            overwrite: replace a same-named footprint already in dest.

        Returns:
            {"success": true, "source": "...", "new_name": "...",
             "same_library": bool}.
lib_count_layer_objectstool Count what is on each layer across every footprint of a PCB library.
Count what is on each layer across every footprint of a PCB library.

        Read only. Answers "is this layer empty in every footprint?" before a
        layer is disabled or a layer scheme is tidied, and names the
        footprints that use each layer, so a layer that is not empty says
        where to look. Covers tracks, arcs, text, regions, fills, 3D bodies,
        pads, vias, polygons, dimensions and coordinate markers. Mechanical
        layers past 16 are named by number (``Mechanical17``...).

        Args:
            library_path: Full path to the open .PcbLib; it must be the
                focused library, or the call refuses. Empty: the focused
                library.

        Returns:
            Dictionary with ``layers`` (``{layer, count, footprints}`` for
            each layer that holds anything), ``footprints`` and ``objects``
lib_create_3d_modeltool Build a STEP model from the datasheet drawing and link it to aFilesoutside text
Build a STEP model from the datasheet drawing and link it to a
        footprint in the open .PcbLib (brought forward itself).

        For a part no package family covers: read each feature off the
        mechanical drawing as a primitive. lib_create_footprint_from_package
        models the standard families. Written with CadQuery (FreeCAD when
        EDA_AGENT_STEP_WRITER is "freecad", plain shapes only).

        Terminals come from the footprint: ``terminals`` puts one on every
        land. A flat terminal box covering lands of two names is refused.

        Args:
            footprint_name: the footprint to link the model to.
            solids: primitives in mm, footprint origin, Z up from the
                board; each has ``kind`` and ``role`` (a colour, or
                ``cut``). box ``x0 y0 z0 x1 y1 z1``; extrude ``outline``
                [[x, y]...] ``z0 z1``; both take ``corner_r``, ``edge_r``
                (top edges), ``taper`` (deg); cylinder ``r cx cy z0 z1``
                (``axis`` "x": ``cy cz x0 x1``); sphere ``cx cy cz r``
                (``clip_z0 clip_z1``); prism ``profile`` [[u, z]...] over
                ``y0 y1`` (``axis`` "x": ``x0 x1``); text ``text size cx
                cy z1`` (``angle bold``), dot ``cx cy r z1``: marks cut
                flush into the top face at z1, inside its edges; instance
                ``group rot dx dy dz``. A cut is taken from what it
                overlaps, or from the ``cut_from`` names (``name``).
                Roles: body metal ceramic ceramic_ivory ball white lens
                gold pin1 nickel seal_ring silicon backside_coat
                substrate pcb_green tin lcp_white; marks ink, laser.
            source: the drawing (document, revision, page or figure).
                Required: a model is not built from guesses.
            output_dir: folder for the .step; empty: ``3D`` beside the
                library.
            replace_existing: remove the footprint's 3D bodies first.
            terminals: ``{"kind": "plate", "height"}`` shaped as each land
                (``chamfered`` {land: {size, corners}}), or ``{"kind":
                "ball", "height": A1, "diameter"}``, seated from the
                board to the package underside.
            groups: name -> solids that instance solids place.
            review: write a PNG from above and below.
            drawing: the outline drawing's totals in mm, a number or
                [min, max]: ``body_x``, ``body_y``, ``height`` (max only:
                [0, max]), ``span_x`` / ``span_y`` where printed. The
                model is refused when its extents differ.

        Returns:
            ``ok``, ``path``, ``writer``, ``height_mm``, ``drawing_dims``,
            ``linked``, ``replaced_bodies``, ``terminals``, ``review``, or
            ``ok: false`` with ``problems`` or ``reason``.
lib_create_footprinttool Create a new PCB footprint in the active library.
Create a new PCB footprint in the active library.

        A name the library already has (ignoring case) is refused with
        NAME_EXISTS.

        Args:
            name: Footprint name
            description: Footprint description

        Returns:
            Dictionary with created footprint information
lib_create_footprint_from_packagetool Create a COMPLETE footprint in the open PcbLib (brought forward,ProcessesFilesoutside text
Create a COMPLETE footprint in the open PcbLib (brought forward,
        shown in 2D) from a package drawing.

        Give the package as the datasheet draws it: lands are the
        manufacturer's recommended pattern where given (not the package's
        own pads), else IPC-7351B. Writes pads, paste, silk with a pin 1
        dot, assembly outline, .Designator, courtyard and height (origin
        the centroid, mm); pads read back.

        Dimensions min/nom/max, cited in ``source``; nominal-only warns.

        Args:
            package: the PackageSpec as an object (or its JSON text):
                ``family`` (chip, melf, molded, sod, sot23, sot89, sot223,
                dpak, soic, son, qfn, qfp, plcc, bga, lga, crystal2,
                crystal4, dip, header, radial, axial, to220, to92,
                connector, custom) and the dimensions it needs, each a
                number, ``[min, max]``, ``[min, nom, max]`` or
                ``{min, nom, max, cite}``; axes and field names: the
                library-part recipe (tool_guide). ``source``: {document, revision, page,
                ref, url, path}; with path (the PDF), a page without
                its land pattern is refused. bga/lga ``options``: letters "y"|"x", a1
                "top_left"|..., as the ball map's top view; bga/lga
                ``pins``: the printed ball count (required); bga
                ``depopulated``: ball names left empty; ``vendor``
                {land_diameter} builds the datasheet's land. ``custom_pads``
                (number, may repeat; x, y, width, height, shape "circle"
                for balls) need ``drawing_numbers``, every number printed
                on the land drawing, and ``drawing_dims`` placing each:
                {from, to, mm, axis, between centres|outer|gap, or
                from_edge/to_edge centre|near|far}, {pad, mm, axis} (a
                land's size); ORIGIN is the centre lines; ``outline``
                [[x, y], ...] for a land that is not a rectangle; and
                ``compared``, the id footprint_compare_drawing returns
                once the lands are set beside the figure.
            name: default the package's, else generated.
            density: L, N or M (default the package's, else N).
            description: Appended to the generated description.
            assembly_layer, courtyard_layer: Mechanical layers; empty
                picks them by kind or name, else it refuses and lists them.
            drafting: Overrides ({"silk_width": 0.15}).
            set_height: Write the height (A max).
            model_3d: "auto" (default): a STEP model from the same
                drawing, linked, else an extruded body (``notes`` says
                why). "step", "extruded" or "none".
            library_path: the .PcbLib; empty: the focused one, else the
                only one open.

        Returns:
            {ok, footprint, library_path, created, layers, readback, pads
            (a summary past 64), courtyard_mm, warnings, notes, ipc, steps}. ``ok`` only when
            every step succeeded and the readback matched; a later
            failure leaves the footprint created but incomplete.
lib_create_ic_symboltool Create a complete IC symbol (body plus every pin) in one call.Filesoutside text
Create a complete IC symbol (body plus every pin) in one call.
        It brings the open SchLib forward itself and fits the new symbol.

        Amplifiers get the standard triangle: with ``body="auto"`` it is
        chosen when the pin names form IN+/IN-/OUT units (+INA/-INA/OUTA
        and IN1+/IN1-/OUT1 count), and a dual or quad becomes one
        triangle per part plus a power part. Copying a standard part
        from the user's library with lib_copy_component is an
        alternative.

        Otherwise a rectangle: you group the pins (inputs, power and
        control LEFT; outputs and status RIGHT, discipline rule 18) and
        this lays them on grid with the top-left pin's wire end at the
        origin (rule 14).

        Args:
            name: Component name.
            left_pins: Pins on the LEFT side, top-to-bottom. Each a dict
                with `designator`, `name`, and optional `electrical_type`
                (input/output/power/passive/...); null for an empty row,
                which spaces one pin group from the next.
            right_pins: Pins on the RIGHT side, top-to-bottom, same shape.
                For an amplifier the sides are ignored: the triangle puts
                every pin where the convention does.
            designator_prefix: e.g. "U".
            description: Component description.
            body: "auto" (triangle for amplifiers, else rectangle),
                "amplifier" or "rectangle".
            invert_on_top: triangle only; put IN- above IN+.
            datasheet: ``{path, page}`` of the pin table. Every pin's
                number and name must be printed together in it, or the
                symbol is not built; pins named only by number skip it.
                A table with a pin-number column per package also takes
                ``package_column``, the package as the table heads its
                column ("LQFP48"): only that column's numbers are read.

        Returns:
            Dict with the symbol name, pin count, ``body`` drawn, body
            extent, ``pin_table``, and the per-step bridge results.
lib_create_passive_symboltool Create a standard DISCRETE symbol (the conventional glyph) in ONE call.
Create a standard DISCRETE symbol (the conventional glyph) in ONE call.
        It brings the open SchLib forward itself and fits the new symbol.

        Use this, not a rectangle, for any discrete part. Draws resistor,
        capacitor, polarized_capacitor, inductor (arcs), diode, led,
        crystal, fuse, zener, schottky, tvs, tvs_bidirectional, switch,
        push_button, and the three-pin nmos, pmos, npn and pnp. Two-pin
        parts have pin 1 on the left and pin 2 on the right; a transistor
        has its gate/base on the left and the other two leaving the top
        and bottom. Pins stay on the 100-mil grid.

        Args:
            name: Component name (e.g. "R_0402").
            kind: one of the kinds above (aliases such as r/c/cp/l/d/xtal/
                f/z/sd/tvs_bi/sw/button/nfet/pfet/bjt_npn are accepted).
            designator_prefix: default by kind (R/C/L/D/Y/F/S/Q) if omitted.
            description: Component description.
            pin_map: transistors only, role -> pin number, e.g.
                {"G": "1", "S": "2", "D": "3"}. Defaults are the common
                SOT-23 assignment (MOSFET 1=G 2=S 3=D, BJT 1=B 2=E 3=C);
                check the datasheet.

        Returns:
            Dict with the symbol name and per-step bridge results.
lib_create_standard_footprinttool Create a COMPLETE standard footprint in ONE call from the land
Create a COMPLETE standard footprint in ONE call from the land
        dimensions you give (pads, silk outline, courtyard). For a package
        drawing with tolerances prefer lib_create_footprint_from_package,
        which sizes lands by IPC-7351B.

        Args:
            name: Footprint name (e.g. "SOIC-8_3.9x4.9").
            family: "chip" | "sip" | "dual" (SOIC/SOP/SON/SOT/DIP; SOT-23
                is dual with 3 pins) | "header" (2-row, odd/even) | "tab"
                (SOT-223, DPAK, TO-220; give tab_w, tab_h) | "quad"
                (QFP/QFN) | "bga" (give rows, cols). hole > 0 makes any
                family through-hole.
            pin_count: Total pads (2 chip, even header, signal pins for
                tab, multiple of 4 quad; ignored for bga).
            rows, cols: BGA grid.
            exposed_pad: QFN/QFP centre pad size, mils (0 = none); it is
                pin_count+1.
            tab_w, tab_h: Tab pad size, mils; it is pin_count+1.
            skip: BGA balls to leave out, e.g. ["A1"].
            pitch: Pad pitch within a row, mils.
            pad_w, pad_h: Pad size, mils. pad_w is the X size (across the
                row for chip and dual, along it for sip, header and tab);
                for quad it runs along each row.
            row_span: Centre-to-centre between rows (dual, quad), mils.
            shape: Pad shape (default "roundrect", corner_radius in %).
            silk: Draw the body outline on TopOverlay, cut clear of the
                pads, with a pin 1 mark where the part needs one.
            courtyard: Courtyard margin past pads, body and silk, mils
                (0 = none).
            courtyard_layer: Its layer; empty takes the library's
                Courtyard Top layer, else Mechanical1.
            body_w, body_h: Body size for the silk (default pad extent).
            hole: Drill, mils; > 0 gives through-hole pads, pin 1 square.
            description: Footprint description.

        Returns:
            Footprint name, pad and track counts, extent, step results.
lib_create_symboltool Create a new schematic symbol in the open symbol library.
Create a new schematic symbol in the open symbol library.

        It becomes the symbol lib_add_pins and lib_add_symbol_* write into,
        so add its pins before creating the next one. ``verified`` in the
        reply means the symbol exists, not that it has pins.

        Args:
            name: Component name
            designator_prefix: Default designator prefix (e.g., "U", "R", "C")
            description: Component description
            part_count: For multi-part components (quad op-amp, dual gate,
                etc), the number of sub-parts. Pins added via lib_add_pins
                with ``owner_part_id`` set to 1..part_count are assigned
                to that sub-part; ``owner_part_id=0`` shares the pin
                across all sub-parts (the usual power-pin pattern on a
                quad op-amp).

        Returns:
            Dictionary with created symbol information
lib_create_symbol_in_partstool Create a multi-part IC symbol, each part with its own body, in ONE call.Filesoutside text
Create a multi-part IC symbol, each part with its own body, in ONE call.
        It brings the open SchLib forward itself and fits the new symbol.

        A quad op-amp as four parts and a power part, an MCU as its ports,
        a relay as coil and contacts. Each part is laid out as
        lib_create_ic_symbol lays out one (pins left and right, origin at
        the top-left pin's wire end, 100-mil grid), gets its own body
        rectangle and its own pins. Put supply pins on a part of their
        own, or in ``shared_pins``.

        Args:
            name: Component name in the active SchLib.
            parts: In order, each ``{"left_pins": [...], "right_pins":
                [...]}`` with pin dicts as lib_create_ic_symbol takes
                (``designator``, ``name``, ``electrical_type``, ``hidden``);
                ``None`` in a list leaves a gap row between pin groups.
            designator_prefix: e.g. "U".
            description: Component description.
            pin_length, pin_pitch: mils, multiples of 100.
            shared_pins: ``{"left_pins": [...], "right_pins": [...]}`` on
                Part Zero, which Altium draws on every part: the supply
                pins of a quad op-amp. They sit below every part's own
                pins, at the same place on each, and every body is made
                as wide and tall as needed to hold them.
            datasheet: ``{path, page}`` of the pin table, checked as
                lib_create_ic_symbol checks it (``package_column`` too).

        Returns:
            ``symbol``, ``part_count``, ``parts`` (pins and body per part),
            ``shared`` (Part Zero pins), and the Altium replies; ``ok``
            false with ``stage`` when a step did not take.
lib_dblib_get_recordtool Every column of one row of a database library table.
Every column of one row of a database library table.

        The row is found by its key, the value in the table's key column
        (``key`` in a ``lib_dblib_search`` result; the column is
        ``key_field`` in ``lib_dblib_info``). The key is passed to the
        database as a parameter, never as SQL text. ``lookup`` says how
        the row was found: ``parameter`` when the database matched it,
        ``scan`` when the parameterised query could not run and the
        table was read and compared instead.

        Args:
            library_path: Full path of the .DbLib file.
            table: A table the DbLib declares.
            key: The row's key value.
            key_field: Optional column to match instead of the DbLib's
                own key column; it must be a column of the table.

        Returns:
            {"library_path", "table", "key", "key_field",
            "key_field_source", "lookup", "found", "match_count",
            "rows_scanned", "scan_capped", "symbol_ref", "symbol_library",
            "footprints": [{"ref", "library"}], "description",
            "fields": {column: value}}. ``found`` False is an answer, not
            an error: the key is not in that table. ``match_count`` above
            1 means the key is not unique and the first row is shown.
lib_dblib_infotool What a database library (.DbLib) declares, and how it connects.
What a database library (.DbLib) declares, and how it connects.

        Call it first on an unfamiliar DbLib: per table it names the key
        column and the symbol and footprint columns that
        ``lib_dblib_get_record`` and ``sch_place_dblib_component`` take.
        The password is never returned (``redacted``, ``has_password``).
        ``key_field_source`` says how the key was found; ``first_column``
        is a guess. Altium answers for the library; the file is not
        opened. A library that is not installed is installed for the read
        and uninstalled after it.

        Args:
            library_path: Full path of the .DbLib (or .SVNDbLib);
                lib_get_installed_libraries lists installed ones.
            with_fields: Connect read-only to list each table's columns
                (default True). False asks Altium only.

        Returns:
            {"library_path", "connection": {"provider", "kind" (access /
            excel / sql_server / odbc / oracle / other), "data_source",
            "has_password", "redacted", "read_only"}, "left_quote",
            "right_quote", "search_path", "table_count", "tables": [{"name",
            "enabled", "schema", "key_field", "key_field_source",
            "key_field_found", "symbol_ref_field", "symbol_library_field",
            "description_field", "footprint_fields": [{"ref_field",
            "library_field"}], "fields" (null when not read), "field_count",
            "error", "settings"}], "fields_included",
            "connected" (null when no connection was attempted)}.
lib_dblib_searchtool Search database libraries (.DbLib) for components, read-only.
Search database libraries (.DbLib) for components, read-only.

        Case-insensitive substring match over every row of every enabled
        table (lib_search folds these in already; this narrows to a table
        or columns). The query never reaches the database as SQL: rows
        are read and matched inside Altium, bounded by ``max_rows``
        (``scan_capped`` says the bound was hit).

        Args:
            query: Text to find (case-insensitive substring).
            library_path: One .DbLib to search. Omitted, every installed
                database library is searched.
            table: One table the DbLib declares (as lib_dblib_info names
                it). Omitted, every enabled table.
            fields: Column names to match. Omitted, every column. A name
                a table lacks is reported under ``unknown_fields``.
            limit: Cap on returned rows (1 to 1000, default 50).
            max_rows: Cap on rows read in total (default 20000).

        Returns:
            "query", "count", "limit", "truncated", "rows_scanned",
            "scan_capped", "libraries" (per library: searched, an error
            code, tables searched and failed, unknown_fields), and
            "results" (library_path, table, key, key_field, symbol_ref,
            symbol_library, footprints, description, matched_field,
            matched_value). No connection string is ever returned.
lib_delete_componenttool Delete one symbol from a schematic library (.SchLib).
Delete one symbol from a schematic library (.SchLib).

        Removes one named component; save with app_save_all. An unknown
        name is COMPONENT_NOT_FOUND.

        Args:
            component_name: the component's LibReference (its library name).
            library_path: optional absolute .SchLib path to target; defaults
                to the currently focused library document.
            component_index: alternative to component_name; the integer
                `index` from lib_get_components. Use it to delete a part
                whose name carries unreproducible bytes (embedded quote or
                control char). Provide exactly one of the two.

        Returns:
            {"success": true, "library_path": "...", "deleted": "..."}.
lib_delete_footprinttool Delete one footprint from a PCB library (.PcbLib).
Delete one footprint from a PCB library (.PcbLib).

        Marks the library changed; does NOT write to disk: save with
        `app_save_all`. An unknown name is FOOTPRINT_NOT_FOUND.

        Args:
            footprint_name: the footprint's name in the library.
            library_path: optional absolute .PcbLib path to target; defaults
                to the currently focused library document.

        Returns:
            {"success": true, "library_path": "...", "deleted": "..."}.
lib_delete_footprint_primitivestool Delete primitives inside ONE footprint of a PCB library.
Delete primitives inside ONE footprint of a PCB library.

        The library-scoped delete: ``obj_delete`` and ``pcb_delete_object``
        act on a BOARD, and aimed at a library can delete from another
        open PcbDoc. The library, footprint
        and type or layer must all match. Pads are kept unless
        ``include_pads``. A footprint on screen is edited with another
        made current, then shown again (``was_current``).

        Args:
            footprint_name: The footprint to edit. Required.
            object_type: e.g. "track", "arc", "text", "region", "fill".
                Give this or ``layer``.
            layer: One layer, e.g. "TopOverlay" or a stack name such as
                "Top Assembly"; an unknown name is refused.
            library_path: The .PcbLib; default the focused document.
            include_pads: Allow pads to be removed.
            confirm: Required True; check first with
                ``lib_get_footprint_primitives`` or
                ``lib_count_layer_objects``. In a library of one
                footprint a temporary ``EDA_AGENT_HOLD`` footprint is
                made current for the delete and removed again.
            identifier: 3D bodies whose Identifier starts with this (one
                prefix takes every suffix a tool wrote); implies
                object_type "body". Bodies built by a tool can be taken
                away without the footprint's own STEP model, which sits
                on the same layer.
            pad_name: The pads with this designator (every one of them;
                ``layer`` narrows to one side); implies object_type "pad"
                and include_pads.

        Returns:
            ``library``, ``footprint``, ``matched``, ``removed``,
            ``leftover`` (matching primitives still there after the
            delete, counted again), ``hint`` (why, when something matched
            and stayed or nothing matched), ``examined``, ``layers``,
            ``pads_included``, ``was_current``.
lib_diff_librariestool Compare two schematic libraries and report differences.
Compare two schematic libraries and report differences.

        Returns which components are only in library A, only in B, or shared.

        Args:
            library_a: Full path to the first SchLib file
            library_b: Full path to the second SchLib file

        Returns:
            Dictionary with only_in_a, only_in_b, common arrays,
            and count_a, count_b, only_a, only_b, shared counts
lib_easyeda_searchtool Search LCSC / EasyEDA for parts by MPN or description.
Search LCSC / EasyEDA for parts by MPN or description.

        EXPECT THIS TO FAIL: the service's search routes do not answer.
        Search LCSC in a browser and import by id instead
        (lib_easyeda_import(lcsc_id="C1234", ...)). EASYEDA_API_BASE
        overrides the endpoint.

        Args:
            query: MPN, keyword, or description fragment.
            limit: max candidates (default 20).

        Returns:
            {"ok": true, "count": N, "results": [{lcsc_id, mpn,
             manufacturer, package, description}]}.
lib_export_kicad_footprinttool Export a PcbLib footprint to a KiCad ``.kicad_mod`` file.Files
Export a PcbLib footprint to a KiCad ``.kicad_mod`` file.

        A KiCad 6+ footprint of the pads (number, position, size, shape,
        drill, layer set), in mm with the y axis flipped.

        Args:
            footprint_name: Footprint to export. If empty, exports the
                library's current footprint.
            output_path: Destination .kicad_mod file. Defaults to
                workspace/<name>.kicad_mod.

        Returns:
            {"output_path", "footprint", "pad_count"} or an error.
lib_export_kicad_symboltool Export a SchLib symbol to a KiCad .kicad_sym file.Files
Export a SchLib symbol to a KiCad .kicad_sym file.

        A KiCad 6+ symbol: a body rectangle round the pins and every pin
        with number, name, type and position, in mm. Naming a component
        leaves it current in the library (``current_component``), so a
        later call without a name, such as ``lib_add_pins``, acts on it.

        Args:
            component_name: LibRef to export. If empty, exports whatever
                component is currently selected in the SchLib.
            output_path: Destination .kicad_sym file. Defaults to
                workspace/<name>.kicad_sym.
            reference: Reference designator prefix for the symbol (default
                "U").

        Returns:
            {"output_path", "symbol", "pin_count"} or an error.
lib_extract_embedded_modelstool Get back the ORIGINAL 3D model files (STEP) embedded in a .PcbLib.Filesoutside text
Get back the ORIGINAL 3D model files (STEP) embedded in a .PcbLib.

        Byte for byte, as Altium exports them: each footprint is exported
        by Altium (its own JSON export, unsaved edits included) and the
        model files it carries are written out. The library is not saved.

        With ``footprint_name``, that footprint's models; with
        ``model_names``, only those; otherwise every footprint's.

        Args:
            library_path: The .PcbLib.
            footprint_name: Extract only this footprint's models.
            model_names: Model file names, e.g. ["NE555DR.stp"].
            out_dir: Folder to write to (default: the workspace's
                models/<library name>).
            overwrite: Replace files already there.

        Returns:
            ``written`` [{name, footprint, path, bytes, sha256, checksum,
            step_header, rotation_deg}], ``refused`` [{name, reason}],
            ``not_found`` (asked for, used by no footprint exported).
lib_extract_intlibtool Extract .SchLib + .PcbLib sources from an .IntLib.
Extract .SchLib + .PcbLib sources from an .IntLib.

        Writes the sources into a folder beside the IntLib named after it,
        without opening the IntLib (no "Open Integrated Library" prompt).
        Pass the reported paths as ``library_path`` to the other library
        tools.

        Args:
            intlib_path: Absolute path to the .IntLib file.

        Returns:
            Dict with ``intlib_path``, ``extract_dir``, ``sch_lib_path``,
            ``sch_lib_found``, ``pcb_lib_path``, ``pcb_lib_found``, and
            ``sch_libs`` / ``pcb_libs`` listing every source extracted
            (their names come from inside the IntLib). A ``_found`` flag
            of False means that source did not appear.
lib_find_vault_componentstool Find the Design Item ID of a managed part by its exact name.
Find the Design Item ID of a managed part by its exact name.

        Looks through the managed (Workspace) parts already placed on the
        sheets Altium has open, and matches ``name`` exactly, case
        ignored, against each part's comment, library reference and
        Design Item ID. Every match comes back, one per Design Item ID,
        with the lifecycle state the library manager reports, so two
        parts sharing a name are both shown rather than the first one
        being picked.

        It does not search the whole Workspace: a part not yet used in
        the design has to be looked up in Altium's Components panel.

        Args:
            name: The comment, library reference or Design Item ID.

        Returns:
            ``name``, ``count``, ``sheets_searched`` and ``matches``, each
            with design_item_id, comment, lib_reference, vault,
            lib_identifier_kind, revision_guid, lifecycle_state and sheet.
lib_fix_designatorstool Bring every footprint's ``.Designator`` onto the library's OWNFilesoutside text
Bring every footprint's ``.Designator`` onto the library's OWN
        convention: the layer, height and centring the majority already use.

        The conventions are inferred from this library (see
        ``lib_audit_footprint_policies``); ``policy`` overrides them.
        "Centred" means on the average pad centre. A dry run by default.
        Applying repeats apply, save, reload until nothing is left; a few
        designators may not persist and come back in ``unrepairable``
        with ``converged: false``. ``applied`` counts only writes
        confirmed by read-back.

        Args:
            library_path: .PcbLib to fix; defaults to the focused library.
            dry_run: report the plan without writing (default True).
            fix_layer: move designators that are not on the convention
                layer onto it.
            fix_center: re-centre designators beyond the library's tolerance.
            fix_height: also normalise text height to the library norm.
            add_missing: create a ``.Designator`` on footprints that lack one.
            policy: explicit conventions, e.g.
                ``{"designator_center_tol": 50, "designator_height": 20}``.

        Returns ``{library_path, dry_run, conventions, planned, applied,
        created, passes, converged, failed, skipped, actions}``.
lib_get_component_detailstool Everything about one library symbol in one call: metadata, pins,
Everything about one library symbol in one call: metadata, pins,
        parameters, models, and the style (font_id, color, is_hidden, x,
        y, orientation, justification) of its designator, comment and
        parameters. obj_get_font_spec expands a font_id. Naming
        library_path opens (focuses) that library; nothing is saved.

        DATASHEET DISCIPLINE: pins, parameters and MPN here are hints;
        fetch the datasheet and cite it before stating a pin or rating.

        Args:
            component_name: LibRef in the .SchLib.
            library_path: .SchLib path (default: the focused library).
            component_index: ``index`` from lib_get_components, for a name
                with characters you cannot reproduce. Give exactly one of
                name or index.

        Returns:
            name, library_path, description, alias_name, part_count (the
            file reader's), part_count_live (the open symbol's),
            parts_with_pins (highest part that has pins) and a
            part_count_note when they disagree, pin_count;
            ``designator`` and ``comment`` (text plus style);
            ``pins`` [{designator, name, electrical_type, x, y,
            orientation, hidden, label_hidden}]; ``parameters`` (name ->
            value); ``parameter_styles``; ``models`` [{model_name,
            model_type, is_current, datafile_links}];
            ``_datasheet_guidance``.
lib_get_componentstool List the components in a library: name, alias_name, part_count,
List the components in a library: name, alias_name, part_count,
        description, fast. ``part_count`` here can read one high; use
        lib_get_component_details when it matters.

        Args:
            library_path: Library path (default: the active library).
            with_parameters: Add each component's parameters (slow on
                large libraries; for one symbol use
                lib_get_component_details).
            with_designator: Add each default designator ("U?"); also
                loads every symbol, so slow on large libraries.
            exact_part_counts: Count each symbol's parts in the open
                library (opening it if needed) instead of the file
                reader's count, which can be one high. Rows then carry
                ``part_count_checked``.

        Returns:
            ``count`` and ``components`` [{index, name, alias_name,
            part_count, description, parameters?, designator?}]. Pass
            ``index`` as component_index to the details, delete and
            rename tools when a name has characters you cannot type.
            The list is the SAVED file. When the library is open, two more
            keys compare it with the symbols in memory:
            ``unsaved_symbols`` (in the open library, not yet in the file,
            for example renamed or new) and
            ``saved_names_not_in_open_library`` (in the file, gone from the
            open library). Name a symbol as the open library has it.
lib_get_footprint_primitivestool Every non-pad primitive of one PcbLib footprint, with where it is.
Every non-pad primitive of one PcbLib footprint, with where it is.

        Tracks, arcs, regions, fills, texts and vias, each with its layer
        (the name the library's stack gives it, plus ``layer_id``), in mm
        from the footprint's origin: the frame the ``lib_add_footprint_*``
        writers take. Pads are in ``lib_get_pad_geometry``. Read-only.

        Args:
            footprint_name: The footprint name in the library.
            library_path: Optional .PcbLib path; defaults to the focused
                library.
            kinds: Optional ``|`` list of what to read, from track, arc,
                region, fill, text, via and body (``"via|body"``); empty
                reads all. Each kind is its own filtered walk.

        Every primitive carries ``selected``. Each via also carries its
        mask (top, bottom, separate, ``mask_expansion_source`` manual or
        rule, ``mask_from_hole_edge``), tenting, the four testpoint flags
        (read only), ``stack_mode`` and its top / mid / bottom diameters;
        each body its outline box (x1, y1, x2, y2).

        Returns:
            {name, library_path, height_mm, editor_origin_x_mm /
            editor_origin_y_mm (the editor's origin marker in this
            footprint's frame; null unless the footprint is the current
            one, as only that one's marker can be read), current (whether
            it is), kinds, bodies (a count),
            body_layers (the layer of each body), body_models [{layer,
            identifier, has_model, model_file (the file the model was
            embedded from), model_type (Altium's T3DModelType; 1 for a
            STEP model), step_solids (solids in that file when it is
            still there, else null: a STEP model is ONE body whatever its
            detail, so read this, not ``bodies``), rotation,
            overall_height_mm, standoff_mm}], tracks
            [{layer, layer_id, x1, y1, x2, y2, width}], arcs [{layer,
            layer_id, xc, yc, r, start, end, width}], regions and fills
            [{layer, layer_id, x1, y1, x2, y2, area and arc_edges
            (regions)}], texts
            [{text, layer, layer_id, x, y, size, rotation, x1, y1, x2,
            y2}], vias [{x, y, diameter, hole}]}. Tracks, arcs, regions
            and fills also carry keepout, and keepout_for where the
            restrictions act (a keepout, or KeepOutLayer). A text's box
            is Altium's cached one and can lag an edit made this session.
lib_get_footprintstool Enumerate every footprint in a PcbLib.
Enumerate every footprint in a PcbLib.

        The PcbLib counterpart of ``lib_get_components``.

        Args:
            library_path: Optional .PcbLib path to focus first.
                Defaults to the focused document.

        Returns:
            Dict with ``library_path``, ``count``, ``footprints``
            (a list of ``{name, description}``) and ``current``: the
            name of the footprint the editor has current in that
            library, or "" when none is. Writers called without a
            footprint name, the library origin read and processes such
            as ``PCB:SetComponentReference`` act on that footprint.
lib_get_installed_librariestool List the libraries installed in the Altium environment.
List the libraries installed in the Altium environment.

        Reads the environment's own list (IntLib, SchLib, PcbLib,
        database and query libraries), open or not; `lib_search` sees
        only open SchLibs. Installed means switched on; the available
        total comes beside it, so a library present but switched off
        shows as a gap between the two numbers.

        Args:
            with_counts: True (default) also reports how many components
                each library holds. That opens every library to count
                them, so pass False for a fast listing; the count then
                comes back as -1, meaning not asked rather than empty.

        Returns:
            {"libraries": [{"library_path", "file_name", "library_type",
            "library_type_ordinal", "component_count"}], "installed_count",
            "available_count", "counts_included"}. ``library_type`` is one
            of integrated / source / datafile / database / none / query /
            design_items, or unknown; it reads "unknown" with an ordinal of
            -1 when a library is installed but missing from the available
            list, which is a real state and not an error.
lib_get_library_origintool Report where a PCB library's origin marker sits.
Report where a PCB library's origin marker sits.

        Read from the library's backing board, in that board's absolute
        mils. Footprint writers place from the footprint's own reference
        point instead: for the origin in that frame read
        ``editor_origin_*`` from ``lib_get_footprint_primitives`` (the
        current footprint only). The library must already be open and
        focused in Altium.

        Args:
            library_path: Full path to the open .PcbLib. It must be the
                focused library, or the call refuses.

        Returns:
            Dictionary with origin_x_mil, origin_y_mil and library_path
lib_get_pad_geometrytool Pad geometry of one PcbLib footprint as floats in mm, relative
Pad geometry of one PcbLib footprint as floats in mm, relative
        to the footprint origin (no integer-mil rounding, for datasheet
        tolerance checks).

        Args:
            footprint_name: the footprint name in the library.
            library_path: optional .PcbLib path; defaults to the
                focused library.
            compact: pads as ``[name, x_mm, y_mm]`` rows only (a
                thousand-ball BGA in a short reply).

        Returns:
            {name, description, library_path, pad_count, pads: [{
             name, id, x_mm, y_mm, copper_x_mm, copper_y_mm, w_mm, h_mm,
             shape, corner_pct, rotation, hole_rotation, hole_mm,
             hole_w_mm, hole_type, slot_aligned (slots only), plated,
             layer, selected, mode, paste_expansion_mm,
             paste_expansion_source, paste_expansion_state,
             mask_expansion_mm, mask_bottom_expansion_mm, mask_separate,
             mask_expansion_source, mask_expansion_state}]}.
            selected is whether the pad is selected in the editor (what
            lib_set_pad_properties selected=True acts on); mode is the
            stack mode, 0 simple, 1 top-middle-bottom, 2 full stack.
            id names the pad for lib_set_pad_properties (stable while the
            library is open). x/y is the pad origin, copper_x/y the copper centre (differs
            on a custom pad). hole_rotation is relative to the pad.
            mask_expansion_mm is the top side when mask_separate, else
            both; mask_bottom_expansion_mm is the stored bottom value.
            *_source is 'manual' (pad override) or 'rule' (value 0; the
            rule holds it); *_state is the cache's manual/valid/invalid.
lib_get_pin_listtool Get all pins of a library component.Files
Get all pins of a library component.

        Name the component: without ``component_name`` this reads the
        current symbol, the one ``lib_add_pins`` writes into (see there),
        which need not be the one on screen. Pin names and types in a
        symbol can be wrong; check them against the datasheet before
        relying on them. With ``items`` the symbols of one library are
        read 25 to a request.

        Args:
            component_name: library reference of the symbol to read.
                Empty reads the current symbol.
            output_path: write the full pin array here as JSON and
                return a summary instead.
            inline_limit: above this many pins the array goes to a file
                (``pins_path``); 0 always returns inline.
            library_path: the .SchLib to read; it is brought to the front
                (opened if need be) first, so a sheet in front does not
                stop the read. Empty reads the library in front.

        Returns:
            "count", "component", and "pins", each with designator,
            name, electrical_type, x, y, orientation, hidden,
            ``owner_part_id`` and ``display_mode`` (0 normal, 1+ an
            alternate mode, not a duplicate). Spilled: "pins_path" and
            "summary" instead of "pins". Plus `_datasheet_guidance`.
lib_get_supplier_linkstool A library symbol's manufacturer and supplier links.
A library symbol's manufacturer and supplier links.

        Read from the numbered parameters a file-based library keeps them
        in ("Manufacturer 1", "Manufacturer Part Number 1", "Supplier 1",
        "Supplier Part Number 1", ...). Changes nothing.

        Args:
            component_name: The symbol in the .SchLib.
            library_path: The .SchLib. Defaults to the focused library.

        Returns:
            ``links`` [{link, manufacturer, mpn, supplier,
            supplier_part_number}] (the fields it has) and the
            ``parameters`` they came from.
lib_get_vault_componenttool Check one managed (Workspace) component can be placed, without placing it.
Check one managed (Workspace) component can be placed, without placing it.

        Loads the item the way ``sch_place_vault_components`` would, reads
        its identity, and throws it away again; nothing reaches a sheet.
        The kind asked for is tried first, then the others. The library
        manager's lookups (library path, lifecycle state, revisions,
        placement parameters) are reported alongside. Give the Design
        Item ID, not a part number.

        Args:
            design_item_id: The component's Design Item ID.
            vault: The Workspace name. Usually left out; see
                ``lib_get_vault_name``.
            lib_identifier_kind: Altium's TLibIdentifierKind, tried first:
                0 Any, 1 NameNoType, 2 NameWithType, 3 FullPath, 4 VaultName
                (the default). A managed part Altium placed shows the kind
                and identifier that work, through ``obj_query`` on
                ``eSchComponent``.

        Returns:
            ``placeable``, ``loader_callable``, lib_identifier_kind (the
            kind that loaded, -1 if none), ``load_probe`` (``kind:result``
            for each try), the loaded ``loaded_design_item_id``,
            ``vault_guid``, ``item_guid`` and ``revision_guid``, then
            ``library_path``, ``display_path``, ``lifecycle_state``,
            ``has_revisions``, ``revisions``, ``placement_parameters``,
            ``note`` and ``diag`` (library manager calls that raised).
lib_get_vault_nametool The Workspace name the managed tools would use, read off the design.
The Workspace name the managed tools would use, read off the design.

        Altium writes the Workspace name onto every managed part it
        places. This reads it from the active sheet, then from the other
        sheets that are already open; it never opens one. A part addressed
        by kind 4 (VaultName) is preferred; ``other_kind`` says when only
        another kind was found.

        Returns:
            ``found``, ``vault``, ``other_kind`` and ``seen``, every
            ``kind:name`` met, separated by ``|``.
lib_inspect_cse_ziptool Identify the library members of a Component Search Engine zip.
Identify the library members of a Component Search Engine zip.

        Reads a SamacSys / Component Search Engine zip WITHOUT extracting:
        which member is the .SchLib, the .PcbLib and the STEP model, the
        MPN, and any member attempting path traversal (``suspicious``).
        Then stage the files with ``lib_extract_cse_zip``. Offline.

        Args:
            zip_path: Absolute path to the downloaded zip.

        Returns:
            ``{"ok": True, "mpn", "schlib", "pcblib", "step", "extras",
            "suspicious"}`` (member names; None when absent) or
            ``{"ok": False, "reason": "..."}`` when the file is missing,
            not a zip, or contains no .SchLib/.PcbLib.
lib_install_librarytool Register a library with the environment's Available Libraries.
Register a library with the environment's Available Libraries.

        An .IntLib / .SchLib / .PcbLib, so its parts resolve by name. A
        .PvLib goes into the PCB editor's pad/via libraries instead.

        Args:
            library_path: absolute path to the library file.

        Returns:
            {"installed": bool, "library_path": "..."}.
lib_ipc_batch_templatetool Altium's template for an IPC footprint batch table, the inputFilesEnv varsoutside text
Altium's template for an IPC footprint batch table, the input
        of lib_generate_ipc_batch.

        With no family it lists the families installed. With one (its
        code, e.g. "QFN", "QFP", "SOT23", or the start of the template's
        file name) it gives the template's path, the ``columns`` in order
        (row 2 of the table, the family code going in A1), the
        ``required`` package columns and the ``legend``: what each column
        measures, its format and whether it is required. Fill rows from
        the part's datasheet package drawing, in mm.

        Returns:
            ``folder`` and ``families``, or ``family``, ``file``,
            ``columns``, ``required`` and ``legend``.
lib_library_reporttool Write a library report: every symbol or footprint on one page.Files
Write a library report: every symbol or footprint on one page.

        One HTML page, read through Altium without its dialog: for a
        .SchLib each symbol's description, designator, parts, pins,
        models and parameters; for a .PcbLib each footprint's
        description and pads. One read per entry, so a large library
        takes a while.

        Args:
            library_path: The .SchLib or .PcbLib.
            out_path: The .html to write. Defaults to "<library> Library
                Report.html" beside the library.

        Returns:
            ``report`` (the file), ``kind``, ``entries`` and ``unread``
            (entries Altium gave nothing for, also named on the page).
lib_link_3d_modeltool Link a 3D STEP model to a footprint in the ACTIVE .PcbLib, as a
Link a 3D STEP model to a footprint in the ACTIVE .PcbLib, as a
        component body (drives the 3D view and height DRC).

        The footprint's existing 3D bodies are removed first
        (``replace_existing``, reported as ``replaced_bodies``).

        Args:
            component_name: Footprint name (empty: the current footprint).
            model_path: Existing .step/.stp file.
            offset_x: X offset in mils from the footprint's origin (the
                body is moved onto that origin first).
            offset_y: Y offset in mils.
            offset_z: Standoff height in mils (lifts the body).
            rotation_x, rotation_y, rotation_z: degrees, set on the
                model before it is bound to the body. It cannot be read back, so
                ``applied.rotation`` says it was written, not checked.
            replace_existing: remove the footprint's 3D bodies before
                linking (default True); False adds this one beside them,
                for a part built from several models.

        Returns:
            ``success``, ``footprint``, ``model``,
            ``footprint_origin_mils``, ``moved_to_footprint_origin``
            (false: the body may sit away from the footprint) and
            ``applied`` {standoff_height, rotation, offset_xy}; false
            means not written, including a zero left at its default.
lib_link_footprinttool Link a footprint to a schematic component in the open SchLibFilesoutside text
Link a footprint to a schematic component in the open SchLib
        (brought forward itself).

        With replace=True (default) existing footprint models are removed
        first; False adds another.

        The symbol's pin numbers are compared with the footprint's pad
        names first (its .PcbLib must be open): a pin with no pad or a
        named plated pad with no pin refuses the link. Unnamed pads and
        unplated holes are left out.

        Args:
            component_name: Name of the schematic component, made current
                first. Empty uses the current component.
            footprint_name: Name of the footprint to link
            footprint_library: Not applied: the footprint is bound by
                name, so install its library and keep names unambiguous.
            replace: remove existing footprint models before adding (default True)

        Returns:
            {success, footprint, replaced, footprints, pin_pad_parity}:
            ``footprints`` is read back from the component. Altium's Models pane is
            not redrawn after a scripted link and can show the previous
            part; this list is the link as stored.
lib_make_nametool Build a name from the naming policy's template for a kind and check
Build a name from the naming policy's template for a kind and check
        it against the policy's pattern.

        Args:
            kind: footprint, symbol or component.
            tokens: Values for the template, e.g. {"mpn": "TPS62130RGTR",
                "manufacturer": "Texas Instruments"}; a manufacturer gives
                ``mfr_short`` from the policy's abbreviations.
lib_move_bodies_to_layertool Put the 3D bodies of the focused PCB library on one mechanical
Put the 3D bodies of the focused PCB library on one mechanical
        layer.

        For libraries merged from sources that used different layers.
        Bodies already on the layer are counted and left; nothing is added
        or removed.

        Args:
            layer: The mechanical layer, by number ("Mechanical13") or by
                the name the library's stack gives it. Anything else is
                refused, as Altium's body dialog only offers mechanical
                layers.
            footprint_names: Only these footprints. Empty means every
                footprint in the library; names no footprint has come
                back in ``not_found``.
            keep_layers: Layers whose bodies stay where they are, by the
                same names as ``layer``. A body already on one of them is
                counted as already on the layer. Every other body moves.
                An unknown name refuses the whole call, and nothing moves.
                Empty: every body moves.

        Does NOT save the library. A mechanical layer the library has not
        enabled is accepted, with ``layer_enabled`` false and a
        ``warning``, since Altium does not draw what is on it.

        Returns:
            Dict with ``layer``, ``layer_enabled``, ``footprints``,
            ``bodies``, ``moved``,
            ``already_on_layer``, ``footprints_without_bodies``,
            ``not_found``, and ``items`` (``{name, moved, from}`` for
            each footprint that changed).
lib_move_componentstool Move matching components (symbol + params + models) between SchLibs.
Move matching components (symbol + params + models) between SchLibs.

        Bulk lib_copy_component: copies each match whole, then removes it
        from the source unless ``delete_from_source`` is False. One already
        in the destination is skipped unless ``overwrite``. A failed copy
        is never deleted from the source.

        Args:
            source_schlib: source .SchLib path.
            dest_schlib: destination .SchLib path.
            names: explicit list of component LibReferences to move.
            name_regex: regex matched against source component names when names
                is not given.
            delete_from_source: remove moved components from source (default True).
            overwrite: replace a same-named component already in dest.
            dry_run: report the selection without moving anything. Use it
                with name_regex, which is a ``search``, not a full match
                (``R`` selects every name containing an R).

        Returns:
            {"success": true, "moved": N, "skipped": N, "failed": N}, or
            in dry-run {"dry_run", "resolved", "count", ...}.
lib_move_footprintstool Move matching footprints between PcbLibs (the PcbLib analog of move).
Move matching footprints between PcbLibs (the PcbLib analog of move).

        Copies each footprint whole, then removes it from the source
        unless delete_from_source is False; with lib_move_components it
        splits a library. Give names or name_regex. A footprint already in
        dest is skipped unless overwrite=True.

        Args:
            source_pcblib: source .PcbLib path.
            dest_pcblib: destination .PcbLib path.
            names: explicit list of footprint names to move.
            name_regex: regex matched against source footprint names when names
                is not given.
            delete_from_source: remove moved footprints from source (default True).
            overwrite: replace a same-named footprint already in dest.
            dry_run: report the selection and move nothing. Use it with
                name_regex: the pattern matches anywhere in a name, so a
                short one selects far more, and the default deletes them
                from the source.

        Returns:
            {"success": true, "moved": N, "skipped": N, "failed": N}, or
            in dry-run {"dry_run", "resolved", "count", ...} with nothing
            sent to the bridge.
lib_normalize_implementationstool Clean up every component's models in a SchLib for a self-contained package.
Clean up every component's models in a SchLib for a self-contained package.

        Per component: clears SourceLibraryName and TargetFileName; keeps
        ONE model per (type, name) in place, with its parameters, pin map
        and datafile link; applies ``rename_map``; and repairs footprints
        with no datafile link. Nothing is rebuilt, so nothing is lost.
        When renaming footprints, run lib_rename_footprint on the PcbLib
        first and pass the same map here.

        Args:
            library_path: optional .SchLib path; defaults to the focused lib.
            rename_map: optional {old_model_name: new_model_name} applied to
                the kept model's name and matching datafile entity.
            dedupe_only: skip renames; only collapse duplicates + clear source.
            source_library: optional; written into every PCBLIB model's
                datafile Location so footprints embed on compile (never
                blanked). Copy it from a known-good model (see
                lib_set_model_source).
            use_component_library: optional; sets the embed-vs-search flag on
                the models whose Location is written.

        Returns:
            {"success": true, "components_touched": N, "duplicates_removed": N,
             "sources_cleared": N, "links_repaired": N, "sources_set": N}.
lib_probe_designatortool Diagnostic: dump one footprint's raw designator geometry.
Diagnostic: dump one footprint's raw designator geometry.

        Read-only. Returns the footprint origin and bounding rectangle, the pad
        extents, and the ``.Designator`` anchor, bounding rectangle, size and
        width, in Altium's internal units.

        Returns ``{footprint, fp_x, fp_y, fp_rect, pad_count, pad_rect,
        desig_anchor, desig_rect, desig_size, desig_width, desig_text}``.
lib_probe_footprinttool Read-only dump of a PcbLib footprint's name-bearing fields.
Read-only dump of a PcbLib footprint's name-bearing fields.

        Finds where an old name persists after a rename: every text
        primitive with its object_id, plus name, description, height and
        primitive count.

        Args:
            footprint_name: the footprint name.
            library_path: optional .PcbLib path; defaults to the focused lib.

        Returns:
            {"success": true, "footprint": "...", "description": "...",
             "height_mils": N, "primitive_count": N,
             "texts": [{"object_id": N, "text": "..."}]}.
lib_read_pin_tabletool Check a pin table copied from a datasheet and turn it into symbol pins.
Check a pin table copied from a datasheet and turn it into symbol pins.

        CSV with the header ``number,name,type``, optionally ``side``
        (left, right, auto) and ``description``. Types: input, output, io,
        bidirectional, passive, power, open_collector, open_emitter, hiz,
        and the usual short spellings. ``left_pins`` and ``right_pins`` go
        straight to lib_create_ic_symbol. Compare the table with the
        datasheet page it came from before trusting it.

        Args:
            table_csv: The table.
            package_pins: The package's pin count, to catch a missing pin.

        Returns:
            ``ok``, ``errors`` (unusable as it is), ``warnings`` (worth a
            look), ``pins``, and ``left_pins`` / ``right_pins``.
lib_redraw_assemblytool Draw the assembly layer of the focused PCB library again from
Draw the assembly layer of the focused PCB library again from
        each footprint's own geometry: a rectangle round the part and a
        ``.Designator`` in its middle.

        With ``replace`` (the default) the tracks, arcs, texts, fills and
        regions on ``layer`` are cleared first; bodies and pads are never
        touched. Does NOT save. A layer the library has not enabled is
        accepted with ``layer_enabled`` false and a ``warning``.

        Args:
            layer: The mechanical layer for the drawing.
            footprint_names: Only these footprints. Empty means all.
            outline_from: ``body``, ``pads``, ``courtyard`` (drawn on
                ``courtyard_layer``) or ``auto`` (that order of
                preference). A footprint with none is in ``skipped``.
            courtyard_layer: The courtyard's layer; not ``layer`` when
                replacing.
            width: Line width (default 4 mil).
            designator: Place a centred ``.Designator``, upright in a
                tall box.
            text_height: 0 sizes it to the box (0.2 to 1 mm).
            replace: Clear the layer first; False draws beside it.
            confirm: Required with ``replace``.
            units: "mil" (default) or "mm" for ``width`` and
                ``text_height``.

        Returns:
            ``layer``, ``layer_enabled``, ``redrawn``, ``cleared``,
            ``skipped``, ``not_found``, ``items`` (``{name,
            outline_from, cleared, width_mm, height_mm}``).
lib_reload_librarytool Close and reopen a PcbLib so Altium rebuilds its caches from disk.
Close and reopen a PcbLib so Altium rebuilds its caches from disk.

        A text's extent is not refreshed after it moves or is resized until
        the library is reloaded, so reload between a write and the next read.

        SAVE FIRST: this does not save, and closing a dirty document loses the
        edits or raises a prompt. ``lib_fix_designators`` already does this.
lib_remove_modeltool Remove models (implementations) from a SchLib component by name.
Remove models (implementations) from a SchLib component by name.

        Removes every implementation whose ModelName equals model_name. With
        keep_one=True it keeps the first match and removes the rest, which
        deletes duplicate model links while preserving one. Errors if the
        component is not found; returns removed=0 if no model matches.

        Args:
            component_name: the component's LibReference.
            model_name: the ModelName of the model(s) to remove.
            keep_one: keep the first match and remove the rest (dedup).
            library_path: optional .SchLib path; defaults to the focused lib.

        Returns:
            {"success": true, "model_name": "...", "removed": N,
             "kept_one": bool}.
lib_rename_componenttool Rename one symbol's LibReference in a schematic library (.SchLib).Filesoutside text
Rename one symbol's LibReference in a schematic library (.SchLib).

        Also repairs a name a caller cannot type (a quote or control
        character from a broken import): address it by
        ``component_index``. A name another component has is NAME_EXISTS.
        Save with app_save_all.

        For several, give ``items``: a list of {component_name, new_name}
        dicts (component_index works too). Items by name in one library
        run as one batch in Altium; arguments given beside ``items`` apply
        to every item.

        Args:
            new_name: the clean LibReference to write.
            component_name: current LibReference of the target. Provide this
                or component_index.
            library_path: optional absolute .SchLib path; defaults to the
                focused library.
            component_index: the integer `index` from lib_get_components,
                the name-free way to pick the target. Provide this or
                component_name.

        Returns:
            {"success": true, "library_path": "...", "old_name": "...",
             "new_name": "..."}. With items by name: the counts of renamed
            and failed; otherwise each item's own reply.
lib_rename_footprinttool Rename a footprint in a PCB library (.PcbLib).
Rename a footprint in a PCB library (.PcbLib).

        Renames the footprint whose name is footprint_name to new_name.
        Errors if footprint_name is not found or new_name already exists in
        the library.

        MARKS the .PcbLib dirty; it does not write. Call `app_save_all` to
        flush, and check what it reports actually reached disk.

        Args:
            footprint_name: the current footprint name.
            new_name: the new footprint name.
            library_path: optional .PcbLib path; defaults to the focused lib.

        Returns:
            {"success": true, "footprint": "...", "new_name": "..."}.
lib_render_footprinttool Draw a footprint as it is in its library, to look at.Files
Draw a footprint as it is in its library, to look at.

        Read live (pads, every primitive, the library's layer kinds) and
        drawn the way ``footprint_render_package`` draws a planned one:
        copper with pad numbers and holes, paste, silkscreen, assembly
        dashed blue, courtyard magenta, anything else dashed grey. Which
        layer is the courtyard comes from Altium's layer KIND; a library
        whose layers have no kind set needs ``courtyard_layer`` /
        ``assembly_layer`` (e.g. "Mechanical15").

        Args:
            footprint_name: the footprint in the library.
            library_path: the .PcbLib; empty = the focused library.
            path: SVG to write; default <workspace>/renders/<name>_live.svg.
            png: also write a PNG beside it when a headless browser is
                installed.
            courtyard_layer / assembly_layer: layer names to use when the
                layer kinds do not say.

        Returns:
            {ok, svg_path, png_path, pads, roles (per role: count and
            extent in mm), height_mm, silk_over_copper (silkscreen lines
            that touch a pad, by pad), notes}.
lib_rotate_footprinttool Turn a footprint in a .PcbLib about its own origin by 90, 180 orFiles
Turn a footprint in a .PcbLib about its own origin by 90, 180 or
        270 degrees, counter-clockwise (-90 is 270), every primitive with it:
        pads (position and pad rotation), tracks, arcs, fills, regions, vias,
        texts (.Designator / .Comment included) and 3D bodies, whose model
        turns with the body as it does under Altium's own Rotate Selection
        (the model's own rotation fields are never written). The library is
        opened by path; it need not be focused, and the user's selection is
        not touched.

        Every pad is read back: its centre must land where the turn puts it
        and its rotation must move by the angle. Any that did not are
        listed in ``pad_mismatches`` and counted in ``mismatches``; the
        library is then NOT saved, so it can be inspected (or the footprint
        turned back by the opposite angle). Polygons and dimensions in a
        footprint are counted in ``not_turned``. Look at one turned
        footprint in 3D before a batch (``show``), since the model's
        orientation cannot be read back.

        Args:
            library_path: the .PcbLib.
            footprint: footprint name (case-insensitive).
            angle: 90, 180, 270 or -90.
            dry_run: count what would be turned, change nothing.
            save: save the library afterwards when nothing mismatched.
            show: make the footprint the library's current one afterwards,
                to look at it (its 3D model shows only there). Changes what
                the library editor has on screen.

        Returns:
            ``kinds`` (count per primitive kind), ``turned``,
            ``not_turned``, ``mismatches``, ``pad_mismatches``,
            ``bodies_with_models`` and ``saved``.
lib_run_acrosstool Run one library command against several libraries in one call
Run one library command against several libraries in one call
        (the loop runs inside Altium; each library is still opened).

        Works for commands that accept a ``library_path`` (most reads and
        batch edits). Footprint editing commands (``create_footprint``,
        ``add_footprint_pad``, ``link_3d_model``...) act on the open
        library and cannot be swept.

        Failure is per library: one that will not open does not stop the
        rest, and each is reported separately.

        Args:
            action: Library command without its namespace, e.g.
                "get_components", "batch_rename", "audit_styles".
            libraries: Full paths. Passed to Altium separated by "|",
                which cannot occur in a Windows path.
            params: Parameters shared by every library. Any
                ``library_path`` here is overridden per library.
            timeout: Seconds for the whole sweep, not per library.

        Returns:
            Dict with ``results`` (each: library, success, data, error),
            ``succeeded``, ``failed`` and ``libraries``.
lib_searchtool Search open SchLib documents and installed database libraries.
Search open SchLib documents and installed database libraries.

        Searched: every .SchLib open (in a project or standalone) and every
        installed DbLib, case-insensitive substring. NOT searched: IntLibs,
        query/SVN libraries, workspace components, closed SchLibs, so 0
        hits is not "no such part"; ``not_searched`` and ``coverage_note``
        say what was skipped. It reads files ON DISK: a symbol created and
        not yet saved is not found (use lib_get_component_details).
        DbLib rows match on every column (MPN, value) and are marked
        ``source: "dblib"``; lib_dblib_search narrows to a table.

        DATASHEET DISCIPLINE: fetch a part's datasheet before recommending
        it; do not go on symbol metadata alone.

        Args:
            query: Substring to match.
            search_type: "all" (name, alias, description; default),
                "name", "description", or "parameters" (slow).
            library_path: Restrict to one .SchLib or .DbLib.
            limit: Cap on matches, SchLib and DbLib together (default 100).
            include_dblibs: Also search installed DbLibs (default True;
                slower on large databases).

        Returns:
            ``query``, ``search_type``, ``count``, ``limit``,
            ``truncated``, ``results`` [{name, alias_name, description,
            library_path, part_count, source}; DbLib rows add table,
            key_field, symbol_ref, symbol_library, footprints,
            matched_field], ``_datasheet_guidance``,
            ``libraries_searched``, ``not_searched`` [{library_path,
            library_type, reason}], ``dblib_searches``, ``coverage_note``.
lib_select_footprint_primitivestool Select primitives of one PcbLib footprint in the editor, for an
Select primitives of one PcbLib footprint in the editor, for an
        editor command that acts on the selection (obj_run_process with
        PCB:CustomPadShape to merge a pad and a region into a custom pad,
        or ``lib_set_pad_properties(selected=True)``). obj_select acts on a
        board, not a footprint. To delete, ``lib_delete_footprint_primitives``
        is far quicker than a selection and PCB:Clear.

        Several sets select together in one call; with ``clear=False`` a
        later call adds to the selection. Every object is checked against
        every set, so use ONE broad set (object_type + layer) for many
        objects: a set per pad name costs more than writing each pad. Pad names are not unique (an
        SMD "12" and a thru-hole "12" can share a footprint), so narrow by
        layer or box and check the reply before running the command.

        Args:
            footprint_name: The footprint, made current if it is not.
            objects: One or more filter sets; an object matching ANY set is
                selected. Each set has any of ``object_type`` ("pad",
                "region", "track", ...), ``layer`` ("TopLayer",
                "MultiLayer", ...), ``name`` (a pad's designator or a
                region's Name), ``box`` ([x1, y1, x2, y2] from the
                footprint origin, the box lib_get_footprint_primitives
                gives a region, fill or text; matched within 0.001 mm)
                and ``identifier`` (3D bodies whose Identifier starts with
                it, as lib_get_footprint_primitives reports in
                ``body_models``).
            clear: Deselect everything else first (default True).

        Returns:
            {selected (how many matched), layers (theirs), selected_total
            (everything the editor now holds selected)}
lib_set_3d_bodytool Read or change the 3D bodies already in a PcbLib footprint.Filesoutside text
Read or change the 3D bodies already in a PcbLib footprint.

        Edits bodies in place: height, opacity, layer, centre and standoff
        (the Properties panel's Standoff Height). Call with only
        ``footprint_name`` to read every body.

        ON A STEP BODY THE STANDOFF IS THE MODEL'S Z OFFSET. Writing it
        also writes the model's rotations, read from Altium's export of
        the footprint as it is now, unsaved edits included. A STEP body
        the export does not hold is ``skipped``.

        Args:
            footprint_name: The footprint whose bodies to edit. Required.
            library_path: The .PcbLib. Defaults to the focused document;
                the edit is refused if that library cannot be focused,
                and a path that is not a file is refused before Altium
                sees it, since Altium opens a new, empty library there.
            standoff_height: Height of the body's base above the board.
            overall_height: Height of the body's top above the board.
            opacity: 0 (clear) to 1 (solid), not a percentage.
            layer: Move the body to this mechanical layer, by number
                ("Mechanical5") or the name the library's stack gives it.
            body_index: 1-based, in the order ``before`` lists them.
                Empty edits every body of the footprint.
            units: "mil" (default) or "mm" for the two heights and the
                centre.
            center_x, center_y: Move the body so the centre of its box is
                here, relative to the footprint origin (one body: give
                ``body_index``). An axis left out stays. ``after`` reads
                the centre back as ``center_x_mils`` / ``center_y_mils``;
                ``moved_as_asked`` compares it.

        Does NOT save the library.

        Returns:
            Dict with ``library``, ``footprint``, ``bodies``, ``changed``,
            and ``before`` / ``after``: one ``{index, layer, step,
            standoff_height_mils, overall_height_mils, opacity}`` per body
            touched with ``center_x_mils`` / ``center_y_mils``, read
            back from Altium (for a STEP body
            ``standoff_height_mils`` is the unused body field).
            ``exported_bodies`` is each body as Altium exports it, with
            ``model_z_offset_mils`` and ``rotation_deg``.
            ``model_z_offset_written`` lists the STEP bodies whose Z
            offset was written; read again to see it in
            ``exported_bodies``. ``skipped``: bodies left alone, why.
lib_set_component_descriptiontool Set the description field on a library component.
Set the description field on a library component.

        Args:
            component_name: Name of the component in the active library
            description: New description text

        Returns:
            Dictionary confirming the description was set
lib_set_current_componenttool Make a named component the editor's current selection in the
Make a named component the editor's current selection in the
        active SchLib.

        Call it before ``obj_modify`` (one filter or ``items``) with scope
        "active_doc" on a symbol's pins, rectangles or parameters: those
        act on the current component, which reading one with
        ``lib_get_component_details`` does not change. (Scope
        "lib_component:NAME" selects the symbol for you.) It is also
        the symbol ``lib_add_pins`` and the ``lib_add_symbol_*`` tools
        then write into.

        Args:
            component_name: Component name (LibRef) in the active SchLib.

        Returns:
            Dict with ``success`` + ``name``, or an error if no SchLib
            is active or the component name isn't found in it.
lib_set_current_footprinttool Make a named footprint the current one in a PCB library.
Make a named footprint the current one in a PCB library.

        The PcbLib twin of ``lib_set_current_component``: the footprint the
        editor shows, and the one ``obj_modify`` with scope "active_doc"
        and the authoring tools given no footprint name act on. Nothing is
        written to the library.

        Args:
            footprint_name: The footprint, as ``lib_get_footprints`` names it.
            library_path: The .PcbLib; empty takes the one in front.

        Returns:
            ``success``, ``name``, ``was`` (the footprint current before)
            and ``library``.
lib_set_footprint_descriptiontool Set the Description of a footprint in a PCB library (.PcbLib).
Set the Description of a footprint in a PCB library (.PcbLib).

        The footprint twin of lib_set_component_description. The text is
        read back; ``success`` is false when Altium holds something else.
        Marks the library modified; app_save_document writes it.

        Args:
            footprint_name: The footprint.
            description: The new text; "" clears it.
            library_path: Optional .PcbLib path; defaults to the focused one.

        Returns:
            ``success``, ``footprint``, ``was`` and ``description`` (as read
            back).
lib_set_footprint_heighttool Set one footprint's Height directly, up or down.
Set one footprint's Height directly, up or down.

        For a part with no 3D model, or a wrong one. The height drives the
        height-clearance DRC: too tall flags parts that are fine, and ZERO
        DISABLES the check for that footprint (the reply says so).

        Args:
            height_mm: the height in MILLIMETRES, not mils. Must be
                non-negative.
            footprint_name: which footprint. Empty uses the library's
                current component.

        Returns:
            ``{name, old_height_mm, new_height_mm, changed, saved,
            save_note, note}``. ``saved`` is always false: the library
            is modified in memory and left for you to review and save.
lib_set_label_formatstool Set label styles on SchLib symbols, several targets in ONE call
Set label styles on SchLib symbols, several targets in ONE call
        (no single-target variant), across one symbol or the whole library.

        Each op writes only the fields it gives (at least one):
            {"target": "designator" | "comment" | "parameter:<Name>",
             "font_id", "color" (BGR int), "is_hidden", "orientation"
             (0/90/180/270), "justification", "x", "y" (mils, symbol
             frame), "text" (e.g. "=Partnumber" on the comment)}
        Resolve font_id with ``obj_get_font_id`` / ``obj_get_font_spec``.

        Args:
            ops: Non-empty list of ops; targets cannot contain ';' or
                '~~'.
            component_name: One symbol only; omit for the whole library.
            library_path: .SchLib (default: the focused one).
            only_mismatched: Skip labels already matching (default True).
            limit: Cap on components in a library walk.
            timeout: Poll timeout override.

        Returns:
            library_path, scope ("single"|"bulk"), total, limit,
            truncated, and ``ops`` [{target, modified, already_compliant,
            missing_target, failed}].
lib_set_mech_layerstool Name, enable and set the kind of a library's mechanical layers.
Name, enable and set the kind of a library's mechanical layers.

        Takes the library by PATH (unlike the pcb_* layer tools, which act
        on whatever is focused) and refuses unless that library is the one
        focused. Every change is read back and failures are reported per
        layer. A Top/Bottom kind ("Courtyard Top") belongs to a layer PAIR,
        so give the partner kind to another layer in the same call. Use
        ``lib_run_across`` to apply one scheme to many libraries.

        Args:
            layers: [{layer (e.g. "Mechanical13"), name?, enabled?,
                kind?}].
            library_path: Library to edit (default: the focused one; only
                safe for a single library).
            tidy_pairs: Also remove layer pairs whose two layers are not a
                matching Top/Bottom kind pair (default off: it removes
                pairs).
            timeout: Seconds.

        Returns:
            ``library``, ``layers`` [{layer, changed, problem}],
            ``changed``, ``failed``, ``kinds_displaced``,
            ``pairs_removed``, ``pairs_tidied``, ``pairs_scanned_to``.
lib_set_model_nametool Set a model's model_name (footprint reference) on a SchLib symbol.
Set a model's model_name (footprint reference) on a SchLib symbol.

        Rewrites the ModelName of one of the component's implementations.
        If model_name is given, the model whose current ModelName matches is
        targeted; otherwise the current (or first) model is used.

        Args:
            component_name: the component's LibReference.
            new_model_name: the new model_name to write.
            model_name: optional current model_name to target a specific one.
            library_path: optional .SchLib path; defaults to the focused lib.

        Returns:
            {"success": true, "component": "...", "new_model_name": "..."}.
lib_set_model_sourcetool Write the datafile-link Location (source library) on a footprint model.
Write the datafile-link Location (source library) on a footprint model.

        With an empty Location a footprint resolves by name in the editor
        but is missing from a compiled library, with no compile error.
        Targets footprint models named model_name, or all of them. Copy
        the exact source_library from a model that embeds correctly
        (``lib_get_component_details`` shows each model's location); it
        is written as given.

        Args:
            component_name: the component's LibReference.
            source_library: the source-library reference written into Location.
            model_name: optional footprint model name to target one model.
            use_component_library: optional; sets the embed-vs-search flag.
            library_path: optional .SchLib path; defaults to the focused lib.

        Returns:
            {"success": true, "component": "...", "source_library": "...",
             "models_updated": N}.
lib_set_pad_geometrytool Change many pads of one PcbLib footprint in ONE call.
Change many pads of one PcbLib footprint in ONE call.

        Each row names its pad by ``id`` (from ``lib_get_pad_geometry``)
        and carries the fields to write, under the names
        ``lib_set_pad_properties`` uses: x_size, y_size, bottom_x_size,
        bottom_y_size, shape, corner_radius_pct, stack_mode, rotation,
        hole_type, hole_size, hole_width, hole_rotation, plated,
        paste_expansion, paste_manual, mask_expansion,
        mask_bottom_expansion, mask_separate, mask_manual,
        mask_from_hole_edge, paste_top_enabled, x, y (a move, from the
        footprint origin), new_name and clear_name (True: no name). ``x_mm`` / ``y_mm`` as the read
        gave them (``x_mils`` / ``y_mils`` in a mil session) guard a row: a
        pad that has moved refuses the call.
        Every row is checked before anything is written. Pads are
        matched by id, never by name, so renumbering (3 -> 5, 5 -> 7)
        needs no temporary names. About 6 s for 200 pads. The same
        writer runs for ``lib_set_pad_properties`` given ``items`` that
        carry ``id``. In a library Undo takes back one pad at a time.

        Args:
            footprint_name: The footprint holding the pads.
            rows: One dict per pad: ``id`` (required), optional
                ``x_mm`` / ``y_mm`` guard, then the fields to change.
            library_path: Optional .PcbLib path; defaults to the
                focused library.
            units: "mil" (default) or "mm", for every length in rows.

        Returns:
            ``rows``, ``pads_changed``, ``pads_with_a_failed_write``,
            ``repeats`` (pads the walk handed out twice, expected 0),
            ``note``, and ``pads`` as read back, each with its ``id``.
lib_set_pad_propertiestool Change existing pads in a PcbLib footprint, only the fields
Change existing pads in a PcbLib footprint, only the fields
        given, each read back. Pick pads by ``pad_name`` (every pad of
        that name), ``selected=True`` (the editor's selection) or ``id``
        (from ``lib_get_pad_geometry``).

        Many pads, different values: ``items``, one dict per pad. Items
        that all carry ``id`` are ONE walk, every item checked first and
        one bad item refusing the call, so a renumbering (3 -> 5,
        5 -> 7) needs no temporary names (about 6 s for 200 pads). Many
        pads, ONE value: select them with ONE broad set in
        ``lib_select_footprint_primitives``, then ``selected=True``.

        A written expansion is made manual (Altium ignores it otherwise);
        ``mask_manual`` / ``paste_manual`` False hands it back to the
        rule. On a per-layer stack ``x_size`` / ``y_size`` are the top
        size (``note``). Undo takes back one pad at a time.

        Args:
            footprint_name: The footprint holding the pad.
            pad_name: The designator; names need not be unique, so
                ``selected`` or ``id`` say which.
            selected: The pads selected in the editor.
            id: The pad's id (stable while the library is open).
            x_mm, y_mm: With ``id``, the position the read gave; a pad
                moved since refuses the call.
            library_path: .PcbLib path; default the focused library.
            units: "mil" (default) or "mm", for every length.
            x_size, y_size: Copper size (top size on a stacked pad).
            bottom_x_size, bottom_y_size: Bottom size; makes the pad
                top-middle-bottom.
            shape: "round", "rectangular", "octagonal" or "roundrect".
            corner_radius_pct: Roundrect corner, 0 to 100 % of half the
                shorter side; 25 when roundrect and not given.
            stack_mode: "simple" or "top-middle-bottom", written first.
            rotation: Degrees.
            hole_type: "round", "square" or "slot", written before the
                hole sizes.
            hole_size: Diameter, 0 for surface mount.
            hole_width: Slot length; makes a slot.
            hole_rotation: Slot rotation relative to the pad.
            plated: Whether the hole is plated.
            paste_expansion, mask_expansion: Expansions (mask: both
                sides unless ``mask_bottom_expansion`` is given).
            mask_bottom_expansion: Bottom mask; unlinks the sides.
            paste_manual, mask_manual: True keeps the value written,
                False hands it to the rule.
            mask_separate: Unlink (True) or link the mask sides.
            mask_from_hole_edge: Measure the mask from the drill edge.
            paste_top_enabled: The top paste opening on or off; holds
                only on a manual paste expansion (made manual first).
                Not before Altium Designer 25.
            x, y: Move the pad from the footprint origin; one pad only.
            new_name: Renumber the pad.
            clear_name: True leaves the pad without a name: a pad the part
                does not use (an unused ball of a standard BGA), which
                lib_link_footprint leaves out of its pin and pad check.

        Returns:
            ``pads_changed``, ``pads_with_a_failed_write``, ``note`` and
            ``pads`` as read back (sizes, shape, corner, stack, rotation,
            hole, plating, expansions and their state, flags,
            ``all_writes_ran``); by id also ``rows`` and ``repeats``.
lib_set_pin_owner_parttool Reassign pins of a multi-part symbol to a sub-part, or to Part Zero.
Reassign pins of a multi-part symbol to a sub-part, or to Part Zero.

        ``owner_part_id=0`` is Part Zero: the pin belongs to the package,
        not one sub-part, which is where supply pins go. A supply pin
        owned by a sub-part is drawn at every instance and can short two
        rails where instances sit close.

        Changes the library only. Placed instances pick it up on the
        next Update From Libraries, which produces an ECO.

        Args:
            pin_designators: comma-separated pin numbers, e.g. "3,12".
            owner_part_id: 0 for Part Zero, or 1..part_count.
            component_name: library reference of the symbol to edit.
                Empty edits the current symbol (see ``lib_add_pins``).

        Returns:
            Dictionary with "component", "owner_part_id", the
            "pins_changed" list and its "count".
lib_set_pin_timingtool Set symbol pins' package length and propagation delay.
Set symbol pins' package length and propagation delay.

        The length and delay inside the package, from the die to the
        pin, which Altium adds to a net's routed length when it matches
        lengths. Every pin with the designator is set, a pin repeated in
        another display mode too. The edit is in memory until
        app_save_all.

        Args:
            component_name: The symbol in the .SchLib.
            pins: designator -> ``{"package_length_mil": 120.5,
                "propagation_delay_ps": 35}``; either key alone sets only
                that value. 0 clears it.
            library_path: The .SchLib. Defaults to the focused library.

        Returns:
            ``pins_changed``, ``not_found`` (designators no pin has) and
            ``pins`` [{designator, package_length_mil,
            propagation_delay_ps}], read back from every pin.
lib_set_supplier_linkstool Replace a library symbol's manufacturer and supplier links.
Replace a library symbol's manufacturer and supplier links.

        A file-based library keeps them as numbered parameters, the names
        Altium's Supplier Links writes: "Manufacturer 1",
        "Manufacturer Part Number 1", "Supplier 1", "Supplier Part
        Number 1", then 2 and on. Every existing one is removed and the
        given links are written from 1, so the list is the whole set; an
        empty list clears them. Other parameters are left alone. The
        edit is in memory until app_save_all.

        Args:
            component_name: The symbol in the .SchLib.
            links: ``{"manufacturer", "mpn", "supplier",
                "supplier_part_number"}`` each, any of them; a link with
                none is refused.
            library_path: The .SchLib. Defaults to the focused library.

        Returns:
            ``removed`` and ``written`` (parameters), ``parameters`` read
            back, and ``links`` grouped by number.
lib_set_symbol_aliasestool Read, add or remove a SchLib symbol's aliases.
Read, add or remove a SchLib symbol's aliases.

        An alias lets one symbol be placed under several part names (a
        74HC00 drawn once, offered as 74HCT00 too). Removal runs before
        adding. Call with only ``name`` to read.

        Args:
            name: The symbol (its library reference).
            library_path: The .SchLib. Defaults to the focused library.
            add: Alias names to add.
            remove: Alias names to remove.

        Does NOT save the library.

        Returns:
            ``aliases_before`` and ``aliases``.
lib_set_symbol_partstool Set how many parts and display modes a SchLib symbol has.
Set how many parts and display modes a SchLib symbol has.

        Uses the library editor's own Add Part / Remove Part and Add /
        Remove Display Mode, one step at a time, each read back. Parts
        and modes are added and removed at the end: a part count going
        from 4 to 2 removes parts 4 and 3 WITH THEIR PINS and graphics
        (``pins_removed`` says how many). A new part or mode is empty;
        draw it with lib_add_pins and the lib_add_symbol_* tools.

        Args:
            name: The symbol (its library reference).
            library_path: The .SchLib. Defaults to the focused library.
            part_count: Parts wanted, from 1. Omit to leave as is.
            display_mode_count: Display modes wanted, from 1 (the normal
                mode only). Omit to leave as is.

        Does NOT save the library.

        Returns:
            ``part_count_before``, ``part_count``,
            ``display_mode_count_before``, ``display_mode_count``,
            ``pins_removed``, and ``complete`` (false with ``stopped``
            saying which step did not take).
lib_set_via_propertiestool Modify one via inside a footprint of an open PCB library.
Modify one via inside a footprint of an open PCB library.

        The via is found by its position relative to the footprint origin
        (within 1 mil, whatever ``units``). No via there is an error, and so
        is more than one: nothing is changed. Only the fields given are
        written, and each is read back: one that did not take sets
        ``all_writes_ran`` false. A middle or bottom diameter raises the via
        to a local-stack via in the same call. The mask expansions are set
        through the pad cache.

        Tenting holds only on a manual mask expansion, so a rule-driven
        via is switched to a manual expansion at its current value first
        (``mask_made_manual``).

        Args:
            x, y: The via centre, relative to the footprint origin.
            library_path: Full path to the open .PcbLib; it must be the
                focused library, or the call refuses. Empty: the focused
                library.
            footprint_name: footprint to change; empty uses the current one.
            units: "mil" (default) or "mm".
            hole_size: Drill diameter.
            size: Top-layer diameter.
            dia_mid: Middle-layer diameter (makes a local-stack via).
            dia_bottom: Bottom-layer diameter (makes a local-stack via).
            stack_mode: "simple" (one diameter on every layer) or
                "top-middle-bottom", written before the sizes.
            tenting_top, tenting_bottom: Solder mask tenting on each side.
            mask_expansion: Solder mask expansion (manual), both sides
                unless ``mask_bottom_expansion`` is also given.
            mask_bottom_expansion: Bottom solder mask expansion (manual).
            mask_separate: Separate (True) or linked (False) mask expansions.
            mask_manual: True keeps the mask as written; False hands it
                back to the design rule (not with a mask value).
            mask_from_hole_edge: Measure the mask from the drill edge.

        Returns:
            Dictionary with ``all_writes_ran``, the via's drill and size,
            its tenting and mask expansions read back, ``mask_source``
            (manual or rule), ``mask_from_hole_edge``, ``stack_mode``,
            ``mid_unverified`` (a middle diameter that reads back 0 on
            this build, so the write could not be checked) and
            ``mask_made_manual``. A field this build cannot read comes back
            null.
lib_split_pin_functionstool Split slash-delimited pin names into pin function lists.
Split slash-delimited pin names into pin function lists.

        For the current library symbol (see ``lib_add_pins``), parses each
        pin whose name is `PRIMARY/ALT1/ALT2/...` into the pin's function
        list (the alternate-function popup). The pin's name is left as it
        was: shorten it yourself if only `PRIMARY` should show. Pins
        without a `/` are unchanged.

        Returns:
            {"pins_processed": N}, every pin looked at, with or without
            a `/`.
lib_uninstall_librarytool Unregister a library from the environment's Available Libraries.Filesoutside text
Unregister a library from the environment's Available Libraries.

        A .PvLib is removed from the PCB editor's installed pad/via
        libraries instead.

        Args:
            library_path: absolute path to the library file.

        Returns:
            ``uninstalled`` (checked against the installed list),
            ``still_installed``, ``closed_document`` (an .IntLib open as a
            document was closed), ``library_path`` and ``file_locked``
            (True: Altium still holds the file, so it cannot be deleted
            or rebuilt in place until Altium restarts).
lib_update_footprint_heights_from_3dtool Set every footprint's height in the active PcbLib from its
Set every footprint's height in the active PcbLib from its
        tallest 3D body, for the height-clearance DRC (a height of 0
        makes that rule pass silently).

        Args:
            mode: ``raise`` (default) only increases a height, so a
                hand-set one survives. ``match`` also lowers it to the
                model; use it when heights are too tall. For one
                footprint, or one with no model, use
                ``lib_set_footprint_height``.

        A footprint with no 3D body is never set to 0; it is listed in
        ``without_model``. The library is not saved; review ``items``
        and save in Altium.

        Returns:
            Dict with ``mode``, ``inspected``, ``updated``, ``lowered``,
            ``without_model``, ``without_model_names``, and ``items``
            (``{name, old_height_mm, new_height_mm}`` per footprint).
lib_verify_ipc_namestool Check that every footprint with an IPC-7351 name has the pads the
Check that every footprint with an IPC-7351 name has the pads the
        name claims: the pin count and, for leaded packages, the pitch.

        Footprints whose names are not IPC names are listed separately, not
        failed. The library is read through Altium and not changed.

        Args:
            library_path: The .PcbLib.
            footprints: Just these; all of them by default.
            limit: The most footprints read.

        Returns:
            ``checked``, ``mismatched`` (each with ``issues``), ``matched``,
            ``not_ipc_names`` and ``cut_short``.
list_componentstool Every component on the open board (reference, value, footprint,Env vars
Every component on the open board (reference, value, footprint,
        kind), from the active backend (or the one named by ``backend``).
list_netstool Every net on the open board with pin count and class (power / groundEnv vars
Every net on the open board with pin count and class (power / ground
        / signal), from the active backend (or the one named by ``backend``).
obj_batch_createtool Create many schematic objects in ONE call (obj_create items).Filesoutside text
Create many schematic objects in ONE call (obj_create items).

        What ``obj_create(items=[...])`` runs, kept under this name for
        callers that use it.

        One Altium transaction for the whole list.

        Args:
            operations: List of create dicts, each with:
                - scope: "active_doc" (default), the only scope a
                  create takes; any other is refused.
                - object_type: Altium type name (e.g. "eNetLabel",
                  "eJunction", "eNoERC").
                - properties: pipe-separated ``Name=Value`` list, same
                  format as ``obj_create`` accepts.
                - container: "document" (default) or "component" (for
                  library-symbol contents when a lib is active).

        Example, drop 3 net labels in one call:
            obj_batch_create(operations=[
                {"object_type": "eNetLabel",
                 "properties": "Text=VCC|Location.X=100|Location.Y=200"},
                {"object_type": "eNetLabel",
                 "properties": "Text=GND|Location.X=100|Location.Y=400"},
                {"object_type": "eNetLabel",
                 "properties": "Text=SCK|Location.X=300|Location.Y=200"},
            ])

        Returns:
            Dict with created, failed, total counts and indexed failures,
            and property_problems: items placed with a property that was
            not written. Known unsupported properties (IsHidden on anything but pins,
            parameters, designators and sheet names; Text on a type without
            it, such as eParameterSet or eWire) reject that item before
            registration.
            Its failure includes reason UNSUPPORTED_PROPERTY, property and
            object_type. Other valid items still run.
obj_batch_deletetool Delete objects for many scope/type/filter sets (obj_delete items).Filesoutside text
Delete objects for many scope/type/filter sets (obj_delete items).

        What ``obj_delete(items=[...])`` runs, kept under this name for
        callers that use it. One round trip.

        Args:
            operations: List of delete dicts, each with:
                - scope: "active_doc" (default), "project", or
                  "doc:<absolute_path>".
                - object_type: Altium type name (e.g. "eJunction",
                  "eNoERC", "eWire", or a PCB type such as
                  "eTrackObject", which deletes from the active board
                  and takes only scope "active_doc").
                - filter: pipe-separated ``PropName=Value`` filter
                  conditions (AND logic), same format as
                  ``obj_delete``. An EMPTY filter deletes every object
                  of that type in that scope.
            confirm_delete_all: required when any operation has an empty
                filter; otherwise nothing is sent.

        Returns:
            operations_processed, total, total_deleted and ``results``
            (per operation ``deleted`` and a ``note`` when it deleted
            nothing). An operation that stopped part way has a note
            starting ``partial:`` and its ``deleted`` counts what it
            removed; ``operations_partial`` counts them. One whose filter
            met sheet system parameters (never removed) names them in a
            note ``kept system parameters: ...``. Query before
            repeating a batch that failed or timed out.
obj_batch_modifytool Apply many filter+set operations in ONE call (obj_modify items).Filesoutside text
Apply many filter+set operations in ONE call (obj_modify items).

        What ``obj_modify(items=[...])`` runs, kept under this name for
        callers that use it.

        No rollback: ops that ran before a failure stay applied. After a
        designator batch, check the netlist: duplicate designators merge
        nets silently. proj_annotate renumbers without duplicates.

        Args:
            operations: List of operation dicts, each with:
                - scope: "active_doc" (default), "project",
                  "doc:C:\\path\\to\\file.SchDoc", or "lib_component:NAME"
                  (a symbol in the active SchLib; ops may name different
                  symbols).
                - object_type: e.g. "ePin", "eParameter", "eSchComponent",
                  or a PCB type such as "eTrackObject" (active board,
                  scope "active_doc" only).
                - filter: Pipe-separated conditions, e.g. "Name=VDD".
                - set: Pipe-separated assignments, e.g.
                  "Location.X=300|Location.Y=-100|Orientation=2". A value
                  may contain ';' but not '|'.

        Returns:
            operations_processed, operations_skipped, total_matched, and
            per-op ``results`` with ``matched`` and a ``note``
            ("no_objects_matched" when nothing matched).

        Example op: ``{"scope": "lib_component:R_0402", "object_type":
        "ePin", "filter": "Designator=1", "set": "Name=A"}``.
obj_clear_highlightstool Clear all net highlights in the active schematic or PCB document.
Clear all net highlights in the active schematic or PCB document.

        On a schematic a highlight is a selection, so the whole sheet is
        deselected (no count is reported).

        Returns:
            Dictionary confirming highlights were cleared
obj_copytool Copy matching schematic objects to the clipboard.
Copy matching schematic objects to the clipboard.

        Selects objects matching the filter, copies them to the system
        clipboard, then clears selection.

        Args:
            object_type: Altium schematic object type (see `obj_query`)
            filter: Pipe-separated property=value conditions (AND logic)

        Returns:
            Dictionary with count of copied objects
obj_counttool Count objects of a type without reading their properties.
Count objects of a type without reading their properties.

        On a board with NO filter Altium's own counter answers at once;
        with a filter it searches like `obj_query` (an indexed filter keeps
        that quick, see there).

        Args:
            object_type: Altium object type constant (see `obj_query` for options)
            scope: "active_doc" (default), "project", or
                "doc:C:\\path\\Sheet.SchDoc" for a specific loaded sheet.
                A PCB type counts the active board and takes no other
                scope (SCOPE_NOT_SUPPORTED).
            filter: Pipe-separated property=value conditions (AND logic)

        Returns:
            Dictionary with "count" (and "sheets_processed" for project scope)
obj_createtool Create and place a schematic object.Filesoutside text
Create and place a schematic object.

        For several, give ``items``: a list of {object_type, properties,
        container} dicts, created in ONE Altium transaction (one undo
        step); arguments given beside ``items`` apply to every item.

        Args:
            object_type: Altium object type constant (see `obj_query`)
            properties: Pipe-separated property=value assignments, e.g.:
                "Text=MY_NET|Location.X=100|Location.Y=200"
            container: "document" (place on active schematic) or
                      "component" (add to current library component)
            items: Several objects at once (see above).

        Example, three net labels in one call:
            obj_create(object_type="eNetLabel", items=[
                {"properties": "Text=VCC|Location.X=100|Location.Y=200"},
                {"properties": "Text=GND|Location.X=100|Location.Y=400"},
                {"properties": "Text=SCK|Location.X=300|Location.Y=200"}])

        Shapes take their geometry here, in mils and degrees: Radius,
        StartAngle, EndAngle on sch_arc (0 to 360 is a circle) and
        elliptical_arc; SecondaryRadius on elliptical_arc and ellipse
        (Radius is the X radius); Vertices "x1,y1,x2,y2,..." on polyline
        (2 points or more), sch_polygon (3 or more) and bezier (4, 7,
        10 ... points); StartLineShape,
        EndLineShape (None, Arrow, Solid Arrow, Tail, Solid Tail, Circle,
        Square) and LineShapeSize on polyline; FileName, EmbedImage,
        KeepAspect and Corner.X / Corner.Y on image.

        Returns:
            Dictionary confirming creation, and ``properties``: the names
            not written (unknown, or a value the object did not keep).
            With items: created, failed, total, the failures by index,
            and property_problems. Known unsupported properties
            (IsHidden on anything but pins, parameters, designators and
            sheet names; Text on a type without it, such as eParameterSet
            or eWire) reject that item before registration with reason
            UNSUPPORTED_PROPERTY; the other items still run.
obj_crossref_nettool Compare the schematic vs PCB membership of a named net.
Compare the schematic vs PCB membership of a named net.

        The schematic's pins and the board's pads on the net, and the
        difference both ways: ``pcb_only`` pins are connections an Update
        PCB from Schematic would remove.

        Args:
            net_name: Exact net name as it appears in the schematic
                (case-sensitive).

        Returns:
            Dict with:
              - net_name
              - sch_pin_count, pcb_pin_count
              - matched (count of pins present on both sides)
              - sch_only_count, pcb_only_count
              - in_sync (True only when both sides list the same pins
                AND the net exists on at least one side)
              - sch_pins[], pcb_pins[], each entry is
                "Designator.PinNumber"
              - sch_only[] (missing from the board), pcb_only[] (on
                the board only)
obj_deletetool Find and delete schematic or PCB objects.Filesoutside text
Find and delete schematic or PCB objects.

        For several type/filter sets at once, give ``items``: a list of
        {scope, object_type, filter} dicts, run in one round trip; an item
        with an empty filter needs confirm_delete_all, or nothing is sent.
        Arguments given beside ``items`` apply to every item.

        A PCB type deletes from the active board (with a library or sheet
        in front: the only open board, brought forward; in a footprint use
        lib_delete_footprint_primitives). It also
        matches footprint primitives and polygon hatching unless the
        filter says "InComponent=false|InPolygon=false". To take up
        routing use ``pcb_unroute``.

        Args:
            object_type: Altium object type constant (see `obj_query`)
            scope: "active_doc", "project", "doc:PATH", or
                "lib_component:NAME" (a named symbol in the active SchLib).
                A PCB type takes only "active_doc"; any other is refused
                (SCOPE_NOT_SUPPORTED) and nothing is deleted.
            filter: Pipe-separated property=value conditions (AND logic).
                    WARNING: empty filter deletes ALL objects of the type.
            confirm_delete_all: Must be True to delete all objects when filter is empty.
            items: Several deletes at once (see above). Reply:
                operations_processed, total, total_deleted and per-item
                ``results`` with ``deleted``; ``partial:`` notes and
                ``operations_partial`` as for a single delete.

        A filter that is not Name=Value pairs (an Altium query expression
        such as ``OnLayer('TopLayer') Or ...``, or a bare name) is refused,
        and nothing is deleted.

        Returns:
            Dictionary with "matched" count (number deleted). When a
            removal fails part way, ``partial`` is true, ``delete_error``
            says why, and ``matched`` still counts the objects already
            removed. Query before repeating a delete that failed or timed
            out: the first part of it may already have happened.
            A sheet's system parameters (Title, Author, Revision ...) are
            never removed (Altium recreates one with the value * on the
            next load): a filter that meets one leaves it, names it in
            ``kept_system_parameters`` and answers ``success`` false.
            Change or clear one with obj_modify (set Text).
obj_deselect_alltool Clear all object selection on the active document.
Clear all object selection on the active document.

        Returns:
            Dictionary confirming deselection
obj_explain_pintool Explain WHY a schematic pin is on the net it is on.
Explain WHY a schematic pin is on the net it is on.

        Lists every object at the pin's CONNECTION point (what drives its
        net; two different labels there is a short) and at its body-side
        ROOT (electrically inert; a label there leaves the pin floating).
        A label at the root belongs at ``connect_x_mils`` /
        ``connect_y_mils``. Objects match by exact location, not
        bounding box.

        Without ``sheet_path`` the active sheet is searched first, then
        the sheets of the project (``project_path``, or the focused one),
        so two open projects that both have a U1 answer for the sheet
        in front of you.

        Args:
            designator: Component designator, e.g. "U10".
            pin: Pin NUMBER (not pin name), e.g. "5".
            sheet_path: Search only this open SchDoc.
            project_path: Search this project's sheets (.PrjPcb path)
                instead of the focused project's; the active sheet is
                then not searched first.

        Returns:
            ``designator, pin, pin_name, sheet, sheet_path`` (the full
            path of the sheet the pin is on), ``found_on``
            (named_sheet, active_sheet_in_project,
            active_sheet_outside_project or project), ``orientation,
            pin_length_mils, root_x/y_mils, connect_x/y_mils,
            compiled_net`` (from the project's netlist, only when the
            sheet is in that project), and ``at_connection`` /
            ``at_root`` lists of ``{kind, text, x_mils, y_mils}``.
obj_get_document_infotool Get comprehensive info about the active document.
Get comprehensive info about the active document.

        For schematics: file path, kind, sheet size, title block visibility,
        snap grid, visible grid, unit system, and custom dimensions.
        For PCB: file path, kind, origin, snap grid.

        Returns:
            Dictionary with document properties
obj_get_font_idtool Get or create a font ID for the given font properties.
Get or create a font ID for the given font properties.

        Looks up (or creates) an entry in the Altium font table matching the
        specified properties and returns its font ID. Use the returned font_id
        to set an object's FontId property via `obj_modify`: labels, net
        labels, power objects, cross-sheet connectors, parameters,
        designators, sheet names, ports, text frames and notes. A sheet
        entry's or harness entry's label font is TextFontId.

        Args:
            size: Font size in points (e.g., 8, 10, 12)
            font_name: Font family name (default "Arial")
            bold: Whether the font is bold
            italic: Whether the font is italic
            rotation: Text rotation in degrees (0, 90, 180, 270)
            underline: Whether the font is underlined
            strikeout: Whether the font has strikeout

        Returns:
            Dictionary with font_id
obj_get_font_spectool Get font properties for a given font ID.
Get font properties for a given font ID.

        The font an object's FontId names.

        Args:
            font_id: Font ID from an object's FontId property

        Returns:
            Dictionary with font_id, size, rotation, bold, italic, underline,
            strikeout, font_name
obj_highlight_nettool Highlight a net by name in the focused schematic or PCB document.
Highlight a net by name in the focused schematic or PCB document.

        On a board it sets the net's IsHighlighted. On a schematic it
        SELECTS the matching net labels, power ports, ports and sheet
        entries on the active sheet, replacing the selection. It follows
        the focused document; ``context`` forces "pcb" or "schematic".

        Args:
            net_name: Exact net name to highlight (e.g., "VCC", "GND",
                "NET_D0"). Returns NOT_FOUND if the net doesn't exist
                on the PCB, or `highlighted=0` on schematic if no
                primitive carries that net name on the active sheet
                (check other sheets).
            clear_existing: Clear existing highlights first (default True).
            context: Empty (default, follow the focused document),
                "schematic", or "pcb".

        Returns:
            Dict with success, net, context ("pcb" or "schematic"), and
            `highlighted` (count of matches, 1 for PCB, N for sch).
obj_modifytool Apply ONE set of property values to every object matching ONE filter.Filesoutside text
Apply ONE set of property values to every object matching ONE filter.

        When each object needs a DIFFERENT value (10 pins to 10 positions,
        distinct designators), give ``items``: a list of
        {scope, object_type, filter, set} dicts, one per filter: ONE
        request, but each item is its own search and edit (its own undo
        step); arguments given beside ``items`` apply to every item. No rollback: items before a failure
        stay applied. After a designator list, check the netlist: duplicate
        designators merge nets silently (proj_annotate renumbers without
        duplicates). With items a value in ``set`` may hold ';' but no
        field may hold '~~'.

        Args:
            object_type: Altium object type constant (see `obj_query`)
            set: Pipe-separated assignments, e.g. "Text=NEW_NAME" or
                "Location.X=100|Location.Y=200". Board lengths are
                decimal mils; a non-number is reported failed, never
                written as 0. Board properties include, besides the
                usual geometry: HolePositiveTolerance and
                HoleNegativeTolerance on pads and vias ("unset" when
                none is set; Altium keeps a negative tolerance as its
                size; IsCounterHole reads); BarCode* and Multiline* on a
                text (their sizes follow the text: read them back); TextHeight,
                TextFormat, TextPrecision, TextPrefix, TextSuffix,
                Arrow* and Extension* on a dimension; PolygonType,
                BorderWidth, AvoidObsticles (Altium's spelling),
                ClipAcuteCorners, MitreCorners, IgnoreViolations and
                ArcPourMode on a pour; EnablePinSwapping and
                EnablePartSwapping on a part (IsBGA reads); also on a
                part LockStrings, PrimitiveLock,
                NameAutoPosition and CommentAutoPosition
                (Altium's anchor numbers), FootprintDescription, DefaultPCB3DModel
                (PackageSpecificHash reads), SourceDescription,
                JumpersVisible, ChannelOffset and GroupNum; on a board
                pad JumperID, SwapID_Pad, SwapID_Part, SwappedPadName and
                OwnerPart_ID; on pads and vias PasteMaskExpansionMode and
                SolderMaskExpansionMode (Altium's numbers: from the rule or
                manual), PasteMaskUsePercent, PasteMaskPercent and
                PasteMaskEnabled; on any board object DetailString,
                DRCError, UniqueID and IsElectricalPrim (reads); on any
                schematic object DescriptionString, IdentifierString and
                ErrorString (reads); on tracks, arcs and vias IsPreRoute
                and UserRouted; on a pour DrawRemovedNecks,
                DrawRemovedIslands, DrawDeadCopper, ExpandOutline and
                AutoGenerateName; on board text Inverted,
                UseInvertedRectangle, InvertedTTTextBorder,
                TTFInvertedTextJustify, TTFOffsetFromInvertedRect and
                ConvertedString (reads: the text as shown) and
                UnderlyingString (reads: the text as typed); on a 3D body OverrideColor (draw its
                own colour, not the model's), Texture (an image file) and
                TextureRotation; on a board pad DrillType (how the hole
                is made: 0 drilled, 1 punched, 2 laser, 3 plasma) and
                IsVirtualPin (reads); on a placed part FlippedOnLayer
                (reads: its "flip on layer" option, not its side); on
                board text BorderSpaceType (Altium's number).
                Schematic pins take
                Symbol_Inner, Symbol_Outer, Symbol_InnerEdge,
                Symbol_OuterEdge and Symbol_LineWidth (Altium's numbers),
                HiddenNetName and DefinedFunctions (the pin's functions,
                ";"-separated; writing replaces the list); schematic parts
                take ShowHiddenPins, ShowHiddenFields, PinsMoveable,
                PartIdLocked, DisplayFieldNames, OverideColors (Altium's
                spelling) and PinColor. Pins also take where their name
                and number sit: Name_PositionMode,
                Name_CustomPosition_Margin,
                Name_CustomPosition_RotationAnchor,
                Name_CustomPosition_RotationRelative and the same four
                for Designator_ (Altium's numbers), DefaultValue and
                FormalType; schematic parts also LibraryPath (the library
                the symbol came from) and AliasAsText. Schematic parameters
                take ReadOnlyState, ParamType, AllowLibrarySynchronize
                and AllowDatabaseSynchronize, and report NameIsReadOnly,
                ValueIsReadOnly, IsRule, IsSystemParameter and
                IsConfigurable, and with designators ShowName,
                Autoposition and GraphicallyLocked (not saved); ports
                take AutoSize,
                OverrideDisplayString and HarnessColor (not saved).
                Styles of notes, frames, shapes, ports, power
                ports and off-sheet connectors: tool_guide.
                Symbol pins
                take SwapIdPart (shared by every pin of the part),
                SwapIdPin, SwapIdPair, SwapIdPartPin.
            scope: "active_doc" (default), "project" (all SCH sheets),
                "doc:C:\\path\\Sheet.SchDoc" (no focus change), or
                "lib_component:NAME" (a symbol in the active SchLib,
                selected for you). A board type takes only the default:
                any other is refused (SCOPE_NOT_SUPPORTED).
            filter: Pipe-separated property=value conditions (AND logic)
            items: Several filter+set operations at once (see above).

        Returns:
            "matched", "sheets_processed", and on a schematic "modified"
            (something was written) with "saved" false: the sheet is
            marked modified, not saved; app_save_all writes it.
            On a board "reindexed" and "stale_index": objects the write
            dropped from the board's index, put back or not.
            With items: operations_processed, operations_skipped,
            total_matched and per-item ``results`` with ``matched`` and a
            ``note`` ("no_objects_matched" when nothing matched).

        Example - rename a net on every sheet:
            obj_modify(object_type="eNetLabel", scope="project",
                       filter="Text=OLD_NET", set="Text=NEW_NET")
        Example - edit a pin on any part of a multi-part SchLib symbol:
            obj_modify(object_type="ePin", scope="lib_component:R_0402",
                       filter="Designator=1", set="Name=A")
        Example - put board copper on a net, or take it off (track, arc,
        via, pad, fill, region, polygon; the net must exist, "" = no net):
            obj_modify(object_type="eRegionObject",
                       filter="Layer=TopLayer|Net=GND", set="Net=")
obj_querytool Query schematic OR PCB objects and read their properties.
Query schematic OR PCB objects and read their properties.

        Args:
            object_type: Altium object type constant.
                Schematic: "eNetLabel", "ePort", "ePowerObject", "eSchComponent",
                "eWire", "eBus", "eBusEntry", "eParameter", "eParameterSet", "ePin",
                "eLabel", "eLine", "ePolyline", "eRectangle", "eSheetSymbol", "eSheetEntry",
                "eNoERC", "eJunction", "eBlanket" (outline in "Vertices",
                settable as "x1,y1,x2,y2,..."; also "LineStyle",
                "Collapsed"); symbol graphics as "sch_polygon",
                "sch_arc", "sch_ellipse", "sch_elliptical_arc", "sch_bezier"
                (plain "polygon" and "arc" are the board's), the bare
                "ellipse", "elliptical_arc" and "bezier", "eDesignator",
                "eRoundRectangle", "eIEEESymbol" (Symbol, ScaleFactor)
                PCB: "eTrackObject", "ePadObject", "eViaObject", "eComponentObject",
                "eArcObject", "eFillObject", "eTextObject", "eRuleObject", "eDimensionObject",
                "eSplitPlaneObject" (a plane layer's regions, with Net
                and Layer),
                "eConnectionObject" (the ratsnest: one line per unrouted
                connection, with X1, Y1, X2, Y2, Layer1, Layer2 and Net)
            properties: Comma-separated property names to return.

                SCHEMATIC objects use the dotted spelling:
                "Text,Location.X,Location.Y" for net labels;
                "Designator,Name,ConnectionX,ConnectionY" for pins
                (ConnectionX/Y is the ELECTRICAL end a wire must touch;
                Location is the body-side root);
                "Designator.Text,Comment.Text,LibReference" for
                components, "DisplayMode,DisplayModeCount" and
                "DisplayModeNames" (the alternate drawing; names
                ";"-separated from Normal; settable) and
                "FootprintPinMap" (the current footprint model's pin map,
                "(G:1),(D:2),(S:3)"; obj_modify also takes "G:1;D:2" and
                merges by schematic pin, so a map cannot be cleared).
                "ComponentKind" is its Component Type, read and set by
                name: standard, mechanical, graphical, net_tie_bom,
                net_tie_no_bom, standard_no_bom or jumper; with scope
                "lib_component:NAME" it sets a library symbol's.
                "TextFontId" is a sheet or harness entry's label font;
                "OwnerSheetSymbol" an entry's symbol. A
                managed component also reads
                "LibraryIdentifier,DesignItemId,ItemGUID,RevisionGUID"
                and the other Vault/Symbol GUIDs.

                PCB PRIMITIVES ARE FLAT, NOT DOTTED: a track's net is
                "Net", never "Net.Name". "Net,Layer,Width" for tracks;
                "Net,Layer,HoleSize,Size" for vias;
                "Designator,Comment,Pattern,Rotation,X,Y,NameOn,CommentOn"
                for components; "Text,Height,StrokeWidth,IsDesignator,
                IsHidden" for texts, and "MirrorFlag" (settable; the text
                stays put). Polygons ("polygon") read and set their pour
                settings: "Name,Grid,TrackSize,
                MinTrack,ArcApproximation,NeckWidthThreshold" (decimal
                mils), "IslandAreaThreshold" (square mils),
                "PolyHatchStyle,PourOver" (raw ordinals), "UseOctagons",
                and the read-only "PourIndex,Poured"; nothing repours.

                A board type returns EVERY primitive of that type
                ("InComponent=false|InPolygon=false": free copper).
                Mechanical-layer tracks have no net. On a board only an
                exact Net=,
                Component= or BoundsLeft/BoundsBottom (X1/Y1) is indexed;
                any other condition (X=, Y=) is checked on every object
                (Layer=: one layer's).
            scope: "active_doc" (default); "project" (every sheet of the
                focused project); "doc:PATH" or the bare path (that sheet,
                no focus change); "project:PATH"; "lib_component:NAME" (a
                symbol in the active SchLib), "lib_component:NAME@3" for
                part 3 of a multi-part one (else only part 1 is seen;
                OwnerPartId 0 = shared). Anything else: INVALID_SCOPE.
            filter: Pipe-separated property=value conditions (AND), e.g.
                "Text=VCC" or "Designator.Text=R1"; "" matches all.
                Numbers match as numbers ('.' or ','): Location.Y=9000.0
                meets 9000; text matches exactly.
                "Net!=GND" excludes; "Y>4250|Y<=5000" compares numbers;
                "Name~POUR_*" matches a wildcard pattern (* any run, ? one
                character, case ignored), "Net!~VCC*" excludes by one. A
                PCB Layer takes the internal name ("Mechanical21") or the
                board's own, any case; ~ meets either; no layer: refused.
                Same grammar in obj_modify, obj_delete, obj_select, obj_count.
            limit: Most objects to return (0 = all); it also ends the
                search early, and count is then the number returned.

        Returns:
            "objects", "count"; "not_on_this_type": properties the type
            lacks.
obj_refresh_documenttool Force a redraw/refresh of the current document.
Force a redraw/refresh of the current document.


        Returns:
            Dictionary confirming the refresh
obj_run_processtool Run an Altium process command via the generic primitive layer.Filesoutside text
Run an Altium process command via the generic primitive layer.

        Wraps any Altium RunProcess call with structured pipe-separated parameters.

        Args:
            process_name: The Altium process identifier (e.g., "Sch:Compile",
                "WorkspaceManager:OpenObject", "PCB:Zoom")
            parameters: Optional pipe-separated key=value parameter pairs, e.g.:
                "ObjectKind=Document|FileName=C:\\path\\to\\file.SchDoc"
                PCB:AutoRoute, Altium's own autorouter, is refused
                (AUTOROUTER_NOT_ALLOWED) unless the user has set "Altium
                autorouter" to Allowed on the Config tab: route with
                pcb_route_brief and pcb_route_round.

        Returns:
            Dictionary with execution result. Success means the process
            was dispatched: Altium accepts an unknown process silently,
            so read the design back to see what it did.
obj_selecttool Select objects matching a filter on the active document.
Select objects matching a filter on the active document.

        Sets the selection state on matching schematic or PCB objects for
        visual highlighting. Use `obj_deselect_all` to clear. On a board
        it ignores Altium's Selection Filter and searches twice (select,
        then read back): an indexed filter (see `obj_query`) keeps that
        quick. With a library or sheet in front a PCB type acts on the
        only open board.

        Args:
            object_type: Altium object type (schematic or PCB)
            filter: Pipe-separated property=value conditions (AND logic)

        Returns:
            ``{"matched": N, "selected": M, "success": bool}``. ``matched``
            is what the filter picked; ``selected`` is how many of those
            read back as selected afterwards, and ``success`` is false
            with a ``reason`` when that is fewer. A select reports
            nothing about property readability.
obj_set_gridtool Set the snap, visible and electrical grids for the active
Set the snap, visible and electrical grids for the active
        schematic. pcb_set_grids sets a board's grids.

        Args:
            snap_grid: Snap grid size in mils (0 = don't change); a metric
                grid in mils keeps its fraction (0.5 mm = 19.685)
            visible_grid: Visible grid size in mils (0 = don't change)
            snap_grid_on: Switch the snap grid on or off (None = don't change)
            visible_grid_on: Switch the visible grid on or off (None = don't change)
            hotspot_grid: Electrical grid in mils, how far a wire end is
                pulled onto a pin or wire (0 = don't change)
            hotspot_grid_on: Switch the electrical grid on or off (None =
                don't change)

        Returns:
            Dictionary with the resulting grid sizes and on/off state
obj_switch_viewtool Switch the focused board or footprint library (.PcbLib)Filesoutside text
Switch the focused board or footprint library (.PcbLib)
        between 2D and 3D view.

        Args:
            mode: "3d" or "2d" (default "3d").
            camera: 3D only, where the view ends: "top", "iso"
                (tilted), "bottom", "front", "back", "left" or "right";
                empty keeps the current camera.
            fit: frame everything (in 3D from above, one step out).
            views: 3D only, cameras to turn through first, each held a
                moment, e.g. "iso,bottom,front" to show a model from
                several sides.
            footprint_name: in a .PcbLib, the footprint to show; without
                it the editor shows whichever footprint is current. With
                another document in front, the only open .PcbLib is
                brought forward first.

        Returns:
            Dictionary confirming the view switch
obj_zoomtool Control the viewport zoom level of the focused document.
Control the viewport zoom level of the focused document.

        Works on a schematic, a schematic library, a board and a footprint
        library; the focused tab decides which editor zooms.

        Args:
            action: "fit" (Fit All Objects, which can cut a sheet's frame
                off), "document" (a schematic's Fit Document: the whole
                sheet with its frame), "board" (the board outline with
                a margin, not parts parked beside it; a schematic fits
                as "fit"),
                "selection" (zoom to selected objects), "point" (zoom
                to x, y) or "object" (centre a named object on a
                schematic sheet, see name)
            x, y: the point for "point", in mils (a footprint's frame in
                a PCB library)
            radius: half the width of the square the view is fitted to
                round the point, mils (default 200)
            name: for "object": a part's designator, a net label, port,
                power port or off-sheet connector name, or a harness
                connector's type; case is ignored. The reply lists every
                match with its box (what Altium outlines when selected)
            scale: for "object": how much of the window the object's box
                fills, percent (default 50)
            index: for "object": which match to show, from 1 (default 1)

        Returns:
            Dictionary confirming the zoom action
part_searchtool Search EVERY enabled part provider and merge the results.Env vars
Search EVERY enabled part provider and merge the results.

        All providers count equally; hits are ordered by provider then
        part, which is NOT relevance. A provider that cannot answer says
        why ("unavailable" is not "no such part"). Each hit has a
        ``kind``: "library" gives geometry (symbol or footprint),
        "catalogue" gives identity (MPN, datasheet, stock) and no
        geometry. Remote providers need the internet; local ones still
        answer without it. An empty query lists the providers.

        DATASHEET DISCIPLINE: a hit is a lead. Blank ``provenance`` or
        ``license`` means unknown; audit an imported footprint with
        lib_audit_footprint_vs_datasheet before trusting it.

        Args:
            query: Substring of part name, manufacturer or keywords.
            limit_per_provider: Cap per provider.

        Returns:
            {"ok", "count", "providers": {name: status}, "hits",
            "by_mpn"} (the same part across providers; wildcard part
            numbers are not merged), or {"ok", "providers"} for an empty
            query.
pcb_add_bend_linetool Add a bend line across a flex board region, from (x1, y1) to
Add a bend line across a flex board region, from (x1, y1) to
        (x2, y2) in mils from the board origin, with its bend radius, bend
        angle in degrees and fold order (the order bends are folded in 3D).
        The region is named as pcb_get_board_regions lists it, or
        "#<index>". Altium stretches the line to the region's edges; a
        line that does not cross the region is refused.

        Returns:
            The rigid-flex setup afterwards, the new line in
            ``bend_lines``.
pcb_add_drill_pairtool Add a drill layer pair between two copper layers, for blind and
Add a drill layer pair between two copper layers, for blind and
        buried vias.

        Args:
            low_layer, high_layer: Layer names as the board shows them
                ("Top Layer", "Mid-Layer 1", ...).

        Returns:
            ``count_before``, ``count_after`` and ``pairs`` (as
            pcb_get_drill_pairs lists them).
pcb_add_layertool Insert a copper layer into the PCB layer stack, then save andFiles
Insert a copper layer into the PCB layer stack, then save and
        reopen the board so every via counts on the new layer.

        Valid names include MidLayer1..MidLayer30 (signal layers) and
        InternalPlane1..InternalPlane16 (power / ground planes). Top / Bottom
        are always present, they cannot be added; a layer already in the
        stack is refused (ALREADY_IN_STACK) and nothing is saved. With ``above`` or
        ``below`` (a layer already in the stack) it goes in at that place;
        otherwise Altium chooses.

        THIS SAVES THE BOARD, with every change made to it so far. A via
        placed since the board was opened does not count on a layer added
        after it was opened until the board is loaded again, and a pour
        there that removes dead copper stays empty. ``reopen=False`` adds
        the layer without saving: vias loaded with the board count at
        once, the others after a save and reopen (``note``).

        Args:
            layer: Layer name, e.g. "MidLayer1", "InternalPlane1"
            above: Put it directly above this layer.
            below: Put it directly below this layer.
            reopen: Save, close and reopen the board after the insert.

        Returns:
            ``layer`` and ``stack_order``, the copper layers top down;
            ``vias_refreshed``: free vias taken off the board and added
            back (a via in a component is left, ``vias_in_components``);
            ``reopened`` with ``saved``. ``reopened`` false carries
            ``reopen_stage`` and ``reopen_reason`` (a board never saved to
            a file is one) and the ``note``: the layer is in, the board
            is as it was left.
pcb_add_pad_via_templatetool Make a pad or via template in the board's own pad/via library.
Make a pad or via template in the board's own pad/via library.

        From a pad (``component`` and ``pad``) or a via (``x``, ``y`` in
        mil from the board origin). Altium names the template from the
        object's shape and sizes, as "r55_60r14". The object itself is
        not linked to the template. Save the board to keep it.

        Args:
            component: Designator of the part that has the pad.
            pad: The pad's name on that part.
            x: A via's x, mil.
            y: A via's y, mil.
            board_path: The .PcbDoc. Defaults to the focused board.

        Returns:
            ``templates_before``, ``templates_after`` and
            ``board_templates`` read back.
pcb_add_teardropstool Add teardrops through Altium's Teardrops dialog.Filesoutside text
Add teardrops through Altium's Teardrops dialog.

        With Dialogs Automatic (Config tab) the tool sets Add, the scope
        and the options given, then OK; None keeps the dialog's value.
        Otherwise the dialog waits for the user. A repour can delete them.

        Args:
            scope: "all" or "selected".
            via_th_pads, smd_pads, tracks, t_junctions: Objects to treat.
            force: Place even where a rule is broken.
            adjust_size: Shrink one that would not fit.

        Returns:
            ``teardrops_before``, ``teardrops_after``, ``dialog``.
pcb_add_testpoints_for_net_classtool For each net in a netclass with no testpoint yet, place a pad
For each net in a netclass with no testpoint yet, place a pad
        with the net and testpoint flags, in a row above the board, to be
        moved into place.

        A net counts as covered when any pad or via on it carries any of
        the four testpoint flags; ``force`` places anyway.

        Args:
            net_class: Netclass name to scan.
            type: ``"smd"`` (top-layer SMD pad, no hole) or
                ``"through_hole"`` (multi-layer pad with drill).
            pad_size_mils: Outer pad size in mils. Default 40.
            hole_size_mils: Drill diameter, only used for through-hole
                testpoints. Default 20.
            fab_top: Set ``IsTestpoint_Top`` (top-side bed-of-nails).
            fab_bottom: Set ``IsTestpoint_Bottom``.
            assy_top: Set ``IsAssyTestpoint_Top`` (top-side assembly
                probe). Default True.
            assy_bottom: Set ``IsAssyTestpoint_Bottom``.
            force: Ignore existing testpoint coverage and always
                place a new pad.

        Returns:
            Dict with ``{net_class, type, placed, skipped_already_covered,
            placed_nets[], skipped_nets[]}``.
pcb_align_componentstool Align multiple PCB components along a common edge or center.
Align multiple PCB components along a common edge or center.

        Args:
            designators: Comma-separated component reference designators
                (e.g., "R1,R2,R3,R4")
            alignment: Alignment mode. Options:
                "left" - Align to leftmost X
                "right" - Align to rightmost X
                "top" - Align to topmost Y
                "bottom" - Align to bottommost Y
                "center_x" - Center horizontally
                "center_y" - Center vertically

        Returns:
            Dictionary with alignment result and component count
pcb_apply_dnp_paste_exclusiontool Suppress stencil paste on Not-Fitted (DNP) components, so no
Suppress stencil paste on Not-Fitted (DNP) components, so no
        paste lands on empty pads. Each surface pad gets a paste expansion
        of minus its larger size; through-hole pads are skipped.

        Apply with no ``designators`` uses the current variant's
        Not-Fitted list. RESTORE THE SAME LIST YOU APPLIED: restore
        refuses without ``designators``, because restoring from a
        different variant would silently leave a fitted part without
        paste. Pass back the ``items`` the apply returned.

        Args:
            designators: Components to treat (apply default: the current
                variant's Not-Fitted list; required for restore).
            restore: Remove the override so the design rules apply again.
            dry_run: Report what would change, change nothing (use first).
            use_current_variant: Let a restore with no designators use the
                current variant (you own that choice).

        Returns:
            ``restored``, ``components_requested`` vs
            ``components_matched``, ``pads_changed``,
            ``pads_skipped_through_hole``, ``items``; a dry run gives
            ``designators`` and ``source``; a refused restore gives
            {"ok": False, "reason"} and touches nothing.
pcb_apply_policy_rulestool Bring the active board's design rules to the policy'sFilesEnv varsoutside text
Bring the active board's design rules to the policy's
        board_rules.json (in EDA_AGENT_POLICY_DIR).

        Rules the board lacks are created; rules it has are rewritten to
        the policy's values and read back. Rules the policy does not list
        are only named in ``extra``; nothing is deleted. Running it again
        changes nothing new.

        Args:
            apply: False (default) only reports what it would do.

        Returns:
            ``create``, ``update`` (each with ``write`` and ``differs``, the
            readable fields that differ now) and ``extra``; with apply,
            ``results`` per rule and ``failed``.
pcb_apply_stackup_templatetool Give the active board a fab stack-up's thicknesses and Dk.Filesoutside text
Give the active board a fab stack-up's thicknesses and Dk.

        A dry run by default: it returns the ``pcb_modify_layer`` calls it
        would make. With ``dry_run=False`` it makes them, each read back.
        Existing layers only: a board with a different copper count is
        refused (add or remove layers first). If a call fails part way,
        the result says which layers changed and which did not.

        Args:
            template: stack-up name, e.g. "JLC04161H-7628"
            dry_run: True to only plan (default)

        Returns:
            ``{"ok", "template", "calls", "dry_run"}``, plus per-layer
            ``results`` and ``changed`` / ``not_changed`` when applied.
pcb_apply_via_templatetool Make free vias match a source via: its via template, hole and diameter.
Make free vias match a source via: its via template, hole and diameter.

        Point at a via using the wanted template; every other free via, or
        those matching the filters, takes its template link, mode, hole
        and diameter, e.g. to meet a template-mode Routing Via rule
        (AD22+). Diameter and hole are read back, the link cannot be, so
        check one via in Properties. Larger vias can break clearance: run
        DRC.

        Args:
            source_x, source_y: A point on the source via, in mils.
            net: Only vias on this net.
            from_size_mils, from_hole_mils: Only vias at this size now.
            dry_run: Report what would change and change nothing.

        Returns:
            ``source`` (position, size, hole, net), ``changed``, ``failed``,
            ``before``/``after`` counted by "diameter/hole" in mils.
            Refused with LOCAL_STACK for a source with a per-layer stack
            and NO_ANNULAR_RING for a source without a ring.
pcb_audit_pad_center_connectedtool Find pads whose center has no copper entering it (acid-pad check).
Find pads whose center has no copper entering it (acid-pad check).

        For every netted pad, checks that a track / arc / via on the same net
        reaches the pad centroid. A pad connected only at its edge (an "acid
        pad") can fail in fab. Read-only; reports offenders with designator,
        pad, net, and location.

        Returns:
            {"checked": N, "offenders": M, "items": [...]}.
pcb_auto_position_texttool Put parts' designator and comment back in Altium's automaticFilesoutside text
Put parts' designator and comment back in Altium's automatic
        positions, or at a chosen anchor.

        With no position given, Altium re-places both texts at each
        part's current anchor (a part set to manual stays). Altium moves
        only text that is shown: a hidden designator or comment takes
        the anchor and keeps its place (``name_shown`` /
        ``comment_shown`` in the reply). Unlike pcb_autoplace_silkscreen,
        this does not look for clearance.

        Args:
            designators: The parts. ``None`` means every part.
            name_position, comment_position: One of manual, top_left,
                center_left, bottom_left, top_center, center,
                bottom_center, top_right, center_right, bottom_right
                (the part's own frame, so a rotated part turns them),
                or Altium's number 0 to 9.

        Returns:
            ``parts``, ``not_found`` and ``changed`` (each part's
            anchors, shown flags and text positions ``before`` and
            ``after``, the first 200).
pcb_auto_size_board_outlinetool Fit the board outline around the embedded-board array(s) plus a margin.
Fit the board outline around the embedded-board array(s) plus a margin.

        Use after `pcb_panelize` (or any embedded-board layout) to size the
        panel outline to its content. Unions the embedded boards' extents, adds
        `margin_mils` on every side, and converts the result to the board
        outline.

        Args:
            margin_mils: border added on each side (default 100).

        Returns:
            {"width_mils", "height_mils"}.
pcb_autoplacetool Place the focused board's parts with the in-house placer, as a job.
Place the focused board's parts with the in-house placer, as a job.

        Returns a job id at once; poll ``design_job_status``, and
        ``design_job_result`` gives the moves, wirelength before and after,
        overlaps and the DRC verdict. Nothing moves until
        ``pcb_autoplace_apply``. Parts keep their side; locked parts and
        mechanical ones (connectors, mounting holes, fiducials, test
        points, switches, batteries) stay unless named in ``parts``.
        Routing does not follow its parts: place first, or ``pcb_unroute``.

        Args:
            expect_file: Full path of the board; refused if another is
                focused.
            parts: Designators to move (default: all movable parts).
            compact: Use only the room the parts need (small circuit on a
                big board; analytic only).
            strategy: "blocks" (default: by sub-circuit, decoupling round
                each IC, repeated channels tiled, signal-flow order) or
                "analytic" (wirelength only). "blocks" falls back to
                "analytic" when its floorplan would push over a quarter of
                the parts (``fallback``).

        Returns:
            {"job_id", "board", "strategy", "read"} or {"error"}.
pcb_autoplace_applytool Move the parts of a finished ``pcb_autoplace`` job on the board.Filesoutside text
Move the parts of a finished ``pcb_autoplace`` job on the board.

        Refuses unless the focused board is ``expect_file``. With
        ``checkpoint`` (default), first snapshots the board's folder as it is
        ON DISK, so it can be restored with ``app_restore_checkpoint``;
        unsaved edits in the editor are not in it, so save first if there
        are any. Positions are whole mils, as the job reported and judged
        them.

        Args:
            job_id: a ``layout_place`` job that has finished.
            expect_file: full path of the board the job placed.
            checkpoint: take a checkpoint first (default True).

        Returns:
            ``{"moved", "failed", "expected", "checkpoint", "notes"}`` or
            ``{"error": ...}``.
pcb_autoplace_silkscreentool Move designators that break silk clearance to a clear position.
Move designators that break silk clearance to a clear position.

        A visible designator that is closer than the silk clearance to
        anything else on its overlay layer (component outlines, texts,
        fills), closer than the mask clearance to a pad's mask opening on
        its side, or off the board, is tried at a ring of auto-position
        anchors and left on the first that clears. A designator that is
        already clear is not touched, and one no anchor clears goes back
        where it was and is listed in ``unplaced_designators`` for a
        person. First-fit on bounding rectangles, so it errs towards
        "blocked"; run DRC after.

        Args:
            silk_clearance_mils: Silk to silk clearance. ``None`` reads the
                board's Silk To Silk rule.
            mask_clearance_mils: Silk to solder mask clearance. ``None``
                reads the board's Silk To Solder Mask rule.
            mask_expansion_mils: How far a pad's mask opening extends past
                its copper (default 4, Altium's default).
            designators: Only these components. ``None`` means all.
            rotations: Reading directions in board degrees, tried in
                order (``[0, 90]``: horizontal, else vertical). A
                designator at none of them is turned even when clear;
                each angle gets the whole anchor ring before the next.
                One that nothing clears keeps its own angle and place.
                Different parts, different directions: ``items``.

        Refused with NO_CLEARANCE, moving nothing, when a clearance is
        neither given nor readable from an enabled rule.

        Returns:
            ``placed``, ``turned`` (placed at a new angle),
            ``already_clear``, ``unplaced``, ``hidden``,
            ``total``, the placed and unplaced designators, and each
            clearance used with its source (``argument`` or the rule's
            name). ``skipped`` is ``unplaced + hidden``.
pcb_autoroutetool Route many nets in one run; to route a board use pcb_route_round.Filesoutside text
Route many nets in one run; to route a board use pcb_route_round.

        Rounds (pcb_route_round) route a group at a time, stop for your
        review and advise on nets left unrouted. This runs as a job.

        Returns a job id at once. Poll design_job_status; design_job_result
        gives the tracks and vias, the DRC verdict, the pours used as planes
        and the same ``review`` a round gives (per-net figures, a picture,
        ``questions``). Nothing is written until pcb_autoroute_apply, which
        refuses while a finding is unanswered. Stages: differential pairs,
        plane fanout, IC pin lanes, buses, then every other connection
        once, shortest first; nothing laid is moved, and a connection with
        no room is left unmade for you to decide. Turns and vias are
        priced, no bend is sharper than 90 degrees, pads are met by a
        dogleg onto their centre, no via goes in a passive's pad. Lays
        only what pcb_route_brief decides: a net with no entry is left
        out (decision_needed), a critical one without a source too
        (brief_needed).

        Args:
            expect_file: Full path of the board; refused if another board
                is focused.
            nets: Route only these nets (default: every net with 2+ pads).
            use_planes: Inner layers a pour covers are planes (default
                True); routed on only if a brief entry names the layer
                (else summary.plane_declined).
            diff_pairs: Route differential pairs (defined, else _P/_N,
                +/-, DP/DM names) first, coupled (default True).
            plane_fanout: Dog-bone via for every plane-net surface pad
                first (default False; it cost completion).
            pin_lanes: Keep 0.8 mm straight out of IC pins at 0.65 mm pitch
                or finer (default True).
            bus_lanes: Route 3+ nets between the same two parts as nested
                lanes (default True).
            gloss: Lay the routed tracks again as the shortest clean 45/90
                runs (default True).
            axis_entry: Reach surface pads only straight out of their centre
                along an axis.
            neck_pads: A net with a wider width rule than most keeps it,
                necking into a narrower pad (default True).
            join_existing: Route only what the board's copper leaves apart;
                a net it joins whole is left alone.
            exclude_layers: Copper layers no route may use (not one a
                net's surface pad is on).
            time_limit_s: Stop then, keeping what is made; 0: none.

        Returns:
            {"job_id", "board", "read": {pads, components, nets, layers}}
            or {"error"}. The job result adds ``via_in_pad`` (for fab
            notes), ``pairs`` (lengths, skew), ``buses`` and ``unreached``
            (pads left unrouted and what blocks them).
pcb_bevel_polygon_cornerstool Chamfer the corners of a copper polygon pour.
Chamfer the corners of a copper polygon pour.

        Replaces each sharp vertex with two points set back along its edges by
        bevel_mils (auto-clamped so neighbouring bevels never overlap), giving
        every corner a straight 45-style cut. Only straight-outline polygons
        are handled, a polygon containing arc segments is left untouched. The
        polygon is repoured after the edit.

        Args:
            index: Which polygon to bevel (0-based, in board iteration order).
            net_name: If set, count only polygons on this net when applying
                index.
            bevel_mils: Set-back distance per edge (default 25).

        Returns:
            {"beveled", "index", "orig_vertices", "new_vertices", "bevel_mils"},
            or an error code (NOT_FOUND / BAD_POLYGON / HAS_ARC).
pcb_bind_pad_netstool Assign component pads to existing board nets, batch in ONE call.
Assign component pads to existing board nets, batch in ONE call.

        Part of the scripted netlist transfer (see pcb_build_from_project).
        Each binding sets the net of a placed part's pad, matched by name.
        The net must already exist; a binding to a missing net fails.

        Keep rows for the same designator adjacent; it is faster.

        Args:
            bindings: List of dicts, each with ``designator`` (e.g. "U1"),
                ``pin`` (pad name, e.g. "3" or "A1"), ``net``.

        Returns:
            Dict with ``bound`` / ``failed`` counts plus
            ``missing_components`` / ``missing_pads`` / ``missing_nets``
            name lists (each capped at 50 entries).
pcb_board_optionstool Read, or set, settings saved in the active board: the template
Read, or set, settings saved in the active board: the template
        new pours are named from, and (read only) whether split planes
        are made automatically.

        Args:
            polygon_name_template: Altium's number for the naming
                template (read the current one first). A pour with
                AutoGenerateName set takes its name from it.

        Returns:
            ``polygon_name_template``, ``automatic_split_planes``,
            ``changed`` and ``not_applied``.
pcb_calc_fusing_currenttool Current that melts a copper conductor in ``seconds``
Current that melts a copper conductor in ``seconds``
        (Onderdonk, in Brooks and Adam's 2015 form).

        Adiabatic, so a LOWER bound for a trace on a board: Brooks and
        Adam's simulations of traces on FR-4 carry 2 to 6 times more. Not
        valid beyond about 10 s. Give the cross-section, or width and
        copper weight.
pcb_calc_impedancetool Characteristic impedance of a PCB trace (IPC-2141 / Wadell).
Characteristic impedance of a PCB trace (IPC-2141 / Wadell).

        The forward direction of ``pcb_calc_trace_width_for_impedance``:
        instead of "how wide for 50 ohms?", it answers "what impedance
        does this width give?". Pure physics, no EDA tool involved.

        Measured against a live editor: this existed only on the Altium
        backend,
        so KiCad and EasyEDA users could size a width for a target but
        could not check an existing one. The signature and reply match
        the Altium tool exactly, and both now compute through
        design/impedance_sizing, so the two backends cannot answer
        differently.

        Accuracy is the usual closed-form +/-10 percent; a fab's field
        solver refines it against the real stackup.

        Args:
            geometry: microstrip / microstrip_diff / stripline /
                stripline_diff.
            width_mils: trace width.
            dielectric_height_mils: for microstrip the height above the
                reference plane; for stripline the FULL thickness
                between the two planes.
            dielectric_constant: er, 4.2 for common FR-4.
            copper_oz: copper weight; 1 oz is 1.378 mils finished.
            spacing_mils: edge-to-edge gap, required for the _diff
                geometries.

        Returns:
            {ok, geometry, width_mils, dielectric_height_mils,
             dielectric_constant, thickness_mils, z0_ohms,
             propagation_delay_ps_per_inch}, plus spacing_mils and
            zdiff_ohms for a differential geometry.
pcb_calc_impedancetool Characteristic impedance of a PCB trace (IPC-2141 microstrip and
Characteristic impedance of a PCB trace (IPC-2141 microstrip and
        stripline, Wadell coupling for pairs). Pure math, about +/-10%:
        fine for choosing widths; the fab's field solver has the final
        word. Read real heights and Er with pcb_get_layer_stackup first
        rather than assuming FR-4.

        Args:
            geometry: "microstrip", "microstrip_diff", "stripline" or
                "stripline_diff".
            width_mils: Track width; for a pair, each conductor's.
            dielectric_height_mils: Microstrip: trace to plane below.
                Stripline: total between the two planes.
            dielectric_constant: Er (default 4.2, FR-4).
            copper_oz: Copper weight; 1 oz = 1.378 mil thick (default 1).
            spacing_mils: Edge-to-edge gap of a pair.

        Returns:
            Inputs echoed, ``thickness_mils``, ``z0_ohms``, ``zdiff_ohms``
            (pairs) and ``propagation_delay_ps_per_inch``.
pcb_calc_length_matchtool Resolve the effective Er and a match tolerance from a skew budget (or
Resolve the effective Er and a match tolerance from a skew budget (or
        match_fraction * rise_time_ns), then optionally report a group of net
        lengths against it.
pcb_calc_length_matchtool Length-match tolerance and serpentine compensation for a bus / pair.
Length-match tolerance and serpentine compensation for a bus / pair.

        Turns a timing budget into the length window the routing must hold
        and, given routed lengths, the serpentine each net needs (lay it
        with pcb_tune_length). Offline. Propagation uses the effective
        dielectric constant (stripline = Er; 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"}``.
pcb_calc_padstacktool Smallest pad and inner-layer clearance a fab builds around aFilesoutside text
Smallest pad and inner-layer clearance a fab builds around a
        hole, from its published ring and hole-to-copper figures, each
        quoted (design_list_fab_vendors). ``kind`` is "via" or "pth"; a
        figure the fab does not publish is said so, not filled in.
pcb_calc_pdn_target_impedancetool The power network's target impedance: allowed ripple over the
The power network's target impedance: allowed ripple over the
        load's current step. The step is the device datasheet's to give;
        nothing here assumes a share of the full current. Exact.
pcb_calc_polygon_areatool Report the area of each copper polygon on the active board.
Report the area of each copper polygon on the active board.

        Returns each polygon's overall boundary area in square mils and
        square millimetres, optionally filtered by net and/or layer.
        Useful for estimating copper coverage / plane area.

        Args:
            net: Only polygons on this net (optional).
            layer: Only polygons on this layer name (optional).

        Returns:
            Dict with ``polygons`` (each: name, net, layer, area_sq_mils,
            area_sq_mm) and ``count``.
pcb_calc_reactancetool Reactance of an inductor and/or capacitor at a frequency.
Reactance of an inductor and/or capacitor at a frequency.

        SI units so a value is never off by a prefix: 10 nH is 10e-9,
        100 nF is 100e-9. Exact (X_L = 2 pi f L, X_C = 1/(2 pi f C)).
pcb_calc_resonancetool Resonant frequency and characteristic impedance of an LC pair,
Resonant frequency and characteristic impedance of an LC pair,
        in henries and farads. Exact.
pcb_calc_spiral_inductancetool DC inductance of a planar spiral: square, hexagonal, octagonal
DC inductance of a planar spiral: square, hexagonal, octagonal
        or circle (Mohan, Hershenson, Boyd, Lee, IEEE JSSC 1999), by the
        modified Wheeler and the current-sheet expressions. Give
        inner_mils, or width and spacing to work it out.
pcb_calc_terminationtool Assess whether a net is electrically long for its edge rate and, if
Assess whether a net is electrically long for its edge rate and, if
        so, recommend a termination (series for point-to-point, Thevenin /
        parallel for a multi-load bus) with E24 values.

        Args:
            length_mils: routed length of the net.
            rise_time_ns: driver edge rate.
            z0: characteristic impedance in ohms. The Altium build
                spells this ``z0_ohms``; either is accepted.
            er: dielectric constant, spelled ``dielectric_constant`` on
                the Altium build; either is accepted.
            geometry: ``microstrip`` or ``stripline``.
            driver_impedance: driver output impedance in ohms, also
                spelled ``driver_impedance_ohms``.
            vcc: supply rail, for Thevenin values.
            width_mils: trace width, if the propagation delay is to be
                derived rather than assumed.
            height_mils: dielectric height, also spelled
                ``dielectric_height_mils``.
            multi_load: true for a bus with several receivers.
            z0_ohms: alias for ``z0``.
            dielectric_constant: alias for ``er``.
            driver_impedance_ohms: alias for ``driver_impedance``.
            dielectric_height_mils: alias for ``height_mils``.
pcb_calc_terminationtool Decide if a net needs termination and size the resistor(s).
Decide if a net needs termination and size the resistor(s).

        Offline. A net is electrically long when its one-way flight time
        exceeds ``length_fraction`` of the rise time (Johnson & Graham's
        1/6 by default). Microstrip Er_eff is Hammerstad when width and
        height are given, else 0.475*Er+0.67.

        Args:
            length_mils: Routed (or estimated) net length.
            rise_time_ns: Signal edge rate (the driver's 10-90 % rise time).
            z0_ohms: Line characteristic impedance (size it with
                ``pcb_calc_impedance``; default 50).
            dielectric_constant: er (default 4.2 FR-4).
            geometry: ``microstrip`` or ``stripline``.
            driver_impedance_ohms: Driver output impedance, subtracted for the
                series value (``Rs = Z0 - Rdriver``).
            vcc: Supply rail; enables the Thevenin split option when > 0.
            width_mils, dielectric_height_mils: Microstrip geometry for the
                Hammerstad Er_eff (optional; falls back to the approximation).
            length_fraction: Electrically-long threshold (default 1/6).
            multi_load: True for a bus / multi-receiver net (recommends
                far-end Thevenin/parallel instead of source series).
            z0, er, driver_impedance, height_mils: the EasyEDA and KiCad
                spellings of the same four values; giving both spellings
                with different values is refused.

        Returns:
            ``ok``, ``needs_termination``, ``recommended``,
            ``critical_length_mils``, ``flight_time_ns``, ``options`` (ideal
            and nearest-E24 values per scheme), ``summary``.
pcb_calc_thermal_viastool Size a thermal-via field for a target thermal resistance (given
Size a thermal-via field for a target thermal resistance (given
        directly, or as power_w with a delta_t_c budget), or score an existing
        via_count. Fourier conduction, R = L/(k*A).

        Args:
            drill_mm: via drill diameter, in mm.
            plating_um: barrel plating thickness, in microns.
            length_mm: conduction length, which for a via through the
                board is the board thickness. The Altium build spells
                this ``board_thickness_mm``; either is accepted.
            filled_copper: whether the barrels are copper filled.
            power_w: power to remove, in watts.
            delta_t_c: permitted temperature rise, in Celsius.
            target_k_per_w: thermal resistance target, given directly.
            via_count: score this many vias instead of sizing a field.
            board_thickness_mm: alias for ``length_mm``.
pcb_calc_thermal_viastool Size a thermal-via field under a power pad, or score a given
Size a thermal-via field under a power pad, or score a given
        ``via_count``. Each barrel conducts ``R = L / (k * A)`` and the vias
        add in parallel. The target is ``target_k_per_w``, or ``power_w``
        with a ``delta_t_c`` budget. Pure math, no Altium; copper spreading
        in the pad and plane is assumed good.

        Args:
            drill_mm: Finished via drill diameter.
            board_thickness_mm: Conduction length, from the top layer to the
                heat-spreading plane (full thickness for a bottom plane).
                The EasyEDA and KiCad builds spell this ``length_mm``;
                either is accepted.
            length_mm: Alias for ``board_thickness_mm``.
            plating_um: Barrel plating thickness in microns.
            filled_copper: True for a copper-filled via (full-circle copper),
                False for an unfilled / resin-filled barrel (annulus only).
            k_cu: Copper thermal conductivity, W/(m.K) (default 385).
            power_w: Dissipation, for the target (with ``delta_t_c``) and the
                realized temperature rise.
            delta_t_c: Allowed rise across the via field.
            target_k_per_w: Explicit target array resistance.
            via_count: Score this exact count instead of solving one.

        Returns:
            ``{"ok": True, "via_count", "single_via_k_per_w", "array_k_per_w",
            "target_k_per_w", "temp_rise_c", "barrel_area_mm2", "summary"}``.
pcb_calc_trace_width_for_currenttool Minimum track width (mils) to carry a current at a temperature rise
Minimum track width (mils) to carry a current at a temperature rise
        (IPC-2221), widened by ``margin`` and snapped to a 0.1 mil grid.

        Args:
            current_a: the current to carry, in amps. The Altium build
                spells this ``current_amps``; either is accepted.
            copper_oz: copper weight in ounces.
            delta_t_c: permitted temperature rise, in Celsius.
            layer: ``external`` or ``internal``.
            margin: fractional widening applied to the IPC result.
            length_mils: run length, for the voltage-drop figure.
            current_amps: alias for ``current_a``.
pcb_calc_trace_width_for_currenttool Minimum track WIDTH to carry a target current (inverse IPC-2221).
Minimum track WIDTH to carry a target current (inverse IPC-2221).

        Offline. Solves ``I = k * dT^0.44 * (h*w)^0.725`` for ``w`` with the
        constants of pcb_calc_track_current_capacity (``k = 0.048`` external,
        ``0.024`` internal, ``h = copper_oz * 1.378 mils``).

        Args:
            current_amps: Target current the track must carry.
            current_a: Alias for ``current_amps``.
            copper_oz: Copper weight, oz/ft^2 (0.5 / 1.0 / 2.0 / 3.0).
            delta_t_c: Allowed temperature rise above ambient (10 degC is a
                common conservative budget; 20-30 degC for tight boards).
            layer: ``"external"`` (top/bottom) or ``"internal"`` (inner; needs
                ~2.6x the width for the same rise).
            margin: Fractional widening above the bare IPC minimum for the
                recommendation (default 0.2 = 20 %).
            length_mils: If > 0, also returns DC resistance and voltage drop at
                the recommended width.

        Returns:
            ``{"ok": True, "min_width_mils", "recommended_width_mils",
            "copper_oz", "delta_t_c", "layer", ...optional resistance/drop}``
            or ``{"ok": False, "reason": ...}``.
pcb_calc_trace_width_for_impedancetool Trace width (mils) to hit a target impedance for a geometry
Trace width (mils) to hit a target impedance for a geometry
        (microstrip / stripline / their *_diff variants). Differential targets
        need spacing_mils. Inverse of the IPC-2141 impedance formula.
pcb_calc_trace_width_for_impedancetool Trace WIDTH to hit a target impedance (inverse of pcb_calc_impedance).
Trace WIDTH to hit a target impedance (inverse of pcb_calc_impedance).

        Inverts the same IPC-2141 / Wadell forms, so it round-trips with
        the forward calculation. Offline, about +/-10 %: the fab's field
        solver has the final word. Read real heights and Er with
        ``pcb_get_layer_stackup``.

        Args:
            target_ohms: Single-ended Z0 for ``microstrip``/``stripline``, or
                the differential Zdiff for ``microstrip_diff``/
                ``stripline_diff``.
            geometry: One of microstrip, microstrip_diff, stripline,
                stripline_diff.
            dielectric_height_mils: Trace-to-plane height (microstrip) or full
                between-plane thickness (stripline).
            dielectric_constant: er (default 4.2 FR-4).
            copper_oz: Copper weight for trace thickness (default 1.0).
            spacing_mils: Edge-to-edge gap (required for ``*_diff``).

        Returns:
            ``{"ok": True, "width_mils", "single_ended_z0_ohms", "feasible",
            ...}`` (feasible False when the target needs a width <= 0: raise the
            dielectric height or lower the target), or ``{"ok": False, ...}``.
pcb_calc_track_current_capacitytool Forward IPC-2221: the current a track of this width sustains at a
Forward IPC-2221: the current a track of this width sustains at a
        given temperature rise.
pcb_calc_track_current_capacitytool IPC-2221 current-carrying capacity for a PCB track.
IPC-2221 current-carrying capacity for a PCB track.

        Offline math. ``I = k (dT)^0.44 (h w)^0.725`` in mils and degrees
        C, with k 0.048 external and 0.024 internal, at rises of 1, 5,
        10, 20 and 30 C. A length adds DC resistance (annealed copper,
        20 C) and the voltage drop at each current.

        Args:
            width_mils: Track width in mils.
            copper_oz: Copper weight in oz/ft² (1 oz = 1.378 mil).
            layer: ``"external"`` (default) or ``"internal"``.
            length_mils: If > 0, also return resistance and voltage drop.
            delta_t_c: The temperature rise asked about, in C (10 by
                default). The 1, 5, 10, 20 and 30 C table is returned too.

        Returns:
            ``width_mils``, ``copper_oz``, ``thickness_mils``, ``layer``,
            ``delta_t_c`` with ``current_a`` for it, ``current_amps``
            (keys ``1c`` ... ``30c``), and with a length
            ``resistance_mohm`` and ``voltage_drop_mv``.
pcb_calc_via_inductancetool Loop inductance a via adds between two planes, with its return
Loop inductance a via adds between two planes, with its return
        (ground via or plane capacitor) ``return_spacing_mils`` away,
        centre to centre (Johnson, 'Via Inductance II', within about 10 %
        of his measurements). Only the interplane part.
pcb_calc_wavelengthtool Wavelength and quarter wave at a frequency, and the electrical
Wavelength and quarter wave at a frequency, and the electrical
        length of ``length_mils`` in degrees. ``er_eff`` is the effective
        permittivity: the laminate's Dk for stripline; a microstrip's is
        lower and geometry dependent, so give it. Exact.
pcb_calc_wire_gaugetool AWG size: diameter, area and kcmil for a gauge (-3 for 0000 up
AWG size: diameter, area and kcmil for a gauge (-3 for 0000 up
        to 40), or the nearest gauge for a diameter. Exact (ASTM B258).
pcb_check_placement_collisiontool Check, without moving it, whether a component at (x, y[,
Check, without moving it, whether a component at (x, y[,
        rotation]) would overlap another component on the same side.
        Use before ``pcb_move_components`` on a populated board.

        Bounding boxes only: a non-quarter rotation reuses the current
        box, and courtyards and pad clearances are not checked (use DRC).

        Args:
            designator: Component to test.
            x, y: Proposed reference point in mils.
            rotation: Proposed rotation; default the current one.
            margin_mils: Extra clearance; at 0, touching boxes collide.

        Returns:
            ``{designator, proposed: {x, y, rotation, bbox, margin_mils},
            clear, colliding_count, colliding: [{designator, bbox}]}``.
pcb_check_rule_scopetool Whether a rule's scopes take in an object, or a pair of objects.
Whether a rule's scopes take in an object, or a pair of objects.

        Altium's own test of the rule's scope queries against the real
        objects, before priorities: the check that a rule written as
        InNet('VBUS') really matches the VBUS pads.

        Args:
            rule_name: The rule.
            object1: "U1", "U1.3" or "net:GND".
            object2: A second object, for a two-scope rule.

        Returns:
            ``scope1_includes_object1``, ``scope2_includes_object2``,
            ``applies`` (Altium's unary or binary scope check), ``unary``
            and the rule's summary.
pcb_check_stackuptool Compare the active board's stack-up with a fab stack-up.Filesoutside text
Compare the active board's stack-up with a fab stack-up.

        Reads the board (``pcb_get_layer_stackup``) and compares copper
        thickness, the dielectric height under each copper layer and its
        Dk with the template (``design_list_stackups``). The board keeps
        one dielectric per copper gap; a template gap of several plies is
        summed (heights) and thickness-weighted (Dk) first, so a correct
        board is not reported wrong for having fewer entries. A different
        copper count is ONE finding. Read only.

        Args:
            template: stack-up name, e.g. "JLC04161H-7628"
            thickness_tol_pct: allowed difference in thickness, percent
            er_tol: allowed difference in Dk

        Returns:
            ``{"ok": True, "matches": bool, "findings": [...], "board":
            {...}}`` or the bridge's error.
pcb_clean_nettool Run Altium's own clean-up on one net's routing.
Run Altium's own clean-up on one net's routing.

        It splits tracks where others meet them and removes nothing.
        Reports the net's track, arc and via count before and after.
        There is no script undo.

        Args:
            net: The net name.

        Returns:
            ``routing_before`` and ``routing_after``.
pcb_clear_guidestool Remove every placement guide and snap point from the active board.
Remove every placement guide and snap point from the active board.

        Altium's SDK lets scripts delete guides but not add them; add
        them in the editor.
pcb_clear_source_footprint_librarytool Clear ``Comp.SourceFootprintLibrary`` on board components.
Clear ``Comp.SourceFootprintLibrary`` on board components.

        A component remembers the library it came from, so after that
        library is renamed or moved, updates fail with "library not
        found". Clearing it makes Altium re-match by name from the
        Available Libraries: install the new library, run this, then the
        ECO.

        Args:
            designator_filter: Restrict to these designators
                (e.g. ``["U1", "U5"]``). ``None`` / empty clears all
                components on the board. Match is case-sensitive
                whole-string.

        Returns:
            Dict with ``{total, cleared}``. ``total`` counts components
            inspected after filter; ``cleared`` counts ones that
            actually had a non-empty SourceFootprintLibrary cleared.
pcb_component_parameterstool Read, set, add or remove the parameters a placed part carries on the board.
Read, set, add or remove the parameters a placed part carries on the board.

        These are the board-side parameters of the part (as in its
        Properties panel on the PCB), not the schematic's. They come from
        the schematic and the library when the board is updated, so treat
        them as read-only: an update from the schematic can put them back.
        ``add`` only creates a new parameter; it never changes one.

        Args:
            designator: The part.
            action: ``list``, ``set`` (name and value), ``add`` (name and
                value; refused with EXISTS when the name is already there
                in any group) or ``remove`` (name).
            group: Which parameters ``list`` reads. ``own`` (default): the
                part's own parameters, from its schematic symbol and
                library component. ``system``: the ones Altium keeps for
                itself, such as Component.VaultGUID, ItemGUID and
                RevisionGUID. ``footprint``: those of the footprint.
                ``all``: every group, each row naming its ``group``.
                ``set``, ``add`` and ``remove`` act on ``own`` only.

        Returns:
            ``parameters`` as they now read (each with ``name``, ``value``
            and ``group``), ``read_back`` (the value of ``name`` after the
            change) and ``done``.
pcb_connected_coppertool The copper joined to one seed object, found by geometry, not net name.
The copper joined to one seed object, found by geometry, not net name.

        Altium's Tab-select grows from the editor's last clicked object and
        cannot be seeded from a script; this walk can. It finds copper of
        another net touching a net (a short), free copper with no net that
        touches it, and what a pour piece connects to. Each object found is
        searched round its bounding box; copper tracks, arcs, vias, pads,
        fills and copper regions join when they share a layer (or one spans
        every layer: a via, a through-hole pad) and Altium measures no gap.

        Args:
            object_type: The seed's object type (e.g. ``pad``, ``track``).
            filter: The generic filter for the seed (e.g.
                ``Component=U1|Name=3``); the first match is the seed.
            pad: Shorthand for a component pad, ``U1.3`` (designator, then
                the pad name after the first dot). Replaces object_type and
                filter.
            limit: The most objects the walk collects; ``capped`` says it
                stopped there. On a busy board a ground net of ~700 objects
                took about 30 s.
            include_objects: Add ``objects``: per object its ``kind``,
                ``layer``, ``net`` and bounding box in mils.
            select: Select every object found (the Selection Filter is
                bypassed for the run and put back afterwards). Otherwise the
                walk changes nothing.
            clear_selection: With select, deselect everything first.

        Returns:
            ``total``, counts per kind (``tracks``, ``arcs``, ``vias``,
            ``pads``, ``fills``, ``regions``), ``nets`` (sorted, unique;
            ``(no net)`` for copper with no net -- poured polygon pieces read
            no net, their net is on their polygon), ``ms``, ``capped``,
            ``selected`` with select, ``objects`` with include_objects.
            NOT_FOUND when the seed matches nothing, NOT_COPPER when it is not
            copper on a signal layer.
pcb_copy_component_placementtool Clone placement from source components onto destination components.
Clone placement from source components onto destination components.

        Copies layer, X, Y and rotation, and optionally the designator
        and comment text placement. For repeated channels: lay out one,
        then map it onto the next, e.g. ``{"R1": "R11", "U1": "U2"}``.

        Args:
            mapping: ``{source_designator: dest_designator}``. Each
                source must already be placed somewhere; each dest gets
                overwritten with the source's placement.
            include_designator: Also copy designator-text placement
                (offset, rotation, size, layer, visibility). Default
                True.
            include_comment: Also copy comment-text placement. Default
                True.

        Returns:
            Dict with:
              - ``applied``: pairs that succeeded
              - ``failed``: pairs that failed (src/dst missing or apply
                exception)
              - ``items``: per-pair ``{src, dst, ok, error}``
pcb_copy_designators_to_mechtool Copy each component designator onto a mechanical layer (assembly prep).
Copy each component designator onto a mechanical layer (assembly prep).

        Places a `.Designator` special-string text on `layer` over every
        component, for an assembly drawing that survives silkscreen edits.

        Args:
            layer: target mechanical layer (default Mechanical1).

        Returns:
            {"copied": N, "layer": "..."}.
pcb_copy_tracks_radialtool Array the selected tracks/arcs/vias radially about a center point.
Array the selected tracks/arcs/vias radially about a center point.

        Replicates the current selection ``count - 1`` more times, each rotated
        a further ``angle_step`` degrees about ``(center_x, center_y)``.
        Copies are added unselected so the source set stays put.

        Args:
            center_x: Rotation-center X in mils.
            center_y: Rotation-center Y in mils.
            count: Total instances including the original (>= 2).
            angle_step: Degrees between instances. Defaults to ``360 / count``
                (a full even ring).

        Returns:
            {"copied", "count", "angle_step"} or an error.
pcb_create_design_ruletool Create a new design rule on the active PCB.Filesoutside text
Create a new design rule on the active PCB.

        Args:
            name: Rule name (e.g., "Min Clearance 6mil"). A name already on
                the board is refused (RULE_EXISTS).
            rule_type: "polygon_connect" / "plane_connect" (no value:
                connect_style decides, e.g. scope "IsVia" with "direct"
                so vias never get thermal reliefs; set relief widths
                and gaps afterwards with pcb_set_rule_properties),
            rule_type: "clearance" (value = gap), "width" (value = min,
                max_value/favored_value optional), "via_size" (value = min
                hole), "differential_pairs" (value = min gap, max_value,
                favored_value, max_uncoupled_length),
                "solder_mask_expansion" / "paste_mask_expansion" (value =
                SIGNED radial expansion; negative with scope "IsVia" tents
                vias), "vias_under_smd" (set ``allowed``, not value),
                "length" (value = min length in mils, max_value = max),
                "signal_impedance" (value = min ohms, max_value = max),
                "flight_time_rising" / "flight_time_falling" (value =
                max flight time in ns). These four read their limits back
                in ``limits``; change them later with
                pcb_set_rule_properties. "matched_lengths" (value =
                tolerance in mils; scope a net / pair / xSignal class)
                reads its settings back in ``settings``.
            value: Primary value in mils (the MIN for ranged kinds).
            max_value: MAX for ranged kinds (default 5x value).
            favored_value: Preferred value (default value).
            max_uncoupled_length: differential_pairs only, mils
                (default 1000).
            scope: Query for Scope1, matching the kind: "InNet('GND')",
                "InNetClass('Power')" or "All" for net rules;
                "InDifferentialPair('USB')" or "IsDifferentialPair" for
                pairs (InNet on a pair rule never matches). Bracket
                comparisons: "IsPad And (HoleSize > 3)"; the unbracketed
                form is refused with ``suggested_scope``.
            net_scope: "different_nets" (default), "any_net" or
                "same_net"; ignored by pair, mask and via-in-pad rules.
            allowed: vias_under_smd only: False forbids via-in-pad.
                Omitted means True, Altium's default.
            match_mode: matched_lengths only: "group" (the pairs,
                xSignals and nets in scope against each other, Altium's
                default) or "within_pair" (the two nets of each pair).

        Returns:
            Dictionary with created rule details.

        Component, hole-to-hole and board-outline clearance rules cannot
        be created; existing ones can be changed with
        pcb_set_rule_properties.
pcb_create_diff_pairtool Create a differential pair object from two existing nets.
Create a differential pair object from two existing nets.

        Both nets must exist on the board.

        A PAIR MADE ONLY ON THE BOARD IS REMOVED BY THE NEXT SCHEMATIC
        SYNC. To keep it, define it in the schematic too: net names ending
        _P/_N with a DifferentialPair directive (sch_add_directive).

        Args:
            positive_net: Positive-side net name (e.g. "USB_DP")
            negative_net: Negative-side net name (e.g. "USB_DM")
            name: Optional diff-pair name (defaults to "<pos>_<neg>")

        Returns:
            Dictionary confirming creation with name, positive_net, negative_net
pcb_create_dimensiontool Draw a measuring dimension from points: Altium works out the value.
Draw a measuring dimension from points: Altium works out the value.

        Its ends are FREE points: they do not follow a pad that moves later
        (a script cannot bind them; dragging an end onto a pad in Altium
        does). A radial needs that binding (free, it draws 0), so a radius
        is drawn as a leader from the arc labelled "R <radius>": right when
        placed, not following the arc after. A diameter is refused.

        Args:
            kind: linear, angular, radial, leader, datum, baseline, center,
                original.
            points: [x, y] pairs. linear: the two points. angular: vertex,
                one point on each line. radial: the arc's centre, and the
                point on the arc to call out from unless radius is given.
                leader: tip, bends, end. datum: origin, then each point.
                baseline: base, then each point. center: the centre.
                original: start, end.
            layer: Layer to draw on (default TopOverlay).
            angle: Measuring direction in degrees (linear, datum, baseline;
                the cross's turn on a center).
            offset: How far the line (linear), callout row (datum) or first
                line (baseline) sits from the points.
            spacing: Distance between a baseline's lines.
            label, shape: A leader's text and frame (none, round, square).
            radius, sector: An angular's arc radius and which of the four
                angles (1-4); the radius a radial calls out.
            size: A center mark's size.
            text_height, line_width, unit (mil, mm, deg), precision,
                prefix, suffix: The callout's style.

        Returns:
            ``created`` and the new ``dimension`` as pcb_get_dimensions
            reads it (its ``index`` for pcb_edit_dimension).
pcb_create_net_classtool Create a net class (or add nets to an existing one) on the active PCB.
Create a net class (or add nets to an existing one) on the active PCB.

        Args:
            name: Name for the net class (e.g., "PowerNets", "HighSpeed")
            nets: Net names to add, as a list or comma-separated
                  (e.g., "VCC,GND,3V3")

        Returns:
            Dictionary with class_name, class_created (bool), nets_added count
pcb_create_nets_from_listtool Create net objects on the active PCB for names not already there.
Create net objects on the active PCB for names not already there.

        Part of the scripted netlist transfer (see pcb_build_from_project,
        which runs it). Names already on the board are counted, not
        duplicated.

        Args:
            nets: Net names to ensure exist (e.g. from the compiled
                netlist). Duplicates and empty strings are ignored.

        Returns:
            Dict with ``created`` and ``existing`` counts.
pcb_create_roomtool Create a room for component grouping on the active PCB.Filesoutside text
Create a room for component grouping on the active PCB.

        Creates a confinement constraint rule that defines a rectangular
        region. Components can be assigned via scope expression.

        Args:
            name: Room name (e.g., "Power Section", "USB Block")
            x1: First corner X in mils
            y1: First corner Y in mils
            x2: Second corner X in mils
            y2: Second corner Y in mils
            components: Comma-separated component designators to confine
                (e.g., "U1,U2,R1,R2"). Optional; empty = applies to all.

        Returns:
            Dictionary with created status, name, coordinates, and scope
pcb_create_xsignalstool Create xSignals between pins, through any series parts.
Create xSignals between pins, through any series parts.

        Altium works out the paths between the pins given, the same as
        its Create xSignals command, and can put the new xSignals in an
        xSignal class for length-matching rules.

        Args:
            pins: At least two pins as "U1.3" (designator.pad).
            class_name: Optional xSignal class to put them in.

        Returns:
            ``count_before``, ``count_after``, ``created`` (the new
            xSignals, as pcb_get_xsignals lists them),
            ``class_assigned`` (every new xSignal read back as a member of
            the class) and ``not_in_class`` (the ones that were not).
pcb_delete_bend_linetool Delete a bend line: the region it belongs to and its index there,
Delete a bend line: the region it belongs to and its index there,
        as pcb_get_board_regions lists them.
pcb_delete_design_ruletool Delete a design rule by name from the active PCB.Filesoutside text
Delete a design rule by name from the active PCB.

        Args:
            name: Exact name of the design rule to delete

        Returns:
            Dictionary confirming deletion
pcb_delete_invalid_objectstool Remove degenerate primitives from the active PCB.
Remove degenerate primitives from the active PCB.

        Deletes zero-length tracks and zero-area regions (board hygiene that
        accumulates from edits and imports). Returns the count removed.
        Free objects only: primitives of a placed component, a polygon pour
        or a dimension belong to their owner and are left alone (a
        zero-length track in a footprint is a round dot, often a pin-1
        mark).

        Returns:
            {"removed": N}.
pcb_delete_nettool Delete nets from the active PCB.
Delete nets from the active PCB.

        By default only empty nets go, e.g. strays left after deleting
        components. A net with connections is skipped unless
        ``force=True``, which orphans its pads and tracks.

        Args:
            nets: Specific net names to delete. Omit (or pass an empty
                list) to sweep ALL empty nets on the board.
            force: Also delete nets that still have connected primitives
                (orphans them). Default False.

        A net name with a comma is refused, since the list travels comma
        separated and ``VCC,GND`` would delete VCC and GND.

        Returns:
            Dict with ``deleted`` (count removed), ``skipped_connected``
            (count), and ``skipped_nets`` (names skipped because still
            connected). Or ``{"ok": False, "reason": ...}`` if a name
            contains a comma, in which case nothing is sent.
pcb_delete_objecttool Delete a PCB object closest to specific coordinates on a layer.
Delete a PCB object closest to specific coordinates on a layer.

        Finds the nearest matching object within 100 mils of the given
        coordinates and removes it from the board. Distance is to the
        object itself: a track by its segment less half its width, an arc
        by its curve, a via by its centre less its radius, anything else
        by its bounding rectangle (0 inside it). A point anywhere on a
        track finds that track.

        Args:
            x: Target X position in mils
            y: Target Y position in mils
            layer: PCB layer name to search; empty searches every layer,
                which is where a through via, a through-hole pad or a part
                is found (they sit on the multi-layer).
            object_type: Type of object to delete. Options:
                "track" - Track segment
                "via" - Via
                "fill" - Copper fill
                "text" - Text string
                "pad" - Free pad
                "arc" - Arc
                "polygon" - Copper polygon pour
                "region" - Region / split-plane
                "component" - Placed component
                (for bulk/filter-based deletes use ``obj_delete``)

        Returns:
            Dictionary with deleted status, object_type, distance_mils,
            the deleted object's net, layer and bbox_mils, and others_as_close:
            how many other objects were exactly as near, so a pick among
            equals is visible.
pcb_delete_xsignalstool Delete xSignals by name, or all of them.
Delete xSignals by name, or all of them.

        Args:
            names: xSignal names, as pcb_get_xsignals lists them (any case).
            all: Delete every xSignal on the board.

        Returns:
            ``count_before``, ``count_after`` and ``deleted`` (names).
pcb_dimension_bindingstool Which dimensions have ends bound to board objects.
Which dimensions have ends bound to board objects.

        A bound end follows its pad or arc when that moves. pcb_edit_dimension
        refuses to change a bound dimension's geometry unless told to unbind
        it, after which it no longer follows. A radial or diameter is bound
        to its arc and is never unbound (free, it reads 0).

        Returns:
            ``bound``: each bound dimension's index, kind, x, y and how many
            of its references are bound; ``count`` dimensions on the board.
pcb_distribute_componentstool Evenly space components along an axis.
Evenly space components along an axis.

        Moves each named component so its X (or Y) coordinate lands at
        equally-spaced stops from `start` to `end`. Order follows the
        designators list, designators="R1,R2,R3" with start=0 end=200
        places R1 at 0, R2 at 100, R3 at 200 on the chosen axis. Y (or X)
        is untouched.

        Args:
            designators: Comma-separated list of component designators
            axis: "x" or "y" (default "x")
            start: First position in mils
            end: Last position in mils

        Returns:
            Dictionary with distribution result
pcb_drc_rulestool The design rules a DRC checks against, and the approved set.Filesoutside text
The design rules a DRC checks against, and the approved set.

        A DRC passes under whatever rules the board holds, so the rules
        themselves are approved: the approved sheet is kept beside the
        board (<board>.DrcRules.json), and every DRC compares against it
        and names each rule added, removed, loosened, re-scoped or switched
        off since. Rule edits made through the tools are logged beside it
        (<board>.DrcRules.log.jsonl).

        Args:
            action: "show" (the rule sheet, its fingerprint and its
                difference from the approved set), "changes" (only the
                difference and the logged edits), or "approve" (keep the
                current rules as the approved set). Approve only when the
                user has read the sheet and said to approve it; never to
                make a DRC pass.
            note: Kept with an approval: who approved it and why.

        Returns:
            ``board_path``, ``fingerprint``, ``approved`` with
            ``approved_at``, ``changes_since_approval`` (each with
            ``loosened``: true lets more through, null needs review),
            ``logged_changes``, and for show the ``sheet``.
pcb_edit_dimensiontool Change a dimension: its points, position, angle or style.
Change a dimension: its points, position, angle or style.

        A dimension with ends bound to board objects (pcb_dimension_bindings)
        is refused for geometry changes while keep_bindings is true. With
        keep_bindings=false its ends are unbound first: it is then drawn as
        before but NO LONGER FOLLOWS the pad or arc it was bound to (fine
        when the drawing is redone by a tool anyway; rebind by dragging an
        end onto the object in Altium). keep_bindings=false alone just
        unbinds. A radial or diameter keeps its arc: only style changes.

        Args:
            index, x, y: The dimension, as pcb_get_dimensions gives it; x, y
                must still match (a stale index is refused).
            keep_bindings: False unbinds bound ends (see above).
            points: New points, as pcb_create_dimension takes them.
            dx, dy: Move the whole dimension.
            angle, offset, spacing, label, shape, radius, sector, size,
                text_height, line_width, unit, precision, prefix, suffix:
                As in pcb_create_dimension.

        Returns:
            ``edited``, ``unbound`` (references released) and the
            ``dimension`` as read afterwards.
pcb_edit_optionstool Read, or set, how the board editor behaves while editing.
Read, or set, how the board editor behaves while editing.

        These are Altium's own preferences and apply to every board. A
        board must be open. Call with nothing to read; every option set
        is read back. ``undo_levels`` is read only.

        Args:
            rotation_step: Degrees per rotate (Space), 0 or more.
            protect_locked: Locked objects cannot be moved or deleted.
            select_only_visible: Selection takes visible objects only.
            click_clears_selection: A click on empty space clears the
                selection.
            double_click_runs_inspector: Double-click opens the
                Inspector instead of the properties.
            snap_to_centre: Objects are picked up by their centre.
            allow_duplicate_designators: Parts may share a designator.
            auto_pan: Pan the view when dragging to its edge.
            drag_mode: What follows a dragged track (Altium's number).
            component_move: What a moved part takes with it (Altium's
                number).
            confirm_delete / confirm_global_edit / confirm_drag /
                confirm_selection_memory_clear: Ask before a delete, a
                change to many objects, dragging a selection, or clearing
                a selection memory.
            shift_to_select: Objects are picked only with Shift held.
            global_edit_includes_arcs: A change to tracks takes arcs along.
            pick_nearest_component: A click picks the nearest component.
            defaults_permanent: Object defaults stay as set, not taken
                from the last object placed.
            check_board_on_load: Check a board's objects when it opens.
            netlist_remove_unconnected_parts /
                netlist_remove_unconnected_objects: A netlist load removes
                components the netlist leaves out, and copper on no net.
            netlist_check_footprints / netlist_check_comments: A netlist
                load checks footprints and comments.
            auto_pan_mode: How the view pans at its edge (Altium's
                number); auto_pan_step, auto_pan_big_step (Shift held)
                and auto_pan_speed its steps and speed.
            pour_redraw_threshold: Pours of more pieces than this are drawn
                as outlines while they are edited.
            online_drc: Altium's Online DRC preference (PCB Editor >
                General): every object placed or changed is checked as it
                goes. Switching it off speeds up bulk edits a lot; read it
                first and put it back afterwards.

        Returns:
            ``options`` (each option by these names), ``changed``,
            ``not_applied``, ``refused`` and ``unknown``.
pcb_embedded_datatool Keep named text records inside the board file, out of sight.
Keep named text records inside the board file, out of sight.

        Each record is an Altium embedded object on Mechanical1: it is saved
        with the PcbDoc, survives close and reopen, and is neither drawn nor
        selectable on the canvas, so a designer cannot move or delete it by
        accident. The data is plain text: encode JSON or anything else
        yourself; it comes back exactly as written. Not for secrets: anyone
        who opens the file can read it. Several records can share a name
        (another writer may have made one), so read, write and delete act
        on every record with that name, in board order.

        Args:
            action: ``list`` (every record: ``name``, ``length``, ``head`` =
                the first 200 characters, ``layer``), ``read`` (the full
                ``text`` of each record named ``name``), ``write`` (replace
                the text of every record named ``name``, or make one when
                there is none) or ``delete`` (remove every record named
                ``name``).
            name: The record's name, matched exactly (case and spaces
                count). Required for read, write and delete.
            text: The record's text, required for write. Sent unchanged.

        Returns:
            list: ``count`` and ``records``. read: ``found`` and ``records``
            with ``text``. write: ``created``, ``updated``, ``length`` and
            ``exact`` (the text read back equals the text sent). delete:
            ``deleted``. The board is marked modified after a write or a
            delete; save it to keep the change.

        Name and text are Latin-1 (U+0000 to U+00FF): an embedded record
        holds 8-bit text, so other characters are refused here rather than
        stored changed. Encode them first, for example as JSON with
        ``ensure_ascii=True``.
pcb_export_coordinatestool Export component placement coordinates formatted for pick-and-place (like `pcb_get_components`, but the pick-and-place shape: adds side, omits bbox detail).
Export component placement coordinates formatted for pick-and-place (like `pcb_get_components`, but the pick-and-place shape: adds side, omits bbox detail).

        Returns designator, footprint, comment, position (x, y),
        rotation, layer, and side (Top/Bottom) for every component.
        Useful for manufacturing pick-and-place machine programming.

        Returns:
            Dictionary with "placements" array (each with designator,
            footprint, comment, x, y, rotation, layer, side) and "count"
pcb_export_stackup_csvtool Write the layer stackup to a conventional fab CSV report.Files
Write the layer stackup to a conventional fab CSV report.

        Fetches the structured stackup (``pcb_get_layer_stackup``) and writes
        it as the board-house stackup table: one row per physical layer,
        copper and dielectric interleaved top-to-bottom, thickness in mil and
        mm, dielectric constant where it applies. Columns: index, layer, type,
        material, thickness_mil, thickness_mm, dielectric_constant.

        Args:
            output_path: Destination .csv file. Defaults to
                ``workspace/<board>_stackup.csv``.

        Returns:
            {"output_path", "rows", "layer_count", "total_thickness_mils"} or
            an error dict if the board / stackup could not be read.
pcb_file_infotool The file format version the board was last saved in, and its id.
The file format version the board was last saved in, and its id.
pcb_filter_variant_componentstool Select a variant's components of one fitted-class on the board.
Select a variant's components of one fitted-class on the board.

        Classifies every component under ``variant_name`` (fitted original /
        alternate / not fitted) and selects exactly the chosen class on the
        active PCB, deselecting the rest, e.g. so a variant's not-fitted
        parts stand out for review.

        Args:
            variant_name: The project variant to classify against.
            select: ``not_fitted`` (default), ``fitted_original``,
                ``alternate``, or ``all_fitted`` (fitted_original +
                alternate). Any other word is refused.

        Returns:
            {"variant", "select", "matched", "designators"}, or
            ``{"ok": False, "reason": ...}`` if ``select`` is not one of
            the four classes, in which case nothing is sent or selected.
pcb_find_dominant_ruletool Which rule Altium itself applies to an object, or a pair of objects.
Which rule Altium itself applies to an object, or a pair of objects.

        Altium's own resolution (scopes and priorities), the rule DRC and
        the router use, not a reading of the scope text. Use it to check a
        rule really reaches the copper it was written for.

        Args:
            object1: "U1" a part, "U1.3" pad 3 of U1, or "net:GND" a net.
            object2: A second object, for a rule between two objects
                (clearance, for example). Empty for a one-object rule.
            rule_name: Any rule of the kind wanted (pcb_get_design_rules
                lists them); its kind is used. Or give rule_kind.
            rule_kind: The rule kind number, as pcb_get_design_rules
                reports it.

        Returns:
            ``found`` and ``rule`` (``name``, ``kind``, ``priority``,
            ``enabled``, ``scope1``, ``scope2``, ``descriptor``).
pcb_find_same_packagetool Find placed parts that share a package, as Altium judges it.
Find placed parts that share a package, as Altium judges it.

        Useful before copying a layout between repeated channels: parts
        with the same package can take each other's placement.

        Args:
            designator: One part, to list the parts with its package.
                Empty lists every group of two or more.

        Returns:
            With a designator: ``footprint`` and ``same_package``.
            Without: ``groups`` (``footprint``, ``count``,
            ``designators``), ``group_count``, ``parts_examined`` and
            ``parts_without_hash``.
pcb_flip_componenttool Flip a component to the other side of the board (top to bottom
Flip a component to the other side of the board (top to bottom
        or bottom to top).

        The part is mirrored left-right about its origin, as seen from the
        top, and Altium changes the rotation it reports. To end at an
        exact place and rotation, use pcb_import_placement with ``side``,
        which sets the rotation after the flip.

        Args:
            designator: Component reference designator (e.g., "U1", "R5")

        Returns:
            Dictionary with designator, old_layer, and new_layer
pcb_focus_boardtool Make a specific PCB the focused/current board.
Make a specific PCB the focused/current board.

        When several PcbDocs are open, the other PCB tools
        (`pcb_get_components`, `pcb_delete_object`, `pcb_delete_net`,
        `pcb_plan_placement`, `design_visual_review`, …) operate on the
        *focused* board, and `app_set_active_document` does NOT reliably set
        that for a PcbDoc. Call this first to point them all at the board
        you mean. (`pcb_place_components` already accepts `board_path`
        directly.)

        Args:
            board_path: Absolute path to the .PcbDoc to focus.

        Returns:
            Dict with ``focused`` and the resolved ``board`` file name.
pcb_gerber_optionstool Read, or set, the Gerber setup saved in the active board: the
Read, or set, the Gerber setup saved in the active board: the
        units and decimals, apertures, flashing, film size and border.

        Call with nothing to read; every option set is read back.
        proj_generate_fab_package writes the files.

        Args:
            units: Altium's number for the Gerber units (read it first).
            decimals: Altium's number for the coordinate format.
            sort_output: Sort the plot output.
            software_arcs: Write arcs as short straight segments.
            centre_on_film: Centre the plots on the film.
            embed_apertures: Write the apertures into each file (RS-274X).
            panelize: Plot the panel's layers.
            g54: Write G54 before each aperture change.
            relief_shapes_allowed: Allow relief apertures.
            flash_pads_only: Flash pad shapes only.
            flash_all_fills: Flash every fill.
            plus_tolerance_mils / minus_tolerance_mils: Aperture match
                tolerances.
            film_x_mils / film_y_mils: Film size.
            border_mils: Border around the plot.
            max_aperture_mils: Largest aperture.

        Returns:
            ``board``, ``options`` (by these names), ``changed``,
            ``not_applied``, ``refused`` and ``unknown``.
pcb_get_board_outlinetool Get the board outline vertices and bounding rectangle.
Get the board outline vertices and bounding rectangle.

        Returns outline geometry as a list of vertices (line segments and
        arcs) plus the bounding rectangle dimensions.

        Returns:
            Dictionary with "point_count", "vertices" array (each with
            index, kind, x, y, and optionally cx, cy, angle1, angle2 for arcs),
            "closing" (the vertex saved after the last, which must equal
            the first) with "closed", and "bounding_rect" (left, bottom,
            right, top in mils)
pcb_get_board_regionstool Read the active board's rigid-flex setup: its board regions
Read the active board's rigid-flex setup: its board regions
        (index, name, layer stack, 3D lock and bend lines), the split
        lines that divide it, and the layer stacks with their copper
        layers and whether each is flex.

        Returns:
            ``regions`` (each with its ``bend_lines``: ``from``, ``to``
            in mils, ``radius_mils``, ``angle``, ``fold_index``),
            ``split_lines`` (by index) and ``layer_stacks``. A region is
            named in the other tools by its name or by "#<index>".
pcb_get_board_statisticstool Get comprehensive statistics for the active PCB board.
Get comprehensive statistics for the active PCB board.

        Returns counts of all object types, total trace length, board
        dimensions, and layer count. Useful for design reviews and
        progress tracking.

        Returns:
            Dictionary with track_count, via_count, pad_count,
            component_count, fill_count, text_count, polygon_count,
            unrouted_connections, total_trace_length_mils,
            board_width_mils, board_height_mils, board_area_sq_mils,
            layer_count, and board_name. ``unrouted_connections``
            counts stored ratsnest lines, which can be out of date;
            pcb_get_unrouted_nets re-derives them first.
pcb_get_clearance_violationstool Read the violations ALREADY on the board, optionally filtered
Read the violations ALREADY on the board, optionally filtered
        to one net. Does NOT run DRC.

        Reads the violation records the last DRC left; opens no dialog.
        ``violation_count: 0`` means none are STORED, not that the board
        passes: with no DRC run this session it is 0 either way (see
        ``note``). ``pcb_run_drc`` runs a fresh check, with no dialog.

        Each violation has ``x_mils``, ``y_mils``, ``layer`` and
        ``primitive1`` / ``primitive2`` ``{detail, type, net, layer,
        x_mils, y_mils}``.

        Args:
            net: Substring matched against each violation's description
                and name. Empty returns all.
            offset: How many matching violations to skip, for paging.
            limit: How many to return, 200 by default.

        Returns:
            ``violation_count`` (all matches), ``offset``, ``limit``,
            ``returned``, ``has_more`` (page on by ``returned``),
            ``drc_triggered``, ``note``, ``violations``.
pcb_get_component_padstool Get all pads of a specific PCB component.
Get all pads of a specific PCB component.

        Returns detailed pad information including pin name, position,
        net assignment, size, and hole information.

        DATASHEET DISCIPLINE: Pad name -> pin function mapping comes
        from the footprint, which can be wrong (especially the thermal
        pad on QFN/DFN, which is rarely numbered consistently across
        vendors). Before stating which pin a pad corresponds to,
        cross-check the manufacturer datasheet's mechanical /
        recommended-land-pattern section. The response carries
        `_datasheet_guidance` + `_datasheet_parts`.

        Args:
            designator: Component reference designator (e.g., "U1", "J3")

        Returns:
            Dictionary with "designator", "pads" array (each with name,
            x, y, net, layer, hole_size, top_x_size, top_y_size,
            rotation), "pad_count", plus `_datasheet_guidance` +
            `_datasheet_parts`.
pcb_get_componentstool Get all components from the active PCB with position and properties.Filesoutside text
Get all components from the active PCB with position and properties.

        DATASHEET DISCIPLINE: The response carries a `_datasheet_guidance`
        block. Before drawing any conclusion about a listed part's
        electrical behavior, pin function, or voltage rating, fetch its
        manufacturer datasheet (use WebSearch + WebFetch if you don't
        already have it). Library metadata here is NOT authoritative.

        Returns:
            Dictionary with "components" array (each with designator, x, y,
            rotation, layer, footprint, bbox, and bbox_no_name_comment: the
            box without the part's designator and comment) and "count", plus
            `_datasheet_guidance` + `_datasheet_parts`.

            Two heights, in mils above the part's own side of the board,
            and neither is chosen for you: ``height_mils`` is the
            footprint's Height field as entered in the library, and
            ``model_height_mils`` the tallest 3D body (STEP or extruded;
            null without one). ``height_mismatch`` is true when they
            differ; ``body_count`` says how many bodies were read and
            ``step_body_count`` how many are STEP models. Either height
            can be wrong for a given part: check the datasheet when it
            matters. ``basic_3d_models`` names the footprints placed with
            only extruded, cylinder or sphere bodies when the Config tab
            does not allow basic 3D models: tell the user and ask before
            replacing any.

        Args:
            body_heights: ``max`` (default) gives the tallest body per
                part; ``all`` adds ``bodies``: identifier, kind (step,
                extruded, cylinder, sphere), layer, standoff_mils,
                overall_mils.
pcb_get_coppertool Read the board's tracks, arcs, vias, regions, fills and pours with
Read the board's tracks, arcs, vias, regions, fills and pours with
        their geometry, a page at a time. Pours carry their outline in
        ``pts`` (``[x, y]`` per vertex, ``[x, y, cx, cy, r, a1, a2]`` where
        the edge is an arc). Unlike the other tools, lengths here are in
        Altium's internal units: divide by ``coord_per_mil`` in the reply.
        ``v`` is, per kind: track ``[x1, y1, x2, y2, width]``; arc ``[cx,
        cy, r, a1, a2, width]``; via ``[x, y, size, hole]`` with ``low``,
        ``high``, ``sizes`` per layer and its mask; fill ``[x1, y1, x2,
        y2, rotation]``. ``in_polygon``, ``pour`` and ``pour_net`` name the
        pour a piece was poured by.

        The fast bulk board reader: one layer of one kind reads in a
        second or two, where all copper of a busy board takes minutes.
        Narrow it with kinds and layer; every page walks the board again.

        Args:
            kinds: Comma list of track, arc, via, region, fill, polygon;
                read in that order. Empty reads every kind in one pass. An
                unknown kind is refused (BAD_KINDS).
            layer: One layer name, Mechanical17 and up included. Unknown is
                refused (UNKNOWN_LAYER) with the board's layer names.
            selected: Only the selected objects; offset and limit page
                through the selection.
            offset, limit: Paging; ``more`` says whether another page is
                left.

        Returns:
            ``copper`` (one entry per object: ``k`` its kind, ``layer``,
            ``net``, ``comp``, ``keepout`` and its geometry), ``offset``,
            ``count`` and ``more``.
pcb_get_design_rulestool Get all design rules from the active PCB.
Get all design rules from the active PCB.

        Every rule kind. ``rule_kind`` is a raw enum ordinal that differs
        between builds; read ``descriptor``, which names the kind and its
        values. Clearance-family rules also carry ``gap_mm``; trust it
        over the descriptor for Board Outline Clearance, whose descriptor
        always says ``Gap=0mil``. That rule's per-object table cannot be
        read. ``from_schematic``
        is true for a rule defined by a directive or parameter on the
        schematic: the next update from the schematic rewrites it, so
        change it there.

        Returns:
            Dictionary with "rules" array (each with name, rule_kind,
            enabled, priority, scope_1, scope_2, comment, descriptor,
            from_schematic, and
            gap_mm for clearance, component, hole-to-hole and board
            outline clearance rules) and "count".
pcb_get_diff_pair_rulestool Get all differential pair routing rules from PCB design rules.
Get all differential pair routing rules from PCB design rules.

        The routing rules, not the pairs themselves
        (pcb_get_differential_pairs lists those).

        Returns:
            Dictionary with "diff_pair_rules" array (each with name, enabled,
            scope_1, scope_2, comment, descriptor) and "count"
pcb_get_differential_pairstool Enumerate every ``IPCB_DifferentialPair`` on the active PCB
Enumerate every ``IPCB_DifferentialPair`` on the active PCB
        and report each pair's two halves with length skew.

        Compare ``skew_mils`` with the limit in the interface's own
        specification or the part's datasheet. One row per pair:
          - ``name``: pair name (e.g. ``"USB_DATA"`` if the SCH had
            ``.DiffPair`` directives ``USB_DATA_P`` / ``USB_DATA_N``)
          - ``positive_net`` / ``negative_net``: the two member nets
          - ``pos_length_mils`` / ``neg_length_mils``: summed track +
            arc length for each half (signal layers only)
          - ``skew_mils``: absolute difference
          - ``both_routed``: false means a half is unrouted and the
            lengths mean little

        Returns:
            Dict with ``{count, pairs: [...]}``.
pcb_get_dimensionstool Read the board's dimensions: kind, position, references, callouts.
Read the board's dimensions: kind, position, references, callouts.

        Each dimension's ``references`` say whether Altium bound that end to
        a board object (``bound``: it follows the pad or arc when that
        moves). ``texts`` are the callouts as drawn. Kinds: linear, angular,
        radial, leader, datum, baseline, center, original, linear_diameter,
        radial_diameter, each with its own values (angle, size, radius,
        sector, label, shape, text_locations).

        Args:
            index: One dimension by its index; -1 (default) reads all.
            pieces: Also list the tracks, arcs and texts it is drawn from.

        Returns:
            ``count`` (dimensions on the board) and ``dimensions``.
pcb_get_drill_pairstool List the board's drill layer pairs.
List the board's drill layer pairs.

        Returns:
            ``count`` and ``pairs``: ``index``, ``low_layer``,
            ``high_layer``, ``description``, ``backdrill``,
            ``plot_drill_drawing``, ``plot_drill_guide``.
pcb_get_fab_statstool DFM (Design For Manufacturing) summary -- the numbers fab
DFM (Design For Manufacturing) summary -- the numbers fab
        houses ask for on their quote forms.

        One IPC call returns:
          - ``board_width_mm``, ``board_height_mm``, ``board_area_mm2``
          - ``num_copper_layers``
          - ``vias_total``, ``vias_through``, ``vias_blind``,
            ``vias_buried``
          - ``pads_plated``, ``pads_unplated``, ``pads_slotted``
          - ``min_annular_ring_mils`` (plated holes, vias and pads)
          - ``min_track_width_mils`` (all copper layers)
          - ``smallest_hole_mils``, ``largest_hole_mils``,
            ``distinct_hole_count``

        Compare them with the chosen fab's published capabilities
        (``design_load_fab_profile``). Aspect ratio is not included; it
        needs ``pcb_get_layer_stackup``.

        Returns:
            Dict with all keys above. All linear measurements use the
            stated unit suffix (``_mm`` vs ``_mils``).
pcb_get_impedance_profilestool Read the impedance profiles in the active board's Layer Stack Manager.
Read the impedance profiles in the active board's Layer Stack Manager.

        Altium's field-solver figures: per profile and layer, the trace
        width (and pair gap) it chose, the impedance it calculated and its
        error from the target.

        Returns:
            ``profile_count``, ``read_errors`` (fields this build would
            not report) and ``profiles``: each with ``name``,
            ``target_ohms``, ``tolerance``, ``differential`` and
            ``layers``: ``layer``, ``stack`` (a rigid-flex board has one
            stack per kind of board region, each with its own lines),
            ``enabled``, ``trace_width_mils``, ``diff_pair_gap_mils``,
            ``calculated_impedance_ohms``, ``impedance_error``,
            ``etch_factor``, ``propagation_speed``, ``line_type`` and the
            ``top_reference`` / ``bottom_reference`` layers. A board with
            no profiles returns an empty list. Stack names, line types and
            references come from the Layer Stack Manager's model; when it
            cannot be read (below AD 22) rows keep only ``stack_index``.
pcb_get_layer_displaytool Visibility and colour for every layer on the active board.
Visibility and colour for every layer on the active board.

        Covers signal, plane, mechanical, mask, paste, silk, keepout and
        multilayer. Each entry gives the internal ``layer`` id, the user's
        ``name`` for it, whether it is ``visible``, ``in_stack``
        (a mid layer the stack does not use still reads as displayed), and
        its colour both as Altium's raw integer and as ``color_hex``.

        ``color_hex`` is #RRGGBB; the raw integer is byte-reversed.

        Returns:
            Dict with ``layers``, ``count`` and ``visible_count``.
pcb_get_layer_stackuptool Get the full PCB layer stackup information.
Get the full PCB layer stackup information.

        Returns copper layers with thickness, dielectric type/height/constant,
        and board name.

        Returns:
            Dictionary with "layers" array (each with name, order,
            copper_thickness_mils, dielectric_type, dielectric_height_mils,
            dielectric_constant), "layer_count", and "board_name"
pcb_get_mech_layer_namestool Every enabled mechanical layer on the board, and what is on it.
Every enabled mechanical layer on the board, and what is on it.

        ``primitive_count`` counts what sits on each layer: 0 is a spare
        layer, -1 not counted. Every enabled layer is listed, shown or
        not (``displayed``). ``kind`` is what the layer is FOR; a kind
        belongs to one layer (a paired kind to the pair), so assigning it
        moves it. ``kind_id`` -1 means this build has no layer kinds.

        Args:
            count_primitives: Count what sits on each layer. The board is
                walked once per enabled layer, so pass False when only
                the names are wanted.

        Returns:
            Dict with ``mechanical_layers`` (each: layer, number, name,
            enabled, displayed, kind, kind_id, partner_layer -- the
            enabled layer it is paired with, or None -- and
            primitive_count),
            ``count``, ``occupied_count``, ``counted_primitives`` and
            ``scanned_to``, the layer number the scan stopped at.
pcb_get_net_classestool Get all net classes on the active PCB, with the nets in each.
Get all net classes on the active PCB, with the nets in each.

        Members are found by asking each class about every net, so on a
        big board ``members=False`` is quicker when only names are needed.

        Args:
            members: Read each class's nets (default). False returns the
                class names only.

        Returns:
            Dictionary with "net_classes" (each with name, super_class and,
            when members are read, "nets", "member_count" and
            "probe_errors"), "count" (built-in superclasses included),
            "user_class_count" (without them) and "members_read". A class with
            probe_errors above 0 may have more nets than listed.
pcb_get_netstool Get all unique net names from the active PCB board.
Get all unique net names from the active PCB board.

        Returns:
            Dictionary with "nets" array of net name strings and "count"
pcb_get_pad_propertiestool Get detailed pad information filtered by net or component.
Get detailed pad information filtered by net or component.

        Returns pad shape, size, hole, thermal relief, and solder/paste
        mask expansion details. Provide at least one filter (net or
        designator) to avoid returning all pads on the board. AT MOST 500
        pads come back, with nothing to say more were left, and every pad
        is looked at: for one part ``pcb_get_component_pads``; for one net
        ``obj_query("ePadObject", ..., filter="Net=GND")``.

        Args:
            net: Filter by net name (e.g., "GND", "VCC"). Optional.
            designator: Filter by component designator (e.g., "U1"). Optional.

        Returns:
            Dictionary with "pads" array (each with name, component, x, y,
            net, layer, shape, top_x_size, top_y_size, hole_size, rotation,
            is_smd, solder_mask_expansion, solder_mask_bottom_expansion,
            solder_mask_separate, paste_mask_expansion) and "count".
            solder_mask_expansion is the TOP side when
            solder_mask_separate is true and both sides when it is false;
            the bottom value is stored either way and takes effect once
            the sides are unlinked. Expansions read 0 when the pad follows
            the board's rule.
pcb_get_pad_via_librarytool The pad and via templates a board holds, or a .PvLib holds.
The pad and via templates a board holds, or a .PvLib holds.

        A board keeps its own pad/via library of the templates its pads
        and vias use. With ``library_path`` the .PvLib file is opened and
        read instead. Either way the installed pad/via libraries are
        listed too. Changes nothing.

        Args:
            board_path: The .PcbDoc. Defaults to the focused board.
            library_path: A .PvLib to read instead of a board.

        Returns:
            ``board_templates`` (or ``templates`` for a .PvLib)
            [{name, description, id, used_by}] and
            ``installed_libraries`` [{name, path, templates}].
pcb_get_polygonstool Get all polygon pours on the active PCB with copper area.
Get all polygon pours on the active PCB with copper area.

        Outlines with true arcs: ``pcb_get_copper(kinds="polygon")``; one
        pour's poured copper: ``pcb_get_pour_copper``.

        Each row: ``index``, ``name``, ``net``, ``layer``,
        ``hatch_style``, ``pour_over``, ``poured`` (false when shelved),
        ``vertex_count``, ``bbox_mm2``, and:
          - ``area_sqmils`` / ``area_mm2``: the OUTLINE's area, unchanged
            by the pour and including copper cut away by clearances.
          - ``copper_area_mm2``: copper actually poured (regions minus
            their holes). A hatched pour is tracks, so its region area
            is 0.
          - ``copper_area_exact``: false when holes could not be read;
            the area then overstates the copper.
          - ``copper_pieces``: 0 on a poured polygon means nothing
            poured.

        Returns:
            Dict with ``{polygons: [...], count: N}``.
pcb_get_pour_coppertool The copper one pour poured: every piece with its outline and holes.
The copper one pour poured: every piece with its outline and holes.

        Args:
            index: The pour's ``index`` from pcb_get_polygons.
            name: Its ``name`` there. Positions shift as pours are added or
                removed, so a pour at ``index`` with another name is refused
                (POUR_CHANGED). Names repeat on many boards, so the index
                is what picks the pour.

        Returns:
            ``index``, ``name``, ``net``, ``layer``, ``pieces``, ``holes``,
            ``vertices``, ``area_sqmils`` (copper less its holes) and
            ``copper``: one entry per poured region with ``outlines`` and
            ``holes`` (each a list of [x, y] in mils, arcs as Altium
            flattened them) and its ``area_sqmils``. ``strokes`` counts the
            tracks and arcs of a hatched pour, which pcb_get_copper reads.
pcb_get_pour_outlinetool The outline one pour fills (not the copper it poured), arcs included,
The outline one pour fills (not the copper it poured), arcs included,
        as Altium holds it.

        Args:
            index: The pour's ``index`` from pcb_get_polygons.
            name: Its ``name`` there. Positions shift as pours are added or
                removed, so a pour at ``index`` with another name is refused
                (POUR_CHANGED).

        Returns:
            ``index``, ``name``, ``net``, ``layer``, ``corners``, ``outline``
            (each ``at`` [x, y], and ``arc`` with ``centre``, ``radius``,
            ``from_deg``, ``to_deg`` where the edge is an arc), the
            ``closing_vertex`` and ``closes_on_first`` (a closing vertex off
            the first spikes the poured shape).
pcb_get_room_rulestool Get all room-like rules (confinement constraint design rules).
Get all room-like rules (confinement constraint design rules).

        The confinement rules, not room objects. Bounds in mils.

        Returns:
            Dictionary with "room_rules" array (each with name, enabled, kind,
            scope_1, comment, x1, y1, x2, y2) and "count"
pcb_get_rule_propertiestool Read a named PCB design rule: name, rule_kind, enabled,
Read a named PCB design rule: name, rule_kind, enabled,
        priority, and a ``descriptor`` string holding the constraint
        values as Altium words them, e.g.
        ``"Clearance Constraint (Gap=0.127mm) (All),(All)"``. Parse it
        for numbers.

        To CHANGE a constraint use ``pcb_set_rule_properties``;
        ``obj_modify`` reports a match and changes nothing.

        A clearance-family rule also returns ``gap_mm`` from the rule
        itself; for Board Outline Clearance the descriptor says
        ``Gap=0mil`` whatever the rule holds, so read ``gap_mm``.

        Args:
            name: Design rule name (e.g., "Clearance", "Width", "RoutingVias").

        Returns:
            Dict with name, rule_kind, enabled, priority, descriptor, and
            gap_mm for a clearance-family rule.
pcb_get_selected_objectstool Get properties of currently selected objects on the active PCB.
Get properties of currently selected objects on the active PCB.

        Reads Altium's selection list, not the board: the quick way to
        read what is selected (``obj_query`` with ``Selected=true`` checks
        every object; ``pcb_get_copper(selected=True)`` gives geometry).

        Args:
            properties: Comma-separated property names to return; any
                name ``obj_query`` reads, e.g. ObjectId, X, Y, X1, Y1, X2,
                Y2, Layer, Net, Width, Name, Rotation, HoleSize, TopXSize,
                TopYSize, Size, Pattern, SourceDesignator, Text,
                Descriptor, Selected. A misspelt name reads blank.

        Returns:
            Dictionary with "objects" array and "count"
pcb_get_trace_lengthstool Get total routed track length per net on the active PCB.
Get total routed track length per net on the active PCB.

        Sums all track segment lengths for each net. Useful for length
        matching analysis and checking differential pair balance.

        Args:
            net: Optional net name filter. If provided, only returns the
                 length for that specific net. Empty = all nets.

        Returns:
            Dictionary with "trace_lengths" array (each with net name and
            length_mils) and "net_count"
pcb_get_unrouted_netstool Get list of nets with unrouted connections (ratsnest lines).
Get list of nets with unrouted connections (ratsnest lines).

        Identifies nets that still have ratsnest lines, meaning they are
        not fully routed. Useful for checking routing completion status.

        Stored connection lines go out of date, so by default Altium
        re-derives them first. ``obj_query`` on ``eConnectionObject`` lists
        each line with its ends.

        Args:
            reanalyze: re-derive the ratsnest before counting (default
                True). False reads the stored lines as they are, faster
                on a large board.

        Returns:
            Dictionary with "unrouted_nets" array (each with net name and
            unrouted_connections count), "net_count", "total_unrouted" and
            "reanalyzed"
pcb_get_viastool Get the vias on the active PCB board.
Get the vias on the active PCB board.

        Returns via position, pad size, hole size, net assignment, and
        start/end layer. Positions are absolute (not from the board origin).

        Args:
            net: Only this net's vias (exact name). Empty is every via.
                Every via is still looked at; ``obj_query("eViaObject",
                ..., filter="Net=GND")`` reads only the net's own.
            offset, limit: Page a large board; limit 0 returns every match.

        Returns:
            Dictionary with "vias" array (each with x, y, size, hole_size,
            net, low_layer, high_layer), "count" (every via that matches),
            "returned" (on this page), "offset" and "more".
pcb_get_xsignalstool List the board's xSignals with their lengths.
List the board's xSignals with their lengths.

        An xSignal is a signal path from pin to pin that may run through
        series parts (a resistor or an AC-coupling capacitor), so a bus
        can be length-matched across them.

        Returns:
            ``count`` and ``xsignals``: ``name``, ``length_mils``,
            ``routed_length_mils``, ``unrouted_length_mils``,
            ``node_count`` and ``items`` (the pins and parts it runs
            through, as Altium names them).
pcb_glosstool Run Altium's Gloss (smooth and shorten the routing) or Retrace
Run Altium's Gloss (smooth and shorten the routing) or Retrace
        (re-run it at the current width and clearance rules) on the
        routing of the given nets, and report each net's track count and
        routed length before and after.

        Only these nets' tracks and arcs are touched: they are selected,
        the command runs on the selection, and the selection is cleared.
        Gloss can reshape copper routed by hand: check the result.

        Args:
            nets: Net names.
            mode: "gloss" or "retrace".

        Returns:
            ``mode``, ``selected`` and ``nets`` (``tracks_before`` /
            ``tracks_after``, ``length_before_mils`` /
            ``length_after_mils``).
pcb_grow_pourtool Move a pour's outline out by a distance all round, or in with a
Move a pour's outline out by a distance all round, or in with a
        negative distance, as Altium's own Grow does: to pull a pour back
        from the board edge or spread it to a new keepout.

        The copper is not repoured: call pcb_repour_polygons afterwards.

        Args:
            name: The pour's name (pcb_get_polygons lists them). It must
                belong to one pour only (AMBIGUOUS_NAME lists the
                candidates); give ``index`` too to pick one of them.
            distance_mils: How far to move the outline; negative shrinks.
            index: The pour's index, alone or with the name (the pour
                there must then carry it).

        Returns:
            ``name``, ``index``, ``distance_mils``, ``bounds_before`` and
            ``bounds_after`` (left, bottom, right, top in mils).
pcb_hole_symbolstool Show or hide the drill symbols Altium draws on every hole.
Show or hide the drill symbols Altium draws on every hole.

        Args:
            show: True draws them, False removes them.
            symbol_size: Symbol size in mils (default 50).
            symbol_type: Altium's symbol style code (default 0).
            layer_pair: Which drill pair's holes (index, default 0).
pcb_impedance_profiletool Create, change or remove an impedance profile in the Layer Stack
Create, change or remove an impedance profile in the Layer Stack
        Manager. pcb_get_impedance_profiles reads them, with the width
        Altium's solver works out per layer; pcb_impedance_profile_layer
        sets a profile's limits on one layer.

        Args:
            action: create, set or remove.
            profile: The profile's name (the new one's, for create).
            name: A new name (set).
            target_ohms: The target impedance.
            tolerance: The tolerance, in percent.
            differential: A differential pair profile.
            coplanar: Coplanar (reference copper beside the trace).

        Returns:
            ``profiles_before``, ``profiles_after`` and ``not_applied``.
pcb_impedance_profile_layertool Read, or set, one impedance profile's settings on one layer:
Read, or set, one impedance profile's settings on one layer:
        whether it applies there, the trace width (locked, or worked out by
        Altium within its limits), the pair gap and its limits, clearance
        to plane for coplanar work, and how the solder mask over the trace
        is modelled. Every value set is read back.

        Args:
            profile: The profile's name.
            layer: The copper layer's name.
            top_reference, bottom_reference: The layers the solver takes
                as the trace's return above and below it ("none" clears
                one), as on a stack whose ground is a poured signal layer.

        A layer the profile does not hold yet is added to it
        (``layer_added``); it starts disabled with no width until Altium's
        solver runs in the Layer Stack Manager.

        Returns:
            The layer's settings with ``calculated_ohms`` (a maximum of
            ``null`` is no limit), and ``not_applied``.
pcb_import_placementtool Position components from a coordinate list (pick-and-place import).
Position components from a coordinate list (pick-and-place import).

        The inverse of `pcb_export_coordinates`. Each entry repositions a
        component already on the board, by designator. Absolute coordinates in
        mils, rotation in degrees; supplying `side`/`layer` flips the component
        to that side (a part already there is left alone).

        Applied in the order that gives an exact result: the side first, then
        the rotation, then the move. ``rotation`` is the FINAL rotation as
        Altium shows it, after any flip, and x/y are the component origin
        exactly, whatever the flip and the turn did to it (both move an
        asymmetric part). A part given only a side or a rotation keeps its
        origin. Every part is read back.

        A FLIP MIRRORS THE PART LEFT-RIGHT (seen from the top) about its
        origin, and Altium changes the rotation it reports: a part facing
        +Y in its library faces +Y on either side at the same rotation,
        one facing +X faces -X on the bottom. For a connector, read the
        pads back (pcb_get_component_pads) to confirm which way it faces.

        Args:
            placements: list of dicts, each supporting:
                designator (required)
                x        (optional) , X in mils
                y        (optional) , Y in mils
                rotation (optional) , degrees
                side     (optional) , "top" or "bottom"
                layer    (optional) , "TopLayer" / "BottomLayer" (overrides side)

        Returns:
            ``applied``, ``failed``, ``unknown_layers``, and ``mismatched``
            with ``mismatches`` (the first 20: designator, what is wrong,
            and the read-back x, y, rotation and layer).
pcb_keepout_board_outlinetool Draw the board outline on the Keep-Out layer.
Draw the board outline on the Keep-Out layer.

        Every outline edge, arcs included, becomes a keep-out track or arc
        of ``width_mils`` centred on the edge. Copper on every layer (a
        pour, a route) then stays half that width plus the clearance rule
        from the board edge, and a pour larger than the board stops there.
        Edges already drawn on the Keep-Out layer are left alone, so a
        second call adds nothing.

        Args:
            width_mils: Keep-out width (default 20, so copper keeps 10 mil
                plus clearance from the edge).

        Returns:
            ``edges``, ``added``, ``already_there`` and ``width_mils``.
pcb_layer_stack_managertool Read the Layer Stack Manager's own data for the open board.
Read the Layer Stack Manager's own data for the open board.

        Nothing is written.

        pcb_physical_stack reads the board's layer objects (Z, thickness,
        material, constant). This reads the Layer Stack Manager's own data,
        which holds more: each layer's type (copper, core, prepreg,
        dielectric, solder_mask, overlay or other), material, thickness, dielectric
        constant, copper weight, and every named material / process
        property that has a value, such as glass construction, resin
        content, Tg, frequency, copper weight and process, or pullback;
        the drill pairs; the stack (symmetric, flex), via spans, drill
        spans and impedance profiles. The manager's provider is dropped
        first, so the read follows the board as it is now.

        Args:
            include_model: "" for none; "xml" adds the manager's model as
                its StackupDocument XML, "records" the same as |KEY=VALUE|
                records.
            compare: Also read pcb_physical_stack and report where the
                manager disagrees with the board's own stack
                (``out_of_step``). The manager keeps its own copy of the
                stack; once it has one, a script write to the board's
                stack (pcb_set_dielectric, pcb_modify_layer, a rebuild)
                does not reach it, and the manager goes on showing, and on
                its next apply writing back, the old values.
                pcb_sync_stack_manager brings it back in step.

        A rigid-flex board has one stack per kind of board region. The
        top-level layers and spans are the first stack's; with more than one
        stack, ``stacks`` gives every stack with its own layers and spans, and
        ``branches`` which stack each section of the board uses.

        Returns:
            ``layers`` (name, guid, type_id, type, material,
            thickness_mils, dielectric_constant, weight, enabled,
            properties), ``property_names``, ``drill_pairs`` (the board's
            own pairs: name, start_layer / stop_layer ids and their names,
            micro_via, back_drill, stacks), ``stacks`` (name, id, flex,
            region, layers, via_spans, drill_spans), ``branches``
            (name, sections: name, parent, stacks), ``stack`` (name, id,
            symmetric, flex),
            ``stacks_count``, ``stackup_type``, ``roughness_model``,
            ``via_spans`` (name, type, start_layer, stop_layer),
            ``drill_spans``, ``impedance_profiles`` (name, impedance_ohm)
            and, when asked, ``model``; with compare, ``out_of_step``
            (layer, field, board, stack_manager) and ``in_step``.
pcb_layer_stackstool List or change the board's layer stacks for rigid-flex: each
List or change the board's layer stacks for rigid-flex: each
        region uses one stack, and a flex region a stack with fewer
        copper layers.

        Args:
            action: list, create (name, flex), rename (stack, name),
                remove (stack), set_flex (stack, flex), enable_layer /
                disable_layer (stack, layer: a copper layer of the board),
                or assign (stack, region: give a board region this stack).
            stack: The stack to act on, by name.
            name: The new stack's name, or the new name.
            flex: Whether the stack is flex.
            layer: A copper layer name, e.g. "Top Layer".
            region: A board region's name.

        Returns:
            The rigid-flex setup afterwards (see pcb_get_board_regions).
pcb_layer_viewtool Read the board view, and change it in one call.
Read the board view, and change it in one call.

        With no arguments it only reads. The reply lists every layer with
        ``visible``, Mechanical17 and up included (enabled ones only), and
        for a mechanical layer ``single_layer_lock``: whether it stays drawn
        in single layer mode (the Ctrl+click lock in View Configuration).
        It also gives ``current_layer`` and ``single_layer_mode``, which is
        enough to put a view back the way it was.

        With a PcbLib in front it reads and changes the library's own
        view, the footprint being edited, never another open board.

        Args:
            show: Layers to display (a list, or text with commas).
            hide: Layers to hide.
            lock: Mechanical layers to keep drawn in single layer mode.
            unlock: Mechanical layers to release from that.
            current_layer: The layer to make current.
            single_layer_mode: True or False to switch single layer mode.

        A layer is a stack name, an id such as "Mechanical21", or the
        user's name of any mechanical layer. Every write is read back:
        ``not_applied`` lists what did not take, ``unknown_layers`` the
        names that matched no layer. View state only; the board is not
        marked modified.
pcb_layout_audittool Measure a board for the layout stages' exit gates. Changes nothing.
Measure a board for the layout stages' exit gates. Changes nothing.

        Reads the focused board (or a saved LayoutBoard JSON) and runs
        these checks, each with counts and findings in mils:

        - ``placement_audit``: body overlaps, pads under clearance, parts
          on keepouts or off the board.
        - ``connectivity_summary``: routed / partial / unstarted nets.
        - ``drc``: the exact clearance check.
        - ``corner_audit``: bends sharper than 45 degrees.
        - ``track_shape_audit``: staircases (a run drawn as a chain of
          tiny steps) and tracks shorter than their own width that are
          no stub into a pad or via.
        - ``return_via_audit``: signal vias with no ground via within
          ``max_distance_mils``.
        - ``plane_region_audit``: pour copper broken into islands.
        - ``loop_audit``: hot, gate-drive, decoupling, crystal and other
          loops, worst first. Advisory.
        - ``pad_entry_audit``: off-axis, off-centre, too-wide or uneven
          pad entries. Fails only on high severity.
        - ``rotation_audit``: parts whose connections are shorter turned
          90, 180 or 270 degrees, a turn into a neighbour's courtyard
          excluded. Advisory.

        Log the result as ``data`` on the stage_result
        (``design_session_log``).

        Args:
            checks: names from the list above; None runs them all.
            expect_file: full path of the focused board, for a live read;
                refused if another board is focused.
            board_json_path: a saved LayoutBoard (.json or .json.gz) to
                audit offline instead.
            nets: nets for ``return_via_audit``; None checks diff-pair
                and high-speed nets, or every signal via.
            max_distance_mils: return via distance, centre to centre.
            limit: findings listed per kind; counts are never cut.

        Returns:
            ``{"board", "pass", "summary": {check: {pass, counts...}},
            "checks": {check: full result}, "source": "live"|"file"}``, or
            ``{"error": ...}``.
pcb_local_gridtool Add a cartesian or polar grid for one area, list or delete grids, or read the grid at a point.
Add a cartesian or polar grid for one area, list or delete grids, or read the grid at a point.

        A polar grid places parts on circles and spokes about a centre, as
        on a round board; a cartesian grid can be rotated. A local grid
        wins over the board grid in its area.

        Args:
            action: ``add_cartesian``, ``add_polar``, ``at`` (the grid that
                applies at x, y), ``list`` (every grid), ``delete`` (the
                grids named ``name``) or ``delete_all`` (every user grid).
            x, y: The grid origin (the centre of a polar grid), absolute.
            name: The grid's name. A new grid is stored with its kind at
                the end, _cart or _pol; list and delete take the name with
                or without it. A grid without the tag (made in Altium) is
                listed with kind unknown and without steps or extent.
            step_x, step_y, rotation: Cartesian steps and its angle.
            width, height: How far a cartesian grid reaches from its
                origin in each direction (one quadrant's size).
            angular_step, radial_step, min_radius, max_radius,
            start_angle, end_angle: Polar angles in degrees, the step and
                radii as lengths.
pcb_lock_net_routingtool Lock or unlock track / arc / via primitives on a list of nets.
Lock or unlock track / arc / via primitives on a list of nets.

        Locked objects stay put when "Protect Locked Objects" is on in the
        PCB preferences.

        Args:
            nets: Net names to lock / unlock (e.g. ``["VCC", "GND",
                "CLK_24M"]``). Case-sensitive.
            lock: True to lock (sets Moveable=False), False to unlock.
            lock_components: Also lock any component with a pad on a
                matched net. Default False.

        Returns:
            Dict with:
              - ``locked``: True / False mirror of the input
              - ``matched_primitives``: track + arc + via objects whose
                net matched
              - ``updated_primitives``: how many actually changed state
              - ``matched_components``: components touched (only filled
                when ``lock_components=True``)
              - ``updated_components``: components whose Moveable flipped
pcb_make_layer_stacktool Make the board's layer stack match a wanted one, copper and
Make the board's layer stack match a wanted one, copper and
        dielectrics, top to bottom.

        Copper first: outer layers renamed, inner ones kept where the wanted
        stack has the same kind in the same order (a plane keeps its pour),
        the rest dropped (refused when objects lie on them), new ones added
        as plain copper. Then each gap's dielectrics are trimmed to the
        wanted count and set. A dielectric cannot be added, so a gap with
        fewer than wanted is refused: plan one per gap.

        The board must be saved first. Any failure closes it unsaved and
        reopens it, which restores it. A run that matches also brings the
        Layer Stack Manager's own copy of the stack in step
        (``stack_manager``, as pcb_sync_stack_manager reports it); save
        afterwards.

        Args:
            layers: Top to bottom: ``{"kind": "copper", "name",
                "thickness_mils", "plane": false}`` or ``{"kind":
                "dielectric", "thickness_mils", "type": "core" | "prepreg",
                "constant", "loss_tangent", "material", "name"}``.
            dry_run: Only plan (the default).
            board_path: The .PcbDoc; it is brought to the front.

        Returns:
            ``wanted``, ``copper_edits`` (and ``dielectric_edits`` once run),
            ``mismatches`` (empty when the board reads as wanted), ``done``,
            ``stack_manager`` after a run that matches, and ``restored``
            after a failure.
pcb_make_paste_gridtool Split one pad's solder-paste opening into a regular grid of
Split one pad's solder-paste opening into a regular grid of
        smaller fills, typically for a QFN/DFN exposed pad. Use the
        stencil pattern from the IC's datasheet when it gives one;
        this tool only does a regular grid.

        Args:
            designator: Component designator, e.g. ``"U5"``.
            pad_name: Pad name on that component. Check the footprint
                for an exposed pad's name.
            min_grid_size_mils: Starting block size; raised in 5-mil
                steps until coverage is met.
            min_gap_mils: Minimum gap between blocks.
            min_coverage_pct: Target paste coverage, % of pad area.

        Returns:
            ``{designator, pad_name, grid_x, grid_y, grid_size_mils,
            gap_x_mils, gap_y_mils, fills_placed, coverage_pct}``. The
            pad's own paste opening is suppressed with a manual
            negative paste-mask expansion before the fills go down.
pcb_measure_clearancetool How far apart two board objects are, and whether that breaks a rule.
How far apart two board objects are, and whether that breaks a rule.

        The edge-to-edge distance Altium measures between the two
        (PrimPrimDistance), the clearance rule Altium itself applies to the
        pair (its own scope and priority resolution) and Altium's own check
        of that rule against the pair (ActualCheck): the same resolution and
        the same check the online DRC makes, for one pair, without a DRC run.

        Args:
            object1: "U1.3" pad 3 of U1, or "<type>:<filter>" for a free
                primitive in the generic filter grammar, e.g.
                "track:Layer=TopLayer|X1=100|Y1=200|X2=300|Y2=200" or
                "via:Net=GND|X=1200|Y=800". The filter must match exactly
                one object. Net=, Component=, X1/Y1 or BoundsLeft/
                BoundsBottom find it at once; X=/Y= alone check every
                object of the type (seconds on a busy board). A whole component ("U1") or a net ("net:GND") is
                refused: a distance needs one primitive.
            object2: The second object, in the same forms.

        Returns:
            ``distance_mils``, ``distance_mm``, ``touching`` (distance 0),
            ``rule`` (``name``, ``kind``, ``priority``, ``enabled``,
            ``scope1``, ``scope2``, ``descriptor``; null when no clearance
            rule applies), ``gap_mm`` (the rule's gap, null when unknown)
            and ``violation`` (false when no rule applies). With no rule,
            ``scoped_rule`` is the clearance rule whose two scopes take the
            pair anyway, with ``scoped_gap_mm``, ``net_scope_matches`` (false
            when its net scope leaves the pair out, as for two objects with
            no net on a different-nets rule) and ``below_scoped_gap``.
pcb_modify_bend_linetool Change a bend line's radius, angle or fold order: the region it
Change a bend line's radius, angle or fold order: the region it
        belongs to and its index there, as pcb_get_board_regions lists
        them. Read back in the region's ``bend_lines``.
pcb_modify_layertool Tune properties on an existing copper layer.
Tune properties on an existing copper layer.

        Only the values given (non-empty, non-zero) are applied.

        Args:
            layer: Target layer name, e.g. "MidLayer1"
            name: New layer name (optional)
            copper_thickness_mils: New copper thickness in mils (optional);
                fractions are kept, 1 oz is 1.378
            dielectric_type: "none" | "core" | "prepreg" | "surface" (optional)
            dielectric_height_mils: New dielectric height in mils (optional);
                fractions are kept
            dielectric_constant: New Dk value (optional)
            dielectric_material: New dielectric material string (optional)

        Returns:
            Dictionary confirming the changes, and ``stack_manager``: the
            Layer Stack Manager's own copy of the stack brought in step, as
            pcb_sync_stack_manager reports it.
pcb_modify_polygontool Modify a polygon pour's properties and its pour options.
Modify a polygon pour's properties and its pour options.

        Name the pour by ``name``, ``index`` or both, from
        ``pcb_get_polygons``. Indices shift after every modify and repour,
        so prefer the name: a name alone must belong to exactly one pour
        (AMBIGUOUS_NAME lists the candidates); with an index too, the pour
        at that index must carry the name (POUR_CHANGED). Nothing here
        repours: run ``pcb_repour_polygons`` after (``repour_needed`` says
        so).

        Args:
            index: Polygon index (from pcb_get_polygons output).
            name: Polygon name, case ignored.
            net: New net; an unknown name goes to ``not_applied``.
            layer: New layer name.
            hatch_style: "Solid", "NoHatch", "45Degree" or "90Degree".
            remove_dead: Remove copper islands off the net. None leaves
                it unchanged, as for the next two.
            remove_narrow_necks: Remove necks under the threshold.
            remove_islands_by_area: Remove islands under the area
                threshold.

        Returns:
            ``modified`` (something changed), ``success``, ``index``
            (where the pour was), ``name`` (its name now), ``changed``,
            ``not_applied``, ``repour_needed``, ``note``.
pcb_move_componentstool Move and/or rotate MANY PCB components in ONE IPC round-trip.
Move and/or rotate MANY PCB components in ONE IPC round-trip.

        One Altium transaction for the whole list.

        Args:
            moves: List of move dicts. Each dict supports:
                designator (required) , target component
                x        (optional)   , new X in mils
                y        (optional)   , new Y in mils
                rotation (optional)   , new rotation in degrees

            Example:
                [
                  {"designator": "U1", "x": 5000, "y": 5000, "rotation": 0},
                  {"designator": "R1", "x": 5200, "y": 4800},
                  {"designator": "C1", "rotation": 90},
                ]

        Returns:
            Dictionary with per-designator results and a count.
pcb_move_layertool Move a layer up or down the board's layer stack.
Move a layer up or down the board's layer stack.

        Moves it one or more places and writes the new order into the board.

        This is the Layer Stack Manager's own intelligent move: the layer
        swaps with its neighbour of the same kind (copper with copper) and
        the dielectrics between them go with it. Objects stay on their
        layers, so the routing on a moved layer moves with it. A move that
        would leave the stack is refused; the moves done before it stay.

        On a symmetric stack the move is mirrored on the opposite half
        (moving L2 down also swaps the matching layers near the bottom),
        unless ``alone`` is set: symmetry is then switched off for the move
        and asked back on afterwards. Altium keeps a stack marked symmetric
        only when it is: after a move alone that leaves it lopsided it
        stays non-symmetric (``symmetric_after``).

        The move goes through the Layer Stack Manager's own copy of the
        stack and writes that copy into the board. Once a board carries
        that copy, script writes to the board's stack (pcb_set_dielectric,
        pcb_modify_layer, a rebuild) do not reach it, and a move would put
        the old values back. So the two are compared first and the move is
        refused while they disagree (``out_of_step``, as
        pcb_layer_stack_manager reports it; pcb_sync_stack_manager brings
        them in step); ``force`` moves anyway.

        Args:
            layer: The layer's name as the stack shows it, e.g. "Layer 2".
            direction: "up" or "down".
            steps: How many places, 1 to 64.
            alone: Move only this layer on a symmetric stack.
            force: Move even when the Layer Stack Manager disagrees with
                the board's stack (its values are then written back).

        Returns:
            ``layer``, ``direction``, ``steps_requested``, ``steps_done``,
            ``refused`` (the next move was refused), ``symmetric`` (the
            stack was symmetric), ``alone``, ``mirrored`` (the opposite
            layers moved too), ``symmetric_after``, ``order_before`` /
            ``order_after`` (the board's copper layers top down) and
            ``stack``; refused for disagreement: ``out_of_step``.
pcb_move_tracks_to_layertool Move all tracks of a net to one layer, adding vias where needed.
Move all tracks of a net to one layer, adding vias where needed.

        Relayers every track of `net_name` onto `target_layer`, then drops a
        via at each same-net single-layer (SMD) pad that is NOT on the target
        layer, since that pad can now only connect through a layer change.
        Multilayer (through-hole) pads need no via. This flattens a net's
        routing onto one layer, so use it deliberately. Tracks only (arcs
        stay where they are), and every track of the net moves: those
        inside footprints and a hatched pour's tracks too.

        Args:
            net_name: Net whose tracks move.
            target_layer: Destination signal layer (e.g. "BottomLayer").
            via_size_mils: Via pad diameter for added vias (default 50).
            via_hole_mils: Via hole diameter (default 28).

        Returns:
            {"net", "target_layer", "moved", "vias_added"}.
pcb_net_displaytool Read, or set, whether nets show their connection lines,
Read, or set, whether nets show their connection lines,
        whether loop removal applies to them, their net colour and
        whether they draw in it, and whether their jumpers show.

        ``color`` with ``use_net_color=True`` draws nets in your colour;
        ``from_project=True`` gives each net its project colour
        (proj_net_color) so board and schematic highlight alike.

        Args:
            nets: Net names; with from_project and no nets, every net on
                the board.
            show_connections: Show (True) or hide (False) their
                connection lines; omit to leave as they are.
            loop_removal: Loop removal on or off; omit to leave.
            use_net_color: Draw the net in its own net colour on the
                board; omit to leave.
            show_jumpers: Show the net's jumpers; omit to leave.
            color: "#RRGGBB" to give the nets this colour; empty to leave.
            from_project: Give each net its project colour and draw it in
                it; a net the project gives no colour is listed in
                ``no_project_color`` and left as it is.

        Returns:
            ``board``, ``project`` (with from_project), ``nets``
            (``connections_shown``, ``loop_removal``, ``use_net_color``,
            ``color`` as "#RRGGBB", ``jumpers_shown`` and
            ``in_differential_pair``, read back), ``no_project_color`` and
            ``not_found``.
pcb_net_figurestool Altium's own figures for each net: lengths, delays, vias and pads.
Altium's own figures for each net: lengths, delays, vias and pads.

        ``routed_length_mils`` (the copper laid), ``signal_length_mils``
        (pad to pad, as Altium measures it for length matching),
        ``delay_total`` and ``signal_delay`` (Altium's propagation
        figures), ``vias``, ``pads`` and ``in_differential_pair``.

        Args:
            nets: Only these nets. Empty lists every net.
            limit: The most nets to list (default 500).
pcb_normalize_viastool Set free vias to their Routing Via rule's sizes, or to given ones.
Set free vias to their Routing Via rule's sizes, or to given ones.

        Without ``size_mils``/``hole_mils``, each via takes its dominant
        Routing Via rule's preferred diameter and hole. A rule in template
        mode ("Templates Used To Check Via") is refused for its vias, since
        its size fields are not what it checks: use pcb_apply_via_template.
        Any target without an annular ring is refused.
        Refused vias are left as they were.

        Args:
            size_mils, hole_mils: An explicit diameter and hole, together.
            net: Only vias on this net.
            from_size_mils, from_hole_mils: Only vias at this size now
                (within 0.05 mil), e.g. to fix one group.
            dry_run: Report what would change and change nothing.

        Returns:
            ``changed``, ``unchanged``, ``failed`` (did not read back), the
            refusal counts, and ``before``/``after``: vias counted by
            "diameter/hole" in mils. ``success`` is false when any via was
            refused or failed.
pcb_object_outlinetool The outline of each SELECTED board object, grown by a clearance.
The outline of each SELECTED board object, grown by a clearance.

        Altium's own outline of the object's copper on one layer: a pad or
        via by its shape there, a track or arc with its round ends, text by
        its strokes, a region or pour by its edge. Grown by ``expansion``
        it is the area a clearance of that size keeps free, ready to place
        as a keepout or cutout region. Select the objects first with
        obj_select. Arcs come back as short straight segments.

        Args:
            expansion: Mils to grow each outline by (negative shrinks).
            layer: Layer to take the outline on. Empty: each object's own
                layer, top copper for a through-hole pad or via.
            limit: The most objects to return (default 200).

        Returns:
            ``expansion``, ``selected``, ``listed``, ``failed``,
            ``truncated`` and ``objects``, each with ``kind``, ``layer``,
            ``outlines`` and ``holes`` (point lists in mils),
            ``area_sqmils`` and ``problem`` (empty when it worked).
            NOTHING_SELECTED when no object is selected.
pcb_pad_relieftool Read or set ONE pad's or free via's own thermal relief.
Read or set ONE pad's or free via's own thermal relief.

        This is the pad's Properties > Thermal Relief, not a design rule.
        With a PcbLib in front it acts on a footprint's pad or via instead
        (the current footprint, or ``footprint``), which carries the relief
        onto every board the footprint is placed on.
        With no value given it reads; with any value it writes the pad
        (SMD pads only) and reads it back. The pour shows a pad's own
        relief only where the polygon connect rule lets the pad decide;
        repour afterwards (pcb_repour_polygons).

        Args:
            designator: The part, e.g. "C12"; empty for a free pad.
            pad: The pad name, e.g. "1"; a free pad by name or by x / y.
            x: A free pad's centre in mils from the board origin (with y).
            y: See x.
            style: "rule" (drop the pad's own values), "relief", "direct"
                or "none" (no connection).
            spokes: Standard spokes, 2 or 4.
            width: Spoke (conductor) width in mils.
            gap: Air gap in mils.
            rotation: Standard spokes at 45 or 90 degrees.
            custom: False switches custom spokes off; set them with
                pcb_pad_relief_spokes.
            read_spokes: Also list the custom spoke points. Marks the
                board modified (one undo step): a spoke is added and
                removed first, as reading a list never made stops the
                script.
            kind: "via" for a free via, named by x / y. A simple via has
                one record for every layer; on a top-middle-bottom via the
                record reached is the MIDDLE one (every inner layer) --
                ``record_scope`` in the reply says which.
            layer: For a via or a thru-hole pad: which layer's spoke list
                and outline to read ("top" by default, "mid", "bottom" or a
                layer name). A thru-hole pad's record behaves like a via's
                (``mode`` / ``record_scope`` in the reply). On a simple
                stack ONE spoke list serves every layer (``spoke_scope``
                "all layers"); a top-middle-bottom stack has one each for
                top, inner and bottom, a full stack one per copper layer,
                planes included ("per layer").
            footprint: With a PcbLib in front: the footprint to act on
                (made current); empty = the current one. x / y are then
                mils from the library's origin.

        Returns:
            The pad (``x`` / ``y``, ``layer``, ``side``, ``pad_rotation``,
            ``shape``, ``net``), its relief (``defined`` rule / manual,
            ``style``, ``spokes``, ``width``, ``gap``, ``rotation``,
            ``custom``), ``manual_reliefs``, the relief ``outline``
            (segments: a line's start, or an arc's centre / radius /
            angles) and, when read, ``custom_spokes``.
pcb_pad_relief_spokestool Place ONE pad's or free via's custom relief spokes, by direction.
Place ONE pad's or free via's custom relief spokes, by direction.

        Replaces the pad's custom spoke list and switches the pad to its
        own relief with custom spokes. Each spoke is resolved from the
        pad's relief outline, read in the same call; a spoke the outline
        cannot carry is refused with the reason and nothing is written.
        The pour shows the spokes only where the polygon connect rule
        lets the pad decide; repour afterwards.

        Args:
            spokes: A list (or comma-separated text) of: a side "N", "E",
                "S", "W", optionally with an offset from -1 to +1 along it
                ("N:+0.5"; + is east on N / S and north on E / W; 1 puts
                the spoke's edge at the end of the straight part); a
                corner "NE", "SE", "SW", "NW"; or an angle in degrees
                ("30"; 0 = east, counter-clockwise), the way for round
                pads and oblong ends.
            designator: The part, e.g. "C12"; empty for a free pad.
            pad: The pad name; a free pad by name or by x / y.
            x: A free pad's centre in mils from the board origin (with y).
            y: See x.
            frame: "pad" (the names turn with the pad) or "board" (north
                is the top of the screen).
            width: Spoke width in mils (also the offset limit's width).
            gap: Air gap in mils.
            dry_run: Only resolve where each spoke would go.
            kind: "via" for a free via, named by x / y.
            layer: For a via or a thru-hole pad: the layer whose spoke list is replaced
                ("top" by default, "mid" for every inner layer of a
                top-middle-bottom via, "bottom", or a layer name); the
                other layers keep theirs. Width and gap go to the via's
                record (see pcb_pad_relief ``record_scope``).
            footprint: With a PcbLib in front: the footprint whose pad or
                via is meant (see pcb_pad_relief).

        Returns:
            ``planned`` (per spoke: ``segment``, ``fraction`` and the
            board point ``x`` / ``y``) and, when written, the pad read
            back with ``custom_spokes``.
pcb_panelizetool Build a production panel on the CURRENT (blank) PCB document.
Build a production panel on the CURRENT (blank) PCB document.

        Open a new empty .PcbDoc and run this on it. Creates an embedded-board
        array of `child_path`, a rectangular panel outline, corner tooling
        holes, and fiducials. Supply the source board size
        (`board_width_mils` / `board_height_mils`).

        Args:
            child_path: path to the source .PcbDoc to array.
            board_width_mils, board_height_mils: source board size (mils).
            rows, cols: array dimensions.
            col_gap_mils, row_gap_mils: spacing between adjacent boards.
            border_mils: rail width around the array (also half the tooling inset).
            tooling_holes, fiducials: whether to add them.

        Returns:
            {"panel_width_mils", "panel_height_mils", "rows", "cols",
             "tooling_holes", "fiducials"}.
pcb_paste_optionstool Read, or set, what the board editor keeps when pasting, and
Read, or set, what the board editor keeps when pasting, and
        its paste array (Paste Special > Paste Array): how many
        instances, how designators step, and a line or circle of them.

        These are Altium's own preferences and apply to every board. A
        board must be open. Call with nothing to read; every option set
        is read back.

        Args:
            paste_same_net / paste_same_class / paste_same_layer /
                paste_same_designator: Pasted objects keep their net,
                classes, layer and designators.
            repeat_count: How many instances a paste array places.
            repeat_increment: How each instance's designator steps, e.g.
                "1".
            repeat_circular: Lay the instances on a circle instead of a
                line.
            repeat_angle: Degrees between instances on a circle.
            repeat_rotate: Turn each instance on a circle with it.
            repeat_x_mils / repeat_y_mils: Step between instances in a
                line; may be negative.

        Returns:
            ``options`` (each option by these names), ``changed``,
            ``not_applied``, ``refused`` and ``unknown``.
pcb_physical_stacktool Read the board's whole physical layer stack top down, as Altium's
Read the board's whole physical layer stack top down, as Altium's
        Layer Stack Manager shows it: copper, dielectric, solder mask,
        overlay and paste layers, each with its Z top, Z bottom and
        thickness in mils; a dielectric or mask layer also with its type
        (Altium's number), material, constant, loss tangent and stiffener
        flag. Also the stack style and the finished board thickness.

        Args:
            style: Set the stack style (Altium's number; read it first).

        Returns:
            ``style``, ``stacks_count``, ``total_thickness_mils`` and
            ``layers``. The layers are the master stack's; a rigid-flex
            board has one stack per kind of board region (``stacks_count``
            more than 1), each listed by pcb_layer_stack_manager.
pcb_place_3d_bodytool Place a STEP model on the open PCB as a free 3D body (Place >
Place a STEP model on the open PCB as a free 3D body (Place >
        3D Body > Generic STEP Model), not inside a component, e.g. a
        fixture, enclosure or device under test.
        Use this rather than ``lib_link_3d_model``, which writes into a
        library footprint, unless the model belongs to a part.

        Rotation cannot be set from here (``rotation_applied: false``);
        rotate in the editor.

        Args:
            model_path: absolute path to the .step / .stp file.
            x: X translation from the STEP's authored coordinates, in mils.
                Nonzero internal model coordinates are preserved.
            y: Y translation from the STEP's authored coordinates, in mils.
            layer: board layer to attach it to.
            standoff_height: additional model Z translation, in mils. Authored
                Z coordinates are preserved; this is not underside clearance.

        Returns:
            ``{"success", "model_path", "x", "y", "layer",
            "standoff_height", "standoff_applied", "rotation_applied",
            "note"}``; x and y are verified by the change in primitive
            bounds. ``position_verified`` reports that check; ``bounds``
            contains the placed outline bounds. No body X/Y member is used.
            This verifies XY only. ``standoff_applied`` reports a model Z write,
            not an independent Z readback; inspect the 3D view before use.
pcb_place_arctool Place an arc on the active PCB.
Place an arc on the active PCB.

        Creates a circular arc segment defined by center, radius, and
        angular range. For many arcs ``pcb_place_arcs`` takes the list
        and resolves each layer and net once.

        Args:
            x_center: Arc center X position in mils
            y_center: Arc center Y position in mils
            radius: Arc radius in mils
            start_angle: Start angle in degrees (default 0)
            end_angle: End angle in degrees (default 360 = full circle)
            width: Arc line width in mils (default 10)
            layer: PCB layer name (default "TopLayer")
            keepout: Mark the arc a keep-out, which routing and pours
                keep clear of. Omitted: on for "KeepOutLayer", off
                elsewhere; True on a copper layer keeps that layer
                clear only.

        Returns:
            Dictionary with placed arc geometry, layer and ``keepout``
pcb_place_arcstool Place many arcs on the active PCB in ONE call and one Altium edit.
Place many arcs on the active PCB in ONE call and one Altium edit.

        Each layer and net name is looked up once for the whole list. Mils,
        decimals kept.

        Args:
            arcs: List of arc dicts. Each dict supports:
                x_center, y_center, radius (required),
                start_angle (default 0), end_angle (default 360),
                and optionally its own width, layer, net, keepout
            width: Line width for every arc that gives none (default 10)
            layer: Layer for every arc that gives none (default
                "TopLayer"). "current" = the editor's CURRENT layer, set
                with pcb_layer_view current_layer; it is read once per call
                and named in the reply, since a click on another layer tab
                between calls moves it.
            net: Net for every arc that gives none (empty = no net); an
                arc on a net the board does not have is skipped
            keepout: Mark the arcs keep-outs. Omitted: on for
                "KeepOutLayer", off elsewhere.
            board_path: The board to place on, taken by its path and
                refused when it is not open; empty acts on the board in
                front, which another session can change between calls.

        Returns:
            "placed" and "failed" counts, "bad_geometry" (radius not above
            0 or a negative width), "unknown_layers" and "unknown_nets";
            "current_layer" / "on_current_layer" when arcs went there.
pcb_place_componentstool Place one or many footprints from PcbLibs onto the board in ONE call.
Place one or many footprints from PcbLibs onto the board in ONE call.

        The unattended stand-in for the ECO (which always raises a modal):
        one Altium transaction for the whole list.

        Per part: **geometry only** (no ``unique_id`` / ``pad_nets``)
        leaves pads unconnected; **synced** (both) stamps the schematic
        UniqueId so a later ECO matches the part, and sets each pad's net.
        Read ``unique_id`` with ``obj_query`` (``eSchComponent``,
        "Designator.Text,UniqueId") and ``pad_nets`` from
        ``proj_get_connectivity_many``.

        Args:
            placements: List of placement dicts, each with:
                footprint (required), library_path (required, .PcbLib),
                x, y (mils, decimals kept), designator, lib_reference, comment,
                rotation, layer, unique_id, and pad_nets
                (``{pad_name: net_name}``); omit unique_id/pad_nets for
                geometry-only, include them for a synced placement.
                The designator and comment texts: ``name_shown`` /
                ``comment_shown`` (bool), then optionally ``_layer``,
                ``_height``, ``_stroke`` (mils), ``_angle``, ``_mirror``
                (bool) and ``_x``, ``_y`` (mils, where the middle of the
                text lands), e.g. ``name_height``. Without ``*_shown`` the
                text keeps the footprint's defaults.
            board_path: Absolute .PcbDoc path to place onto (optional).

        Returns:
            Dict with ``placed`` (count), ``failed`` (count), ``total``,
            ``label_layers_unknown`` (texts whose layer was not found).
pcb_place_extruded_bodytool Place an extruded 3D body on the open PCB: an outline lifted
Place an extruded 3D body on the open PCB: an outline lifted
        from ``standoff_height`` to ``overall_height``.

        A clearance volume, an enclosure feature, or the body of a part
        with no STEP model (a STEP model is preferred when there is one).

        Args:
            overall_height: top of the body above the board, mils.
            points: outline ``[{x, y}]`` or ``[[x, y]]`` in mils, three or
                more vertices, decimals kept; or leave it out and give the
                rectangle x1, y1, x2, y2.
            x1, y1, x2, y2: opposite corners in mils when no points.
            standoff_height: underside above the board, mils (default 0).
            layer: the layer the body belongs to; a bottom layer makes it
                project from the bottom side.
            identifier: a name to find the body again by.
            color: Altium TColor integer.
            opacity: 0 (clear) to 1 (solid).

        Returns:
            ``placed``, ``outline``, ``standoff_height``,
            ``overall_height``, ``identifier`` and ``layer`` read back
            from the body, and ``*_applied`` for each optional property.
pcb_place_filltool Place a rectangular copper fill on the active PCB.
Place a rectangular copper fill on the active PCB.

        Creates a solid copper rectangle. Useful for thermal pads,
        ground planes, and copper pours in specific areas.

        Args:
            x1: First corner X in mils
            y1: First corner Y in mils
            x2: Second corner X in mils
            y2: Second corner Y in mils
            layer: PCB layer name (default "TopLayer")
            net_name: Net name to assign (optional, empty = no net)

        Returns:
            Dictionary with placed fill coordinates and layer
pcb_place_padtool Place a standalone pad on the active PCB.
Place a standalone pad on the active PCB.

        Not part of any component. Use for fiducials, test points,
        mounting holes. Set hole_size=0 for surface-mount pads,
        nonzero for through-hole. For many pads ``pcb_place_pads``
        takes the list and resolves each layer and net once.

        Args:
            x, y: Position in mils
            name: Pad designator / label (optional)
            net: Net to connect to (optional); one the board does not
                have is refused and nothing is placed
            shape: "round" (default) / "rect" / "oct", or spelled out as
                the library tools take them ("rectangular", "octagonal").
                Any other word is refused.
            x_size, y_size: Pad dimensions (default 60 mil)
            hole_size: Drill diameter (0 = SMD)
            layer: Copper layer (default "TopLayer")
            units: "mil" (default) or "mm", for the position and every
                size, kept exact rather than rounded to whole mils.

        Returns:
            Dictionary confirming pad placement
pcb_place_padstool Place many free pads that are all ONE pad, moved, turned and
Place many free pads that are all ONE pad, moved, turned and
        named, in ONE call and one Altium edit.

        The pad is described once by the arguments; each item of ``pads``
        only says where it goes. Use for pad arrays, test point rows,
        fiducials, mounting holes.

        Args:
            pads: List of dicts: x, y (required), rotation (degrees,
                default 0), name, and optionally its own layer and net
            shape: "round" (default) / "rect" / "oct" / "roundrect";
                "rectangular", "octagonal", "rounded_rectangular" taken too
            x_size, y_size: Pad size (default 60 mil)
            corner_radius: roundrect corner, percent of half the shorter
                side (default 25)
            hole_size: Drill (0 = SMD). A pad with a hole goes on
                MultiLayer.
            hole_length: Slot length; above hole_size the hole is a slot
                along the pad's X, turned by hole_rotation
            plated: False for a non-plated hole
            mask_expansion, paste_expansion: Manual solder / paste mask
                expansion (omitted = the board's rules)
            layer: Copper layer of an SMD pad (default "TopLayer").
                "current" = the editor's CURRENT layer, read once and named
                in the reply.
            net: Net for every pad that gives none; a pad on a net the
                board does not have is skipped
            units: "mil" (default) or "mm" for every length
            board_path: The board to place on, taken by its path and
                refused when it is not open; empty acts on the board in
                front, which another session can change between calls.

        Returns:
            "placed", "failed", "total", "slots", "unplated",
            "expansions", "property_failures", "unknown_layers",
            "unknown_nets"; "current_layer" / "on_current_layer" when pads
            went there.
pcb_place_polygontool Drop a copper polygon pour on an outline of straight edges.
Drop a copper polygon pour on an outline of straight edges.

        As pcb_place_polygon_rect, on any shape: a zone from another tool,
        an L-shaped plane. The pour keeps its clearance from other nets
        by the board's rules.

        Args:
            points: The outline, three or more ``[x, y]`` (or ``{x, y}``)
                in mils, in order; it closes by itself.
            net: Net of the pour; it must exist on the board.
            layer: Copper layer (default "TopLayer").
            name: The pour's name, to pour or find it again by.
            pour_over: Pour over same-net objects (default True).
            remove_dead: Remove islands joined to nothing (default True).
            pour: Pour it now (default True); False leaves it for one
                pcb_repour_polygons after the rest of the board is drawn.

        Returns:
            ``placed``, ``vertices`` read back, ``name``, ``layer``,
            ``net``, ``poured`` and ``repour_mode``.
pcb_place_polygon_boardtool Pour copper over the whole board shape, following its outline.
Pour copper over the whole board shape, following its outline.

        The pour takes the board outline's own vertices, arcs included, so
        it fits a round or flanged board exactly. The outline is drawn on
        the Keep-Out layer first (pcb_keepout_board_outline, twice
        ``edge_clearance_mils`` wide), which keeps the copper that far
        plus the clearance rule from the edge. Pour every copper layer
        that wants it, then stitch them with pcb_place_stitching_vias.

        Args:
            net: Net of the pour, typically "GND". Must exist on the board.
            layer: Copper layer (default "TopLayer").
            edge_clearance_mils: Copper-free band inside the board edge
                (default 10; 0 draws no keep-out).
            pour_over: Pour over same-net objects (default True).
            remove_dead: Remove copper islands joined to nothing
                (default True).
            pour: Pour it now (default True); False skips the pour, to
                pour once with pcb_repour_polygons (by the ``name`` in the
                reply) after its settings are made. Altium may pour it
                anyway: ``poured`` reports the copper that is there.

        Returns:
            The pour (``vertices``, ``name``, ``layer``, ``net``,
            ``remove_dead``, ``pour_skipped``, ``poured``,
            ``repour_mode``) and ``keepout`` (what the keep-out outline
            added).
pcb_place_polygon_recttool Drop a copper polygon pour on a rectangular area.
Drop a copper polygon pour on a rectangular area.

        Useful for placing a ground plane or power plane: pass the board's
        corners, the layer, and the net name (typically "GND"). Set
        pour_over=False to force the pour around same-net tracks/pads
        instead of covering them.

        On a board that is not a rectangle (round, flanged), draw the
        outline as a keep-out first (pcb_keepout_board_outline) and make
        the rectangle larger than the board: the pour stops at the
        keep-out, and copper left outside it, joined to nothing, is
        removed as dead copper.

        Args:
            x1: First corner X in mils
            y1: First corner Y in mils
            x2: Opposite corner X in mils
            y2: Opposite corner Y in mils
            net: Net name to assign (empty = no-net fill, unusual)
            layer: Copper layer (default "TopLayer")
            pour_over: Pour over same-net objects (default True)
            remove_dead: Remove copper islands joined to nothing
                (default True).
            pour: Pour it now (default True). False skips the pour, so
                its hatch, grid or thresholds can be set first and it is
                poured once, with pcb_repour_polygons by the ``name`` in
                the reply. Altium may pour it anyway: ``poured`` reports
                the copper that is there.

        Returns:
            Dictionary confirming the polygon placement, with
            ``pour_skipped``, ``poured``, ``repour_mode`` and ``name``.
pcb_place_regiontool Place a solid copper region on a rectangle or a polygon outline.
Place a solid copper region on a rectangle or a polygon outline.

        A solid shape, connected only if given a net. For a ground pour
        use pcb_place_polygon_rect.

        Args:
            x1, y1, x2, y2: Opposite corners in mils (any order); not used
                when points is given
            layer: Copper or mech layer (default "TopLayer")
            net: Optional net assignment
            points: Optional outline, ``[{x, y}]`` (or ``[[x, y]]``) in
                mils, three or more vertices in order, decimals kept; the
                outline closes by itself. A vertex given as ``{x, y, sweep}``
                (or ``[x, y, sweep]``) makes the edge from it to the next a
                true arc of ``sweep`` degrees, counterclockwise when
                positive, as in lib_add_footprint_regions
            name: Optional region Name, a tag to find the region again by
                (``obj_query`` filter ``Name=...``); avoid ``=`` and ``|``,
                which split a filter

        Returns:
            Dictionary confirming the region placement, with the ``name``
            read back from the region; with points, also ``vertices`` and
            ``points``, the outline read back from the placed region in mils;
            with arcs, ``arc_edges`` and ``shape``, ``[x, y, sweep]`` per
            vertex read back
pcb_place_ringtool Place parts evenly round a circle (or an arc of one), in order.
Place parts evenly round a circle (or an arc of one), in order.

        For rings of LEDs, buttons or mounting features: the first part at
        ``start_angle`` (degrees, 0 = +X, 90 = +Y), the rest every
        ``span / n`` degrees (``span / (n - 1)`` for an arc short of a full
        turn, so both ends are used), clockwise by default. Each part
        faces the centre the same way (its rotation follows its angle plus
        ``rotation_offset``), unless ``rotation`` fixes one rotation for
        all. Placed with the exact batch placement of pcb_move_components
        (side, then turn, then origin) and read back.

        Args:
            designators: the parts, in ring order.
            center_x, center_y: the circle's centre, mils.
            radius: mils.
            start_angle: the first part's angle, degrees.
            clockwise: direction round the ring.
            span: degrees covered (360 for a full ring).
            rotation: one rotation for every part, instead of following
                the ring.
            rotation_offset: added to each part's angle when following
                the ring (0 turns a part's +X outward).
            side: "top" or "bottom" for every part; empty keeps each.

        Returns:
            The batch placement reply, plus ``positions`` [{designator, x,
            y, rotation}] as sent.
pcb_place_simple_bodytool Place a cylinder or sphere 3D body on the board, with no STEP file.
Place a cylinder or sphere 3D body on the board, with no STEP file.

        Altium's own model factory makes the shape: enough for an
        electrolytic can, an LED dome, a standoff or a clearance check.

        Args:
            shape: ``cylinder`` or ``sphere``.
            x, y: The centre, absolute mils.
            radius: Mils.
            height: Mils, for a cylinder.
            standoff: Height above the board, mils.
            layer: The mechanical layer the body sits on.
            side: ``top`` or ``bottom``.
            color: BGR colour as an integer; grey when omitted.
            identifier: A name to find the body by later.
pcb_place_stitching_viastool Place a grid of stitching vias on a named net.
Place a grid of stitching vias on a named net.

        The grid covers the rectangle, or the whole board when no
        rectangle is given. With ``within_board`` (default) only grid
        points inside the board outline, at least ``edge_clearance_mils``
        from its edge, are tried, so a round or flanged board gets vias
        only on the board. A point is skipped when any pad or via (any
        net: no via in a pad), a part's 3D body (``avoid_parts``), or a
        track, arc or keep-out of another net lies within
        ``via_size_mils/2 + clearance_mils``; the rest get a through via
        on the net. Dry run by default: check ``placed`` and
        ``skipped``, then call again with ``dry_run=False``.

        Args:
            net: Target net (must already exist on the board).
            x1_mils, y1_mils, x2_mils, y2_mils: Inclusive rectangle for
                the grid; all zero (default) uses the board's extent.
            spacing_mils: Grid spacing (default 50).
            via_size_mils: Via pad diameter (default 30).
            via_hole_mils: Via drill diameter (default 14).
            clearance_mils: Min gap to a blocking primitive (default 10).
            dry_run: When True (default), only count would-be
                placements without mutating the board.
            within_board: Keep to the board outline (default True).
            edge_clearance_mils: Minimum distance from a via centre to
                the board edge when ``within_board`` (default 30).
            avoid_parts: Keep out from under every part's 3D body
                (default True). False stitches under bodies too, as under
                a QFN's thermal area.

        Returns:
            Dict with ``{net, dry_run, placed, skipped, spacing_mils,
            clearance_mils}``, plus ``outside_board`` (grid points left out).
pcb_place_texttool Place a text string on the active PCB.
Place a text string on the active PCB.

        Args:
            text: Text content to place
            x: Text X position in mils. With a justification, the point
                the justification names (the centre for "center").
            y: Text Y position in mils, as x.
            layer: PCB layer name (default "TopOverlay"). Common choices:
                "TopOverlay", "BottomOverlay", "TopLayer", "BottomLayer",
                "Mechanical1" and up, or the board's own layer name
            height: Text height in mils (default 60), decimals allowed
            rotation: Rotation angle in degrees (default 0); a justified
                text turns about its justification point.
            stroke: Stroke width in mils; 0 keeps Altium's default.
                To resize existing designators use ``pcb_set_text_style``.
            kind: "stroke" or "truetype"; empty keeps Altium's default.
                font_name, bold, italic or inverted alone ask for truetype.
            stroke_font: "default", "sans_serif" or "serif" (stroke only).
            font_name: TrueType font name, e.g. "Arial".
            bold: TrueType bold.
            italic: TrueType italic.
            justification: top_left, top_center, top_right, center_left,
                center, center_right, bottom_left, bottom_center or
                bottom_right. Makes the text multiline: Altium justifies a
                text only inside its frame, a single-line text ignores it.
            frame_width: Frame width in mils; 0 = as wide as the text's
                longest line, measured on the placed text. A frame narrower
                than a line wraps it at its spaces: Altium grows a frame
                only to the longest word (plus margin).
            frame_height: Frame height in mils; 0 = fitted to the text (all
                its lines).
            inverted: TrueType text cut out of a filled box (silkscreen
                labels). On a justified text the filled box is the frame,
                so frame_width / frame_height make the label larger.
            margin: Inverted margin in mils, the minimum fill round the text.
            mirror: None mirrors a text on a bottom layer (BottomOverlay,
                BottomLayer, BottomSolder, BottomPaste), as Altium's Place
                String does, so it reads right from below. True / False
                force it (True for a bottom mechanical layer). The text
                keeps the box it has unmirrored, so x / y mean the same.

        Returns:
            Dictionary with placed text properties as read back from the
            placed text: height, stroke, kind, font_id, font_name, bold,
            italic, mirror, multiline, justification, frame, inverted,
            margin, location (the frame's corner) and bounds.
pcb_place_thieving_padstool Fill bare copper area with a grid of isolated thieving pads.
Fill bare copper area with a grid of isolated thieving pads.

        Drops a regular grid of small round pads on `layer`, inside the board
        outline minus `margin_mils`. A grid point is skipped whenever any
        existing primitive (track, arc, via, pad, fill, region, polygon, or
        component body) sits within half-pad + clearance of it, so pads land
        only in genuinely empty regions. Pads carry no net. Evens out plating
        current on sparse boards. Capped at 5000 pads per run.

        Args:
            layer: Copper layer to populate (default TopLayer).
            pad_size_mils: Pad diameter (default 20).
            pitch_mils: Grid spacing (default 50).
            clearance_mils: Keep-out from existing copper (default 15).
            margin_mils: Inset from board edge (default 100).

        Returns:
            {"placed", "scanned", "layer"}.
pcb_place_viatool Place a via at specific coordinates on the active PCB.
Place a via at specific coordinates on the active PCB.

        Sizes take fractions of a mil, or millimetres through ``size_mm``
        and ``hole_size_mm``. A hole as wide as the pad is refused.

        Args:
            x: Via X position in mils
            y: Via Y position in mils
            net: Net name to assign (optional, empty = no net)
            size: Via pad diameter in mils (default 50)
            hole_size: Drill hole diameter in mils (default 28)
            low_layer: Start layer (default "TopLayer")
            high_layer: End layer (default "BottomLayer")
            size_mm: pad diameter in mm, used instead of ``size``
            hole_size_mm: hole diameter in mm, used instead of
                ``hole_size``

        Returns:
            Dictionary with placed via position and size (mils)
pcb_place_via_arraytool Stitch vias in a regular grid across a rectangle.
Stitch vias in a regular grid across a rectangle.

        Typical use: GND stitching between top and bottom layer copper
        pours. Places vias at every (pitch × pitch) grid intersection
        inside the rectangle.

        Args:
            x1: First corner X in mils
            y1: First corner Y in mils
            x2: Opposite corner X in mils
            y2: Opposite corner Y in mils
            pitch: Grid spacing in mils (default 50)
            net: Net to assign (typically "GND"; empty = no net)
            size: Via pad diameter in mils (default 30)
            hole_size: Drill hole diameter in mils (default 12)
            low_layer: Start layer (default "TopLayer")
            high_layer: End layer (default "BottomLayer")

        Returns:
            Dictionary with count of vias placed and rectangle/pitch echo
pcb_place_viastool Place many vias on the active PCB in ONE IPC round-trip.Filesoutside text
Place many vias on the active PCB in ONE IPC round-trip.

        One Altium transaction for the whole list; a list of one places
        a single via. Coordinates and sizes keep their decimals. Past a
        few hundred, pass ``file`` instead, or use pcb_apply_geometry_map.

        Args:
            vias: List of via dicts. Each dict supports:
                x, y (required, mils), size (default 50), hole_size
                (default 28), low_layer (default "TopLayer"), high_layer
                (default "BottomLayer"), net (optional, empty = no net);
                size_mm and hole_size_mm in place of size and hole_size
            board_path: The board to place on, taken by its path and
                refused when it is not open; empty acts on the board in
                front, which another session can change between calls.
            file: A JSON file holding the same list, or an object with it
                under "vias"; in place of vias.

        Returns:
            Dictionary with "placed" and "failed" counts, "unknown_layers"
            naming any layer pair and "unknown_nets" any net that did not
            resolve; a via on an unknown net is not placed. Error BAD_VIA,
            with nothing placed, when an entry has a key that is not read
            or a hole that is not smaller than its pad.
pcb_plan_placementtool Auto-place components to shorten wirelength, legally. Dry-run by
Auto-place components to shorten wirelength, legally. Dry-run by
        default: returns proposed moves and metrics, changes nothing.

        Reads the netlist and each footprint's real bounding box, then
        minimises half-perimeter wirelength (HPWL) inside the outline with
        no same-layer overlaps. Parts on opposite layers may overlap.
        Workflow: run with apply=False, check ``summary``,
        ``hpwl_improvement_pct``, ``overlap_pairs_after`` and ``moves``,
        then run again with apply=True to commit in one transaction.

        Args:
            designators: Only these move; the rest stay put but still pull
                their nets and block overlaps. Default: all but ``fixed``.
            fixed: Designators held in place. You choose them; nothing is
                guessed from prefixes.
            region: Bounds {x1, y1, x2, y2} in mils. Default: the board
                outline's bounding box.
            iterations: Relaxation steps (default 400).
            grid_mils: Snap grid for final positions (default 5).
            clearance_mils: Extra spacing between parts (default 15).
            max_net_fanout: Ignore nets on more components than this
                (0 = keep all; ~20 drops power planes).
            exclude_nets: Net names to ignore, e.g. ["GND"].
            critical_nets: Nets whose pull is multiplied by
                ``critical_weight`` so they come out shortest.
            critical_weight: Multiplier for critical nets (default 3,
                clamped to 1..20).
            edge_parts: {refdes: "L"|"R"|"T"|"B"}: seat a part against that
                board edge (connectors, mounting holes).
            keepout_groups: {refdes: group}: parts in different groups are
                pushed apart, e.g. switching vs analog. construct only.
            match_groups: {refdes: group}: parts in one group are kept
                adjacent even without a shared net (matched pairs).
                construct only.
            match_roles: {refdes: role} within a match group (e.g. A/B):
                drives each role's centroid together for a common-centroid
                (ABBA) layout. Needs match_groups; construct only.
            plan_json: Your DesignPlan (JSON or dict). Adds match groups
                from differential nets and keepout groups from analog vs
                digital roles; explicit groups win. Echoed in
                ``auto_constraints``.
            reseed_grid: Re-place from scratch instead of refining current
                positions (unplaced or scrambled boards only).
            optimize_rotation: Also pick 0/90/180/270 per top-side part to
                point pins at their nets (default True).
            engine: "refine" (default) nudges current positions;
                "construct" places from scratch with a multi-term objective
                (wirelength, overlap, edge, decoupling, connectors,
                thermal) and sizes the board.
            restarts: construct only: run this many seeded restarts and
                keep the best legal result (default 1).
            render_png: Path for a preview image of the proposal, returned
                as ``preview_png`` (``preview_error`` on failure).
            apply: Commit the moves (default False).

        Returns:
            ``dry_run``, ``engine``, counts (component, movable, fixed,
            net, pin), ``summary`` (read first), ``hpwl_before/after`` and
            ``hpwl_improvement_pct``, ``overlap_pairs_before/after``,
            ``objective_report`` (each term unweighted plus
            ``weighted_total``, ``legal``, ``utilization``),
            ``net_length_report`` (``longest_nets``,
            ``critical_net_spans``), ``ratsnest`` (``signal_crossings``
            predicts layer changes), ``decoupling_report`` ([{decap, ic,
            distance_mils}], worst first, found from connectivity),
            ``suggested_board`` (construct only), ``moved_count``,
            ``rotated_count``, ``moves`` [{designator, from, to}] in
            mils/degrees, ``region``, ``notes``, and ``apply_result`` when
            applied.
pcb_plane_connectionstool How pads and vias meet the internal planes.
How pads and vias meet the internal planes.

        Per object: the connection the board's rules give it (relief,
        direct or none) with the relief and clearance values, the ruling
        rule names, ``manual_reliefs`` (a hand-edited thermal relief; the
        rule's values do not show one) and ``plane_contacts``: the planes
        the object really passes through, each with the plane's net (on
        a split plane, the region under the object) and ``joins`` (same net) -- an SMD pad has none, a hole spans every
        plane, a blind / buried via only the planes it reaches.

        Use it to check that a power pad or via joins its plane, and that
        a signal via only clears the planes it passes.

        Args:
            designator: One part's pads, e.g. "U1".
            pad: One pad name of that part; empty lists every pad.
            kind: Without a designator, "via" for the board's free vias or
                "pad" for its free pads.
            net: Only objects on this net.
            limit: Most objects reported (``truncated`` says when more
                matched; ``matched`` counts them all).

        Returns:
            ``plane_layers``, ``planes`` (layer, name, net), ``matched``,
            ``truncated`` and ``pads`` or ``vias``, each with ``net``,
            ``connection`` (``rule_style`` is Altium's number), the relief
            values in mils, ``rule``, ``clearance_rule``,
            ``manual_reliefs`` and ``plane_contacts``; free objects also
            carry ``x`` / ``y`` in mils from the board origin.
pcb_plane_statetool For each internal plane layer, whether Altium holds it poured.
For each internal plane layer, whether Altium holds it poured.
pcb_polygon_repour_modetool Read or set Altium's "Repour Polygons After Modification" preference.
Read or set Altium's "Repour Polygons After Modification" preference.

        With ``always``, editing anything a pour touches rebuilds that pour
        after the edit, and a large hatched pour (tens of thousands of
        pieces) can then take minutes per edit. Set ``never`` before a run
        of geometry edits and repour once at the end with
        pcb_repour_polygons, which rebuilds whatever this is set to. Put
        the user's setting back afterwards: it is an application
        preference, not a board property, and it stays until changed.

        Args:
            mode: "" reads only; "never", "threshold" or "always" sets it.

        Returns:
            {"mode_before", "mode", "before", "after"}: names and Altium's
            raw values (0 never, 1 threshold, 2 always).
pcb_pours_attool Which pours on the active board have a point inside their
Which pours on the active board have a point inside their
        outline, with each pour's net and layer: is this via inside the
        GND pour, which pours overlap here.

        The outline, not the poured copper: a point in a gap of a poured
        pour still counts.

        Args:
            x: X in mils, from the board origin.
            y: Y in mils, from the board origin. ``obj_query``,
                ``pcb_get_vias`` and ``pcb_get_copper`` give ABSOLUTE
                positions: subtract the board origin first.

        Returns:
            ``pours`` (``name``, ``net``, ``layer``), ``found`` and
            ``pours_examined``.
pcb_print_optionstool Read, or set, the print setup saved in the active board:
Read, or set, the print setup saved in the active board:
        scale, fit to page, corrections, holes and pad labels.

        Call with nothing to read; every option set is read back.
        proj_export_pdf prints.

        Args:
            scale: Print scale (1 is full size).
            scale_to_fit_page: Fit the board to the page instead.
            x_correction / y_correction: Scale corrections for the
                printer (1 is none).
            show_holes: Draw the holes.
            printer_fonts: Print text with the printer's fonts.
            software_arcs: Draw arcs as short straight segments.
            pad_nets: Print net names on pads.
            pad_numbers: Print pad numbers.
            border_mils: Border around the print.
            composite_type / batch_type: Altium's numbers for how layers
                are combined and split into pages (read them first).

        Returns:
            ``board``, ``options`` (by these names), ``changed``,
            ``not_applied``, ``refused`` and ``unknown``.
pcb_remove_layertool Remove a copper layer from the PCB layer stack.
Remove a copper layer from the PCB layer stack.

        Does nothing if the layer is not in the stack.

        Args:
            layer: Layer name, e.g. "MidLayer1", "InternalPlane2"

        Returns:
            Dictionary confirming the layer was removed.
pcb_remove_split_linetool Remove a split line (its index from pcb_get_board_regions); the
Remove a split line (its index from pcb_get_board_regions); the
        regions on either side join again.
pcb_remove_teardropstool Remove teardrops, as pcb_add_teardrops with Remove.Filesoutside text
Remove teardrops, as pcb_add_teardrops with Remove.

        Args:
            scope: "all" or "selected".
pcb_render_svgtool Render the active PcbDoc to an SVG file.Files
Render the active PcbDoc to an SVG file.

        For a picture of placement, silkscreen or spacing. Never judge
        connectivity, nets or clearance from it: use ``pcb_get_nets``,
        ``pcb_get_unrouted_nets``, ``pcb_run_drc`` or
        ``proj_compare_sch_pcb``.

        Draws the outline, tracks, arcs, pads, vias and overlay texts;
        not regions, pours or component-body outlines. Each primitive
        group carries ``data-net``, ``data-layer`` and ``data-shape``.

        Args:
            output_path: SVG path; default the workspace renders folder.
            layers: Only these layer names (e.g. ``["TopLayer",
                "TopOverlay"]``); default all. Vias and the outline are
                always drawn.
            margin_mils: Padding around the board.
            flip_y: Flip Y to Altium's bottom-left origin (default True).
            show_drills: Draw pad and via holes.
            show_texts: Draw overlay texts.
            show_designators: Draw designators.
            interactive_legend: Add a clickable per-layer legend.
            background: Background fill; ``"none"`` for transparent.

        Returns:
            ``ok``, ``svg_path``, ``counts``, ``bbox`` (mils), ``bytes``.
pcb_renumber_padstool Renumber the current PcbLib footprint's pads in spatial order.
Renumber the current PcbLib footprint's pads in spatial order.

        Pads are sorted by position and numbered in sequence; rows and
        columns are banded by a small tolerance so a grid numbers cleanly.
        A pad's position is its copper centre, not its origin, so a custom
        pad numbers where it is drawn.
        Acts on the active PCB library's current footprint.

        Args:
            order: ``lr_tb`` (default) numbers rows top-to-bottom,
                left-to-right within a row; ``tb_lr`` numbers columns
                left-to-right, top-to-bottom within a column.
            start: First designator number (default 1).
            increment: Step between successive pads (default 1).
            prefix: Optional string prefixed to each number (e.g. ``A`` ->
                ``A1``, ``A2``).

        Returns:
            {"renumbered", "order", "mapping": [{old, new}, ...]} or an error.
pcb_replicate_layouttool Copy one channel's routing onto a matching channel.
Copy one channel's routing onto a matching channel.

        Copies the source group's tracks, arcs, vias, polygons, regions
        and fills onto the destination group, remapping each net to the
        matching destination net. One rigid transform comes from the
        FIRST mapping pair. Only nets internal to the source group are
        copied (every pad on the net belongs to a mapped part), so shared
        GND or power nets are left alone; ``nets`` overrides that.

        The destination parts must already sit like the source (run
        ``pcb_copy_component_placement`` first, or pass
        ``move_components=True``); ``congruence_warnings`` counts those
        that don't.

        Args:
            mapping: ``{source_designator: dest_designator}``; include
                every part in the channel.
            nets: Source net names to copy instead of the internal ones.
            move_components: Also move the destination parts onto the
                transform (default False).

        Returns:
            ``copied``, ``net_assigned``, ``internal_nets``,
            ``shared_nets_skipped``, ``congruence_warnings``, ``notes``.
pcb_repour_polygonstool Repour poured polygons on the open PCB, in pour order.
Repour poured polygons on the open PCB, in pour order.

        Each polygon is rebuilt through the API, so a changed clearance
        or board-edge rule takes effect. Shelved polygons stay shelved.
        ``repoured`` is true only when at least one polygon was rebuilt
        and none failed; each item reports its copper pieces and poured
        area before and after, so a repour that changed nothing shows.

        With no filter every polygon is repoured. ``names`` and
        ``indices`` (places in the board's polygon order, as
        pcb_modify_polygon counts them) pick polygons and add up;
        ``exclude`` drops names and wins. Use them to redo many small
        pours quickly and a slow hatched one once, at the end.

        A large hatched pour can take minutes. The call waits up to 30
        times ``timeout`` while Altium reports it is still working, so
        the default of 60 s allows 30 minutes.

        Args:
            names: Polygon names to repour (any case).
            indices: Polygon indices to repour.
            exclude: Polygon names to leave alone.
            board_path: The .PcbDoc to act on. Empty uses the open board;
                a path is refused unless that file is the board opened.
            timeout: Seconds per wait window, see above.
            clean_first: Empty every selected poured polygon before any
                is rebuilt. Use it after polygons were moved: otherwise
                an early pour flows around later pours' stale copper and
                a later one can then fill the space it left.
            empty_only: Empty the selected poured polygons and rebuild
                none, leaving them with no copper until the next repour.
                For a command that avoids pour copper, such as
                Teardrops, so that the pours are poured around its result.

        Returns:
            ``repoured``, counts of ``polygons`` (selected), ``skipped``,
            ``rebuilt``, ``shelved`` and ``failed``, ``clean``, ``empty``
            and ``cleared_primitives``, per-polygon ``items``, and
            ``not_found``: requested names no polygon has.
pcb_resize_designatorstool Resize, turn and centre designators to fit their parts, for an
Resize, turn and centre designators to fit their parts, for an
        assembly drawing.

        A stroke font centred on the part, along its longer side, the characters
        sharing that side but no taller than the part is wide, kept between
        ``smallest_mm`` and ``largest_mm``; the stroke is ``stroke_share`` of
        the height, at most ``stroke_cap_mm``. Bottom parts read mirrored;
        upright parts turn 90 degrees on the top and 270 on the bottom. The
        outline is the part without its designator and comment. Run it
        again after parts move.

        Args:
            designators: Only these parts; empty for every part.
            top_layer, bottom_layer: Layers to move the texts to, usually two
                mechanical layers of an assembly drawing ("Mechanical10",
                "Mechanical11"). Empty leaves each text on its layer.
            smallest_mm, largest_mm, stroke_share, stroke_cap_mm: The bounds.
            dry_run: True (default) only plans; False writes and reads back.
            board_path: The .PcbDoc; defaults to the focused board.

        Returns:
            ``plan`` per part (height, stroke, angle, mirrored, ``move_to``;
            ``limited_by_width`` and ``natural_mm`` where they apply),
            ``turned``, ``limited_by_width``; once written also ``held``,
            ``refused``, ``missing`` and ``wrong`` (part and what read back
            differently).
pcb_route_brieftool Set, change or read the board's routing brief: how the nets thatFilesoutside text
Set, change or read the board's routing brief: how the nets that
        matter are to be routed, which the router obeys.

        You decide; the router lays only that: a net is routed once an
        entry gives its layers and reason (one may decide a group) and a
        later call confirms it: confirm [{nets, verified, confidence,
        alternative}], what you checked per net (name it and its parts; a
        big plain group: its check_first net) against the reply's
        to_confirm facts, how sure you are it is the best choice (0-100,
        80 or more to route) and the other choice you weighed. A critical
        net (the reply names them) needs a sourced entry: read the
        datasheet's layout section and the standards first.

        Entry: nets, kind, layers, width (mils, not under the width rule),
        region / keep_out (polygons), max_vias, min_ / max_length, match +
        skew, reference (plane net under every track), return_via (mils: a
        reference via that near each via of the net), impedance or
        diff_impedance + gap, impedance_tol (%), apart_from (nets, classes)
        + spacing, max_parallel + parallel_gap, max_broadside; guard,
        guard_gap, max_unguarded; terminate, terminate_at (end|source),
        driver, max_stub; current (A) + temp_rise (C, IPC-2221); source,
        reason. An impedance or current gets each layer's width.

        Areas bar all nets but those allowed: name, polygons, kind, layers,
        allow, source (an antenna feed needs one). Loops: name, members
        (pads in current order, "C5.1"), kind, max_area (sq mils) or
        max_length, source; a read lists ``loops_found``. Barriers: name,
        nets, apart_from, creepage / clearance, source. Assembly:
        via_to_pad, vias_under_parts, part_gap, source. Orient: name,
        parts, rotation, side, pins ({"D1.K": "VIN"}), source. Pdn: name,
        part, rails, decaps, max_distance, min_vias + via_reach, source.
        Thermal (a power part): name, part, pad (default its largest),
        min_area (sq mils of its net's copper there), min_vias +
        via_reach, power (W) + theta_ja (C/W) + ambient + tj_max (C),
        source (its datasheet).

        Args:
            expect_file: full path of the focused board.
            add: entries to add (a net in another entry moves here).
            drop: [{nets, rules}] rules to take out of those nets' entries.
            remove: nets to take out of the brief.
            replace: the whole brief (an empty list clears it).
            areas, loops, barriers, orient, pdn, thermal: to add; one of the
                same name is replaced. remove_*: names to take out.
            assembly: sets the assembly rule ({} clears it).

        Returns:
            ``brief``, the other rules by name, ``errors`` (nothing is saved
            then), ``needed`` (critical nets with no sourced entry, why,
            what to read), ``undecided`` (and its count), ``to_confirm``,
            ``rounds``, ``file``.
pcb_route_optionstool Read, or set, the board editor's routing preferences.
Read, or set, the board editor's routing preferences.

        These are Altium's own preferences and apply to every board. A
        board must be open. Call with nothing to read; every option set
        is read back.

        Args:
            route_mode: The interactive routing conflict mode (Altium's
                number: ignore, walkaround, push ...; read it first).
            plow_through_pours: Route through pours rather than around.
            auto_via: Add a via when the routing layer changes.
            shove_depth: How far placement may push other parts.
            lock_pre_routes: Keep existing routes when re-routing.
            delete_dead_ends: Remove track stubs left after a reroute.
            smart_track_ends: Track ends follow the connection they make.

        Returns:
            ``options`` (each option by these names), ``changed``,
            ``not_applied``, ``refused`` and ``unknown``.
pcb_route_reviewtool Review the copper on the board against the routing brief, without
Review the copper on the board against the routing brief, without
        routing anything: tracks you laid by hand, an earlier round, or a
        router job's result once applied.

        The same review a round gets, on the board as it is: each brief rule
        measured on the copper (length, skew, return plane and return vias,
        impedance, current against IPC-2221, spacing and parallel runs,
        guards, termination, loops, decoupling, thermal pads and junction
        temperature, barriers, areas, assembly), then the
        judgements (detour, vias, off-45 pieces, pad entries, staircases,
        short tracks). Use it to check your own routing before going on, and
        a finding's ``simulate`` call where a closed form cannot settle it.
        Reads only; nothing waits on an answer here.

        Args:
            expect_file: full path of the focused board.
            nets: the nets to review (default: every net with free copper).
            picture: draw the reviewed nets (PNG, default True).

        Returns:
            ``findings`` (each id, check, text, and measured / limit where it
            has them), ``nets`` (length, vias, layers, detour per net),
            ``open`` (nets in scope the copper does not join yet),
            ``picture`` and ``brief_errors`` when the brief cannot be read
            as written.
pcb_route_roundtool Route the next round of nets under the brief, then stop for review.Filesoutside text
Route the next round of nets under the brief, then stop for review.

        The rounds go: differential pairs, switching nodes, high-current
        paths, clocks, the other nets the brief rules, then the rest. A
        round routes only what the board's copper leaves apart: earlier
        rounds and every route you laid by hand stay as they are. The
        router lays only what you decided: a net in the round no brief
        entry decides (its layers and the reason) stops the round before
        anything is routed (decision_needed), and so does a critical net
        without a sourced entry (brief_needed, with what to read).
        When the user has set Routing discipline to advisory or off on
        the Config tab, the round goes ahead and the reply says so.

        Runs as a job: poll design_job_status, then design_job_result. Its
        ``review`` holds per net the length, vias, layers and detour; a
        picture (PNG) to look at; ``questions`` to answer; and for each net
        left unrouted, ``advice``: options tried by routing them (a part
        moved clear, a net laid before ripped up, a brief rule dropped),
        each with what it gave and the tool call that applies it. Nets
        whose route would break the brief are held back, not laid.

        Look at the picture, answer the questions, then accept with
        pcb_autoroute_apply(job_id), or change the brief or the board and
        route the round again (same nets). Nothing is written before.

        Args:
            expect_file: full path of the focused board.
            nets: route these nets as the round (default: the next round);
                the other net of a pair named comes too.
            advise: try options for nets left unrouted (default True).
            use_planes: inner layers a pour covers are planes (default True);
                one goes to routing only if a brief entry names its layer
                (summary.plane_declined says what it would close).
            time_limit_s: stop at this many seconds and keep what is made
                (summary.stopped_at_time_limit); 0: no limit. Cancel with
                design_job_cancel.

        Returns:
            ``job_id``, ``round`` {kind, nets}, ``rounds_left``, or
            ``brief_needed`` (and no job), or ``done`` when no net is open.
pcb_route_simulatetool Simulate what a routing finding asks, on the board's real copper.
Simulate what a routing finding asks, on the board's real copper.

        A finding's ``simulate`` gives the call. Give the result file as
        the ``evidence`` of your answer in pcb_autoroute_apply(accept=...).
        The copper is the board's, or, with job_id, the board's plus that
        round's routes before they are written.

        what:
            loop (ngspice): the brief loop ``name`` as the resistance and
                inductance of its routed path, driven by ``drive`` {i (A),
                rise_ns, source}; gives the peak voltage, L di/dt.
            pdn (ngspice): the pdn rule ``name``: each rail at its IC as
                the capacitors serving it, ``models`` {ref: {c_uf, esr_ohm,
                esl_nh, source}} from their datasheets, behind the
                inductance of the track and vias that mount them; swept over
                ``band`` {f_start, f_stop} Hz; gives |Z| max and where it is
                over ``target_ohm``.
            impedance (openEMS): ``net``'s tracks and vias on the stack, its
                brief reference as sheets where it is a plane or pour, ports
                at its end pads (the brief's driver first); S11, S21, line
                impedance.
            crosstalk (openEMS): ``net`` the victim, ``other`` the
                aggressor, ports at each end; near and far end coupling.

        Where a simulator is not installed the reply says so with the
        install offer for the user (never install without them); an
        openEMS model and script are written either way.

        Args:
            expect_file: full path of the focused board.
            f_max_ghz: openEMS's highest frequency (default 10).

        Returns:
            {engine, ok, the figures, inputs (what was measured on the
            copper), result_file or script} or {error}.
pcb_run_drctool Run Design Rule Check on the active PCB, with no dialog.Filesoutside text
Run Design Rule Check on the active PCB, with no dialog.

        Altium's batch check of the rules ticked for batch checking, and
        the violations it leaves on the board. Nothing opens, the focus
        does not move, and the report goes to the bridge workspace.
        ``drc_confirmed`` is true only if this run wrote its report.

        Args:
            allow_modal: True runs the check through Altium's Design Rule
                Checker DIALOG instead, which blocks the bridge for every
                session until a person presses Run or Cancel. Only for
                someone at the keyboard who wants that dialog's options.
            detail: "full" (default) or "summary": no ``rules.sheet``
                (``sheet_omitted``; read it with pcb_drc_rules) and
                ``report_rules`` only with violations
                (``report_rules_checked`` counts all). Fingerprint,
                changes and verdict stay. For repeated runs.

        Returns:
            ``violation_count`` (all), ``mode`` ("batch" or "dialog"),
            ``drc_triggered``, ``drc_confirmed``, ``report_path`` and
            ``violations`` (first 100): name, description, rule, x_mils,
            y_mils, layer, and ``primitive1`` / ``primitive2`` {detail,
            type, net, layer, x_mils, y_mils} (primitive2 empty for
            single-object rules). ``reason`` when not confirmed.
            From the report Altium wrote: ``report_counts`` (warnings,
            rule_violations, waived_violations, kept apart),
            ``report_rules`` (every rule checked and its count; a rule
            not listed was not checked), ``report_rules_add_up`` and
            ``report_stopped_at_limit`` with ``report_violation_limit``
            (Altium stopped early, so the run is not complete).
            ``rules``: what the check ran under, ``sheet`` (every rule's
            values, scopes, priority, enabled and drc_enabled),
            ``fingerprint``, ``not_checked`` with why, pours set to ignore
            violations, and against the rules the user approved
            (pcb_drc_rules) ``changes_since_approval`` and the logged rule
            changes. ``verdict``: pass, pass_with_waivers,
            pass_under_changed_rules, pass_unapproved_rules, fail,
            incomplete, not_run; ``verdict_reason`` says why. Report the
            verdict, never only the violation count.
pcb_scaletool Scale the selected free primitives by a ratio about an anchor.
Scale the selected free primitives by a ratio about an anchor.

        Each coordinate maps ``P' = anchor + ratio*(P - anchor)`` and sizes
        scale by ``ratio``. Handles free tracks, arcs, vias, pads, fills and
        text. Primitives inside a component, dimension, or polygon are skipped
        (as are polygons/regions), so this scales free copper and artwork,
        not footprints.

        Args:
            ratio: Scale factor (> 0). ``0.95`` shrinks 5%, ``1.05`` grows 5%.
            anchor: ``selection_center`` (default), ``board_center``, or
                ``origin``.

        Returns:
            {"scaled", "skipped", "ratio", "anchor_x", "anchor_y"} or an error.
pcb_set_board_regiontool Rename a board region, or lock it in 3D (folding the board then
Rename a board region, or lock it in 3D (folding the board then
        moves the other regions around it) or unlock it.

        Args:
            region: The region, by name or "#<index>" (pcb_get_board_regions).
            name: Its new name.
            locked_3d: Lock (True) or unlock (False).
pcb_set_board_shapetool Define the physical PCB board outline: a rectangle, a circle or
Define the physical PCB board outline: a rectangle, a circle or
        a polygon.

        Overwrites the current board shape. Use this right after creating a
        new PCB document to establish the board size before placing parts.
        Coordinates are in mils.

        Args:
            x1: rectangle: first corner X.
            y1: rectangle: first corner Y.
            x2: rectangle: opposite corner X (corners in any order).
            y2: rectangle: opposite corner Y.
            shape: "rectangle" (default), "circle" or "polygon".
            center_x: circle: centre X.
            center_y: circle: centre Y.
            radius: circle: radius.
            points: polygon: the vertices in order, three or more, not
                repeating the first at the end. Each is ``[x, y]`` (a
                straight edge to the next vertex) or ``{"x", "y",
                "arc_center": [cx, cy], "clockwise": false}`` (an arc
                about that centre to the next vertex, counter-clockwise
                unless ``clockwise``). A round board with mounting tabs
                is arcs of the board circle between straight tab sides
                and an arc around each hole.

        Returns:
            ``success`` and the shape as written.
pcb_set_dielectrictool Set a dielectric or solder mask (coverlay) layer of the stack:
Set a dielectric or solder mask (coverlay) layer of the stack:
        its type (Altium's number), material, dielectric constant (Dk),
        loss tangent (Df), thickness and whether it is a stiffener. Each
        value is read back; any that did not take is in ``not_applied``.
        The Layer Stack Manager's own copy of the stack is then brought in
        step (``stack_manager``, as pcb_sync_stack_manager reports it).

        Args:
            layer: The layer's name as pcb_physical_stack lists it.
            rename_to: Its new name.
pcb_set_drill_pairtool Mark a drill pair as a backdrill, and choose whether its drill
Mark a drill pair as a backdrill, and choose whether its drill
        drawing and drill guide are plotted.

        Args:
            index: The pair, from pcb_get_drill_pairs.
            backdrill, plot_drill_drawing, plot_drill_guide: True or
                False; omit to leave as it is.

        Returns:
            ``pair``, read back after the write.
pcb_set_gridstool Read, or set, the active board's grids, in mils.
Read, or set, the active board's grids, in mils.

        Call with nothing to read. Every value set is read back, and any
        that did not take is listed in ``not_applied``. The grid for
        moving parts (``component_x`` / ``component_y``) is read only: it
        follows the snap grid. obj_set_grid is the schematic's grid.

        Args:
            snap_x: Snap grid across.
            snap_y: Snap grid up.
            track: Grid for routing tracks.
            via: Grid for placing vias.
            visible: The fine visible grid.
            visible_big: The coarse visible grid.
            dot_grid: Draw the visible grid as dots (True) or lines.
            visible_big_factor: The coarse visible grid as a multiple of
                the snap grid. The fine one's (``visible_factor``) is
                read only.
            snap_unit / visible_unit / visible_big_unit: "mm" or "mil",
                the unit each grid is shown and stepped in.

        Returns:
            ``snap_x``, ``snap_y``, ``component_x``, ``component_y``,
            ``track``, ``via``, ``visible``, ``visible_big``,
            ``visible_factor``, ``visible_big_factor``, ``snap_unit``,
            ``visible_unit``, ``visible_big_unit``, ``dot_grid`` and
            ``not_applied``.
pcb_set_layer_colortool Recolour one layer.
Recolour one layer.

        Read back before success is reported. Colour is a display setting
        of the installation, not saved in the board.

        Args:
            layer: Layer name, e.g. "TopOverlay" or "Mechanical13".
            color: Colour as "#RRGGBB".

        Returns:
            Dict with ``layer``, ``color`` and ``color_hex``.
pcb_set_layer_visibilitytool Show or hide a PCB layer, or several.
Show or hide a PCB layer, or several.

        Args:
            layers: Several layer names to set at once (a list, or a JSON
                list as text), instead of ``layer``.
            layer: Layer name string, e.g.:
                Copper: "TopLayer", "BottomLayer", "MidLayer1"-"MidLayer30"
                Overlay: "TopOverlay", "BottomOverlay"
                Mask: "TopPaste", "BottomPaste", "TopSolder", "BottomSolder"
                Plane: "InternalPlane1"-"InternalPlane16"
                Other: "DrillGuide", "DrillDrawing", "MultiLayer",
                       "KeepOutLayer", "Mechanical1" and up, or the
                       board's own name for a layer
            visible: True to show, False to hide

        Returns:
            Dictionary with layer name and visibility state
pcb_set_mech_layer_kindtool Set what a mechanical layer is FOR, not what it is called.
Set what a mechanical layer is FOR, not what it is called.

        Naming a layer "Courtyard Top" does not make it one: courtyard
        checks, assembly drawings, 3D bodies and via treatments read the
        KIND. A single kind ("Fab Notes") moves off any layer holding it
        (``cleared_from``). A kind ending in Top or Bottom belongs to a
        layer PAIR and needs ``partner_layer``; it moves off any other
        pair holding it (``pairs_released``). The write is read back.

        Args:
            layer: Mechanical layer, e.g. "Mechanical13".
            kind: e.g. "Courtyard Top", "Assembly Top", "3D Body Top",
                "Fab Notes", "Not Set", or a bare number. Read the
                current kinds with ``pcb_get_mech_layer_names``.
            partner_layer: The layer for the other side; required for a
                Top or Bottom kind.

        Returns:
            Dict with ``layer``, ``kind``, ``kind_id``, ``paired``,
            ``pair_kind``, ``partner_layer``, ``pairs_released`` and
            ``cleared_from``.
pcb_set_mech_layerstool Name, enable and kind the mechanical layers of the open BOARD.
Name, enable and kind the mechanical layers of the open BOARD.

        The board counterpart of ``lib_set_mech_layers`` (which refuses
        a PcbDoc). Every change is read back, and one that did not take
        is reported against its layer.

        A kind ending in Top or Bottom belongs to the layer PAIR, stored
        without the side ("Courtyard Top" is pair kind "Courtyard"):
        give both sides in one call and they are paired and given the
        kind. Single kinds such as "Fab Notes" need no partner.

        Read ``pcb_get_mech_layer_names`` first: moving a kind off a
        layer whose ``primitive_count`` is not 0 orphans that geometry
        from anything that finds the layer by purpose.

        Args:
            layers: One dict per layer. Keys: ``layer`` (required, e.g.
                "Mechanical13"), and any of ``name``, ``enabled``
                (bool), ``kind`` (e.g. "Courtyard Top"). A layer with
                none of the three is reported as nothing asked for.
            tidy_pairs: Remove layer pairs no kind justifies. Off by
                default, because it REMOVES pairs.
            timeout: Seconds.

        Returns:
            Dict with ``document``, ``layers`` (each: layer, changed,
            problem), ``changed``, ``failed``, ``kinds_displaced``,
            ``pairs_removed``, ``pairs_tidied`` and ``pairs_scanned_to``.
pcb_set_plane_nettool Tie an internal plane layer to a net.
Tie an internal plane layer to a net.

        A plane's net belongs to the layer; a polygon poured on a plane
        connects nothing.

        The net must exist on the board. A signal layer is refused
        (``NOT_A_PLANE``) and a layer the board lacks is ``UNKNOWN_LAYER``;
        "Internal Plane 1" and "InternalPlane1" both work. The net is
        read back, and if it did not take the reply is ``success: false``,
        ``applied: false``, with the board left unmarked.

        Args:
            layer: Internal plane layer, e.g. "InternalPlane1" or the name
                the stackup reports for it
            net: Existing net name to tie the plane to, e.g. "PGND"

        Returns:
            Dictionary with "success", "layer" (the RESOLVED layer),
            "layer_name", "net", "net_readback", "applied", "route" (which
            write took) and "note".
pcb_set_rule_propertiestool
No description.
pcb_set_rules_enabledtool Bulk-toggle the DRC-enabled flag on design rules by name.Filesoutside text
Bulk-toggle the DRC-enabled flag on design rules by name.

        For example, silence Silk-to-Silk while sweeping Clearance. It
        flips ``DRCEnabled`` (whether DRC checks the rule), not
        ``Enabled``.

        Args:
            names: Rule names to toggle. With ``match="name"`` (default)
                each entry is matched case-insensitively against
                ``Rule.Name``; a trailing ``*`` wildcards the suffix
                (``"Clearance*"``). With ``match="kind"`` each entry is
                a TRuleKind ordinal as a string (look up via
                ``pcb_get_design_rules``).
            enabled: New value for ``DRCEnabled``. True turns the rule
                ON in DRC; False disables it for this run.
            match: ``"name"`` (default) or ``"kind"``.

        Returns:
            Dict with:
              - ``matched``: rules that matched any pattern
              - ``updated``: how many actually changed value
              - ``enabled``: the requested target value (for confirmation)
              - ``items``: per-matched ``{name, kind, prev_enabled, new_enabled}``
pcb_set_text_styletool Set the height and stroke width of component designators or comments.
Set the height and stroke width of component designators or comments.

        Stroke text has a height and a stroke width only; the characters
        scale with the height (0.8 mm / 0.1 mm is ``height_mils=31.5,
        stroke_mils=3.94``).

        For free texts use ``obj_modify`` on ``eTextObject`` with
        ``Height`` and ``StrokeWidth`` (filter ``IsDesignator=false``).

        Args:
            height_mils: Text height in mils. ``None`` leaves it.
            stroke_mils: Stroke width in mils. ``None`` leaves it.
            designators: Only these components (e.g. ``["U1", "R5"]``).
                ``None`` applies to every component.
            which: ``"designator"`` (default), ``"comment"`` or ``"both"``.

        At least one of ``height_mils`` / ``stroke_mils`` must be given.

        Returns:
            Dict with ``matched`` components, ``changed`` and ``failed``
            texts, ``not_found`` designators, and ``texts``: each one's
            height and stroke as read back after the write. ``success``
            is false when any text did not take or a designator was not
            found.
pcb_set_text_visibilitytool Bulk-toggle component designator and / or comment visibility.
Bulk-toggle component designator and / or comment visibility.

        Args:
            designators: If True/False, set ``Component.NameOn`` for
                matched components. ``None`` leaves designator visibility
                alone.
            comments: If True/False, set ``Component.CommentOn``. ``None``
                leaves comment visibility alone.
            filter: Restrict to these designator names (e.g. ``["U1",
                "U2", "C5"]``). ``None`` applies to every component.
                Match is case-sensitive whole-string.

        At least one of ``designators`` / ``comments`` must be supplied.

        Returns:
            Dict with:
              - ``matched``: components inspected (after filter)
              - ``updated_names``: components whose NameOn flipped
              - ``updated_comments``: components whose CommentOn flipped
pcb_set_track_widthtool Modify track width for all tracks on a specific net.
Modify track width for all tracks on a specific net.

        Changes the width of every routed track segment assigned to
        the given net. Useful for adjusting power or signal trace widths.
        Tracks only: arcs keep their width (``obj_modify`` on eArcObject
        with ``Net=``). Footprint, pour and dimension tracks are left.

        Args:
            net_name: Name of the net whose tracks to modify (e.g., "VCC")
            width_mils: New track width in mils (e.g., 10, 20, 50)

        Returns:
            Dictionary with net_name, width_mils, and tracks_modified count
pcb_set_via_soldermask_relieftool Open the solder mask round each via's barrel, measured from the
Open the solder mask round each via's barrel, measured from the
        hole edge, on both sides.

        The opening is the hole plus ``expansion_mils``, written as a
        manual value on both sides (a linked via still stores the bottom
        one) and read back into ``vias_verified``. Vias inside footprints
        are written too (``pcb_set_via_tenting`` leaves them alone). A rule scoped
        ``IsVia`` also covers vias placed later:
        ``pcb_create_design_rule(rule_type="solder_mask_expansion",
        scope="IsVia", value=<mils>)``.

        Args:
            expansion_mils: Mask expansion from the hole edge, in mils.
                Default 4.
            net: Only vias on this net. Empty means every via.

        Returns:
            ``vias_matched``, ``vias_verified``, ``expansion_mils``,
            ``net``, ``from_hole_edge``.
pcb_set_via_tentingtool Set a board via's own Tenting Top / Bottom flags.
Set a board via's own Tenting Top / Bottom flags.

        Tenting holds only on a manual solder mask expansion, so a
        rule-driven via is switched to a manual mask at the values it
        already has (``mask_made_manual``). Every flag is read back. Vias inside
        footprints are skipped: use ``lib_set_via_properties`` in the
        PcbLib.

        Args:
            points: ``[{x, y}]`` in mils; each picks the via whose pad
                covers that point (nearest centre wins).
            net: Without points, every free via on this net; with points,
                only vias on this net are considered.
            top, bottom: True tents that side, False opens it; leave one
                out to keep it as it is.

        Returns:
            ``matched``, ``changed``, ``failed``, ``points_without_a_via``,
            ``footprint_vias_skipped`` and ``vias`` [{x_mils, y_mils, net,
            tenting_top, tenting_bottom, mask_made_manual, ok}].
pcb_set_view_configurationtool Switch a board's view configuration, e.g. "Altium 3D Black".Filesoutside text
Switch a board's view configuration, e.g. "Altium 3D Black".

        Sets the PCB Standard toolbar's view configuration combo (the one
        showing "Altium Standard 2D") through the interface, and reads it
        back, so a pick that did not take is reported.

        Args:
            name: The configuration as the combo lists it. Omit it to
                read the current one; a name not on the list is refused
                with the names that are.
            board_path: Focus this .PcbDoc first. Omit it to act on the
                board already in front.
pcb_smart_drctool Design checks from TEMPORARY rules, evaluated offline. Writes no
Design checks from TEMPORARY rules, evaluated offline. Writes no
        rule and changes nothing on the board.

        Asks what the board's own rules usually leave out, using the circuit
        loops (design_find_loops) to know which nets matter:
        - ``spacing``: sensitive nets (regulator/op-amp feedback, crystal)
          closer than ``spacing_mils`` to noisy ones (switch node, bootstrap,
          gate drive). Take ``spacing_mils`` from the datasheet layout
          section where one is given; 40 is a starting value.
        - ``tightest_pairs``: the actual gap of every sensitive/noisy pair
          within ``probe_mils``, smallest first: how close the board runs to
          trouble, not only where it fails.
        - ``hot_loop_width``: hot-loop tracks narrower than the IPC-2221
          width for the current given per net in ``currents`` (amps).

        Gaps use the DRC's own geometry. Give ``board_json_path`` (saved
        LayoutBoard) or ``expect_file`` (focused board, read live). A board
        carries pad numbers only, so pass ``pin_names`` ({refdes: {pad:
        pin_name}}) to find feedback, bootstrap and gate-drive nets.
pcb_snap_to_gridtool Snap a component to the nearest grid point.
Snap a component to the nearest grid point.

        Rounds the component's X and Y position to the nearest multiple
        of the specified grid size.

        Args:
            designator: Component reference designator (e.g., "U1", "R5")
            grid_size: Grid spacing in mils (default 50)

        Returns:
            Dictionary with designator, old and new positions, and grid_size
pcb_special_stringstool List Altium's special strings on the active board, or resolve some.
List Altium's special strings on the active board, or resolve some.

        A special string is a text such as ``.Layer_Count`` that Altium
        draws as a value (``8``). Read only: nothing is left on the board.

        Args:
            action: ``list`` (default): every special string name Altium
                offers on a board, plus the names that belong to this board
                (for example ``.Total_Thickness(Board Layer Stack)``).
                ``resolve``: the value of each text in ``names``.
            names: For resolve, a ``|`` separated list of up to 200 texts,
                each a name (``.Layer_Count|.Total_Thickness|.Via_Count``)
                or mixed text (``Rev .Layer_Count/.Via_Count``).

        Each text is resolved the only way found to work from a script:
        placed as a temporary free text on the top overlay at the board
        origin, its converted string read, and removed again in the same
        call (one edit). Altium may still mark the board modified and keep
        an undo step that changes nothing.

        Only strings that a free text on a board can show resolve. Part
        strings (``.Designator``, ``.Comment``, a part parameter such as
        ``.Tolerance``) resolve only on a part's own text, and project
        parameters (``.Designer``) only on a board inside a project; on a
        free text they come back unresolved. Layer strings answer for the
        top overlay, where the text sits.

        Returns:
            list: ``count``, ``capped`` (the walk stopped at 2000),
            ``names`` and ``board_names``. resolve: ``count``, ``placed``,
            ``removed`` and ``strings``: per text ``name``, ``value`` (as
            Altium draws it), ``resolved`` (value present and different
            from the name) and ``underlying`` (the text as written, read
            back).
pcb_split_boardtool Divide the board into layer stack regions along a split line
Divide the board into layer stack regions along a split line
        from (x1, y1) to (x2, y2), in mils from the board origin, as
        Board Planning Mode's Define Split Line does. Draw it across the
        board, past the outline at both ends.

        Both halves may come back with the same name: tell them apart by
        index and give each its own (pcb_set_board_region), then a layer
        stack (pcb_layer_stacks assign).

        Returns:
            The rigid-flex setup afterwards, with ``changed`` true when a
            split line was added.
pcb_start_polygon_placementtool Start INTERACTIVE polygon pour placement on the active PCB.
Start INTERACTIVE polygon pour placement on the active PCB.

        Starts Altium's polygon placement mode; a person then draws the
        outline in Altium. It does NOT make a polygon from coordinates
        (pcb_place_polygon_rect and pcb_place_polygon_board do).

        Args:
            layer: Target copper layer (default "TopLayer")
            net_name: Net to assign to the polygon pour (optional)

        Returns:
            Dictionary confirming polygon placement mode was initiated
pcb_sync_stack_managertool Bring the Layer Stack Manager's own copy of the stack back in step
Bring the Layer Stack Manager's own copy of the stack back in step
        with the board.

        Once a board carries the manager's copy, script writes to its stack
        (pcb_set_dielectric, pcb_modify_layer, a rebuild) do not reach it:
        the manager shows the old values and writes them back on its next
        apply, pcb_move_layer included. This writes the board's thickness,
        dielectric constant, material and core / prepreg type into the
        manager's model, loads it and applies it to the board, all through
        Altium; the board's own values do not change. A layer only one side
        has is refused: the manager's layers are added or removed in the
        Layer Stack Manager itself.

        Args:
            dry_run: Only list what would change (the default).

        Returns:
            ``in_step`` before, ``changes`` (layer, field, value) and, once
            run, ``in_step_after``, ``out_of_step_after``, ``symmetric`` and
            ``symmetric_after`` (Altium keeps a stack symmetric only when it
            is). Refused: ``layers_differ``.
pcb_trim_extend_tracktool Trim or extend one track endpoint along the track's own slope.
Trim or extend one track endpoint along the track's own slope.

        Finds the track endpoint nearest (from_x, from_y), then slides it to
        the perpendicular projection of (to_x, to_y) onto that track's line.
        The track stays collinear (no bend introduced) and the opposite end
        stays put, so this cleanly lengthens a track up to a target or pulls
        it back. All coordinates in mils.

        Args:
            from_x, from_y: Picks which endpoint moves (nearest one wins).
            to_x, to_y: Target the moving end is projected toward.
            tolerance_mils: How close (from_x, from_y) must be to a real
                endpoint (default 5).

        Returns:
            {"moved_end", "old_x", "old_y", "new_x", "new_y", "layer"}.
pcb_tune_lengthtool Add approximate routed length to a net with a square serpentine.
Add approximate routed length to a net with a square serpentine.

        Lays a square meander on `net` at (x_mils, y_mils) sized to add about
        `add_length_mils`, then reports the net's routed length before and
        after.

        Open-loop and NOT DRC-checked: you choose where the meander goes and
        check clearance afterwards (`pcb_run_drc`). Finish in Altium's
        interactive tuner if needed; that one cannot be scripted.

        Args:
            net: net name.
            add_length_mils: target length to add (mils).
            x_mils, y_mils: anchor point of the meander (mils).
            layer: routing layer (default TopLayer).
            amplitude_mils: meander height; bump count = add_length / (2*amplitude).
            width_mils: track width.

        Returns:
            {"length_before_mils", "length_after_mils", "added_mils", "bumps",
             "drc_checked": false}.
pcb_unroutetool Take up the focused board's routing: its tracks, arcs and vias.
Take up the focused board's routing: its tracks, arcs and vias.

        Removes the free tracks and arcs on signal layers, and the free
        vias, that carry a net. Never removes a footprint's own copper,
        polygons or their hatching, dimensions, keepouts, or copper with
        no net (an antenna, a logo, a heat spreader): those are drawn,
        not routed. Locked routing stays unless ``include_locked``, since
        locking is how a designer keeps a route. Polygons are not
        repoured; ``pcb_repour_polygons`` does that.

        Refuses unless the focused board is ``expect_file``. With
        ``checkpoint`` (default), first snapshots the board's folder as it
        is ON DISK, so it can be restored with ``app_restore_checkpoint``;
        unsaved edits in the editor are not in it, so save first if there
        are any.

        For other selections of board copper, ``obj_delete`` (one filter
        or a list as ``items``) takes a board type with a filter, e.g.
        ``eTrackObject`` with ``Layer=TopLayer|InComponent=false``.

        Args:
            expect_file: full path of the board to un-route.
            nets: take up only these nets' routing. None takes every
                net's. A name that is not a net on the board refuses the
                whole call and nothing is removed.
            include_locked: take locked routing as well (default False).
            checkpoint: take a checkpoint first (default True).

        Returns:
            ``{"tracks", "arcs", "vias", "nets", "kept_locked", "failed",
            "checkpoint"}``: how many of each were removed, how many nets
            they were on, and how many locked primitives stayed. Or
            ``{"error": ...}``.
pcb_update_footprints_from_librarytool Refresh placed parts from their edited PcbLib, with no ECO.
Refresh placed parts from their edited PcbLib, with no ECO.

        For a footprint fixed in its library (silk, pads, 3D body) when
        the project ECO would also propose every other difference. Each
        part is replaced by a
        fresh copy from the library that keeps its side, rotation,
        position, designator and comment text as placed, locked state,
        pad nets by pad name, and its schematic link (SourceUniqueId and
        SourceHierarchicalPath, which multi-channel designs match on).

        A part is replaced only when the library holds its pattern and
        every pad that carried a net exists on the new footprint;
        otherwise it is left as it was and the reason is given. Routed
        copper is not touched, so check connectivity where pads moved.

        The part's PARAMETERS (LCSC number, manufacturer and the rest) are
        NOT carried over. Run proj_sync_pcb after a refresh, before writing
        a BOM from the board; pcb_component_parameters reads them.

        Args:
            designators: The parts to refresh, e.g. ``["C12", "J3"]``.
            library_path: The .PcbLib to load from. Empty uses each
                part's own SourceFootprintLibrary; for an integrated
                library that is its source .PcbLib, found beside it or up
                to three folders above (an IntLib is never opened: Altium
                asks to install or extract it).
            board_path: Focus this .PcbDoc first. Omit for the board in
                front.
            dry_run: Report what would be refreshed and change nothing.

        Returns:
            ``updated``, ``failed`` and per part ``ok``, ``pattern``,
            ``library``, ``pads_before``/``pads_after``, ``nets_bound``
            and a ``reason`` when it was left alone.
pcb_update_free_primitive_netstool Design > Netlist > Update Free Primitives From Component Pads.Filesoutside text
Design > Netlist > Update Free Primitives From Component Pads.

        Free tracks, arcs, vias, fills and regions with no net that touch a
        component pad take that pad's net, and copper touching them follows,
        as Altium decides. Altium asks "Update free-primitives nets from
        component-pad nets?" in a Confirm box; this tool presses Yes on that
        box, and on nothing else. Without UI Automation it refuses before
        sending anything: a direct bridge call (not through this tool)
        blocks the bridge until someone answers the Confirm box in Altium.

        Returns:
            What the bridge replied: ``no_net_before`` and ``no_net_after``
            (free copper with no net), ``changed_count`` and ``changed``
            (each object that gained a net, at most 200: ``kind``,
            ``layer``, ``net`` and its box ``x1``, ``y1``, ``x2``, ``y2``
            in mils), plus ``prompt_answered``.
pcb_via_structurestool How the board's vias are protected and drilled: each via's
How the board's vias are protected and drilled: each via's
        structure type and its features (the IPC-4761 tenting, plugging,
        filling and capping, each with side and material; Altium's numbers)
        and its back drilling (stub lengths and hole oversize). Vias that
        agree are counted together.

        Args:
            limit: The most distinct kinds listed.

        Returns:
            ``vias`` and ``structures`` (``vias``, ``structure_type``,
            ``features``, ``back_drilled``, ``top_stub_mils``,
            ``bottom_stub_mils``, ``oversize_mils``).
pcb_viewtool Read or set the area of the board the PCB editor shows.
Read or set the area of the board the PCB editor shows.

        Save the user's view with ``action="get"``, zoom wherever the work
        needs, then put the view back with ``action="set"`` and the saved
        ``left``, ``bottom``, ``right``, ``top``.

        Args:
            action: "get" (the default) reads the view; "set" zooms the
                editor on the rectangle given.
            left, bottom, right, top: the rectangle for "set", in mils
                (board coordinates, kept to 0.0001 mil).

        Returns:
            ``left``, ``bottom``, ``right``, ``top``, ``width`` and
            ``height`` of the view in mils. After "set" these are read back
            from the editor: Altium fits the rectangle to the window's
            shape, so the view shown is larger than the one asked for on
            one axis. The view moves in fixed steps; "set" also returns
            ``centre_error_mils``, at most half a step. A rectangle
            read by "get" after any zoom puts that view back exactly. On a
            board just opened, "get" reads the view saved in the file, which
            Altium refits to the window on the first zoom. A missing side,
            right <= left or top <= bottom is refused (BAD_RECT). View state
            only; the board is not marked modified.
pcb_view_optionstool Read, or set, how the board editor draws a board: net names
Read, or set, how the board editor draws a board: net names
        and numbers on pads and vias, test points, single layer mode,
        special strings shown as their values, and net highlighting.

        These are Altium's own preferences and apply to every board. A
        board must be open. Call with nothing to read; every option set
        is read back.

        Args:
            show_pad_nets: Net names on pads.
            show_pad_numbers: Pad numbers on pads.
            show_via_nets: Net names on vias.
            show_test_points: Mark test points.
            single_layer_mode: Show only the current layer.
            show_special_strings: Show special strings as their values.
            highlight_in_net_color: Highlight a net in its own colour.
            highlight_full: Highlight with a solid fill.
            highlight_whole_net: Highlight every object of the net.
            show_component_reference_point: Mark each part's origin.
            plane_draw_mode: How internal planes are drawn (Altium's
                number: read the current one first).
            pad_types_display: How pad types are shown (Altium's number).
            from_tos_display: How connection lines are drawn (Altium's
                number).
            layer_name_display: How layer names are shown on the layer
                tabs (Altium's number).
            draft_track_threshold_mils: Tracks narrower than this are
                drawn in outline in draft mode.
            show_invisible_objects: Draw objects on hidden layers too.
            transparent_layers: Draw layers see-through.
            clean_redraw: Clear the view before each redraw.
            redraw_layer_on_toggle: Redraw when a layer is switched.
            text_as_box_below: Text smaller than this many pixels is
                drawn as a box.
            pad_net_font: Font of the net names and numbers drawn on pads
                and vias; pad_net_min_font_size the smallest size it is
                drawn at.
            pad_net_font_color / pad_net_font_background: Its colours.
            default_truetype_font: TrueType font new board text starts
                with.
            board_area_color, board_line_color, sheet_area_color,
                sheet_line_color: Colours of the board area and outline
                and of the sheet area and border.
                Colours are Altium's numbers: red + 256 * green +
                65536 * blue, 0 to 16777215.

        Returns:
            ``options`` (each option by these names), ``changed``,
            ``not_applied``, ``refused`` and ``unknown``.
proj_add_documenttool Add an existing document to a project.
Add an existing document to a project.

        Args:
            document_path: Full path to the document to add
            project_path: Optional project path. If None, uses active project.

        Returns:
            Dictionary confirming the operation
proj_add_generated_documenttool List a file the project produced under its Generated documents.
List a file the project produced under its Generated documents.

        For a report, PDF, STEP or drawing written outside an OutJob, so it
        shows with the project. The file itself is not changed. ``listed``
        is true once the project holds it.
proj_add_sheettool Create a new schematic sheet and add it to a project.
Create a new schematic sheet and add it to a project.

        The sheet is created in the same directory as the project file.
        Refused (FILE_EXISTS) when a file of that name is already there,
        as one removed with proj_delete_sheet is: it would open with its
        old drawing. Refused (NO_PROJECT) when no project is named and
        the focused document belongs to none, as a library opened on its
        own does.

        Args:
            name: Name for the new sheet (without .SchDoc extension).
                  Default "NewSheet".
            project_path: The open project to add it to; empty means the
                focused project.

        Returns:
            ``path``, ``project_path``, ``saved``, ``added_to_project``
            (read back from the project's document list) and
            ``project_saved``; ``success`` only when saved and added.
proj_annotatetool Annotate schematic designators programmatically, no dialog, no user interaction.
Annotate schematic designators programmatically, no dialog, no user interaction.

        Numbers every unlocked component on every sheet in the chosen
        order, per prefix (R1, R2, ... C1, ...), keeping each prefix ("R?"
        and "R13" both stay R). Locked designators are skipped. Undoable.

        Args:
            order: Annotation traversal order:
                   "down_then_across" (default: row-major top-to-bottom, left-to-right)
                   "up_then_across"   (row-major bottom-to-top, left-to-right)
                   "across_then_down" (column-major left-to-right, top-to-bottom)
                   "across_then_up"   (column-major left-to-right, bottom-to-top)
                   "none"             (reset all designators to "<prefix>?")

        Returns:
            Dictionary with:
              - success: True
              - order: the order that was applied
              - renamed: count of components renumbered
              - reset: count reset to "?" (only for order="none")
              - skipped_locked: count of locked components left untouched
              - documents_processed: count of schematic sheets visited
              - programmatic: True (marks this as the non-interactive path)
proj_apply_policy_erctool Bring a project's ERC levels to an ERC set in the policyFilesEnv varsoutside text
Bring a project's ERC levels to an ERC set in the policy
        folder: erc_levels.json, or erc_levels/<set_name>.json, with the
        sets it extends folded in.

        Args:
            set_name: The named set; "" for erc_levels.json.
            apply: False (default) only reports the differences.
            project_path: The .PrjPcb. Default: the focused project.

        Returns:
            ``chain`` (files merged, base first), ``change``, ``same``,
            ``unknown`` (types the project does not list); with apply,
            the write's reply in ``applied_reply`` and ``saved``.
proj_closetool Close a project, saving its documents (default) or discarding
Close a project, saving its documents (default) or discarding
        their unsaved edits (save=False).

        Altium closes the FOCUSED project, so this focuses the named one
        first and refuses if it cannot; if any other project closes, it
        stops and reports it as ``closed_instead``. Without saving, it
        clears each member's modified flag so no save prompt appears; if
        one appears anyway it answers "Save None" then "OK", but only
        when every listed document belongs to this project. A prompt
        that lists another project's documents is cancelled, in either
        mode, and the close reported as not done with
        ``foreign_documents``. A document shared with another
        open project loses its edits too. A prompt left open blocks the
        bridge: answer it with app_press_dialog_button.

        Args:
            project_path: Project to close; omit for the focused one (a
                save=False prompt is then left for a human).
            save: Write modified documents first (True) or discard (False).

        Returns:
            ``success``, ``closed`` (checked by looking again),
            ``project_path``; ``prompts_answered`` and ``discarded`` when a
            prompt was answered, ``prompt`` and ``reason`` when one was
            left; otherwise ``discarded`` (members closed unsaved, not
            proof of edits) and ``attempts``.
proj_compare_sch_pcbtool Compare schematic and PCB component counts.
Compare schematic and PCB component counts.

        Compiles the project. ``proj_get_differences`` gives the
        per-component breakdown. Before proposing a footprint or pin fix,
        read the parts' datasheets.

        Args:
            project_path: Optional project path. If None, uses active project.

        Returns:
            Dictionary with sch_components, pcb_components, components_match
            (bool), and pcb_path. (Net-count comparison is not provided here;
            use ``proj_get_nets`` / ``pcb_get_nets``.)
proj_compiletool Compile a project to check for errors.
Compile a project to check for errors.


        Args:
            project_path: Optional project path. If None, uses active project.

        Returns:
            Dictionary with compilation results including any errors/warnings
proj_component_modelstool Show where each part's models resolve, as Altium finds them.
Show where each part's models resolve, as Altium finds them.

        For each compiled part, each model (footprint, simulation, 3D...)
        with its name, type, whether it is the current one and whether it
        comes from an integrated library, and per datafile the library it
        names, the entity, the kind and ``found_at``: the full path Altium
        resolves it to, empty when it finds none. ``datafiles_not_found``
        counts the links that resolve nowhere.

        Args:
            project_path: The .PrjPcb. Defaults to the focused project.
            designator: One part. Empty lists every part.
            limit: The most parts to list (default 300).
proj_copy_varianttool Start a new variant from an existing variant's entries.
Start a new variant from an existing variant's entries.

        Carries over every entry (fitted, not fitted, alternate with its
        library link), every varied parameter value and the variant's own
        parameters, then compares each entry with its source. Also the way
        to keep a copy before ``proj_delete_variant``.

        Args:
            source: The variant to copy, by name or description.
            name: The new variant's name (saved as its description, which
                Altium shows as the name); one already in use is refused.
            project_path: The .PrjPcb. Defaults to the focused project.

        Save the project (proj_save) to keep the change.

        Returns:
            ``entries_copied``, ``parameter_values_copied``,
            ``variant_parameters``, ``alternate_links_not_copied``,
            ``differs`` (designators whose copy does not match) and
            ``applied``.
proj_createtool Create a new, empty Altium project, made and saved by Altium.
Create a new, empty Altium project, made and saved by Altium.

        The file's extension decides the kind: .PrjPcb a PCB project,
        .PrjHar a harness project (then add a wiring diagram with
        app_create_document kind "HarnessWiringDiagram" and a .WirDoc
        path), .LibPkg an integrated library package. An existing file is
        refused, never overwritten: open it with proj_open.

        Args:
            project_path: Full path for the new project file.
            project_type: Not needed; the extension decides the kind.

        Returns:
            Dictionary with created project information
proj_create_outjobtool Give a project an OutJob by copying one in the user's own style.FilesEnv varsoutside text
Give a project an OutJob by copying one in the user's own style.

        It invents no outputs: it copies an existing OutJob (the user's
        own, or one Altium ships), points each output at this project's
        documents, writes every container to ``output_dir``, and adds the
        copy to the project. Altium saves the project's file itself, so
        when Altium does not save, the project gets none. Run it afterwards
        with proj_run_outjob or proj_generate_fab_package.

        ASK THE USER FIRST. With no ``source_outjob`` nothing is written:
        the reply lists the OutJobs found in open projects. Ask the user
        which one to copy, or how they prefer their outputs (Gerber
        format and units, drill files, pick-and-place, BOM, folders) and
        pick the closest. Altium's own templates are a fallback, used
        only with ``use_fallback`` once the user has agreed. While the
        dashboard's Saving switch is off it is refused and writes nothing.

        Args:
            project_path: The target .PrjPcb.
            source_outjob: The .OutJob to copy.
            outjob_name: File name for the copy; defaults to the source's.
            output_dir: Absolute folder for the outputs; defaults to
                "Project Outputs for <project>" beside the project.
            use_fallback: With no source, copy Altium's shipped
                Fabrication template. Only once the user has agreed.

        Returns:
            ``outjob_path``, the ``outputs`` it holds, which documents
            were ``retargeted`` and which were left ``unmapped``, and the
            containers Altium reads back from it.
proj_create_varianttool Create a new project variant.
Create a new project variant.

        After creating, use `proj_set_active_variant` to switch to it,
        and `proj_set_component_variation` to mark parts not fitted or
        give them an alternate part.

        Altium saves only the description and shows it as the variant's
        name; leave ``description`` empty and it takes ``name``. A name
        that differs from the description lasts until the project is
        reopened.

        Args:
            name: Name for the new variant
            description: Optional description
            project_path: Optional project path. If None, uses active project.

        Returns:
            Dictionary confirming creation with name and description
proj_cross_probetool Jump to and highlight a component in the schematic or PCB.
Jump to and highlight a component in the schematic or PCB.

        Args:
            designator: Component designator to find (e.g., "U1", "R8")
            target: "schematic" or "pcb"

        Returns:
            Dictionary confirming the operation
proj_delete_sheettool Remove a schematic sheet from the focused project.Filesoutside text
Remove a schematic sheet from the focused project.

        Safety check: refuses to remove the last remaining schematic sheet.
        The file is removed from the project but not deleted from disk, and
        closed unless it has unsaved edits. The project file is saved and
        read back, and Altium writes it fresh when its save left the
        sheet in it, as proj_remove_document does.

        Args:
            file_path: Full path to the .SchDoc file to remove

        Returns:
            ``removed``, ``project_saved`` and ``in_project_file`` (the
            file on disk still lists it); ``success`` only when it does not.
proj_delete_varianttool Delete a project variant, with every component variation in it.
Delete a project variant, with every component variation in it.

        NOT REVERSIBLE: run ``proj_copy_variant`` first to keep a copy.
        Read the variant with ``proj_list_variants`` first if you did not
        create it; ``entries_removed`` reports how many went. Addressed
        by name, since deleting one renumbers the rest.

        Args:
            variant_name: name of the variant to remove.
            project_path: optional project path; defaults to the focused
                project.

        Returns:
            ``{"success": true, "variant_name": ..., "entries_removed": N,
            "variant_count_before": N, "variant_count_after": N,
            "verified": true}``, or ``success: false`` with a ``reason``
            when the variant is still listed afterwards.
proj_export_bom_htmltool Export the project BOM as a self-contained interactive HTML file.Files
Export the project BOM as a self-contained interactive HTML file.

        Standalone HTML page, no external CSS / JS / Altium runtime
        dependency. Open it in any browser; sortable columns, free-text
        filter, toggle between grouped (one row per value+footprint) and
        per-component layouts. A self-contained one-shot static export.

        Useful for emailing the BOM to a manufacturer, archiving with a
        board release, or sharing with a non-Altium reviewer.

        Args:
            output_path: Where to write the HTML. Defaults to
                ``<workspace>/bom.html``.
            title: Heading + ``<title>`` for the page.
            limit: Max components to include (default 5000; the BOM call
                supports up to ~10000 cleanly).

        Returns:
            Dict with ``ok``, ``html_path``, ``components`` (count
            written), ``bytes``.
proj_export_dxftool Export the active PCB to DXF (AutoCAD) format.
Export the active PCB to DXF (AutoCAD) format.

        Requires an active PCB document. If output_path is omitted,
        Altium may show a file-save dialog.

        Args:
            output_path: Full path for the output .dxf file (optional)

        Returns:
            Dictionary confirming the export
proj_export_netlisttool Write the compiled connectivity to a flat netlist file.Files
Write the compiled connectivity to a flat netlist file.

        "pads" (PADS-PCB ASCII) or "tabular" (component,pin,pin_name,net
        CSV). Single-pin and unnamed nets are included.

        Args:
            output_path: Destination file. Defaults to
                workspace/netlist.<ext> if omitted.
            net_format: "pads" (default) or "tabular".
            project_path: Optional project path; uses active if omitted.

        Returns:
            Dictionary with output_path, net_format, net_count, node_count.
proj_export_pdftool Open Altium's PRINT dialog for the active document, for a PDF.
Open Altium's PRINT dialog for the active document, for a PDF.

        NOT UNATTENDED. This opens the print preview / print setup dialog
        with the user's real printer selected and a live Print button,
        and blocks the bridge until a person finishes or cancels it; a
        wrong press prints paper. ``written`` says whether the PDF exists
        afterwards. For a PDF with nobody at the machine, run an OutJob
        container whose medium is PDF (proj_list_outjob_containers, then
        proj_run_outjob).

        Args:
            output_path: Full path for the output PDF file

        Returns:
            Dictionary confirming export
proj_export_variant_matrix_csvtool Write the variant fitted/not-fitted matrix to a CSV.Files
Write the variant fitted/not-fitted matrix to a CSV.

        One row per component (every one), one column per variant, each
        cell ``Fitted`` / ``Not Fitted`` / ``Alternate``.

        Args:
            output_path: Destination .csv. Defaults to
                ``workspace/variant_matrix.csv``.
            project_path: Optional project path. If None, uses the focused
                project.

        Returns:
            {"output_path", "component_count", "variant_count"} or an error.
proj_find_componenttool Search for components across all project sheets.
Search for components across all project sheets.

        Case-insensitive partial match. For a technical question about a
        match, read its datasheet; symbol metadata is not ground truth.

        Args:
            search_text: Text to search for (e.g., "U1", "100nF", "LM317")
            search_by: Property to search, "designator", "value", or "comment" (default "designator")
            project_path: Optional project path. If None, uses active project.

        Returns:
            Dictionary with "results" array (each: designator, comment, footprint,
            lib_ref, sheet, location_x, location_y) and "count", plus
            `_datasheet_guidance` + `_datasheet_parts`.
proj_force_recompiletool Flush all dirty docs, invalidate the compile cache, and recompile.
Flush all dirty docs, invalidate the compile cache, and recompile.

        For a netlist that is surely fresh. The compile ticks before and
        after show the recompile happened.

        Returns:
            Dict with recompiled, prev_compile_tick, new_compile_tick,
            project path.
proj_get_active_varianttool Get the currently active project variant.
Get the currently active project variant.

        Args:
            project_path: Optional project path. If None, uses active project.

        Returns:
            Dictionary with variant "name" and "description".
            Returns "[No Variations]" if no variant is active.
proj_get_board_infotool Get PCB board information, outline vertices, layer stack, origin.
Get PCB board information, outline vertices, layer stack, origin.

        It answers about ANY open board when none is focused. Check
        ``board_path`` (the board that answered), or focus the board you
        mean first.

        Returns:
            Dictionary with origin_x, origin_y, board_path, outline
            (vertex array), and layers (active copper layer names)
proj_get_bomtool Export a full BOM from the compiled project.
Export a full BOM from the compiled project.

        DATASHEET DISCIPLINE: library metadata is NOT authoritative; read
        a part's datasheet before drawing conclusions about it
        (``_datasheet_guidance`` has search queries).

        Every component with designator, comment, footprint, library
        reference and pin nets.

        With ``variant``, the BOM is the one that variant builds: its
        not-fitted parts leave ``components`` (listed in ``not_fitted``),
        an alternate part takes the alternate's library reference and
        footprint (``alternate`` holds its library link), and varied
        parameter values replace the base ones (``varied_parameters``;
        a varied Comment becomes ``comment``). An alternate keeps the base
        comment unless the variant varies it.

        Args:
            project_path: Optional project path. If None, uses active project.
            limit: Max components to return (default 1000).
            variant: A variant's name or description. Leave empty for the
                base design.

        Returns:
            Dictionary with "components" array and "count", "limit",
            "limit_hit" (true when the list stopped at ``limit`` with
            components left over), "skipped_nil", plus
            `_datasheet_guidance` + `_datasheet_parts`. With ``variant``
            also ``variant``, ``not_fitted``, ``alternates``, ``varied``
            and ``entries_not_in_bom``; each component carries
            ``variation`` (none, fitted or alternate).
proj_get_channelstool List the sheet instances of a multi-channel design, as compiled.
List the sheet instances of a multi-channel design, as compiled.

        Every compiled sheet instance with its ``instance`` name,
        hierarchical ``path``, ``room``, ``channel_prefix``,
        ``channel_index`` and ``instance_number``, and the project's
        ``room_naming_style``. A design without repeated channels lists
        each sheet once.

        Args:
            project_path: The .PrjPcb. Defaults to the focused project.
proj_get_compile_freshnesstool Report the age of the cached netlist and which docs are dirty.
Report the age of the cached netlist and which docs are dirty.

        Check this before disagreeing with the user about connectivity:
        a dirty document means the netlist does NOT reflect what the user
        is looking at.

        ``needs_compile`` and ``violation_count`` are Altium's own
        answer: whether the project needs compiling now, and how many
        violations its last compile left (-1 when it would not say).

        Returns:
            Dict with compile_age_ms, needs_compile, violation_count,
            compile_cached (bool), ttl_ms, open_doc_count,
            dirty_doc_count, dirty_docs[], project.
proj_get_component_infotool Get full information about one placed component.
Get full information about one placed component.

        Pin nets need a project compile (30-60 s on a large project);
        with_pin_nets=False answers in under a second.

        DATASHEET DISCIPLINE: parameters and comment are not
        authoritative; fetch the datasheet before stating pin functions
        or ratings.

        Args:
            designator: e.g. "U1".
            project_path: Project (default: the active one).
            with_pin_nets: Compile and give each pin's net (default True).
            with_parameters: Include parameters (default True).
            timeout: Poll timeout in seconds (raise to ~90 with pin nets
                on large projects).

        Returns:
            designator, comment, footprint, lib_ref, sheet, ``pins``
            [{pin, name, net?}], ``parameters`` when asked, and
            ``_datasheet_guidance``.
proj_get_component_info_manytool Full per-component info for MANY designators in ONE round-trip.
Full per-component info for MANY designators in ONE round-trip.

        One compile for the whole list (a list of one for a single part).
        ``with_pin_nets=False`` skips the compile for a sub-second read.

        Parameters and library metadata are not authoritative: read the
        manufacturer datasheet before reasoning about pin functions,
        ratings or behaviour (see `_datasheet_guidance`).

        Args:
            designators: List of component designators.
            project_path: Optional project path. If None, uses active.
            with_pin_nets: When True (default) compile once and emit
                the flattened net for each pin on every component.
                Set False to skip the compile.
            with_parameters: When True (default) include each
                component's parameter dict.
            timeout: Optional bridge poll-timeout override (seconds).
                Raise this when keeping `with_pin_nets=True` on large
                hierarchical projects.

        Returns:
            Dict with components[], matched, requested, not_found[],
            plus `_datasheet_guidance` + `_datasheet_parts`.
proj_get_connectivitytool Get pin-to-net connectivity for a specific component.
Get pin-to-net connectivity for a specific component.

        Compiles the project; every pin with number, name and net. A
        multi-part component placed across sheets is read from all of
        them (``sheets``).

        Args:
            designator: Component designator (e.g., "U1", "R8")
            project_path: Optional project path. If None, uses active.
            force_recompile: SaveAll + invalidate cache + recompile
                before reading. Use when you need a guaranteed-fresh
                netlist.
            pins: Only these pins, by number or name; ``pins_left_out``
                counts the rest.
            connected_only: Leave out pins on no net ("" or "?").

        Pin names come from the symbol and can be wrong: check a pin's
        function against the manufacturer datasheet before relying on it
        (see `_datasheet_guidance`).

        Returns:
            Dict with designator, comment, sheet, sheets, pin_count,
            pins[], plus `_datasheet_guidance` + `_datasheet_parts`.
proj_get_connectivity_manytool Pin-net connectivity for MANY components in ONE round-trip.
Pin-net connectivity for MANY components in ONE round-trip.

        One compile for the whole list (a list of one for a single part).
        Pin names come from the symbol and can be wrong: check pin
        functions in the datasheet. A multi-part component placed across
        sheets is read from all of them (``sheets``).

        Args:
            designators: List of component designators.
            project_path: Optional project path.
            force_recompile: SaveAll + invalidate cache + recompile
                before reading. Use when you need a guaranteed-fresh
                netlist.
            pins: Only these pins (number or name) of each component;
                ``pins_left_out`` counts the rest.
            connected_only: Leave out pins on no net ("" or "?").

        Returns:
            Dict with components[], matched, requested, not_found[],
            plus `_datasheet_guidance` + `_datasheet_parts`.
proj_get_declared_design_objectstool The net classes, component classes, differential pairs and rooms
The net classes, component classes, differential pairs and rooms
        the project's schematics declare, from the compiled project.

        What an Update PCB would create on the board; compare with
        pcb_get_net_classes / pcb_get_differential_pairs.

        Returns:
            ``sheets_examined`` (an empty answer from 0 sheets means
            nothing was read), ``net_classes`` and
            ``component_classes`` (``name``, ``sheet``,
            ``members``), ``differential_pairs`` (``name``, ``positive``,
            ``negative``) and ``rooms`` (``name``, ``scope``).
proj_get_differencestool Get detailed differences between schematic and PCB netlist.
Get detailed differences between schematic and PCB netlist.

        Compiles the project and uses component mappings to find:
        - Matched components (present in both schematic and PCB)
        - Extra components in schematic (not yet in PCB)
        - Extra components in PCB (not in schematic)

        Args:
            project_path: Optional project path. If None, uses active project.

        Returns:
            Dictionary with matched_components, extra_in_schematic (array),
            extra_in_pcb (array), and in_sync (bool)
proj_get_erc_levelstool The project's ERC report level for every violation type (Project
The project's ERC report level for every violation type (Project
        Options > Error Reporting): no_report, warning, error or fatal.

        Args:
            match: only types whose description contains this text, e.g.
                "multiple names" or "driving source".
            project_path: the .PrjPcb; default the focused project.

        Returns:
            ``levels``: [{kind, description, level}], and ``count``.
proj_get_erc_violationstool Return the ERC violation list produced by the last
Return the ERC violation list produced by the last
        ``proj_run_erc()`` invocation.

        A cheap re-read; ``proj_run_erc()`` does the slow check. Each
        violation lists its ``related_objects`` (``kind``, ``document``
        and the ``cross_probe`` string Altium uses to find that exact
        pin or net). Act only on a named object: a NoERC marker placed by
        guesswork hides a real disconnection. ``related_object_count``
        tells a violation with no objects from one whose objects could
        not be read.

        Args:
            limit: How many violations to return; 0 returns all of them.
            offset: Index of the first violation, to page through a long
                list without running ERC again.
            include_suppressed: also list violations a No ERC marker
                covers or whose type is set to No Report; left out and
                only counted by default, as Altium's Messages panel does.

        Returns:
            ``{"violation_count", "offset", "returned", "truncated",
            "next_offset" (when truncated), "violations": [{"index",
            "description", "detail", "related_object_count",
            "related_objects": [{"kind", "document", "cross_probe"}]}]}``
proj_get_focusedtool Get information about the currently focused project.
Get information about the currently focused project.

        Returns:
            Dictionary with project information:
            - project_name: Name of the project
            - project_path: Full path to the project file
            - document_count: Number of documents in the project
proj_get_hierarchytool The compiled sheet hierarchy: each sheet's ``parents``,
The compiled sheet hierarchy: each sheet's ``parents``,
        ``ports`` and ``sheet_symbols`` with their ``entries``, and the
        ``problems``: a missing child, an entry without a port or a port
        without an entry, opposite directions, an orphan sheet.

        Each port and entry gives ``net``, the net's name on its own sheet,
        and ``physical``: per copy of the sheet (one per channel), the
        ``instance`` and the ``net`` it joins across the project. They
        differ when a name from another sheet wins. ``x`` / ``y`` (mils)
        tell apart items of one name.

        Args:
            project_path: The .PrjPcb. Default: the focused project.
proj_get_messagestool Get all messages from the Messages panel (compile errors, ERC violations, etc.).
Get all messages from the Messages panel (compile errors, ERC violations, etc.).

        Compiles the project first.

        Args:
            project_path: Optional project path. If None, uses active project.

        Returns:
            Dictionary with "messages" array (each: message, severity, source) and "count"
proj_get_net_itemstool Show what gives each compiled net its name, and where.
Show what gives each compiled net its name, and where.

        For each net: its net labels, power ports, ports, sheet entries,
        off-sheet connectors and ``directives`` (the ones the compiled net
        carries) with sheet and location, whether the
        compiler made the name up (``auto_generated``),
        ``local_scope`` (False when a power port gives the net a global
        name; a net joined across sheets by ports still reads True), its
        ``electrical`` type as Altium words it (Passive, Input, Output,
        I/O ...), ``erc_suppressed`` (a No ERC marker sits on it), and
        for a bus member ``bus_prefix`` and ``bus_index``. With one net,
        its pins too.

        Args:
            net: One net (any case). Empty lists every net.
            named_only: Skip nets that nothing names.
            limit: The most nets to list (default 500); ``truncated``
                says when more were left out.
            project_path: The .PrjPcb. Defaults to the focused project.
            structure: Add how each net is built, from the compiled
                model: ``sub_wires``, ``lines``, ``all_items``,
                ``removed_items``, ``scope``, ``signal_type``,
                ``calculated_name``, ``hidden_name``, ``bus_width``,
                ``net_number``, ``non_pin_items`` (labels, ports and other
                objects on it), ``harness_type`` and the count of
                ``output_pins``, ``io_pins``, ``power_pins`` and
                ``open_collector_pins`` it joins (two outputs on one net
                drive against each other). For buses: ``bus_section``
                (the bus itself, e.g. D[0..7]) with ``bus_kind``,
                ``bus_range_from`` / ``bus_range_to`` as written,
                ``bus_range_value_from`` / ``bus_range_value_to`` and
                ``bus_range_by_value``; ``bus_element`` (one member) with
                ``bus_section_parent`` naming its bus.

        Returns:
            ``nets_examined``, ``nets_listed``, ``truncated`` and
            ``nets``.
proj_get_netstool Get net-to-pin connectivity from the compiled project netlist.
Get net-to-pin connectivity from the compiled project netlist.

        For more than one component or net, do NOT loop: call once with
        no filters (raise ``limit``) and slice locally. Each call
        compiles the project, about 700 ms.

        Args:
            component: Filter by component designator. Empty = all.
            net_name: Filter by net name; * and ? match any run and
                one character (SD*), case ignored. Empty = all.
            project_path: Optional project path. If None, uses active.
            limit: Max pin records (default 500); 0 lists every pin.
            force_recompile: Save dirty docs and recompile from scratch
                (5-10 s more), for a netlist that is surely fresh, e.g.
                after the user edited sheets. ``proj_get_compile_freshness``
                tells whether any doc is dirty.

        Returns:
            Dict with "pins", "count", "limit", "limit_hit" (true when
            the list stopped at ``limit`` with pins left over) and
            "skipped_nil" (entries Altium returned empty).
proj_get_optionstool Get project options: output path, hierarchy mode, compiler settings.
Get project options: output path, hierarchy mode, compiler settings.

        Returns configuration details including output directory, hierarchy mode,
        document counts, variant count, channel settings, and net naming options.

        Args:
            project_path: Optional project path. If None, uses active project.

        Returns:
            Dictionary with project_name, output_path, hierarchy_mode,
            logical_document_count, physical_document_count, variant_count,
            channel settings, and net naming options
proj_get_parameterstool Get all parameters defined at the project level.
Get all parameters defined at the project level.

        Args:
            project_path: Optional project path. If None, uses active project.

        Returns:
            List of parameter dictionaries with name and value
proj_get_pathtool Get the full path of the currently focused project file.
Get the full path of the currently focused project file.

        Returns:
            Dictionary with project_path, project_dir, and project_name
proj_get_statstool Get design statistics from the compiled project.
Get design statistics from the compiled project.

        Returns counts of sheets, components, pins, and nets.

        Args:
            project_path: Optional project path. If None, uses active project.

        Returns:
            Dictionary with sheets, components, pins, nets counts
proj_get_unconnected_pinstool Find unconnected/floating pins in the focused project.
Find unconnected/floating pins in the focused project.

        Compiles the project first.

        Returns:
            Dictionary with "count" and "unconnected_pins" array, each entry
            having designator, pin_number, pin_name, and sheet path
proj_import_documenttool Import a document into the focused project from an external path.
Import a document into the focused project from an external path.

        Altium writes a copy into the project directory (if not already
        there), as Save Copy As, then it is added to the project and the
        project file saved. A file already at the new path is refused.

        Args:
            source_path: Full path to the source document (SchDoc, PcbDoc, etc.)

        Returns:
            Dictionary with success status, source_path, and dest_path
proj_import_from_kicadtool Rebuild a KiCad project in Altium: libraries, schematic, board.Filesoutside text
Rebuild a KiCad project in Altium: libraries, schematic, board.

        Altium draws everything through this server's own tools: each
        symbol and footprint the project uses, as KiCad draws it (no grid
        snapping), into a SchLib and PcbLib of the new project's own, then
        every sheet from a template (parts where KiCad put them,
        mirrored as there, wires, power ports, net labels, ports, sheet
        symbols and entries, No ERC markers, the parts' fields), then the
        board (outline, layer stack, parts on their side and angle, tracks,
        arcs, vias, zones as pours, net classes and their rules). KiCad's
        files are only read. Global labels become power ports.

        Checks: every symbol and footprint read back from the new
        libraries against KiCad's own (pins, body drawing, pads, drills,
        drawing layers); any difference stops the import before a sheet is
        drawn and is listed in ``libraries.differences``, to be fixed, not
        passed over. Altium's compiled netlist against KiCad's (kicad-cli), pin
        group by pin group (``nets.same``); every pad read back against
        KiCad's centre (``board.pads``); a DRC (``board.drc``). Copper
        takes the Altium name of the net its pads are on
        (``board.renamed_nets``).

        Args:
            kicad_project: The .kicad_pro, its root .kicad_sch, or its
                folder.
            output_dir: An empty folder for the Altium project.
            dry_run: Only plan (default): step counts, what is not
                carried, and each sheet's template checked against KiCad's
                own pin positions (``sheets``), with Altium untouched.
            kicad_cli: kicad-cli.exe for the netlist check; empty = the
                newest KiCad installed.

        Returns:
            ``ok``, ``project`` (the .PrjPcb), ``stages`` (each with
            ``done``/``of`` and the step that failed, if one did),
            ``sheets``, ``warnings`` and ``nets``.
proj_list_documentstool List all documents in a project.
List all documents in a project.

        Args:
            project_path: Optional path to specific project. If None, uses active project.

        Returns:
            List of document information dictionaries containing:
            - file_name: Document file name
            - file_path: Full file path
            - document_kind: Type of document
proj_list_opentool List all currently open projects in the Altium workspace.
List all currently open projects in the Altium workspace.

        Returns:
            Dictionary with "projects" array (each: project_name,
            project_path, document_count) and "count"
proj_list_outjob_containerstool List all output containers defined in an OutJob file.
List all output containers defined in an OutJob file.

        Run one with `proj_run_outjob`.

        Args:
            outjob_path: Path to the .OutJob file. If omitted, uses the
                         first OutJob found in the focused project.

        Returns:
            Dictionary with "outjob_path" and "containers" array (each:
            name, type, outputs, output_names, output_path, output_dir,
            index), read through Altium's OutJob API.
proj_list_variantstool List all project variants with their component overrides.
List all project variants with their component overrides.

        Compiles the project and returns every variant definition including
        component variation details (Fitted / Not Fitted / Alternate) and
        any parameter overrides.

        Args:
            project_path: Optional project path. If None, uses active project.

        Returns:
            Dictionary with "variants" array and "count". Each variant has
            name, description, its own ``parameters``, and variations
            array (designator, unique_id, kind, alternate_part (Altium
            reads it from the varied Comment, so a fitted part with a
            varied Comment shows one too),
            ``alternate_link`` for an alternate: the alternate's library,
            symbol reference and footprint, and ``parameters``, the varied
            parameter values).
proj_load_sheetstool Load every schematic sheet of a project into the Altium editor.
Load every schematic sheet of a project into the Altium editor.

        Project-scope queries and edits see only loaded sheets
        (``loaded`` in app_list_documents); call this first. Safe to
        repeat.

        Args:
            project_path: Optional project path. If None, uses focused project.

        Returns:
            Dictionary with:
            - total_sheets: Total SCH sheets in the project
            - loaded: Sheets newly loaded by this call
            - already_loaded: Sheets that were already resident
            - failed: Sheets that could not be opened
proj_lock_designatortool Lock or unlock component designators to prevent re-annotation.
Lock or unlock component designators to prevent re-annotation.

        When locked, designators are preserved during annotation operations.
        Use designator="all" to lock/unlock all components on the active sheet.

        Args:
            designator: Component designator (e.g., "U1", "R3") or "all" for all components
            lock: True to lock, False to unlock (default True)

        Returns:
            Dictionary with designator, locked status, and count of affected components
proj_make_integrated_librarytool Make an integrated library of every part the project places.
Make an integrated library of every part the project places.

        Altium's Design > Make Integrated Library, which runs with no
        dialog: the symbols and footprints of the placed parts are
        compiled into "<project>.IntLib" in the project folder,
        replacing one already there. One document of the project must
        be open (proj_load_sheets).

        Args:
            project_path: The .PrjPcb. Defaults to the focused project.

        Returns:
            ``intlib``, ``built`` (a new file is there, read from its
            time), ``bytes`` and the ``focused_document`` it ran from.
proj_net_colortool Read, or set, the colour the project gives a net.
Read, or set, the colour the project gives a net.

        Args:
            net: The net name.
            color: "#RRGGBB", "none" to clear the project's colour for
                the net, or empty to only read.
            project_path: The .PrjPcb. Defaults to the focused project.

        Returns:
            ``color_before`` and ``color`` as "#RRGGBB", or "none" when the
            project sets no colour (and Altium's own integers as
            ``color_before_bgr`` / ``color_bgr``).
proj_opentool Open an existing Altium project.
Open an existing Altium project.

        Args:
            project_path: Full path to the project file

        Returns:
            Dictionary with opened project information
proj_output_paneltool Read the lines in Altium's Output panel, newest last.
Read the lines in Altium's Output panel, newest last.

        Altium writes progress and results of many processes there
        (compiles, generators, scripts). ``clear`` empties the panel after
        reading, so the next read shows only what came since.
proj_project_setuptool Read, or change, a project's document order, library searchFilesoutside text
Read, or change, a project's document order, library search
        paths, net naming options, net identifier scope, output path,
        pin swap options, single-pin nets, automatic sheet numbering and
        class generation.

        Call with no changes to read. Every change is read back, and
        any that did not take is listed in ``not_applied``. Save the
        project (proj_save) to keep the changes.

        Args:
            move_document: Full path of a document to move.
            move_to_index: Its new position, from 0 (with move_document).
            add_search_path: A folder to add to the library search paths.
            include_subfolders: Search below that folder too.
            allow_port_net_names: Ports name nets.
            allow_sheet_entry_net_names: Sheet entries name nets.
            hierarchy_mode: The net identifier scope: automatic, flat,
                hierarchical, global or strict_hierarchical (or Altium's
                number 0 to 4, in that order).
            output_path: The folder outputs are written to.
            append_sheet_number_to_local_nets: Add the sheet number to
                the names of nets local to one sheet.
            pin_swap_by_net_label: Pin swaps on the board may change
                net labels on the schematic.
            pin_swap_by_pin: Pin swaps on the board may move pins on
                the schematic.
            single_pin_nets: Allow single pin nets.
            auto_sheet_numbering: Altium numbers the sheets itself.
            class_generation: Project-wide class generation flags, any
                of comp_class_manual, comp_class_manual_room,
                net_class_auto_bus, net_class_auto_comp,
                net_class_auto_named_harness, net_class_manual,
                net_class_separate_bus_sections (True / False).
            class_gen_document: Full path of the sheet that
                sheet_class_generation applies to.
            sheet_class_generation: That sheet's flags: comp_class_auto,
                comp_class_auto_room, generate_class_cluster (True /
                False) and net_class_auto_scope (none, local or all).
            project_path: The .PrjPcb. Defaults to the focused project.

        Returns:
            ``documents`` (in project order), ``search_paths``,
            ``generated_documents``, the two naming options,
            ``hierarchy_mode`` (Altium's number) and
            ``hierarchy_mode_name``, ``output_path``,
            ``append_sheet_number_to_local_nets``,
            ``pin_swap_by_net_label``, ``pin_swap_by_pin``,
            ``single_pin_nets``, ``auto_sheet_numbering``, the read-only
            ``name_nets_hierarchically`` and
            ``power_port_names_take_priority``, ``class_generation``
            (``project`` and one entry per sheet), ``changed``, ``moved_from`` / ``moved_to`` and
            ``not_applied``.
proj_push_parameterstool Copy all project-level parameters onto each loaded schematic sheet.
Copy all project-level parameters onto each loaded schematic sheet.

        Every project parameter is written as a document (sheet) parameter on
        each LOADED schematic in the focused project, so title blocks can
        reference project-wide values. Unloaded sheets are skipped -- call
        ``proj_load_sheets`` first to include every sheet.

        Returns:
            Dict with param_count, sheets_updated, sheets_skipped_not_loaded,
            and params_pushed.
proj_remove_documenttool Remove a document from a project.Filesoutside text
Remove a document from a project.

        Note: This only removes the document from the project, it doesn't delete the file.

        The project file is saved and read back. Altium's save keeps the
        old [DocumentN] sections, so a removed document would come back
        on reopen. When the file lists more than the project holds,
        Altium saves the project as a copy, the original is deleted and
        Altium saves the project back onto no file, which writes only its
        documents. No dialog. A list of items rewrites the file once.

        Args:
            document_path: Full path to the document to remove
            project_path: Optional project path. If None, uses active project.
            save_project: Write the .PrjPcb so the removal lasts (default).
                False leaves it for a later proj_save.

        Returns:
            ``removed`` (gone from the project in memory),
            ``project_saved``, ``in_project_file`` (the file on disk
            still lists it, with ``project_file_entry``) and
            ``stale_sections`` when the file was rewritten (``before``,
            ``after``, ``copy_kept`` naming the copy when the rewrite
            could not finish). ``success`` is true only
            when the file no longer lists it.
proj_remove_parametertool Remove a project-level parameter and write the project file
Remove a project-level parameter and write the project file
        (only that file).

        Args:
            name: Parameter name (exact).
            project_path: The .PrjPcb. Defaults to the focused project.

        Returns:
            ``removed`` (read back), ``parameters_before`` /
            ``parameters_after`` and ``project_file_saved``. A name the
            project does not have is refused (NOT_FOUND).
proj_rename_documenttool Rename a project document, keeping the project and its sheet
Rename a project document, keeping the project and its sheet
        symbols pointing at it.

        Altium saves the document under the new name in the same folder
        (its Save As, unsaved edits included), the project entry follows
        it, every sheet symbol in the project whose file name names the
        old file is changed to the new one, and the project is saved and
        compiled. The old file is left on disk. Refused when the new
        name exists, changes the extension, or the document is in no
        open project.

        Args:
            document_path: Full path of the document.
            new_name: The new file name (extension optional, same kind).
            project_path: The project; defaults to the one holding it.

        Returns:
            ``old_path``, ``new_path``, ``project_path``, ``in_project``,
            ``old_entry_left``, ``entry_moved_last`` (Altium did not move
            the entry, so it was added again at the end),
            ``sheet_symbols`` changed (sheet and new file name),
            ``sheet_symbols_not_changed``, ``project_saved``; ``success``
            when the project lists only the new name and every symbol
            took the change.
proj_rename_varianttool Rename a project variant.
Rename a project variant.

        Altium saves a variant's description and shows it as the name, so
        the new name is written there (and to the in-memory name). A name
        another variant already has is refused. The name is read back.

        Args:
            variant: The variant's current name or description.
            new_name: Its new name.
            project_path: The .PrjPcb. Defaults to the focused project.

        Save the project (proj_save) to keep the change.

        Returns:
            ``name_before``, ``name``, ``was_active`` and ``applied``.
proj_replace_componenttool Replace a part on the active sheet with another library part.
Replace a part on the active sheet with another library part.

        With ``library_path`` (a .SchLib) the symbol itself is swapped: the
        new symbol goes where the old one is, every pin's connection point
        is compared, and only then is the old part removed. The designator
        and UniqueId carry over, so the board keeps its link. A pin that
        would move or disappear refuses the swap with nothing changed
        (``PIN_MISMATCH``), unless ``allow_pin_changes``.

        Without ``library_path`` only the library link changes
        (LibReference, DesignItemId, library name); the symbol, pins and
        graphics on the sheet stay the old part's, and the reply says
        ``symbol_replaced: false``.

        Args:
            designator: Component designator to replace (e.g., "U1", "R3")
            new_lib_ref: New library reference / component name
            new_library: New source library name for the relink (optional,
                keeps current if empty)
            library_path: .SchLib holding ``new_lib_ref``; swaps the symbol.
            allow_pin_changes: Swap even when pins move or disappear; the
                wires on those pins are then left unconnected.

        Returns:
            ``symbol_replaced``. After a swap: ``pins_kept``,
            ``pins_missing``, ``pins_moved``, ``pins_added``,
            ``parameters_not_on_new_symbol`` (old parameters the new
            symbol lacks, not copied) and ``unique_id_kept``.
proj_run_erctool Run Electrical Rules Check on the focused project.
Run Electrical Rules Check on the focused project.

        Compiles the project first (required), runs ERC, and returns
        what it found, the same list ``proj_get_erc_violations`` reads:
        what Altium reports. A violation a No ERC marker covers, or of a
        type set to No Report, is left out and counted in
        ``suppressed_count`` / ``not_reported_count``.

        Args:
            limit: How many violations to return; 0 returns all of them.
            include_suppressed: list those too, each with ``suppressed``
                and ``level``.

        Returns:
            ``violation_count`` and ``violations``: each with its kind,
            document, detail and the related objects, whose cross-probe
            string names the exact pin or net. ``truncated`` is true when
            the list stops short of ``violation_count``; read the rest
            with ``proj_get_erc_violations(offset=next_offset)``.
proj_run_outjobtool Execute a specific output container from an OutJob file.Filesoutside text
Execute a specific output container from an OutJob file.

        Containers are listed by `proj_list_outjob_containers`; both
        generated-file and publish (PDF) containers run.

        SUCCESS MEANS A FILE WAS WRITTEN under ``output_dir`` after the
        run started; a container bound to a managed release or with its
        outputs off runs cleanly and writes nothing. Output written
        elsewhere reads as ``success: false``, and ``reason`` says what
        was examined.

        The OutJob is opened if needed and made the ACTIVE document
        first: Altium writes nothing for a container whose OutJob is
        not active. A dialog Altium raises during the run (an error
        after the files are out, say) comes back as ``dialog`` with the
        files found so far, not as a bare failure; close it before the
        next call. An error Altium raises without a dialog comes back as
        ``run_raised`` with the files found. OutJobs an earlier run
        opened are closed first, unless they have unsaved changes.

        Args:
            container_name: Name of the output container to execute
            outjob_path: Path to the .OutJob file. If omitted, uses the
                         first OutJob found in the focused project.
            fresh_window_seconds: files modified up to this many seconds
                before the run started still count as written, for file
                systems with coarse timestamps. Default 5s.
            fab, fab_tier, outer_oz: the fab the files go to
                (design_list_fab_vendors), its tier and the finished outer
                copper in oz. A container writing Gerber, NC drill, ODB++
                or IPC-2581 is not run until the board is inside that
                fab's published limits (``fab_check``).
            fab_limits: with fab "custom", the user's own figures in mils
                (min_track, min_gap, min_drill, min_annular_ring,
                min_hole_to_hole, min_mask_sliver, copper_to_edge;
                copper_layer_counts a list), for a fab with no data here.

        Returns:
            ``success``, ``container_name``, ``container_type``,
            ``output_dir``, ``output_dir_exists``, ``files_written`` (a
            count), ``written`` (up to 50 paths), ``fab_check``, and
            ``reason`` when nothing was written.
proj_run_outjob_alltool Run every container in an OutJob and report what each produced.Filesoutside text
Run every container in an OutJob and report what each produced.

        Each container runs through ``proj_run_outjob`` in order, and its
        ``output_dir`` files written since it started are flagged
        ``newly_produced``.

        Args:
            outjob_path: Path to the .OutJob. Omit to use the first one
                in the focused project.
            include_files: List each container's files (default True).
            fresh_window_seconds: Files modified up to this long before a
                container started still count as new. Default 5 s.
            fab, fab_tier, outer_oz: as proj_run_outjob; nothing runs
                when a container writes fab files and the board is
                outside the fab's limits.

        Returns:
            Dict with ``ok``, ``outjob_path``, ``containers_run``
            (list of container names), ``results`` (per-container
            dicts each with ``container``, ``container_type``,
            ``output_dir``, ``ok``, ``files``).
proj_run_outputtool Generate manufacturing output files from the active PCB.
Generate manufacturing output files from the active PCB.

        Note: These may open Altium's export dialogs for configuration.

        Args:
            output_type: Type of output, "gerber", "drill", "pick_place", "ipc_netlist"
            output_path: Optional output directory/file path

        Returns:
            Dictionary confirming generation
proj_savetool Save the current or specified project.
Save the current or specified project.

        Args:
            project_path: Optional path to specific project. If None, saves active project.

        Returns:
            Dictionary confirming save operation
proj_set_active_varianttool Switch the active project variant, or back to the base design.
Switch the active project variant, or back to the base design.

        Args:
            variant_name: The variant's name or description, or
                "[No Variations]" for the base design.
            project_path: Optional project path. If None, uses active project.

        Returns:
            ``success``, ``variant_name`` (the variant now current) and
            ``verified``, read back from the project; ``success`` false
            with ``current_variant`` and a ``reason`` otherwise.
proj_set_component_variationtool Set one part's entry in a project variant: fitted, not fitted,
Set one part's entry in a project variant: fitted, not fitted,
        an alternate part, or no entry at all.

        Adds the variation when the part has none in that variant, changes
        it when it has one, and with ``kind="remove"`` deletes it, varied
        parameter values included, so the part follows the base design
        again. Parameter values: ``proj_set_parameter_variation``. The part is found by its
        designator in the compiled project; the entry is read back.

        Args:
            variant: The variant's name or description.
            designator: The part, e.g. "R12".
            kind: "fitted", "not_fitted", "alternate" or "remove".
            alternate_part: For ``alternate``: the alternate part's name,
                which Altium keeps as the part's varied Comment.
            project_path: The .PrjPcb. Defaults to the focused project.
            alternate_library: For ``alternate``: the library the
                alternate comes from, e.g. "Miscellaneous Devices.IntLib".
                Without it Altium saves the entry but loads it back as
                fitted when the project is reopened.
            alternate_lib_ref: The alternate's symbol in that library;
                defaults to ``alternate_part``.
            alternate_footprint: The alternate's footprint when it differs
                from the base part's.

        Save the project (proj_save) to keep the change.

        Returns:
            ``before`` and ``after`` (the entry's kind, or "none"),
            ``alternate_part``, ``alternate_link``, ``unique_id`` and
            ``applied``.
proj_set_document_parametertool Set a document-level parameter on a specific schematic sheet.
Set a document-level parameter on a specific schematic sheet.

        Useful for per-sheet title block data (e.g., "SheetTitle", "Revision").
        If the parameter already exists it is updated; otherwise a new hidden
        parameter object is created on the sheet. Of two with one name the
        first is updated; sch_sheet_parameters picks one by index, adds
        sheet rules and removes parameters.

        The sheet must be loaded (`proj_load_sheets`), else NOT_LOADED.
        The sheet is marked modified, not written: `app_save_all` or
        `proj_save` writes it.

        Args:
            file_path: Full path to the schematic document (.SchDoc).
                Use Windows-style backslashes (e.g. C:\\path\\Sheet.SchDoc),
                not forward slashes.
            name: Parameter name
            value: Parameter value

        Returns:
            Dictionary with file_path, name, value, action (added /
            updated), saved=false and pending_save=true.
proj_set_erc_levelstool Set ERC report levels (Project Options > Error Reporting).
Set ERC report levels (Project Options > Error Reporting).

        A project's policy, not a way to a clean ERC. Before turning a
        check off because it reports something that is not there, rule out
        a stale compile (proj_force_recompile): a resized or redrawn sheet
        can report "Off sheet" or duplicates that are gone.

        Args:
            levels: {violation type: level}. A type is its exact description
                as proj_get_erc_levels lists it ("Nets with multiple names")
                or its kind number; a level is no_report, warning, error or
                fatal. Example: {"Nets with no driving source": "no_report"}.
            project_path: the .PrjPcb; default the focused project.
            save: save the project file afterwards so the setting persists.

        Returns:
            ``set``, ``failed`` and per item ``results`` with the level read
            back (``problem`` when it did not take), and ``saved``.
proj_set_parametertool Set a project-level parameter, new or existing, and write the
Set a project-level parameter, new or existing, and write the
        project file (only that file).

        Args:
            name: Parameter name
            value: Parameter value
            project_path: Optional project path. If None, uses active project.

        Returns:
            Dictionary confirming the operation
proj_set_parameter_variationtool Set or clear the parameter values one part takes in a variant,
Set or clear the parameter values one part takes in a variant,
        e.g. R5's Value 4k7 in variant "Lite" while the base design has 10k.

        A value of None clears that parameter's variation, so the part
        takes the base value again. A part with no entry in the variant
        gets a fitted one to hold the values; a not-fitted part is
        refused. Every value is read back. ``proj_get_bom`` with
        ``variant`` applies them. Altium keeps an alternate part's name
        as its varied Comment, so changing Comment on an alternate
        renames the alternate.

        Args:
            variant: The variant's name or description.
            designator: The part, e.g. "R5".
            parameters: Parameter name to value, e.g. {"Value": "4k7",
                "Comment": "4k7"}; None clears it.
            project_path: The .PrjPcb. Defaults to the focused project.

        Save the project (proj_save) to keep the change.

        Returns:
            ``parameters`` (the part's varied values afterwards),
            ``entry_created``, ``not_on_part`` (names the part does not
            carry, written anyway), ``not_applied`` and ``applied``.
proj_step_export_optionstool Read, or change, the settings Altium's STEP exporter keeps.
Read, or change, the settings Altium's STEP exporter keeps.

        These are the settings File > Export > STEP 3D last used, kept
        between exports: export the folded rigid-flex board, copper,
        holes, how 3D models and parts are written, and the part name
        suffix. ``proj_export_step`` uses whatever is set here. Nothing
        is exported by this call.

        Args:
            options: Settings to write, by name: ``folded`` (bool),
                ``fold_rate`` (int), ``component_option``,
                ``models_option``, ``holes_option``, ``copper_option``
                (Altium's codes, read them first), ``mechanical_pad_holes``,
                ``electrical_pad_holes``, ``free_pad_holes``,
                ``barrels_only``, ``cover_layer`` (bool),
                ``component_suffix_type`` (int), ``component_suffix``
                (text). Omit to read only.

        Returns:
            Every setting as it now reads, ``not_taken`` (names that did
            not take) and ``read_errors``.
proj_sync_pcbtool Push schematic changes to the PCB (Design > Update PCB Document).Filesoutside text
Push schematic changes to the PCB (Design > Update PCB Document).

        With Dialogs Automatic (Config tab) the tool executes and closes
        the change order (``change_order``); otherwise it waits for the
        user and blocks the bridge (``app_list_open_dialogs`` reads it).
        Focuses the PCB first (WRONG_FOCUS if it cannot).

        Returns:
            success, pcb_path, mapping counts, components added, removed
            and in sync, ``change_order``, and ``after_sync``:
            ``footprint_mismatch``, ``missing_on_board``,
            ``diff_pairs_removed`` (board-only pairs),
            ``pad_nets`` (pads ``unbound`` or ``mismatched``).
            ``change_order.failed_lines``: failed lines read by OCR (0/O,
            1/l slips); a mismatch it explains carries ``eco_line``
            and, for Footprint Not Found, ``footprint_source``: each
            library and ``found_at`` ('' if none).
proj_sync_schematictool Push PCB changes back to schematic (back-annotate ECO).Filesoutside text
Push PCB changes back to schematic (back-annotate ECO).

        Design > Update Schematic, compiled before and after. A change
        order it opens is answered as in proj_sync_pcb.

        Returns:
            success, pcb_path, mapping counts, components added and
            removed, in_sync, ``change_order``.
proj_update_from_librariestool Update the project's parts from their libraries: Tools > UpdateFilesoutside text
Update the project's parts from their libraries: Tools > Update
        From Libraries (symbols, parameters, models) or Update From PCB
        Libraries (the board's footprints). Run as Altium's own process,
        so neither the menu nor the focus is touched.

        With Dialogs Automatic (Config tab) every dialog is answered: the
        wizard finishes with its options as set, a count of footprints no
        library has is answered Yes (its sentence kept in
        ``change_order.passed``), and the change order is executed, its
        failed lines read, and closed. With Manual the wizard is left to
        you and the bridge waits until it closes.

        Args:
            target: "schematic" or "pcb".
            document_path: a sheet (schematic) or the board (pcb) of the
                project, focused first. Default: the document in front.

        Returns:
            ``document``, ``updated`` (a change order was executed) and
            ``change_order``: ``done``, ``passed`` and ``failed_lines``.
review_designtool EDA-agnostic design review of the open board.Env vars
EDA-agnostic design review of the open board.

        Runs the same netlist-level review regardless of the active EDA
        (Altium or KiCad): board stats and net classes, annotation hygiene
        (unannotated, duplicate references, missing values), and connectivity
        (single-pin nets, shorted pins/components, unconnected parts and pads,
        missing decoupling). ``backend`` ("altium" | "kicad") targets one tool
        when the server runs in "both" mode; omit it to use the active backend.

        Geometric DRC (clearances, courtyards) is separate and backend-specific.
route_plantool Route a board given as a geometry dict and return the copper to
Route a board given as a geometry dict and return the copper to
        place, checked by the exact DRC. Nothing is drawn.

        The same router as pcb_autoroute: each connection shortest first,
        committed before the next, turns and vias priced, pads entered on
        their centre, every route checked against the exact copper.
        ``tracks`` come in the pcb_place_tracks shape and ``vias`` in the
        pcb_place_vias shape, mils to a thousandth. A net that fails is reported
        with the connections it leaves unmade. On a live Altium board
        pcb_autoroute reads the board itself and takes the brief.

        Args:
            geometry: pads (x, y, x_size, y_size, rotation, shape, layer,
                net, hole_size), tracks, vias, regions, outline or bbox,
                in mils. Copper already there stays as it is.
            rules: clearance_mils, track_width_mils (a number, or a dict of
                net class to width with "default"), via_size_mils,
                via_drill_mils, layers (top first; default TopLayer and
                BottomLayer).
            nets: Route only these (unknown ones in ``unknown_nets``).
            net_classes: net -> class, for the per-class widths.
            fetch_geometry: Read the live board when geometry is None.

        Returns:
            {"ok", "summary" (connections, made, completion, routed,
            failed, tracks, vias, length), "nets" {net: {status,
            unmade}}, "tracks", "vias", "validation" (violation_count,
            violations), "geometry" (source "live" or "caller", bbox,
            counts)}. A caller-supplied geometry is only as fresh as its
            snapshot: read it again after placing anything.
route_plan_repairstool Turn a DRC violation payload into an ordered repair plan.
Turn a DRC violation payload into an ordered repair plan.

        Pure Python. Apply the actions in order, then run
        ``pcb_run_drc`` and plan again:
          ``rip_and_reroute`` {net}: ``pcb_delete_net``, then route it
            again (``route_plan`` with ``nets``); worst offender first.
          ``nudge`` {net, dx, dy, x_mils, y_mils}: ``obj_modify`` on the
            primitive nearest (x_mils, y_mils).
          ``widen`` / ``narrow`` {net}: ``pcb_set_track_width``.
          ``escalate`` {reason}: stop and report it.
        Coordinates and deltas are integer mils.

        Args:
            violations: ``pcb_run_drc`` result ``{violation_count,
                violations}`` or a bare list of violation dicts.
            max_rounds: Rip budget for the clearance worst-offender
                loop, integer >= 0 (0 = escalate-only for clearance).

        Returns:
            ``{"ok": True, "actions": [...], "rounds_used": n,
            "ripped_nets": [...], "counts": {bucket: n}}``;
            ``{"ok": False, "reason": ...}`` on malformed input.
run_drctool Run geometric design-rule check (DRC) on the open board.Env vars
Run geometric design-rule check (DRC) on the open board.

        Dispatches to the active backend: Altium runs its native DRC; KiCad
        runs ``kicad-cli pcb drc`` (KiCad's own CLI) on the board file on disk,
        so save pending edits first for current results. Returns violation
        counts and a normalized list. ``backend`` targets one tool in "both"
        mode.
run_erctool Run the schematic Electrical Rules Check (ERC) on the open design.Env vars
Run the schematic Electrical Rules Check (ERC) on the open design.

        Dispatches to the active backend: Altium runs its native ERC; KiCad runs
        ``kicad-cli sch erc`` on the schematic file on disk (save pending edits
        first). Returns violation counts and a normalized list. ``backend``
        targets one tool in "both" mode.
sch_add_datafile_linktool Attach a datafile link to a component's current implementation.
Attach a datafile link to a component's current implementation.

        E.g. an IBIS or simulation model file.

        Args:
            designator: Component reference (e.g., "U1").
            file_path: Full path to the file being linked.
            kind: Optional implementation-specific type
                (e.g., "SimModel", "IBIS").

        Returns:
            Dict with success, designator, file_path.
sch_add_directivetool Place a directive ON a wire of the active schematic; its
Place a directive ON a wire of the active schematic; its
        parameters (e.g. NetClass=PWR) go to that net. For an area, use
        sch_place_blanket.

        Args:
            x, y: Location in mils.
            param_name, param_value: One parameter.
            parameters: Several, e.g. {"NetClass": "PWR", "Width": "20"}.
            style: Altium's Style integer.
            orientation: Quarter turns, 0 to 3.
            parameter_list: Instead of parameters: [{"name", "value",
                "hidden"}, ...] in order; names may repeat, values may
                hold '=' and '|'. {"rule": {"RULEKIND": "Length", ...}}
                instead of a value makes a Rule parameter.
            name: The directive's own name (default: its first parameter's).

        Returns:
            The ``directive`` read back, each parameter with ``hidden``.
sch_audit_outside_sheettool Find anything drawn outside the active schematic's sheet, andFilesoutside text
Find anything drawn outside the active schematic's sheet, and
        with ``apply`` bring it back inside.

        Reads the sheet's REAL frame from Altium (an A3 frame is 15500 x
        11100 mils, not A3 paper), every object's bounding box, and the
        template's own graphics, which become the title-block keep-out
        rather than objects. Reports what is past the border or over the
        title block, then a verdict:
        - ``fits``: nothing outside.
        - ``shift``: the drawing fits once moved by ``dx``, ``dy``.
        - ``enlarge``: it does not fit; ``to_size`` is the first larger
          sheet of the SAME family (A4 -> A3, ANSI A -> B) that holds it.
        - ``too_big``: nothing in the family holds it.
        A shift is whole 100 mil steps, so everything stays on the grid.

        ``apply`` (default False, which changes nothing) fixes it the
        preferred way first: a ``shift`` moves EVERY object on the sheet
        by dx, dy, wires and labels with the parts, so no connection
        changes. An ``enlarge`` on a sheet without a template sets the
        larger sheet size, then shifts if that is still needed. A sheet
        drawn from a template is not enlarged here: ``to_template`` names
        the same-family template to move it to. ``actions`` lists what was
        done and the reply is the audit after it.
sch_autoposition_labelstool Put part designators and comments, and sheet-symbol names and file
Put part designators and comments, and sheet-symbol names and file
        names, back where Altium positions them, on the active schematic.

        For labels left at the sheet origin (the bottom-left corner) or
        anywhere odd after a scripted placement. Each label's auto-position
        is turned back on and Altium is made to position it, as rotating a
        part and rotating it back does by hand. A label moved on purpose
        (obj_modify Designator.Location.X) loses that position.

        Args:
            names: Designators and sheet names to fix; none means every
                part and sheet symbol on the sheet.
            method: What makes Altium reposition: "rotate" (90 degrees and
                back), "move" (one grid step and back) or "modify" (an
                edit with no change).

        Returns:
            ``count`` and per object ``name``, ``kind``, ``location`` and
            every label ``before`` and ``after`` (x, y in mils and
            autoposition).
sch_clear_source_librarytool Unpin placed schematic components from a stale source library.
Unpin placed schematic components from a stale source library.

        After a library is renamed or moved, placed parts still point at it
        (``SourceLibraryName``, ``DesignItemId``) and show ``<Not Found>``.
        This clears the first and sets the second to LibReference, so
        Altium re-matches from the Available Libraries. DesignItemId is a
        property, not a parameter (for one part: ``obj_modify``).

        Args:
            sheet_path: absolute .SchDoc path; empty = the focused
                sheet. For a whole project, call once per sheet (see
                proj_list_documents).
            designators: restrict to these designators (whole-string,
                case-sensitive); None/empty = every component on the
                sheet.
            clear_source_library: clear ``SourceLibraryName``.
            sync_design_item_id: set ``DesignItemId`` = LibReference
                where they differ.

        Returns:
            {"total": inspected, "cleared_source_library": n,
             "synced_design_item_id": n}.
sch_draw_templatetool Draw a schematic sheet from a hand template: THE way to drawFilesoutside text
Draw a schematic sheet from a hand template: THE way to draw
        or redraw a block. Same template as sch_preview_template; run that
        first and look at the PNG.

        Order: the template is checked against the library symbols, the
        parts are placed, their pins are read back off the sheet, the
        wiring is checked again against those real pins (and every other
        part already on the sheet), and only then are the wires, power
        ports, net labels and values (the Comment) drawn. Any error stops
        it before the first wire. A designator already on the sheet is
        refused: redraw on a fresh sheet rather than patching. Does not
        save.

        A multi-part symbol is placed one part per entry (``"part"``), each
        set to its part and read back; a part the symbol does not have
        stops the call before any wire.

        Args:
            template: parts, wires, ports, labels and optional nets.
            document_path: the .SchDoc to draw on (it is focused first).
            png_path: where to write a picture of what was drawn.
            grid: grid in mils for the off-grid check.
            plan_json: the DesignPlan, as for sch_preview_template. Its
                Value, Manufacturer, Manufacturer Part Number and
                Footprint are stamped on every drawn part.
            sheet: the plan sheet this template draws.
            template_path: a JSON file holding the template, instead of
                passing it inline.

        Returns:
            The same report as sch_preview_template, plus ``placed``,
            ``wires``, ``ports``, ``labels``, ``values`` counts and
            ``stage`` (where it stopped, or "done").
sch_editor_optionstool Read, or set, the schematic editor's preferences.
Read, or set, the schematic editor's preferences.

        These are Altium's own preferences and apply to every sheet. Call
        with nothing to read; every option set is read back.

        Args:
            snap_to_electrical_grid: Pull wire ends onto pins and wires.
            electrical_grid_distance: How far they are pulled (Altium's
                number).
            drag_orthogonal: Wires stay at right angles when dragging.
            components_cut_wires: A part dropped on a wire cuts it.
            optimize_wires: Join and trim overlapping wires.
            single_slash_negation: One leading backslash bars the
                whole name.
            convert_special_strings: Show special strings as values.
            mark_manual_parameters: Mark parameters moved by hand.
            show_pin_direction: Draw each pin's direction arrow.
            auto_zoom: Zoom to a part found by a cross-probe.
            click_clears_selection: A click on empty space clears it.
            double_click_runs_inspector: Double-click opens the
                Inspector.
            undo_levels: How many steps undo keeps.
            pin_name_margin: Gap between the body edge and a pin name,
                in mils.
            pin_number_margin: Gap from the body edge to a pin number,
                in mils.
            multi_part_naming: How multi-part designators are written
                (Altium's number: U1A, U1:1 ...).
            increment_primary: The step for repeated placement, e.g. "1".
            increment_secondary: The second step, e.g. "1".
            power_ground_name: Net name of a new power ground port.
            signal_ground_name: Net name of a new signal ground port.
            earth_name: Net name of a new earth port.
            expand_designators / expand_net_labels / expand_ports /
                expand_sheet_number / expand_document_number: In a
                multi-channel design, show these as they are on each
                channel rather than as drawn.
            watermark_read_only_sheets: Mark sheets that cannot be
                edited.
            always_drag: Moving a part drags its wires along.
            use_printer_fonts: Draw text with the printer's fonts.
            default_template: The template file new sheets start from.
            increment_drops_leading_zero: Repeated placement drops a
                leading zero (R09 is followed by R10, not R010).
            ctrl_double_click_goes_down: Ctrl + double-click on a sheet
                symbol opens the sheet below.
            confirm_selection_memory_clear: Ask before a selection
                memory is cleared.
            allow_device_sheet_editing: Device sheets may be edited.
            watermark_device_sheets: Mark device sheets.
            cutter_grid_multiple: The wire cutter's length in snap grids.
            cutter_fixed_length: The wire cutter's fixed length, in mils.
            physical_view_dim_level: How far the physical view dims what
                is not in focus (Altium's number).

        Returns:
            ``options`` (each option by these names), ``changed``,
            ``not_applied``, ``refused`` and ``unknown``.
sch_generate_toctool Place a table-of-contents note listing every schematic sheet.
Place a table-of-contents note listing every schematic sheet.

        Reads the project's document list, keeps the .SchDoc sheets in
        project order, and drops a numbered text frame on the active sheet.
        Run it on a dedicated cover/index sheet. Re-running does not remove a
        prior frame, delete the old one first if you regenerate.

        Args:
            x1, y1, x2, y2: Frame corners in mils (default a tall left box).
            title: Heading line above the list.
            project_path: Optional project; uses active if omitted.

        Returns:
            Dict with sheet_count and the placement result, or an error if
            no schematic sheets were found.
sch_get_active_nettool Read the compiled net of the net label, port, power port or wire selected on a sheet.
Read the compiled net of the net label, port, power port or wire selected on a sheet.

        The first selected object of those four kinds is looked up in the
        compiled netlist of the sheet's project, so a wire answers with
        its net too. Nothing is written.

        Args:
            document_path: The open .SchDoc. Empty reads the sheet in front.
            route: "auto" (default), "getnet" (one lookup by handle; no
                net labels) or "lines" (walks the sheet's nets).
            compile: Compile the project first (skipped while unchanged).

        Returns:
            ``net`` ("<none>" when nothing is selected, "" when the
            netlist has none for it: compile first), ``kind``, ``text``,
            ``x``, ``y`` (mils), ``sheet``, ``project``, ``route`` (the
            one that answered), ``compiled``, ``found``, ``ms``.
sch_get_blanketstool List the blankets on the active schematic sheet.
List the blankets on the active schematic sheet.

        Returns:
            ``blankets``: each with ``vertices`` ("x,y;x,y;..." in mils), its
            box (x1, y1, x2, y2), ``line_style``, ``collapsed`` and the
            ``directives`` inside it or on its edge (``owner`` "blanket" or
            "sheet").
            ``coverage``: per blanket, from the last compile, the ``nets``
            and ``sheet_symbols`` it covers. ``compiled`` false: the sheet
            is not in the focused project.
sch_get_constraint_groupstool Enumerate IDocument.DM_ConstraintGroups on the active schematic.
Enumerate IDocument.DM_ConstraintGroups on the active schematic.

        FPGA-style pin and timing constraints attached to the document.

        Returns:
            Dict with groups (list of {target_kind, target_id,
            constraint_count, constraints[{kind, data}, ...]}) and count.
sch_get_directivestool Enumerate parameter-set directives on the active schematic sheet.
Enumerate parameter-set directives on the active schematic sheet.

        Each with its location and the parameters it carries, including
        the directives held inside blankets (sch_get_blankets lists the
        blankets themselves and the nets they cover).

        Returns:
            Dictionary with ``directives`` array, each entry has
            ``name``, ``x``, ``y``, ``owner`` ("sheet", or "blanket" for
            one held inside a blanket) and a ``parameters`` list of
            ``{name, value, hidden}`` objects, plus ``count`` and
            ``in_blankets``.
sch_get_harnesstool Read a harness wiring diagram (.WirDoc): every wire and what it joins.
Read a harness wiring diagram (.WirDoc): every wire and what it joins.

        Lists the harness objects by kind and name (components, pins such
        as "P1-1", splices, cables, twists, shields, wire labels,
        no-connects) and each wire with its points, its colours, what its
        two ends meet and the splices, labels, shields, twists and cables
        it belongs to. Objects Altium names only by position (twists,
        shields) get one running number in document order: "shield1",
        "twist2".

        Args:
            document_path: The open .WirDoc. Empty reads the document in
                front.
            limit: The most wires to list (default 500).

        Returns:
            ``document``, ``wire_count``, ``wires_listed``, ``truncated``,
            ``objects`` [{kind, name}] and ``wires`` [{name, points (mils),
            colours (primary, secondary, tertiary, border names and the
            same as #RRGGBB), end1, end2 ("pin:P1-1", "splice:SPL1",
            "no_connect:Nc1", empty when unconnected), splices, labels,
            shields, twists, cables}].
sch_get_sheet_parameterstool Get title block parameters (title, revision, date, etc.) from a schematic sheet.
Get title block parameters (title, revision, date, etc.) from a schematic sheet.

        Reads all parameters from the sheet without modifying anything.
        sch_sheet_parameters lists the same and adds, sets and removes
        them, sheet rules included.

        Args:
            file_path: Full path to a specific .SchDoc file. If empty, reads
                       from the active document.

        Returns:
            Dictionary with "count" and "parameters" array, each having
            "name" and "value" (and, as sch_sheet_parameters lists them,
            "index", "hidden", "system", "rule" ...)
sch_increment_designatorstool Offset the trailing number of schematic designators by a delta.
Offset the trailing number of schematic designators by a delta.

        Adds ``delta`` to the numeric suffix of every component designator
        on the active sheet (delta=100 turns R5 into R105), optionally
        only those with a prefix.

        Args:
            delta: Non-zero integer added to each designator's number.
            prefix: If set (e.g. "R"), only designators with this letter
                prefix are changed.

        Returns:
            Dict with success, modified (count), delta.
sch_mirror_componenttool Mirror a placed schematic component horizontally.
Mirror a placed schematic component horizontally.

        USE THIS RATHER THAN WRITING `IsMirrored` with obj_modify, which
        sets the flag and leaves the drawing unchanged. This reflects the
        primitives as Altium's own mirror does.

        Args:
            designator: component to mirror, e.g. "U1"
            mirrored: True or False for an absolute state; omit to
                toggle. Asking for the state it already has is a no-op,
                not a second reflection.
            doc_path: sheet to act on. Defaults to the focused schematic.

        Every primitive is reflected about the component's X; a kind it
        cannot reflect stays put and is counted in primitives_skipped.

        Returns:
            Dictionary with designator, mirrored (the resulting state),
            primitives_moved, primitives_skipped, and changed.
sch_optimize_wirestool Tidy the wires on the active sheet with Altium's own wire
Tidy the wires on the active sheet with Altium's own wire
        optimiser: wires that continue one another are joined and
        overlapping pieces trimmed. Connectivity is unchanged.

        Returns:
            ``sheet``, ``wires_before`` / ``wires_after`` and
            ``vertices_before`` / ``vertices_after``.
sch_place_blankettool Place a blanket on the active schematic: a polygon whose directive
Place a blanket on the active schematic: a polygon whose directive
        applies to every net it encloses (a net class, a differential pair,
        No ERC over an area).

        Args:
            vertices: Outline as [[x, y], ...] in mils, at least 3 points.
            parameters: The directive's parameters, e.g. {"NetClass": "PWR"}.
                Omit for a bare blanket.
            parameter_list: Instead of parameters: [{"name", "value",
                "hidden"}, ...] in order; names may repeat, values may
                hold '=' and '|'. {"rule": {"RULEKIND": "Length", ...}}
                instead of a value makes a Rule parameter.
            name: The directive's own name (default: its first parameter's).
            directive_x, directive_y: Where the directive sits, in mils.
                Default: the first vertex, on the outline, which is where
                Altium reads a blanket's directive from.
            line_style: Outline style, as Altium's integer.
            collapsed: Draw the blanket collapsed.
            color, area_color: Border and fill, Altium's BGR integers;
                omitted, the user's blanket defaults. The fill is always
                see-through: the blanket is drawn above what it encloses
                (sch_set_draw_order sends it back), and Altium keeps no
                opaque blanket fill on save.

        Reshape: obj_modify eBlanket "Vertices=x1,y1,x2,y2,...".
        Coverage: sch_get_blankets after a compile.

        Returns:
            ``vertices``, ``color``, ``area_color``, ``transparent``,
            ``line_style`` and the ``directive`` read back.
sch_place_bustool Place a bus segment between two XY coordinates on the active schematic.
Place a bus segment between two XY coordinates on the active schematic.

        Name it with a net label in bus syntax (DATA[0..7]), then add bus
        entries and wires.

        Args:
            x1: Start X coordinate in mils
            y1: Start Y coordinate in mils
            x2: End X coordinate in mils
            y2: End Y coordinate in mils

        Returns:
            Dictionary confirming bus placement with coordinates
sch_place_bus_entrytool Place a bus entry (45 degree stub) connecting a wire to a bus.
Place a bus entry (45 degree stub) connecting a wire to a bus.

        Bus entries are the angled stubs that tap a single-signal wire
        off a bus line. Start point should sit on the bus; end point
        should sit on the wire (both usually at 45 degrees offset).

        Args:
            x1, y1: Start coordinates in mils (typically on the bus)
            x2, y2: End coordinates in mils (typically on the wire)

        Returns:
            Dictionary confirming bus entry placement
sch_place_commenttool Post an Altium 365 review comment at a point on a schematic.Filesoutside text
Post an Altium 365 review comment at a point on a schematic.

        A comment is kept only on a project saved to an Altium 365
        Workspace. On a local project it is placed but stays unsaved, and
        closing the project asks "Save To Workspace" (Yes moves the
        project into the Workspace, No drops the comment). A free sheet
        offers no comment at all. There is no API for comments, so this
        drives the interface: Place > Comment, Jump To Location to the
        point, then the popup's text box and Post. It brings Altium to the
        front and leaves the view zoomed in on the point.

        Args:
            text: The comment.
            x, y: The point on the sheet, in mils.
            document: The schematic's full path. Empty uses the focused
                document, which must be a schematic.

        Returns:
            ``ok``, ``posted``, ``document``, ``x``, ``y`` and ``kept``
            (where the comment is stored); or ``ok: False`` with
            ``reason`` and, when Altium refused, ``altium`` with its
            message. The posted text is not read back: the Comments and
            Tasks panel cannot be read.
sch_place_compile_masktool Place a compile mask on the active schematic: what it encloses
Place a compile mask on the active schematic: what it encloses
        is left out of the compile, netlist and ERC.

        Args:
            x1, y1, x2, y2: Corners in mils.
            collapsed: Draw it collapsed.
sch_place_componentstool Place MANY schematic components from libraries in ONE call.
Place MANY schematic components from libraries in ONE call.

        NOT THE WAY TO DRAW A SCHEMATIC: four or more parts onto a sheet
        with two or fewer is refused. sch_draw_template draws a whole
        block from a template. Use this to add parts to an existing sheet.
        Parts land on the ACTIVE sheet unless ``document_path`` is given;
        a sheet just created is not focused, so always pass it.

        Args:
            placements: [{lib_reference (required), x, y (mils),
                library_path (empty: an open library), designator,
                rotation (0/90/180/270), footprint, part_id}]. With
                ``footprint`` naming one of the symbol's PCB models (any
                case), that model becomes current; ``part_id`` picks which
                part of a multi-part symbol goes down.
            document_path: .SchDoc to focus and place onto.
            allow_manual_layout: True places your own coordinates onto an
                empty sheet anyway; say why.
            tidy: Make each placed part match the sheet: its library
                link (a loaded part says "*", and Altium then will not
                change its Design Item ID), the parameters its models
                bring hidden, and the sheet's designator font. Listed
                per part in ``tidied``.

        Returns:
            Dict with placed, failed, total counts and footprints_chosen;
            footprint_issues lists a part whose symbol has no model of
            that name (with the models it has) or whose choice did not
            take. Such a part is placed on its library's model.
sch_place_cross_sheet_connectortool Place a cross-sheet connector (off-sheet port) on the active sheet.
Place a cross-sheet connector (off-sheet port) on the active sheet.

        Connects to the same net name on another sheet.

        Args:
            x, y: Connector location in mils.
            net: Net name the connector binds to.
            side: "left" or "right" orientation (optional).

        Returns:
            Dict with success, x, y, net.
sch_place_dblib_componenttool Place one database library (DbLib) part on a schematic sheet.
Place one database library (DbLib) part on a schematic sheet.

        Altium builds the part from the row (symbol, footprints,
        parameters and database link) and drops it at (x, y), with no
        cursor or click. The DbLib must be installed (lib_install_library)
        or in the project, or the call is refused. ``database_linked``
        says whether the placed part kept its link. For a whole sheet use
        sch_draw_template instead.

        Args:
            library_path: Full path of the .DbLib file.
            table: A table the DbLib declares.
            key: The row's key value (``key`` in a lib_dblib_search
                result).
            x, y: Location in mils.
            rotation: 0, 90, 180 or 270.
            designator: Optional designator to stamp on the part.
            sheet_path: Optional .SchDoc path; default the active sheet.
            part_id: Which part of a multi-part component to place, from
                1 (A); part 1 when left out.

        Returns:
            "placed", "library_path", "table", "key", "lib_reference",
            "database_table", "database_linked", "x", "y", "rotation",
            "part_id" (read back), "part_count", "part_id_applied",
            "designator"; "reason" PART_REFUSED when the part did not take.
sch_place_dblib_rowstool Place many database library (DbLib) rows on one sheet in ONE call.
Place many database library (DbLib) rows on one sheet in ONE call.

        Every row goes down as sch_place_dblib_component places one: the
        symbol, footprints, parameters and database link from the row, no
        cursor, then read back. Each library and table is checked once. A
        row Altium cannot build is reported with its reason and the rest
        are still placed.

        Args:
            rows: ``{"key", "x", "y"}`` each, optionally ``rotation`` (0,
                90, 180, 270), ``designator``, ``part_id`` (from 1, default 1), and
                ``table`` or ``library_path`` where it is not the call's.
            library_path: The .DbLib of rows that name none.
            table: The table of rows that name none.
            sheet_path: The .SchDoc; defaults to the active sheet.

        Returns:
            ``sheet``, ``placed``, ``refused`` and ``rows``: per row its
            ``row`` number and what sch_place_dblib_component reads back,
            or ``placed`` false with the ``reason``.
sch_place_harness_connectortool Place a harness connector on the active schematic sheet, with
Place a harness connector on the active schematic sheet, with
        its entries.

        Draw the signal harness from it with sch_place_signal_harness.
        Move a placed one with obj_modify Location.X / Location.Y on
        eHarnessConnector: its entries go with it. eHarnessEntry and
        eSignalHarness are obj_query / obj_delete types.

        Args:
            x, y: Top-left corner in mils; the body hangs below it.
            width, height: Connector rectangle size in mils.
            harness_type: Named harness type (optional).
            entries: Entry names, top to bottom (e.g. ["USB+", "USB-"]).
            entry_side: "left", "right", "top" or "bottom".
            entry_pitch: mils from the top to the first entry and between
                entries; keep the height long enough for them.

        Returns:
            Dict with success, x, y, width, height, harness_type,
            ``entries`` as read back and ``entries_placed`` (those at the
            side and distance asked).
sch_place_harness_connectorstool Put library parts on a harness wiring diagram as harness connectors.
Put library parts on a harness wiring diagram as harness connectors.

        A part placed with sch_place_components lands on a .WirDoc as a
        plain component that harness wires cannot attach to. This copies
        the part into a harness connector instead: its graphics and models
        as drawn in the library, each pin as a harness pin, its designator
        and comment where the library puts them. The reply gives each
        pin's end, the point a harness wire must start or finish on.

        Args:
            connectors: [{lib_reference, library_path (.SchLib), designator,
                x, y (mils), rotation (0, 90, 180 or 270)}].
            document_path: The open .WirDoc. Empty uses the document in
                front. Anything other than a wiring diagram is refused.

        Returns:
            ``placed``, ``failed``, ``total`` and ``connectors`` [{designator,
            lib_reference, placed, problem, pin_ends [{pin, name, x, y}]}].
sch_place_harness_wirestool Draw harness wires and splices on a harness wiring diagram.Files
Draw harness wires and splices on a harness wiring diagram.

        A wire runs through its points; start and finish it on a pin end
        (from sch_place_harness_connectors) or on a splice. Altium links a
        wire's ends to what they touch only when the diagram loads, so with
        ``connect`` the diagram is saved, closed and reopened afterwards
        and each wire's ends are read back.

        Args:
            document_path: The open .WirDoc.
            wires: [{points [[x, y], ...] (mils, two or more), name ("W1"),
                colour ("#RRGGBB"), colour_name (the wire colour code,
                e.g. "RD")}].
            splices: [{x, y, name ("SPL1")}].
            connect: Save and reopen the diagram, then read the ends back
                (default True). False leaves the ends unlinked until the
                diagram is next opened.

        Returns:
            ``placed``, ``failed``, ``total``, ``items`` [{kind, name,
            placed, problem}] and, with ``connect``, ``reload`` and
            ``connections`` [{wire, end1, end2}], an end reading
            "pin:J1-1" or "splice:SPL1", empty when it touches nothing.
sch_place_imagetool Place an image/logo on the active schematic.
Place an image/logo on the active schematic.

        Args:
            image_path: Full path to the image file (BMP, JPG, PNG, etc.)
            x: X coordinate in mils (bottom-left corner)
            y: Y coordinate in mils (bottom-left corner)
            width: Image width in mils (default 500)
            height: Image height in mils (default 500)

        Returns:
            Dictionary confirming placement with path and dimensions
sch_place_junctiontool Place a MANUAL junction at coordinates on the active schematic.
Place a MANUAL junction at coordinates on the active schematic.

        A T NEEDS NONE: Altium draws a junction itself where a wire ends
        on another. Use this only where two wires CROSS and must connect;
        a plain crossing is not a connection.

        Args:
            x: X coordinate in mils
            y: Y coordinate in mils

        Returns:
            Dictionary confirming placement with coordinates
sch_place_linetool Place a decorative line on the active schematic.
Place a decorative line on the active schematic.

        This is a graphic line, not a signal wire. Use `sch_place_wires`
        for electrical connections. Use this for hand-drawn borders,
        arrows, diagram overlays.

        Args:
            x1, y1, x2, y2: Endpoints in mils
            line_width: 1 (small), 2 (medium), 3 (large)

        Returns:
            Dictionary confirming line placement
sch_place_net_labeltool Place a net label at coordinates on the active schematic.
Place a net label at coordinates on the active schematic.

        The label takes the font most of the sheet's net labels use, and
        Altium's native net-label maroon (Color 128) always.

        Args:
            text: Net name for the label (e.g., "VCC", "GND", "SDA")
            x: X coordinate in mils
            y: Y coordinate in mils
            orientation: Label rotation (0=0deg, 1=90deg, 2=180deg, 3=270deg)

        Returns:
            Dictionary confirming placement
sch_place_no_erctool Place a No ERC marker on a pin's connection end. By default it
Place a No ERC marker on a pin's connection end. By default it
        is active and suppresses every violation, as Altium's own does.

        Args:
            x, y: Location in mils.
            symbol: Altium's Symbol integer.
            orientation: Quarter turns, 0 to 3.
            suppress_all: False suppresses only ``error_kinds`` and
                ``connection_pairs`` (Altium's strings).
            active: False places it switched off.

        Returns:
            Every option read back. ``error_kinds`` and
            ``connection_pairs`` are left out while ``suppress_all`` reads
            back true: they suppress nothing more then, and they are some
            3 KB a marker.
sch_place_notetool Place a text-box note on the active schematic.
Place a text-box note on the active schematic.


        Args:
            x1, y1, x2, y2: Note box corners in mils
            text: Note content

        Returns:
            Dictionary confirming note placement
sch_place_porttool Place a port on the active schematic for inter-sheet connectivity.
Place a port on the active schematic for inter-sheet connectivity.

        Args:
            name: Port name (maps to net name)
            x: X coordinate in mils
            y: Y coordinate in mils
            style: The port's axis: "horizontal" (also "none", "left",
                "right", "left_right") or "vertical" (also "top",
                "bottom"). Altium keeps only the axis; the arrows follow
                io_type and the end that is wired.
            io_type: I/O direction, "unspecified", "output", "input", "bidirectional"
            width: Port length in mils. Auto-size is turned off so it
                holds; 0 leaves the port sizing itself to its name.
            font_id: The port's font. 0 takes the font the sheet's ports
                already use, else its net labels' font.

        Returns:
            ``font_id``, ``width`` and ``auto_size`` read back.
sch_place_power_porttool Place a power port symbol (VCC, GND, etc.) on the active schematic.
Place a power port symbol (VCC, GND, etc.) on the active schematic.

        Args:
            text: Net name for the power port (e.g., "VCC", "GND", "+3V3")
            x: X coordinate in mils
            y: Y coordinate in mils
            style: Symbol style:
                "circle", circle symbol (default, typical for VCC)
                "arrow", arrow symbol
                "bar", bar/line symbol
                "wave", wave symbol
                "gnd_power", power ground symbol
                "gnd_signal", signal ground symbol
                "gnd_earth", earth ground symbol
                Any other name is refused rather than drawn as a circle.
            orientation: which way the glyph points from the connection
                point: 0=right, 1=up, 2=left, 3=down. Leave at -1 to let
                the bridge decide by style: the three ground glyphs point
                down, the supply glyphs (circle, arrow, bar, wave) point up.
            font_id: The net name's font. 0 takes the font the sheet's
                power ports already use, else its net labels' font.

        Returns:
            The placement, with the ``font_id`` the power port got.
sch_place_probetool Place a simulation voltage probe on the active schematic.
Place a simulation voltage probe on the active schematic.

        The probe measures the voltage of the net under it, so place it
        on a wire. It is the probe Altium's Place > Probes > Voltage
        makes: a simulation run reports and plots it, and
        sim_get_probes lists it with the node it resolved to.

        Args:
            x, y: Probe location in mils, on a wire.
            net_name: Echoed back; the net comes from the wire.
            probe_method: Echoed back.
            name: A name shown instead of the net's (ProbeCustomName).

        Returns:
            Dict with success, x, y, net_name, name, measures.
sch_place_rectangletool Place a rectangle shape on the active schematic (decorative only).
Place a rectangle shape on the active schematic (decorative only).

        Args:
            x1, y1, x2, y2: Opposite corners in mils
            solid: Fill the rectangle (default False = outline only)
            line_width: 1 (small), 2 (medium), 3 (large)

        Returns:
            Dictionary confirming rectangle placement
sch_place_sheet_entrytool Place an entry on a sheet symbol; it joins the child sheet's
Place an entry on a sheet symbol; it joins the child sheet's
        port of the same name.

        Args:
            sheet_name: The symbol's name (a repeated one by its plain name).
            entry_name: The child port's name.
            repeat: One signal per channel, named Repeat(entry_name).
            io_type: "input" | "output" | "bidirectional" | "unspecified"
            side: "left" | "right" | "top" | "bottom"
            distance_from_top: Along the side, in mils.
            font_id: 0 takes the sheet's entry font, else its net labels'.

        Returns:
            Where it was placed and ``font_id``.
sch_place_sheet_symboltool Place a sheet symbol for a child .SchDoc of the project (exact
Place a sheet symbol for a child .SchDoc of the project (exact
        file name). Add entries with sch_place_sheet_entry.

        Args:
            x1, y1, x2, y2: Corners in mils.
            sheet_file_name: e.g. "PSU.SchDoc".
            sheet_name: Default: the file name.
            repeat_first, repeat_last: Channels, e.g. 1 and 4, named
                Repeat(sheet_name,1,4).
sch_place_signal_harnesstool Draw a signal harness on the active sheet: the thick line that
Draw a signal harness on the active sheet: the thick line that
        carries a harness from a harness connector or harness port to a
        sheet entry. Its ends must meet those objects' connection points.

        Args:
            vertices: [[x, y], ...] in mils, two points or more.

        Returns:
            ``success`` (every vertex read back), ``vertices``, ``asked``.
sch_place_text_frametool Place a multi-line text frame (note block) on the active sheet.
Place a multi-line text frame (note block) on the active sheet.

        A text frame is a bordered rectangle that word-wraps a block of
        text. A newline becomes Altium's own line break; a text with no
        newline may type ``\\n`` for one instead. The style is set before
        the frame is placed, so a table of filled cells needs no search
        and restyle afterwards.

        Args:
            x1, y1, x2, y2: The two rectangle corners in mils.
            text: Frame contents.
            align: Horizontal alignment "left", "center", or "right".
            font_id: The frame's font. 0 takes the font the sheet's text
                frames already use, else its net labels' font.
            fill: "#RRGGBB" fills the frame with that colour; empty leaves
                it unfilled.
            border_color, text_color: "#RRGGBB"; empty keeps the default.
            show_border, word_wrap, clip_to_rect: None keeps the default
                (all three on).
            text_margin: Gap between border and text in mils; None keeps
                the default.
            typed_breaks: False keeps a typed ``\\n`` as text, as in the
                path ``C:\\new``.

        Returns:
            The placement: the frame's corners, the ``font_id`` it got and
            ``style`` read back off the frame (colours as "#RRGGBB").
sch_place_vault_componentstool Place MANY managed (Workspace) components in ONE call.
Place MANY managed (Workspace) components in ONE call.

        ``sch_place_components`` for Workspace parts, placed by Design
        Item ID and kept linked. The same hand-drawing rule applies (four
        or more parts onto a near-empty sheet is refused). Part numbers
        are not looked up; ``lib_get_vault_component`` checks an ID.

        Args:
            placements: dicts with "design_item_id" (required), ``x``,
                ``y`` (mils), optional ``designator``, ``rotation`` and
                ``part_id`` (which part of a multi-part component goes
                down; default 1, set before the part reaches the sheet).
            vault: The Workspace name; usually read off managed parts on
                an open sheet. If refused, ask the user, don't invent it.
            document_path: The .SchDoc to focus and place onto.
            lib_identifier_kind: Load kind, default 4 (VaultName).
            allow_manual_layout: Place onto a near-empty sheet anyway.

        Returns:
            ``placed``, ``linked`` (read back a VaultGUID and ItemGUID),
            ``failed``, ``total``, ``vault``, lib_identifier_kind,
            ``loader_callable``, ``note``, ``items`` (``part_id`` as read
            back; ``reason`` PLACED_WITHOUT_LINK, PART_REFUSED (on the
            sheet as another part), NOT_FOUND_IN_VAULT or LOAD_RAISED).
sch_place_wirestool Place MANY wire segments on the active schematic in ONE call.
Place MANY wire segments on the active schematic in ONE call.

        NOT THE WAY TO WIRE A SHEET: sch_draw_template draws a whole
        block from a template, with the pin ends worked out and the
        wiring checked. Use this for a few segments on an existing sheet.

        Args:
            wires: List of wire dicts, each with x1, y1, x2, y2 in mils.
                Fractions are kept, so a pin end on a metric grid
                (30905.45) is met exactly.

        Returns:
            Dict with placed, failed, total counts.
sch_reference_zonestool Where each part, net label, port, power port, sheet symbol and
Where each part, net label, port, power port, sheet symbol and
        off-sheet connector sits on the active sheet, as the border zone
        a printed drawing is read by ("B3"). The zone is Altium's own; a
        sheet without zones gives an empty one.

        Args:
            kinds: Any of "component", "net_label", "port", "power_port",
                "sheet_symbol", "cross_sheet"; None for all.

        Returns:
            ``sheet``, ``count`` and ``objects``: each ``kind``, ``text``
            (designator, label, port or sheet name), ``zone`` and ``x`` /
            ``y`` in mils.
sch_relink_componentstool Point placed parts at another library, without Altium's dialog.
Point placed parts at another library, without Altium's dialog.

        The kind follows ``library_path``: a .SchLib or .IntLib links the
        symbol (``lib_ref``) from that file; a .DbLib links a database row
        (``dblib_table`` and ``dblib_key``, the row's key). ``footprint``
        and ``footprint_library`` repoint the current footprint model.
        Only the link changes: the symbol drawn on the sheet stays until
        Altium updates from the library (``app_update_from_libraries``);
        ``proj_replace_component`` swaps the symbol itself.

        Checked FIRST, so nothing changes on a bad target: a SchLib/IntLib
        given by full path must contain ``lib_ref``; the DbLib key must
        pick out one row, with the whole table read (else
        ``DBLIB_KEY_NOT_UNIQUE``), and that row's symbol and footprint
        fill ``lib_ref`` and
        ``footprint`` when they are not given. Every part is read back:
        ``parts`` has each one's link ``before`` and ``after``, and a
        field that did not take is named in ``not_applied``.

        Args:
            designators: the parts to relink, e.g. ["R1", "R2"].
            library_path: target .SchLib, .IntLib or .DbLib (full path to
                verify; a bare file name is written without checking).
            lib_ref: the symbol name in that library.
            dblib_table: DbLib table.
            dblib_key: the row's key, which becomes the Design Item ID.
            footprint: footprint name for the current footprint model.
            footprint_library: .PcbLib the footprint model points at.
            sheet_path: open .SchDoc; empty = the focused sheet.
            all_sheets: every open schematic of the focused project.
            dry_run: report what would change, write nothing.
            verify: check the target before writing (default True).
sch_reload_documenttool Save, close and reopen one schematic sheet, then recompile itsFiles
Save, close and reopen one schematic sheet, then recompile its
        project, so nets and ERC are compiled from the sheet as it is.

        A recompile alone can keep what the sheet no longer holds: a
        deleted net label still naming its net, a changed sub-part still
        compiled as the old one. A harness wiring diagram links its wires
        to pins and splices only when it loads, so it takes the same step.

        Args:
            file_path: The open .SchDoc or .WirDoc.
            save: Write it first; ``saved`` is measured on disk. False
                closes without writing, and a sheet Altium reads as
                modified is refused untouched; an edit Altium did not flag
                is lost.

        Returns:
            ``file_path``, ``saved``, ``closed``, ``reopened`` and
            ``recompile`` (its compile ticks); ``ok`` false with ``stage``
            and ``reason`` at the first step that did not take, the sheet
            left open when it fails before the close.
sch_rename_designatorstool Rename designators across a whole project, swaps included, refusing
Rename designators across a whole project, swaps included, refusing
        any collision before the first write.

        Each rename names a part by its current ``designator`` (with
        ``sheet``, a file name or full path, when copies of a sheet share
        it) or by the ``unique_id`` of any of its parts (obj_query
        ``UniqueId``), and gives ``to``. A part is its sub-parts on one
        sheet with one designator and library reference, so a multi-part
        part is renamed whole. Every sheet is loaded and every part read
        first: a name the batch hands out that another part keeps, a part
        named twice, or one not found refuses the whole batch with nothing
        written. The parts then go through unique temporary names before
        their final ones, so R1 to R2 and R2 to R1 works, and the project
        is read back after each step. Nothing is saved (app_save_all).
        To renumber a whole design, proj_annotate stays the tool.

        Args:
            project_path: The .PrjPcb, a full path.
            changes: ``[{"designator": "R1", "to": "R2"}, ...]``, with
                ``sheet`` when needed, or ``unique_id`` in place of
                ``designator``.
            dry_run: Check and plan only.

        Returns:
            ``ok``, ``changes`` (``sheet``, ``from``, ``to``, ``parts``),
            ``sheets``, ``components``, ``duplicates_left`` (designators
            parts the batch does not touch still share, as on copied sheets
            not annotated yet); when written, ``verified`` and per step
            ``temporary`` and ``final`` with what was read back. A step
            that did not read back as planned stops with ``stage`` and
            ``now`` (each changed part's designators as the project holds
            them), so nothing is left unreported.
sch_render_svgtool Render the active SchDoc to an SVG file.Files
Render the active SchDoc to an SVG file.

        For a picture of layout and readability. Never judge
        connectivity, values or pin functions from it: use
        ``proj_get_nets``, ``proj_get_connectivity_many`` or
        ``design_review_snapshot``.

        Draws components as labelled boxes with pin stubs (not the symbol
        art), wires, junctions, labels, ports and power ports, each group
        carrying ``data-designator``, ``data-net`` and ``data-pin``.

        Args:
            output_path: SVG path; default the workspace renders folder.
            margin_mils: Padding around the drawing (default 200).
            flip_y: Flip Y to Altium's bottom-left origin (default True).

        Returns:
            ``ok``, ``svg_path``, ``doc``, ``counts``, ``bytes``.
sch_replicate_componenttool Copy a placed schematic part and share the master's UniqueId.
Copy a placed schematic part and share the master's UniqueId.

        The gates of a multi-part device are one package only when they
        share UniqueId; the copy keeps the source's (written before it is
        placed, the only way it sticks). Optionally switches the part id
        and moves it.

        Args:
            designator: Source instance to copy (e.g. "U8").
            part_id: 1-based CurrentPartID for the copy. 0 = keep source.
            x, y: Placement in mils. Omit both to leave the replica
                where Replicate dropped it.
            new_designator: Designator for the copy. Empty keeps the
                source designator (required for multi-part packing).

        Returns:
            Dict with success, source/copy UniqueIds, part_id, and
            ``shared`` (true when the copy kept the master's UniqueId).
sch_set_component_part_idtool Switch the active sub-part on a multi-part schematic component.
Switch the active sub-part on a multi-part schematic component.

        Sets which gate (U1A, U1B, ...) a symbol shows; IDs are 1-based.
        Every gate of a device shares the designator (and unique id), so
        when it names several symbols, pass the location of the one you
        mean: without it the call refuses and lists the candidates with
        their locations and part ids.

        Args:
            designator: Component reference (e.g., "U1").
            part_id: Sub-part index, 1-based (1=A, 2=B, ...). A value
                above PartCount is accepted by Altium and does not take,
                so the result is read back and a mismatch is reported.
            location_x: Symbol X in mils, to choose one of several.
            location_y: Symbol Y in mils, to choose one of several.

        Returns:
            Dict with success, designator, part_id, the location written,
            ``changed`` (always 1, the one symbol written) and
            ``same_designator`` (how many carry it). On ambiguity,
            an AMBIGUOUS_DESIGNATOR error carrying `candidates`.
sch_set_component_unique_idtool Set UniqueId on every placed symbol with this designator.
Set UniqueId on every placed symbol with this designator.

        The gates of a multi-part device are one package only when they
        share UniqueId. Every matching symbol is stamped and read back;
        if any kept its old id the call fails and names it.

        Args:
            designator: Component reference as drawn (e.g. "U_COMP2B").
            unique_id: Target UniqueId, usually copied from the A unit.

        Returns:
            Dict with success, designator, unique_id, symbols_written,
            symbols_found, and per-symbol locations with the id each
            reads back.
sch_set_components_parameterstool Bulk-update parameters on placed schematic components, in one
Bulk-update parameters on placed schematic components, in one
        call and one undo group. The follow-up to the parameter audits.

        Args:
            stamps: One dict per component: ``designator`` plus any
                parameter key/values, e.g. ``{"designator": "R1",
                "Value": "10k", "MPN": "..."}``. A parameter the part
                lacks is created, hidden, at the part. ``Value`` writes
                the part's Comment and also a Value parameter the part
                already has; ``Description`` writes the part's own
                description (as a parameter Altium dropped it on reload).
            sheet_path: Optional SchDoc path; default the focused one.

        Returns:
            ``{updated, failed, total}``; ``failed`` counts stamps that
            could not be applied (designator not found and the like).
            A ``Footprint`` key repoints the part's footprint model;
            ``footprints_applied`` counts the ones that read back the
            new name and ``footprints_not_applied`` lists designators
            whose part has no footprint model or did not take it.
sch_set_draw_ordertool Bring matching objects on the active sheet to the front, or send
Bring matching objects on the active sheet to the front, or send
        them to the back. A sheet draws its objects in the order they were
        placed, so a new rectangle, image or blanket hides what is under it.

        Args:
            object_type: Schematic object type (see `obj_query`), e.g.
                "eBlanket". Only objects placed on the sheet itself have
                a draw order; pins, sheet entries and a part's parameters
                go with their owner.
            filter: Pipe-separated property=value conditions (AND logic),
                as `obj_query`. Empty = every object of the type.
            to: "front" (drawn over everything else) or "back" (drawn
                under everything else).

        Not undoable with Ctrl+Z; set it again to change it. Kept on save.

        Returns:
            ``matched``, ``moved``, ``objects_on_sheet`` and ``verified``
            (the matches read back at the front or back of the sheet).
sch_set_net_tietool Mark a placed schematic component as a net tie.
Mark a placed schematic component as a net tie.

        Joins the nets on its pins while keeping them separate nets, so
        ERC and DRC accept the join. Sets the part's ComponentKind.

        Args:
            designator: Component to convert (e.g. "NT1").
            mode: "nobom" (default, hidden from BOM, kept through sync) or
                "bom" (appears in the BOM).

        Returns:
            {"designator", "component_kind"} or NOT_FOUND.
sch_set_sheet_optionstool Read, or set, the active sheet's reference zones and where they
Read, or set, the active sheet's reference zones and where they
        are counted from, margin, border style, template graphics, title
        block, border, sheet and border colours and document font. Call
        with nothing to read.

        On a standard sheet size the zones and margin follow the size, so
        zones_x, zones_y and margin_width do not take; the custom_* ones
        apply to a custom-size sheet. Every value is read back; one that
        did not take is in ``not_applied``. Nothing is saved.

        Args:
            zones_x, zones_y: Reference zones across and down (from 1).
            margin_width: Sheet margin in mils.
            border_style: Altium's border style number (read one back
                first; 0 is the standard border).
            reference_zones: Show the zone letters and numbers.
            show_template_graphics: Show the template's graphics.
            custom_zones_x, custom_zones_y, custom_margin_width: The same
                for a custom-size sheet.
            title_block_on, border_on: Show Altium's standard title block
                and the sheet border.
            zone_origin: Where the zones are counted from: "upper_left"
                (Altium's default) or "bottom_right" (zone 1 and zone A in
                the bottom right corner).
            document_font_id: The sheet's document font, a font id from
                obj_get_font_id in this session; one that names no font is
                refused.
            sheet_color, border_color: The sheet's background colour and
                the colour of its border and zone frame, "#RRGGBB".

        Returns:
            ``changed``, ``options`` (read back after any write; colours
            as "#RRGGBB" with Altium's BGR integer beside them as
            ``sheet_color_bgr`` and ``border_color_bgr``; the font as
            ``document_font_id`` and ``document_font``, its name, size and
            style) and ``not_applied``.
sch_set_sheet_sizetool Set the sheet size / template style of the active schematic.Files
Set the sheet size / template style of the active schematic.

        Changes SheetStyle on the current SchDoc. Use a named style
        (A-E, A0-A4, Letter, Legal, Tabloid) or "Custom" with explicit
        width and height in mils. Give ``style``, ``orientation`` or both.

        Args:
            style: Sheet size name, e.g. "A", "A3", "A4", "Letter", "Custom"
            custom_width: Custom sheet width in mils (only if style="Custom")
            custom_height: Custom sheet height in mils (only if style="Custom")
            orientation: "landscape" or "portrait"; empty leaves it as is

        Returns:
            Dictionary confirming the style change
sch_set_unitstool Set the unit system for the active schematic.
Set the unit system for the active schematic.

        `obj_get_document_info` reads the current one.

        Args:
            unit: one of
                "mil"           , imperial, mils (0.001 in)
                "inch"          , imperial, inches
                "dxp"           , DXP default
                "auto_imperial" , auto-scaled imperial display
                "mm"            , metric, millimetres
                "cm"            , metric, centimetres
                "m"             , metric, metres
                "auto_metric"   , auto-scaled metric display

        Returns:
            Dictionary confirming the change, with the resulting
            unit_system ("imperial" or "metric").
sch_sheet_parameterstool List, add, set or remove a schematic sheet's own parameters (the
List, add, set or remove a schematic sheet's own parameters (the
        title block fields and the sheet's design rules), never a part's.

        Args:
            action: "list", "add", "set" or "remove".
            file_path: The .SchDoc; empty = the sheet in front.
            name: The parameter. list: only those of that name.
            index: Its index as listed (set, remove). With name too, the
                two must agree; a name that repeats needs the index.
            value: The value to write (add, set). add makes a second
                parameter of a name already used (a note says so).
            rule: Instead of value, a sheet rule as its fields, e.g.
                {"RULEKIND": "Clearance", "NAME": "HV", "GAP": "20mil",
                "NETSCOPE": "DifferentNets", ...}; it is a parameter
                named Rule. The first rule goes into the sheet's empty
                system Rule (value *), later ones are new parameters.

        list gives each parameter's index, name, value, hidden,
        read_only_state (0 none, 1 name, 2 value, 3 both), system, rule,
        removable, and a rule's rule_fields. add writes it hidden: a
        sheet's own parameter is never drawn, and Altium reads every one
        back hidden after a reload. A system parameter (Title,
        Author, Rule ...) takes a value but is not removed: Altium makes it
        again, with the value *, on the next load. A value Altium holds
        read-only is refused. Each write is read back: applied is false
        when Altium did not keep it (a rule it did not take reads back as
        PcbType=ProtelPcb), and marks the sheet without saving it.

        Returns:
            list: count, parameters. add / set / remove: action, applied,
            parameter (read back; remove: as it was), saved false,
            pending_save true.
sch_sheet_templatetool Read, set, update or remove the sheet template (.SchDot) of a
Read, set, update or remove the sheet template (.SchDot) of a
        schematic sheet, with no dialog.

        A template carries the sheet size, the border and the company
        title block. Setting one switches the standard title block off
        and keeps the sheet's parameters (Title and the rest), which the
        title block then shows. Altium's own update and remove commands
        ask for a scope in a dialog; these do not, and act on one sheet.
        Every action is read back.

        A template on the Altium server is set by its vault and revision
        GUIDs instead of a file: Altium downloads it and the sheet keeps
        the link. Read the GUIDs off a sheet already linked (get with
        vault=True) or from the server; the workspace template lists are
        not reachable here. "update" keeps a link: with revision_guid it
        moves the sheet to that revision, without arguments it applies
        the revision the sheet is linked to again (it does not look for
        a newer one).

        Args:
            action: "get" (default), "set", "update" or "remove".
            template_file: A local .SchDot for "set". For "update" it is
                optional: without it a sheet linked to the server updates
                from the server, any other reads its own template file
                again (it must still exist on this machine). A local file
                replaces a server link.
            vault: Also read the vault link (vault, item and revision
                GUIDs and names); always read after a server set or update.
            file_path: The sheet (.SchDoc). Empty uses the sheet in front.
                Set and update bring a named sheet forward for Altium's
                template command and then restore the view you had.
            vault_guid, revision_guid: A server template for "set" or
                "update", in place of template_file; both together.
            parameter_action: What a server "set" does to the sheet's
                parameters: "add_new" (default, adds the template's
                parameters the sheet lacks), "none", "override_all" (the
                template's values replace the sheet's) or "auto".

        Returns:
            ``applied`` (the sheet reads back as asked: the file, or the
            vault and revision asked with a template file),
            ``template_source`` ("local" or "server", for set and
            update), ``asked`` (the GUIDs a server call used),
            ``template_file``, ``template_before``, ``template_objects``,
            ``template_graphics``, ``sheet_style``, ``title_block_on``,
            ``border_on``; ``removed`` for "remove"; ``vault``.
sch_stub_pinstool Draw a short wire stub + net label on every unconnected schematic pin.
Draw a short wire stub + net label on every unconnected schematic pin.

        Each floating pin (as `proj_get_unconnected_pins` finds them) gets
        a wire out from its end and a net label "<designator>_<pin_number>",
        so ERC reports it as a named single-pin net.

        Args:
            stub_length_mils: Length of each stub wire in mils (default 100)
            only_designators: If given, only stub pins on these components

        Returns:
            Dictionary with "stubbed" and "failed" counts, plus the pin list
            that was acted on
sch_tidy_port_referencestool Move each port's cross-reference off its wire, to the free end.
Move each port's cross-reference off its wire, to the free end.

        A port moved without its wire keeps its "Sheet[zone]" reference on
        the wired end, over the wire. Each reference goes 20 mil past the
        free end. Vertical ports are ``skipped``. The sheet is not saved.

        Args:
            sheet_path: The .SchDoc.
            dry_run: True (default) only lists what would move.

        Returns:
            ``to_move`` (port, which end is wired and how that was decided,
            x and justification now and new), ``already_right``,
            ``skipped`` (with why), ``orphan_references``; once written
            ``moved`` and ``not_moved``.
sch_toggle_pin_visibilitytool Show or hide pin name / designator labels on schematic symbols.
Show or hide pin name / designator labels on schematic symbols.

        Targets a single component (by ``designator``) or every component
        on the active sheet when ``designator`` is empty. Provide
        ``show_name`` and/or ``show_designator`` to set those flags; omit a
        flag to leave it unchanged.

        Args:
            designator: Component to target, or "" for all components.
            show_name: True/False to set pin-name visibility (optional).
            show_designator: True/False to set pin-designator visibility.

        Returns:
            Dict with success and pins_modified (count).
server_updatetool Check the eda-agent repository for a newer version, or install it.
Check the eda-agent repository for a newer version, or install it.

        ASK THE USER FIRST. Call with apply=True only after the user has
        agreed in this conversation to update; describe what is new
        (``new_commits``) when you ask. app_ping and app_context report
        ``update`` when the daily check found one.

        With apply=False (default) it fetches and reports what an update
        would bring, and changes nothing. With apply=True it fast-forwards
        the clone, reinstalls when the dependencies changed, copies the
        Altium scripts again when they changed and, with ``relaunch``,
        restarts the Altium loop so it compiles them (other sessions' calls
        wait through the restart). A clone with uncommitted changes or
        commits of its own is refused and left untouched.

        Args:
            apply: Install the update. Only after the user says yes.
            relaunch: Restart the Altium loop when the scripts changed.

        Returns:
            Check: ``update_available``, ``commits_behind`` (as ``behind``),
            ``new_commits``, ``local_changes``, ``ahead``. Apply: ``updated``,
            ``from``, ``to``, ``commits``, ``steps`` (each ok and its output)
            and ``next_step``: reconnect the MCP server to run the new
            Python.
sim_attach_primitivestool Attach SPICE primitives to MANY components in ONE call.
Attach SPICE primitives to MANY components in ONE call.

        For the ``needs_primitive`` list from `sim_get_readiness`, all in
        one call.

        Args:
            attachments: List of attach dicts, each with:
                - designator (str, required)
                - primitive  (str, required), R/L/C/V/I/D/Q/M/X
                - value      (str, optional), "10k", "100n",
                  "DC 5", "SIN(0 1 1k)", etc.
                - spice_model (str, optional), model name for
                  semi/sub-circuit parts
                - sim_kind   (str, optional), "General" /
                  "Subcircuit" / "Model"

        Returns:
            Dict with attached, failed, total counts.
sim_get_probestool List the probes on the focused project's sheets.
List the probes on the focused project's sheets.

        Each probe with its sheet, location and parameters. ``simulation``
        is true for a probe the simulator uses (it carries
        SimulationProbe: V, I, P, VD+ or VD-, given as ``kind``);
        ProbeName is the node Altium resolved ("Empty Probe" when it sits
        off a wire), ProbeCustomName the name shown instead, and
        ProbeValueDisplay the value shown on the sheet. Sheets that are
        not open are listed in ``not_loaded`` (proj_load_sheets opens
        them).

        Returns:
            Dict with project, count, probes and not_loaded.
sim_get_readinesstool Audit every component on the active schematic for SPICE readiness.
Audit every component on the active schematic for SPICE readiness.

        Step 1 of any simulation. Each component lands in one bucket:
        ``ready`` (SpicePrefix set AND a SIM model linked, which is what
        Altium's netlister reads), ``no_sim_model`` (SpicePrefix written
        but no model link: the netlister reports "Missing component
        models" for these; sim_run_deck runs a plain SPICE deck without
        them), ``needs_primitive`` (R/L/C or a
        V/I/D/Q source needing SpicePrefix and Value; pass them all to
        sim_attach_primitives in one call) or ``needs_file`` (an IC or
        active part needing the vendor's .mdl/.ckt/.lib, for
        sim_attach_model).

        VENDOR SPICE MODELS ONLY. Never build a model from a datasheet:
        the parameters that set convergence and bias are not in it, and
        a plausible hand-made model gives confidently wrong results.
        ``_spice_guidance`` repeats this and gives per-part search
        queries.

        Returns:
            Dict with:
              - ready, ready_count (each with sim_model)
              - no_sim_model, no_sim_model_count
              - needs_primitive, needs_primitive_count
                (each entry has designator, comment, suggested_prefix,
                 suggested_value)
              - needs_file, needs_file_count
                (each entry has designator, comment, lib_ref,
                 manufacturer, manufacturer_part)
              - _spice_guidance (rules + structured search_hints +
                primitive_hints)
sim_runtool Run Altium's mixed-signal simulation of the focused project.Filesoutside text
Run Altium's mixed-signal simulation of the focused project.

        Runs the sheet's setup the way the Simulation Dashboard's Run
        does (set with sim_setup_analysis, or in the dashboard), and
        reports in ``ran_analyses`` which analyses this run produced,
        read back from the results.

        MEASURED on AD 26.11: Altium takes the on/off switches from the
        setup at the first run after the project opens and keeps that
        selection until the project is reopened; each run also switches
        operating point, DC, transient and AC back on in the setup. So
        ``analyses`` writes the switches and is applied by the first run
        after opening; otherwise the run does what Altium kept, and
        ``selection_applied`` is false. sim_get_results(analysis=...)
        reads one analysis either way.

        With no sheet in front and none given, the project's first
        simulator output runs instead (``run_mode`` "project"), which
        always does those four.

        Succeeds only when a results document (.sdf) appears, else
        SIM_NOT_RUN; the reply summarises each wave, sim_get_results
        gives the traces. Order: focus a sheet, sim_get_readiness and
        sim_attach_*, sch_place_probe, sim_setup_analysis, sim_run.

        Args:
            analysis: Free-form label echoed back in the response.
            analyses: switch on only these before the run: "op", "dc",
                "transient", "ac".
            sheet: the schematic whose setup to run; empty uses the
                sheet in front.

        Returns:
            Dict with success, ran, results_document (the .sdf path),
            results_saved, run_mode ("sheet" or "project"), sheet,
            ran_analyses, results (this run's analyses, per wave: unit,
            points, min, max, first, last; magnitude for an AC wave),
            analysis and note; with analyses, ``switched`` and
            ``selection_applied``.
tool_catalogtool Find tools by category, maturity, interaction or text, withoutFilesoutside text
Find tools by category, maturity, interaction or text, without
        loading every schema.

        Filters (all optional, AND-combined):
            category: core, application, project, library, generic,
                schematic, pcb, audit, design, simulation, routing, meta,
                parts, altium365 (and kicad on the KiCad backend). "core" is the
                EDA-agnostic main flow and the usual start. No filter
                returns the live ``categories`` map.
            maturity: ``offline`` (no Altium), ``simulator`` or
                ``live_only``.
            interaction: readonly | silent | modal | partial. ``modal``
                pops a blocking dialog; ``partial`` leaves the job
                incomplete.
            query: case-insensitive substring of the name or description.
            with_description: include the one-line summary per tool.
            with_schema: include parameters and required list; needed
                before tool_invoke under the minimal toolset. Capped, so
                filter first.

        Returns ``{count, tools:[{name, category, maturity, interaction
        [, description][, parameters, required]}], categories:{cat: n}}``.
tool_guidetool How to do something correctly, and what is genuinely impossible.
How to do something correctly, and what is genuinely impossible.

        USE THIS BEFORE CONCLUDING A CAPABILITY IS MISSING. The costly
        mistakes are aiming a board tool at a library and reporting a
        capability absent when it exists; both give a confident wrong
        answer, not an error.

        Answers three things, kept apart: the tool and its
        prerequisites, the tool you were probably reaching for and why
        it acts on another document, and what is proven impossible,
        with the reason. An empty result means only that this guide has
        nothing on it; fall back to ``tool_catalog``.

        Ask here for help when a tool seems missing, you are not sure
        which tool to use, an operation seems not supported, or a call
        failed because the wrong document was open.

        Args:
            task: What you are trying to do, in your own words, e.g.
                "delete silkscreen from a footprint". Matched on
                keywords, so a rough phrase is fine.
            document_kind: Narrow to one of library, board, schematic,
                project, any. Optional.
            backend: altium, kicad or easyeda. Optional; omit to see
                every backend's answer.

        Returns:
            Dict with ``recipes`` (each with ``use``, ``avoid`` and a
            ``note``), ``not_possible``, and ``matched``.
tool_invoketool Invoke any registered tool by name: the companion to
Invoke any registered tool by name: the companion to
        `tool_catalog`.

        A client with a limited context can expose only the core tools plus
        this pair: discover a tool with `tool_catalog`, then run it here by
        name without ever loading its schema. ``arguments`` is the tool's
        keyword-argument dict.

        GET THE ARGUMENT NAMES FIRST. Under the minimal toolset no schema
        is loaded up front, so call
        ``tool_catalog(query="<name>", with_schema=True)`` and use the
        ``parameters``/``required`` it returns. Guessing is a real failure
        mode: several tools take names that look obvious but are not
        (``current_amps``, not ``current_a``), and the same tool can differ
        between backends.

        Returns the tool's own result (JSON-decoded), or ``{"error": ...}``
        for an unknown/disallowed name. Note: bypassing the schema means
        argument mistakes surface as the target tool's own error, not a
        pre-validation message.

Text the model reads (1119)

Every tool, prompt and resource description as written in the code: the model sees all of it, the user usually does not.

audit_find_mixed_designator_rotation tool
Find PCB silkscreens where designators face BOTH 0 and 180
        (or both 90 and 270) -- the assembly-readability check.

        Assembly inspectors and pick-and-place operators read silkscreen
        from a fixed angle. If half the designators on the top overlay
        read normally and the other half are upside-down (0 vs 180),
        QC has to physically rotate the board between parts -- slow,
        error-prone, and the kind of thing fab houses charge extra to
        deal with. Orthogonal mixes (0 + 90) are fine because the
        inspector turns their head, not the board.

        The check runs per overlay layer (top, bottom) independently --
        a top side with mixed 0/180 doesn't excuse a clean bottom.

        Returns:
            Dict with `{checked, violations, top_mixed_0_180,
            top_mixed_90_270, bottom_mixed_0_180, bottom_mixed_90_270,
            items[]}`. Each item carries `{designator, layer,
            rotation_deg}` for a component contributing to a flagged
            pair, so the agent can rotate those specifically.
audit_find_pin_net_name_mismatches tool
Find IC pins whose NAME looks like a power / ground pin but
        whose connected NET is not actually a power / ground rail.

        Examples flagged:
          - pin "VCC" wired to a non-power net (swapped rail bug)
          - pin "GND" or "VSS" wired to a non-ground net (broken
            reference plane)
        ERC won't catch these: the wire is connected, the names just
        disagree on intent. A class of bug that ships when the user
        copied a sub-circuit and forgot to re-tag the rail.

        Pattern: ports the dashboard's JS-side analyzePinNetMismatch
        as an authoritative MCP audit.

        Returns:
            Dict with `{checked, violations, items[]}` where each item
            carries `{designator, mismatches[]}` with one entry per
            offending pin: `{pin, name, net, kind}`. `kind` is
            ``power_pin_on_non_power_net`` or
            ``ground_pin_on_non_ground_net``.
audit_find_unconnected_ic_pins tool
Find IC pins with an empty / unset net (excluding pins
        intentionally named NC / DNC / RSVD / RESERVED).

        Walks the project BOM (cheap: uses the already-cached
        ``project.get_bom`` snapshot, no extra Altium round-trip) and,
        for every component whose designator starts with ``U``, counts
        pins whose `net` is empty / null / "?". Pins whose NAME marks
        them as no-connect by convention are skipped because those
        aren't bugs.

        Same heuristic the Components tab's "unconnected IC pins" chip
        runs in JS, but now exposed as a first-class MCP tool so the
        agent can drill in from one call and the result is consistent
        between the dashboard and the lint sweep.

        Returns:
            Dict with:
              - ``checked``: ICs inspected
              - ``violations``: ICs with at least one unconnected pin
                (the COUNT here is per-IC, not per-pin)
              - ``unconnected_pin_total``: sum of unconnected pins
                across all flagged ICs
              - ``items``: per-IC `{designator, unconnected_pins[]}`
                listing pin numbers + names that were flagged.
audit_find_pads_near_board_edge tool
Find PCB pads / vias closer than ``clearance_mils`` to the
        board outline (depaneling damage hazard).

        Copper near a routed or scored edge can be damaged when the board
        is separated; take the limit from the fab's rules. The gap is
        measured from the outline's lines and arcs to the pad's copper
        at any rotation.

        Args:
            clearance_mils: Minimum gap to flag (default 25).

        Returns:
            Dict with:
              - ``checked``: total pads + vias inspected
              - ``violations``: how many are within the clearance
              - ``unmeasured``: pads that could not be measured, which
                are therefore neither passed nor flagged
              - ``clearance_mils``: echo of the threshold used
              - ``items``: per-violation `{kind, designator,
                distance_mils, at}` where ``at`` is "(x,y)" mils.
audit_find_removed_pad_shapes tool
Find pads / vias whose copper annular ring has been removed
        on layers where it's still needed.

        Altium's "Tools → Remove Unused Pad Shapes" optimization
        deletes per-layer pad copper where a primitive isn't electrically
        used on that layer. Applied too aggressively, it leaves a via
        that drills through an inner layer with NO annular ring there:
        any later trace edit on that inner layer that tries to land on
        the via will silently fail to connect at fab.

        Detection:
          - Vias: ``Via.SizeOnLayer(L) <= Via.HoleSize`` means no copper
            left, just the drilled hole.
          - Pads: ``Pad.IsPadRemoved(L)`` is True.

        Pattern: brett's PadShapeRemoved.pas (read-only; we surface
        coordinates rather than highlight on canvas).

        Returns:
            Dict with:
              - ``checked``: total pads + vias inspected
              - ``violations``: how many layer-instances are flagged
                (one via removed on 3 layers counts as 3)
              - ``items``: per-violation `{kind, designator, net,
                layer, at}` where ``at`` is "(x,y)" mils.
design_edit_plan tool
Edit an existing plan instead of re-emitting it. The tool does
        the bookkeeping (a deleted part leaves every net; merged nets
        de-dupe pins). Ops run in order and the result is validated once
        at the end, so a newly floating net surfaces.

        Operations (each a dict keyed by ``"op"``):

          * ``{"op": "set_part", "refdes", <field>: <value>, ...}`` --
            change ``value`` / ``footprint`` / ``mpn`` / ``manufacturer`` /
            ``lib_ref`` / ``status`` / ``sheet`` / ``role`` / ... on a part.
          * ``{"op": "delete_part", "refdes"}`` -- remove a part; nets it
            emptied are dropped, nets left with one pin are flagged in
            ``notes`` as floating.
          * ``{"op": "set_net", "net", <flag>: <value>, ...}`` -- change a
            net's ``is_power`` / ``is_ground`` / ``role`` / ``force_label``
            / ``force_wires`` (fix a forgotten power/ground flag).
          * ``{"op": "connect_pin", "net", "refdes", "pin"}`` -- tie a
            part's pin to a net (fix an unconnected pin); makes the net if
            new.
          * ``{"op": "disconnect_pin", "net", "refdes", "pin"}`` -- remove a
            pin from a net.
          * ``{"op": "rename_net", "old", "new"}`` -- rename a net.
          * ``{"op": "merge_nets", "into", "from"}`` -- fold ``from`` into
            ``into`` (keeping ``into``'s flags), then drop ``from``.

        Args:
            plan_json: the DesignPlan as a JSON string or dict.
            operations: the ordered edit ops.

        Returns:
            ``{ok, plan, notes, validation}`` for the edited plan -- same
            validation shape as the add tools. On a bad op,
            ``{ok: False, errors: [...]}`` naming the operation's index.
design_simulate_loops tool
Loop gain, crossover, phase and gain margin of every feedback
        loop in a plan, simulated in ngspice. Changes nothing.

        The loops come from design_find_loops. Each is broken at the
        driving pin (an op-amp's output) and measured by Middlebrook
        double injection, so the real load on the output counts. A
        switching regulator's FB loop runs only when its model is marked
        ``"averaged": true``: a vendor's switching (transient) model has
        no small-signal loop gain.

        Models are the manufacturer's: ``models`` maps refdes to
        ``{"file": path, "subckt": name, "pins": [plan pins in the
        subckt's node order]}``. Without ``pins`` the .SUBCKT node names
        are matched to the plan's pin names (and ``pin_names``). R, C and
        L are SPICE primitives from their values. A part with no model is
        listed in ``missing_models`` and nothing runs; nothing is ever
        approximated. Rails take ``supplies`` ({net: volts}) or the
        voltage in the net name (+12V, 3V3).

        No ngspice: the reply carries the install offer and runs nothing.

        A phase margin under 45 degrees is flagged ``low``: a common
        design convention, not a datasheet limit; loops are ranked by
        margin either way.
easyeda_export_bom_html tool
Export the board's BOM as a self-contained interactive page.

        One HTML file with no external CSS, JavaScript or EasyEDA
        dependency: sortable columns, a free-text filter, and a toggle
        between grouped (one row per value and footprint) and
        per-component views. Made for mailing to a manufacturer or
        filing with a board release, where the reader has no EDA tool.

        PARTS TICKED OFF THE BOM ARE LEFT OUT, and the count of what was
        left out is reported rather than the list quietly being shorter.
        Mounting holes, fiducials and test points are excluded on
        purpose and are most of what a healthy board excludes.

        A part that does not report the flag is INCLUDED. Absence is not
        a decision to leave it off, and defaulting the other way would
        drop parts from a purchase order on the strength of a missing
        key.

        Reads design.snapshot rather than the components list directly.
        The snapshot handler already resolves the trap that produced a
        measured bug on a live board: footprint and component arrive as
        OBJECTS carrying a name, not as strings, and reading them as
        strings returned an empty value for all 111 parts. Repeating
        that mapping here would reopen the same hole.

        Args:
            output_path: where to write the HTML. Defaults to
                ``bom.html`` in the workspace directory.
            title: heading and page title.
            include_excluded: keep parts marked off the BOM, flagged
                with a column rather than dropped. For checking what
                was excluded, not for sending to a manufacturer.
easyeda_audit_degenerate_copper tool
Fills and pours whose outline cannot enclose an area.

        Port of the Altium invalid-regions audit. A region left behind
        by a cancelled pour, or mangled by an import, renders as
        nothing: the board LOOKS as though it has that ground plane
        and does not. Nothing on screen shows the difference, which is
        what makes it worth a check rather than a glance.

        Counting is deliberately conservative. The outline is a flat
        list mixing coordinates with segment markers, measured as
        ``[546.9685, 341.063, "L", 547.0866, ...]``, and only the
        numbers are counted: three points need six of them. If a
        marker like an arc carries extra numeric parameters the count
        comes out HIGH, so a real degenerate could be missed, but a
        healthy region is never flagged. Missing the odd defect is
        recoverable; a review tool that cries wolf is not.

        REPORTS, does not delete. Removing a region that turns out to
        be legitimately tiny is worse than listing it.

        Returns:
            {ok, checked, violation_count, violations: [{kind, layer,
             net, name, points_seen, primitive_id}]}.
proj_run_outjob_all tool
Run every container in an OutJob and report what each produced.

        Each container runs through ``proj_run_outjob`` in order, and its
        ``output_dir`` files written since it started are flagged
        ``newly_produced``.

        Args:
            outjob_path: Path to the .OutJob. Omit to use the first one
                in the focused project.
            include_files: List each container's files (default True).
            fresh_window_seconds: Files modified up to this long before a
                container started still count as new. Default 5 s.
            fab, fab_tier, outer_oz: as proj_run_outjob; nothing runs
                when a container writes fab files and the board is
                outside the fab's limits.

        Returns:
            Dict with ``ok``, ``outjob_path``, ``containers_run``
            (list of container names), ``results`` (per-container
            dicts each with ``container``, ``container_type``,
            ``output_dir``, ``ok``, ``files``).
altium365_check_setup tool
Which Altium 365 route is set up, whether the live schema has the
        fields the read tools use, and which changes it offers.

        Routes: the workspace's own API (EDA_AGENT_ALTIUM365_DOMAIN, and a
        token made under Admin > Developer in EDA_AGENT_ALTIUM365_TOKEN), or
        Nexar (EDA_AGENT_NEXAR_APP_ID, then ``eda-agent altium365-login``).
altium365_list_workspaces tool
The Altium 365 workspaces the token sees (url, id, name,
        description); with EDA_AGENT_ALTIUM365_WORKSPACES set, only those.
altium365_list_projects tool
Projects of one workspace (id, name, description), optionally those
        whose name contains a text.
altium365_get_project tool
One Altium 365 project by id.
altium365_list_library_folders tool
Folders of a workspace's managed library (id, name, path); publishing
        names its folder by id.
altium365_list_components tool
Managed components of a workspace (id, name), and their parameters
        when asked, the whole library in one call.
altium365_get_component tool
One managed component and its parameters.
altium365_read_object tool
Any object a ``des...ById`` query returns (a release, a part choice,
        a comment thread), asking for the fields the live schema lists, never
        guessed ones. altium365_describe_type("Query") lists the queries.

        Returns:
            ``type``, ``fields``, and ``nested_fields`` to read with
            altium365_run_query.
altium365_describe_type tool
One type of the live Altium 365 schema with its fields, their
        arguments and types: start at "Query" and follow the types named.
altium365_run_query tool
Run a reading GraphQL query against Altium 365. Queries that change
        anything (mutation, subscription) are refused; library changes are
        altium365_publish_library_file, altium365_release_component and
        altium365_set_component_parameters.
altium365_publish_library_file tool
Publish a symbol (.SchLib) or footprint (.PcbLib) into a folder of a
        workspace's managed library.

        Without ``confirm`` this shows what would be sent. With it the file
        is uploaded and the item created, and its ``id`` comes back.
altium365_release_component tool
Release a managed component (desReleaseComponent). ``release`` is
        that operation's input as Altium documents it, with at least
        ``workspaceUrl`` and ``componentItemName``. Without ``confirm`` this
        shows what would be sent.
altium365_set_component_parameters tool
Add or change a managed component's parameters as a new revision.

        ``parameters`` is [{"name", "value"}]; ``replace_existing`` drops
        every parameter the component has first. The new revision has a new
        component id, which comes back. Without ``confirm`` this shows what
        would be sent.
tool_catalog tool
Find tools by category, maturity, interaction or text, without
        loading every schema.

        Filters (all optional, AND-combined):
            category: core, application, project, library, generic,
                schematic, pcb, audit, design, simulation, routing, meta,
                parts, altium365 (and kicad on the KiCad backend). "core" is the
                EDA-agnostic main flow and the usual start. No filter
                returns the live ``categories`` map.
            maturity: ``offline`` (no Altium), ``simulator`` or
                ``live_only``.
            interaction: readonly | silent | modal | partial. ``modal``
                pops a blocking dialog; ``partial`` leaves the job
                incomplete.
            query: case-insensitive substring of the name or description.
            with_description: include the one-line summary per tool.
            with_schema: include parameters and required list; needed
                before tool_invoke under the minimal toolset. Capped, so
                filter first.

        Returns ``{count, tools:[{name, category, maturity, interaction
        [, description][, parameters, required]}], categories:{cat: n}}``.
tool_invoke tool
Invoke any registered tool by name: the companion to
        `tool_catalog`.

        A client with a limited context can expose only the core tools plus
        this pair: discover a tool with `tool_catalog`, then run it here by
        name without ever loading its schema. ``arguments`` is the tool's
        keyword-argument dict.

        GET THE ARGUMENT NAMES FIRST. Under the minimal toolset no schema
        is loaded up front, so call
        ``tool_catalog(query="<name>", with_schema=True)`` and use the
        ``parameters``/``required`` it returns. Guessing is a real failure
        mode: several tools take names that look obvious but are not
        (``current_amps``, not ``current_a``), and the same tool can differ
        between backends.

        Returns the tool's own result (JSON-decoded), or ``{"error": ...}``
        for an unknown/disallowed name. Note: bypassing the schema means
        argument mistakes surface as the target tool's own error, not a
        pre-validation message.
app_find_menu_command tool
Search every Altium menu item and the command behind it.

        Read from Altium's own menu definitions in its install, so it
        answers without Altium's window, in any language Altium ships
        (words may be English, 中文, 日本語, Deutsch, ...). Each hit gives
        the menu ``path`` (English), the ``command`` and ``params`` it
        runs, and its ``shortcut``. Run one with ``app_run_menu`` (no
        menu walk) or ``app_click_menu`` (the real menu).

        Args:
            query: words to find, all of which must match.
            editor: PCB, SCH, PCBLIB or SCHLIB; empty searches all four.
            limit: how many hits to return.
app_get_status tool
Check if Altium Designer is running and get status information.

        Returns information about the Altium Designer process including:
        - Whether Altium is running
        - Process ID
        - Executable path
        - Whether the MCP bridge is attached

        MORE THAN ONE ALTIUM. ``candidate_count`` and ``candidate_pids``
        list every instance, and ``selected_by`` says how ``pid`` was
        chosen: the instance owning the bridge's status window, or the
        only one with a visible window. When neither decides it, ``pid``
        is None, ``ambiguous`` is True and ``reason`` explains, and every
        UI tool refuses rather than read the wrong process's dialogs.

        MORE THAN ONE eda-agent SERVER. ``other_servers`` lists the other
        servers recorded on this workspace (pid and start time), and
        ``warnings`` says so when there are any. A warning only: several
        sessions at once are allowed, and nothing is stopped.

        Returns:
            Dictionary with status information
app_context tool
Where you are, in one call. Run this before anything else.

        Reports the facts behind most "why didn't that work": which
        document is focused and its kind (most tools act on it, and a
        pcb_ tool aimed at a focused library can act on another board);
        whether the running script matches the deployed one (a deployed
        fix does nothing until reloaded); what is unsaved; and whether
        the bridge answers at all.

        It cannot tell which library component is current; if a lib_add_*
        call lands somewhere unexpected, set it with
        ``lib_set_current_component``.

        Returns:
            ``{"backend", "bridge_answering", "script_version_match",
            "running_script_version", "deployed_script_version",
            "altium_version", "active_document", "open_document_count",
            "unsaved": [paths], "warnings", "next_step"}``.

            ``warnings`` is empty when nothing needs attention.
            ``next_step`` is the single thing worth doing first, or empty.
app_attach tool
Connect to a running Altium Designer instance.

        This verifies Altium is running and the polling script is responding.
        The Altium_API.PrjScr script must be running (StartMCPServer) in Altium.

        Returns:
            Dictionary with attachment status
app_save_all tool
Flush every dirty Altium document to disk.

        Edit tools change documents in memory only; call this at
        checkpoints (after routing, before DRC, before closing). Detach
        saves too. A library no tool edited is not written (listed in
        ``libraries_left_unedited``); hand edits are not tracked, so save
        those with ``app_save_document``.

        CHECK ``still_dirty``: Altium declines to save, silently, while a
        command is active in the editor, and ``saved`` is false then. Run
        ``app_exit_active_command`` and retry.

        Returns:
            Dict with ``saved``, ``still_dirty``, ``libraries_left_unedited``,
            and a ``reason`` when documents remain unsaved.
app_save_document tool
Save ONE open document: ``file_path``, or the focused one.

        ``app_save_all`` writes every open document, so one that cannot
        be written, a sheet in a read-only folder say, stops a save you
        never asked for. This touches only the named document, never
        changes focus and never walks the workspace.

        ``saved`` is measured from the file's age on disk: Altium does
        not report a declined save. ``was_modified`` says whether Altium
        thought there was anything to write, and it misses edits made
        through scripts: a board changed only by this server's tools read
        false and was saved all the same. A save Altium declines while
        a command is active reads ``saved`` false; run
        ``app_exit_active_command`` and retry.

        Args:
            file_path: Absolute path of an open document. Empty saves the
                focused document.

        Returns:
            ``file_path``, ``saved``, ``was_modified`` and a ``reason``
            when it was not saved. NOT_OPEN when the document is not open,
            since only an open document can hold unsaved edits.
app_exit_active_command tool
Close a transaction a crashed handler left open in Altium.

        THE TOOL FOR "A command is currently active and save cannot be
        completed at this time", when every save is refused. The state
        lives in Altium, so it survives restarting the polling loop and
        Escape does not clear it; it is left by a handler that died
        mid-transaction. Harmless when nothing is open. It saves nothing:
        run ``app_save_all`` afterwards and check ``still_dirty``.

        Returns:
            Dict reporting whether each server accepted the unwind, plus
            the count of still-modified documents before and after.
app_close_document tool
Close ONE open document, found by its full path, whatever has focus.

        Unlike closing through the workspace manager, which acts on the
        FOCUSED object, this closes the named document itself. It refuses a
        document that reads modified, and says whether it is really gone
        afterwards. The modified read can miss edits held in the editor, so
        save anything you care about first; a close of an edited document
        may still raise Altium's save prompt.

        Args:
            file_path: the document's full path, as app_list_documents
                reports it.
            discard_changes: close it even when it reads modified, and
                LOSE the unsaved edits: the modified flag is cleared first
                so no save prompt appears. For scratch copies and documents
                Altium changed by merely opening them, never for work. A
                schematic an open project lists may keep the edit in the
                project after its tab closes: ``discarded`` is then false
                and ``project_may_hold_edit`` true; proj_close with
                save=False drops it.

        Returns:
            ``{"closed": bool, "discarded": bool, "project_may_hold_edit":
            bool, "file_path": ...}``; an
            error when the path is not open, or when the document reads
            modified and ``discard_changes`` is not set.
app_close_opened_documents tool
Close the documents this session's commands opened, and no other.

        Each reply names the documents its command loaded that were not
        open before it, and the session keeps that list. This closes the
        ones still open. A document open before (yours, or one another
        session opened) is never on the list, nor is a project. One that
        reads modified is kept and named: save it or close it yourself.

        Args:
            dry_run: Only say what would close (default True).
            keep: Full paths to leave open although this session opened
                them, such as the board still being worked on.

        Returns:
            ``would_close`` (dry run) or ``closed``; ``kept_modified``,
            ``kept``, ``already_closed`` (closed since, dropped from the
            list), ``failed`` (path and reply) and ``remaining`` (what
            stays on the list).
app_checkpoint tool
Snapshot a project so the session can be rolled back.

        Altium saves a copy of each design document in the project folder
        into a content-addressed store under the workspace, an open one as
        it is in the editor; the project file and other files are stored
        as they are on disk. Unchanged files are stored once, and a closed
        document unchanged since the last checkpoint is not opened again.
        Take one before any risky autonomous edit; restore with
        `app_restore_checkpoint`. This is the undo the live bridge otherwise
        lacks.

        Args:
            label: optional human note ("before routing pass").
            save_first: save the project first, so the project file holds
                what Altium holds (default True).
            project_path: the .PrjPcb to snapshot. Left empty, the focused
                project is taken; with several open that may not be the one
                you are editing, so the reply names it and lists the rest.

        Returns:
            The checkpoint manifest summary (id, created, file_count,
            ``not_written``: documents Altium did not copy, with why),
            ``project`` (the one snapshotted) and ``other_open_projects``.
            With ``save_first``, also ``saved``: True when the save
            worked, False with ``save_error`` and a ``note`` when it did
            not.
app_list_checkpoints tool
List saved checkpoints for the current workspace, newest first.
app_restore_checkpoint tool
Restore the focused project's files from a checkpoint.

        Only files that differ from the checkpoint are restored. The
        project is closed WITHOUT SAVING, so edits since the checkpoint
        are dropped, and opened again afterwards. Altium opens each
        changed design document's snapshot and saves it under its own
        name; the project file and other files are put back while the
        project is closed. With `prune_added=True` this is a true revert:
        files created after the checkpoint are deleted; the default leaves
        newer files untouched.

        Args:
            checkpoint_id: id from `app_list_checkpoints`.
            prune_added: delete files absent at checkpoint time (default False).

        Returns:
            {restored, unchanged, removed, missing_blobs, not_restored
            (file: why), not_in_checkpoint, reopened, were_open (the
            project's documents open before; the project reopens with
            none of them open)}.
app_detach tool
Stop the Altium MCP polling loop. CALL THIS WHEN YOU'RE FINISHED.

        While the loop runs it holds Altium's scripting engine, so some of
        Altium's own script-backed commands may not respond. This saves
        edited and modified documents, leaves clean ones alone, and stops
        the loop. Afterwards the user must run StartMCPServer again (File
        > Run Script) before any more tools work, so detach only when done.

        Returns:
            attached False always; stopped True only when Altium answered
            that its loop stopped, with edited_saved and clean_left_alone
            counts. Otherwise stopped False and the reason: the loop may
            still be running.
app_ping tool
Check that Altium and its bridge script answer, and that the
        running script is the version on disk. A mismatch or a non-empty
        ``stale_units`` means Altium runs an old compile: close and reopen
        the script project to recompile.

        Returns:
            ``success``, ``mcp_server_version``, ``altium_script_version``,
            ``bundled_script_version`` and ``bundled_script_path``,
            ``version_match``, ``altium_version``, ``message``,
            ``script_projects_open`` and ``script_location_match`` (False:
            Altium loaded scripts from elsewhere), ``loop_workspace_dir``
            (the folder the answering loop takes requests from) and
            ``server_workspace_dir`` (this server's), ``unit_stamps``,
            ``stale_units``, ``unstamped_units``, ``saving_allowed`` (False
            while the dashboard's Saving switch is off), ``other_servers``
            (other eda-agent servers on this workspace) and ``warnings``.
app_get_report tool
Report the health of the MCP bridge, workspace, and Altium link.

        One call to diagnose the plumbing without touching the design:
        package version, the script version on disk vs. what Altium has
        compiled, whether Altium is up, the live IPC round-trip time, the
        workspace location, and how many request/response/stop files are
        sitting in it (a backlog of stale request_*.json usually means a
        dead or wedged poller).

        Returns:
            Dictionary with mcp_server_version, bundled_script_version,
            altium_running, altium_script_version, version_match,
            round_trip_ms (None if Altium is down), workspace_dir,
            workspace_exists, and a file_counts breakdown.
app_create_document tool
Create a new blank document of a given kind and save it to disk.

        Saved to `file_path` and, by default, added to the focused
        project, or to ``project_path`` when given. With several projects
        open, name the project: the focused one is whichever was clicked
        last, and a scratch sheet added to a production project stays in
        it. ``member_of`` reads back which projects now list the file.

        Args:
            kind: Document kind, 'PCB', 'SCH', 'PCBLIB', 'SCHLIB',
                'OUTPUTJOB', 'HarnessWiringDiagram' (a .WirDoc in a
                .PrjHar), or any other kind Altium's server module
                registers under.
            file_path: Absolute path where the new document should live.
                Use Windows backslashes.
            name: Optional display name. Defaults to the filename.
            add_to_project: Attach the new file to a project. Default
                True. Set False to leave it as a free document.
            project_path: The .PrjPcb to attach it to. An unknown path is
                refused before anything is created.

        The new document is focused, and ``focused`` says whether that
        took, since the next tool acts on the focused one. A save that
        fails is an error naming the cause.

        A path that is already OPEN is refused (``ALREADY_OPEN``): creating
        over an open document crashed Altium's PCB editor. Focus it with
        app_set_active_document instead. A file that exists on disk but is
        not open is replaced by the blank document.

        Returns:
            Dictionary with kind, file_path, saved, focused,
            added_to_project and member_of (project paths).
app_document_owners tool
Which Claude session is editing which open document.

        Sessions share one Altium. A tool that writes claims the document
        it acts on; another session's write to it is refused
        (DOCUMENT_IN_USE) while the owner has written within the last
        ``idle_release_seconds``. Reads are never refused, and neither is
        the person at the dashboard.

        Returns:
            ``documents`` (each ``document``, ``session``, ``last_command``,
            ``seconds_since_write``, ``held``, ``yours``) and ``session``,
            this session's tag.
app_claim_document tool
Take a document over from the session editing it.

        Only when the user says so: the other session's next write to it
        is then refused instead of this one's.

        Args:
            file_path: The document's full path.

        Returns:
            ``document``, ``session`` (this one) and ``previous_owner``.
app_release_document tool
Give up a document this session is editing.

        Another session can then write to it at once, instead of after
        ``idle_release_seconds``. Call it when done with a document that
        another session may want. A document another session holds is
        refused (NOT_YOURS); taking one over is app_claim_document.

        Args:
            file_path: The document's full path. Empty releases every
                document this session holds.

        Returns:
            ``released`` (the documents given up) and ``session``.
app_list_documents tool
List all documents known to the current Altium workspace.

        Returns both project members and any free documents. Each entry
        carries a `loaded` flag that distinguishes "listed as project
        member on disk" from "actually resident in the editor".
        Project-scope queries (query_objects, batch_modify, ...) only
        iterate loaded sheets, if `loaded` is false for sheets you need
        to hit, call load_project_sheets first.

        Returns:
            List of document information dictionaries containing:
            - file_name: Document file name
            - file_path: Full file path
            - document_kind: Type of document (SCH, PCB, etc.)
            - loaded: True if the doc is resident in the editor server.
              False means it's a project member on disk whose editor
              state hasn't been opened yet.
            - modified: True if the editor holds unsaved edits. A false
              is a floor rather than a clean bill, since the flag does
              not always propagate from ProcessControl. app_save_all
              measures file timestamps instead of trusting it.
app_diag_workspace tool
Diagnostic: enumerate workspace files via Altium's FindFiles helper.

        Reports workspace_dir, the pattern used, match_count and the first
        10 matching filenames. Used to validate the per-request file
        enumeration that the dispatcher relies on.
app_get_active_document tool
Get information about the currently active (focused) document.

        Several Claude sessions can share one Altium. Each command runs on
        its own session's document (the last one it focused), which Altium
        puts back in front first if anything else moved the focus. So by
        default this answers what is REALLY in front, which may be another
        session's document or one a person has just opened. To work on that
        document, focus it (app_set_active_document); it then becomes this
        session's.

        Args:
            session: True for this session's own document instead, brought
                back to the front first if something else is there.

        Returns:
            Dictionary with active document information:
            - file_name: Document file name
            - file_path: Full file path
            - document_kind: Type of document (SchDoc, PcbDoc, etc.)
            - modified: True if the editor holds unsaved edits. A false
              is a floor rather than a clean bill, since the flag does
              not always propagate from ProcessControl.
            Returns empty dict if no document is active.
app_set_active_document tool
Set a specific document as the active (focused) document,
        opening it first when it is a file Altium has not loaded yet (a
        member of a project just opened, say).

        Args:
            file_path: Full path to the document to activate

        Returns:
            Dictionary with result of the operation; ``opened`` true when
            the document had to be opened first.
app_get_version tool
Get the version of Altium Designer.

        Uses Client.GetProductVersion internally. If that API is unavailable
        (older builds or restricted script context), the returned dictionary
        will omit "version" and include a "note" field instead.

        Returns:
            Dictionary with product_name and either:
            - version: Full version string (when Client.GetProductVersion works)
            - note: Explanation when the version API is unavailable
app_get_preferences tool
Get key Altium Designer preferences.

        Returns PCB preferences (snap grid, display unit) from the active board
        and schematic preferences (visible/snap grid) from the active schematic.
        Values are null if no PCB or schematic is currently open.

        Returns:
            Dictionary with "pcb" and "schematic" sub-objects containing
            grid and unit settings
app_autosave tool
Read, or set, Altium's auto-save: whether it saves backup
        copies of open documents, and how often.

        Call with nothing to read. Both values are read back.

        Args:
            enabled: Auto-save on (True) or off (False).
            interval_minutes: Minutes between saves, 1 or more.

        Returns:
            ``enabled``, ``interval_minutes`` and ``changed``.
app_format_value tool
Read, write or clean up a component value. HOW IT IS WRITTEN IS
        THE USER'S CHOICE on the Config tab of the bridge panel in Altium,
        read on every call: RKM (IEC 60062, a letter where the decimal
        point would be: 4K7, 0R005, 2u2, 10uF, 3V3), SI (4.7k, 0.005, 2.2u,
        3.3V), SI with the unit (2.2uF, 100nF, 10uH; never on resistors), or
        None, which leaves values as written: cleanup returns the text
        unchanged and tostring is refused. The reply's ``value_format``
        says which applied. Do not pick a form for the user.

        Done by the bridge's own value engine (no document is read or
        touched), so a script can use the same rules. NO ROUNDING: a value
        is digits and a power of ten, exact to the last digit.

        Reading is tolerant: 4.7k, 4,7 kOhm, 10 000uF, 2.2uF, 0.1 uF,
        3,3 V, 125 degC. The unit letter decides the kind; without one,
        p / n / u is a capacitor and G / M / m / K a resistor. Letters
        that could read two ways are blocked: on a resistor m is MEGA
        (milli and micro are written 0R005, 0R0005); on volts and amperes
        M is milli; femto is never read (100 fF is 0p1). The value ends at
        the first space or character that is not part of it ("10uF 50V"
        and "10uF/50V" read 10uF, the rest comes back in ``rest``); a value
        that runs on into digits or letters it cannot use ("10.1.1k") is
        refused.

        Args:
            action: ``cleanup`` (text -> the proper text), ``fromstring``
                (text -> value and kind) or ``tostring`` (kind + value ->
                text).
            text: The value as written, for cleanup / fromstring.
            value: The value in the base unit (ohm, farad, henry, volt,
                ampere, %, ppm, degree C) for tostring: a string such as
                "0.0000022" or "1e3", or a number.
            kind: ohm, farad, henry, volt, ampere, percent, ppm or
                celsius (also R, C, L, V, A). Takes precedence over the
                text; a unit in the text that disagrees is a note.
            decimal: The decimal separator of the SOURCE text, "." or
                ",", for "1,000" / "1.000"; default this machine's.

        Returns:
            ``text`` (cleanup, tostring), ``value`` as an exact decimal
            string and ``kind`` (cleanup, fromstring), ``rest`` (what
            followed the value), ``notes`` (every guess made) and
            ``value_format`` (cleanup, tostring).
app_run_menu tool
Dispatch a menu command by path. DISPATCH IS NOT EXECUTION:
        Altium accepts an unknown or unavailable process in silence, so
        the reply says ``dispatched`` with ``outcome_verified: false``.
        Use ``app_click_menu`` when the command must actually run; it
        clicks the real menu and fails on a path that does not exist.

        Any path in the focused editor's menu bar works, in English or
        in any language Altium ships: it is looked up in Altium's own
        menu definitions (``app_find_menu_command`` searches them) and
        the command behind it is run, with no menu walk and no focus
        taken. The reply names the ``command`` and ``params`` used. A
        path the install does not declare is refused with
        UNMAPPED_MENU_PATH and the nearest matches.

        Args:
            menu_path: Menu path using pipe separators (e.g., "File|Save All")

        Returns:
            Dictionary with dispatched, outcome_verified (always false),
            menu_path, and the process used. A reply the bridge could not
            parse is reported as a failure, not smoothed into a success.
app_set_intent tool
Tell the dashboard what high-level task the agent is working on.

        The text is written to ``workspace/intent.txt`` where the web
        dashboard polls it and shows a banner. Purely informational --
        does not affect tool dispatch in any way. Call this once at the
        start of a long task ("reviewing buck-converter feedback divider",
        "auto-placing the analog front-end on sheet B") so the user
        watching the dashboard knows what's happening between IPC
        events. Pass an empty string to clear the banner.

        Args:
            intent: Short human-readable description (one line, <=240 chars).

        Returns:
            ``{"ok": true, "intent": "<truncated text>"}``.
app_get_clipboard tool
Get text content from the Windows clipboard.

        Returns whatever text is currently on the clipboard, which can be
        useful for reading data copied from Altium dialogs or reports.

        Returns:
            Dictionary with "text" containing the clipboard content.
            Returns empty string if clipboard is empty or non-text.
audit_find_inconsistent_track_widths tool
Find nets where the maximum and minimum track widths differ
        by more than 2×.

        Classic bug pattern: a power rail (VCC / VDD / GND) is routed
        at 20 mil to handle the expected current, then later someone
        adds a connection using the editor's default 8 mil width and
        moves on. The result is a thin orphan stub welded to a wide
        bus -- under load that thin section becomes a thermal hotspot
        and eventually a fab rework. Most agents and human
        reviewers miss it because the bulk of the net looks fine.

        Algorithm: per net, collect min/max track widths on signal
        layers. Ratio > 2.0 → flag. Per-violation reports the actual
        widths and the (x, y) of the *thinnest* track on the net so
        the agent can jump straight to the questionable section.

        Pattern: SDK-derived. No community-script reference.

        Returns:
            Dict with ``{checked, violations, items[]}`` where each
            item carries ``{net, min_width_mils, max_width_mils,
            ratio, thin_x_mils, thin_y_mils}``.
audit_find_acute_angles tool
Find pairs of same-net tracks meeting at < 90° interior
        angle.

        An acute inside corner can over-etch. Pure geometry on signal
        layers, independent of Altium's acute-angle rule, which is often
        off; at most 100 are listed.

        Returns:
            Dict with ``{checked, violations, items[]}`` where each
            item carries ``{net, layer, x_mils, y_mils, angle_deg}``.
audit_find_placeholder_values tool
Find SCH component parameters containing obvious "I'll
        fix this later" placeholder strings that escaped a release.

        Matched values (case-insensitive, whole-string after trim):
          - ``TBD``, ``TBA``
          - ``TODO``, ``FIXME``, ``XXX``
          - ``?``, ``??``, ``???``
          - ``PLACEHOLDER``, ``FILLER``, ``ASK``, ``UNKNOWN``
          - ``N/A``, ``NA``

        Every parameter of every component in the project; empty values
        are left to other audits such as ``audit_find_missing_datasheets``.

        Returns:
            Dict with ``{checked, violations, items[]}`` where each
            item carries ``{designator, parameter, value}`` for a
            component parameter that matched a placeholder pattern.
            ``checked`` counts ALL parameters inspected.
audit_find_orphan_power_objects tool
Find schematic power-port markers (GND, VCC, +3V3 etc.)
        sitting off-wire.

        Symmetric cousin to ``audit_find_orphan_net_labels``. A power
        port carries its net name (from the marker's Style); the
        marker has to sit ON a wire for the wire to actually adopt
        that net. Markers in empty space create phantom power
        connections -- the schematic LOOKS like the rail is hooked
        up, but the wire underneath is unrelated.

        ERC sometimes catches this when the wire ends up with no
        driver, but power rails frequently have multiple drivers
        (the real connection elsewhere, plus this phantom), so ERC
        sees a valid net and stays quiet.

        Spatial-iterates a 1-mil square at each ``ePowerObject``
        location for any ``eWire``; absence → orphan.

        Pattern: SDK-derived, mirrors the orphan-net-label check.

        Returns:
            Dict with ``{checked, violations, items[]}`` where each
            item carries ``{net, sheet, x_mils, y_mils}`` for an
            orphan power object. ``net`` comes from the marker's
            ``Text`` (its visible net name).
audit_find_orphan_net_labels tool
Find schematic net labels whose location is NOT on any
        wire or bus.

        In Altium, a net label labels whichever wire passes through
        its (x, y). If the label sits in empty space (because the
        wire was moved during a layout pass, or was never placed),
        the compile produces a phantom net -- the label looks correct
        on paper but the signal it "names" connects to nothing under
        the label. ERC sometimes catches this (no driver / no load)
        but not always -- the other end of the same-named net often
        provides a load, so the violation never fires.

        Spatial-iterates a 1-mil square at each net label's location
        for any ``eWire`` / ``eBus`` object. Absence → orphan.

        Pattern: SDK-derived. No community-script reference; surfaced
        by reviewing the ``ISch_NetLabel`` interface in the Altium
        Schematic API docs.

        Returns:
            Dict with ``{checked, violations, items[]}`` where each
            item carries ``{label, sheet, x_mils, y_mils}`` for an
            orphan net label.
audit_find_net_label_conflicts tool
Find net labels that silently merge, short, or do nothing.

        All three look correct on a printed sheet:

        1. ``conflicting_labels``: different text at the same point.
           Altium merges the nets under one name, a real short; the
           symptom is a net with zero pins.
        2. ``labels_on_pin_root``: a label on a pin's body-side root
           instead of its electrical end, so it connects nothing. Each
           item gives ``connect_x_mils`` / ``connect_y_mils`` to move it
           to.
        3. ``duplicate_labels``: the same text twice at one point;
           harmless, but it can hide a conflict.

        ``audit_find_orphan_net_labels`` checks only for a wire under
        the label, so it calls a label on a pin end an orphan.

        Returns:
            Dict with ``{checked, conflicts, on_pin_root, duplicates,
            conflicting_labels[], labels_on_pin_root[],
            duplicate_labels[]}``.
audit_find_visible_supplier_pn tool
Find schematic components with a VISIBLE supplier-PN
        parameter.

        BOM hygiene rule: only the manufacturer's MPN should appear
        on the SCH PDF. Supplier part numbers (Digi-Key, Mouser,
        Newark, Arrow, RS, Farnell) change over time -- a Digi-Key
        bin gets retired, the part is re-binned under a new
        Digi-Key SKU, and an SCH PDF saying "Digi-Key 296-1234-1-ND"
        sends the next person picking the BOM five years from now
        on a wild goose chase. Manufacturer + MPN is stable;
        supplier PNs are not.

        Detects any component parameter whose name starts with
        "supplier" (case-insensitive) AND ``IsHidden=False``. Catches
        the legacy "Supplier Part Number 1" along with any free-text
        "Supplier" / "Supplier 1" variants designers create.

        Returns:
            Dict with `{checked, violations, items[]}` where each item
            carries `{designator, parameter, value}` for a visible
            supplier-PN parameter. Pair with `sch_set_components_parameters`
            to hide them in bulk.
audit_find_unlocked_component_primitives tool
Find placed components whose internal primitives are NOT
        locked. Unlocked primitives are a silent fab-bug class --
        a stray click + drag in the PCB editor moves a single pad
        off-center within the footprint without any warning. The
        gerbers look fine, just slightly off, and the part doesn't
        solder properly because the pad no longer aligns with the
        device's lead.

        Library footprints ship with PrimitiveLock=True by default;
        components show up unlocked when someone clicked Component
        Properties and toggled the flag off (sometimes deliberately
        to nudge silkscreen, more often accidentally).

        Returns:
            Dict with `{checked, violations, items[]}` where each item
            carries `{designator}` for an unlocked component. Pair
            with `obj_modify` and `items` to re-lock at scale.
audit_find_stale_read_paths tool
Find board objects a search by area or a net's list misses.

        A write that reported success can still leave one of the ways of
        finding an object behind, hiding it from a later read, the DRC or
        a pour.

        Per object: the spatial index holds it over its own bounding box
        (searches by area, Altium's online DRC, pours and picking use the
        index), and an object reporting a net is in that net's list
        (connectivity, the ratsnest and pours use the list). Per type: the
        index holds as many objects as a board walk finds.

        Args:
            board_path: The board to check; the focused board when empty.
            types: Comma-separated type names to check (track, arc, via,
                pad, fill, region, text, component_body, component,
                polygon); all of them when empty.
            limit: Most items to list.

        Returns:
            ``checked``, ``violations`` (the sum of the three below),
            ``stale_index``, ``stale_net``, ``count_mismatches``,
            ``counts`` (``{type, board, index}`` per type) and ``items``
            (``read_path`` "index" or "net", type, layer, box in mils).
audit_find_mirrored_pcb_text tool
Find free-floating PCB text (eTextObject) that's mirrored
        on the wrong overlay.

        Rule: top-overlay text must read normally; bottom-overlay
        text must be mirrored. When the assembled board is flipped to
        access the bottom side, the bottom text reads correctly. A
        normally-oriented bottom-side text reads backwards on the
        physical board -- the kind of thing that gets caught only at
        the fab-review stage by the customer's QA, then triggers
        a respin.

        Note: this checks free-floating text (revision strings, layer
        labels, copyright notices) -- NOT component designators or
        comments, which Altium auto-flips with the component.

        Returns:
            Dict with `{checked, violations, items[]}` where each item
            carries `{text, layer, reason}`. ``reason`` is one of
            `top_overlay_text_is_mirrored` or
            `bottom_overlay_text_is_not_mirrored`.
audit_find_non_embedded_images tool
Find schematic images that are NOT embedded -- they hold
        only a path reference to the original file.

        Non-embedded images render fine on the designer's own machine
        but show a red X / placeholder box on every other machine that
        opens the schematic, because the path doesn't resolve. Common
        offenders are company-logo title-blocks dragged in from a
        network share and never re-saved with EmbedImage=True. The
        manufacturer / customer sees broken images on the SCH PDFs.

        Returns:
            Dict with `{checked, violations, items[]}` where each item
            carries `{sheet, x_mils, y_mils}` for a non-embedded image.
            ``checked`` counts ALL images (embedded + not), ``violations``
            counts only the non-embedded ones.
audit_find_single_pin_nets tool
Find nets that have EXACTLY ONE pin AND at least one
        net-label / port / power-object on them.

        A single-pin net is normal for unused / no-connect pins.
        A single-pin net **with a named label** is a broken connection:
        the designer asserted "this signal goes somewhere" by naming it
        but the other end never made it onto the schematic. Common
        causes are a typo in a net-label that doesn't match its peer,
        a sheet-entry vs port-name mismatch on a hierarchical block,
        or an off-page connector that was deleted while routing was
        being re-arranged.

        The flat hierarchy is queried (`DM_DocumentFlattened`) so nets
        spanning multiple sheets via off-page connectors are counted
        as one net.

        Returns:
            Dict with `{checked, violations, items[]}`. Each item
            carries `{net, designator, pin}` for the lonely pin.
audit_find_mpn_inconsistencies tool
Find groups of ICs with the same (lib_ref, comment) but
        DIFFERENT Manufacturer Part Numbers.

        Two presumably-identical parts pointing at different MPNs is
        almost always a bug: either a typo / accidental override
        during a sub-circuit clone, or means the design genuinely wants
        two sources but lost the alternates table somewhere. The agent
        reviewing the BOM should see this before purchase.

        Pattern: ports the dashboard's analyzeMpnConsistency JS
        heuristic to an authoritative Pascal-side audit.

        Returns:
            Dict with `{checked, violations, items[]}`. Each item
            carries `{lib_ref, comment, mpns, designators}` where
            ``mpns`` is a comma-joined list of the conflicting part
            numbers and ``designators`` lists the components involved.
audit_find_missing_datasheets tool
Find ICs (designator U*) with no fetchable datasheet URL in
        any of their parameters.

        Checks the standard Altium slots:
          - HelpURL, Datasheet, DatasheetURL
          - ComponentLink1URL..ComponentLink4URL

        At least one of those needs to carry an ``http(s)://`` value
        for the IC to count as covered. The agent's review discipline
        requires fetching the actual manufacturer datasheet before
        making any device-related claim: ICs without a stored URL
        force the agent to web-search the part name, which is slower
        and more error-prone than a direct link.

        Pattern: ports the dashboard's pickDatasheetLinks heuristic to
        an authoritative Pascal-side audit.

        Returns:
            Dict with `{checked, violations, items[]}` where each item
            carries `{designator, comment, lib_ref}` for an IC missing
            any datasheet link.
audit_find_missing_decoupling tool
Find ICs whose power pins lack a nearby decoupling cap.

        For every IC, identify its power pins (by net name or by pin
        name pattern). For each power pin, check if any capacitor
        (designator C*) shares the same net. Buckets:

          - ``missing``: no power pin has any cap on its net (worst)
          - ``partial``: some power pins covered, some not

        ICs with full coverage are not surfaced (no problem to fix).
        ICs with NO recognised power pins are skipped (we can't
        distinguish "no power needed" from "couldn't detect").

        Catches the single most-skipped pre-release review check: a
        missing local bypass doesn't fail ERC, doesn't fail DRC, but
        bites at first power-on with brown-outs / random resets.

        Pattern: ports the dashboard's JS-side analyzeDecoupling.

        Returns:
            Dict with `{checked, violations, items[]}` where each item
            is `{designator, status, covered_pin_count, uncovered_pins[]}`.
            ``status`` is ``missing`` or ``partial``. ``uncovered_pins[]``
            lists each `{pin, name, net}` that needs a cap.
audit_component_param_visibility tool
Check that every placed component shows the parameters its class
        requires for a legible schematic and a procurable BOM.

        Per class, by designator: C* shows a value ending in ``F`` and a
        voltage ending in ``V``; R* a value ending in ``R``, ``k``, ``M``
        or ``m``; L* an inductance ending in ``H`` and a saturation
        current ending in ``A``; U* a visible parameter whose name starts
        with ``Manufacturer Part Number``.

        A visible parameter or the Comment satisfies a rule; a hidden one
        does not. Runs on the compiled (flattened) tree, so hierarchical
        and multichannel designs are covered.

        Returns:
            Dict with:
              - ``checked``: how many components matched a known class
              - ``violations``: how many of those have at least one
                missing required value
              - ``items``: list of `{designator, class, missing[]}`
                violation entries. ``missing`` enumerates which required
                fields are absent (``capacitance``, ``voltage``,
                ``resistance``, ``inductance``, ``saturation_current``,
                ``mpn``).
audit_power_port_orientation tool
Check that schematic power-symbol orientations follow the standard
        convention so reviewers' eyes can scan the sheet quickly.

        Rules:
          - Ground symbols (``ePowerGndPower``, ``ePowerGndSignal``,
            ``ePowerGndEarth``) MUST face down (Orientation = 270deg).
          - Power bars (``ePowerBar``, used for VCC/VDD/V+ rails)
            MUST face up (Orientation = 90deg).

        Stylistic but high signal: a flipped ground symbol or a sideways
        rail is invariably an editing accident, and one violation can hide
        a real wiring issue under it because the eye keeps wanting to fix
        the orientation first.

        Returns:
            Dict with:
              - ``checked``: total power-symbols inspected (grounds + bars)
              - ``violations``: count with wrong orientation
              - ``items``: list of ``{text, style, expected, actual, sheet}``
audit_tented_via_ratio tool
Count tented vs untented via SURFACES on the active board and
        report the tented ratio.

        Untented vias expose the via barrel through solder mask; in humid
        or salt-spray environments that risks acid traps and copper
        corrosion. For consumer boards spec is usually "all vias tented
        top + bottom"; for prototyping boards a lower ratio is fine.

        Counts top and bottom surfaces separately (a via reaching only the
        top layer contributes one surface, a through-via two). Buried /
        blind via surfaces that don't reach an outer layer are ignored.

        Returns:
            Dict with:
              - ``total_surfaces``: tented + untented (denominator)
              - ``tented``: surfaces with tenting on
              - ``untented``: surfaces with tenting off
              - ``ratio``: tented / total (0.0 - 1.0; 1.0 = all tented)
              - ``violation_pct``: untented / total * 100
audit_find_floating_ports tool
Find schematic ports that aren't actually connected to anything.

        On each schematic sheet a port is "floating" if its net does not
        appear on any component pin OR any sheet-symbol entry on the same
        sheet. A floating port is usually an editing leftover (renamed a
        net but forgot to retag the port) or a never-completed hookup --
        ERC can miss these when the port carries a valid net-label tag
        that just doesn't connect to anything physically.

        Walks the compiled / flattened doc tree so multichannel /
        hierarchical designs are covered.

        Returns:
            Dict with:
              - ``checked``: total port objects inspected
              - ``violations``: floating-port count
              - ``items``: per-violation `{net, sheet, location}`
audit_find_bad_connections tool
Find PCB tracks / arcs with endpoints that are close to another
        same-net primitive but don't actually touch.

        An end of a signal-layer track or arc with no same-net track,
        arc, pad or via within ``tolerance_mils`` is dangling: it can look
        connected and still be an open on the fabricated board, and DRC
        does not reliably catch it. Teardrops, component primitives,
        unnetted copper and full circles are skipped.

        Args:
            tolerance_mils: Coord tolerance in mils. 0 = exact match required
                (rare, since router can place tracks on sub-mil grid).
                Defaults to 1 mil; bump to 5 or 10 to surface
                gross misalignments only.

        Returns:
            Dict with:
              - ``checked``: track + arc primitives inspected
              - ``violations``: primitives with at least one dangling endpoint
              - ``tolerance_mils``: echo of the tolerance used
              - ``items``: per-violation `{kind, layer, net, at}` where
                ``at`` is the dangling endpoint's "(x,y)" in mils
audit_find_signal_vias_without_return tool
Find signal vias that have no nearby ground / power via for
        return-current flow.

        A signal via changing layers needs its return current to cross
        too; this flags signal vias with no ground or power via within
        ``radius_mils``. Ground and power are guessed from the name
        (starts with GND, V, + or -, or contains GND). A proximity check
        only, not aware of the stackup.

        Args:
            radius_mils: How close a return via must be. Default 50.

        Returns:
            Dict with:
              - ``checked``: signal vias inspected (non-power/ground)
              - ``violations``: signal vias with no return via in range
              - ``radius_mils``: echo of radius used
              - ``items``: per-violation `{net, at}` where ``at`` is
                "(x,y)" mils of the offending signal via
audit_find_components_outside_board_outline tool
Find PCB components whose origin sits outside the board outline.

        Editing accident catch: the user grabbed a component and moved
        it off the PCB by mistake. Usually invisible during normal
        review because the component is off-canvas; DRC doesn't catch it
        (DRC is between primitives, not "is this object on the board").

        Uses ``IPCB_BoardOutline.PrimitiveInsidePoly`` for the actual
        polygon-inside test, so non-rectangular boards are handled
        correctly.

        Pattern: brett's SelectCMPInOutSideBOL.pas.

        Returns:
            Dict with:
              - ``checked``: total components inspected
              - ``violations``: components outside the outline
              - ``items``: per-violation `{designator, layer, at}` with
                ``at`` = "(x,y)" mils.
audit_find_off_grid_components tool
Find schematic components placed off the snap grid.

        Schematic best practice: components sit on a 100-mil (or whatever
        the project standard is) grid so pins land predictably on wire
        endpoints. Off-grid placement is the classic "I edited around it
        and never resnapped" trap: the symbol LOOKS wired but the pin
        doesn't actually touch the wire, ERC silently passes (no visible
        net) and the connection is missing on the netlist.

        Args:
            grid_mils: Grid size to check against (default 100). Use 50
                if your sheets are set to a half-step grid.

        Returns:
            Dict with:
              - ``checked``: total placed components inspected
              - ``violations``: off-grid component count
              - ``grid_mils``: echo of the grid used
              - ``items``: per-violation `{designator, sheet, at, dx,
                dy}` where ``dx``/``dy`` are the off-grid magnitudes in
                mils. Snap to ``-dx`` / ``-dy`` (or whichever direction
                is closer) to restore grid alignment.
audit_find_designator_collisions tool
Find schematic components that share a designator across sheets.

        Annotation should make every designator unique across the project,
        but paste-from-another-sheet operations and post-annotate edits
        can leave duplicates that the agent / reviewer want to surface
        before they hit ERC.

        Walks source schematic sheets (not compiled docs: compiled
        flattening would auto-disambiguate multichannel instances with
        channel suffixes, hiding the real source-level collision).

        Returns:
            Dict with:
              - ``checked``: total components inspected
              - ``violations``: count of distinct designators that occur
                more than once
              - ``items``: per-collision `{designator, count, sheets}`
                where ``sheets`` is a comma-joined sheet-filename list
audit_find_via_antennas tool
Find vias connected on only one layer (resonating stubs).

        A via connected on one layer is an open stub, often left when the
        trace on its other side was rerouted. Connected means copper
        touching it on a signal layer, or a plane connection. Lists them;
        selects nothing.

        Returns:
            Dict with:
              - ``checked``: total vias inspected
              - ``violations``: antenna-via count
              - ``items``: per-violation `{net, at, connected_layers}`
                where ``at`` is "(x,y)" mils and ``connected_layers``
                will always be 1.
audit_find_unmatched_ports tool
Find schematic nets with port-direction mismatches across sheets.

        Catches the two cases that matter most:

          - **multi_output**: a net has MORE THAN ONE Output port. Two
            drivers fighting for the same net: almost always a wiring
            error or copy-paste mistake.
          - **no_driver**: a net has Input ports but ZERO Output (or
            Bidirectional) ports anywhere in the project. Orphan signal:
            something is listening but nothing is talking.

        Walks compiled docs so multichannel designs are covered. Ports
        are grouped by their flattened net name, so net-label renames
        keep ports correctly clustered.

        Returns:
            Dict with:
              - ``checked``: total port objects inspected
              - ``violations``: net count with at least one issue
              - ``items``: per-net `{net, issue, output_count,
                input_count}`. ``issue`` is ``multi_output`` or
                ``no_driver``.
audit_variant_not_fitted tool
List components marked Not Fitted in the project's CURRENT variant.

        Not-fitted parts should get no stencil paste.
        ``pcb_apply_dnp_paste_exclusion`` removes it, after this list has
        been reviewed.

        Returns:
            Dict with:
              - ``variant``: the current variant's description (empty
                when the project has no variant selected: DNP only
                applies to a variant)
              - ``checked``: total flattened-project components
              - ``violations``: how many are NotFitted in this variant
              - ``items``: per-violation `{designator, comment, unique_id}`
audit_find_invalid_regions tool
Find PCB polygon regions whose area is zero or unset.

        These are leftover from cancelled polygon-pour operations or
        corrupted file imports. They don't render visibly but can throw
        DRC violations under "Modified Polygon" rules and bloat board
        size. Read-only: this tool only surfaces them. Auto-delete
        belongs in a separate user-confirmed mutating flow because
        misclassification could remove a real (legitimately small)
        region.

        Returns:
            Dict with:
              - ``checked``: regions inspected (skips primitives owned
                by components or dimensions)
              - ``violations``: invalid-region count
              - ``items``: per-violation `{layer, at}`
pcb_calc_impedance tool
Characteristic impedance of a PCB trace (IPC-2141 / Wadell).

        The forward direction of ``pcb_calc_trace_width_for_impedance``:
        instead of "how wide for 50 ohms?", it answers "what impedance
        does this width give?". Pure physics, no EDA tool involved.

        Measured against a live editor: this existed only on the Altium
        backend,
        so KiCad and EasyEDA users could size a width for a target but
        could not check an existing one. The signature and reply match
        the Altium tool exactly, and both now compute through
        design/impedance_sizing, so the two backends cannot answer
        differently.

        Accuracy is the usual closed-form +/-10 percent; a fab's field
        solver refines it against the real stackup.

        Args:
            geometry: microstrip / microstrip_diff / stripline /
                stripline_diff.
            width_mils: trace width.
            dielectric_height_mils: for microstrip the height above the
                reference plane; for stripline the FULL thickness
                between the two planes.
            dielectric_constant: er, 4.2 for common FR-4.
            copper_oz: copper weight; 1 oz is 1.378 mils finished.
            spacing_mils: edge-to-edge gap, required for the _diff
                geometries.

        Returns:
            {ok, geometry, width_mils, dielectric_height_mils,
             dielectric_constant, thickness_mils, z0_ohms,
             propagation_delay_ps_per_inch}, plus spacing_mils and
            zdiff_ohms for a differential geometry.
pcb_calc_trace_width_for_impedance tool
Trace width (mils) to hit a target impedance for a geometry
        (microstrip / stripline / their *_diff variants). Differential targets
        need spacing_mils. Inverse of the IPC-2141 impedance formula.
pcb_calc_termination tool
Assess whether a net is electrically long for its edge rate and, if
        so, recommend a termination (series for point-to-point, Thevenin /
        parallel for a multi-load bus) with E24 values.

        Args:
            length_mils: routed length of the net.
            rise_time_ns: driver edge rate.
            z0: characteristic impedance in ohms. The Altium build
                spells this ``z0_ohms``; either is accepted.
            er: dielectric constant, spelled ``dielectric_constant`` on
                the Altium build; either is accepted.
            geometry: ``microstrip`` or ``stripline``.
            driver_impedance: driver output impedance in ohms, also
                spelled ``driver_impedance_ohms``.
            vcc: supply rail, for Thevenin values.
            width_mils: trace width, if the propagation delay is to be
                derived rather than assumed.
            height_mils: dielectric height, also spelled
                ``dielectric_height_mils``.
            multi_load: true for a bus with several receivers.
            z0_ohms: alias for ``z0``.
            dielectric_constant: alias for ``er``.
            driver_impedance_ohms: alias for ``driver_impedance``.
            dielectric_height_mils: alias for ``height_mils``.
pcb_calc_length_match tool
Resolve the effective Er and a match tolerance from a skew budget (or
        match_fraction * rise_time_ns), then optionally report a group of net
        lengths against it.
pcb_calc_thermal_vias tool
Size a thermal-via field for a target thermal resistance (given
        directly, or as power_w with a delta_t_c budget), or score an existing
        via_count. Fourier conduction, R = L/(k*A).

        Args:
            drill_mm: via drill diameter, in mm.
            plating_um: barrel plating thickness, in microns.
            length_mm: conduction length, which for a via through the
                board is the board thickness. The Altium build spells
                this ``board_thickness_mm``; either is accepted.
            filled_copper: whether the barrels are copper filled.
            power_w: power to remove, in watts.
            delta_t_c: permitted temperature rise, in Celsius.
            target_k_per_w: thermal resistance target, given directly.
            via_count: score this many vias instead of sizing a field.
            board_thickness_mm: alias for ``length_mm``.
pcb_calc_trace_width_for_current tool
Minimum track width (mils) to carry a current at a temperature rise
        (IPC-2221), widened by ``margin`` and snapped to a 0.1 mil grid.

        Args:
            current_a: the current to carry, in amps. The Altium build
                spells this ``current_amps``; either is accepted.
            copper_oz: copper weight in ounces.
            delta_t_c: permitted temperature rise, in Celsius.
            layer: ``external`` or ``internal``.
            margin: fractional widening applied to the IPC result.
            length_mils: run length, for the voltage-drop figure.
            current_amps: alias for ``current_a``.
pcb_calc_track_current_capacity tool
Forward IPC-2221: the current a track of this width sustains at a
        given temperature rise.
pcb_calc_reactance tool
Reactance of an inductor and/or capacitor at a frequency.

        SI units so a value is never off by a prefix: 10 nH is 10e-9,
        100 nF is 100e-9. Exact (X_L = 2 pi f L, X_C = 1/(2 pi f C)).
pcb_calc_resonance tool
Resonant frequency and characteristic impedance of an LC pair,
        in henries and farads. Exact.
pcb_calc_wavelength tool
Wavelength and quarter wave at a frequency, and the electrical
        length of ``length_mils`` in degrees. ``er_eff`` is the effective
        permittivity: the laminate's Dk for stripline; a microstrip's is
        lower and geometry dependent, so give it. Exact.
pcb_calc_pdn_target_impedance tool
The power network's target impedance: allowed ripple over the
        load's current step. The step is the device datasheet's to give;
        nothing here assumes a share of the full current. Exact.
pcb_calc_wire_gauge tool
AWG size: diameter, area and kcmil for a gauge (-3 for 0000 up
        to 40), or the nearest gauge for a diameter. Exact (ASTM B258).
pcb_calc_fusing_current tool
Current that melts a copper conductor in ``seconds``
        (Onderdonk, in Brooks and Adam's 2015 form).

        Adiabatic, so a LOWER bound for a trace on a board: Brooks and
        Adam's simulations of traces on FR-4 carry 2 to 6 times more. Not
        valid beyond about 10 s. Give the cross-section, or width and
        copper weight.
pcb_calc_via_inductance tool
Loop inductance a via adds between two planes, with its return
        (ground via or plane capacitor) ``return_spacing_mils`` away,
        centre to centre (Johnson, 'Via Inductance II', within about 10 %
        of his measurements). Only the interplane part.
pcb_calc_spiral_inductance tool
DC inductance of a planar spiral: square, hexagonal, octagonal
        or circle (Mohan, Hershenson, Boyd, Lee, IEEE JSSC 1999), by the
        modified Wheeler and the current-sheet expressions. Give
        inner_mils, or width and spacing to work it out.
pcb_calc_padstack tool
Smallest pad and inner-layer clearance a fab builds around a
        hole, from its published ring and hole-to-copper figures, each
        quoted (design_list_fab_vendors). ``kind`` is "via" or "pth"; a
        figure the fab does not publish is said so, not filled in.
footprint_read_ipc_name tool
Decode an IPC-7351 footprint name into its package, in mm.

        CAPC1005X55N: a 1.0 x 0.5 mm chip, 0.55 mm high. SOT95P280X130-5N:
        five pins at 0.95 mm pitch across 2.80 mm, 1.30 mm high.
        QFN50P400X400X100-21N: 21 pads at 0.50 mm on a 4 x 4 mm body.

        Returns:
            ``ipc_name`` (whether it decodes) and the numbers: ``family``
            (chip, two-sided, four-sided), ``pins``, ``pitch``, ``span``,
            ``length``/``width``, ``height`` and ``density``.
lib_verify_ipc_names tool
Check that every footprint with an IPC-7351 name has the pads the
        name claims: the pin count and, for leaded packages, the pitch.

        Footprints whose names are not IPC names are listed separately, not
        failed. The library is read through Altium and not changed.

        Args:
            library_path: The .PcbLib.
            footprints: Just these; all of them by default.
            limit: The most footprints read.

        Returns:
            ``checked``, ``mismatched`` (each with ``issues``), ``matched``,
            ``not_ipc_names`` and ``cut_short``.
lib_check_naming tool
Check names against the company naming policy (naming.json in
        EDA_AGENT_POLICY_DIR); without one nothing is enforced.

        Args:
            kind: footprint, symbol or component.
            names: The names to check; or library_path to take them from a
                .PcbLib (footprints) or .SchLib (symbols).
            library_path: The library to take names from.

        Returns:
            ``checked``, ``off_policy`` ({name, why}) and the ``pattern``.
lib_make_name tool
Build a name from the naming policy's template for a kind and check
        it against the policy's pattern.

        Args:
            kind: footprint, symbol or component.
            tokens: Values for the template, e.g. {"mpn": "TPS62130RGTR",
                "manufacturer": "Texas Instruments"}; a manufacturer gives
                ``mfr_short`` from the policy's abbreviations.
lib_read_pin_table tool
Check a pin table copied from a datasheet and turn it into symbol pins.

        CSV with the header ``number,name,type``, optionally ``side``
        (left, right, auto) and ``description``. Types: input, output, io,
        bidirectional, passive, power, open_collector, open_emitter, hiz,
        and the usual short spellings. ``left_pins`` and ``right_pins`` go
        straight to lib_create_ic_symbol. Compare the table with the
        datasheet page it came from before trusting it.

        Args:
            table_csv: The table.
            package_pins: The package's pin count, to catch a missing pin.

        Returns:
            ``ok``, ``errors`` (unusable as it is), ``warnings`` (worth a
            look), ``pins``, and ``left_pins`` / ``right_pins``.
design_check_company_rules tool
Check the open design against one of the company's rules files.

        Rules files are JSON in ``rules/`` under EDA_AGENT_POLICY_DIR; an
        empty ``rules`` lists them. Rules given as an object are checked
        for mistakes and then run, so a file can be tried before it is
        saved. Check kinds: params_present, param_matches, param_not_in,
        prefix_for_symbol, net_names, no_lone_pins, net_has_part,
        board_rule_present, parts_on_side, and note (guidance that never
        passes or fails).

        The design is read through Altium (BOM, parameters, nets, and the
        board's parts and rules when a board is open); ``data`` stands in
        for that read. A check whose input could not be read is listed in
        ``not_run`` and never counts as passed.

        Returns:
            ``passed`` (no error-level finding), ``tally``, ``findings``,
            ``notes``, ``not_run``, and ``remarks`` about the read.
design_read_rules_export tool
Read an Altium design-rules export (.RUL): one record per rule,
        with its fields as Altium wrote them (they differ by rule kind and
        version). Reads only the file; the open board's own rules come from
        pcb_get_design_rules.
pcb_apply_policy_rules tool
Bring the active board's design rules to the policy's
        board_rules.json (in EDA_AGENT_POLICY_DIR).

        Rules the board lacks are created; rules it has are rewritten to
        the policy's values and read back. Rules the policy does not list
        are only named in ``extra``; nothing is deleted. Running it again
        changes nothing new.

        Args:
            apply: False (default) only reports what it would do.

        Returns:
            ``create``, ``update`` (each with ``write`` and ``differs``, the
            readable fields that differ now) and ``extra``; with apply,
            ``results`` per rule and ``failed``.
proj_apply_policy_erc tool
Bring a project's ERC levels to an ERC set in the policy
        folder: erc_levels.json, or erc_levels/<set_name>.json, with the
        sets it extends folded in.

        Args:
            set_name: The named set; "" for erc_levels.json.
            apply: False (default) only reports the differences.
            project_path: The .PrjPcb. Default: the focused project.

        Returns:
            ``chain`` (files merged, base first), ``change``, ``same``,
            ``unknown`` (types the project does not list); with apply,
            the write's reply in ``applied_reply`` and ``saved``.
design_apply_policy tool
Run every part of the policy folder that can be applied: the
        board rules (needs a board open) and the ERC set (needs a project).
        A part the policy does not define is ``skipped``; one that fails
        does not stop the other.

        Args:
            apply: False (default) only reports.
            erc_set: The ERC set's name; "" for erc_levels.json.
            project_path: The .PrjPcb for the ERC set.

        Returns:
            ``board_rules`` and ``erc_levels`` replies, and ``skipped``,
            ``failed`` and ``ok`` (no part failed).
design_compare_plans tool
Compare two DesignPlans: parts new, dropped or edited (library
        reference, value, footprint, maker, part number, sheet), nets new,
        dropped or rewired, and pins that changed net.

        Review an edit before drawing it, or hold a plan read back from the
        sheets (design_plan_from_sheet) against the plan it was drawn from.
proj_import_from_kicad tool
Rebuild a KiCad project in Altium: libraries, schematic, board.

        Altium draws everything through this server's own tools: each
        symbol and footprint the project uses, as KiCad draws it (no grid
        snapping), into a SchLib and PcbLib of the new project's own, then
        every sheet from a template (parts where KiCad put them,
        mirrored as there, wires, power ports, net labels, ports, sheet
        symbols and entries, No ERC markers, the parts' fields), then the
        board (outline, layer stack, parts on their side and angle, tracks,
        arcs, vias, zones as pours, net classes and their rules). KiCad's
        files are only read. Global labels become power ports.

        Checks: every symbol and footprint read back from the new
        libraries against KiCad's own (pins, body drawing, pads, drills,
        drawing layers); any difference stops the import before a sheet is
        drawn and is listed in ``libraries.differences``, to be fixed, not
        passed over. Altium's compiled netlist against KiCad's (kicad-cli), pin
        group by pin group (``nets.same``); every pad read back against
        KiCad's centre (``board.pads``); a DRC (``board.drc``). Copper
        takes the Altium name of the net its pads are on
        (``board.renamed_nets``).

        Args:
            kicad_project: The .kicad_pro, its root .kicad_sch, or its
                folder.
            output_dir: An empty folder for the Altium project.
            dry_run: Only plan (default): step counts, what is not
                carried, and each sheet's template checked against KiCad's
                own pin positions (``sheets``), with Altium untouched.
            kicad_cli: kicad-cli.exe for the netlist check; empty = the
                newest KiCad installed.

        Returns:
            ``ok``, ``project`` (the .PrjPcb), ``stages`` (each with
            ``done``/``of`` and the step that failed, if one did),
            ``sheets``, ``warnings`` and ``nets``.
proj_convert_to_kicad tool
Export a KiCad copy of an Altium project, for sharing or review.

        For handing a design to someone who works in KiCad, or reading it
        there; the Altium project stays the design. KiCad's own Altium
        importer brings the project in (kicad.exe is driven through its
        import dialogs). The copy is then tidied so it can be used as it
        is:
        - one symbol per part in project libraries;
        - power ports as power symbols;
        - Value, Footprint and Datasheet filled in;
        - sheets on the 1.27 mm grid, wire stubs trimmed;
        - a flat project given a root sheet;
        - board nets named as the schematic names them;
        - rules, stack-up and net classes read from the open Altium board;
        - footprints in project libraries, mechanical layers mapped by kind;
        - pours filled with Altium's neck width and island removal;
        - Altium's variants as KiCad variants (not fitted = DNP, varied
          values as field values).
        The Altium files are only read.

        Every step is checked against the pin-to-net map. ``ok`` is true
        only when the schematic, the board and Altium's own compiled
        netlist put the same pins together. Takes a few minutes: KiCad
        opens on screen while it imports.

        Args:
            output_dir: An empty folder for the KiCad project.
            project_path: The .PrjPcb; empty = the focused project.
            board_path: Its .PcbDoc; empty = the project's only board.
            kicad_cli: kicad-cli.exe; empty = the newest KiCad installed.
            remove_title_block: Take out what each sheet's Altium template
                drew (border, title block, logo), found by the template
                objects' own boxes, so what the user drew stays; KiCad
                draws its own.

        Returns:
            ``ok``, ``project`` (the .kicad_pro), ``steps`` (what each step
            did, with the ``check_*`` pin comparisons, ERC and DRC counts
            and the rules not ported), and ``stage`` / ``reason`` when a
            step stopped it.
design_get_discipline tool
Read the design discipline, and on request the DesignPlan schema.

        ALWAYS call this first when starting a design task. The result
        contains the hard rules the planner must follow (datasheet-first
        part choice, NDA isolation, the template method for schematics,
        placement and routing discipline).

        Args:
            include_schema: Also return the DesignPlan JSON schema, which
                the plan tools (design_validate_plan, design_review_plan,
                design_compose_netlist) take. A schematic drawn from
                templates does not need it.

        Returns:
            A dict with ``discipline`` (markdown text) and, when asked,
            ``schema`` (DesignPlan JSON schema as a dict).
design_session_start tool
Open a durable design-session journal for an autonomous run.

        The journal is append-only state that survives context compaction,
        client restarts, and model switches, so any later client can resume
        the run from recorded fact instead of chat history. Call this once at
        the start of a spec-to-board task, then log stage results as you go
        and read `design_session_resume` to know what's next.

        Args:
            requirement: the design requirement text this run implements.
            session_id: optional explicit id; defaults to a timestamp.

        Returns:
            ``{"session_id": ..., "state": {...}}``.
design_session_log tool
Append one event to a design-session journal.

        ``event`` is one of: ``stage_enter`` (needs ``stage``),
        ``stage_result`` (``stage`` + ``status`` = ok|blocked|failed),
        ``plan_revision`` (``revision``), ``artifact`` (``path``, ``kind``),
        ``blocked`` (``question``), ``resolved`` (``text`` = answer),
        ``note`` (``text``). Returns the updated derived state.

        ``data`` (a dict, or JSON text) goes with a ``stage_result`` or a
        ``note``. On a stage_result it is the evidence for the exit gate:
        for placement, routing, pours_tuning and verification, pass the
        ``pcb_layout_audit`` result (and the ``pcb_calc_length_match`` or
        ``proj_run_erc`` reply under its own tool name) and the reply
        carries ``gate``, the verdict on those numbers. A stage logged ok
        whose numbers fail its gate is sent back by
        ``design_next_action``. ``topic`` files a note under a section of
        ``design_session_report``: placement, stackup, critical_routes,
        power, planes (fan-out and via-in-pad too), silkscreen,
        verification, simulation, issue, or decision.
design_session_status tool
Read a design session's derived state (stage map, artifacts, ...).

        With no ``session_id`` the most recently active session is used.
design_session_resume tool
Resume a design run: state plus a plain-language next-action hint.

        Surfaces any open blocking question first (answer it before
        proceeding), otherwise names the next pipeline stage to work on. Use
        this at the start of a fresh client session to pick up where the last
        one stopped.
design_next_action tool
Decide the single next action for an autonomous design run.

        Reads the session journal and returns the next 13-stage pipeline step
        server-side, so a client need not memorize the workflow: loop
        "call design_next_action -> do what it says -> design_session_log the
        result" until ``status`` is ``complete`` or ``blocked``.

        Returns a dict with ``status`` (proceed | retry | blocked | complete),
        the ``stage``, its ``goal``, ``suggested_tools`` (exact tool names),
        the ``exit_gate`` that marks it done, and, on ``blocked``, the
        ``open_question`` to put to the user. Bounded retries: a stage that
        fails repeatedly escalates to ``blocked`` instead of looping forever.

        The layout stages (placement, routing, pours_tuning, verification)
        have measured gates: the reply also carries ``gate``, the numbers
        and the values that pass, and ``last_gate``, the verdict on numbers
        already logged for the stage. A stage logged ok whose logged numbers
        fail its gate comes back as ``retry``, with the failing numbers in
        ``guidance``. A stage logged with no numbers is taken as logged.
design_autonomy_guide tool
The autonomous spec-to-board loop protocol, in one call.

        Returns how to drive a full design run with the harness: the loop
        (start session → design_next_action → execute → log → repeat), the
        13 pipeline stages with their tools and exit gates, the hard
        constraints, and how to resume after context loss. Read this once
        before an autonomous run; `design_next_action` then guides each step.
design_session_report tool
Write up a design run from its session journal, as markdown.

        Assembled only from what the run recorded: the requirement, each
        stage's outcome with the gate numbers logged for it, decisions,
        audit results, simulations and open issues. The body sections come
        in a fixed order: placement strategy, stack-up and impedance,
        critical routes (lengths, skews, layer changes, return vias,
        exceptions), power paths, planes and fan-out (where via-in-pad was
        used and why), silkscreen policy, verification results, simulations,
        open issues. A section nothing was logged for says so in one line.
        Notes reach a section through their ``topic`` (see
        ``design_session_log``).

        Args:
            session_id: the session to report; blank uses the most recently
                active one.
            output_path: also write the markdown to this file. Its folder
                must exist, and a path inside the installed eda_agent
                package is refused. Blank writes nothing.

        Returns:
            ``{"session_id", "markdown", "path"}`` (``path`` is "" when
            nothing was written), or ``{"error": ...}``.
pcb_layout_audit tool
Measure a board for the layout stages' exit gates. Changes nothing.

        Reads the focused board (or a saved LayoutBoard JSON) and runs
        these checks, each with counts and findings in mils:

        - ``placement_audit``: body overlaps, pads under clearance, parts
          on keepouts or off the board.
        - ``connectivity_summary``: routed / partial / unstarted nets.
        - ``drc``: the exact clearance check.
        - ``corner_audit``: bends sharper than 45 degrees.
        - ``track_shape_audit``: staircases (a run drawn as a chain of
          tiny steps) and tracks shorter than their own width that are
          no stub into a pad or via.
        - ``return_via_audit``: signal vias with no ground via within
          ``max_distance_mils``.
        - ``plane_region_audit``: pour copper broken into islands.
        - ``loop_audit``: hot, gate-drive, decoupling, crystal and other
          loops, worst first. Advisory.
        - ``pad_entry_audit``: off-axis, off-centre, too-wide or uneven
          pad entries. Fails only on high severity.
        - ``rotation_audit``: parts whose connections are shorter turned
          90, 180 or 270 degrees, a turn into a neighbour's courtyard
          excluded. Advisory.

        Log the result as ``data`` on the stage_result
        (``design_session_log``).

        Args:
            checks: names from the list above; None runs them all.
            expect_file: full path of the focused board, for a live read;
                refused if another board is focused.
            board_json_path: a saved LayoutBoard (.json or .json.gz) to
                audit offline instead.
            nets: nets for ``return_via_audit``; None checks diff-pair
                and high-speed nets, or every signal via.
            max_distance_mils: return via distance, centre to centre.
            limit: findings listed per kind; counts are never cut.

        Returns:
            ``{"board", "pass", "summary": {check: {pass, counts...}},
            "checks": {check: full result}, "source": "live"|"file"}``, or
            ``{"error": ...}``.
design_job_start tool
Start a long engine run as a background job; returns its id.

        For work that can exceed the MCP tool timeout (routing a dense
        board). Call `design_job_status` with ``wait_seconds`` until it is
        done (nothing notifies you), then `design_job_result`.

        Args:
            kind: registered job kind. Currently: ``route`` (route_plan as
                a job; ``params`` needs a ``geometry`` dict, optional
                ``rules`` / ``nets`` / ``net_classes``).
            params: keyword arguments for the engine.

        Returns:
            ``{"job_id": ..., "kind": ...}`` or ``{"error": ...}`` for an
            unknown kind.
design_job_status tool
Status of a background job (or all jobs if ``job_id`` is blank).

        Nothing tells you when a job finishes, so keep calling this until
        it is done rather than ending your turn: a session that stopped to
        "check when it finishes" was never woken again.

        A running job shows ``elapsed_s`` and ``progress``, the engine's
        latest line (a router's: the round, nets routed, conflicts).

        Args:
            job_id: the job; blank lists every job.
            wait_seconds: hold the call until the job finishes or this
                many seconds pass (capped at 100, inside the client's
                two-minute limit). 0 answers at once.
design_job_cancel tool
Cancel a background job.

        One still waiting never starts. A running one stops at the
        engine's next step (a net routed, a progress line), usually within
        seconds: design_job_status shows ``cancel_requested`` until then,
        and ``cancelled`` after. Nothing a cancelled job made is kept.
        To keep what a long route has made, give it a time limit instead
        (pcb_route_round time_limit_s).

        Args:
            job_id: the job.
design_job_result tool
Fetch a finished job's result payload (None until it's done).

        A router result lists every track and via, which ran to 250,000
        characters on a 61-LED board; the client set it aside in a file
        instead of reading it. So any list longer than a few dozen
        entries comes back as its count and first entries, and the whole
        result is written to ``full_path`` (pcb_autoroute_apply takes the
        tracks from the job itself, not from this reply).

        Args:
            job_id: the job.
            full: return every entry inline, however long.
design_snapshot_inventory tool
Open a list of SchLib files and return what components live in them.

        NDA scope: pass only the user's own neutral standard libraries,
        never project-local libraries from another client engagement.

        The returned set is filtered and capped; the full inventory is
        always written to ``<workspace>/inventory.json``.

        Args:
            library_paths: Absolute paths to .SchLib files to scan.
            name_filter: Case-insensitive substring; keep only components
                whose lib_ref or description contains it (e.g. ``"10k"``,
                ``"NE555"``). Empty = no filter.
            limit_per_library: Cap components returned per library
                (default 60; 0 = unlimited). Each library reports
                ``total`` and ``returned`` so you know if it was capped.
            include_descriptions: False drops the (often long)
                ``description`` from each row. Default True.

        Returns:
            Inventory dict: ``{"libraries": [{"path", "total",
            "returned", "components": [...]}]}``. Each component carries
            lib_ref, designator_prefix, pin_count, description (unless
            suppressed), and footprint when available.
design_validate_plan tool
Validate a candidate DesignPlan JSON against the schema + cross-check.

        Run this before drawing to catch schema problems and
        cross-references that ``sch_draw_template`` would reject. Cheap;
        no Altium round-trip.

        Args:
            plan_json: Either a JSON string of the DesignPlan, or the
                DesignPlan as a JSON object/dict. The MCP framework
                auto-deserializes JSON-object literals to dicts before
                the tool sees them, so both shapes are accepted.

        Returns:
            ``{"ok": True, "summary": "..."}`` on success, or
            ``{"ok": False, "errors": [...]}`` listing the specific
            problems. The planner can read these and revise.
design_list_circuit_blocks tool
List the canonical circuit blocks and their parameter contracts.

        Discoverability for `design_add_circuit_block`: returns every block
        with its summary, required params, optional params (already folding
        in the universal `sheet` / `lib_path` / `pins`), and which nets it
        creates. Call this to author with the exact parameter names instead
        of guessing -- a mistyped optional key is silently ignored by the
        block, so getting the names right up front avoids an incomplete
        part the ERC can't catch. Pure Python, no Altium.

        Returns:
            ``{ok, blocks: [{name, summary, required, optional,
            creates_nets}]}``.
design_add_circuit_block tool
Add a standard sub-circuit to a DesignPlan, wired, in one call.

        It sets the topology (unique refdes, every pin on its net, power
        and ground tagged) and re-validates the plan. You choose every
        part: lib_ref, value, footprint, mpn, datasheet_url in ``params``.
        Nets the block only touches (a pull-up's signal, a divider's rail)
        should already exist in the plan.

        Blocks and required params (all accept pins, refdes_prefix, sheet;
        design_list_circuit_blocks gives the full contract):
          ``decoupling``: power_net, ground_net, lib_ref [count, value]
          ``pullup``: signal_net, rail_net, lib_ref
          ``pulldown``: signal_net, ground_net, lib_ref
          ``series_resistor``: net_a, net_b, lib_ref
          ``voltage_divider``: rail_net, ground_net, lib_ref_top,
            lib_ref_bottom [output_net]
          ``rc_lowpass`` / ``rc_highpass``: input_net, ground_net,
            lib_ref_r, lib_ref_c [output_net]
          ``led_indicator``: anode_net, cathode_net, lib_ref_r,
            lib_ref_led
          ``crystal``: xin_net, xout_net, ground_net, lib_ref, cap_lib_ref
          ``pi_filter``: input_net, ground_net, lib_ref_l, lib_ref_c
          ``mosfet_low_side``: control_net, load_net, ground_net,
            lib_ref_r, lib_ref_fet
          ``mosfet_high_side``: control_net, load_net, rail_net,
            lib_ref_r, lib_ref_fet

        Args:
            plan_json: the DesignPlan as a JSON string or dict.
            block: block name from the list.
            params: block parameters.

        Returns:
            {ok, plan, added: {refdes, nets, extended_nets}, notes,
            validation}; ``plan`` is ready for the next block or for
            drawing. ``ok`` False comes with ``errors``.
design_add_part tool
Add one part and wire its pins to named nets, in one call.

        ``connections`` maps pin to net, as a datasheet pinout reads;
        pins on the same net merge onto it. With
        ``design_add_circuit_block`` and ``design_connect_bus`` this
        builds a whole netlist without raw net JSON. You choose the part
        and the net names.

        Args:
            plan_json: the DesignPlan as a JSON string or dict.
            refdes: the new part's designator (must be free in the plan).
            lib_ref: its library symbol name.
            connections: ``{pin: net_name}`` -- a net is created if absent
                or merged into if present.
            value / footprint / lib_path / sheet / manufacturer / mpn /
                datasheet_url / role: standard Part fields.
            power_nets / ground_nets: net names to flag power / ground when
                this call creates them (an existing net keeps its flags).
            net_roles: ``{net_name: role}`` for nets created here.

        Returns:
            ``{ok, plan, added: {refdes, nets, extended_nets}, notes,
            validation}`` -- same shape as ``design_add_circuit_block``.
            ``ok`` is False on a duplicate refdes / empty connections /
            schema error.
design_connect_bus tool
Wire a parallel bus across two+ parts in one call.

        Joins the i-th pin of every endpoint into one net per bit, so
        bits cannot be misaligned. Creates no parts. A bus of 4 or more
        bits is drawn as a bus.

        Args:
            plan_json: the DesignPlan as a JSON string or dict.
            endpoints: one dict per part on the bus, ``{"refdes": str,
                "pins": [pin, ...]}``. Every endpoint must list the same
                number of pins (the bus width); bit i joins ``pins[i]`` of
                each endpoint.
            net_names: explicit name per bit (length must equal the width);
                omitted -> ``f"{net_prefix}{start_index+i}"`` (D0, D1, ...).
            net_prefix: prefix for auto-named bits.
            start_index: first bit number for auto-naming.

        Returns:
            ``{ok, plan, added: {nets, extended_nets}, notes, validation}``
            -- same shape as ``design_add_circuit_block``. ``ok`` is False
            on a bad endpoint / width mismatch / schema error.
design_compose_netlist tool
Apply many authoring operations to a plan in ONE call.

        Runs the operations in order, each seeing the last one's result,
        and validates once at the end: a whole netlist in one call.

        Args:
            plan_json: the DesignPlan as a JSON string or dict.
            operations: ordered list of op dicts, each with an ``"op"`` key:

                * ``{"op": "add_part", "refdes", "lib_ref", "connections",
                  ...}`` -- plus any optional add-part field (``value``,
                  ``footprint``, ``lib_path``, ``power_nets``,
                  ``ground_nets``, ``net_roles``, ...).
                * ``{"op": "add_block", "block", "params"}`` -- see
                  ``design_list_circuit_blocks`` for each block's params.
                * ``{"op": "connect_bus", "endpoints", "net_names"?,
                  "net_prefix"?, "start_index"?}``.

        Returns:
            ``{ok, plan, added: {refdes, nets, extended_nets}, notes,
            validation}`` for the FINAL plan -- same shape as the single-op
            tools. On a bad operation, ``{ok: False, errors: [...]}`` where
            the message names the failing operation's index.
design_generate_bom tool
Derive the bill of materials from a plan's parts in one call.

        Every design needs a BOM, and it is mechanical to build from parts
        you already authored -- this rolls them up so you do not hand-group
        refdes (redundant with the parts, and easy to miscount). Parts with
        an ``mpn`` consolidate by ``(manufacturer, mpn)`` -- one orderable
        line each; parts without an mpn consolidate by ``(lib_ref, value,
        footprint)`` -- so every 100 nF 0402 cap is one line. Deterministic
        (natural-sorted, R2 before R10). Pure Python, no Altium.

        ``lines_without_mpn`` flags lines that still need a manufacturer
        part number before the BOM is orderable -- the gaps to fill.

        Args:
            plan_json: the DesignPlan as a JSON string or dict.
            set_on_plan: when True (default), the returned ``plan`` carries
                the generated BOM in its ``bom`` field, ready for
                ``sch_draw_template``; the parts are unchanged.

        Returns:
            ``{ok, bom: [{refdes_list, manufacturer, mpn, description,
            qty}], summary: {line_count, total_parts, lines_without_mpn},
            plan?}``.
design_compute_component_value tool
Compute a component value snapped to an E-series, with the value
        actually achieved and its error. Use it instead of hand arithmetic.

        Args:
            kind and what it needs:
              nearest: value
              feedback_divider: v_out, v_ref [r_bottom_ohms]
              resistor_divider: v_in, v_out
              led_resistor: v_supply, v_forward, i_led_ma
              rc_lowpass: f_cutoff_hz and one of r_ohms / c_farads
              crystal_load_caps: c_load_pf [c_stray_pf, default 5]
              i2c_pullup: v_bus, c_bus_pf, t_rise_ns (1000/300/120)
              divider_tolerance: v_in, r_top_ohms, r_bottom_ohms [tol_pct]
              opamp_gain: gain, config (inverting / non_inverting)
              buck_inductor: v_in, v_out, i_out_a, f_sw_khz [ripple_pct]
              capacitor_energy: c_farads, voltage
              holdup_cap: i_load_a, t_s, v_drop
              discharge_resistor: c_farads, v_initial, v_final, t_s
              junction_temp: power_w, theta_ja [t_ambient, default 25]
              max_power: tj_max, theta_ja [t_ambient]
              required_theta_ja: power_w, tj_max [t_ambient]
            series: E6/E12/E24/E48/E96 (default E96; E24 for jellybean).

        Returns:
            {"ok": True, ...values..., "summary"} or {"ok": False, "error"}.
design_describe_circuits tool
Report the electrical behaviour of each recognised sub-circuit.

        Recognises the parametric blocks in a ``DesignPlan`` (voltage / feedback
        dividers, RC low/high-pass filters, crystal load networks) and computes
        each one's characteristic from the chosen component values: a divider's
        ratio, a filter's cut-off, a crystal's load capacitance. Use it to
        verify a block does what you intended -- it catches the
        wrong-but-consistent value error (a divider of two valid resistors that
        produces the wrong ratio) that connectivity and equality checks miss.

        Most parameters are ratios / time-constants that need only the values,
        not a supply voltage, so this works on the plan alone. No Altium.

        Returns ``{"ok": True, "circuits": [{motif, parts, summary, params}]}``;
        blocks whose values are missing or unparseable are skipped.
design_suggest_diff_pair_traces tool
Recommend a controlled-impedance trace width for every differential
        pair in a plan.

        Detects the differential pairs (nets with role ``differential``) and
        sizes each to ``target_ohms`` (90 USB / 100 HDMI/LVDS) for the supplied
        stackup and edge-to-edge ``spacing_mils`` via the IPC-2141 impedance
        inverse -- the trace geometry for every pair in one call instead of
        identifying pairs and running ``pcb_calc_trace_width_for_impedance`` by
        hand. The stackup and target are board-level decisions you supply; pure
        Python, no Altium.

        Returns ``{"ok": True, "pairs": [{nets, endpoints, width_mils,
        spacing_mils, target_ohms, feasible}]}`` or ``{"ok": False, ...}``.
design_find_loops tool
Find the circuit loops whose physical size matters, and measure
        them on a placed board. Changes nothing.

        Loops: a switching converter's HOT loop (input cap, switch, low side,
        ground back to the cap; boost: switch, diode, output cap), its
        output loop and bootstrap cap, a MOSFET gate drive, a decoupling cap
        with the IC pins it serves, a crystal with its load caps, a
        regulator FB divider or op-amp feedback network, and a current-sense
        Kelvin connection. Each loop lists its parts and pins IN PATH ORDER
        and says what found it: ``role`` (plan tags), ``pin_name`` (SW,
        BOOT, FB, G/S/D, IN-/OUT, SENSE+) or ``structure`` (netlist shape).

        Give ONE source:
        - ``plan_json``: a DesignPlan; loops only, no geometry.
        - ``board_json_path``: a saved LayoutBoard; loops measured on the
          placement (area and an inductance estimate, or path length),
          worst first.
        - ``expect_file``: the focused board, read live (full path).

        A board carries pad numbers, not pin functions, so pin-function loops
        need ``pin_names``: {refdes: {pad_number: pin_name}}, e.g. from
        lib_get_pin_list. Without them a board gives decoupling, crystal,
        switching and shunt loops from structure alone.

        Args:
            kinds: restrict to these loop kinds.
            limit: loops listed; counts are never cut.
design_simulators tool
Which circuit and field simulators are installed: ngspice
        (batch build; KiCad's copy is a DLL only) and openEMS with its
        Python bindings, with versions. Changes nothing, installs nothing.

        A missing one comes back with an install offer (source, and the
        scoop command where scoop is present). Put the offer to the user
        and install only after they approve; a missing simulator never
        fails a design, it only skips the simulation.
design_simulate_deck tool
Simulate a SPICE deck in ngspice or LTspice on this machine and
        return its .meas values, errors and waveforms.

        ``engine`` "auto" uses ngspice when it is installed and LTspice
        when only LTspice is; name "ltspice" or "ngspice" to choose. Both
        return the same shape. Altium's own simulator runs a deck through
        sim_run_deck instead.

        The deck is screened first: .ferret is refused, and .include/.lib
        may only name a bare file or one in the workspace or
        EDA_AGENT_SPICE_MODEL_DIRS. An IC needs its manufacturer's model
        (SPICE_MODEL_RULES); this simulates whatever it is given. LTspice
        refuses a .control block, which is ngspice's.

        Args:
            deck: The SPICE text, with an analysis (.tran, .ac, .dc, .op)
                and any .meas lines.
            engine: "auto", "ngspice" or "ltspice".
            waves: Traces to report (e.g. ["V(out)"]); empty reports all.
            points: Also return this many samples of each trace in
                ``waves`` (AC traces in dB and degrees).
            timeout_s: Stop the simulator after this many seconds.

        Returns:
            ``engine`` and ``why``, ``measures`` ({name: value}),
            ``errors``, ``warnings``, ``plots`` (per analysis, each trace's
            min, max, first and last), ``run_folder`` and ``log_tail``;
            ``install_offers`` when no simulator is installed.
design_export_spice_deck tool
Write a plan's circuit as a SPICE deck for ngspice or LTspice.

        The same netlist design_simulate_loops runs: R, C and L from their
        values, everything else from the manufacturer's model (``models``,
        as there), rails as DC sources. ``dialect`` "ltspice" writes a
        .net LTspice opens and runs as it is; "ngspice" writes a .cir. A
        plan read off a live sheet comes from design_plan_from_sheet.

        A part without its model is never approximated: the deck is not
        written and ``gaps`` names what is missing. ``allow_partial``
        writes it anyway with every gap listed in comments at the top, so
        the file cannot pass for the whole circuit.

        Args:
            plan_json: a DesignPlan (object or JSON).
            dialect: "ngspice" or "ltspice".
            analyses: {"op": true}, {"tran": {"step", "stop"}},
                {"ac": {"points", "start", "stop"}} (decade) or {"dc":
                {"source", "start", "stop", "step"}}; default .op.
            models / supplies / pin_names: as design_simulate_loops.
            path: file to write; default <workspace>/sim/<title>.cir|.net.
            allow_partial: write a deck that is missing parts.
pcb_smart_drc tool
Design checks from TEMPORARY rules, evaluated offline. Writes no
        rule and changes nothing on the board.

        Asks what the board's own rules usually leave out, using the circuit
        loops (design_find_loops) to know which nets matter:
        - ``spacing``: sensitive nets (regulator/op-amp feedback, crystal)
          closer than ``spacing_mils`` to noisy ones (switch node, bootstrap,
          gate drive). Take ``spacing_mils`` from the datasheet layout
          section where one is given; 40 is a starting value.
        - ``tightest_pairs``: the actual gap of every sensitive/noisy pair
          within ``probe_mils``, smallest first: how close the board runs to
          trouble, not only where it fails.
        - ``hot_loop_width``: hot-loop tracks narrower than the IPC-2221
          width for the current given per net in ``currents`` (amps).

        Gaps use the DRC's own geometry. Give ``board_json_path`` (saved
        LayoutBoard) or ``expect_file`` (focused board, read live). A board
        carries pad numbers only, so pass ``pin_names`` ({refdes: {pad:
        pin_name}}) to find feedback, bootstrap and gate-drive nets.
design_review_plan tool
One-call offline pre-flight: bundle every plan-level analysis.

        Runs, on the plan alone (no Altium), the checks and reports the agent
        would otherwise call one by one, so the planner can vet a design in a
        single step before emit:

          - ``stats``: part counts by kind, IC / passive split, power & ground
            rails, average net degree, the widest signal net (a routing
            hotspot).
          - ``erc``: the ERC-lite report (floating nets, unconnected parts,
            missing decoupling, malformed values, matched-value mismatches);
            ``passed`` is False only on a hard error.
          - ``circuits``: the computed behaviour of each recognised block
            (divider ratios, filter cut-offs, crystal load).
          - ``placement_constraints``: the match / keepout groups that would be
            auto-derived for ``pcb_plan_placement(plan_json=...)``.
          - ``net_classes``: each net's class (power / ground / differential /
            clock / analog / ... / signal) grouped for PCB net-class setup.

        Returns ``{"ok": True, "passed": <erc.passed>, ...sections...}`` or
        ``{"ok": False, "errors"/"error": ...}`` on a schema problem.
design_suggest_partition tool
Split a plan's parts into ``n_groups`` balanced groups with the
        fewest nets crossing between them (min-cut, Kernighan-Lin style),
        for PCB rooms or schematic sheets. Pure data; touches nothing.
        Assign the groups to part ``sheet`` or ``zone`` yourself.

        A hub-centric design (one IC wired to everything) does not split
        cleanly; check ``cut_nets`` and ``group_sizes`` before acting.

        Args:
            plan_json: A DesignPlan (dict or JSON string).
            n_groups: Number of groups.
            max_fanout: Nets touching more than this many parts are
                treated as rails and ignored.

        Returns:
            ``{ok, n_groups, groups: {idx: [refdes...]}, cut_nets,
            boundary_nets: [names...], group_sizes, summary}``. ``cut_nets``
            is how many nets cross the boundary (lower is cleaner);
            ``boundary_nets`` names them -- those become cross-sheet labels or
            off-sheet connectors if you split there.
design_plan_from_sheet tool
Read a DesignPlan back off a schematic so an edit becomes a
        plan edit. Parts come from the components, nets from the compiled
        netlist, rails from the power ports; the plan is validated.

        A schematic does not record, so you supply:

        - ``role`` on each part (decoupling, crystal, op-amp motif...).
        - ``zone`` on each part, for functional blocks.
        - Single-pin nets, which a plan cannot express; they come back
          in ``dropped_pins``.

        Edit the plan, then redraw the block on a fresh sheet with
        ``sch_preview_template`` and ``sch_draw_template`` (plan_json).

        Args:
            project_path: The .PrjPcb the sheet belongs to. Its compiled
                netlist is what supplies the nets.
            sheet_document: Full path to the .SchDoc to read. Defaults to
                the active document.

        Returns:
            ``ok`` / ``plan`` (a DesignPlan dict, or None on a refusal) /
            ``parts_read`` / ``nets_read`` / ``dropped_pins`` / ``notes``,
            and ``complete``: false when anything on the sheet is not in
            the plan. ``interfaces_not_in_plan`` lists each lost
            connection as ``{refdes, pin, net, why, is_rail}`` and
            ``skipped_components`` the parts left out. A redraw from an
            incomplete plan drops them: restore each one and compare the
            netlists before keeping it.
design_audit_schematic tool
Structured visual/layout audit of the active schematic.

        Call AFTER ``sch_draw_template`` and BEFORE ``design_validate``
        so layout problems are fixed first; ERC violations downstream are
        less noisy. Detects three classes of issue, each with enough
        geometry for the planner to compute a corrective move:

          * overlaps        - pairs of components whose bboxes intersect
          * wire_crossings  - wire segments that cross a component body
                              (excluding pin-to-pin connections)
          * stacked_ports   - 3+ power/ground glyphs of the same net
                              huddled inside ``cluster_radius_mils``

        Args:
            project_path: Optional .PrjPcb path. None uses the focused
                project.
            cluster_radius_mils: Radius for stacked-port clustering.
                Default 600 mils.

        Returns:
            SchematicAuditReport dict: ``{ok, project_path, overlaps[],
            wire_crossings[], stacked_ports[], notes[]}``.
            ``ok=True`` iff every list is empty.
design_validate tool
ERC + connectivity sanity report on the focused project.

        Runs run_erc, project.get_messages, and get_unconnected_pins,
        then bundles the output into a structured ValidationReport that
        the planner can read and respond to. Schematic-only in this
        slice, PCB validation is a separate later slice.

        Args:
            project_path: Optional absolute path to a .PrjPcb. If omitted,
                uses the focused project.

        Returns:
            ValidationReport dict: ``{passed, project_path, errors,
            warnings, notes}`` where each error/warning is an Issue with
            ``{category, severity, text, refdes, pin, net, sheet}``.
design_validate_requirement tool
Validate a DesignRequirement before part selection and planning
        (stage 1 of the autonomous flow). Pure Python, no Altium.

        A fact the requirement does not state goes into ``open_questions``
        for the user, never guessed; validation fails while any remain.
        Also fails on: no outputs, no power source, inverted temperature or
        IO-voltage ranges, comms IO without a protocol, and a rail or power
        output larger than every power input (a boost or inverting stage
        the user must confirm).

        ``board_intent`` (stackup, impedance, peak currents, edges,
        enclosure, assembly, finish, test) is optional; when one matters
        and is missing, ``notes`` suggests a question.

        Args:
            requirement: DesignRequirement as a JSON object/dict. Units are
                SI with the unit in the field name (``voltage_v``,
                ``current_a``, ``temp_min_c``); mechanical dimensions are
                MILLIMETRES (``board_size_mm``, ``height_max_mm``).

        Returns:
            ``{"ok": True, "issues": [], "notes": [...], "summary": "..."}``
            when the requirement is planning-ready (``summary`` is the
            labelled-line block to embed in ``DesignPlan.summary``), or
            ``{"ok": False, "issues": [...]}`` / ``{"ok": False,
            "errors": [...]}`` (schema problems) listing what to resolve.
design_load_fab_profile tool
Validate a fab capability profile and echo the normalized form.

        Stage 8 of the autonomous flow (rules & stackup,
        reference/autonomy-roadmap.md): before synthesizing design rules,
        the fab's published limits are captured as a ``FabProfile`` dict --
        transcribed from the fab's capability page (cite it in ``source``),
        NEVER recalled from memory. This tool is the schema gate: it
        validates the dict (all dimensions MILS, copper weight oz/ft^2,
        stackups with copper outer layers and no adjacent copper plies) and
        returns the normalized profile for ``design_synthesize_rules``.

        Args:
            profile: FabProfile as a JSON object/dict: ``name``, optional
                ``source`` citation, ``copper_layer_counts``, the seven
                ``min_*_mils`` floors, and optional ``stackups``.

        Returns:
            ``{"ok": True, "profile": {...}, "stackups": [names],
            "summary": "..."}`` or ``{"ok": False, "reason": "..."}``.
design_list_fab_vendors tool
Fab houses whose published capabilities ship with this server.

        Each has its capability page, the day it was read, whether that
        is over a year ago (``stale``), its tiers and how many stack-ups
        it has. Nothing here is recalled: every figure was read off the
        fab's page and carries the fab's own words.

        Returns:
            ``{"ok": True, "vendors": [...], "laminates": [...]}``; each
            laminate with its design Dk.
design_fab_vendor_profile tool
A fab profile for one build at a fab, ready for
        ``design_synthesize_rules``, with every value's source.

        Minimums depend on the build: JLCPCB's track is 4 mil on two
        layers, 3.5 mil on four, and grows with copper weight. The
        profile is built for the layer count and outer copper given.
        A figure the fab does not publish is never filled in here: the
        profile is refused, naming each one, until ``fill`` supplies it
        (recorded as yours, not the fab's). PCBWay's standard table, for
        one, gives no hole-to-hole or mask bridge; its ``advanced_normal``
        tier does.

        With ``copper_layers`` 0, returns the vendor's raw figures with
        their quotes instead.

        Args:
            vendor: a fab from design_list_fab_vendors ("JLCPCB",
                "Eurocircuits", "Sierra Circuits", ...)
            copper_layers: copper layer count of the board
            outer_oz: outer copper weight, oz
            tier: the vendor's tier, "standard" by default
            fill: {FabProfile field: mils} for figures the fab does not
                publish, e.g. {"min_hole_to_hole_mils": 10}

        Returns:
            ``{"ok": True, "profile": {...}, "provenance": {field:
            {quote, ...}}, "age": {...}}`` or ``{"ok": False, "missing":
            [{field, reason}], ...}``.
design_list_stackups tool
The fabs' own stack-ups that ship with this server.

        JLCPCB's are parsed ply by ply from its impedance page (36 at
        1.6 mm, 4 and 6 layers), so every height and Dk is JLCPCB's.

        Args:
            vendor: limit to one fab ("" for all)
            copper_layers: limit to one copper count (0 for all)

        Returns:
            ``{"ok": True, "stackups": [{name, vendor, copper_layers,
            total_mm, dielectrics}]}``.
design_get_stackup tool
One fab stack-up ply by ply, with optional trace widths for
        target impedances and an optional comparison against a board.

        Widths: outer layers as microstrip over the dielectric to the next
        copper; an inner layer only when it sits near the middle of its
        two planes (the closed form is symmetric; otherwise it is reported
        and not sized). Closed forms are +/-10 %, so these are starting
        widths for the fab's solver to confirm.

        Args:
            name: stack-up name, e.g. "JLC04161H-7628"
            impedance_targets: e.g. [{"ohms": 50}, {"ohms": 90,
                "spacing_mils": 6}] (spacing makes it differential)
            board_stackup: a ``pcb_get_layer_stackup`` result to compare
                with; the template's plies are first collapsed to one
                dielectric per copper gap, as Altium keeps them

        Returns:
            ``{"ok": True, "stackup": {...}, "plies": [...], "source":
            {...}, "impedance": {...}?, "comparison": {...}?}``.
design_get_laminate tool
A laminate's datasheet figures and the Dk to design with.

        Makers publish different kinds of Dk: Rogers a process value (a QC
        test) AND a design value 5 % higher, Isola and Panasonic typical
        values by frequency. Each figure here says which it is, with its
        frequency, method and datasheet. The returned design Dk is the
        design value when there is one, else the typical value nearest
        ``frequency_ghz``; never a process value.

        Args:
            name: e.g. "RO4350B", "370HR", "MEGTRON 6" (prefix matches)
            frequency_ghz: the frequency to pick a typical Dk at (0: the
                highest listed)

        Returns:
            The laminate record plus the design Dk it chose and why.
design_synthesize_rules tool
Synthesize PCB design rules + stackup ops from a fab profile.

        Returns ``pcb_create_design_rule`` and ``pcb_modify_layer``
        parameter dicts to send as they are, after
        ``pcb_create_net_class`` creates the classes they name. Every
        number comes from a profile field or a calculator (IPC-2221
        width, IPC-2141 impedance); a rule missing an input is skipped
        with a note. Pure Python, no Altium.

        Args:
            profile: FabProfile as a dict (see ``design_load_fab_profile``).
            plan_json: Optional DesignPlan (JSON string or dict). When given
                and ``net_class_map`` is not, net classes are derived from
                the plan (flags + net roles, naming-agnostic).
            net_class_map: Optional explicit ``{net_name: class}`` map;
                takes precedence over ``plan_json`` derivation.
            options: Optional synthesis targets: ``stackup`` (name, default
                first), ``class_current_a`` ({class: amps} -> per-class
                width rules), ``delta_t_c``, ``track_margin``, ``layer``,
                ``copper_oz``, ``geometry``, ``diff_pair_target_ohms``
                (required for differential rules),
                ``diff_pair_spacing_mils``.

        Returns:
            ``{"ok": True, "rules": [...], "stackup_ops": [...],
            "notes": [...], "stackup": name|None, "net_classes": {...}}``
            -- rule values are INTEGER MILS -- or
            ``{"ok": False, "reason": "..."}``.
design_plan_hierarchy tool
Propose a multi-sheet hierarchy for a dense DesignPlan.

        Splits the parts by signal connectivity (min-cut, zones kept
        whole), names each sheet from its main zone, makes ports from the
        signal nets the cut severs (rails stay power ports), and returns
        top-sheet ops shaped for ``sch_place_sheet_symbol``,
        ``sch_place_sheet_entry`` and ``sch_generate_toc``. Apply with
        ``design_apply_hierarchy`` before drawing the sheets. Pure
        Python, deterministic.

        Args:
            plan_json: DesignPlan as a JSON string or dict.
            max_parts_per_sheet: Split threshold (default 20). At or below
                it the plan stays single-sheet (``split=False``).

        Returns:
            ``{"ok": True, "split": bool, "top_sheet": str, "sheets":
            [{name, refdes, zones, part_count}], "ports": [{net,
            from_sheet, to_sheet, io_type}], "top_sheet_ops": [{tool,
            params}], "cut_nets": int}`` (op coordinates are MILS) or
            ``{"ok": False, "reason": "..."}``.
design_apply_hierarchy tool
Rewrite a DesignPlan onto the sheets a hierarchy proposes.

        Stage 6 of the autonomous flow (schematic emit,
        reference/autonomy-roadmap.md), the second half of the hierarchy
        step: take the result of ``design_plan_hierarchy`` and produce a
        NEW plan with ``sheets`` = [top sheet, *child sheets], every
        part's ``sheet`` re-homed per the hierarchy, and every zone moved
        with its parts (part-less zones park on the top sheet). The input
        plan is never mutated; a non-split hierarchy returns the plan
        unchanged. Feed the returned plan to ``design_validate_plan`` and
        draw each sheet with ``sch_draw_template``; emit the hierarchy's
        ``top_sheet_ops`` separately to draw the top sheet. Pure Python.

        Args:
            plan_json: DesignPlan as a JSON string or dict.
            hierarchy: The dict returned by ``design_plan_hierarchy``.

        Returns:
            ``{"ok": True, "plan": {...rewritten DesignPlan...},
            "sheets": [names], "summary": "..."}`` or
            ``{"ok": False, "reason": "..."}`` on a malformed plan or
            hierarchy.
design_phase_gate tool
The checks that close one stage on the way to production, and how
        the product stands against them.

        The stages in order: feasibility, prototype, evt, dvt, pvt. Each check
        says what it asks, why at this stage, what counts as done, which tools
        here answer it, and its outcome from the answers recorded so far. It
        runs nothing: call ``tools_to_run``, then record each result with
        design_phase_answer. ``for_people`` are the holding checks no tool
        can answer.

        Args:
            stage: feasibility, prototype, evt, dvt or pvt (also "design
                validation" and similar).
            revision: The board revision in question; answers given for
                another revision stop counting, and the check says so.
            product: Whose ledger, when there are several products.
            with_reasons: Include each check's ``why_now``.

        Returns:
            ``cleared``, ``tally``, ``checks``, ``holding``, ``tools_to_run``
            and ``for_people``.
design_phase_answer tool
Record the answer to one stage check in the product's ledger.

        The ledger is only appended to: a new answer replaces the old one in
        reviews and both stay on file. A waiver needs a ``detail``; months
        later an unexplained waiver cannot be told from a skipped check.

        Args:
            key: The check's key from design_phase_gate, e.g. "prototype:drc".
            outcome: met, unmet, waived or open.
            detail: The evidence: a count, a measurement, a document.
            source: The tool that answered, or the person who confirmed it.
            revision: The board revision it applies to.
            product: Whose ledger.

        Returns:
            The check's stage reviewed again: ``stage_cleared``, ``tally``
            and ``holding``.
design_phase_standing tool
Which stage the product is in, and what that stage still needs.

        A product is in the FIRST stage that does not clear, however much
        work exists beyond it: a board whose feasibility checks never closed
        is in feasibility.

        Returns:
            ``stage``, ``title``, ``in_production`` (every stage cleared),
            that stage's ``holding`` and ``tools_to_run``, and ``stages``
            (each one's ``cleared``, ``tally`` and ``holding``).
easyeda_ping tool
Is an EasyEDA editor connected, and to which document?

        The editor dials out to this server rather than being driven by
        it, so a failure here usually means the extension is not running
        rather than that EasyEDA is closed. The reply names the current
        document kind, because a PCB command aimed at a schematic tab is
        meaningless and finding that out from a confusing error is worse
        than being told.

        It also reports whether the editor is running THIS tree's build
        of the extension. That is not housekeeping: an extension that
        is installed, enabled and months old is indistinguishable from
        a current one in EasyEDA's Extensions Manager, same name, same
        uuid, same size. A whole session was once spent reading "the
        export fix is broken" off an editor that was simply running a
        build from before the fix.

        Returns:
            The editor's reply plus ``build_matches`` (True, False, or
            None when either side cannot say) and, when it does not
            match, ``build_warning`` naming both builds and the remedy.
easyeda_get_capabilities tool
Which parts of the EasyEDA API exist in the CURRENT context.

        EasyEDA loads its API per document type: its own pro-api
        manifest declares separate services for default, sch, symbol,
        pcb and panel. On the start page only the reduced default
        surface is present, so every pcb_* and sch_* class is undefined
        and every read fails with "Cannot read properties of
        undefined". Those failures look like defects in this project
        and are not.

        Read this FIRST when commands fail in a way that makes no
        sense. One call reports which classes the editor actually
        injected and what each can do, which sixty-four failing probes
        can only hint at.

        The answer depends on the open document, so it is a measurement
        of this moment rather than a property of the editor.
easyeda_get_components tool
Every component placed on the current PCB.

        Designator, footprint, layer, position and rotation as the
        editor reports them.
easyeda_get_schematic_components tool
Every component on the current schematic.

        Separate from the PCB list on purpose: the two disagree while a
        design is mid-edit, and that disagreement is a finding rather
        than something to paper over by merging them.

        COUNTED BY KIND, because the raw number misleads on a
        hierarchical design. A live top page returned five rows for a
        111-part design: one page FRAME (reported as componentType
        "sheet", which is not a child sheet), two ordinary parts, and
        two block symbols standing in for child schematics. A reviewer
        reading "5 components" against a netlist of 111 has no way to
        tell a hierarchy from a broken read.

        Every row is still returned. The blocks and the frame are real
        objects a caller may want; what changes is that the counts now
        say which is which.
easyeda_get_nets tool
Nets in the design, with the pins on each.

        The board read is tried first, then the schematic netlist.

        THE SCHEMATIC PATH EXISTS BECAUSE THE OBVIOUS ONE RETURNS
        NOTHING. Measured on a schematic with 332 connected
        pins: sch_Net.getAllNets, getAllNetsName and
        getCurrentProjectAllNets each returned an EMPTY LIST. Not an
        error, not a refusal, just zero, which reads as a design with
        no nets and is the quietest way to be wrong.

        The netlist has them: every part carries pin number to net
        name, so the nets and their members can be rebuilt exactly.
        That also gives something the raw net list would not, the pins
        on each net, which is what a fanout or single-pin check needs.
easyeda_get_net_length tool
Routed length of one net, as the editor measures it.

        Read from the editor rather than computed here: a length this
        project calculated could disagree with what the user sees, and
        two numbers for one net is worse than one.

        A reply carrying no length is a FAILURE here, not a success
        with a missing field. Measured on a schematic tab, where net
        reads answer from either document: the editor returned the net
        name and nothing else, and passing that through as ``ok`` left
        a caller reading ``length`` as absent. Absent is one careless
        line away from being treated as zero, and zero length is the
        definition of an unrouted net.

        Args:
            net: exact net name. Required; an empty name is refused
                rather than defaulting to some net.
easyeda_highlight_net tool
Highlight one net in the editor, to show a human where it is.

        Args:
            net: exact net name.
easyeda_get_net_classes tool
Net classes defined on the current PCB.
easyeda_get_differential_pairs tool
Differential pairs the editor knows about.

        The editor's own list, not this project's naming-based
        inference, so it reflects what the router will actually treat
        as a pair.
easyeda_invoke tool
Call any EasyEDA API method directly.

        The escape hatch, and the reason new capability no longer costs
        an extension re-import. Everything else here is a named tool
        over one or two of these calls; this reaches the rest of the 92
        classes without new extension code.

        WHAT IT IS FOR: measuring. A method whose arguments or reply
        shape nobody has seen can be tried here, once, and what it
        answers decides whether a proper tool is worth writing. Several
        features currently rest on a guessed reply shape precisely
        because there was no way to ask.

        WHAT IT IS NOT FOR: routine work. A named tool validates its
        arguments, reports what the editor answered rather than
        assuming, and carries the accumulated knowledge of what goes
        wrong. This has none of that, so anything worth doing twice is
        worth a tool.

        DESTRUCTIVE METHODS NEED confirm. Any method starting delete,
        remove, clear, destroy or reset is refused without it, on both
        sides. Otherwise this would be a hole straight through every
        confirm guard in the surface.

        The value comes back exactly as the editor gave it, including
        null and false. Those are how this API declines, and reading a
        falsey answer as success is the single most common bug this
        backend has produced.

        Args:
            class_name: an API class, e.g. "pcb_Layer". Call
                easyeda_get_capabilities for what exists in the current
                document.
            method: the method on it, e.g. "getAllLayers".
            args: positional arguments, in order.
            confirm: required for a destructive-looking method.
easyeda_invoke_batch tool
Several easyeda_invoke calls in one round trip.

        What makes the generic path usable for real work. A per-item
        loop over a hundred primitives is a hundred round trips; this
        is one, and the editor runs them in order.

        Each result is reported individually. A failure in the middle
        does not lose the answers either side of it, because a partial
        result naming what failed is usable and an exception is not.

        Args:
            calls: a list of ``{"class_name", "method", "args",
                "confirm"}`` dicts, same fields as easyeda_invoke.
easyeda_get_layers tool
Layers on the current PCB.
easyeda_list_boards tool
Every PCB in the open project, with the current one marked.
easyeda_get_netlist tool
The schematic netlist, parsed.

        The editor returns this as a JSON STRING, measured on a live
        schematic, not as an object. Handing that through unchanged
        meant every caller received one long string where it expected a
        mapping: no iteration, no lookup, and no error either, because
        a string is perfectly valid JSON to whatever received it.

        The parsed shape, measured: keyed by a component's uniqueId,
        each entry carrying ``props`` (Designator, Device, Footprint,
        Datasheet and the rest) and ``pins`` as pin number to net name.

        ``netlist_raw`` keeps the original string, since the export
        tools deal in file content and a caller writing it out should
        not have to re-serialise what the editor already formatted.
easyeda_run_drc tool
Run the editor's own design rule check and read the result.

        The editor's checker, never a reimplementation. A second opinion
        that disagreed with the tool the user is looking at would be
        worse than no opinion.

        A check that produced no report is reported as a FAILURE. Zero
        violations is only good news when something was actually
        examined.
easyeda_run_erc tool
Run the editor's own electrical rule check and read it back.

        A check that produced no report is reported as a FAILURE rather
        than as a clean schematic. Measured on a live editor: the
        schematic checker answers with the boolean ``false``, which is
        not a violation list, and treating it as an empty one announced
        a clean bill of health nothing had established.
easyeda_get_vias tool
Vias on the current PCB.
easyeda_get_lines tool
Line primitives (tracks and graphics) on the current PCB.
easyeda_get_pads tool
Pads on the current PCB.
easyeda_save tool
Save the current PCB document.
easyeda_clear_routing tool
Remove existing routing from the current PCB.

        DESTRUCTIVE, and not undoable through this channel. Refused
        unless ``confirm`` is true, the same guard the Altium side puts
        on a delete-everything call: an agent that can erase every track
        by accident eventually will.

        Args:
            confirm: must be true for anything to happen.
easyeda_get_primitives_in_region tool
Everything inside a rectangle on the current PCB.

        The way to inspect one area without pulling the whole board
        across the link. A zero-area rectangle is refused rather than
        returning an empty list, because "nothing is there" and "you
        asked about nothing" are different answers.

        Args:
            x1, y1: one corner.
            x2, y2: the opposite corner.
easyeda_navigate tool
Scroll the editor to a coordinate, to show a human where.

        Pairs with a violation or a net query: report the finding, then
        put it on screen.

        Args:
            x: x to centre on, in mils. A PCB coordinate, so it takes no
                unit conversion, unlike everything schematic here.
            y: y to centre on, in mils.
easyeda_auto_route tool
Run the editor's autorouter over the current PCB.

        Replaces existing routing decisions across the board, so it is
        refused unless ``confirm`` is true. Not destructive the way
        clearing routing is, but it overwrites human work wholesale and
        an agent should have to mean it.

        KNOWN NOT TO WORK on EasyEDA Pro with pro-api 0.2.29:
        ``pcb_Document.autoRouting`` is declared in the published types
        and absent at runtime, measured and matching
        upstream pro-api-sdk issue #28 (the method is @alpha and
        unimplemented). The call fails as "is not a function". Kept
        rather than removed so an editor update that implements it
        starts working here without a change; the capability guard in
        tests flags the day that happens.

        Args:
            confirm: must be true for anything to happen.
easyeda_create_net_port tool
Place a net port on the schematic, at a point.

        A sheet-level connector. For a power or ground rail glyph use
        ``easyeda_create_net_flag`` instead: EasyEDA treats those as a
        different object, and a port standing in for a rail symbol
        connects correctly while reading wrong to anyone used to the
        convention, so nothing catches it.

        Args:
            name: the net the port carries.
            x: placement x, in mils.
            y: placement y, in mils.
            direction: IN, OUT or BI.
            rotation: degrees.
            mirror: mirror the glyph.
easyeda_create_net_flag tool
Place a power or ground rail glyph on the schematic.

        Args:
            name: the net the glyph carries, e.g. GND or V3V3.
            x: placement x, in mils.
            y: placement y, in mils.
            kind: Power, Ground, AnalogGround or ProtectGround. Analog
                ground is a separate glyph on purpose: drawing AGND with
                the plain ground symbol loses the distinction the
                schematic exists to show.
            rotation: degrees.
            mirror: mirror the glyph.
easyeda_get_arcs tool
Arc primitives on the current PCB.
easyeda_get_regions tool
Filled regions (copper pours) on the current PCB.
easyeda_get_schematic_wires tool
Wires on the current schematic.
easyeda_get_attributes tool
Text attributes on the current PCB.

        Designators, values and free text. What silkscreen audits read,
        and where placeholder values hide.
easyeda_get_schematic_attributes tool
Text attributes on the current schematic.
easyeda_get_dimensions tool
Dimension objects on the current PCB.

        What a fabricator reads off the drawing, so a board whose
        dimensions disagree with its outline is worth catching here.
easyeda_create_net_label tool
Place a net label on the schematic, at a point.

        The coordinates are not decoration. A label connects whatever it
        sits on, so one placed away from a pin names a net that touches
        nothing, and the schematic still looks labelled.

        Args:
            name: the net the label carries.
            x: placement x, in mils. Put it at the pin.
            y: placement y, in mils.
easyeda_link_3d_model tool
Bind a 3D model, footprint or symbol to a device.

        The EasyEDA counterpart to ``lib_link_3d_model`` on the Altium
        side. ``lib_Device.modify`` takes an ``association`` object
        carrying ``model3D``, ``footprint`` and ``symbol``, each as a
        uuid plus the library holding it, and that is how a 3D model
        reaches a part here.

        Recorded previously as a gap on the assumption the extension API
        might not expose it. It does, and ``LIB_3DModel`` carries a full
        create, get, search, modify, copy and delete surface besides.
        Find a model with ``easyeda_search_3d_models``.

        ONLY WHAT YOU NAME IS SENT. The footprint and model slots are
        explicitly nullable in the API, so passing a blank one would
        UNBIND that part while reporting success. Omitted arguments are
        left out of the call entirely rather than sent empty.

        Args:
            uuid: the device to bind to.
            library_uuid: the library holding the device. Also the
                default library for any binding whose own library is
                not given.
            model_uuid: the 3D model to attach.
            model_library_uuid: its library, if it differs.
            footprint_uuid: rebind the footprint, in the device's
                library unless another is implied.
            symbol_uuid: rebind the symbol, likewise.

        Returns:
            Dict with ``linked`` and ``bound``, the slots written.
easyeda_search_3d_models tool
Search the editor's 3D model library.

        A footprint without a model leaves a hole in the assembled view,
        which is where mechanical clashes are actually spotted.

        TEN PER PAGE, AND THERE ARE MORE PAGES. Ten is the editor's
        default page size, not a ceiling: the documented signature
        carries ``itemsOfPage`` and ``page``, which this backend never
        used to pass. ``more_likely`` in the reply means a full page
        came back, and ``next_page`` says which page to ask for.

        Args:
            query: Substring matched by the editor's own search. Empty
                returns the editor's default first page rather than
                nothing.
            library_uuid: Restrict to one library. Read the reachable
                uuids from ``easyeda_list_libraries``.

        Returns:
            Dict with ``models``, ``result_count``, ``page``,
            ``capped`` and ``library_uuid``.
easyeda_get_paths tool
Where the editor keeps documents, projects and libraries.

        Read from the editor rather than inferred. The extension runs
        sandboxed and the server has no way to know these, so a guessed
        path is how an export ends up somewhere nobody looks.
easyeda_open_document tool
Open a document in the editor by uuid.

        Args:
            uuid: from a schematic, PCB or project listing.
easyeda_activate_document tool
Switch to an already-open TAB, by its tab id.

        Different from opening a document: this brings a tab that is
        already there to the front, and it is how a session moves
        between the schematic and the board.

        That matters more here than it would elsewhere. EasyEDA serves a
        different API depending on which document is focused, so most
        pcb_* reads answer nothing at all from a schematic tab and the
        reverse. Switching first is the fix for a whole family of
        "returned nothing" results.

        A TAB ID IS NOT A DOCUMENT UUID, and nothing converts one to the
        other. ``easyeda_open_document`` returns ``tab_id``, which is
        the only place in the API one can be obtained; if you have only
        a uuid, open the document instead. This previously passed a
        document uuid, which the call does not accept.

        Args:
            tab_id: from ``easyeda_open_document``.
easyeda_mark_findings tool
Draw review findings ON the board, where the reader is looking.

        The thing a review has been unable to do on this backend: point
        at the defect instead of describing where it is. Altium
        highlights violations in the editor; this is EasyEDA's
        equivalent, and it was left unbuilt while its arguments were
        unknown.

        AN OVERLAY, NOT GEOMETRY. Markers draw on top of the design,
        change nothing in it, and ``easyeda_clear_findings`` removes
        them all. That is why this is not confirm-guarded when
        everything else that draws is.

        Each marker needs the fields ITS OWN TYPE uses, and the wrong
        ones are refused rather than sent, because a marker the editor
        accepts and draws in the wrong place is a review pointing
        confidently at nothing:

        * ``point``     x, y
        * ``line``      startX, startY, endX, endY
        * ``rectangle`` left, right, top, bottom
        * ``circle``    x, y, r
        * ``arc``       startX, startY, endX, endY, angle

        Args:
            markers: list of shape dicts, each with ``type`` plus its
                fields. A JSON string is accepted.
            color: ``{r, g, b, alpha}``, 0-255 with alpha 0-1. The
                editor's default is used when omitted.
            line_width: stroke width in mils. Editor default when 0.
            zoom: frame the markers after drawing them.
            tab_id: which tab to draw on, from
                ``easyeda_open_document``. Defaults to the active one.

        Returns:
            Dict with ``marked`` and ``count``.
easyeda_clear_findings tool
Remove every marker drawn by ``easyeda_mark_findings``.

        Clears the whole overlay rather than one marker: the API
        removes them as a set and offers no per-marker handle.

        Args:
            tab_id: which tab. Defaults to the active one.
easyeda_zoom_to_all tool
Frame everything in the current document.

        Worth doing before easyeda_render_image: the render captures
        what the editor is showing, so a zoomed-in view produces a
        picture of one corner and nothing says the rest was cropped.
easyeda_zoom_to_selection tool
Frame the current selection.

        Pairs with the select tools to put a finding on screen: select
        what an audit named, zoom to it, then render.
easyeda_get_strings tool
Text primitives on the current PCB.

        Silkscreen and copper text: designators, values, legends. What a
        mirrored-text or off-board-text audit reads.
easyeda_get_pours tool
Copper pour outlines on the current PCB.

        The shape the user drew, not the copper it produced. Compare
        with ``easyeda_get_poured``: an outline with no poured copper is
        a pour that was never executed, which looks fine on screen and
        ships as a missing plane.
easyeda_get_poured tool
Copper actually filled in by pouring.
easyeda_get_fills tool
Solid fill primitives on the current PCB.
easyeda_get_schematic_buses tool
Buses on the current schematic.
easyeda_save_schematic tool
Save the current schematic document.

        Separate from ``easyeda_save``, which saves the PCB. Saving one
        does not save the other, and assuming it does is how edits get
        lost.
easyeda_get_images tool
Images placed on the current PCB.

        Worth checking before release: a linked rather than embedded
        image renders as a blank on any machine without the source file,
        which the Altium side audits for too.
easyeda_get_bounding_box tool
Bounding box enclosing the named primitives.

        Args:
            primitive_ids: comma-separated ids from any query result.
easyeda_get_environment tool
Which EasyEDA this is, and whether it is online.

        Worth reading FIRST when something behaves oddly. Pro, JLCEDA
        Pro and the private edition do not expose the same API surface,
        and offline mode changes what a library call can reach, so a
        failure that looks like a bug here is often an edition or a
        connectivity difference. Reporting it lets that be attributed
        rather than guessed at.
easyeda_list_boards_dmt tool
Boards in the workspace, at the document-manager level.

        Distinct from ``easyeda_list_boards``, which lists the PCBs in
        the open project.
easyeda_list_panels tool
Panels in the workspace.

        A panel is how several boards are stepped and repeated for
        fabrication, so it is where an array that differs from the board
        it was built from would show up.
easyeda_get_current_panel tool
The panel document currently open, if one is.

        No panel open is a normal answer rather than a failure, and it
        comes back as ``open: false`` so a caller can tell it apart from
        a read that went wrong.
easyeda_get_panel tool
One panel by uuid, from easyeda_list_panels.

        Args:
            uuid: the panel's identifier.
easyeda_create_panel tool
Create a panel document.

        This is where a panelised fabrication starts on EasyEDA, and it
        is NOT the same thing as Altium's step-and-repeat: it makes the
        document, and nothing here arranges boards inside it. dmt_Panel
        has no add, insert or place method and neither does dmt_Board,
        so populating the panel appears not to be exposed to extensions
        at all. Treat this as document management.

        NAMING IS A SECOND STEP. ``createPanel()`` takes no arguments,
        so the panel is created with the editor's default name and then
        renamed. The reply reports ``created`` and ``named`` separately,
        because a panel that exists under the wrong name is a different
        outcome from one that was never made. Before this the name was
        passed to a method that does not accept it and was silently
        dropped, so the rename never happened at all.

        Args:
            name: what to call it. Applied by a follow-up rename. Left
                empty, the editor's default name stands.
easyeda_rename_panel tool
Rename a panel document.

        Args:
            uuid: the panel's identifier.
            name: the new name.
easyeda_delete_panel tool
Delete a panel document. There is no undo.

        Checkpoints on this backend save ONE open document, so a deleted
        panel is not something this side can put back.

        Args:
            uuid: the panel's identifier.
            confirm: must be true. Nothing is sent without it.
easyeda_render_image tool
Render what the editor is currently showing, as an image.

        Use it. A board can pass every numeric check and still be
        visibly wrong, and this project's own library and placement work
        repeatedly found geometry bugs that scores hid. Looking is the
        check that catches those.

        The editor hands back a Blob, which does not survive JSON, so
        the extension packs it. An unpacked reply is reported as a
        FAILURE rather than as a successful render of nothing: this is
        the one tool whose whole purpose is to put a picture in front of
        someone, and succeeding without one defeats it entirely.

        Args:
            save_to: where to write the image. Without it the encoded
                bytes come back in the reply, which is fine for a small
                view and wasteful for a large one.
easyeda_get_selection tool
What the user currently has selected in the editor.

        The bridge between a human pointing at something and a tool
        acting on it, without either having to name coordinates.
easyeda_clear_selection tool
Deselect everything in the editor.
easyeda_cross_probe tool
Reveal parts, pins or nets in the editor by NAME.

        The counterpart to a query: having found something, put it in
        front of the human rather than describing where it is. This is
        the schematic-to-board link, so it works in the vocabulary a
        review speaks, designators and net names, rather than in
        internal ids.

        NOT BY PRIMITIVE ID. Use ``easyeda_select_primitives`` for
        those; the two identifier spaces are separate and this call
        matches nothing when handed an id. It previously passed
        primitive ids here and reported a count of whatever it was
        given, so it looked successful while selecting nothing.

        Args:
            designators: comma-separated, e.g. "U1,R4".
            pins: comma-separated ``designator_pin``, e.g. "U1_1,U1_2".
            nets: comma-separated net names.
            highlight: highlight the matches. On by default.
            select: select the matches. On by default.
easyeda_modify_component tool
Change properties of one placed component on the PCB.

        This is how a footprint is moved, rotated, flipped to the other
        side or locked: there is no separate move or rotate call, they
        are all properties.

        An empty ``changes`` is refused rather than sent. The editor
        would accept it and report success, which reads as "the change
        was applied" when nothing was.

        Args:
            primitive_id: from a component query.
            changes: property names to new values. Recognised: x, y,
                rotation, layer (TOP or BOTTOM, which is the side the
                part sits on), primitiveLock, addIntoBom, designator,
                name, uniqueId, manufacturer, manufacturerId, supplier,
                supplierId, and otherProperty for anything else.
easyeda_get_project_info tool
The open project: name, uuid, and what it contains.
easyeda_list_schematics tool
Every schematic in the open project.
easyeda_list_schematic_pages tool
Pages of the current schematic.

        A multi-page schematic is the normal case on anything real, and
        a tool that only ever saw page one would silently report a
        fraction of the design.
easyeda_get_schematic_hierarchy tool
The sheet hierarchy: which blocks the open schematic contains.

        The vocabulary is not obvious and getting it wrong misreads the
        whole structure. A schematic page reports three kinds of
        component and only one of them is a part:

          sheet          the PAGE FRAME itself, at 0,0 with no
                         designator. Not a child sheet, despite the
                         name, which is the trap here.
          block_symbol   a hierarchical BLOCK, backed by its own
                         schematic document. subPartName carries the
                         block's name, measured as "ESP32.1" and
                         "Power.1".
          part           an ordinary component.

        Each block_symbol corresponds to a child schematic document
        rather than to a library symbol.

        This matters for a review because counting components on a top
        page returns the frame and the block outlines, not the parts
        inside them. The netlist is flattened and does cover the whole
        design, so netlist-based checks are correct; anything reading
        components directly is not.
easyeda_get_schematic_pins tool
Every schematic pin, with its part and the net it sits on.

        Built from the NETLIST, and that is a measured decision rather
        than a preference.

        sch_PrimitivePin.getAll() returns only pins placed loose on a
        sheet, which is a symbol-editor thing: a live schematic with 89
        components reported zero. The per-component route the board
        side uses does not work here either. Measured:
        sch_PrimitiveComponent.getAllPinsByPrimitiveId,
        .getComponentDetail, .get and sch_PrimitivePin.getAllPrimitiveId
        ALL failed on a live schematic, the last of those taking no
        argument at all, so it is not a question of passing the wrong
        id. Only getAll() works on that class.

        The netlist has what those cannot give: each entry carries
        ``pins`` as pin number to net name, alongside the props that
        hold the designator. That is the whole of what a connectivity
        review needs.

        A pin on no net is reported with an empty net rather than
        dropped, because an unconnected pin is the finding.
easyeda_get_assembly_variants tool
Assembly variant configurations.

        Which parts are fitted in which build. The same question the
        Altium variant tools answer, and the reason a BOM alone is not
        enough to order a board.

        KNOWN NOT TO ANSWER. Measured twice against a live schematic
        holding 111 parts: the editor accepts the call and never
        returns. It is not a missing class and not an empty project,
        because the same document answers ``sch.components`` and
        ``sch.netlist``. The refusal arrives after a short budget rather
        than the full timeout, and it is a refusal, NOT an empty variant
        list: nothing was read, so nothing can be concluded about which
        parts are fitted.
easyeda_export_schematic_bom tool
The BOM as the schematic generates it.

        Distinct from the PCB BOM on purpose: the two disagree when a
        part is placed on one and not the other, and that disagreement
        is a finding rather than something to hide by picking one.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_simulation_netlist tool
The SPICE netlist for simulation.

        Note the standing rule on this project: a simulation model comes
        from the vendor, never generated. This exports the netlist the
        editor built from models already attached, and does not invent
        any.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_list_libraries tool
Libraries available in the editor: system, personal, project.

        THE ENUMERATION IS EMPTY. ``getAllLibrariesList`` returns no
        entries even against an editor holding a populated system
        library, so ``libraries`` being empty says nothing about what is
        installed. ``enumeration_empty`` flags that, rather than letting
        an empty list read as an empty workspace.

        What does work is ``known_library_uuids``, which carries the
        four uuids the named getters answer with. Those are what a
        search scopes to.

        Returns:
            Dict with ``libraries``, ``enumeration_empty`` and
            ``known_library_uuids`` (system, personal, project,
            favorite).
easyeda_search_devices tool
Search the editor's device libraries.

        A device is symbol plus footprint plus metadata, which is what
        you place. Searching symbols alone finds drawings that may have
        no land pattern behind them.

        TEN RESULTS, ALWAYS. See ``easyeda_search_footprints``.

        Args:
            query: Substring matched by the editor's own search. Empty
                returns the editor's default first page rather than
                nothing.
            library_uuid: Restrict to one library. Read the reachable
                uuids from ``easyeda_list_libraries``.

        Returns:
            Dict with ``devices``, ``result_count``, ``page``,
            ``capped`` and ``library_uuid``.
easyeda_get_devices_by_lcsc tool
Look devices up by LCSC part number.

        The one lookup that starts from a number on a BOM rather than
        from a name someone chose.

        NOT ENOUGH TO PLACE A PART. Measured against a live library:
        each entry carries ``uuid``, ``symbolUuid`` and
        ``footprintUuid`` and NO ``libraryUuid``, while placing needs
        the library and device pair. So this identifies a part and
        cannot position one; search by MPN when the next step is
        placement.

        A part the library does not hold is named in ``missing`` rather
        than left as a gap in a shorter list. Asking for three and
        receiving two tells a caller nothing about which BOM line
        failed, and quietly resolving a BOM one part short is how a
        board gets built without it.

        Args:
            lcsc_ids: comma-separated LCSC ids, for example "C25804,C1525".
easyeda_search_symbols tool
Search the editor's symbol libraries.

        THE ONLY SEARCH THAT NEEDS A QUERY. The device, footprint and 3D
        model searches answer an empty one with a default page.
        ``lib_Symbol.search`` does not answer it at all: measured twice,
        the editor accepted the call and never returned. So the query is
        required here, and refusing it early is what keeps a blank
        search from hanging the connection.

        TEN RESULTS, ALWAYS. See ``easyeda_search_footprints``.

        Args:
            query: What to search for. Required.
            library_uuid: Restrict to one library. Read the reachable
                uuids from ``easyeda_list_libraries``.

        Returns:
            Dict with ``symbols``, ``result_count``, ``page``,
            ``capped`` and ``library_uuid``.
easyeda_search_footprints tool
Search the editor's footprint libraries.

        TEN PER PAGE, AND THERE ARE MORE PAGES. Ten is the default page
        size, not a ceiling. The earlier note that no page argument
        exists came from a numeric SECOND argument matching nothing,
        and the second argument is a library uuid; paging sits further
        along the signature. Ask for ``next_page`` when ``more_likely``
        is true, or raise ``items_of_page``.

        Args:
            query: What to search for. Empty returns the editor's
                default first page rather than nothing.
            library_uuid: Restrict to one library. Read the reachable
                uuids from ``easyeda_list_libraries``.

        Returns:
            Dict with ``footprints``, ``result_count``, ``page``,
            ``capped`` and ``library_uuid``.
easyeda_get_symbol_image tool
Render one symbol to an image.

        Worth using rather than skipping: geometry that scores well and
        looks wrong is a recurring failure in this project's own library
        work, and a picture is the only thing that catches it.

        BOTH UUIDS ARE REQUIRED. ``getRenderImage`` takes one source
        object, ``{symbolUuid, libraryUuid}``, and cannot resolve a
        symbol from its own uuid alone. Passing a bare uuid was recorded
        as the editor never answering, and the call was written off on
        that basis; the ids were good and the argument was the wrong
        shape. Both uuids come back on every search hit.

        Args:
            uuid: the symbol's identifier, from a search result.
            library_uuid: the library holding it, from the same hit.
            sub_part_name: one part of a multi-part symbol. Optional.
easyeda_get_footprint_image tool
Render one footprint to an image.

        Check it against the manufacturer land pattern before trusting
        it, the same way ``lib_audit_footprint_vs_datasheet`` does on the
        Altium side. A rendered footprint is evidence of what was drawn,
        not of what is correct.

        BOTH UUIDS ARE REQUIRED, for the same reason as
        ``easyeda_get_symbol_image``: the call takes one source object,
        ``{footprintUuid, libraryUuid}``. A bare uuid was mistaken for
        the editor refusing to answer.

        Args:
            uuid: the footprint's identifier, from a search result.
            library_uuid: the library holding it, from the same hit.
easyeda_export_gerber tool
Gerber fabrication data.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_generate_fab_package tool
Everything a fab house needs, in one folder, with a manifest.

        Runs the fabrication exports in turn and writes them side by
        side, then reports every file with its size and every export
        that did not produce one.

        THE PACKAGE IS NOT REPORTED COMPLETE UNLESS IT IS. A folder
        missing the pick-and-place looks exactly like a finished one to
        anybody who did not run it, and that is how a board reaches a
        fab house and comes back with questions a week later. If any
        required export fails, ``ok`` is false and ``missing`` names
        what is not there, even though the other files were written and
        are perfectly good.

        Everything written is listed either way. A partial package is
        worth keeping; it just must not be mistaken for a whole one.

        Drill data is inside the gerber zip on this backend rather than
        being its own export, which is where it differs from Altium.

        Args:
            output_dir: folder to write into. Created if absent.
            include: extras beyond the standard set, any of "pdf",
                "step", "dxf", "ipc2581". These are choices rather than
                omissions, so leaving one out never makes the package
                incomplete.
easyeda_export_ipc2581 tool
IPC-2581 fabrication data, the format that carries intent.

        Preferred over Gerber where the fabricator accepts it: netlist
        and stackup travel with the geometry instead of being inferred.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_ipcd356 tool
IPC-D-356A netlist for bare-board electrical test.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_import_routing tool
Import an autorouter or autolayout result back onto the board.

        CLOSES THE ROUND TRIP that ``easyeda_export_dsn`` opens. The
        classic flow is: export a DSN, route it in an external
        autorouter, import the SES back. Only the outward half existed,
        so the loop stopped halfway.

        DESTRUCTIVE, and differently so per kind. A session file or an
        autoroute JSON replaces the board's ROUTING; an autolayout JSON
        replaces the PLACEMENT of every component. Whatever is there is
        discarded. Take an ``easyeda_checkpoint`` first.

        The file is read here and sent as base64, because the editor
        runs in a sandbox with no path this server can name. The
        extension rebuilds it as a File. The NAME travels with it, since
        the editor identifies the format by extension, and a name whose
        extension does not match the kind is refused rather than passed
        on: the wrong format is accepted by the editor and produces a
        board nobody asked for.

        NEVER RUN AGAINST A LIVE EDITOR. Built from the published
        signatures, which settle what the call expects and not what the
        editor does with it.

        Args:
            kind: one of "ses", "route_json", "layout_json".
            path: the file to send.
            confirm: must be true. Nothing happens without it.
easyeda_search_circuit_blocks tool
Find reusable circuit blocks in the libraries.

        A circuit block (EasyEDA calls it 复用模块) is a saved piece of
        schematic placed into a design. It is what this editor has
        INSTEAD of hierarchy: schematic pages here are siblings with an
        order, and nothing exposes a sheet symbol or a parent link, so
        reuse happens by placing a block rather than by nesting a sheet.

        Pair with ``easyeda_place_circuit_block``.

        Args:
            query: free text. Empty lists what the library holds.
            library_uuid: scope to one library.
            page: which page of results, from 1.
            items_of_page: results per page. The editor's default is
                ten when this is left at 0.
easyeda_set_netlist tool
REPLACE the board's entire connectivity from a netlist.

        THE MOST DESTRUCTIVE OPERATION ON THIS BACKEND. Every net on the
        board comes from the text you supply, and whatever it had before
        is gone. Take an ``easyeda_checkpoint`` first.

        The counterpart to reading the netlist, and the way an
        externally generated connectivity reaches the board.

        NOT A FILE IMPORT, despite sitting beside the autorouter
        imports. ``pcb_Net.setNetlist(type, netlist)`` takes a plain
        STRING, so no file plumbing is involved. It also lives on
        ``pcb_Net`` rather than ``pcb_Document``.

        NEVER RUN AGAINST A LIVE EDITOR. Every argument here comes from
        the published reference. The reference settles what the call
        expects, not what the editor does with it, and this one
        rewrites a board.

        Args:
            netlist: the netlist text.
            netlist_type: one of Allegro, DISA, DSNET, EasyEDA, JLCEDA,
                PADS. Leave empty to let the editor decide.
            confirm: must be true. Nothing happens without it.

        Returns:
            Dict with ``applied``, read from the editor's own answer
            rather than assumed.
easyeda_export_netlist tool
The PCB netlist file.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_altium tool
Export the design as an Altium Designer file.

        Worth knowing about on this project specifically: it is a route
        out of EasyEDA into the primary backend, done by EasyEDA's own
        exporter rather than by a converter written here. Check the
        result before trusting it; a vendor's own export is a better
        starting point than a third-party translation, not a guarantee.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_bom tool
The BOM file, as the editor generates it.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_dxf tool
The board outline and copper as DXF.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_3d tool
The 3D model of the assembled board.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_add_line tool
Draw one line on the current PCB.

        Copper on a copper layer, so this is also how a track is drawn:
        EasyEDA has no separate track primitive, a routed segment is a
        line on TOP, BOTTOM or an inner layer with a net on it.

        Args:
            start_x: start x, in mils. The PCB canvas counts in mils
                one to one, unlike the schematic one.
            start_y: start y.
            end_x: end x.
            end_y: end y.
            layer: layer name, e.g. TOP, BOTTOM, TOP_SILKSCREEN,
                BOARD_OUTLINE. Rejected by the editor if unknown, with
                the known names in the message.
            net: net the line belongs to. Empty for silkscreen and
                outline, which have no net.
            width: line width. The editor's default when omitted.
            locked: lock the primitive against interactive edits.
easyeda_add_arc tool
Draw one arc on the current PCB.

        The arc runs from start to end sweeping ``angle`` degrees, so the
        two endpoints and the angle together fix the radius. A full
        circle is not expressible as one arc: draw two of 180.

        Args:
            start_x: start x.
            start_y: start y.
            end_x: end x.
            end_y: end y.
            angle: swept angle in degrees. Sign sets the direction.
            layer: layer name.
            net: net, if the arc is copper.
            width: line width. The editor's default when omitted.
easyeda_add_via tool
Place one via on the current PCB.

        Refused when ``diameter`` does not exceed ``hole_diameter``: the
        editor would accept it and produce a via with no annular ring,
        which is an unmanufacturable board rather than anything visible
        on screen.

        Args:
            x: centre x.
            y: centre y.
            hole_diameter: drill diameter.
            diameter: pad diameter. Must exceed the hole.
            net: net the via connects.
easyeda_add_text tool
Place one text string on the current PCB.

        Args:
            text: the string to place.
            x: anchor x. Which corner of the text this is depends on
                ``align``.
            y: anchor y.
            font_size: text height, in mils.
            width: stroke width.
            layer: layer name, e.g. TOP_SILKSCREEN.
            align: one of LEFT_TOP, LEFT_MIDDLE, LEFT_BOTTOM, CENTER_TOP,
                CENTER, CENTER_BOTTOM, RIGHT_TOP, RIGHT_MIDDLE,
                RIGHT_BOTTOM.
            rotation: degrees.
            font: font family name.
            mirror: mirror the text. What bottom-side text needs so it
                reads correctly from the bottom.
            locked: lock against interactive edits.
easyeda_delete_primitives tool
Delete primitives from the current PCB by id.

        DESTRUCTIVE. Refused unless ``confirm`` is true, and the
        extension refuses independently, because that channel is
        reachable by anything speaking this protocol and cannot assume a
        caller already checked.

        Args:
            kind: which primitive class the ids belong to: line, arc,
                via, text, pad, fill, region, pour or component. Each
                class deletes only its own kind, and the caller knows
                what it created.
            primitive_ids: ids to delete.
            confirm: must be true for anything to happen.
easyeda_cleanup_track_slivers tool
Delete near-zero track stubs left behind by editing.

        Dragging and re-routing leaves fragments a fraction of a mil
        long. They are invisible at any sane zoom, they carry no
        current, and they generate DRC noise that hides real findings,
        which is the actual cost: a violation list nobody reads.

        DRY RUN BY DEFAULT, which is the opposite of most tools here and
        deliberate. This deletes copper. Seeing the list first, and how
        long the "slivers" actually are, is how you find out the
        threshold was wrong BEFORE the tracks are gone rather than
        after. Pass dry_run=False and confirm=True to apply.

        THE THRESHOLD IS CAPPED. Nothing above 10 mils is accepted: at
        that size a segment is real routing, and a cleanup that quietly
        removes real routing is far worse than one that leaves litter.
        A caller who wants to delete longer tracks should select them
        and say so.

        Altium offers a second mode, merging collinear runs into one
        track. That is NOT here: it creates copper as well as deleting
        it, and it needs to know that the shared point is a clean
        two-track junction with no via, pad or arc on it. Neither the
        creation nor that check is settled on this backend, and half of
        a merge is a broken net.

        Args:
            min_length_mils: delete tracks shorter than this. Default 1
                mil. Capped at 10.
            confirm: must be true to delete anything.
            dry_run: report what would go without touching the board.
                On by default.
easyeda_add_zone tool
Pour a copper zone over a polygon on the current PCB.

        Args:
            points: the outline, as at least three ``[x, y]`` pairs.
                Repeating the first point at the end is accepted and
                dropped: EasyEDA's own polygon example does not repeat
                its start point, so passing the closing point through
                would add a zero-length segment.
            layer: copper layer name: TOP, BOTTOM or an inner layer.
            net: net the pour connects, e.g. GND.
            priority: pour priority, where overlapping pours resolve.
                The editor's default when omitted.
            name: pour name.
            width: outline width. The editor's default when omitted.
            preserve_islands: keep copper islands the pour cuts off
                instead of removing them.
easyeda_add_wire tool
Draw a wire on the current schematic.

        THE SCHEMATIC Y AXIS POINTS DOWN. Measured: every wire already
        on a live sheet reports geometry like
        ``[[400, -200, 300, -200]]``, and the editor stores exactly what
        it is given, applying no transformation of its own. So content
        above the origin has NEGATIVE y, and a wire meant to sit beside
        existing content needs coordinates in that same space.

        This is not converted for you, because
        ``easyeda_get_schematic_wires`` reports the editor's own
        geometry and silently flipping the sign here would make a
        read-modify-write land somewhere else. Note that
        ``sch_PrimitiveComponent`` reports POSITIVE y, so the two spaces
        differ and component coordinates cannot be used directly as wire
        coordinates.

        Args:
            points: the path, as at least two ``[x, y]`` pairs in MILS.
                More than two draws a polyline in one call rather than a
                wire per segment. Whole ``[x1, y1, x2, y2]`` segments
                are accepted too, which is the form the editor reports,
                so geometry read back can go straight in again.
            net: net to put the wire on. The editor infers one from what
                the wire touches when this is empty.
easyeda_add_schematic_text tool
Place a text note on the current schematic.

        Args:
            text: the string to place.
            x: anchor x, in mils.
            y: anchor y, in mils.
            font_size: text size. The editor's default when omitted.
            rotation: degrees.
            font: font family. The editor's default when empty.
            bold: bold.
            italic: italic.
            underline: underline.
easyeda_add_schematic_rectangle tool
Draw a rectangle on the current schematic.

        Used to box a functional block on a sheet, the same job the
        Altium side's ``sch_place_rectangle`` does.

        Args:
            x: TOP-LEFT corner x, in mils. Not a centre and not a
                bottom-left corner. Reading it as either puts the box a
                full height from where it was asked for, which still
                looks like a deliberate drawing.
            y: top-left corner y, in mils.
            width: width, in mils.
            height: height, in mils.
            corner_radius: rounded corner radius, in mils. Square when 0.
            rotation: degrees.
easyeda_place_schematic_component tool
Place a library part on the current schematic.

        The part is identified by the uuid pair that
        ``easyeda_search_devices`` returns, never by name: two libraries
        can hold the same name, and choosing one silently is how a board
        ends up with the wrong footprint under a BOM line that reads
        correctly.

        Args:
            library_uuid: the library the part lives in.
            uuid: the part.
            x: placement x, in mils.
            y: placement y, in mils.
            rotation: degrees.
            sub_part: which section, for a multi-part symbol such as one
                gate of a quad. The whole part when empty.
            mirror: mirror the symbol.
            add_to_bom: include it in the BOM. False for a part that is
                drawn but not fitted.
            add_to_pcb: give it a footprint on the board. False for a
                schematic-only symbol.
easyeda_place_pcb_component tool
Place a footprint on the current PCB.

        Args:
            library_uuid: the library the footprint lives in.
            uuid: the footprint.
            x: placement x.
            y: placement y.
            layer: TOP or BOTTOM.
            rotation: degrees.
            locked: lock against interactive edits.
easyeda_set_schematic_component_properties tool
Change properties of one placed schematic component.

        Args:
            primitive_id: the component, from a schematic component
                listing.
            changes: properties to set. Recognised: x, y, rotation,
                mirror, addIntoBom, addIntoPcb, designator, name,
                uniqueId, manufacturer, manufacturerId, supplier,
                supplierId, and otherProperty for anything else.
easyeda_export_pdf tool
The board as a PDF, as the editor renders it.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_pick_and_place tool
Component centroids for assembly.

        What a fab house needs to populate the board, alongside the
        Gerbers and the BOM.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_test_points tool
The test point list.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_flying_probe tool
The flying probe test file.

        Electrical test for a run too small to justify a bed-of-nails
        fixture.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_dsn tool
The board as a Specctra DSN file.

        The input format external autorouters take. The route comes back
        as a SES file, which the editor imports.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_pads tool
The design in PADS format.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_pcb_info tool
The board's fabrication parameters, as a file.

        Stackup, finish and the rest of what a quote needs, in the
        editor's own summary rather than one assembled here.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_schematic_document tool
The schematic as a document file.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_export_schematic_netlist tool
The netlist as the schematic editor generates it.

        Different from the PCB netlist export: this one is what the
        schematic says, which is the side to compare against when the
        two disagree.

        Args:
            save_to: where to write the exported file. Required in
                practice: the editor returns whole-file data, and
                without a destination the tool refuses rather than
                returning megabytes of base64.
easyeda_create_net_class tool
Create a net class on the current PCB.

        Args:
            name: class name.
            nets: nets to put in it.
            color: how the class is drawn, as ``{"r":.., "g":.., "b":..}``
                with an optional ``alpha``. The editor chooses when
                omitted, which is why there is no default here: a colour
                invented on this side would silently restyle a board.
easyeda_add_nets_to_net_class tool
Add nets to an existing net class.

        Args:
            name: the class.
            nets: nets to add.
easyeda_create_differential_pair tool
Declare a differential pair on the current PCB.

        Declaring the pair is what makes the router treat the two nets
        together. This project can also infer pairs from a netlist, but
        an inferred pair the editor has not been told about routes as two
        unrelated nets.

        Args:
            name: pair name.
            positive_net: the P net.
            negative_net: the N net. Must differ from the P net: a pair
                of one net with itself routes as a pair and is not one.
easyeda_create_length_match_group tool
Create an equal-length net group on the current PCB.

        The editor's own grouping, which is what its length tuning acts
        on. ``pcb_calc_length_match`` computes a target offline; this is
        how the board is told to hold it.

        Args:
            name: group name.
            nets: nets to match.
            color: as for a net class. The editor chooses when omitted.
easyeda_add_nets_to_length_match_group tool
Add nets to an existing equal-length group.

        Args:
            name: the group.
            nets: nets to add.
easyeda_get_length_match_groups tool
Equal-length net groups defined on the current PCB.
easyeda_get_net_rules tool
Per-net rule values in force on the current PCB.

        The widths and clearances the editor will actually enforce, as
        opposed to what a calculator here suggests.
easyeda_get_rule_configurations tool
Rule configurations on the current PCB, and which is active.

        A board can hold several rule sets and route against one. Which
        one is current decides what DRC means, so a violation count is
        only meaningful alongside it.
easyeda_set_copper_layer_count tool
Set how many copper layers the board has.

        DESTRUCTIVE when the count goes down: anything on a layer that
        disappears goes with it. Refused unless ``confirm`` is true.

        Args:
            count: an even number from 2 to 32. EasyEDA accepts no
                others, so an odd or larger value is refused here with
                the list rather than sent.
            confirm: must be true for anything to happen.
easyeda_set_layer_visibility tool
Show or hide layers in the editor.

        Display only. Nothing on a hidden layer is removed, and DRC still
        sees it.

        Args:
            layers: layer names, e.g. ["TOP", "TOP_SILKSCREEN"].
            visible: show them. False hides them.
            exclusive: also invert every other layer, so showing one
                layer hides the rest. What you want before a screenshot
                of a single layer.
easyeda_set_layer_lock tool
Lock or unlock layers against editing.

        Args:
            layers: layer names.
            locked: lock them. False unlocks.
easyeda_select_layer tool
Make one layer the active one in the editor.

        Args:
            layer: layer name.
easyeda_modify_layer tool
Rename or restyle one layer.

        An empty change is refused rather than sent: the editor would
        report success, which reads as the change having been applied.

        Args:
            layer: which layer.
            name: new display name.
            color: new colour.
            transparency: new transparency.
easyeda_list_projects tool
Every project uuid the editor lists.

        Uuids only. Pair with ``easyeda_get_project`` for names, which is
        two calls rather than one but avoids a list that goes stale in a
        different way from the editor's own.

        AN EMPTY LIST DOES NOT MEAN NO PROJECTS. Measured on a live
        editor with a team project open and working: the list came back
        empty while the project's own uuid answered
        ``easyeda_get_project`` perfectly. So when the list is empty this
        also reports the OPEN project separately, because "0 projects"
        while the user is looking at one reads as a broken tool.
easyeda_get_project tool
One project's details, by uuid.

        Args:
            uuid: the project.
easyeda_open_project tool
Open a project in the editor.

        Changes what every other tool here is looking at, so a command
        sent immediately after may land on a document that is still
        loading.

        Args:
            uuid: the project.
easyeda_create_project tool
Create a project.

        Args:
            name: the display name.
            internal_name: the short name, if it should differ from the
                display name.
            description: free text.
            team_uuid: create it under a team rather than personally.
            folder_uuid: put it in a folder.
easyeda_import_schematic_changes tool
Apply the schematic to the board: EasyEDA's ECO.

        DESTRUCTIVE. A component the schematic no longer has is removed
        from the board along with its routing, so this is refused unless
        ``confirm`` is true.

        Fails rather than guessing on an orphaned PCB with no schematic
        of its own, which is why ``schematic_uuid`` exists.

        Args:
            confirm: must be true for anything to happen.
            schematic_uuid: which schematic to take changes from. The
                one belonging to this board when empty.
easyeda_zoom_to_board tool
Fit the board outline in the editor view.

        Display only. Worth calling before ``easyeda_render_image`` so
        the picture shows the board rather than wherever the user was
        last zoomed.
easyeda_delete_schematic_primitives tool
Delete primitives from the current schematic by id.

        DESTRUCTIVE. Refused unless ``confirm`` is true, and the
        extension refuses independently.

        Args:
            kind: which primitive class the ids belong to: wire, text,
                rectangle, component or attribute.
            primitive_ids: ids to delete.
            confirm: must be true for anything to happen.
easyeda_emit_template tool
Placement calls for a hand template: THE way to draw a sheet.

        The template is the sheet planned by hand, as for Altium's
        sch_preview_template: parts by designator at grid positions in
        mils, wires through pin anchors (``"U1.3"``), power ports and
        labels. This first pass places the parts where the template says,
        resolving each through the plan: an unresolved part becomes a
        search step and ``runnable`` stays false until resolved_parts
        names its library part. Run the calls, read the pins back with
        easyeda_get_schematic_pins (multiply its units by 10 for mils),
        then call easyeda_emit_template_connections.

        Args:
            template: the hand template; every plan part needs a position.
            plan_json: the DesignPlan, as JSON text or a dict.
            resolved_parts: refdes to ``{"library_uuid", "uuid"}``.
easyeda_emit_template_connections tool
The wiring calls for a hand template, checked against the pins
        as placed. Second pass after easyeda_emit_template.

        The template's wires, ports and labels are checked the same way
        as on Altium (shorts, overlapping wires, crossings, dangling
        ends, off-grid points, and with the plan its nets pin by pin)
        and emitted only if there is no error.

        Args:
            template: the same hand template.
            pin_positions: ``"REFDES.PIN"`` to ``[x, y]`` in MILS, read
                back from the editor (its units times 10). Anchors in the
                template must use pin numbers here.
            plan_json: the DesignPlan, to check its nets.
            grid: grid in mils for the off-grid check.
easyeda_add_schematic_circle tool
Draw a circle on the current schematic.

        Args:
            x: centre x, in mils.
            y: centre y, in mils.
            radius: radius, in mils. Must be greater than zero: the
                editor would take a zero and draw nothing, which is a
                primitive that exists and cannot be seen.
easyeda_add_schematic_polygon tool
Draw a closed polygon on the current schematic.

        Args:
            points: at least three ``[x, y]`` pairs, in mils.
easyeda_get_schematic_selection tool
What is selected on the current schematic.

        The schematic counterpart of ``easyeda_get_selection``. Kept
        separate because the two editors hold their own selections, and
        merging them would report objects from a sheet the caller is not
        looking at.
easyeda_select_schematic_primitives tool
Select primitives on the current schematic, by id.

        Args:
            primitive_ids: ids to select. Replaces the current
                selection rather than adding to it.
easyeda_clear_schematic_selection tool
Deselect everything on the current schematic.
easyeda_get_unconnected_pins tool
Which pins on the current PCB sit on no net.

        The shared ``review_design`` reports how many; this names them,
        which is the difference between knowing there is a problem and
        being able to go and look at it.

        A pin with no net is not automatically a fault. A mechanical
        mounting pad, a no-connect leg and a genuinely forgotten
        connection all look identical here, so this reports and does not
        judge.
easyeda_compare_schematic_pcb tool
Do the schematic and the board hold the same components?

        Compared by designator, which is the only identifier both sides
        carry. Two lists that disagree mean the board has not been
        updated from the schematic, or has been updated and edited
        since.

        This is this project's comparison, not the editor's, and the
        reason is narrower than "EasyEDA has none".

        The editor does carry comparison calls. ``sys_Tool`` documents
        ``netlistComparison(netlist1, netlist2)``, marked beta with an
        unspecified return, and a live capture also shows
        ``pcbComparison`` and ``schematicComparison``, which the
        published reference does not describe at all. All three take
        two artefacts the CALLER supplies rather than reading the open
        design, so they answer a different question from this one.

        The other candidate, ``import_schematic_changes``, APPLIES the
        schematic rather than reporting on it: running it to find out
        what differs would change the board to answer a question about
        it.

        So this compares designator lists itself. Reaching for
        ``netlistComparison`` would mean exporting both netlists first
        and trusting an unspecified reply shape.
easyeda_create_symbol tool
Create an empty symbol in a library, and return its uuid.

        A drawing, not a placeable part. Placing needs a DEVICE, which
        binds a symbol to a footprint: see
        ``easyeda_create_device``. Creating symbols and footprints and
        stopping there leaves a library nobody can place from, which
        looks like progress.

        Args:
            library_uuid: which library, from
                ``easyeda_list_libraries``. There is no default: a part
                created in the wrong library is found by nobody looking
                for it.
            name: the symbol name.
            description: free text.
easyeda_create_footprint tool
Create an empty footprint in a library, and return its uuid.

        Args:
            library_uuid: which library.
            name: the footprint name.
            description: free text.
easyeda_create_device tool
Bind a symbol and a footprint into a placeable device.

        This is the object the rest of this backend places. It is also
        where this project's atomic-parts standard lands: symbol,
        footprint and 3D model bound at the part level, so the BOM and
        the layout come out complete on the first pass rather than
        needing a footprint chosen again later.

        Refused with neither a symbol nor a footprint. The API accepts
        that and returns a uuid, so the empty shell would read as a
        created part until somebody tried to place it.

        Args:
            library_uuid: which library the device goes in.
            name: the device name.
            symbol_uuid: the symbol to bind.
            footprint_uuid: the footprint to bind.
            model_3d_uuid: the 3D model to bind.
            description: free text.
            symbol_library_uuid: the symbol's library, when it differs
                from the device's.
            footprint_library_uuid: likewise for the footprint.
            model_3d_library_uuid: likewise for the 3D model.
easyeda_add_polyline tool
Draw a connected run of segments on the current PCB.

        One call instead of a line per segment, which matters for a
        routed run: every extra round trip is a chance for the board to
        be half-drawn if something fails partway.

        Args:
            points: at least two ``[x, y]`` pairs, in mils.
            layer: layer name.
            net: net the run belongs to.
            width: line width. The editor's default when omitted.
            locked: lock against interactive edits.
easyeda_select_primitives tool
Select primitives on the current PCB, by id.

        Args:
            primitive_ids: ids to select. Replaces the current
                selection rather than adding to it.
easyeda_get_board_outline tool
The board outline, as the segments drawn on its layer.

        EasyEDA has no outline object and no call that returns one: the
        outline is ordinary lines and arcs on the BOARD_OUTLINE layer.
        So this reports those segments and their extent rather than a
        shape, and the extent is a bounding box, not the board area. A
        rounded or cut-out board is smaller than its box.

        An empty result means nothing is drawn on that layer, which is a
        board with no outline rather than an error.
easyeda_plan_placement tool
Work out a better arrangement of the parts on the board.

        The solver is the same one the Altium side uses and has no EDA
        dependency at all: it takes components, nets and a region, and
        returns centroids that shorten total connection length while
        keeping parts from overlapping. Only the reading and writing is
        specific to this backend.

        PROPOSES BY DEFAULT. Nothing moves unless ``apply`` is true, so
        the normal use is to look at the numbers first: hpwl_before
        against hpwl_after says whether the arrangement is actually
        better, and overlap counts say whether it is legal.

        SIZES COME FROM THE BOUNDING BOX WHERE ONE CAN BE READ. A
        measured EasyEDA component reports position, rotation, layer and
        its pads, and no box, so the box is fetched separately. Where
        that fails the extent of the PADS is used instead, and the reply
        says so through ``size_source``, because pads understate a
        footprint: silkscreen and courtyard sit outside them, and
        courtyard is what collision is really about. A placement solved
        from understated sizes packs parts too tightly, and without the
        field nothing in the answer would reveal it.

        EasyEDA positions a part by its ORIGIN and the solver works in
        CENTROIDS, so both conversions happen here.

        Args:
            designators: only move these. Everything else still holds
                its place and pulls on its nets.
            fixed: never move these. Connectors, mounting holes,
                anything mechanically constrained.
            region: ``{"x1","y1","x2","y2"}`` in mils. Taken from the
                board outline when omitted.
            iterations: solver effort.
            grid_mils: snap resolution for the result.
            clearance_mils: breathing room between parts.
            apply: move the parts. Off by default.
easyeda_tune_length tool
Add routed length to a net with a square serpentine.

        For matching a bus or a differential pair to a target length: a
        meander is laid at the point you choose, sized to add roughly
        the length you asked for, and the net's length is reported
        before and after.

        OPEN LOOP AND NOT DRC CHECKED, exactly as the Altium
        counterpart is, and for the same reason: neither editor offers
        a scriptable interactive tuner, so this is the approximation
        that is available rather than the tool anyone would design. You
        pick the spot; run a DRC afterwards.

        THE LENGTH IT ADDS IS NOT THE LENGTH YOU ASK FOR. A serpentine
        adds length in whole teeth, so the result is quantised to
        2*amplitude a tooth. Both numbers are reported, requested and
        achieved, because a tuner that silently rounds is a tuner that
        quietly misses a matching window.

        DRY RUN BY DEFAULT. This draws copper on a routed board.

        Args:
            net: the net to lengthen.
            add_length: how much to add, in mils. Achieved to the
                nearest tooth.
            x, y: where the meander starts.
            layer: layer to draw on.
            amplitude: how far each tooth reaches. Bigger teeth mean
                fewer of them and a coarser result.
            pitch: spacing between teeth along the run.
            width: track width. Match the net's existing width, or the
                meander is an impedance discontinuity.
            dry_run: report the geometry without drawing. On by default.
easyeda_place_stitching_vias tool
Stitch a rectangle with vias on one net, usually ground.

        The standard EMC move: tie the reference planes together
        alongside a fast signal so return current has a short path, and
        around connectors and clock sources for the same reason. A
        return path that has to go the long way round is what turns a
        working board into one that fails emissions.

        DRY RUN BY DEFAULT, like the sliver cleanup and for the same
        reason: this adds copper in bulk, and seeing where before
        committing is how a wrong rectangle gets caught while it is
        still free to fix.

        A GRIDPOINT IS SKIPPED WHEN ANYTHING NOT ON THE NET IS WITHIN
        REACH. Reach is the via radius plus the clearance, measured
        against pads, other vias and track segments. Placing a ground
        via on top of a signal is not a DRC warning to clean up later;
        it is a short, and it is invisible on a plane pour.

        Same-net objects do not block, because a ground via next to a
        ground pad is the point of the exercise.

        WHAT THIS CANNOT SEE, and it matters: copper whose layer the
        editor will not resolve is left out of the check entirely and
        counted. Vias are through-holes and hit every layer, so any
        unchecked copper is a real risk rather than a formality.

        Args:
            net: the net to stitch, e.g. "GND".
            x1, y1, x2, y2: the rectangle, in mils, any corner order.
            spacing: grid pitch. A quarter of the shortest wavelength
                of interest is the usual rule; 50 mils is a common
                default for digital work.
            diameter: via pad diameter.
            hole_diameter: drill diameter. Must be smaller.
            clearance: extra space demanded around each via.
            dry_run: report the positions without placing. On by
                default.
            max_vias: refuse rather than place more than this. A
                mistyped rectangle is how a board gets a thousand vias.
easyeda_route_plan tool
Route the board offline and return tracks and vias to place.

        The router is the one the Altium side uses (route_plan,
        pcb_autoroute) and has no EDA dependency: it takes pads, existing
        copper and a board outline, and returns segments checked by the
        exact DRC. Only the reading is specific to this backend.

        PLANS ONLY. Nothing is drawn. The result is in the shape
        easyeda_add_track and easyeda_add_via take, so applying it is a
        separate, visible step.

        LAYER SIDES COME FROM THE EDITOR, not from a table here. PCB
        reads carry a numeric layer, and which integer is top copper is
        not measured; getting it wrong would route on the wrong side of
        the board. The editor's own layer list is consulted, and
        anything it cannot resolve is EXCLUDED from the obstacle map
        with a count, rather than guessed onto a layer.

        That exclusion is the one thing to watch in the result. Copper
        left out of the obstacle map is copper the router will happily
        route through, so a non-zero ``obstacles_skipped`` means the
        plan may collide with something real.

        Args:
            nets: only route these. Everything else stays an obstacle.
            clearance_mils: copper-to-copper spacing.
            track_width_mils: width for new track.
            via_size_mils: via pad diameter.
            via_drill_mils: via hole diameter.
easyeda_audit_pads_near_board_edge tool
Pads too close to the board edge to be made reliably.

        Distance is measured to the OUTLINE SEGMENTS, not to a bounding
        box. A box overstates a rounded or routed-out board, and it
        overstates it in the dangerous direction: a pad that sits close
        to a real curved edge reads as comfortably inside the box, so
        the check would miss exactly the violations it exists to find.

        Pad SIZE is a different matter. EasyEDA carries it in a shape
        object whose structure is not published, so where a width and
        height can be read the distance is copper-to-edge, and where
        they cannot it is centre-to-edge and understates the risk. Every
        result says which it is, and the summary counts them, so a run
        that could read no sizes is visible rather than quietly
        optimistic.

        Args:
            clearance: the minimum acceptable distance, in mils.
easyeda_open_symbol tool
Open a library symbol for editing, and make it the active
        document.

        This is how a symbol gets its geometry on this backend. There is
        no separate library-drawing API: open the symbol, then use the
        ordinary schematic drawing tools (``easyeda_add_wire``,
        ``easyeda_add_schematic_rectangle``, and the rest), which now
        act on the symbol rather than on a sheet.

        It changes what every other tool is looking at, so anything sent
        straight after may land on a document still loading.

        Args:
            uuid: the symbol.
            library_uuid: the library it lives in.
easyeda_open_footprint tool
Open a library footprint for editing.

        The PCB counterpart of ``easyeda_open_symbol``: open it, then
        the ordinary PCB drawing tools act on the footprint.

        Args:
            uuid: the footprint.
            library_uuid: the library it lives in.
easyeda_rename_symbol tool
Rename a library symbol or change its description.

        Args:
            uuid: the symbol.
            library_uuid: the library it lives in.
            name: the new name. Left alone when empty.
            description: the new description. Left alone when empty.
easyeda_rename_footprint tool
Rename a library footprint or change its description.

        Args:
            uuid: the footprint.
            library_uuid: the library it lives in.
            name: the new name. Left alone when empty.
            description: the new description. Left alone when empty.
easyeda_copy_symbol tool
Copy a symbol into another library.

        The usual way to start from a vendor part rather than a blank
        one: copy it into your own library first, then edit the copy, so
        the original stays as shipped.

        Args:
            uuid: the symbol to copy.
            library_uuid: the library it currently lives in.
            target_library_uuid: where the copy goes.
            new_name: name for the copy. Keeps the original name when
                empty.
easyeda_copy_footprint tool
Copy a footprint into another library.

        Args:
            uuid: the footprint to copy.
            library_uuid: the library it currently lives in.
            target_library_uuid: where the copy goes.
            new_name: name for the copy. Keeps the original name when
                empty.
easyeda_get_embedded_objects tool
Binary embedded objects on the current PCB.

        Not the same as ``easyeda_get_images``, despite the name.
        EasyEDA keeps colour-silkscreen artwork as embedded binary
        objects whose payload is data rather than geometry, and they
        are a fabrication question of their own: a fabricator who
        cannot process them prints nothing where the artwork was.
easyeda_add_schematic_arc tool
Draw an arc on the current schematic, through three points.

        Three points on the curve, NOT a centre and a sweep. The middle
        pair is a point the arc passes through. Passing a centre there
        draws a plausible-looking curve in the wrong place, which is the
        kind of mistake that survives a glance at the sheet.

        Args:
            start_x: start x, in mils.
            start_y: start y, in mils.
            reference_x: x of a point the arc passes THROUGH.
            reference_y: y of that point.
            end_x: end x, in mils.
            end_y: end y, in mils.
easyeda_get_library_classifications tool
The category tree of one library.

        Worth reading before creating a part: a symbol or footprint made
        with no classification lands uncategorised, where it is found
        only by someone who already knows its name.

        Args:
            library_uuid: which library.
            kind: what the library holds: CBB, SYMBOL, DEVICE,
                FOOTPRINT, MODEL or PANEL_LIBRARY.
easyeda_run_plan tool
Run a sequence produced by the emit tools, in order.

        DESTRUCTIVE: it places parts and draws on the open document.
        Refused unless ``confirm`` is true.

        Takes the ``calls`` list from ``easyeda_emit_template`` or
        ``easyeda_emit_template_connections`` rather than a plan, so what runs is
        exactly what was reviewed. Passing a plan here instead would
        re-emit it, and a sequence that was read and a sequence that
        ran would be two different things.

        STOPS AT THE FIRST FAILURE. Continuing would leave a design that
        is part-built and looks built: the remaining steps would place
        parts around a hole where one is missing, and the result reads
        as a finished schematic with a mistake in it rather than as a
        run that stopped.

        Args:
            calls: the ordered ``{"tool": ..., "arguments": {...}}``
                entries from an emit tool.
            confirm: must be true for anything to happen.
easyeda_checkpoint tool
Save the open document so a later change can be undone.

        Worth taking before ``easyeda_run_plan`` or any of the
        confirm-guarded tools, which is the whole reason it exists.

        Captures ONE document, the open one, not the project. The Altium
        side snapshots a whole project directory; this backend has no
        directory the server can reach, so what is saved is the document
        the editor currently has.

        Args:
            label: a note to recognise it by later.
easyeda_list_checkpoints tool
Checkpoints taken on this machine, newest first.
easyeda_restore_checkpoint tool
Put a saved document back, replacing what is open.

        DESTRUCTIVE: it replaces the whole open document. Refused
        unless ``confirm`` is true.

        Refused as well when the open document is not the one the
        checkpoint came from. Restoring a snapshot of board A over board
        B destroys B and looks like a successful restore, which is the
        worst shape a safety net can fail in. ``force`` overrides that
        for the case where the document was legitimately renamed.

        Args:
            checkpoint_id: from ``easyeda_list_checkpoints``.
            confirm: must be true for anything to happen.
            force: restore even onto a different document.
easyeda_delete_schematic tool
Delete a schematic and every page in it.

        DESTRUCTIVE. Refused unless ``confirm`` is true, and the
        extension refuses independently, so a caller that forgets on one
        side is still stopped on the other.

        Take a checkpoint first: ``easyeda_checkpoint`` saves the open
        document, and this removes a whole schematic, which no
        checkpoint here can put back.

        Args:
            uuid: the schematic to delete; list them with
                ``easyeda_list_schematics``.
            confirm: must be true for anything to happen.
easyeda_delete_schematic_page tool
Delete one page of a schematic.

        DESTRUCTIVE, and the narrower of the two: this removes a single
        sheet rather than the whole schematic.

        Args:
            uuid: the page; list them with
                ``easyeda_list_schematic_pages``.
            confirm: must be true for anything to happen.
easyeda_delete_pcb tool
Delete a board, including its routing.

        DESTRUCTIVE. The routing is the expensive part: a board deleted
        by mistake is hours of work, and nothing on this side can
        restore it.

        Args:
            uuid: the board; list them with ``easyeda_list_boards``.
            confirm: must be true for anything to happen.
easyeda_delete_project tool
NOT POSSIBLE on EasyEDA. Delete the parts, or use the UI.

        EasyEDA'S API CANNOT DELETE A PROJECT. ``dmt_Project`` offers
        create, open, move and the info reads, and no other class
        deletes one either: the document tree can remove a board, a
        folder, a panel, a PCB, a schematic and a schematic page, but
        never the project itself.

        This previously called a method that does not exist, so it threw
        a TypeError AFTER the caller had confirmed a destructive
        operation. It now refuses up front and says what can be deleted.

        Use ``easyeda_delete_schematic``, ``easyeda_delete_pcb`` or
        ``easyeda_delete_panel`` for the contents, and the EasyEDA UI
        for the project.

        Args:
            uuid: accepted and unused, so an existing caller gets the
                explanation rather than a signature error.
            confirm: accepted and unused, for the same reason.
easyeda_close_document tool
Close an open document without deleting anything.

        The counterpart to ``easyeda_open_document``, and deliberately
        not confirm-guarded: nothing is removed, and what happens to
        unsaved changes is the editor's own business.

        Args:
            uuid: the document to close.
easyeda_create_schematic tool
Add a schematic to the open project.

        Part of the from-scratch path: create the project, then a
        schematic and a board inside it. Without these the backend can
        only work on something a human made first, which is the
        difference between editing a design and authoring one.

        Args:
            name: what to call it. The editor picks a default when
                empty.
easyeda_create_schematic_page tool
Add a page to an existing schematic.

        Args:
            uuid: the schematic, from ``easyeda_list_schematics``.
easyeda_create_pcb tool
Add a board to the open project.

        Args:
            name: what to call it. The editor picks a default when
                empty.
easyeda_set_title_block tool
Fill in the current schematic page's title block.

        What a printed sheet is identified by: title, author, revision,
        date. A design that reaches a fabricator with an empty title
        block is a real problem and an easy one to leave until last.

        Args:
            fields: field name to ``{"value": ..., "showTitle": bool,
                "showValue": bool}``. The field names are the editor's
                own, so read an existing sheet before guessing them.
            show: whether the title block is displayed at all. Setting
                fields while this is false fills in a block nobody sees.
easyeda_get_workspaces tool
Workspaces the editor knows about, and which is current.

        Worth checking before creating anything: a project made in the
        wrong workspace is found by nobody looking for it.
easyeda_audit_vias_near_board_edge tool
Vias too close to the board edge to survive routing.

        The same measurement as the pad check and the same reason for
        it, applied to vias: distance to the outline SEGMENTS, never to
        a bounding box, because a box overstates a rounded or routed-out
        board and hides the violations nearest a real curved edge.

        A via close to the edge is worse than a pad there. Depanelling
        cuts through the barrel, and the resulting open circuit is
        intermittent rather than dead, so it survives a functional test.

        Distance is measured to the via's copper where its diameter can
        be read, and to its centre otherwise, and each result says
        which.

        Args:
            clearance: the minimum acceptable distance, in mils.
easyeda_audit_off_grid_components tool
Components whose origin does not sit on the placement grid.

        Off-grid parts are not wrong, they are awkward: every later
        alignment, array and length-match works from the grid, so one
        part off it turns tidy work into hand-nudging, and the offset
        propagates into whatever gets aligned to that part.

        Reports the offset rather than judging it. A part deliberately
        placed to a mechanical dimension is off-grid on purpose, and
        nothing here can tell that from a slip.

        Args:
            grid: the placement grid pitch, in mils.
easyeda_get_device tool
One library device: what it is and what it is bound to.

        THE 3D MODEL IS NOT IN THE DEVICE RECORD. ``lib_Device.get``
        returns an association carrying only symbol, footprint and
        images, while ``lib_Device.search`` reports ``model3DUuid`` for
        the same uuid. Read straight, the record says every device is
        unmodelled. So the model is looked up separately and reported as
        ``model_3d``, with ``model_3d_source`` saying where it came
        from:

        - ``get``: the record carried it after all.
        - ``search``: recovered from the search row. ``model_3d`` of
          None here means the device genuinely has no model.
        - ``unresolved``: the search did not reach this device, because
          searches cap at ten results and a common name hides the row.
          ``model_3d`` of None here means UNKNOWN, not absent, and must
          not be reported as a missing model.

        Args:
            uuid: the device.
            library_uuid: the library it lives in.

        Returns:
            Dict with ``device``, ``model_3d`` and ``model_3d_source``.
easyeda_copy_device tool
Copy a device into another library.

        The usual way to adopt a vendor part: copy it into your own
        library, then edit the copy, so the original stays as shipped
        and an update to the vendor library cannot silently change your
        board.

        The device is what gets placed, so copying only its symbol and
        footprint leaves nothing placeable behind.

        Args:
            uuid: the device to copy.
            library_uuid: the library it currently lives in.
            target_library_uuid: where the copy goes.
            new_name: name for the copy. Keeps the original when empty.
easyeda_delete_device tool
Remove a device from a library.

        DESTRUCTIVE. Refused unless ``confirm`` is true, and the
        extension refuses independently.

        It does not touch boards already using the part: those keep the
        placed copy, so a design can keep working while the library
        entry it came from no longer exists.

        Args:
            uuid: the device.
            library_uuid: the library it lives in.
            confirm: must be true for anything to happen.
easyeda_add_pad tool
Place a pad on the current PCB or footprint.

        The piece that makes footprint authoring real: open a footprint
        with ``easyeda_open_footprint`` and the drawing tools give it an
        outline and silkscreen, but only pads give it something to
        solder.

        SMD or through-hole is decided by ``hole_diameter``. Leave it at
        zero for surface mount. A through-hole pad usually wants
        ``layer="MULTI"`` so its copper reaches both sides; putting a
        drilled pad on TOP alone leaves the bottom unconnected, which
        looks right on screen and fails on the board.

        Args:
            pad_number: what ties this pad to a symbol pin. Required and
                a string, because "0" and "" are different pads and an
                unnumbered pad is copper the netlist cannot reach.
            x: centre x, in mils.
            y: centre y, in mils.
            width: pad width. For REGULAR_POLYGON this is the diameter.
            height: pad height. Square with the width when omitted.
            shape: ELLIPSE, RECTANGLE, OBLONG or REGULAR_POLYGON.
            layer: TOP, BOTTOM, or MULTI for a through-hole pad.
            net: net the pad belongs to.
            rotation: degrees.
            corner_radius: rounded corners, RECTANGLE only.
            sides: number of sides, REGULAR_POLYGON only. Must exceed 2.
            hole_diameter: drill diameter. Zero means surface mount.
            hole_length: for a slotted hole, the slot length. Ignored
                when it does not exceed the diameter, which is how a
                round hole is asked for.
easyeda_add_pin tool
Place a pin on the current symbol.

        The symbol counterpart of ``easyeda_add_pad``, and the piece
        that makes a symbol connectable rather than merely drawn. Open a
        symbol with ``easyeda_open_symbol`` first; on an ordinary sheet
        this places a loose pin.

        Args:
            pin_number: what ties this pin to a footprint pad. Required
                and a string, since "0" and "" are different pins and a
                symbol whose pins carry no numbers cannot be matched to
                a package.
            x: the ELECTRICAL end, in mils, which is where a wire
                connects. Not the end at the symbol body: getting them
                the wrong way round leaves wires attaching to thin air
                at a point that looks like a pin.
            y: electrical end y, in mils.
            name: the pin's name, e.g. VCC or RESET.
            pin_type: BI, GROUND, HIZ, IN, OPEN_COLLECTOR, OPEN_EMITTER,
                OUT, PASSIVE, POWER, TERMINATOR or UNDEFINED. This is
                what ERC checks, and it does not change how the pin
                draws: two outputs tied together look exactly like an
                output driving an input.
            rotation: degrees. Which way the pin points out of the body.
            length: pin length. The editor's default when omitted.
easyeda_get_net_lengths tool
Routed copper length of every net, in one call.

        The per-net tool asked net by net would cost a round trip each,
        so the loop runs inside the editor.

        A net the editor cannot measure comes back as ``null`` rather
        than zero, because zero means "carries no copper" and that is a
        finding, not a missing measurement.

        An EMPTY list is called out rather than returned as a count of
        zero. Net data is reachable from either document, so asking
        from a schematic tab answers with no entries instead of
        refusing, and "0 nets measured" reads as "no net carries any
        copper" when it means the board was never consulted.
easyeda_get_unrouted_nets tool
Nets with no routed copper at all.

        WHAT THIS CATCHES, precisely: a net that carries zero routed
        length. That is the common case worth finding before ordering,
        a connection nobody drew.

        WHAT IT DOES NOT CATCH: a net that is PARTLY routed. EasyEDA
        reports a length per net and no ratline list, so a net with one
        segment drawn and one pin still floating measures non-zero and
        reads as routed here. Run the editor's own DRC for that; this is
        a cheap first pass, not a replacement for it.

        A net whose length could not be measured is listed separately
        rather than counted as unrouted, since "no answer" and "no
        copper" are different and only one of them is a defect.
easyeda_audit_components_outside_outline tool
Components whose origin falls outside the board outline.

        A part off the board is not a drawing mistake to fix later: it
        is not manufactured. The panel is cut to the outline, so the
        part exists in the design, appears in the BOM, is bought and
        placed by nobody.

        Tested by counting how many outline edges a ray from the part
        crosses, which works on an unordered set of segments. That
        matters here because the outline is drawn as loose lines and
        arcs with no guaranteed order, so anything that assumed a walked
        polygon would silently mis-handle a board drawn out of sequence.

        Reports the component ORIGIN, not its body. A part whose origin
        is just inside while half its footprint hangs over the edge is
        not reported, so a clean result is not a promise that everything
        fits.
easyeda_audit_mirrored_text tool
Bottom-side text that will read backwards on the real board.

        Text on a bottom layer is viewed through the board, so it has to
        be mirrored to come out readable. Unmirrored bottom silkscreen
        looks perfectly correct in the editor, where you are looking at
        it from the top, and comes back from the fab reversed. That is a
        respin of the silkscreen for a defect nothing on screen shows.

        The reverse is reported too: mirrored text on a TOP layer reads
        backwards for the same reason in the other direction.

        Text whose layer or mirror flag cannot be read is listed as
        unchecked rather than assumed correct, since an assumption in
        either direction here is one that gets manufactured.
easyeda_audit_track_widths tool
Nets routed at more than one width.

        REPORTS, does not judge. A net at several widths is often a
        mistake, a segment drawn before a rule was set or a rework that
        picked up the default. It is also how a deliberate taper into a
        fine-pitch pad looks, and nothing here can tell those apart, so
        the widths are listed and the call is left to a human.

        Counted per net per LAYER. The same net legitimately changes
        width when it moves between an inner layer and an outer one, so
        folding the layers together would report that as a defect on
        every multi-layer board. (The Altium audit folds them; this one
        deliberately does not.)

        This is also the ONLY width check that works here. The per-net
        rules measured on a live board carry the string "default"
        rather than a width, so nothing can be compared against a rule
        without first resolving a fab capability matrix; internal
        consistency needs no rule at all.

        Args:
            ignore_below: treat widths differing by less than this as
                the same, in mils. Rounding in a unit conversion can
                leave two nominally equal segments differing in the last
                decimal, which is noise rather than a finding.
            ratio: when above 1, report only nets whose widest and
                narrowest differ by more than this factor. 2.0 is the
                Altium audit's threshold and isolates the bug worth
                acting on: a rail routed wide for its current, then
                extended at the editor's default, leaving a thin stub
                welded to a wide bus. 0 (the default) keeps the
                report-everything behaviour.
easyeda_add_fill tool
Fill a polygon with solid copper on the current PCB.

        Different from a poured zone: a fill is solid and does not flow
        around what it meets, so it will short anything inside it that
        is on another net. Use a zone (``easyeda_add_zone``) for a
        ground plane that has to keep clearance; use a fill for a
        deliberate slab, a thermal pad or a shield.

        Args:
            points: the outline, as at least three ``[x, y]`` pairs in
                mils.
            layer: layer name.
            net: net the copper belongs to.
            width: outline width. The editor's default when omitted.
            locked: lock against interactive edits.
easyeda_add_region tool
Mark a keepout or constraint area on the current PCB.

        The area under a connector, beneath a mounting screw, or around
        an antenna, where something must NOT go.

        ``rules`` is required and has no default. A region with no rule
        is just an outline: it draws, it constrains nothing, and the
        board routes straight through the area somebody meant to
        protect, which looks exactly like a region that is working.

        Args:
            points: the outline, as at least three ``[x, y]`` pairs in
                mils.
            rules: one or more of NO_COMPONENTS, NO_WIRES, NO_FILLS,
                NO_POURS, NO_INNER_ELECTRICAL_LAYERS,
                FOLLOW_REGION_RULE.
            layer: layer name.
            name: a name for the region.
            width: outline width. The editor's default when omitted.
            locked: lock against interactive edits.
easyeda_add_dimension tool
Draw a measured dimension on the current PCB.

        What a fabrication drawing is read from: board size, cutout
        positions, hole spacing. A board sent without them is one where
        the fab measures from the Gerbers and guesses the tolerance.

        Args:
            dimension_type: LENGTH, RADIUS or ANGLE. Each takes a
                different number of points and reads them differently,
                so they are not interchangeable.
            points: ``[x, y]`` pairs in mils. LENGTH takes four: first
                measurement end, first arrow end, second arrow end,
                second measurement end. RADIUS takes three: a point on
                the arc, the dimension line tail, the text corner.
                ANGLE takes three: one edge end, the vertex, the other
                edge end. A wrong count is refused rather than sent,
                since a dimension drawn from the wrong points still
                draws and reads as a measurement.
            layer: which layer to draw on. DOCUMENT by default, since a
                dimension is drawing rather than copper.
            width: line width. The editor's default when omitted.
            precision: decimal places on the measurement.
easyeda_add_bus tool
Draw a bus on the current schematic.

        Args:
            name: the bus name, and what carries its members, e.g.
                ``D[0..7]``. Required: a bus drawn without one is a
                thick line. It looks like a bus, groups nothing, and the
                signals a reader assumes are in it are not.
            points: the path, as at least two ``[x, y]`` pairs in mils.
easyeda_modify_schematic_components tool
Change properties on many schematic components at once.

        Each result is reported individually rather than as one verdict.
        A partial failure is the case that matters: knowing THAT
        something failed is no use without knowing which, because the
        rest did apply and the design is now half-edited.

        Args:
            changes: a list of ``{"primitive_id": ..., "changes": {...}}``.
                The inner keys are the same ones
                ``easyeda_set_schematic_component_properties`` accepts:
                x, y, rotation, mirror, designator, name, manufacturer
                and the rest.
easyeda_increment_designators tool
Offset the trailing number of schematic designators.

        delta=100 turns R5 into R105. What it is for is copying a block:
        the copy arrives with the same designators as the original, and
        moving them out of the way is what makes re-annotation possible
        without every part colliding.

        COLLISIONS ARE CHECKED BEFORE ANYTHING IS SENT. A delta that
        lands one part on another leaves two components claiming one
        designator, which the netlist then reads as one part, and it is
        the kind of error that survives to fabrication. If any target
        name is already taken by a part that is not itself moving, the
        whole operation is refused and the clashes are named.

        THE ORDER OF APPLICATION MATTERS and is handled here. Shifting
        R1 to R5 up by one has to start at R5, or R1 becomes R2 while
        the real R2 still exists. Renames go descending for a positive
        delta and ascending for a negative one, so no intermediate state
        has two parts sharing a name.

        Parts whose designator has no trailing number are left alone and
        counted, not silently skipped: a sheet of them means the delta
        did nothing and the caller should know that rather than read a
        cheerful zero.

        Args:
            delta: non-zero integer added to each designator's number.
            prefix: restrict to one letter prefix, e.g. "R". Matched
                exactly and case-sensitively, so "R" does not touch
                "RN".
            dry_run: work out the renames and report them without
                sending anything.
easyeda_modify_pcb_components tool
Change properties on many PCB components at once.

        The board counterpart of the schematic bulk edit, and how a
        placement pass applies: move, rotate and flip in one call
        instead of one per part.

        Args:
            changes: a list of ``{"primitive_id": ..., "changes": {...}}``.
                The inner keys are the ones ``easyeda_modify_component``
                accepts: x, y, rotation, layer, primitiveLock and the
                rest.
easyeda_place_schematic_components tool
Place many library parts on the schematic in one call.

        The bulk form of ``easyeda_place_schematic_component``, and what
        a plan of any size should use: placing forty parts one at a time
        is forty round trips over a socket.

        Each placement is reported individually. A batch that
        half-succeeds is the case worth designing for, because the parts
        that landed are on the sheet and a caller needs to know which so
        a retry does not place them twice.

        Args:
            components: a list of ``{"library_uuid": ..., "uuid": ...,
                "x": ..., "y": ..., "rotation": ...}``. Coordinates are
                in mils, as everywhere else here, and converted once on
                the way out.
easyeda_place_pcb_components tool
Place many footprints on the board in one call.

        The board counterpart of the schematic bulk placement, and the
        same reason: placing forty footprints one at a time is forty
        round trips over a socket.

        Coordinates are in mils and take NO conversion here. The PCB
        canvas already counts in mils, unlike the schematic one, which
        is the difference this backend keeps having to be careful about.

        Stops at the first failure and reports the rest as skipped, so a
        batch leaves the board in the same knowable state a sequence of
        single calls would.

        Args:
            components: a list of ``{"library_uuid": ..., "uuid": ...,
                "x": ..., "y": ..., "layer": "TOP"|"BOTTOM",
                "rotation": ..., "locked": ...}``.
easyeda_add_wires tool
Draw many wires on the schematic in one call.

        The connections pass draws a wire per net segment, so a design
        of any size pays a round trip for each. This is that pass in one
        call.

        Coordinates are in mils and converted once here, the same as the
        single-wire tool.

        Stops at the first failure and reports the rest as skipped, so
        the sheet ends up in the state a sequence of single calls would
        leave it in.

        Args:
            wires: a list of ``{"points": [[x, y], ...], "net": ...}``.
                Each needs at least two points. The net may be empty,
                and then the editor infers one from what the wire
                touches.
easyeda_audit_designator_collisions tool
Footprints on the board sharing one designator.

        Two footprints with the same designator are a real defect, not a
        matter of taste: the BOM counts one part, the netlist binds to
        one of them, and pick-and-place gets two positions for a line
        item that has one. It usually arrives from a copied placement or
        from an annotation that did not finish.

        BOARD ONLY, and that is deliberate. On a schematic a multi-part
        symbol puts the same designator on each of its parts by design,
        so the same check there would report every multi-part IC on the
        sheet. One footprint per designator is the rule that holds.

        Components with no readable designator are counted separately
        rather than grouped together, since an unannotated board would
        otherwise report as one enormous collision.
easyeda_audit_single_pad_nets tool
Nets that reach exactly one pad on the board.

        A net with one pad connects nothing. It is the shape a dropped
        wire leaves behind, and it survives layout because a one-pad net
        has nothing to route and so never appears as unrouted.

        REPORTS, does not judge. A test point, a mounting hole and a
        shield tab are all legitimately one pad on their own net, and
        nothing readable here separates those from a connection that was
        meant to exist.

        Counted over PADS, not the netlist. A net can carry tracks and
        vias and still reach one pad, so counting copper would hide
        exactly the case this looks for.
easyeda_find_component tool
Find components whose designator or value contains the query.

        Answers "where is R47", which otherwise means reading every
        component and filtering by hand.

        Searches the BOARD and the SCHEMATIC and says which side each
        hit came from. A part present on one and not the other is
        usually the reason someone is looking, so reporting only the
        board would answer half the question.

        Case-insensitive substring, not a pattern. A designator search
        for "R4" finds R4, R40 and R47, which is the useful behaviour
        when the exact name is what is being looked for.

        Field names are read defensively. EasyEDA's published reference
        lists methods rather than the shape of what they return, so
        several spellings are tried and a component that carries none of
        them is counted as unreadable rather than silently skipped.

        Args:
            query: substring to look for, matched against the
                designator and the value or name.
            scope: "both" (default), "pcb" or "schematic".
easyeda_add_pins tool
Place many pins on the current symbol in one call.

        A symbol is the worst case for one-call-per-primitive: an SOIC-8
        costs eight round trips and a 100-ball BGA costs a hundred.

        Coordinates are the ELECTRICAL end in mils, the same as the
        single-pin tool, converted once here.

        Stops at the first failure and marks the rest skipped, so a
        half-pinned symbol is never mistaken for a finished one.

        Args:
            pins: a list of ``{"pin_number": ..., "x": ..., "y": ...,
                "name": ..., "pin_type": ..., "rotation": ...,
                "length": ...}``.
easyeda_create_ic_symbol tool
Create a COMPLETE IC symbol in one call.

        STANDARD SYMBOLS FIRST: a single op-amp, comparator, current-sense
        or instrumentation amplifier is drawn as a TRIANGLE (inputs left
        with + and -, output at the apex, supplies top and bottom) when
        ``body="auto"`` and the pin names form IN+/IN-/OUT. A dual or quad
        stays a rectangle here, and the reply says so; multi-part symbols
        are drawn as triangles on the Altium side. ``body="rectangle"``
        forces the box.

        You decide the functional grouping, inputs and power on the
        LEFT, outputs on the RIGHT. This lays the pins out on the grid,
        sizes the body to clear the pin names, and emits the whole
        symbol: create, then every pin in one batch, then the body.

        The geometry comes from the SAME module the Altium side uses, so
        a symbol drawn here follows the same discipline rules and the
        two backends cannot drift apart on what a good symbol looks
        like.

        Args:
            library_uuid: the library to create it in, from
                ``easyeda_list_libraries``.
            name: the component name.
            left_pins: pins on the left, top to bottom. Each a dict with
                ``designator``, ``name`` and optional
                ``electrical_type`` (input, output, power, passive and
                so on).
            right_pins: pins on the right, top to bottom, same shape.
            description: the component description.
easyeda_create_passive_symbol tool
Create a complete 2-pin passive symbol in one call.

        The companion to ``easyeda_create_ic_symbol``, using the same
        shared geometry module, so a resistor drawn here matches one
        drawn on the Altium side.

        ONLY resistor and inductor for now, and the reason is a genuine
        limit rather than unfinished work. EasyEDA's schematic
        primitives are arc, circle, polygon, rectangle, text, wire, pin
        and bus, with no LINE among them. A resistor is a rectangle and
        an inductor is a row of arcs. A capacitor is two plates, a diode a bar, a crystal
        two plates and a fuse a lead through a body, and every one of
        those is an open segment.

        A wire would draw the shape and would also be electrical, so the
        symbol would carry connectivity nobody asked for and the fault
        would surface later as a net joining two unrelated things.

        Args:
            library_uuid: the library to create it in, from
                ``easyeda_list_libraries``.
            name: the component name.
            kind: resistor or inductor. The other kinds
                ``generate_passive_symbol`` knows are refused here with
                an explanation.
            description: the component description.
easyeda_add_pads tool
Place many pads on the current PCB or footprint in one call.

        A QFP-64 is sixty-four pads, and one call each is sixty-four
        round trips over a socket.

        Coordinates are in mils and take NO conversion. The PCB canvas
        already counts in mils, unlike the schematic canvas, which is
        the difference this backend keeps having to be careful about.

        Stops at the first failure and marks the rest skipped, so a
        part-padded footprint is never mistaken for a finished one.

        Args:
            pads: a list of ``{"pad_number": ..., "x": ..., "y": ...,
                "width": ..., "height": ..., "shape": ..., "layer": ...,
                "rotation": ..., "hole_diameter": ...}``.
easyeda_create_standard_footprint tool
Create a COMPLETE standard footprint in one call.

        The board-side companion to ``easyeda_create_ic_symbol``, using
        the same shared geometry module the Altium backend uses, so a
        land pattern generated here matches one generated there.

        Emits the pads in one batch, then the silkscreen outline and the
        courtyard.

        THIS IS A STARTING POINT, NOT A LAND PATTERN FROM A DATASHEET.
        It computes a regular geometry from the numbers given; it does
        not know the part. Check it against the manufacturer's
        recommended land pattern before using it on a board.

        Args:
            library_uuid: the library to create it in, from
                ``easyeda_list_libraries``.
            name: the footprint name.
            family: chip, sip, dual, header, tab, quad or bga.
            pin_count: total pads; the signal pins for tab; ignored for
                bga, whose count is rows x cols.
            pitch: centre-to-centre within a row, in mils.
            pad_width: pad width, in mils. The shared generator's pad_w,
                with its two meanings kept: the pad's X size in every
                family but quad (so ACROSS the row in dual), and ALONG
                the row in quad. For a land pattern from a package
                drawing use easyeda_create_footprint_from_package.
            pad_height: pad height, in mils.
            row_span: centre-to-centre between opposing rows, in mils.
                Required for dual and quad.
            corner_radius: rounding for rectangular pads, in mils. The
                shared geometry asks for a roundrect and EasyEDA carries
                the rounding separately, so the radius is chosen here
                rather than invented.
            hole_diameter: drill diameter, in mils. Zero means surface
                mount. A header is through-hole by nature and comes out
                unsolderable without this, so it is not optional in
                practice for the header family.
            description: the footprint description.
            rows, cols: the ball grid, for bga.
            skip: ball names to leave out of a bga, e.g. ["A1"].
            tab_width, tab_height: the tab pad, for tab, in mils; the
                tab takes the next number after the signal pins.
            exposed_pad: a square centre pad for quad, in mils; 0 for
                none. It takes the next number after the pins.
            courtyard: courtyard clearance past the pads, in mils; 0
                leaves the courtyard out.
            body_width, body_height: the body for the silkscreen
                outline, in mils; 0 draws it round the pads.
easyeda_create_footprint_from_package tool
Create a COMPLETE footprint from a datasheet package drawing.

        The EasyEDA twin of ``lib_create_footprint_from_package``, from the
        same engine: the lands come from IPC-7351B for the package's
        terminal dimensions and tolerances, not from a pad list typed in.
        Draws the pads (rounded rectangles with their corner radius,
        circles, ovals, holes and slots), silkscreen kept clear of copper
        with a pin 1 dot, the body outline and a reference text on
        TOP_ASSEMBLY, the courtyard, and paste windows over an exposed
        pad on TOP_PASTE_MASK. Then it reads the pads back from the
        editor and compares count, centres and sizes.

        What the extension cannot express is REFUSED before anything is
        created, not drawn wrong: a non-plated hole (its pad call passes
        no plating flag) and a manual paste or mask expansion. The
        exposed pad's own full paste opening cannot be closed from here
        either; the reply says so and names the pad.

        DATASHEET DISCIPLINE: transcribe the package from the
        manufacturer's drawing fetched in this conversation, each
        dimension as min/nom/max with its page, and name the datasheet
        in ``source``.

        Args:
            library_uuid: the library, from ``easyeda_list_libraries``.
            package: the PackageSpec as an object or JSON text, in mm.
                The same schema as lib_create_footprint_from_package:
                ``family`` plus the dimensions it needs; two-row parts
                have their rows left and right, ``lead_span_x`` across
                them, ``lead_length`` the terminal along the span and
                ``lead_width`` across it.
            name: footprint name; default the package's name.
            density: L, N or M; default the package's own (N).
            description: appended to the generated description.
            courtyard_layer: where the courtyard goes. DOCUMENT by
                default, where easyeda_create_standard_footprint puts it;
                nothing readable on this backend reports a courtyard, so
                pick another layer only if your library uses one.
            drafting: drafting rule overrides, as for the Altium tool.

        Returns:
            ``{ok, name, uuid, pad_count, drawn, readback, layers,
            warnings, notes, steps}``. Coordinates go to the editor in
            mils, converted from the model's mm.
easyeda_audit_device_pin_parity tool
Do a device's symbol and footprint agree on their connections?

        ``easyeda_create_device`` refuses a device bound to neither
        half, but nothing checks the two against each other. An 8-pin
        symbol bound to a 4-pad footprint binds without complaint and
        fails at the netlist or at assembly.

        Compares pin NUMBERS, not counts. A symbol with pins 1 to 8 and
        a footprint with pads 1 to 7 plus 9 has matching counts and is
        wrong.

        REPORTS, does not judge. A footprint legitimately carries
        mounting pads, thermal pads and shield tabs that no symbol pin
        stands behind, so an extra pad is often correct. A pin with no
        pad is the direction that is nearly always a fault: it is a
        connection the schematic makes and the board cannot.

        CHANGES THE OPEN DOCUMENT. Counting means opening the symbol and
        then the footprint, and the footprint is left open when this
        returns. That side effect is the reason this is a separate tool
        rather than a check inside create_device.

        Args:
            uuid: the device's uuid.
            library_uuid: the library holding it.
easyeda_align_components tool
Line placed components up along one edge or centre.

        ALIGNS ORIGINS, not visible edges. EasyEDA reports a
        component's position as its origin and nothing readable gives
        its extent on the board, so for a row of identical parts this is
        exactly edge alignment and for a mixed row it is not. Worth
        knowing before using it on parts of different sizes.

        Moves ONE axis. Aligning left changes x and leaves y alone,
        which is what makes it an alignment rather than a stacking.

        One read and one bulk write, whatever the count.

        Args:
            designators: comma separated, for example "R1,R2,R3".
            alignment: left, right, top, bottom, center_x or center_y.
                The centre modes use the midpoint of the outermost two,
                so the group keeps its position rather than drifting
                toward wherever most of the parts happen to be.
easyeda_distribute_components tool
Space placed components evenly between the outermost two.

        The outermost two do not move: they define the span. Everything
        between them is spread at equal spacing, in the order their
        current positions put them, not the order they were named.
        Sorting by the given order would let a mistyped list reorder the
        board.

        Like the alignment tool, this works on ORIGINS rather than
        visible edges, so equal origin spacing means equal gaps only
        when the parts are the same size.

        Args:
            designators: comma separated, for example "R1,R2,R3,R4".
                At least three, since two are already as evenly spaced
                as two things can be.
            axis: x to spread horizontally, y vertically.
easyeda_snap_components_to_grid tool
Move placed components onto the nearest grid point.

        The other half of ``easyeda_audit_off_grid_components``, which
        reports offsets and cannot correct them.

        DESTRUCTIVE, and quietly so. Every part moves a fraction of a
        grid step, so the board looks the same afterwards and a mistake
        does not show in a screenshot. A connector aligned to a panel
        cutout, a mounting hole on a customer's pattern and a part
        placed to a mechanical dimension are all off-grid deliberately,
        and nothing here can tell them from a slip. Name the parts
        rather than snapping everything unless the board really is
        meant to be entirely on-grid.

        Reports each move with its before and after, so a wrong snap can
        be undone by hand.

        Args:
            designators: comma separated, for example "R1,R2,C7". Empty
                means EVERY component on the board.
            grid: the grid pitch in mils. Must be positive.
            confirm: must be true for anything to move.
easyeda_get_bounding_boxes tool
One bounding box per primitive, in a single call.

        Different from ``easyeda_get_bounding_box``, which returns ONE
        box enclosing everything it is given. That is the right answer
        for "how big is this group" and the wrong one for "where is each
        of these", and getting each separately used to cost a round trip
        apiece.

        A box that cannot be measured comes back as null rather than
        stopping the batch: this is a read, and the answers already
        gathered are worth keeping.

        Args:
            primitive_ids: comma separated, from any query result.
easyeda_audit_placement_collisions tool
Placed components whose extents overlap or nearly touch.

        REPORTS, does not judge. A bounding box encloses a footprint's
        silkscreen as well as its copper, and silkscreen crossing a
        neighbour is routine. What actually decides whether two parts
        can be assembled is a courtyard, and nothing readable on this
        backend reports one. So a pair here is a place to look.

        Two reads whatever the board size: every component, then every
        bounding box in one batch.

        Args:
            clearance: report pairs closer than this, in mils. Zero
                reports only true overlaps. A small positive value finds
                the near misses, which are often the real problem: parts
                two mils apart pass an overlap test and cannot be hand
                soldered.
easyeda_get_board_statistics tool
Counts and extents for the whole board, in one call.

        What a review opens with and what a fab quote needs: how many
        components, nets, pads, vias and track segments, how much copper
        is routed, how many layers, and how big the board is.

        Five reads bundled into one round trip. The board extent comes
        out of the same track list rather than a sixth read, since the
        outline on this backend is just lines on a particular layer.

        A section whose read fails is reported as UNAVAILABLE with the
        reason, never as zero. "No vias on this board" and "the via list
        could not be read" are different statements, and quoting a fab
        from the second one mistaken for the first is how a board comes
        back missing its drills.

        Track length is the sum of the segments the editor reports and
        is only as good as those coordinates. Segments whose endpoints
        cannot be read are counted separately rather than treated as
        zero length.
easyeda_delete_symbol tool
Remove a symbol from a library.

        DESTRUCTIVE. Refused unless ``confirm`` is true, and the
        extension refuses independently.

        A symbol can be BOUND to a device, and deleting it leaves that
        device pointing at a drawing that no longer exists. Nothing
        readable on this backend reports which devices use which symbol,
        so this cannot check and does not pretend to. Delete the device
        first if the whole part is going.

        Boards already using the part keep their placed copies, so a
        design keeps working while the library entry is gone.

        Args:
            uuid: the symbol.
            library_uuid: the library it lives in.
            confirm: must be true for anything to happen.
easyeda_delete_footprint tool
Remove a footprint from a library.

        DESTRUCTIVE. Refused unless ``confirm`` is true, and the
        extension refuses independently.

        The same warning as ``easyeda_delete_symbol``: a footprint bound
        to a device leaves that device pointing at a land pattern that
        is gone, and nothing readable here reports the binding.

        Args:
            uuid: the footprint.
            library_uuid: the library it lives in.
            confirm: must be true for anything to happen.
easyeda_rename_device tool
Rename a library device or change its description.

        The device is the placeable object, so this is the name a
        designer searches for. Renaming the symbol and the footprint
        leaves that name unchanged, which is why the matrix needed this
        one to be complete.

        Args:
            uuid: the device.
            library_uuid: the library it lives in.
            name: the new name. Left alone when empty.
            description: the new description. Left alone when empty.
easyeda_audit_placeholder_values tool
Components still carrying an "I'll fix this later" string.

        A part goes down as a placeholder, TBD goes in its value, and
        six months later the assembly drawing says TBD and the fab
        calls. Cheap to find here and expensive to find there.

        Matched whole-string after trimming, case-insensitive: tbd, tba,
        todo, fixme, xxx, xx, ?, ??, ???, -, --, placeholder, filler,
        ask, unknown, n/a, na, none, null, value, changeme.

        Whole-string on purpose. A substring rule would flag a resistor
        valued "1k" for containing "1" and a part named "NAND" for
        containing "na".

        EMPTY values are not reported. A connector, a mounting hole and
        most ICs carry no value by design, so flagging them would bury
        the real findings.

        Scans every readable string field rather than one named value,
        because EasyEDA's published reference lists methods and not the
        shape of what they return. That also catches a placeholder left
        in a manufacturer or part-number field, which is where it does
        the most damage.

        Args:
            scope: "both" (default), "pcb" or "schematic".
easyeda_audit_via_annular_ring tool
Vias whose copper ring around the drill is too thin to make.

        The ring is (diameter - holeDiameter) / 2. Too thin and drill
        wander breaks out of the pad: an open circuit that appears on
        some boards of a batch and not others, which is the most
        expensive kind of fault to chase.

        Field names are measured rather than assumed: a session on
        reported every via carrying ``diameter``,
        ``holeDiameter``, ``net``, ``x``, ``y`` and ``primitiveId``.
        A via missing either number is counted as unreadable rather
        than passed, since a ring nobody computed is not a ring that
        passed.

        Args:
            minimum_ring: smallest acceptable ring, in mils. The
                default is a common fab floor; check the chosen fab's
                capability table rather than trusting it.
easyeda_audit_dangling_track_ends tool
Track ends that touch nothing else on their own net.

        Port of the Altium bad-connections audit. A segment whose end
        sits near, but not on, the next thing looks connected on
        screen at any sane zoom, and the photoplot does not bridge it:
        a real open, found at test rather than at review.

        NETS WITH A POUR ARE SKIPPED, and that decision is what makes
        the result readable. A ground track legitimately ends inside
        poured copper, and whether an endpoint lands in a polygon is
        not something this can test from the measured outline, so
        every ground track would be reported. Skipping those nets
        loses coverage on exactly the nets least likely to be broken,
        and keeps the report to signal nets where a dangling end is
        unambiguous. The count of skipped nets is returned rather than
        hidden.

        Fields are the measured ones: lines carry ``startX``,
        ``startY``, ``endX``, ``endY``, ``net`` and ``layer``; pads and
        vias carry ``x``, ``y`` and ``net``; pours carry ``net``. Arcs
        are excluded because no measured arc carried a net at all.

        Args:
            tolerance: how close counts as touching, in mils. The
                router places tracks on a sub-mil grid, so an exact
                match is the wrong test.

        Returns:
            {ok, checked, violation_count, violations: [{net, layer,
             x, y, primitive_id}], nets_skipped_for_pours}.
easyeda_audit_parts_excluded_from_bom tool
Placed components that will not appear on the BOM.

        The EasyEDA analogue of the Altium not-fitted audit, which has
        no direct counterpart here because EasyEDA has no assembly
        variants. The DEFECT is the same and it is expensive: a part
        sits on the board, gets a footprint and gets routed, and
        nobody orders it, which is discovered at assembly.

        REPORTS, does not judge. Mounting holes, fiducials, test
        points and shield cans are excluded from the BOM on purpose
        and are the majority of what this finds on a healthy board.
        What it exists to surface is the ONE resistor somebody
        unticked while copying a block. So the list is grouped by
        whether the part carries a part number: an excluded component
        WITH a Partnumber is the interesting case, since a part
        deliberately off the BOM rarely has one.

        Fields are the measured ones: ``addIntoBom`` on each
        component, and ``Partnumber`` among its parameters.

        Returns:
            {ok, checked, violation_count, violations, excluded_total,
             source}. ``violations`` holds only the excluded parts that
            carry a part number; ``excluded_total`` counts them all.
easyeda_audit_mpn_inconsistencies tool
The same library part placed with different part numbers.

        Two presumably-identical components pointing at different MPNs
        is almost always a defect: a typo, or an override made while
        cloning a sub-circuit. Occasionally it means the design wants
        two sources and lost its alternates table. Either way a
        reviewer should see it before the BOM is bought.

        Port of the Altium audit, which groups by library reference.
        Here that is ``Design Item ID`` plus ``Library Name`` from the
        component's parameters, falling back to the library item's
        uuid, which every component carries. The part number is
        ``Partnumber``. All three names are measured from a live
        schematic rather than assumed, which matters because the
        neighbouring ``PP Comment`` holds the formula ``=Comment`` and
        would have made a plausible-looking grouping key that groups
        nothing.

        Blank part numbers are counted separately, not compared: an
        unfilled field is a different problem from a contradictory one,
        and mixing them buries the contradiction.

        Returns:
            {ok, checked, violation_count, violations: [{library_item,
             part_numbers, designators}], blank_part_numbers}.
easyeda_audit_missing_datasheets tool
ICs with no fetchable datasheet URL among their parameters.

        Port of the Altium audit, checking the same slots it does:
        ``HelpURL``, ``Datasheet``, ``DatasheetURL`` and any
        ``ComponentLink*URL``. A slot counts only when its value
        contains ``://``, which is what separates a real link from a
        placeholder.

        That test earns its keep here. A live schematic reported
        ``ComponentLink1URL`` as the literal string ``=HelpURL``, an
        unresolved display formula rather than an address, and a
        presence check would have called that part documented.

        Reads the SCHEMATIC, because that is where parameters live: a
        schematic tab has to be active or the editor refuses, and the
        refusal is passed through rather than reported as a clean
        board. Component classification uses the same helper as the
        Altium side, so an IC is an IC on both.

        A MEASUREMENT GAP worth knowing before trusting a run. The
        only ``sch.components`` sample captured so far is a mounting
        hole, whose parameters are unresolved templates. The same
        board's ``sch.netlist`` reports a real IC with a fully
        resolved ``ComponentLink1URL`` pointing at a manufacturer PDF.
        So it is not yet established whether ``sch.components``
        resolves parameters for ordinary parts or returns templates
        for all of them, and if it returns templates this audit will
        report documented ICs as missing. Confirming that needs one
        sample of a real IC from ``sch.components``; until then, cross
        a surprising result against ``easyeda_get_schematic_netlist``.

        Returns:
            {ok, checked, violation_count, violations: [{designator,
             name, links_seen}]}. An IC with no parameters at all is a
            violation; a part that is not an IC is not checked.
easyeda_audit_missing_decoupling tool
ICs whose power pins have no capacitor on the same net.

        The single most-skipped pre-release check: a missing local
        bypass passes ERC, passes DRC, and bites at first power-on as
        brown-outs and random resets.

        Runs the SAME engine as the Altium audit
        (find_missing_decoupling_from_bom), fed from measured EasyEDA
        data rather than a reimplementation, so the two backends put an
        IC in the same bucket. Components carry their pads nested, and
        each pad carries its net, so one read is enough.

        ONE LIMITATION, and it is the honest direction to fail in: a
        PCB pad has a NUMBER but no pin NAME, so a power pin is
        recognised by its NET name only (VCC / VDD / GND and the rest),
        never by a pin called "VDD" sitting on an oddly-named net. The
        shared engine SKIPS an IC with no recognised power pins rather
        than guessing, so such a part is left unreported instead of
        being reported wrongly. Reading pin names needs the schematic,
        which is a different document context.

        Returns:
            {ok, checked, violations, items: [{designator, status,
             uncovered_pins, covered_pin_count}]} where status is
            "missing" (no power pin has a cap) or "partial". Fully
            covered ICs are not listed: there is nothing to fix.
easyeda_audit_signal_vias_without_return tool
Signal vias with no nearby ground / power via for return
        current.

        Port of the Altium audit, same heuristic on both backends: for
        every via NOT on a power/ground net, look for at least one
        power/ground via within ``radius_mils``. When a high-speed
        signal changes layers the return current has to cross the
        dielectric somewhere; a nearby reference via carries it
        cleanly, and without one it detours through the plane.

        Net classification mirrors the Altium side's
        IsPowerOrGroundNetName exactly (GND vocabulary, any name
        containing GND, and the V/+/- rail prefixes), so the two
        backends flag the same boards the same way. This is a
        SIMPLIFIED proximity heuristic, not a stackup-aware analyser;
        for first-pass review it catches the obvious cases.

        Via fields are the measured ones from a live session
        measured: every via carries ``net``, ``x``, ``y`` and
        ``primitiveId``. The PCB canvas is mils, so the radius needs no
        conversion. A via with unreadable coordinates is counted as
        unreadable rather than passed.

        Args:
            radius_mils: how close a return via must be. Default 50
                mils; typical good practice is within 1-2 mm.

        Returns:
            {ok, checked, violations, unreadable, radius_mils,
             items: [{primitive_id, net, x, y}]}.
easyeda_audit_unconnected_component_pads tool
Components with pads on no net, counted per component.

        The shared unconnected-pins tool names loose pins board-wide;
        this groups them by OWNER, which is what a reviewer acts on: an
        IC with four floating pads is one finding, not four.

        ONE read. Components carry their pads nested (measured live
        measured: every component reported a ``pads`` array whose
        entries carry ``net`` and ``padNumber``), so there is no second
        query and no positional matching between two lists.

        REPORTS, does not judge: a mounting pad, a heatsink tab and a
        deliberately floating shield all look identical here. Two-pad
        parts are excluded by default because a decoupling cap mid-
        placement is noise, not news.

        Args:
            minimum_pads: only components with at least this many pads
                are examined. The default skips passives.
easyeda_audit_acute_angles tool
Track joints that meet at an acute angle.

        An acute joint leaves a sliver of gap the etchant cannot clear
        reliably (an acid trap): some boards of a batch come back with a
        short or a spur there and others do not.

        Segments are grouped by NET and LAYER and compared only where
        they SHARE an endpoint, because two tracks of different nets
        meeting at any angle is a different problem, and a crossing is
        not a joint. The angle measured is between the two directions
        LEAVING the shared point, so a straight continuation reads as
        180 degrees and a hairpin as near zero.

        Field names are measured: every line carries
        ``startX``, ``startY``, ``endX``, ``endY``, ``net`` and
        ``layer``. Segments missing any are counted unreadable rather
        than skipped silently.

        Args:
            threshold_degrees: report joints tighter than this. The
                default of 90 reports everything acute; some fabs only
                care below 60.
easyeda_audit_via_antennas tool
Vias whose net has copper on fewer than two layers.

        A via joins layers. When everything its net owns sits on ONE
        layer, the via joins that layer to nothing: a stub into the
        board that radiates and reflects instead of connecting. It
        usually survives from a rerouted track whose via nobody deleted.

        Copper is counted from TRACKS, PADS, POURS and FILLS together,
        because a via legitimately lands in a plane pour that carries no
        tracks at all. A pad whose layer reads as MULTI reaches every
        layer by construction, so its net is never an antenna candidate.

        REPORTS, does not judge: a via placed for a plane that has not
        been poured yet looks exactly like a mistake until the pour
        exists.

        Field names are measured across all five reads.
easyeda_audit_decoupling_schematic tool
Integrated circuits without a decoupling capacitor.

        The check a schematic review exists for. An IC whose supply pin
        has no local capacitor draws its switching current through the
        whole rail, which shows up as a board that works on the bench
        and fails intermittently, or fails emissions.

        The sibling audit ``missing_decoupling`` asks the same question
        of the BOARD, through the engine the Altium backend uses, so
        the two agree across backends. This one reads the SCHEMATIC,
        which differs in two ways that matter: it can be run before a
        board exists, and it counts capacitors against supply PINS
        rather than parts, so an IC with four supply pins and one
        capacitor is reported rather than passed.

        WHAT IS CHECKED. For each IC, every supply net it touches, and
        whether any capacitor sits on that same net with its other end
        on ground. Values are reported so the split between bulk and
        high-frequency decoupling is visible: a rail with a single 22uF
        and nothing small is a different finding from a rail with
        nothing at all.

        WHAT IS NOT CHECKED. Proximity. A schematic cannot say whether
        the capacitor is near the pin, and on a board it is the loop
        area that matters. This finds the missing capacitor, not the
        badly placed one.

        Supply and ground nets are recognised by name, since the
        netlist reports pin numbers without pin functions. Nets that
        match neither convention are listed as unrecognised so a
        non-standard rail name is visible rather than silently ignored.
easyeda_audit_open_drain_pullups tool
Open-drain buses with a missing or badly sized pull-up.

        An I2C or SMBus line is driven low and released, never driven
        high. Without a resistor to the rail it stays low, the bus
        never idles, and nothing on it answers. That part is not a
        margin question: the bus does not work.

        The SIZE is arithmetic rather than opinion. UM10204 section 7.1
        derives the rise between the 0.3 and 0.7 thresholds as 0.8473
        RC, so the rise time ceiling in Table 10 fixes a maximum
        resistance: Rp(max) = tr / (0.8473 Cb). Too large and the line
        cannot return high inside the bit period; too small and the
        driver cannot pull it down, since the same section sets
        Rp(min) from the 3mA sink current the specification requires.

        Bus capacitance is the one term a schematic cannot supply: it
        is wire, pins and connectors, and it belongs to the board. So
        rather than assume a figure and report a confident verdict,
        this reports the CROSSOVER capacitance at which each fitted
        resistor stops meeting the rise time, which is a number the
        layout can be checked against. Pass bus_capacitance_pf to get
        a straight verdict once that figure is known.

        The default speed is 100kHz because it is the most forgiving,
        so anything reported at the default is a finding at every
        speed. Set bus_speed_khz to the real bus rate to tighten it.
easyeda_audit_capacitor_voltage_margin tool
Capacitors rated too close to the rail they sit on.

        A ceramic capacitor loses capacitance under DC bias, and an
        X5R or X7R part run near its rating can be down to a fraction
        of its marked value. The part meets its specification and the
        circuit still misbehaves, which is why this is worth checking
        on the schematic rather than discovering on the bench.

        The default asks for twice the rail voltage. That is the
        common working rule for ceramics rather than a figure from any
        one datasheet, so it is a parameter: a tantalum or an
        electrolytic is usually derated harder, a film part less.

        WHAT IS NOT CHECKED. The actual capacitance under bias, which
        needs the manufacturer's bias curve and cannot be derived from
        a description. This flags the parts whose curve is worth
        reading, and does not pretend to have read it.

        Rails are only judged when their NAME states a voltage. A rail
        called +VBAT or +VSYS has a voltage set by the design, and
        inventing one would produce a confident wrong verdict, so those
        are reported as unknown instead.
easyeda_audit_crystal_load_caps tool
Crystals whose load capacitors are missing or mismatched.

        A crystal oscillates against the capacitance the circuit
        presents to it. Get that wrong and the part still works, which
        is what makes it worth checking on the schematic: the oscillator
        starts, the frequency is off, and it shows up as a serial link
        that fails only against certain peers or a clock that drifts
        with temperature.

        WHAT IS CHECKED. Each crystal pin reaches a capacitor to ground,
        and the two capacitors carry the SAME value. An unbalanced pair
        pulls the crystal off frequency and is the commoner mistake,
        because both capacitors are present so nothing looks wrong.

        WHAT IS NOT CHECKED. Whether the value is RIGHT. That needs the
        crystal's specified load capacitance from its datasheet and an
        estimate of stray capacitance, neither of which is in the
        schematic. The arithmetic is CL = (C1 C2)/(C1 + C2) + Cstray, so
        the numbers here are reported for that calculation rather than
        judged against a guess.

        A two pin crystal is assumed. A three or four pin oscillator has
        a supply and an output instead of a second load pin, and is
        reported as skipped rather than judged by a rule that does not
        apply to it.
easyeda_audit_power_port_orientation tool
Power and ground glyphs pointing the wrong way.

        A ground symbol drawn upside down, or a rail flag turned
        sideways, is invariably an editing accident. It matters beyond
        tidiness: a VCC glyph pointing down reads as a ground at a
        glance, and one wrong-looking symbol holds the eye long enough
        to hide a real wiring fault underneath it.

        REPORTED AS INCONSISTENCY, NOT AGAINST A FIXED CONVENTION, and
        the difference is deliberate. The Altium check asserts absolute
        angles because Altium's power symbols carry a style
        (``ePowerBar``, ``ePowerGndPower``) that says which way each is
        meant to face. EasyEDA has no such style: a net flag is a net
        flag, and which rotation value points down has never been
        measured here. Asserting one would be a guess, and a guess in an
        audit produces confident findings about nothing.

        So this compares each glyph against the OTHERS OF ITS OWN KIND
        on the same sheet. Grounds are judged against grounds and rails
        against rails, because the two point opposite ways by
        convention. Where a group agrees except for one or two, those
        are reported. Where a group is evenly split, nothing is
        reported and the split is stated: with no majority there is no
        evidence of which way is right.

        Mirroring is reported alongside rotation, since a mirrored
        glyph can read wrongly at the same angle.

        Returns:
            Dict with ``checked``, ``violations``, ``items`` (each with
            ``net``, ``kind``, ``rotation``, ``mirror``, ``expected``
            and ``x``/``y``), and ``groups`` describing what each kind
            agreed on.
easyeda_audit_placeholder_values_schematic tool
Parts still carrying a placeholder instead of a real value.

        Two kinds, and the first is the one that hides.

        An UNRESOLVED FORMULA is a field left as "=Partnumber" or
        "=HelpURL", where the parameter it points at was never
        supplied. The editor shows the formula rather than an error, so
        it reads as filled in, and it survives all the way into a BOM
        as a part number nobody can order.

        A PLACEHOLDER WORD is TBD, TODO or similar, left during design
        and never revisited.

        A blank Value is reported only for parts whose value is their
        identity, which is resistors, capacitors, inductors and beads.
        A connector or a test point has no value and never will, so
        reporting those would bury the ones that matter.

        The sibling ``placeholder_values`` asks this of the BOARD. This
        reads the schematic, where the parameter is actually set and
        where the fix belongs.
review_design tool
EDA-agnostic design review of the open board.

        Runs the same netlist-level review regardless of the active EDA
        (Altium or KiCad): board stats and net classes, annotation hygiene
        (unannotated, duplicate references, missing values), and connectivity
        (single-pin nets, shorted pins/components, unconnected parts and pads,
        missing decoupling). ``backend`` ("altium" | "kicad") targets one tool
        when the server runs in "both" mode; omit it to use the active backend.

        Geometric DRC (clearances, courtyards) is separate and backend-specific.
get_board_info tool
Object counts and net-class summary for the open board, from the
        active backend (or the one named by ``backend``).
list_components tool
Every component on the open board (reference, value, footprint,
        kind), from the active backend (or the one named by ``backend``).
run_drc tool
Run geometric design-rule check (DRC) on the open board.

        Dispatches to the active backend: Altium runs its native DRC; KiCad
        runs ``kicad-cli pcb drc`` (KiCad's own CLI) on the board file on disk,
        so save pending edits first for current results. Returns violation
        counts and a normalized list. ``backend`` targets one tool in "both"
        mode.
run_erc tool
Run the schematic Electrical Rules Check (ERC) on the open design.

        Dispatches to the active backend: Altium runs its native ERC; KiCad runs
        ``kicad-cli sch erc`` on the schematic file on disk (save pending edits
        first). Returns violation counts and a normalized list. ``backend``
        targets one tool in "both" mode.
list_nets tool
Every net on the open board with pin count and class (power / ground
        / signal), from the active backend (or the one named by ``backend``).
(name computed at run time) tool
datasheet_fetch tool
Download a datasheet PDF into the workspace and return its path.

        Read the ``path`` yourself; nothing here parses the PDF. Files are
        cached under ``<workspace>/datasheets`` with a sidecar (URL, part
        number, SHA-256), so a repeat call is a ``cache: "hit"``; a copy
        whose hash no longer matches is fetched again. Refused, storing
        nothing: a non-http(s) URL, over 50 MB, no answer in 60 s, or a
        reply that is not a PDF (a login page); download those in a
        browser instead.

        Args:
            url: the datasheet's http or https URL, ideally the
                manufacturer's own.
            part_number: recorded in the sidecar, for the citation.

        Returns:
            ``{ok, path, sidecar, cache, url, final_url, sha256, size,
            pages, pages_approximate, pages_method, fetched_at}``. ``pages``
            is counted from the page objects in the file without a PDF
            parser and can be None or off for a compressed file.
datasheet_find_pages tool
List the pages of a datasheet PDF that mention given words.

        With no ``terms`` it looks for where a manufacturer publishes its
        land pattern (land pattern, footprint, PCB layout, solder pad,
        stencil, ...). That is often far from the package outline, so call
        it before deciding a datasheet gives none, then read those pages.
        A scanned page has no text and is not found.

        Args:
            path: the PDF on disk (from datasheet_fetch, or a local file).
            terms: words or phrases to find, case ignored.

        Returns:
            ``{ok, path, pages_searched, terms, pages: [{page, lines}]}``,
            pages 1-based with up to three matching lines each.
datasheet_view_page tool
Render part of a datasheet page as a zoomed image, to read a
        drawing's small numbers.

        A land-pattern figure read as a whole page is too small: a 0.75
        among 0.5 spacings or a stepped land corner is lost. Read the image
        it writes. Numbers printed as text in the region are also listed.

        Args:
            path: the PDF on disk.
            page: 1-based.
            region: [left, top, right, bottom] as fractions of the page
                from its top left, e.g. [0.3, 0.2, 0.75, 0.6]; empty is the
                whole page.
            dpi: 72 to 800 (default 400).

        Returns:
            ``{ok, png, width, height, region, dpi, numbers: [{value, at}]}``,
            ``at`` the number's place as fractions of the image.
footprint_compare_drawing tool
Set the land-pattern figure beside the lands a package builds,
        to compare them by eye before the footprint is drawn.

        The figure is source.page of source.path, zoomed to ``region``;
        beside it the lands are drawn alike, each numbered, the gap between
        every pair of neighbouring rows and columns written in red, land
        sizes listed. Read the image and compare every land, gap, size and
        shape with the figure; correct the package for any difference.
        lib_create_footprint_from_package takes custom_pads only with the
        ``compared`` id this returns for those same lands. The package body
        is drawn dashed over the lands.

        Lands named like balls (A1, H8) need their names checked against a
        figure that prints them: when the land figure does not, give the
        ball map (pinout) as names_page and names_region; it is set beside
        the lands drawn as the map is (names_view). Names the map prints as
        text are matched to the lands by position, and a mismatch withholds
        the id.

        Args:
            package: the PackageSpec as for lib_create_footprint_from_package.
            region: the figure on its page, [left, top, right, bottom] as
                fractions of the page from its top left.
            view: "top", or "bottom" when the figure is drawn from below
                (the lands are mirrored to match it).
            dpi: 72 to 800 (default 400).
            names_page: the ball map's page in the same PDF.
            names_region: the ball map on that page, as ``region``.
            names_view: "top" or "bottom", the side the ball map is drawn
                from (default ``view``).

        Returns:
            ``{ok, png, compared, printed_numbers, not_built, ball_names}``:
            ``not_built`` lists numbers printed as text in the figure that no
            land size, gap or span of the built lands shows; ``ball_names``
            ``{checked, mismatched}`` for names the figures print as text.
footprint_check_package tool
Check a package description for numbers that cannot be right.

        Run this on every package transcribed from a datasheet, before
        drawing a footprint from it. Offline.

        Sanity checks (each finding names the dimensions, their values and
        citations, and why the combination is impossible or unusual):
        limits in order; lead width below the pitch; each row of pins fits
        the body it comes out of; lead span larger than the body for
        leaded parts; the foot shorter than the lead's reach and two
        terminals fitting the span; the exposed pad inside the body and
        clear of the terminals; ball diameter below the pitch; values 25.4
        times off their neighbours (mils typed as mm); pin counts the
        family can have; the vendor land pattern consistent with itself.
        ``error`` is impossible, ``warning`` unusual.

        Cross-check, when the package carries the datasheet's recommended
        land pattern as ``vendor``: the IPC pattern computed from the
        package against it, per quantity (pitch, span, land length and
        width, tab, exposed pad, grid land), with both numbers, both
        citations and the difference. Beyond the tolerance measured
        between real vendor patterns and IPC, or a factor of two apart,
        the pair is reported as a likely transcription error in one of the
        two sources.

        Args:
            package: the PackageSpec as an object or JSON text, the same
                schema lib_create_footprint_from_package takes.

        Returns:
            ``{ok, errors, warnings, findings, cross_check, examined,
            notes}``. ``ok`` is true when no sanity finding is an error and
            the cross-check (if it ran) agreed.
footprint_render_package tool
Draw the land pattern a package gives, to compare with its datasheet.

        Offline. Renders the footprint the engine would build (lands with
        their numbers, paste windows, silkscreen with the pin 1 dot,
        assembly outline, courtyard, origin and a 1 mm scale bar) and draws
        the package's terminals over the lands as dashed green outlines,
        so a land that misses its terminal shows. A caption gives the
        pattern's pitch, span and land sizes. Read the returned image next
        to the datasheet's package drawing and recommended land pattern.

        Args:
            package: the PackageSpec as an object or JSON text.
            density: L, N or M (least, nominal, most).
            path: where to write the SVG; default
                ``<workspace>/renders/<name>_<density>.svg``.
            png: also write a PNG beside it through the headless browser
                the board renders use, when one is installed.

        Returns:
            ``{ok, svg_path, png_path, name, density, metrics, warnings}``,
            with ``rasterize_note`` when no PNG could be made.
obj_query tool
Query schematic OR PCB objects and read their properties.

        Args:
            object_type: Altium object type constant.
                Schematic: "eNetLabel", "ePort", "ePowerObject", "eSchComponent",
                "eWire", "eBus", "eBusEntry", "eParameter", "eParameterSet", "ePin",
                "eLabel", "eLine", "ePolyline", "eRectangle", "eSheetSymbol", "eSheetEntry",
                "eNoERC", "eJunction", "eBlanket" (outline in "Vertices",
                settable as "x1,y1,x2,y2,..."; also "LineStyle",
                "Collapsed"); symbol graphics as "sch_polygon",
                "sch_arc", "sch_ellipse", "sch_elliptical_arc", "sch_bezier"
                (plain "polygon" and "arc" are the board's), the bare
                "ellipse", "elliptical_arc" and "bezier", "eDesignator",
                "eRoundRectangle", "eIEEESymbol" (Symbol, ScaleFactor)
                PCB: "eTrackObject", "ePadObject", "eViaObject", "eComponentObject",
                "eArcObject", "eFillObject", "eTextObject", "eRuleObject", "eDimensionObject",
                "eSplitPlaneObject" (a plane layer's regions, with Net
                and Layer),
                "eConnectionObject" (the ratsnest: one line per unrouted
                connection, with X1, Y1, X2, Y2, Layer1, Layer2 and Net)
            properties: Comma-separated property names to return.

                SCHEMATIC objects use the dotted spelling:
                "Text,Location.X,Location.Y" for net labels;
                "Designator,Name,ConnectionX,ConnectionY" for pins
                (ConnectionX/Y is the ELECTRICAL end a wire must touch;
                Location is the body-side root);
                "Designator.Text,Comment.Text,LibReference" for
                components, "DisplayMode,DisplayModeCount" and
                "DisplayModeNames" (the alternate drawing; names
                ";"-separated from Normal; settable) and
                "FootprintPinMap" (the current footprint model's pin map,
                "(G:1),(D:2),(S:3)"; obj_modify also takes "G:1;D:2" and
                merges by schematic pin, so a map cannot be cleared).
                "ComponentKind" is its Component Type, read and set by
                name: standard, mechanical, graphical, net_tie_bom,
                net_tie_no_bom, standard_no_bom or jumper; with scope
                "lib_component:NAME" it sets a library symbol's.
                "TextFontId" is a sheet or harness entry's label font;
                "OwnerSheetSymbol" an entry's symbol. A
                managed component also reads
                "LibraryIdentifier,DesignItemId,ItemGUID,RevisionGUID"
                and the other Vault/Symbol GUIDs.

                PCB PRIMITIVES ARE FLAT, NOT DOTTED: a track's net is
                "Net", never "Net.Name". "Net,Layer,Width" for tracks;
                "Net,Layer,HoleSize,Size" for vias;
                "Designator,Comment,Pattern,Rotation,X,Y,NameOn,CommentOn"
                for components; "Text,Height,StrokeWidth,IsDesignator,
                IsHidden" for texts, and "MirrorFlag" (settable; the text
                stays put). Polygons ("polygon") read and set their pour
                settings: "Name,Grid,TrackSize,
                MinTrack,ArcApproximation,NeckWidthThreshold" (decimal
                mils), "IslandAreaThreshold" (square mils),
                "PolyHatchStyle,PourOver" (raw ordinals), "UseOctagons",
                and the read-only "PourIndex,Poured"; nothing repours.

                A board type returns EVERY primitive of that type
                ("InComponent=false|InPolygon=false": free copper).
                Mechanical-layer tracks have no net. On a board only an
                exact Net=,
                Component= or BoundsLeft/BoundsBottom (X1/Y1) is indexed;
                any other condition (X=, Y=) is checked on every object
                (Layer=: one layer's).
            scope: "active_doc" (default); "project" (every sheet of the
                focused project); "doc:PATH" or the bare path (that sheet,
                no focus change); "project:PATH"; "lib_component:NAME" (a
                symbol in the active SchLib), "lib_component:NAME@3" for
                part 3 of a multi-part one (else only part 1 is seen;
                OwnerPartId 0 = shared). Anything else: INVALID_SCOPE.
            filter: Pipe-separated property=value conditions (AND), e.g.
                "Text=VCC" or "Designator.Text=R1"; "" matches all.
                Numbers match as numbers ('.' or ','): Location.Y=9000.0
                meets 9000; text matches exactly.
                "Net!=GND" excludes; "Y>4250|Y<=5000" compares numbers;
                "Name~POUR_*" matches a wildcard pattern (* any run, ? one
                character, case ignored), "Net!~VCC*" excludes by one. A
                PCB Layer takes the internal name ("Mechanical21") or the
                board's own, any case; ~ meets either; no layer: refused.
                Same grammar in obj_modify, obj_delete, obj_select, obj_count.
            limit: Most objects to return (0 = all); it also ends the
                search early, and count is then the number returned.

        Returns:
            "objects", "count"; "not_on_this_type": properties the type
            lacks.
obj_explain_pin tool
Explain WHY a schematic pin is on the net it is on.

        Lists every object at the pin's CONNECTION point (what drives its
        net; two different labels there is a short) and at its body-side
        ROOT (electrically inert; a label there leaves the pin floating).
        A label at the root belongs at ``connect_x_mils`` /
        ``connect_y_mils``. Objects match by exact location, not
        bounding box.

        Without ``sheet_path`` the active sheet is searched first, then
        the sheets of the project (``project_path``, or the focused one),
        so two open projects that both have a U1 answer for the sheet
        in front of you.

        Args:
            designator: Component designator, e.g. "U10".
            pin: Pin NUMBER (not pin name), e.g. "5".
            sheet_path: Search only this open SchDoc.
            project_path: Search this project's sheets (.PrjPcb path)
                instead of the focused project's; the active sheet is
                then not searched first.

        Returns:
            ``designator, pin, pin_name, sheet, sheet_path`` (the full
            path of the sheet the pin is on), ``found_on``
            (named_sheet, active_sheet_in_project,
            active_sheet_outside_project or project), ``orientation,
            pin_length_mils, root_x/y_mils, connect_x/y_mils,
            compiled_net`` (from the project's netlist, only when the
            sheet is in that project), and ``at_connection`` /
            ``at_root`` lists of ``{kind, text, x_mils, y_mils}``.
obj_modify tool
Apply ONE set of property values to every object matching ONE filter.

        When each object needs a DIFFERENT value (10 pins to 10 positions,
        distinct designators), give ``items``: a list of
        {scope, object_type, filter, set} dicts, one per filter: ONE
        request, but each item is its own search and edit (its own undo
        step); arguments given beside ``items`` apply to every item. No rollback: items before a failure
        stay applied. After a designator list, check the netlist: duplicate
        designators merge nets silently (proj_annotate renumbers without
        duplicates). With items a value in ``set`` may hold ';' but no
        field may hold '~~'.

        Args:
            object_type: Altium object type constant (see `obj_query`)
            set: Pipe-separated assignments, e.g. "Text=NEW_NAME" or
                "Location.X=100|Location.Y=200". Board lengths are
                decimal mils; a non-number is reported failed, never
                written as 0. Board properties include, besides the
                usual geometry: HolePositiveTolerance and
                HoleNegativeTolerance on pads and vias ("unset" when
                none is set; Altium keeps a negative tolerance as its
                size; IsCounterHole reads); BarCode* and Multiline* on a
                text (their sizes follow the text: read them back); TextHeight,
                TextFormat, TextPrecision, TextPrefix, TextSuffix,
                Arrow* and Extension* on a dimension; PolygonType,
                BorderWidth, AvoidObsticles (Altium's spelling),
                ClipAcuteCorners, MitreCorners, IgnoreViolations and
                ArcPourMode on a pour; EnablePinSwapping and
                EnablePartSwapping on a part (IsBGA reads); also on a
                part LockStrings, PrimitiveLock,
                NameAutoPosition and CommentAutoPosition
                (Altium's anchor numbers), FootprintDescription, DefaultPCB3DModel
                (PackageSpecificHash reads), SourceDescription,
                JumpersVisible, ChannelOffset and GroupNum; on a board
                pad JumperID, SwapID_Pad, SwapID_Part, SwappedPadName and
                OwnerPart_ID; on pads and vias PasteMaskExpansionMode and
                SolderMaskExpansionMode (Altium's numbers: from the rule or
                manual), PasteMaskUsePercent, PasteMaskPercent and
                PasteMaskEnabled; on any board object DetailString,
                DRCError, UniqueID and IsElectricalPrim (reads); on any
                schematic object DescriptionString, IdentifierString and
                ErrorString (reads); on tracks, arcs and vias IsPreRoute
                and UserRouted; on a pour DrawRemovedNecks,
                DrawRemovedIslands, DrawDeadCopper, ExpandOutline and
                AutoGenerateName; on board text Inverted,
                UseInvertedRectangle, InvertedTTTextBorder,
                TTFInvertedTextJustify, TTFOffsetFromInvertedRect and
                ConvertedString (reads: the text as shown) and
                UnderlyingString (reads: the text as typed); on a 3D body OverrideColor (draw its
                own colour, not the model's), Texture (an image file) and
                TextureRotation; on a board pad DrillType (how the hole
                is made: 0 drilled, 1 punched, 2 laser, 3 plasma) and
                IsVirtualPin (reads); on a placed part FlippedOnLayer
                (reads: its "flip on layer" option, not its side); on
                board text BorderSpaceType (Altium's number).
                Schematic pins take
                Symbol_Inner, Symbol_Outer, Symbol_InnerEdge,
                Symbol_OuterEdge and Symbol_LineWidth (Altium's numbers),
                HiddenNetName and DefinedFunctions (the pin's functions,
                ";"-separated; writing replaces the list); schematic parts
                take ShowHiddenPins, ShowHiddenFields, PinsMoveable,
                PartIdLocked, DisplayFieldNames, OverideColors (Altium's
                spelling) and PinColor. Pins also take where their name
                and number sit: Name_PositionMode,
                Name_CustomPosition_Margin,
                Name_CustomPosition_RotationAnchor,
                Name_CustomPosition_RotationRelative and the same four
                for Designator_ (Altium's numbers), DefaultValue and
                FormalType; schematic parts also LibraryPath (the library
                the symbol came from) and AliasAsText. Schematic parameters
                take ReadOnlyState, ParamType, AllowLibrarySynchronize
                and AllowDatabaseSynchronize, and report NameIsReadOnly,
                ValueIsReadOnly, IsRule, IsSystemParameter and
                IsConfigurable, and with designators ShowName,
                Autoposition and GraphicallyLocked (not saved); ports
                take AutoSize,
                OverrideDisplayString and HarnessColor (not saved).
                Styles of notes, frames, shapes, ports, power
                ports and off-sheet connectors: tool_guide.
                Symbol pins
                take SwapIdPart (shared by every pin of the part),
                SwapIdPin, SwapIdPair, SwapIdPartPin.
            scope: "active_doc" (default), "project" (all SCH sheets),
                "doc:C:\\\\path\\\\Sheet.SchDoc" (no focus change), or
                "lib_component:NAME" (a symbol in the active SchLib,
                selected for you). A board type takes only the default:
                any other is refused (SCOPE_NOT_SUPPORTED).
            filter: Pipe-separated property=value conditions (AND logic)
            items: Several filter+set operations at once (see above).

        Returns:
            "matched", "sheets_processed", and on a schematic "modified"
            (something was written) with "saved" false: the sheet is
            marked modified, not saved; app_save_all writes it.
            On a board "reindexed" and "stale_index": objects the write
            dropped from the board's index, put back or not.
            With items: operations_processed, operations_skipped,
            total_matched and per-item ``results`` with ``matched`` and a
            ``note`` ("no_objects_matched" when nothing matched).

        Example - rename a net on every sheet:
            obj_modify(object_type="eNetLabel", scope="project",
                       filter="Text=OLD_NET", set="Text=NEW_NET")
        Example - edit a pin on any part of a multi-part SchLib symbol:
            obj_modify(object_type="ePin", scope="lib_component:R_0402",
                       filter="Designator=1", set="Name=A")
        Example - put board copper on a net, or take it off (track, arc,
        via, pad, fill, region, polygon; the net must exist, "" = no net):
            obj_modify(object_type="eRegionObject",
                       filter="Layer=TopLayer|Net=GND", set="Net=")
obj_create tool
Create and place a schematic object.

        For several, give ``items``: a list of {object_type, properties,
        container} dicts, created in ONE Altium transaction (one undo
        step); arguments given beside ``items`` apply to every item.

        Args:
            object_type: Altium object type constant (see `obj_query`)
            properties: Pipe-separated property=value assignments, e.g.:
                "Text=MY_NET|Location.X=100|Location.Y=200"
            container: "document" (place on active schematic) or
                      "component" (add to current library component)
            items: Several objects at once (see above).

        Example, three net labels in one call:
            obj_create(object_type="eNetLabel", items=[
                {"properties": "Text=VCC|Location.X=100|Location.Y=200"},
                {"properties": "Text=GND|Location.X=100|Location.Y=400"},
                {"properties": "Text=SCK|Location.X=300|Location.Y=200"}])

        Shapes take their geometry here, in mils and degrees: Radius,
        StartAngle, EndAngle on sch_arc (0 to 360 is a circle) and
        elliptical_arc; SecondaryRadius on elliptical_arc and ellipse
        (Radius is the X radius); Vertices "x1,y1,x2,y2,..." on polyline
        (2 points or more), sch_polygon (3 or more) and bezier (4, 7,
        10 ... points); StartLineShape,
        EndLineShape (None, Arrow, Solid Arrow, Tail, Solid Tail, Circle,
        Square) and LineShapeSize on polyline; FileName, EmbedImage,
        KeepAspect and Corner.X / Corner.Y on image.

        Returns:
            Dictionary confirming creation, and ``properties``: the names
            not written (unknown, or a value the object did not keep).
            With items: created, failed, total, the failures by index,
            and property_problems. Known unsupported properties
            (IsHidden on anything but pins, parameters, designators and
            sheet names; Text on a type without it, such as eParameterSet
            or eWire) reject that item before registration with reason
            UNSUPPORTED_PROPERTY; the other items still run.
obj_delete tool
Find and delete schematic or PCB objects.

        For several type/filter sets at once, give ``items``: a list of
        {scope, object_type, filter} dicts, run in one round trip; an item
        with an empty filter needs confirm_delete_all, or nothing is sent.
        Arguments given beside ``items`` apply to every item.

        A PCB type deletes from the active board (with a library or sheet
        in front: the only open board, brought forward; in a footprint use
        lib_delete_footprint_primitives). It also
        matches footprint primitives and polygon hatching unless the
        filter says "InComponent=false|InPolygon=false". To take up
        routing use ``pcb_unroute``.

        Args:
            object_type: Altium object type constant (see `obj_query`)
            scope: "active_doc", "project", "doc:PATH", or
                "lib_component:NAME" (a named symbol in the active SchLib).
                A PCB type takes only "active_doc"; any other is refused
                (SCOPE_NOT_SUPPORTED) and nothing is deleted.
            filter: Pipe-separated property=value conditions (AND logic).
                    WARNING: empty filter deletes ALL objects of the type.
            confirm_delete_all: Must be True to delete all objects when filter is empty.
            items: Several deletes at once (see above). Reply:
                operations_processed, total, total_deleted and per-item
                ``results`` with ``deleted``; ``partial:`` notes and
                ``operations_partial`` as for a single delete.

        A filter that is not Name=Value pairs (an Altium query expression
        such as ``OnLayer('TopLayer') Or ...``, or a bare name) is refused,
        and nothing is deleted.

        Returns:
            Dictionary with "matched" count (number deleted). When a
            removal fails part way, ``partial`` is true, ``delete_error``
            says why, and ``matched`` still counts the objects already
            removed. Query before repeating a delete that failed or timed
            out: the first part of it may already have happened.
            A sheet's system parameters (Title, Author, Revision ...) are
            never removed (Altium recreates one with the value * on the
            next load): a filter that meets one leaves it, names it in
            ``kept_system_parameters`` and answers ``success`` false.
            Change or clear one with obj_modify (set Text).
obj_get_font_spec tool
Get font properties for a given font ID.

        The font an object's FontId names.

        Args:
            font_id: Font ID from an object's FontId property

        Returns:
            Dictionary with font_id, size, rotation, bold, italic, underline,
            strikeout, font_name
obj_get_font_id tool
Get or create a font ID for the given font properties.

        Looks up (or creates) an entry in the Altium font table matching the
        specified properties and returns its font ID. Use the returned font_id
        to set an object's FontId property via `obj_modify`: labels, net
        labels, power objects, cross-sheet connectors, parameters,
        designators, sheet names, ports, text frames and notes. A sheet
        entry's or harness entry's label font is TextFontId.

        Args:
            size: Font size in points (e.g., 8, 10, 12)
            font_name: Font family name (default "Arial")
            bold: Whether the font is bold
            italic: Whether the font is italic
            rotation: Text rotation in degrees (0, 90, 180, 270)
            underline: Whether the font is underlined
            strikeout: Whether the font has strikeout

        Returns:
            Dictionary with font_id
obj_select tool
Select objects matching a filter on the active document.

        Sets the selection state on matching schematic or PCB objects for
        visual highlighting. Use `obj_deselect_all` to clear. On a board
        it ignores Altium's Selection Filter and searches twice (select,
        then read back): an indexed filter (see `obj_query`) keeps that
        quick. With a library or sheet in front a PCB type acts on the
        only open board.

        Args:
            object_type: Altium object type (schematic or PCB)
            filter: Pipe-separated property=value conditions (AND logic)

        Returns:
            ``{"matched": N, "selected": M, "success": bool}``. ``matched``
            is what the filter picked; ``selected`` is how many of those
            read back as selected afterwards, and ``success`` is false
            with a ``reason`` when that is fewer. A select reports
            nothing about property readability.
obj_deselect_all tool
Clear all object selection on the active document.

        Returns:
            Dictionary confirming deselection
obj_zoom tool
Control the viewport zoom level of the focused document.

        Works on a schematic, a schematic library, a board and a footprint
        library; the focused tab decides which editor zooms.

        Args:
            action: "fit" (Fit All Objects, which can cut a sheet's frame
                off), "document" (a schematic's Fit Document: the whole
                sheet with its frame), "board" (the board outline with
                a margin, not parts parked beside it; a schematic fits
                as "fit"),
                "selection" (zoom to selected objects), "point" (zoom
                to x, y) or "object" (centre a named object on a
                schematic sheet, see name)
            x, y: the point for "point", in mils (a footprint's frame in
                a PCB library)
            radius: half the width of the square the view is fitted to
                round the point, mils (default 200)
            name: for "object": a part's designator, a net label, port,
                power port or off-sheet connector name, or a harness
                connector's type; case is ignored. The reply lists every
                match with its box (what Altium outlines when selected)
            scale: for "object": how much of the window the object's box
                fills, percent (default 50)
            index: for "object": which match to show, from 1 (default 1)

        Returns:
            Dictionary confirming the zoom action
sch_reload_document tool
Save, close and reopen one schematic sheet, then recompile its
        project, so nets and ERC are compiled from the sheet as it is.

        A recompile alone can keep what the sheet no longer holds: a
        deleted net label still naming its net, a changed sub-part still
        compiled as the old one. A harness wiring diagram links its wires
        to pins and splices only when it loads, so it takes the same step.

        Args:
            file_path: The open .SchDoc or .WirDoc.
            save: Write it first; ``saved`` is measured on disk. False
                closes without writing, and a sheet Altium reads as
                modified is refused untouched; an edit Altium did not flag
                is lost.

        Returns:
            ``file_path``, ``saved``, ``closed``, ``reopened`` and
            ``recompile`` (its compile ticks); ``ok`` false with ``stage``
            and ``reason`` at the first step that did not take, the sheet
            left open when it fails before the close.
sch_place_comment tool
Post an Altium 365 review comment at a point on a schematic.

        A comment is kept only on a project saved to an Altium 365
        Workspace. On a local project it is placed but stays unsaved, and
        closing the project asks "Save To Workspace" (Yes moves the
        project into the Workspace, No drops the comment). A free sheet
        offers no comment at all. There is no API for comments, so this
        drives the interface: Place > Comment, Jump To Location to the
        point, then the popup's text box and Post. It brings Altium to the
        front and leaves the view zoomed in on the point.

        Args:
            text: The comment.
            x, y: The point on the sheet, in mils.
            document: The schematic's full path. Empty uses the focused
                document, which must be a schematic.

        Returns:
            ``ok``, ``posted``, ``document``, ``x``, ``y`` and ``kept``
            (where the comment is stored); or ``ok: False`` with
            ``reason`` and, when Altium refused, ``altium`` with its
            message. The posted text is not read back: the Comments and
            Tasks panel cannot be read.
sch_mirror_component tool
Mirror a placed schematic component horizontally.

        USE THIS RATHER THAN WRITING `IsMirrored` with obj_modify, which
        sets the flag and leaves the drawing unchanged. This reflects the
        primitives as Altium's own mirror does.

        Args:
            designator: component to mirror, e.g. "U1"
            mirrored: True or False for an absolute state; omit to
                toggle. Asking for the state it already has is a no-op,
                not a second reflection.
            doc_path: sheet to act on. Defaults to the focused schematic.

        Every primitive is reflected about the component's X; a kind it
        cannot reflect stays put and is counted in primitives_skipped.

        Returns:
            Dictionary with designator, mirrored (the resulting state),
            primitives_moved, primitives_skipped, and changed.
sch_rename_designators tool
Rename designators across a whole project, swaps included, refusing
        any collision before the first write.

        Each rename names a part by its current ``designator`` (with
        ``sheet``, a file name or full path, when copies of a sheet share
        it) or by the ``unique_id`` of any of its parts (obj_query
        ``UniqueId``), and gives ``to``. A part is its sub-parts on one
        sheet with one designator and library reference, so a multi-part
        part is renamed whole. Every sheet is loaded and every part read
        first: a name the batch hands out that another part keeps, a part
        named twice, or one not found refuses the whole batch with nothing
        written. The parts then go through unique temporary names before
        their final ones, so R1 to R2 and R2 to R1 works, and the project
        is read back after each step. Nothing is saved (app_save_all).
        To renumber a whole design, proj_annotate stays the tool.

        Args:
            project_path: The .PrjPcb, a full path.
            changes: ``[{"designator": "R1", "to": "R2"}, ...]``, with
                ``sheet`` when needed, or ``unique_id`` in place of
                ``designator``.
            dry_run: Check and plan only.

        Returns:
            ``ok``, ``changes`` (``sheet``, ``from``, ``to``, ``parts``),
            ``sheets``, ``components``, ``duplicates_left`` (designators
            parts the batch does not touch still share, as on copied sheets
            not annotated yet); when written, ``verified`` and per step
            ``temporary`` and ``final`` with what was read back. A step
            that did not read back as planned stops with ``stage`` and
            ``now`` (each changed part's designators as the project holds
            them), so nothing is left unreported.
obj_batch_modify tool
Apply many filter+set operations in ONE call (obj_modify items).

        What ``obj_modify(items=[...])`` runs, kept under this name for
        callers that use it.

        No rollback: ops that ran before a failure stay applied. After a
        designator batch, check the netlist: duplicate designators merge
        nets silently. proj_annotate renumbers without duplicates.

        Args:
            operations: List of operation dicts, each with:
                - scope: "active_doc" (default), "project",
                  "doc:C:\\\\path\\\\to\\\\file.SchDoc", or "lib_component:NAME"
                  (a symbol in the active SchLib; ops may name different
                  symbols).
                - object_type: e.g. "ePin", "eParameter", "eSchComponent",
                  or a PCB type such as "eTrackObject" (active board,
                  scope "active_doc" only).
                - filter: Pipe-separated conditions, e.g. "Name=VDD".
                - set: Pipe-separated assignments, e.g.
                  "Location.X=300|Location.Y=-100|Orientation=2". A value
                  may contain ';' but not '|'.

        Returns:
            operations_processed, operations_skipped, total_matched, and
            per-op ``results`` with ``matched`` and a ``note``
            ("no_objects_matched" when nothing matched).

        Example op: ``{"scope": "lib_component:R_0402", "object_type":
        "ePin", "filter": "Designator=1", "set": "Name=A"}``.
obj_run_process tool
Run an Altium process command via the generic primitive layer.

        Wraps any Altium RunProcess call with structured pipe-separated parameters.

        Args:
            process_name: The Altium process identifier (e.g., "Sch:Compile",
                "WorkspaceManager:OpenObject", "PCB:Zoom")
            parameters: Optional pipe-separated key=value parameter pairs, e.g.:
                "ObjectKind=Document|FileName=C:\\\\path\\\\to\\\\file.SchDoc"
                PCB:AutoRoute, Altium's own autorouter, is refused
                (AUTOROUTER_NOT_ALLOWED) unless the user has set "Altium
                autorouter" to Allowed on the Config tab: route with
                pcb_route_brief and pcb_route_round.

        Returns:
            Dictionary with execution result. Success means the process
            was dispatched: Altium accepts an unknown process silently,
            so read the design back to see what it did.
proj_run_erc tool
Run Electrical Rules Check on the focused project.

        Compiles the project first (required), runs ERC, and returns
        what it found, the same list ``proj_get_erc_violations`` reads:
        what Altium reports. A violation a No ERC marker covers, or of a
        type set to No Report, is left out and counted in
        ``suppressed_count`` / ``not_reported_count``.

        Args:
            limit: How many violations to return; 0 returns all of them.
            include_suppressed: list those too, each with ``suppressed``
                and ``level``.

        Returns:
            ``violation_count`` and ``violations``: each with its kind,
            document, detail and the related objects, whose cross-probe
            string names the exact pin or net. ``truncated`` is true when
            the list stops short of ``violation_count``; read the rest
            with ``proj_get_erc_violations(offset=next_offset)``.
sch_set_components_parameters tool
Bulk-update parameters on placed schematic components, in one
        call and one undo group. The follow-up to the parameter audits.

        Args:
            stamps: One dict per component: ``designator`` plus any
                parameter key/values, e.g. ``{"designator": "R1",
                "Value": "10k", "MPN": "..."}``. A parameter the part
                lacks is created, hidden, at the part. ``Value`` writes
                the part's Comment and also a Value parameter the part
                already has; ``Description`` writes the part's own
                description (as a parameter Altium dropped it on reload).
            sheet_path: Optional SchDoc path; default the focused one.

        Returns:
            ``{updated, failed, total}``; ``failed`` counts stamps that
            could not be applied (designator not found and the like).
            A ``Footprint`` key repoints the part's footprint model;
            ``footprints_applied`` counts the ones that read back the
            new name and ``footprints_not_applied`` lists designators
            whose part has no footprint model or did not take it.
proj_get_erc_violations tool
Return the ERC violation list produced by the last
        ``proj_run_erc()`` invocation.

        A cheap re-read; ``proj_run_erc()`` does the slow check. Each
        violation lists its ``related_objects`` (``kind``, ``document``
        and the ``cross_probe`` string Altium uses to find that exact
        pin or net). Act only on a named object: a NoERC marker placed by
        guesswork hides a real disconnection. ``related_object_count``
        tells a violation with no objects from one whose objects could
        not be read.

        Args:
            limit: How many violations to return; 0 returns all of them.
            offset: Index of the first violation, to page through a long
                list without running ERC again.
            include_suppressed: also list violations a No ERC marker
                covers or whose type is set to No Report; left out and
                only counted by default, as Altium's Messages panel does.

        Returns:
            ``{"violation_count", "offset", "returned", "truncated",
            "next_offset" (when truncated), "violations": [{"index",
            "description", "detail", "related_object_count",
            "related_objects": [{"kind", "document", "cross_probe"}]}]}``
obj_highlight_net tool
Highlight a net by name in the focused schematic or PCB document.

        On a board it sets the net's IsHighlighted. On a schematic it
        SELECTS the matching net labels, power ports, ports and sheet
        entries on the active sheet, replacing the selection. It follows
        the focused document; ``context`` forces "pcb" or "schematic".

        Args:
            net_name: Exact net name to highlight (e.g., "VCC", "GND",
                "NET_D0"). Returns NOT_FOUND if the net doesn't exist
                on the PCB, or `highlighted=0` on schematic if no
                primitive carries that net name on the active sheet
                (check other sheets).
            clear_existing: Clear existing highlights first (default True).
            context: Empty (default, follow the focused document),
                "schematic", or "pcb".

        Returns:
            Dict with success, net, context ("pcb" or "schematic"), and
            `highlighted` (count of matches, 1 for PCB, N for sch).
obj_crossref_net tool
Compare the schematic vs PCB membership of a named net.

        The schematic's pins and the board's pads on the net, and the
        difference both ways: ``pcb_only`` pins are connections an Update
        PCB from Schematic would remove.

        Args:
            net_name: Exact net name as it appears in the schematic
                (case-sensitive).

        Returns:
            Dict with:
              - net_name
              - sch_pin_count, pcb_pin_count
              - matched (count of pins present on both sides)
              - sch_only_count, pcb_only_count
              - in_sync (True only when both sides list the same pins
                AND the net exists on at least one side)
              - sch_pins[], pcb_pins[], each entry is
                "Designator.PinNumber"
              - sch_only[] (missing from the board), pcb_only[] (on
                the board only)
obj_clear_highlights tool
Clear all net highlights in the active schematic or PCB document.

        On a schematic a highlight is a selection, so the whole sheet is
        deselected (no count is reported).

        Returns:
            Dictionary confirming highlights were cleared
proj_add_sheet tool
Create a new schematic sheet and add it to a project.

        The sheet is created in the same directory as the project file.
        Refused (FILE_EXISTS) when a file of that name is already there,
        as one removed with proj_delete_sheet is: it would open with its
        old drawing. Refused (NO_PROJECT) when no project is named and
        the focused document belongs to none, as a library opened on its
        own does.

        Args:
            name: Name for the new sheet (without .SchDoc extension).
                  Default "NewSheet".
            project_path: The open project to add it to; empty means the
                focused project.

        Returns:
            ``path``, ``project_path``, ``saved``, ``added_to_project``
            (read back from the project's document list) and
            ``project_saved``; ``success`` only when saved and added.
proj_delete_sheet tool
Remove a schematic sheet from the focused project.

        Safety check: refuses to remove the last remaining schematic sheet.
        The file is removed from the project but not deleted from disk, and
        closed unless it has unsaved edits. The project file is saved and
        read back, and Altium writes it fresh when its save left the
        sheet in it, as proj_remove_document does.

        Args:
            file_path: Full path to the .SchDoc file to remove

        Returns:
            ``removed``, ``project_saved`` and ``in_project_file`` (the
            file on disk still lists it); ``success`` only when it does not.
obj_switch_view tool
Switch the focused board or footprint library (.PcbLib)
        between 2D and 3D view.

        Args:
            mode: "3d" or "2d" (default "3d").
            camera: 3D only, where the view ends: "top", "iso"
                (tilted), "bottom", "front", "back", "left" or "right";
                empty keeps the current camera.
            fit: frame everything (in 3D from above, one step out).
            views: 3D only, cameras to turn through first, each held a
                moment, e.g. "iso,bottom,front" to show a model from
                several sides.
            footprint_name: in a .PcbLib, the footprint to show; without
                it the editor shows whichever footprint is current. With
                another document in front, the only open .PcbLib is
                brought forward first.

        Returns:
            Dictionary confirming the view switch
obj_refresh_document tool
Force a redraw/refresh of the current document.


        Returns:
            Dictionary confirming the refresh
proj_get_unconnected_pins tool
Find unconnected/floating pins in the focused project.

        Compiles the project first.

        Returns:
            Dictionary with "count" and "unconnected_pins" array, each entry
            having designator, pin_number, pin_name, and sheet path
sch_stub_pins tool
Draw a short wire stub + net label on every unconnected schematic pin.

        Each floating pin (as `proj_get_unconnected_pins` finds them) gets
        a wire out from its end and a net label "<designator>_<pin_number>",
        so ERC reports it as a named single-pin net.

        Args:
            stub_length_mils: Length of each stub wire in mils (default 100)
            only_designators: If given, only stub pins on these components

        Returns:
            Dictionary with "stubbed" and "failed" counts, plus the pin list
            that was acted on
sch_place_rectangle tool
Place a rectangle shape on the active schematic (decorative only).

        Args:
            x1, y1, x2, y2: Opposite corners in mils
            solid: Fill the rectangle (default False = outline only)
            line_width: 1 (small), 2 (medium), 3 (large)

        Returns:
            Dictionary confirming rectangle placement
sch_place_line tool
Place a decorative line on the active schematic.

        This is a graphic line, not a signal wire. Use `sch_place_wires`
        for electrical connections. Use this for hand-drawn borders,
        arrows, diagram overlays.

        Args:
            x1, y1, x2, y2: Endpoints in mils
            line_width: 1 (small), 2 (medium), 3 (large)

        Returns:
            Dictionary confirming line placement
sch_place_note tool
Place a text-box note on the active schematic.


        Args:
            x1, y1, x2, y2: Note box corners in mils
            text: Note content

        Returns:
            Dictionary confirming note placement
sch_place_sheet_symbol tool
Place a sheet symbol for a child .SchDoc of the project (exact
        file name). Add entries with sch_place_sheet_entry.

        Args:
            x1, y1, x2, y2: Corners in mils.
            sheet_file_name: e.g. "PSU.SchDoc".
            sheet_name: Default: the file name.
            repeat_first, repeat_last: Channels, e.g. 1 and 4, named
                Repeat(sheet_name,1,4).
sch_autoposition_labels tool
Put part designators and comments, and sheet-symbol names and file
        names, back where Altium positions them, on the active schematic.

        For labels left at the sheet origin (the bottom-left corner) or
        anywhere odd after a scripted placement. Each label's auto-position
        is turned back on and Altium is made to position it, as rotating a
        part and rotating it back does by hand. A label moved on purpose
        (obj_modify Designator.Location.X) loses that position.

        Args:
            names: Designators and sheet names to fix; none means every
                part and sheet symbol on the sheet.
            method: What makes Altium reposition: "rotate" (90 degrees and
                back), "move" (one grid step and back) or "modify" (an
                edit with no change).

        Returns:
            ``count`` and per object ``name``, ``kind``, ``location`` and
            every label ``before`` and ``after`` (x, y in mils and
            autoposition).
sch_place_sheet_entry tool
Place an entry on a sheet symbol; it joins the child sheet's
        port of the same name.

        Args:
            sheet_name: The symbol's name (a repeated one by its plain name).
            entry_name: The child port's name.
            repeat: One signal per channel, named Repeat(entry_name).
            io_type: "input" | "output" | "bidirectional" | "unspecified"
            side: "left" | "right" | "top" | "bottom"
            distance_from_top: Along the side, in mils.
            font_id: 0 takes the sheet's entry font, else its net labels'.

        Returns:
            Where it was placed and ``font_id``.
sch_place_bus_entry tool
Place a bus entry (45 degree stub) connecting a wire to a bus.

        Bus entries are the angled stubs that tap a single-signal wire
        off a bus line. Start point should sit on the bus; end point
        should sit on the wire (both usually at 45 degrees offset).

        Args:
            x1, y1: Start coordinates in mils (typically on the bus)
            x2, y2: End coordinates in mils (typically on the wire)

        Returns:
            Dictionary confirming bus entry placement
sch_set_sheet_size tool
Set the sheet size / template style of the active schematic.

        Changes SheetStyle on the current SchDoc. Use a named style
        (A-E, A0-A4, Letter, Legal, Tabloid) or "Custom" with explicit
        width and height in mils. Give ``style``, ``orientation`` or both.

        Args:
            style: Sheet size name, e.g. "A", "A3", "A4", "Letter", "Custom"
            custom_width: Custom sheet width in mils (only if style="Custom")
            custom_height: Custom sheet height in mils (only if style="Custom")
            orientation: "landscape" or "portrait"; empty leaves it as is

        Returns:
            Dictionary confirming the style change
sch_set_sheet_options tool
Read, or set, the active sheet's reference zones and where they
        are counted from, margin, border style, template graphics, title
        block, border, sheet and border colours and document font. Call
        with nothing to read.

        On a standard sheet size the zones and margin follow the size, so
        zones_x, zones_y and margin_width do not take; the custom_* ones
        apply to a custom-size sheet. Every value is read back; one that
        did not take is in ``not_applied``. Nothing is saved.

        Args:
            zones_x, zones_y: Reference zones across and down (from 1).
            margin_width: Sheet margin in mils.
            border_style: Altium's border style number (read one back
                first; 0 is the standard border).
            reference_zones: Show the zone letters and numbers.
            show_template_graphics: Show the template's graphics.
            custom_zones_x, custom_zones_y, custom_margin_width: The same
                for a custom-size sheet.
            title_block_on, border_on: Show Altium's standard title block
                and the sheet border.
            zone_origin: Where the zones are counted from: "upper_left"
                (Altium's default) or "bottom_right" (zone 1 and zone A in
                the bottom right corner).
            document_font_id: The sheet's document font, a font id from
                obj_get_font_id in this session; one that names no font is
                refused.
            sheet_color, border_color: The sheet's background colour and
                the colour of its border and zone frame, "#RRGGBB".

        Returns:
            ``changed``, ``options`` (read back after any write; colours
            as "#RRGGBB" with Altium's BGR integer beside them as
            ``sheet_color_bgr`` and ``border_color_bgr``; the font as
            ``document_font_id`` and ``document_font``, its name, size and
            style) and ``not_applied``.
sch_sheet_template tool
Read, set, update or remove the sheet template (.SchDot) of a
        schematic sheet, with no dialog.

        A template carries the sheet size, the border and the company
        title block. Setting one switches the standard title block off
        and keeps the sheet's parameters (Title and the rest), which the
        title block then shows. Altium's own update and remove commands
        ask for a scope in a dialog; these do not, and act on one sheet.
        Every action is read back.

        A template on the Altium server is set by its vault and revision
        GUIDs instead of a file: Altium downloads it and the sheet keeps
        the link. Read the GUIDs off a sheet already linked (get with
        vault=True) or from the server; the workspace template lists are
        not reachable here. "update" keeps a link: with revision_guid it
        moves the sheet to that revision, without arguments it applies
        the revision the sheet is linked to again (it does not look for
        a newer one).

        Args:
            action: "get" (default), "set", "update" or "remove".
            template_file: A local .SchDot for "set". For "update" it is
                optional: without it a sheet linked to the server updates
                from the server, any other reads its own template file
                again (it must still exist on this machine). A local file
                replaces a server link.
            vault: Also read the vault link (vault, item and revision
                GUIDs and names); always read after a server set or update.
            file_path: The sheet (.SchDoc). Empty uses the sheet in front.
                Set and update bring a named sheet forward for Altium's
                template command and then restore the view you had.
            vault_guid, revision_guid: A server template for "set" or
                "update", in place of template_file; both together.
            parameter_action: What a server "set" does to the sheet's
                parameters: "add_new" (default, adds the template's
                parameters the sheet lacks), "none", "override_all" (the
                template's values replace the sheet's) or "auto".

        Returns:
            ``applied`` (the sheet reads back as asked: the file, or the
            vault and revision asked with a template file),
            ``template_source`` ("local" or "server", for set and
            update), ``asked`` (the GUIDs a server call used),
            ``template_file``, ``template_before``, ``template_objects``,
            ``template_graphics``, ``sheet_style``, ``title_block_on``,
            ``border_on``; ``removed`` for "remove"; ``vault``.
sch_audit_outside_sheet tool
Find anything drawn outside the active schematic's sheet, and
        with ``apply`` bring it back inside.

        Reads the sheet's REAL frame from Altium (an A3 frame is 15500 x
        11100 mils, not A3 paper), every object's bounding box, and the
        template's own graphics, which become the title-block keep-out
        rather than objects. Reports what is past the border or over the
        title block, then a verdict:
        - ``fits``: nothing outside.
        - ``shift``: the drawing fits once moved by ``dx``, ``dy``.
        - ``enlarge``: it does not fit; ``to_size`` is the first larger
          sheet of the SAME family (A4 -> A3, ANSI A -> B) that holds it.
        - ``too_big``: nothing in the family holds it.
        A shift is whole 100 mil steps, so everything stays on the grid.

        ``apply`` (default False, which changes nothing) fixes it the
        preferred way first: a ``shift`` moves EVERY object on the sheet
        by dx, dy, wires and labels with the parts, so no connection
        changes. An ``enlarge`` on a sheet without a template sets the
        larger sheet size, then shifts if that is still needed. A sheet
        drawn from a template is not enlarged here: ``to_template`` names
        the same-family template to move it to. ``actions`` lists what was
        done and the reply is the audit after it.
sch_place_bus tool
Place a bus segment between two XY coordinates on the active schematic.

        Name it with a net label in bus syntax (DATA[0..7]), then add bus
        entries and wires.

        Args:
            x1: Start X coordinate in mils
            y1: Start Y coordinate in mils
            x2: End X coordinate in mils
            y2: End Y coordinate in mils

        Returns:
            Dictionary confirming bus placement with coordinates
sch_place_net_label tool
Place a net label at coordinates on the active schematic.

        The label takes the font most of the sheet's net labels use, and
        Altium's native net-label maroon (Color 128) always.

        Args:
            text: Net name for the label (e.g., "VCC", "GND", "SDA")
            x: X coordinate in mils
            y: Y coordinate in mils
            orientation: Label rotation (0=0deg, 1=90deg, 2=180deg, 3=270deg)

        Returns:
            Dictionary confirming placement
sch_place_port tool
Place a port on the active schematic for inter-sheet connectivity.

        Args:
            name: Port name (maps to net name)
            x: X coordinate in mils
            y: Y coordinate in mils
            style: The port's axis: "horizontal" (also "none", "left",
                "right", "left_right") or "vertical" (also "top",
                "bottom"). Altium keeps only the axis; the arrows follow
                io_type and the end that is wired.
            io_type: I/O direction, "unspecified", "output", "input", "bidirectional"
            width: Port length in mils. Auto-size is turned off so it
                holds; 0 leaves the port sizing itself to its name.
            font_id: The port's font. 0 takes the font the sheet's ports
                already use, else its net labels' font.

        Returns:
            ``font_id``, ``width`` and ``auto_size`` read back.
sch_tidy_port_references tool
Move each port's cross-reference off its wire, to the free end.

        A port moved without its wire keeps its "Sheet[zone]" reference on
        the wired end, over the wire. Each reference goes 20 mil past the
        free end. Vertical ports are ``skipped``. The sheet is not saved.

        Args:
            sheet_path: The .SchDoc.
            dry_run: True (default) only lists what would move.

        Returns:
            ``to_move`` (port, which end is wired and how that was decided,
            x and justification now and new), ``already_right``,
            ``skipped`` (with why), ``orphan_references``; once written
            ``moved`` and ``not_moved``.
sch_place_power_port tool
Place a power port symbol (VCC, GND, etc.) on the active schematic.

        Args:
            text: Net name for the power port (e.g., "VCC", "GND", "+3V3")
            x: X coordinate in mils
            y: Y coordinate in mils
            style: Symbol style:
                "circle", circle symbol (default, typical for VCC)
                "arrow", arrow symbol
                "bar", bar/line symbol
                "wave", wave symbol
                "gnd_power", power ground symbol
                "gnd_signal", signal ground symbol
                "gnd_earth", earth ground symbol
                Any other name is refused rather than drawn as a circle.
            orientation: which way the glyph points from the connection
                point: 0=right, 1=up, 2=left, 3=down. Leave at -1 to let
                the bridge decide by style: the three ground glyphs point
                down, the supply glyphs (circle, arrow, bar, wave) point up.
            font_id: The net name's font. 0 takes the font the sheet's
                power ports already use, else its net labels' font.

        Returns:
            The placement, with the ``font_id`` the power port got.
sch_get_sheet_parameters tool
Get title block parameters (title, revision, date, etc.) from a schematic sheet.

        Reads all parameters from the sheet without modifying anything.
        sch_sheet_parameters lists the same and adds, sets and removes
        them, sheet rules included.

        Args:
            file_path: Full path to a specific .SchDoc file. If empty, reads
                       from the active document.

        Returns:
            Dictionary with "count" and "parameters" array, each having
            "name" and "value" (and, as sch_sheet_parameters lists them,
            "index", "hidden", "system", "rule" ...)
sch_sheet_parameters tool
List, add, set or remove a schematic sheet's own parameters (the
        title block fields and the sheet's design rules), never a part's.

        Args:
            action: "list", "add", "set" or "remove".
            file_path: The .SchDoc; empty = the sheet in front.
            name: The parameter. list: only those of that name.
            index: Its index as listed (set, remove). With name too, the
                two must agree; a name that repeats needs the index.
            value: The value to write (add, set). add makes a second
                parameter of a name already used (a note says so).
            rule: Instead of value, a sheet rule as its fields, e.g.
                {"RULEKIND": "Clearance", "NAME": "HV", "GAP": "20mil",
                "NETSCOPE": "DifferentNets", ...}; it is a parameter
                named Rule. The first rule goes into the sheet's empty
                system Rule (value *), later ones are new parameters.

        list gives each parameter's index, name, value, hidden,
        read_only_state (0 none, 1 name, 2 value, 3 both), system, rule,
        removable, and a rule's rule_fields. add writes it hidden: a
        sheet's own parameter is never drawn, and Altium reads every one
        back hidden after a reload. A system parameter (Title,
        Author, Rule ...) takes a value but is not removed: Altium makes it
        again, with the value *, on the next load. A value Altium holds
        read-only is refused. Each write is read back: applied is false
        when Altium did not keep it (a rule it did not take reads back as
        PcbType=ProtelPcb), and marks the sheet without saving it.

        Returns:
            list: count, parameters. add / set / remove: action, applied,
            parameter (read back; remove: as it was), saved false,
            pending_save true.
obj_copy tool
Copy matching schematic objects to the clipboard.

        Selects objects matching the filter, copies them to the system
        clipboard, then clears selection.

        Args:
            object_type: Altium schematic object type (see `obj_query`)
            filter: Pipe-separated property=value conditions (AND logic)

        Returns:
            Dictionary with count of copied objects
obj_count tool
Count objects of a type without reading their properties.

        On a board with NO filter Altium's own counter answers at once;
        with a filter it searches like `obj_query` (an indexed filter keeps
        that quick, see there).

        Args:
            object_type: Altium object type constant (see `obj_query` for options)
            scope: "active_doc" (default), "project", or
                "doc:C:\\\\path\\\\Sheet.SchDoc" for a specific loaded sheet.
                A PCB type counts the active board and takes no other
                scope (SCOPE_NOT_SUPPORTED).
            filter: Pipe-separated property=value conditions (AND logic)

        Returns:
            Dictionary with "count" (and "sheets_processed" for project scope)
sch_place_no_erc tool
Place a No ERC marker on a pin's connection end. By default it
        is active and suppresses every violation, as Altium's own does.

        Args:
            x, y: Location in mils.
            symbol: Altium's Symbol integer.
            orientation: Quarter turns, 0 to 3.
            suppress_all: False suppresses only ``error_kinds`` and
                ``connection_pairs`` (Altium's strings).
            active: False places it switched off.

        Returns:
            Every option read back. ``error_kinds`` and
            ``connection_pairs`` are left out while ``suppress_all`` reads
            back true: they suppress nothing more then, and they are some
            3 KB a marker.
sch_place_junction tool
Place a MANUAL junction at coordinates on the active schematic.

        A T NEEDS NONE: Altium draws a junction itself where a wire ends
        on another. Use this only where two wires CROSS and must connect;
        a plain crossing is not a connection.

        Args:
            x: X coordinate in mils
            y: Y coordinate in mils

        Returns:
            Dictionary confirming placement with coordinates
obj_get_document_info tool
Get comprehensive info about the active document.

        For schematics: file path, kind, sheet size, title block visibility,
        snap grid, visible grid, unit system, and custom dimensions.
        For PCB: file path, kind, origin, snap grid.

        Returns:
            Dictionary with document properties
obj_set_grid tool
Set the snap, visible and electrical grids for the active
        schematic. pcb_set_grids sets a board's grids.

        Args:
            snap_grid: Snap grid size in mils (0 = don't change); a metric
                grid in mils keeps its fraction (0.5 mm = 19.685)
            visible_grid: Visible grid size in mils (0 = don't change)
            snap_grid_on: Switch the snap grid on or off (None = don't change)
            visible_grid_on: Switch the visible grid on or off (None = don't change)
            hotspot_grid: Electrical grid in mils, how far a wire end is
                pulled onto a pin or wire (0 = don't change)
            hotspot_grid_on: Switch the electrical grid on or off (None =
                don't change)

        Returns:
            Dictionary with the resulting grid sizes and on/off state
sch_optimize_wires tool
Tidy the wires on the active sheet with Altium's own wire
        optimiser: wires that continue one another are joined and
        overlapping pieces trimmed. Connectivity is unchanged.

        Returns:
            ``sheet``, ``wires_before`` / ``wires_after`` and
            ``vertices_before`` / ``vertices_after``.
sch_reference_zones tool
Where each part, net label, port, power port, sheet symbol and
        off-sheet connector sits on the active sheet, as the border zone
        a printed drawing is read by ("B3"). The zone is Altium's own; a
        sheet without zones gives an empty one.

        Args:
            kinds: Any of "component", "net_label", "port", "power_port",
                "sheet_symbol", "cross_sheet"; None for all.

        Returns:
            ``sheet``, ``count`` and ``objects``: each ``kind``, ``text``
            (designator, label, port or sheet name), ``zone`` and ``x`` /
            ``y`` in mils.
sch_editor_options tool
Read, or set, the schematic editor's preferences.

        These are Altium's own preferences and apply to every sheet. Call
        with nothing to read; every option set is read back.

        Args:
            snap_to_electrical_grid: Pull wire ends onto pins and wires.
            electrical_grid_distance: How far they are pulled (Altium's
                number).
            drag_orthogonal: Wires stay at right angles when dragging.
            components_cut_wires: A part dropped on a wire cuts it.
            optimize_wires: Join and trim overlapping wires.
            single_slash_negation: One leading backslash bars the
                whole name.
            convert_special_strings: Show special strings as values.
            mark_manual_parameters: Mark parameters moved by hand.
            show_pin_direction: Draw each pin's direction arrow.
            auto_zoom: Zoom to a part found by a cross-probe.
            click_clears_selection: A click on empty space clears it.
            double_click_runs_inspector: Double-click opens the
                Inspector.
            undo_levels: How many steps undo keeps.
            pin_name_margin: Gap between the body edge and a pin name,
                in mils.
            pin_number_margin: Gap from the body edge to a pin number,
                in mils.
            multi_part_naming: How multi-part designators are written
                (Altium's number: U1A, U1:1 ...).
            increment_primary: The step for repeated placement, e.g. "1".
            increment_secondary: The second step, e.g. "1".
            power_ground_name: Net name of a new power ground port.
            signal_ground_name: Net name of a new signal ground port.
            earth_name: Net name of a new earth port.
            expand_designators / expand_net_labels / expand_ports /
                expand_sheet_number / expand_document_number: In a
                multi-channel design, show these as they are on each
                channel rather than as drawn.
            watermark_read_only_sheets: Mark sheets that cannot be
                edited.
            always_drag: Moving a part drags its wires along.
            use_printer_fonts: Draw text with the printer's fonts.
            default_template: The template file new sheets start from.
            increment_drops_leading_zero: Repeated placement drops a
                leading zero (R09 is followed by R10, not R010).
            ctrl_double_click_goes_down: Ctrl + double-click on a sheet
                symbol opens the sheet below.
            confirm_selection_memory_clear: Ask before a selection
                memory is cleared.
            allow_device_sheet_editing: Device sheets may be edited.
            watermark_device_sheets: Mark device sheets.
            cutter_grid_multiple: The wire cutter's length in snap grids.
            cutter_fixed_length: The wire cutter's fixed length, in mils.
            physical_view_dim_level: How far the physical view dims what
                is not in focus (Altium's number).

        Returns:
            ``options`` (each option by these names), ``changed``,
            ``not_applied``, ``refused`` and ``unknown``.
sch_set_units tool
Set the unit system for the active schematic.

        `obj_get_document_info` reads the current one.

        Args:
            unit: one of
                "mil"           , imperial, mils (0.001 in)
                "inch"          , imperial, inches
                "dxp"           , DXP default
                "auto_imperial" , auto-scaled imperial display
                "mm"            , metric, millimetres
                "cm"            , metric, centimetres
                "m"             , metric, metres
                "auto_metric"   , auto-scaled metric display

        Returns:
            Dictionary confirming the change, with the resulting
            unit_system ("imperial" or "metric").
sch_add_directive tool
Place a directive ON a wire of the active schematic; its
        parameters (e.g. NetClass=PWR) go to that net. For an area, use
        sch_place_blanket.

        Args:
            x, y: Location in mils.
            param_name, param_value: One parameter.
            parameters: Several, e.g. {"NetClass": "PWR", "Width": "20"}.
            style: Altium's Style integer.
            orientation: Quarter turns, 0 to 3.
            parameter_list: Instead of parameters: [{"name", "value",
                "hidden"}, ...] in order; names may repeat, values may
                hold '=' and '|'. {"rule": {"RULEKIND": "Length", ...}}
                instead of a value makes a Rule parameter.
            name: The directive's own name (default: its first parameter's).

        Returns:
            The ``directive`` read back, each parameter with ``hidden``.
sch_get_directives tool
Enumerate parameter-set directives on the active schematic sheet.

        Each with its location and the parameters it carries, including
        the directives held inside blankets (sch_get_blankets lists the
        blankets themselves and the nets they cover).

        Returns:
            Dictionary with ``directives`` array, each entry has
            ``name``, ``x``, ``y``, ``owner`` ("sheet", or "blanket" for
            one held inside a blanket) and a ``parameters`` list of
            ``{name, value, hidden}`` objects, plus ``count`` and
            ``in_blankets``.
sch_place_blanket tool
Place a blanket on the active schematic: a polygon whose directive
        applies to every net it encloses (a net class, a differential pair,
        No ERC over an area).

        Args:
            vertices: Outline as [[x, y], ...] in mils, at least 3 points.
            parameters: The directive's parameters, e.g. {"NetClass": "PWR"}.
                Omit for a bare blanket.
            parameter_list: Instead of parameters: [{"name", "value",
                "hidden"}, ...] in order; names may repeat, values may
                hold '=' and '|'. {"rule": {"RULEKIND": "Length", ...}}
                instead of a value makes a Rule parameter.
            name: The directive's own name (default: its first parameter's).
            directive_x, directive_y: Where the directive sits, in mils.
                Default: the first vertex, on the outline, which is where
                Altium reads a blanket's directive from.
            line_style: Outline style, as Altium's integer.
            collapsed: Draw the blanket collapsed.
            color, area_color: Border and fill, Altium's BGR integers;
                omitted, the user's blanket defaults. The fill is always
                see-through: the blanket is drawn above what it encloses
                (sch_set_draw_order sends it back), and Altium keeps no
                opaque blanket fill on save.

        Reshape: obj_modify eBlanket "Vertices=x1,y1,x2,y2,...".
        Coverage: sch_get_blankets after a compile.

        Returns:
            ``vertices``, ``color``, ``area_color``, ``transparent``,
            ``line_style`` and the ``directive`` read back.
sch_set_draw_order tool
Bring matching objects on the active sheet to the front, or send
        them to the back. A sheet draws its objects in the order they were
        placed, so a new rectangle, image or blanket hides what is under it.

        Args:
            object_type: Schematic object type (see `obj_query`), e.g.
                "eBlanket". Only objects placed on the sheet itself have
                a draw order; pins, sheet entries and a part's parameters
                go with their owner.
            filter: Pipe-separated property=value conditions (AND logic),
                as `obj_query`. Empty = every object of the type.
            to: "front" (drawn over everything else) or "back" (drawn
                under everything else).

        Not undoable with Ctrl+Z; set it again to change it. Kept on save.

        Returns:
            ``matched``, ``moved``, ``objects_on_sheet`` and ``verified``
            (the matches read back at the front or back of the sheet).
sch_place_compile_mask tool
Place a compile mask on the active schematic: what it encloses
        is left out of the compile, netlist and ERC.

        Args:
            x1, y1, x2, y2: Corners in mils.
            collapsed: Draw it collapsed.
sch_place_harness_connectors tool
Put library parts on a harness wiring diagram as harness connectors.

        A part placed with sch_place_components lands on a .WirDoc as a
        plain component that harness wires cannot attach to. This copies
        the part into a harness connector instead: its graphics and models
        as drawn in the library, each pin as a harness pin, its designator
        and comment where the library puts them. The reply gives each
        pin's end, the point a harness wire must start or finish on.

        Args:
            connectors: [{lib_reference, library_path (.SchLib), designator,
                x, y (mils), rotation (0, 90, 180 or 270)}].
            document_path: The open .WirDoc. Empty uses the document in
                front. Anything other than a wiring diagram is refused.

        Returns:
            ``placed``, ``failed``, ``total`` and ``connectors`` [{designator,
            lib_reference, placed, problem, pin_ends [{pin, name, x, y}]}].
sch_place_harness_wires tool
Draw harness wires and splices on a harness wiring diagram.

        A wire runs through its points; start and finish it on a pin end
        (from sch_place_harness_connectors) or on a splice. Altium links a
        wire's ends to what they touch only when the diagram loads, so with
        ``connect`` the diagram is saved, closed and reopened afterwards
        and each wire's ends are read back.

        Args:
            document_path: The open .WirDoc.
            wires: [{points [[x, y], ...] (mils, two or more), name ("W1"),
                colour ("#RRGGBB"), colour_name (the wire colour code,
                e.g. "RD")}].
            splices: [{x, y, name ("SPL1")}].
            connect: Save and reopen the diagram, then read the ends back
                (default True). False leaves the ends unlinked until the
                diagram is next opened.

        Returns:
            ``placed``, ``failed``, ``total``, ``items`` [{kind, name,
            placed, problem}] and, with ``connect``, ``reload`` and
            ``connections`` [{wire, end1, end2}], an end reading
            "pin:J1-1" or "splice:SPL1", empty when it touches nothing.
sch_get_harness tool
Read a harness wiring diagram (.WirDoc): every wire and what it joins.

        Lists the harness objects by kind and name (components, pins such
        as "P1-1", splices, cables, twists, shields, wire labels,
        no-connects) and each wire with its points, its colours, what its
        two ends meet and the splices, labels, shields, twists and cables
        it belongs to. Objects Altium names only by position (twists,
        shields) get one running number in document order: "shield1",
        "twist2".

        Args:
            document_path: The open .WirDoc. Empty reads the document in
                front.
            limit: The most wires to list (default 500).

        Returns:
            ``document``, ``wire_count``, ``wires_listed``, ``truncated``,
            ``objects`` [{kind, name}] and ``wires`` [{name, points (mils),
            colours (primary, secondary, tertiary, border names and the
            same as #RRGGBB), end1, end2 ("pin:P1-1", "splice:SPL1",
            "no_connect:Nc1", empty when unconnected), splices, labels,
            shields, twists, cables}].
sch_get_active_net tool
Read the compiled net of the net label, port, power port or wire selected on a sheet.

        The first selected object of those four kinds is looked up in the
        compiled netlist of the sheet's project, so a wire answers with
        its net too. Nothing is written.

        Args:
            document_path: The open .SchDoc. Empty reads the sheet in front.
            route: "auto" (default), "getnet" (one lookup by handle; no
                net labels) or "lines" (walks the sheet's nets).
            compile: Compile the project first (skipped while unchanged).

        Returns:
            ``net`` ("<none>" when nothing is selected, "" when the
            netlist has none for it: compile first), ``kind``, ``text``,
            ``x``, ``y`` (mils), ``sheet``, ``project``, ``route`` (the
            one that answered), ``compiled``, ``found``, ``ms``.
sch_get_blankets tool
List the blankets on the active schematic sheet.

        Returns:
            ``blankets``: each with ``vertices`` ("x,y;x,y;..." in mils), its
            box (x1, y1, x2, y2), ``line_style``, ``collapsed`` and the
            ``directives`` inside it or on its edge (``owner`` "blanket" or
            "sheet").
            ``coverage``: per blanket, from the last compile, the ``nets``
            and ``sheet_symbols`` it covers. ``compiled`` false: the sheet
            is not in the focused project.
sch_place_image tool
Place an image/logo on the active schematic.

        Args:
            image_path: Full path to the image file (BMP, JPG, PNG, etc.)
            x: X coordinate in mils (bottom-left corner)
            y: Y coordinate in mils (bottom-left corner)
            width: Image width in mils (default 500)
            height: Image height in mils (default 500)

        Returns:
            Dictionary confirming placement with path and dimensions
proj_replace_component tool
Replace a part on the active sheet with another library part.

        With ``library_path`` (a .SchLib) the symbol itself is swapped: the
        new symbol goes where the old one is, every pin's connection point
        is compared, and only then is the old part removed. The designator
        and UniqueId carry over, so the board keeps its link. A pin that
        would move or disappear refuses the swap with nothing changed
        (``PIN_MISMATCH``), unless ``allow_pin_changes``.

        Without ``library_path`` only the library link changes
        (LibReference, DesignItemId, library name); the symbol, pins and
        graphics on the sheet stay the old part's, and the reply says
        ``symbol_replaced: false``.

        Args:
            designator: Component designator to replace (e.g., "U1", "R3")
            new_lib_ref: New library reference / component name
            new_library: New source library name for the relink (optional,
                keeps current if empty)
            library_path: .SchLib holding ``new_lib_ref``; swaps the symbol.
            allow_pin_changes: Swap even when pins move or disappear; the
                wires on those pins are then left unconnected.

        Returns:
            ``symbol_replaced``. After a swap: ``pins_kept``,
            ``pins_missing``, ``pins_moved``, ``pins_added``,
            ``parameters_not_on_new_symbol`` (old parameters the new
            symbol lacks, not copied) and ``unique_id_kept``.
sch_relink_components tool
Point placed parts at another library, without Altium's dialog.

        The kind follows ``library_path``: a .SchLib or .IntLib links the
        symbol (``lib_ref``) from that file; a .DbLib links a database row
        (``dblib_table`` and ``dblib_key``, the row's key). ``footprint``
        and ``footprint_library`` repoint the current footprint model.
        Only the link changes: the symbol drawn on the sheet stays until
        Altium updates from the library (``app_update_from_libraries``);
        ``proj_replace_component`` swaps the symbol itself.

        Checked FIRST, so nothing changes on a bad target: a SchLib/IntLib
        given by full path must contain ``lib_ref``; the DbLib key must
        pick out one row, with the whole table read (else
        ``DBLIB_KEY_NOT_UNIQUE``), and that row's symbol and footprint
        fill ``lib_ref`` and
        ``footprint`` when they are not given. Every part is read back:
        ``parts`` has each one's link ``before`` and ``after``, and a
        field that did not take is named in ``not_applied``.

        Args:
            designators: the parts to relink, e.g. ["R1", "R2"].
            library_path: target .SchLib, .IntLib or .DbLib (full path to
                verify; a bare file name is written without checking).
            lib_ref: the symbol name in that library.
            dblib_table: DbLib table.
            dblib_key: the row's key, which becomes the Design Item ID.
            footprint: footprint name for the current footprint model.
            footprint_library: .PcbLib the footprint model points at.
            sheet_path: open .SchDoc; empty = the focused sheet.
            all_sheets: every open schematic of the focused project.
            dry_run: report what would change, write nothing.
            verify: check the target before writing (default True).
sch_clear_source_library tool
Unpin placed schematic components from a stale source library.

        After a library is renamed or moved, placed parts still point at it
        (``SourceLibraryName``, ``DesignItemId``) and show ``<Not Found>``.
        This clears the first and sets the second to LibReference, so
        Altium re-matches from the Available Libraries. DesignItemId is a
        property, not a parameter (for one part: ``obj_modify``).

        Args:
            sheet_path: absolute .SchDoc path; empty = the focused
                sheet. For a whole project, call once per sheet (see
                proj_list_documents).
            designators: restrict to these designators (whole-string,
                case-sensitive); None/empty = every component on the
                sheet.
            clear_source_library: clear ``SourceLibraryName``.
            sync_design_item_id: set ``DesignItemId`` = LibReference
                where they differ.

        Returns:
            {"total": inspected, "cleared_source_library": n,
             "synced_design_item_id": n}.
sch_get_constraint_groups tool
Enumerate IDocument.DM_ConstraintGroups on the active schematic.

        FPGA-style pin and timing constraints attached to the document.

        Returns:
            Dict with groups (list of {target_kind, target_id,
            constraint_count, constraints[{kind, data}, ...]}) and count.
sch_place_harness_connector tool
Place a harness connector on the active schematic sheet, with
        its entries.

        Draw the signal harness from it with sch_place_signal_harness.
        Move a placed one with obj_modify Location.X / Location.Y on
        eHarnessConnector: its entries go with it. eHarnessEntry and
        eSignalHarness are obj_query / obj_delete types.

        Args:
            x, y: Top-left corner in mils; the body hangs below it.
            width, height: Connector rectangle size in mils.
            harness_type: Named harness type (optional).
            entries: Entry names, top to bottom (e.g. ["USB+", "USB-"]).
            entry_side: "left", "right", "top" or "bottom".
            entry_pitch: mils from the top to the first entry and between
                entries; keep the height long enough for them.

        Returns:
            Dict with success, x, y, width, height, harness_type,
            ``entries`` as read back and ``entries_placed`` (those at the
            side and distance asked).
sch_place_signal_harness tool
Draw a signal harness on the active sheet: the thick line that
        carries a harness from a harness connector or harness port to a
        sheet entry. Its ends must meet those objects' connection points.

        Args:
            vertices: [[x, y], ...] in mils, two points or more.

        Returns:
            ``success`` (every vertex read back), ``vertices``, ``asked``.
sch_place_cross_sheet_connector tool
Place a cross-sheet connector (off-sheet port) on the active sheet.

        Connects to the same net name on another sheet.

        Args:
            x, y: Connector location in mils.
            net: Net name the connector binds to.
            side: "left" or "right" orientation (optional).

        Returns:
            Dict with success, x, y, net.
sch_place_text_frame tool
Place a multi-line text frame (note block) on the active sheet.

        A text frame is a bordered rectangle that word-wraps a block of
        text. A newline becomes Altium's own line break; a text with no
        newline may type ``\\\\n`` for one instead. The style is set before
        the frame is placed, so a table of filled cells needs no search
        and restyle afterwards.

        Args:
            x1, y1, x2, y2: The two rectangle corners in mils.
            text: Frame contents.
            align: Horizontal alignment "left", "center", or "right".
            font_id: The frame's font. 0 takes the font the sheet's text
                frames already use, else its net labels' font.
            fill: "#RRGGBB" fills the frame with that colour; empty leaves
                it unfilled.
            border_color, text_color: "#RRGGBB"; empty keeps the default.
            show_border, word_wrap, clip_to_rect: None keeps the default
                (all three on).
            text_margin: Gap between border and text in mils; None keeps
                the default.
            typed_breaks: False keeps a typed ``\\\\n`` as text, as in the
                path ``C:\\\\new``.

        Returns:
            The placement: the frame's corners, the ``font_id`` it got and
            ``style`` read back off the frame (colours as "#RRGGBB").
sch_generate_toc tool
Place a table-of-contents note listing every schematic sheet.

        Reads the project's document list, keeps the .SchDoc sheets in
        project order, and drops a numbered text frame on the active sheet.
        Run it on a dedicated cover/index sheet. Re-running does not remove a
        prior frame, delete the old one first if you regenerate.

        Args:
            x1, y1, x2, y2: Frame corners in mils (default a tall left box).
            title: Heading line above the list.
            project_path: Optional project; uses active if omitted.

        Returns:
            Dict with sheet_count and the placement result, or an error if
            no schematic sheets were found.
sch_set_net_tie tool
Mark a placed schematic component as a net tie.

        Joins the nets on its pins while keeping them separate nets, so
        ERC and DRC accept the join. Sets the part's ComponentKind.

        Args:
            designator: Component to convert (e.g. "NT1").
            mode: "nobom" (default, hidden from BOM, kept through sync) or
                "bom" (appears in the BOM).

        Returns:
            {"designator", "component_kind"} or NOT_FOUND.
sch_increment_designators tool
Offset the trailing number of schematic designators by a delta.

        Adds ``delta`` to the numeric suffix of every component designator
        on the active sheet (delta=100 turns R5 into R105), optionally
        only those with a prefix.

        Args:
            delta: Non-zero integer added to each designator's number.
            prefix: If set (e.g. "R"), only designators with this letter
                prefix are changed.

        Returns:
            Dict with success, modified (count), delta.
sch_toggle_pin_visibility tool
Show or hide pin name / designator labels on schematic symbols.

        Targets a single component (by ``designator``) or every component
        on the active sheet when ``designator`` is empty. Provide
        ``show_name`` and/or ``show_designator`` to set those flags; omit a
        flag to leave it unchanged.

        Args:
            designator: Component to target, or "" for all components.
            show_name: True/False to set pin-name visibility (optional).
            show_designator: True/False to set pin-designator visibility.

        Returns:
            Dict with success and pins_modified (count).
sch_set_component_part_id tool
Switch the active sub-part on a multi-part schematic component.

        Sets which gate (U1A, U1B, ...) a symbol shows; IDs are 1-based.
        Every gate of a device shares the designator (and unique id), so
        when it names several symbols, pass the location of the one you
        mean: without it the call refuses and lists the candidates with
        their locations and part ids.

        Args:
            designator: Component reference (e.g., "U1").
            part_id: Sub-part index, 1-based (1=A, 2=B, ...). A value
                above PartCount is accepted by Altium and does not take,
                so the result is read back and a mismatch is reported.
            location_x: Symbol X in mils, to choose one of several.
            location_y: Symbol Y in mils, to choose one of several.

        Returns:
            Dict with success, designator, part_id, the location written,
            ``changed`` (always 1, the one symbol written) and
            ``same_designator`` (how many carry it). On ambiguity,
            an AMBIGUOUS_DESIGNATOR error carrying `candidates`.
sch_set_component_unique_id tool
Set UniqueId on every placed symbol with this designator.

        The gates of a multi-part device are one package only when they
        share UniqueId. Every matching symbol is stamped and read back;
        if any kept its old id the call fails and names it.

        Args:
            designator: Component reference as drawn (e.g. "U_COMP2B").
            unique_id: Target UniqueId, usually copied from the A unit.

        Returns:
            Dict with success, designator, unique_id, symbols_written,
            symbols_found, and per-symbol locations with the id each
            reads back.
sch_replicate_component tool
Copy a placed schematic part and share the master's UniqueId.

        The gates of a multi-part device are one package only when they
        share UniqueId; the copy keeps the source's (written before it is
        placed, the only way it sticks). Optionally switches the part id
        and moves it.

        Args:
            designator: Source instance to copy (e.g. "U8").
            part_id: 1-based CurrentPartID for the copy. 0 = keep source.
            x, y: Placement in mils. Omit both to leave the replica
                where Replicate dropped it.
            new_designator: Designator for the copy. Empty keeps the
                source designator (required for multi-part packing).

        Returns:
            Dict with success, source/copy UniqueIds, part_id, and
            ``shared`` (true when the copy kept the master's UniqueId).
sch_place_probe tool
Place a simulation voltage probe on the active schematic.

        The probe measures the voltage of the net under it, so place it
        on a wire. It is the probe Altium's Place > Probes > Voltage
        makes: a simulation run reports and plots it, and
        sim_get_probes lists it with the node it resolved to.

        Args:
            x, y: Probe location in mils, on a wire.
            net_name: Echoed back; the net comes from the wire.
            probe_method: Echoed back.
            name: A name shown instead of the net's (ProbeCustomName).

        Returns:
            Dict with success, x, y, net_name, name, measures.
sch_add_datafile_link tool
Attach a datafile link to a component's current implementation.

        E.g. an IBIS or simulation model file.

        Args:
            designator: Component reference (e.g., "U1").
            file_path: Full path to the file being linked.
            kind: Optional implementation-specific type
                (e.g., "SimModel", "IBIS").

        Returns:
            Dict with success, designator, file_path.
obj_batch_create tool
Create many schematic objects in ONE call (obj_create items).

        What ``obj_create(items=[...])`` runs, kept under this name for
        callers that use it.

        One Altium transaction for the whole list.

        Args:
            operations: List of create dicts, each with:
                - scope: "active_doc" (default), the only scope a
                  create takes; any other is refused.
                - object_type: Altium type name (e.g. "eNetLabel",
                  "eJunction", "eNoERC").
                - properties: pipe-separated ``Name=Value`` list, same
                  format as ``obj_create`` accepts.
                - container: "document" (default) or "component" (for
                  library-symbol contents when a lib is active).

        Example, drop 3 net labels in one call:
            obj_batch_create(operations=[
                {"object_type": "eNetLabel",
                 "properties": "Text=VCC|Location.X=100|Location.Y=200"},
                {"object_type": "eNetLabel",
                 "properties": "Text=GND|Location.X=100|Location.Y=400"},
                {"object_type": "eNetLabel",
                 "properties": "Text=SCK|Location.X=300|Location.Y=200"},
            ])

        Returns:
            Dict with created, failed, total counts and indexed failures,
            and property_problems: items placed with a property that was
            not written. Known unsupported properties (IsHidden on anything but pins,
            parameters, designators and sheet names; Text on a type without
            it, such as eParameterSet or eWire) reject that item before
            registration.
            Its failure includes reason UNSUPPORTED_PROPERTY, property and
            object_type. Other valid items still run.
obj_batch_delete tool
Delete objects for many scope/type/filter sets (obj_delete items).

        What ``obj_delete(items=[...])`` runs, kept under this name for
        callers that use it. One round trip.

        Args:
            operations: List of delete dicts, each with:
                - scope: "active_doc" (default), "project", or
                  "doc:<absolute_path>".
                - object_type: Altium type name (e.g. "eJunction",
                  "eNoERC", "eWire", or a PCB type such as
                  "eTrackObject", which deletes from the active board
                  and takes only scope "active_doc").
                - filter: pipe-separated ``PropName=Value`` filter
                  conditions (AND logic), same format as
                  ``obj_delete``. An EMPTY filter deletes every object
                  of that type in that scope.
            confirm_delete_all: required when any operation has an empty
                filter; otherwise nothing is sent.

        Returns:
            operations_processed, total, total_deleted and ``results``
            (per operation ``deleted`` and a ``note`` when it deleted
            nothing). An operation that stopped part way has a note
            starting ``partial:`` and its ``deleted`` counts what it
            removed; ``operations_partial`` counts them. One whose filter
            met sheet system parameters (never removed) names them in a
            note ``kept system parameters: ...``. Query before
            repeating a batch that failed or timed out.
sch_place_wires tool
Place MANY wire segments on the active schematic in ONE call.

        NOT THE WAY TO WIRE A SHEET: sch_draw_template draws a whole
        block from a template, with the pin ends worked out and the
        wiring checked. Use this for a few segments on an existing sheet.

        Args:
            wires: List of wire dicts, each with x1, y1, x2, y2 in mils.
                Fractions are kept, so a pin end on a metric grid
                (30905.45) is met exactly.

        Returns:
            Dict with placed, failed, total counts.
sch_place_components tool
Place MANY schematic components from libraries in ONE call.

        NOT THE WAY TO DRAW A SCHEMATIC: four or more parts onto a sheet
        with two or fewer is refused. sch_draw_template draws a whole
        block from a template. Use this to add parts to an existing sheet.
        Parts land on the ACTIVE sheet unless ``document_path`` is given;
        a sheet just created is not focused, so always pass it.

        Args:
            placements: [{lib_reference (required), x, y (mils),
                library_path (empty: an open library), designator,
                rotation (0/90/180/270), footprint, part_id}]. With
                ``footprint`` naming one of the symbol's PCB models (any
                case), that model becomes current; ``part_id`` picks which
                part of a multi-part symbol goes down.
            document_path: .SchDoc to focus and place onto.
            allow_manual_layout: True places your own coordinates onto an
                empty sheet anyway; say why.
            tidy: Make each placed part match the sheet: its library
                link (a loaded part says "*", and Altium then will not
                change its Design Item ID), the parameters its models
                bring hidden, and the sheet's designator font. Listed
                per part in ``tidied``.

        Returns:
            Dict with placed, failed, total counts and footprints_chosen;
            footprint_issues lists a part whose symbol has no model of
            that name (with the models it has) or whose choice did not
            take. Such a part is placed on its library's model.
sch_place_vault_components tool
Place MANY managed (Workspace) components in ONE call.

        ``sch_place_components`` for Workspace parts, placed by Design
        Item ID and kept linked. The same hand-drawing rule applies (four
        or more parts onto a near-empty sheet is refused). Part numbers
        are not looked up; ``lib_get_vault_component`` checks an ID.

        Args:
            placements: dicts with "design_item_id" (required), ``x``,
                ``y`` (mils), optional ``designator``, ``rotation`` and
                ``part_id`` (which part of a multi-part component goes
                down; default 1, set before the part reaches the sheet).
            vault: The Workspace name; usually read off managed parts on
                an open sheet. If refused, ask the user, don't invent it.
            document_path: The .SchDoc to focus and place onto.
            lib_identifier_kind: Load kind, default 4 (VaultName).
            allow_manual_layout: Place onto a near-empty sheet anyway.

        Returns:
            ``placed``, ``linked`` (read back a VaultGUID and ItemGUID),
            ``failed``, ``total``, ``vault``, lib_identifier_kind,
            ``loader_callable``, ``note``, ``items`` (``part_id`` as read
            back; ``reason`` PLACED_WITHOUT_LINK, PART_REFUSED (on the
            sheet as another part), NOT_FOUND_IN_VAULT or LOAD_RAISED).
sim_attach_primitives tool
Attach SPICE primitives to MANY components in ONE call.

        For the ``needs_primitive`` list from `sim_get_readiness`, all in
        one call.

        Args:
            attachments: List of attach dicts, each with:
                - designator (str, required)
                - primitive  (str, required), R/L/C/V/I/D/Q/M/X
                - value      (str, optional), "10k", "100n",
                  "DC 5", "SIN(0 1 1k)", etc.
                - spice_model (str, optional), model name for
                  semi/sub-circuit parts
                - sim_kind   (str, optional), "General" /
                  "Subcircuit" / "Model"

        Returns:
            Dict with attached, failed, total counts.
tool_guide tool
How to do something correctly, and what is genuinely impossible.

        USE THIS BEFORE CONCLUDING A CAPABILITY IS MISSING. The costly
        mistakes are aiming a board tool at a library and reporting a
        capability absent when it exists; both give a confident wrong
        answer, not an error.

        Answers three things, kept apart: the tool and its
        prerequisites, the tool you were probably reaching for and why
        it acts on another document, and what is proven impossible,
        with the reason. An empty result means only that this guide has
        nothing on it; fall back to ``tool_catalog``.

        Ask here for help when a tool seems missing, you are not sure
        which tool to use, an operation seems not supported, or a call
        failed because the wrong document was open.

        Args:
            task: What you are trying to do, in your own words, e.g.
                "delete silkscreen from a footprint". Matched on
                keywords, so a rough phrase is fine.
            document_kind: Narrow to one of library, board, schematic,
                project, any. Optional.
            backend: altium, kicad or easyeda. Optional; omit to see
                every backend's answer.

        Returns:
            Dict with ``recipes`` (each with ``use``, ``avoid`` and a
            ``note``), ``not_possible``, and ``matched``.
lib_generate_ipc_batch tool
Make PcbLibs from an IPC footprint batch table with Altium's
        own batch generator, for any package family it has a template
        for (lib_ipc_batch_template gives the columns).

        A .csv or .xls table is checked against its family's template
        first: the family in A1, every column name, the required package
        columns filled. Every footprint is then read back: pad count, the
        table's row count, errors in Altium's report, and with
        require_step its STEP body, extracted and checksummed. Naming
        follows Altium's saved batch preferences.

        Args:
            input_file: Absolute path of the .csv, .xls or .xlsx table.
            output_dir: A new or empty folder; nothing is overwritten.
            require_step: Ask for STEP bodies and fail without them.
            remove_designator: Delete the Designator text, refused when
                other text shares its layer.
            timeout: Seconds, 10 to 600.

        Returns:
            ``ok``, ``stage`` (where it stopped), ``libraries`` with each
            footprint, and the ``reports``.
lib_ipc_batch_template tool
Altium's template for an IPC footprint batch table, the input
        of lib_generate_ipc_batch.

        With no family it lists the families installed. With one (its
        code, e.g. "QFN", "QFP", "SOT23", or the start of the template's
        file name) it gives the template's path, the ``columns`` in order
        (row 2 of the table, the family code going in A1), the
        ``required`` package columns and the ``legend``: what each column
        measures, its format and whether it is required. Fill rows from
        the part's datasheet package drawing, in mm.

        Returns:
            ``folder`` and ``families``, or ``family``, ``file``,
            ``columns``, ``required`` and ``legend``.
kicad_ping tool
Check the live connection to a running KiCad; returns KiCad and API
        versions, or a reason (enable the API server, open a board).
kicad_move_component tool
Move a component to an absolute board position (mm).
kicad_rotate_component tool
Set a component's orientation (degrees).
kicad_set_component_side tool
Place a component on the top or bottom copper layer ("top"/"bottom").
kicad_lock_component tool
Lock or unlock a component's placement.
kicad_set_component_value tool
Set a component's value field.
kicad_delete_component tool
Delete a component from the board.
kicad_add_track tool
Add a copper track segment on a layer ("F.Cu", "B.Cu", "In1.Cu"),
        assigned to a net, between two points (mm) at a given width (mm).
kicad_add_via tool
Add a through via at a position (mm) with pad diameter and drill
        diameter (mm), assigned to a net.
kicad_add_text tool
Add a text label at a position (mm) on a layer (default
        "F.Silkscreen").
kicad_add_line tool
Add a graphic line between two points (mm) on a layer (default
        "F.Silkscreen") with a stroke width (mm).
kicad_add_circle tool
Add a graphic circle at a centre (mm) with a radius (mm) on a
        layer, with a stroke width (mm).
kicad_add_rectangle tool
Add a graphic rectangle from top-left to bottom-right (mm) on a
        layer, with a stroke width (mm).
kicad_add_arc tool
Add a graphic arc through start, mid and end points (mm) on a layer,
        with a stroke width (mm).
kicad_add_zone tool
Add a copper zone (pour) on a layer, assigned to a net, with an
        outline given as a list of [x_mm, y_mm] points (at least 3).
kicad_set_text_variable tool
Set a project text (substitution) variable, e.g. key "REV" value
        "B". Other variables are preserved.
kicad_upgrade_board tool
Upgrade the open board's file format to the current KiCad version.
        Rewrites the .kicad_pcb on disk in place.
kicad_upgrade_schematic tool
Upgrade the open schematic's file format to the current KiCad
        version. Rewrites the .kicad_sch on disk in place.
kicad_run_action tool
Run an arbitrary KiCad tool action by name (e.g. a TOOL_ACTION such
        as "pcbnew.Control.zoomFitScreen"). Escape hatch equivalent to Altium's
        run-process/run-menu.

        NOTE: this is KiCad's unstable, non-guaranteed action API -- it may have
        side effects on the open design. Use deliberately.
kicad_save_board tool
Write the open board to disk.
kicad_list_tracks tool
Copper tracks and arcs: net, layer, width, endpoints, length (mm).
kicad_get_trace_lengths tool
Total routed track length per net (mm), summed from the copper
        tracks. Useful for length-matching and impedance work.
kicad_list_vias tool
Vias: net, position, diameter and drill (mm).
kicad_get_layer_usage tool
Per-layer routing usage: track count and total track length (mm),
        sorted by length.
kicad_get_via_summary tool
Via count and the distinct via sizes (pad diameter / drill) in use,
        each with a count. Fewer via types is cheaper to fabricate.
kicad_list_zones tool
Copper zones and rule areas: name, net, layers, fill, priority.
kicad_get_stackup tool
Board stackup: layer name, type, material, thickness (mm).
kicad_get_layers tool
Enabled board layer names.
kicad_get_board_outline tool
Board edge bounding box (mm), from Edge.Cuts graphics.
kicad_get_title_block tool
Title-block fields (title, date, revision, company, comments).
kicad_list_text tool
Free board text items: value, layer, position (mm).
kicad_get_component_details tool
Full detail for one component: value, footprint, position (mm),
        layer, lock state, and its pads with net assignments.
kicad_get_fab_stats tool
Board fabrication statistics (component / pad / hole / track counts,
        board area) via kicad-cli. Runs on the board file on disk.
kicad_get_unconnected_pins tool
Pads with no net assigned (potentially unconnected pins).
kicad_get_diff_pairs tool
Differential pairs inferred from net naming (X_P/X_N, X+/X-),
        naming-agnostic beyond the universal polarity suffix convention.
kicad_get_net tool
All pads on a given net: reference and pin number.
kicad_find_component tool
Find components whose reference or value contains the query
        (case-insensitive).
kicad_get_selection tool
Items currently selected in the KiCad PCB editor: type and, for
        footprints, reference.
kicad_list_shapes tool
Graphic shapes: type (segment/arc/circle/rect/polygon), layer, net,
        and geometry points (mm).
kicad_list_groups tool
Item groups on the board: name and member count.
kicad_list_dimensions tool
Dimension annotations: layer, override text, height (mm).
kicad_list_documents tool
Documents currently open in KiCad (PCB and schematic) with
        filename and project.
kicad_get_project_info tool
Open project's name, directory, and net-class names.
kicad_get_text_variables tool
Project text (substitution) variables.
kicad_get_netlist tool
Structured schematic netlist: components (reference, value,
        footprint) and nets (name, class, pin nodes). This is the schematic's
        intended connectivity, from ``kicad-cli sch export netlist``.
kicad_full_review tool
One-call comprehensive review of the open design: board stats, PCB
        connectivity review, schematic review, schematic-vs-PCB comparison, and
        (optionally) geometric DRC and schematic ERC. Sections that fail are
        reported under sections_failed rather than aborting the whole review.
kicad_review_schematic tool
Design review of the SCHEMATIC's intended connectivity: annotation,
        single-pin nets, shorts, unconnected parts, missing decoupling, net
        classes -- from the netlist, independent of PCB layout. Complements
        review_design (which reviews the PCB copper).
kicad_get_bom tool
Consolidated Bill of Materials from the schematic netlist: one line
        per value+footprint with quantity and the reference designators.
kicad_compare_sch_pcb tool
Compare the schematic netlist against the open PCB and report
        components and nets present in one but not the other (the schematic/PCB
        sync differences an ECO would resolve).
kicad_get_board_summary tool
One-call board overview: object counts, board size (mm), layer
        count, distinct via sizes, and net/component counts.
kicad_get_net_classes tool
Per-net net-class assignment and each class's routing rules
        (clearance, diff-pair gap/width, bus width) in mm.
kicad_list_pads tool
All pads on the board: number, net, position (mm), pad type.
kicad_export_gerbers tool
Plot Gerber files for every board layer into a directory.
kicad_export_drill tool
Generate Excellon drill files into a directory.
kicad_export_step tool
Export the board as a STEP 3D model.
kicad_export_glb tool
Export the board as a GLB (binary glTF) 3D model.
kicad_export_pdf tool
Plot the given board layers to a PDF (comma-separated layer names).
kicad_export_pos tool
Generate a component position (pick-and-place) file.
kicad_export_ipc2581 tool
Export the board in IPC-2581 format.
kicad_export_odb tool
Export the board in ODB++ format.
kicad_export_dxf tool
Plot the given board layers to DXF (mechanical CAD) files.
kicad_export_ipcd356 tool
Generate an IPC-D-356 netlist (bare-board electrical test).
kicad_export_vrml tool
Export the board as a VRML 3D model.
kicad_export_stl tool
Export the board as an STL 3D model (3D printing / mechanical).
kicad_export_3dpdf tool
Export an interactive 3D PDF of the board.
kicad_render_3d tool
Render the board's 3D view to a PNG image.
kicad_cli tool
Run an arbitrary kicad-cli command -- an escape hatch for anything
        not covered by a dedicated tool (e.g. pcb import, version formats).

        args is the argument list after the executable, e.g.
        ["version", "--format", "json"] or ["pcb", "import", ...]. Only
        kicad-cli's own subcommands run; it cannot invoke other programs.
kicad_run_jobset tool
Run a KiCad jobset (a saved batch of output jobs -- KiCad's
        equivalent of an Altium OutJob) against the open project. Leave output
        blank to generate every output the jobset defines.
kicad_export_pcb tool
Run any kicad-cli PCB export format not covered by a dedicated tool
        (e.g. gencad, brep, ply, xao, u3d, stpz, ps, hpgl, stats).

        fmt is the export format; directory-based formats (gerbers, drill, dxf,
        svg, odb) write into the output directory, others write a single file.
        Pass layers (comma-separated) for the layer-based formats.
kicad_export_bom tool
Generate a Bill of Materials (CSV) from the schematic.
kicad_export_netlist tool
Export a netlist from the schematic.
kicad_run_spice tool
Run a SPICE simulation on the schematic via a standalone ngspice.

        Exports the schematic's SPICE netlist and runs it in ngspice batch
        mode. Requires ngspice on PATH -- KiCad bundles only ngspice.dll (used
        by its GUI simulator), not a runnable executable -- so this reports a
        clear reason when no standalone ngspice is installed.
kicad_export_spice tool
Export a SPICE netlist from the schematic (the input to an ngspice
        simulation; requires SPICE models/directives on the schematic).
kicad_export_schematic_pdf tool
Export the schematic sheets to a PDF.
kicad_export_schematic_svg tool
Export the schematic sheets to SVG (one per sheet).
kicad_export_sch tool
Run any kicad-cli schematic export format not covered by a dedicated
        tool (e.g. dxf, ps, hpgl, python-bom).

        fmt is the export format; multi-sheet formats (svg, dxf, ps, hpgl) write
        into the output directory, others write a single file.
kicad_export_footprint_svg tool
Export a footprint (or a whole .pretty library) to SVG.

        library_path is a .pretty directory (or a single .kicad_mod file);
        footprint optionally names one footprint within the library.
kicad_export_symbol_svg tool
Export a symbol (or a whole .kicad_sym library) to SVG.

        symbol optionally names one symbol within the library.
kicad_generate_project tool
Generate a complete, openable KiCad project from a DesignPlan:
        <name>.kicad_pro + <name>.kicad_sch + <name>.kicad_pcb in output_dir.
        The full design-execution deliverable (real symbols/footprints where
        resolvable, placement, net assignment, board outline). Parts given a
        placeholder footprint box are listed in ``placeholder_footprints``.
kicad_generate_schematic tool
Generate a KiCad schematic (.kicad_sch) from a DesignPlan: embeds a
        box symbol per part, places every part on a grid, and carries net
        connectivity via global labels. The KiCad counterpart of Altium's
        design-execution (schematic side); the output opens in Eeschema.
        Writes a new file. render=true validates it via kicad-cli.
kicad_generate_pcb tool
Generate a KiCad board (.kicad_pcb) from a DesignPlan: declares the
        nets and places a footprint per part with pads assigned to those nets.
        The PCB side of design-execution; the output opens in pcbnew with the
        ratsnest ready to route. Writes a new file.

        A part whose footprint is not found in KiCad's libraries gets a
        generated placeholder box instead; those parts are listed in
        ``placeholder_footprints`` and named in ``warning``.
kicad_create_footprint tool
Create a footprint (.kicad_mod) in a .pretty library from a list of
        pads. Each pad: {number, x_mm, y_mm, w_mm, h_mm, shape (rect/roundrect/
        circle/oval), type (smd/thru_hole), drill_mm (thru_hole only)}.

        Writes a new file (does not touch the open board). Set render=true to
        validate it by exporting an SVG via kicad-cli.
kicad_create_footprint_from_package tool
Create a COMPLETE .kicad_mod footprint from a package drawing.

        Written into a .pretty library. The lands come from IPC-7351B for the package's terminal
        dimensions and tolerances (the engine behind
        lib_create_footprint_from_package). Writes pads (roundrect with
        roundrect_rratio, circle, oval, rect; drills, oval slots,
        np_thru_hole), paste windows over an exposed pad as unnumbered
        F.Paste pads with the pad's own paste left out, silkscreen kept
        clear of copper with a pin 1 dot on F.SilkS, the body outline and
        ${REFERENCE} on F.Fab, and the courtyard on F.CrtYd. Origin at
        the package centroid; KiCad's Y axis points down, so Y is flipped.
        No 3D body: KiCad draws one only from a model file.

        The written file is parsed back and every pad compared with the
        model (count, centre, size, drill, slot); a difference makes ok
        false.

        Args:
            library_path: the .pretty directory (created if missing).
            package: the PackageSpec as an object or JSON text, in mm,
                the same schema as lib_create_footprint_from_package.
            name: footprint name; default the package's name.
            density: L, N or M; default the package's own (N).
            description: appended to the generated description.
            tags: KiCad keyword tags.
            drafting: drafting rule overrides.
            overwrite: replace an existing footprint of the same name.
                Off by default: a footprint in a library may already be
                on boards.
            render: export an SVG with kicad-cli to look at.
kicad_upgrade_footprint_library tool
Upgrade a footprint (.pretty) library to the current KiCad format.
kicad_create_symbol tool
Create a schematic symbol in a .kicad_sym library. Each pin:
        {number, name, x_mm, y_mm, angle (0/90/180/270), type (input/output/
        bidirectional/passive/power_in/...), length}. If the library file
        exists the symbol is inserted into it, otherwise a new library is
        created. Writes a file (does not touch the open design). render=true
        validates it via kicad-cli.
kicad_upgrade_symbol_library tool
Upgrade a symbol (.kicad_sym) library to the current KiCad format.
kicad_query_items tool
Find board items in the open PCB and read them (mm, degrees).

        kinds: footprint, pad, track, arc, via, zone, shape, text, textbox,
        dimension, group, barcode. Filters combine: ids, nets, net_classes,
        references (footprints, or their pads with kinds=["pad"]), layers,
        selected (the editor's selection), inside_mm [x1,y1,x2,y2] (wholly
        inside). count_only returns counts per kind. Each item carries its
        id, which the modify, move, copy and delete tools take.
kicad_get_component_pads tool
Pads of footprints by reference: number, net, type, shape, size,
        drill, position, angle, layers, tenting. with_polygons adds each
        pad's copper outline on its first copper layer (mm).
kicad_get_connected_items tool
Copper connected to the given items (by id, or a footprint's pad
        by reference and pad number), as KiCad's connectivity sees it:
        tracks, arcs, vias, pads and zones touching it physically.
kicad_get_zone_fill tool
The filled copper of zones (by id or name; all zones when none
        given): per layer, each polygon's outline and holes in mm, plus its
        area in mm2. Empty when the zone is unfilled: refill first.
kicad_measure_clearance tool
Edge-to-edge copper distance (mm) between two items: tracks,
        arcs, vias, pads (their true outline) and filled zones. 0 means
        touching or overlapping.
kicad_check_placement_collision tool
Footprints whose bodies overlap (bounding boxes without text,
        grown by clearance_mm), among the references given or all.
kicad_get_board_view tool
The PCB editor's view state: visible layers, active layer,
        inactive-layer display, net colouring, ratsnest mode, board flip,
        and the grid and drill/place origins (mm).
kicad_get_board_text tool
The whole board in KiCad's file format as it stands in the editor,
        unsaved edits included. With output_path it is written there and
        only the path and size come back.
kicad_get_drc_violations tool
Run KiCad's DRC on the board as it stands in the editor (a copy
        saved with the project's rules, so unsaved edits count). Lists each
        violation with its type, severity, description, position and items,
        and the unconnected items grouped by net.
kicad_place_tracks tool
Draw copper tracks. Each item: points [[x_mm, y_mm], ...] (a
        polyline), and net, layer, width_mm, locked. One commit.
kicad_place_arcs tool
Draw copper arc tracks. Each item: start_mm, mid_mm, end_mm, or
        center_mm, radius_mm, start_deg, end_deg (counter-clockwise from
        +X); and net, layer, width_mm. One commit.
kicad_place_vias tool
Place vias. Each item: x_mm, y_mm, and net, diameter_mm,
        drill_mm, via_type (through, blind, buried, micro), start_layer,
        end_layer. One commit.
kicad_place_via_array tool
Stitch vias on a grid at pitch_mm inside area_mm [x1,y1,x2,y2]
        or a zone's outline, on a net. A grid point is skipped when the via
        would come within clearance_mm of a pad, track or via of another net,
        or of the board edge. dry_run lists the points without placing.
kicad_place_shapes tool
Draw graphics on any layer. Each item: shape segment (start_mm,
        end_mm), rectangle (start_mm, end_mm corners), circle (center_mm,
        radius_mm), arc (start_mm, mid_mm, end_mm, or center_mm, radius_mm,
        start_deg, end_deg) or polygon (points); and layer, width_mm,
        filled, net. A filled copper rectangle or polygon is a fill. One
        commit.
kicad_place_text tool
Place board text. Each item: text, x_mm, y_mm, and layer,
        size_mm, thickness_mm, angle_deg, knockout. Back-layer text reads
        mirrored; variables like ${REVISION} expand. One commit.
kicad_place_zones tool
Add copper zones (pours) or rule areas. Each item: points
        [[x_mm, y_mm], ...] or outline "board" (the board edge; inset_mm
        shrinks it); net, layers (default ["F.Cu"]), name, priority,
        clearance_mm, min_width_mm, connection (thermal, solid, none,
        pth_thermal). keepout {copper, vias, tracks, pads, footprints:
        bool} makes a rule area. fill refills the zones afterwards.
kicad_place_dimensions tool
Place dimensions. Each item: start_mm, end_mm (centre and a point
        on the circle for radial and center), style (aligned, orthogonal,
        leader, center, radial), height_mm (line offset), layer,
        text_size_mm, unit (mm, mils, in, auto). One commit.
kicad_set_board_outline tool
Replace the board edge: every Edge.Cuts graphic is removed and one
        closed outline drawn. Give points (a polygon), rect_mm [x1,y1,x2,y2],
        or fit_components_margin_mm to wrap all footprints' bodies plus a
        margin.
kicad_modify_items tool
Change fields of board items in one commit, keeping the rest.

        Each item names its target by id, by reference (a footprint), or by
        reference and pad, with the fields to set beside it. Or give where
        (the filters of kicad_query_items) and set (the fields) to change
        every match. Fields use the names the query returns: net, layer,
        width_mm, start_mm, end_mm, mid_mm, position_mm, locked,
        diameter_mm, drill_mm, via_type, start_layer, end_layer, tented,
        solder_mask_margin_mm; pad number, size_mm, shape, clearance_mm,
        angle_deg; text text, size_mm, thickness_mm, angle_deg, visible,
        mirrored, knockout; footprint reference, value, datasheet,
        description, dnp, exclude_from_bom, exclude_from_pos, rotation_deg,
        reference_visible, reference_size_mm, reference_thickness_mm,
        reference_position_mm, reference_layer (and value_...); zone name,
        priority, layers, outline, clearance_mm, min_width_mm, connection,
        fill_mode, thermal_gap_mm, thermal_spoke_width_mm, keepout; shape
        filled; dimension override_text, prefix, suffix. Each reply item
        is the item as KiCad kept it; a value KiCad changed is reported.
kicad_move_items tool
Move items (by id, or footprints by reference) by dx_mm, dy_mm,
        and/or turn them by rotate_deg counter-clockwise about about_mm
        (default: the centre of their positions). One commit.
kicad_copy_items tool
Copy items (tracks, arcs, vias, shapes, text, zones, dimensions)
        count times, each copy offset by dx_mm, dy_mm and turned by
        rotate_deg about about_mm from the one before; net and layer
        override the copies'. One commit.
kicad_delete_items tool
Delete board items by id, or every item matching where (the
        filters of kicad_query_items, e.g. {"nets": ["SDA"], "kinds":
        ["track", "arc", "via"]} unroutes a net). Each result says whether
        the item is gone, checked after the commit.
kicad_cleanup_tracks tool
Remove zero-length tracks, tracks that duplicate another (same
        ends, layer and net) and vias stacked on another via of the same
        net. dry_run lists them without deleting.
kicad_place_components tool
Move and turn footprints to absolute positions in one commit. Each
        item: reference, x_mm, y_mm, rotation_deg, locked. Pads, graphics
        and text follow. Change side with kicad_flip_components.
kicad_flip_components tool
Turn footprints over to the other side with KiCad's own Flip,
        which mirrors their pads, graphics and text. One undo step.
kicad_arrange_components tool
Align or distribute footprints with KiCad's own tools. action:
        align_top, align_bottom, align_left, align_right, align_center_x,
        align_center_y, distribute_horizontally_centers,
        distribute_horizontally_gaps, distribute_vertically_centers,
        distribute_vertically_gaps. Returns the new positions.
kicad_snap_components_to_grid tool
Move footprints (the references given, or all) to the nearest
        point of a grid_mm grid measured from the grid origin. One commit.
kicad_select_items tool
Select items in the PCB editor: by id, footprints by reference,
        or every track, via, pad and zone of nets. mode: replace, add,
        remove, clear. highlight also highlights the selected items' nets
        (clear mode clears the highlight).
kicad_refill_zones tool
Refill every copper zone (KiCad 10.0 cannot refill only some), or
        unfill them all with unfill. Waits for the fill and reports each
        zone's filled state.
kicad_set_board_layers tool
Set the board's copper layer count and enable or disable the
        technical and user layers (e.g. "User.1", "F.Adhes"). Copper layers
        are added or removed at the inside of the stack.
kicad_set_board_view tool
Change what the PCB editor shows: visible_layers (the full set),
        or show and hide some; active_layer; inactive_layers (normal,
        dimmed, hidden); net_colors (all, ratsnest, off); ratsnest
        (all_layers, visible_layers); board_flip (normal, flipped_x).
        Returns the view as it is afterwards.
kicad_set_origin tool
Set the board's grid origin or its drill/place origin (kind
        "drill"), which position files and Gerbers can be measured from.
kicad_set_title_block tool
Set the board's title block: title, date, revision, company, and
        comments {"1": "...", ...} for comment1 to comment9. Fields not
        given are kept.
kicad_set_net_classes tool
Add or change net classes (each item: name, and clearance_mm,
        track_width_mm, diff_pair_width_mm, diff_pair_gap_mm,
        via_diameter_mm, via_drill_mm, priority) live in the editor, or
        delete them by name from the .kicad_pro (read on reopening the
        project). Assign nets with kicad_set_design_rules
        netclass_patterns.
kicad_save_board_copy tool
Save a copy of the board as it stands in the editor to path
        (.kicad_pcb). The open board keeps its own file.
kicad_revert_board tool
Throw away unsaved board edits and reload the board file.
kicad_add_drc_markers tool
Put review markers on the board among KiCad's DRC markers. Each
        item: message, x_mm, y_mm, ids (items it concerns), severity
        (warning, error, info).
kicad_generate_fab_package tool
Write a fabrication package from the board as it stands in the
        editor (unsaved edits included): Gerbers and Excellon drill files
        (zipped with zip_gerbers), a position file (CSV, mm) and a BOM (CSV,
        from the schematic file). Returns every file written and any step
        that failed.
kicad_get_design_rules tool
The board's design rules from the project files: the board-setup
        constraints (mm) in the .kicad_pro, the net-class patterns that
        assign nets to classes, and each custom rule in the .kicad_dru with
        its name, layer, condition and constraints. Net-class values are
        read live with kicad_get_net_classes.
kicad_set_design_rules tool
Write design rules to the project files.

        rules go to the .kicad_dru, read by every DRC run: each {name,
        condition (e.g. "A.NetClass == 'POWER'"), layer (outer, inner,
        F.Cu), constraints (e.g. ["clearance (min 0.3mm)"])}; a rule of the
        same name is replaced. delete_rules removes rules by name.

        constraints (board-setup minimums in mm: min_clearance,
        min_track_width, min_via_diameter...) and netclass_patterns
        [{netclass, pattern}] (added, or all replaced with
        replace_patterns) go to the .kicad_pro. The open editor does not
        reread it: reopen the project before saving in KiCad.
kicad_export_stackup_csv tool
Write the board stackup (layer, type, material, thickness, Er,
        loss tangent) to a CSV file and return its path and rows.
kicad_lib_list_libraries tool
The symbol or footprint libraries (kind) the open project sees:
        nickname, path, scope (project or global), disabled. Project rows
        come first; KiCad takes a nickname from the project table first.
kicad_lib_set_table tool
Add (action "add", with path) or remove (action "remove") a
        library in the project's or the global (scope) symbol or footprint
        table. A path inside the project folder is stored as ${KIPRJMOD}.
        KiCad reads the tables when a library is next opened.
kicad_lib_list_items tool
The symbols in a .kicad_sym library, or the footprints in a
        .pretty library (kind), by nickname or path: name, description,
        keywords, footprint (symbols), pad count, and pin count. filter keeps
        names containing it (case-insensitive).
kicad_lib_get_symbol tool
One library symbol: properties, units, whether it is a power
        symbol, the symbol it extends, and every pin's number, name, type,
        unit, position (library mm, Y up), angle and length.
kicad_lib_get_footprint tool
One library footprint: description, tags, properties, attributes,
        every pad's number, type, shape, position, angle, size, drill and
        layers (mm from the footprint origin), graphic counts per layer, and
        its 3D model paths.
kicad_lib_search tool
Search every library the project sees for symbols or footprints
        (kind) whose name, description or keywords hold every word of
        query. Returns "Library:Name" ids ready for placing.
kicad_lib_copy tool
Copy a symbol or footprint (kind) within a library or into another
        (to_library, an existing .kicad_sym or .pretty, by nickname or
        path), as new_name (default: the same name).
kicad_lib_delete tool
Delete symbols or footprints (kind) from a library. A symbol that
        others extend is refused.
kicad_lib_rename tool
Rename a symbol or footprint (kind) in its library. Symbols that
        extend it follow. Placed copies in schematics and boards keep the
        old name until updated from the library.
kicad_lib_set_symbol_properties tool
Set properties of library symbols. Each item: library, name,
        properties {name: value, or null to remove}: Value, Footprint,
        Datasheet, Description, ki_keywords, ki_fp_filters, or any field
        (MPN, Manufacturer: added hidden).
kicad_lib_add_pins tool
Add pins to a library symbol's unit. Each pin: number, name, type
        (input, output, bidirectional, passive, power_in, power_out,
        open_collector, no_connect...), x_mm, y_mm (its connection end,
        library coordinates, Y up), angle_deg (0 for a pin on the body's
        left, 180 on its right), length_mm, shape, hidden. A number the unit
        already has is refused.
kicad_lib_add_symbol_graphics tool
Draw on a library symbol's unit (library mm, Y up). Each item:
        shape rectangle (points: two corners), polyline (points), circle
        (center_mm, radius_mm), arc (points: start, mid, end) or text (text,
        position_mm, size_mm); with width_mm and fill (none, outline,
        background).
kicad_lib_set_footprint_properties tool
Set a library footprint's description, tags, mounting (smd,
        through_hole, unspecified), and 3D models: add_models [{path,
        offset_mm, rotation_deg, scale}] and remove_models (paths, or "*"
        for all).
kicad_lib_add_footprint_items tool
Add pads and graphics to a library footprint (mm from its origin,
        Y down). Each item: kind pad (number, type smd/pth/npth, shape
        roundrect/rect/circle/oval, position_mm, size_mm, drill_mm,
        angle_deg, layers), line or arc (points), rect (points: corners,
        filled), circle (center_mm, radius_mm), polygon (points), text (text,
        position_mm, size_mm); graphics take layer (default F.SilkS) and
        width_mm.
kicad_lib_check tool
Check a symbol or footprint library (kind) for common faults.
        Symbols: no pins, duplicate pin numbers in a unit, pins off the 1.27
        mm grid, empty Reference or Value. Footprints: no pads, duplicate
        pad numbers of different shapes, no courtyard, no F.Fab or silk
        outline, no Reference text. Lists each finding with its item.
kicad_sch_get_items tool
Read a schematic sheet from its file (default the root). kinds:
        symbols, wires, buses, labels, junctions, no_connects, texts,
        sheets, page; all by default. Symbols carry their fields, flags,
        position, angle, mirror, unit and each pin's number, name, type and
        sheet position (mm) for wiring. Lists the project's sheet files.
kicad_sch_place_symbols tool
Place library symbols on a sheet (default the root). Each item:
        lib_id ("Device:R", from the symbol tables), x_mm, y_mm, and
        reference (default: next free for the prefix), value, angle_deg
        (0/90/180/270), mirror (x, y), unit, footprint, properties {name:
        value}, dnp, in_bom, on_board. Returns uuids, references and pin
        positions.
kicad_sch_place_power tool
Place power ports. Each item: name (the net: GND, +3V3), x_mm,
        y_mm (its pin), angle_deg, lib_id (default "power:<name>").
        References are numbered #PWR.
kicad_sch_place_wires tool
Draw wires. Each item: points [[x_mm, y_mm], ...] (a polyline),
        bus (true for a bus). With junctions, one is added where a wire end
        lands mid-wire.
kicad_sch_place_labels tool
Place net labels. Each item: text (the net), x_mm, y_mm (on a
        wire end or pin), angle_deg, kind (local, global, hierarchical),
        shape (input, output, bidirectional, tri_state, passive), size_mm.
kicad_sch_place_markers tool
Place junctions, no-connect flags or bus entries. Each item: x_mm,
        y_mm, kind (junction, no_connect, bus_entry); a bus entry takes
        size_mm [dx, dy] (default [2.54, 2.54]).
kicad_sch_place_graphics tool
Place notes and drawing. Each item: shape text (text, x_mm,
        y_mm, size_mm, angle_deg), text_box (text, points: two corners),
        line (points), rectangle (points: two corners) or circle (x_mm,
        y_mm, radius in size_mm).
kicad_sch_place_sheet tool
Add a hierarchical sheet: name, file (a .kicad_sch in the project
        folder, made empty when missing), position and size (mm), and pins
        [{name, shape (input, output, bidirectional, tri_state, passive),
        side (left, right), offset_mm (from the top)}]. Pins on the sheet
        symbol pair with hierarchical labels of the same name inside.
kicad_sch_modify_symbols tool
Change placed symbols, each named by reference (which_unit picks
        one unit of a multi-unit part) or uuid, with the changes beside it:
        new_reference, value, footprint, datasheet,
        properties {name: value, or null to remove}, x_mm, y_mm (moves
        fields with it), angle_deg, mirror (x, y, or ""), unit, dnp, in_bom,
        on_board, exclude_from_sim. Wires are not moved.
kicad_sch_delete_items tool
Delete schematic items by uuid (any item: symbol, wire, label,
        junction, sheet...) or symbols by reference, from one sheet file.
kicad_sch_annotate tool
Number symbols across every sheet of the project (sheet: any of
        its files, default the open one). References ending "?" get the
        lowest free number for their prefix, ordered by position (order x:
        rows; y: columns). reset renumbers all but power ports. Each
        unannotated unit gets its own number.
kicad_sch_set_page tool
Set a sheet's paper size (A4, A3, A2, A1, A0, A, B, C, D, E,
        USLetter, USLegal) and title block: title, date, revision, company,
        comments {"1": "..."} for comments 1 to 9. Fields not given are
        kept.
length_units tool
Read, or set, the unit this session gives and reads lengths in.

        One rule on every tool: a length whose name has no unit (x,
        width, hole_size) is in this unit, in arguments and replies alike.
        A name with a unit always means it: thickness_mils is mils, and
        thickness_mm may be given instead. Replies rename such keys to
        this unit and say ``length_units``. One call can use the other
        unit by giving ``length_units`` beside its own arguments.

        The setting is this session's own; other sessions keep theirs. A
        new session starts in the unit chosen on the Config tab of the
        Altium panel (mil unless changed there).

        Args:
            to: "mil" or "mm" to set it; omit to read it.

        Returns:
            ``length_units`` (this session's) and ``default`` (the Config
            tab's, for new sessions).
lib_create_symbol tool
Create a new schematic symbol in the open symbol library.

        It becomes the symbol lib_add_pins and lib_add_symbol_* write into,
        so add its pins before creating the next one. ``verified`` in the
        reply means the symbol exists, not that it has pins.

        Args:
            name: Component name
            designator_prefix: Default designator prefix (e.g., "U", "R", "C")
            description: Component description
            part_count: For multi-part components (quad op-amp, dual gate,
                etc), the number of sub-parts. Pins added via lib_add_pins
                with ``owner_part_id`` set to 1..part_count are assigned
                to that sub-part; ``owner_part_id=0`` shares the pin
                across all sub-parts (the usual power-pin pattern on a
                quad op-amp).

        Returns:
            Dictionary with created symbol information
lib_create_ic_symbol tool
Create a complete IC symbol (body plus every pin) in one call.
        It brings the open SchLib forward itself and fits the new symbol.

        Amplifiers get the standard triangle: with ``body="auto"`` it is
        chosen when the pin names form IN+/IN-/OUT units (+INA/-INA/OUTA
        and IN1+/IN1-/OUT1 count), and a dual or quad becomes one
        triangle per part plus a power part. Copying a standard part
        from the user's library with lib_copy_component is an
        alternative.

        Otherwise a rectangle: you group the pins (inputs, power and
        control LEFT; outputs and status RIGHT, discipline rule 18) and
        this lays them on grid with the top-left pin's wire end at the
        origin (rule 14).

        Args:
            name: Component name.
            left_pins: Pins on the LEFT side, top-to-bottom. Each a dict
                with `designator`, `name`, and optional `electrical_type`
                (input/output/power/passive/...); null for an empty row,
                which spaces one pin group from the next.
            right_pins: Pins on the RIGHT side, top-to-bottom, same shape.
                For an amplifier the sides are ignored: the triangle puts
                every pin where the convention does.
            designator_prefix: e.g. "U".
            description: Component description.
            body: "auto" (triangle for amplifiers, else rectangle),
                "amplifier" or "rectangle".
            invert_on_top: triangle only; put IN- above IN+.
            datasheet: ``{path, page}`` of the pin table. Every pin's
                number and name must be printed together in it, or the
                symbol is not built; pins named only by number skip it.
                A table with a pin-number column per package also takes
                ``package_column``, the package as the table heads its
                column ("LQFP48"): only that column's numbers are read.

        Returns:
            Dict with the symbol name, pin count, ``body`` drawn, body
            extent, ``pin_table``, and the per-step bridge results.
lib_create_symbol_in_parts tool
Create a multi-part IC symbol, each part with its own body, in ONE call.
        It brings the open SchLib forward itself and fits the new symbol.

        A quad op-amp as four parts and a power part, an MCU as its ports,
        a relay as coil and contacts. Each part is laid out as
        lib_create_ic_symbol lays out one (pins left and right, origin at
        the top-left pin's wire end, 100-mil grid), gets its own body
        rectangle and its own pins. Put supply pins on a part of their
        own, or in ``shared_pins``.

        Args:
            name: Component name in the active SchLib.
            parts: In order, each ``{"left_pins": [...], "right_pins":
                [...]}`` with pin dicts as lib_create_ic_symbol takes
                (``designator``, ``name``, ``electrical_type``, ``hidden``);
                ``None`` in a list leaves a gap row between pin groups.
            designator_prefix: e.g. "U".
            description: Component description.
            pin_length, pin_pitch: mils, multiples of 100.
            shared_pins: ``{"left_pins": [...], "right_pins": [...]}`` on
                Part Zero, which Altium draws on every part: the supply
                pins of a quad op-amp. They sit below every part's own
                pins, at the same place on each, and every body is made
                as wide and tall as needed to hold them.
            datasheet: ``{path, page}`` of the pin table, checked as
                lib_create_ic_symbol checks it (``package_column`` too).

        Returns:
            ``symbol``, ``part_count``, ``parts`` (pins and body per part),
            ``shared`` (Part Zero pins), and the Altium replies; ``ok``
            false with ``stage`` when a step did not take.
lib_create_passive_symbol tool
Create a standard DISCRETE symbol (the conventional glyph) in ONE call.
        It brings the open SchLib forward itself and fits the new symbol.

        Use this, not a rectangle, for any discrete part. Draws resistor,
        capacitor, polarized_capacitor, inductor (arcs), diode, led,
        crystal, fuse, zener, schottky, tvs, tvs_bidirectional, switch,
        push_button, and the three-pin nmos, pmos, npn and pnp. Two-pin
        parts have pin 1 on the left and pin 2 on the right; a transistor
        has its gate/base on the left and the other two leaving the top
        and bottom. Pins stay on the 100-mil grid.

        Args:
            name: Component name (e.g. "R_0402").
            kind: one of the kinds above (aliases such as r/c/cp/l/d/xtal/
                f/z/sd/tvs_bi/sw/button/nfet/pfet/bjt_npn are accepted).
            designator_prefix: default by kind (R/C/L/D/Y/F/S/Q) if omitted.
            description: Component description.
            pin_map: transistors only, role -> pin number, e.g.
                {"G": "1", "S": "2", "D": "3"}. Defaults are the common
                SOT-23 assignment (MOSFET 1=G 2=S 3=D, BJT 1=B 2=E 3=C);
                check the datasheet.

        Returns:
            Dict with the symbol name and per-step bridge results.
lib_set_current_component tool
Make a named component the editor's current selection in the
        active SchLib.

        Call it before ``obj_modify`` (one filter or ``items``) with scope
        "active_doc" on a symbol's pins, rectangles or parameters: those
        act on the current component, which reading one with
        ``lib_get_component_details`` does not change. (Scope
        "lib_component:NAME" selects the symbol for you.) It is also
        the symbol ``lib_add_pins`` and the ``lib_add_symbol_*`` tools
        then write into.

        Args:
            component_name: Component name (LibRef) in the active SchLib.

        Returns:
            Dict with ``success`` + ``name``, or an error if no SchLib
            is active or the component name isn't found in it.
lib_set_current_footprint tool
Make a named footprint the current one in a PCB library.

        The PcbLib twin of ``lib_set_current_component``: the footprint the
        editor shows, and the one ``obj_modify`` with scope "active_doc"
        and the authoring tools given no footprint name act on. Nothing is
        written to the library.

        Args:
            footprint_name: The footprint, as ``lib_get_footprints`` names it.
            library_path: The .PcbLib; empty takes the one in front.

        Returns:
            ``success``, ``name``, ``was`` (the footprint current before)
            and ``library``.
lib_add_pins tool
Add MANY pins to the current symbol in ONE call (there is no
        single-pin variant).

        The current symbol is the one created, copied, renamed or made
        current LAST in this library this session (lib_set_current_component,
        or any "lib_component:NAME" scope, a read-only obj_query
        included), else the one on screen; ``lib_get_pin_list()`` with no
        name reads it. Make a symbol and add its pins before making the
        next: a batch of lib_create_symbol followed by lib_add_pins puts
        every pin on the last symbol. To add pins to an existing symbol,
        lib_set_current_component first. lib_create_ic_symbol makes the
        symbol and its pins together.

        Args:
            pins: List of pin dicts, each with:
                - designator, name (required)
                - x, y: where the pin meets the BODY (Altium's
                  Location), mils. The wire connects at the other end,
                  ``length`` away in the rotation's direction.
                - length: mils (default 200)
                - rotation: the way the pin points out of the body:
                  0 right, 90 up, 180 left, 270 down (default 0). A
                  left-side pin at the body edge x=0 is rotation 180 and
                  connects at x=-length; a top pin at y=0 is 90.
                - electrical_type: input, output, bidirectional, passive
                  (default), open_collector, open_emitter, power, hiz, io
                - hidden: hide the pin (default False)
                - owner_part_id: sub-part of a multi-part symbol; 0 shares
                  the pin across all parts (power pins).
                - symbol_outer_edge / symbol_inner_edge: IEEE decoration,
                  e.g. "dot" (active low) outside, "clock" inside, or any
                  TIeeeSymbol name.
                - show_name / show_designator: draw the pin's name or
                  number (a resistor shows neither).
            pins_on_part: The part a pin without its own owner_part_id
                goes on (0 puts it on every part). Left out, such pins
                go on the symbol's current part.
            datasheet: ``{path, page}`` of the pin table. Needed for pins
                going into a symbol lib_create_symbol has just made: they
                are checked as lib_create_ic_symbol checks its pins
                (``package_column`` too).
            grid: the grid the pins' x, y and length snap to (default
                100 mils); 0 keeps them exactly as given.

        Returns:
            Dict with added, failed, total counts.
lib_add_symbol_rectangle tool
Add a rectangle to the current symbol body.

        ADD THE BODY BEFORE THE PINS: drawing order is insertion order,
        and a filled rectangle added after the pins paints over their
        names (the only fix is rebuilding the symbol).

        Args:
            x1: First corner X in mils
            y1: First corner Y in mils
            x2: Opposite corner X in mils
            y2: Opposite corner Y in mils
            fill_color: Fill color index (-1 = no fill)
            border_color: Border color index
            line_width: Border width, 0 (smallest) to 3 (large); omit
                for Altium's default.
            is_solid: Fill (True) or outline only (False); omit and a
                fill colour makes it solid.
            owner_part_id: the part of a multi-part symbol it belongs to;
                omit for the current part.
            grid: the grid the corners snap to (default 100 mils); 0
                keeps them exactly as given.

        Returns:
            Dictionary confirming rectangle addition, with the style it
            now holds read back: ``color``, ``area_color``,
            ``line_width``, ``is_solid``.
lib_add_symbol_text tool
Add MANY body-text items to the current symbol in ONE call.

        Free text such as polarity marks, pin-group headings and "NC".

        Args:
            texts: List of text dicts, each with:
                - text     (str, required; empty is refused)
                - x, y     (int, mils)
                - rotation (int, default 0), 0/90/180/270
                - font_size (int, default 10): Altium's font size, not
                  mils and not converted
                - font_name (str, default "Arial")
                - bold, italic (bool, default False)
                - owner_part_id (int, optional): as in ``lib_add_pins``,
                  1..part_count picks a sub-part, 0 shares it
            grid: the grid x and y snap to (default 100 mils); 0 keeps
                them.

        Returns:
            Dict with ``added``, ``failed``, ``total`` counts.
lib_add_symbol_lines tool
Add MANY lines to the current symbol body in ONE call.

        One Altium transaction for the whole list.

        Args:
            lines: list of dicts, each with keys ``x1``, ``y1``,
                ``x2``, ``y2`` (mils, int), ``width`` (int 0-3,
                default 1), an optional ``color`` (Altium colour
                integer) and ``owner_part_id`` (as in ``lib_add_pins``).
            grid: snap grid (mils) for the line endpoints. Glyph lines do
                NOT need the 100-mil pin grid (rule 15), so the default is
                a finer 25 mils for clean glyph detail; pass 100 mils for
                the coarse grid or 0 to disable snapping.

        Returns:
            Dict with ``added``, ``failed``, ``total`` counts.
lib_create_footprint tool
Create a new PCB footprint in the active library.

        A name the library already has (ignoring case) is refused with
        NAME_EXISTS.

        Args:
            name: Footprint name
            description: Footprint description

        Returns:
            Dictionary with created footprint information
lib_create_standard_footprint tool
Create a COMPLETE standard footprint in ONE call from the land
        dimensions you give (pads, silk outline, courtyard). For a package
        drawing with tolerances prefer lib_create_footprint_from_package,
        which sizes lands by IPC-7351B.

        Args:
            name: Footprint name (e.g. "SOIC-8_3.9x4.9").
            family: "chip" | "sip" | "dual" (SOIC/SOP/SON/SOT/DIP; SOT-23
                is dual with 3 pins) | "header" (2-row, odd/even) | "tab"
                (SOT-223, DPAK, TO-220; give tab_w, tab_h) | "quad"
                (QFP/QFN) | "bga" (give rows, cols). hole > 0 makes any
                family through-hole.
            pin_count: Total pads (2 chip, even header, signal pins for
                tab, multiple of 4 quad; ignored for bga).
            rows, cols: BGA grid.
            exposed_pad: QFN/QFP centre pad size, mils (0 = none); it is
                pin_count+1.
            tab_w, tab_h: Tab pad size, mils; it is pin_count+1.
            skip: BGA balls to leave out, e.g. ["A1"].
            pitch: Pad pitch within a row, mils.
            pad_w, pad_h: Pad size, mils. pad_w is the X size (across the
                row for chip and dual, along it for sip, header and tab);
                for quad it runs along each row.
            row_span: Centre-to-centre between rows (dual, quad), mils.
            shape: Pad shape (default "roundrect", corner_radius in %).
            silk: Draw the body outline on TopOverlay, cut clear of the
                pads, with a pin 1 mark where the part needs one.
            courtyard: Courtyard margin past pads, body and silk, mils
                (0 = none).
            courtyard_layer: Its layer; empty takes the library's
                Courtyard Top layer, else Mechanical1.
            body_w, body_h: Body size for the silk (default pad extent).
            hole: Drill, mils; > 0 gives through-hole pads, pin 1 square.
            description: Footprint description.

        Returns:
            Footprint name, pad and track counts, extent, step results.
lib_create_footprint_from_package tool
Create a COMPLETE footprint in the open PcbLib (brought forward,
        shown in 2D) from a package drawing.

        Give the package as the datasheet draws it: lands are the
        manufacturer's recommended pattern where given (not the package's
        own pads), else IPC-7351B. Writes pads, paste, silk with a pin 1
        dot, assembly outline, .Designator, courtyard and height (origin
        the centroid, mm); pads read back.

        Dimensions min/nom/max, cited in ``source``; nominal-only warns.

        Args:
            package: the PackageSpec as an object (or its JSON text):
                ``family`` (chip, melf, molded, sod, sot23, sot89, sot223,
                dpak, soic, son, qfn, qfp, plcc, bga, lga, crystal2,
                crystal4, dip, header, radial, axial, to220, to92,
                connector, custom) and the dimensions it needs, each a
                number, ``[min, max]``, ``[min, nom, max]`` or
                ``{min, nom, max, cite}``; axes and field names: the
                library-part recipe (tool_guide). ``source``: {document, revision, page,
                ref, url, path}; with path (the PDF), a page without
                its land pattern is refused. bga/lga ``options``: letters "y"|"x", a1
                "top_left"|..., as the ball map's top view; bga/lga
                ``pins``: the printed ball count (required); bga
                ``depopulated``: ball names left empty; ``vendor``
                {land_diameter} builds the datasheet's land. ``custom_pads``
                (number, may repeat; x, y, width, height, shape "circle"
                for balls) need ``drawing_numbers``, every number printed
                on the land drawing, and ``drawing_dims`` placing each:
                {from, to, mm, axis, between centres|outer|gap, or
                from_edge/to_edge centre|near|far}, {pad, mm, axis} (a
                land's size); ORIGIN is the centre lines; ``outline``
                [[x, y], ...] for a land that is not a rectangle; and
                ``compared``, the id footprint_compare_drawing returns
                once the lands are set beside the figure.
            name: default the package's, else generated.
            density: L, N or M (default the package's, else N).
            description: Appended to the generated description.
            assembly_layer, courtyard_layer: Mechanical layers; empty
                picks them by kind or name, else it refuses and lists them.
            drafting: Overrides ({"silk_width": 0.15}).
            set_height: Write the height (A max).
            model_3d: "auto" (default): a STEP model from the same
                drawing, linked, else an extruded body (``notes`` says
                why). "step", "extruded" or "none".
            library_path: the .PcbLib; empty: the focused one, else the
                only one open.

        Returns:
            {ok, footprint, library_path, created, layers, readback, pads
            (a summary past 64), courtyard_mm, warnings, notes, ipc, steps}. ``ok`` only when
            every step succeeded and the readback matched; a later
            failure leaves the footprint created but incomplete.
lib_add_footprint_pad tool
Add a pad to a footprint: the named one, or the current one.

        A footprint new from lib_create_footprint takes lands only with
        ``compared``, the id footprint_compare_drawing returned for them.

        Args:
            designator: Pad designator (e.g., "1", "2")
            x, y: Pad position.
            x_size, y_size: Pad size (default 60 mil).
            hole_size: Drill size; 0 for SMD. A drilled pad is
                through-hole (MultiLayer); a hole-less one is SMD on
                ``layer``.
            shape: "round", "rectangular", "octagonal" or "roundrect".
                An oval is "round" with x_size != y_size. Another word
                (e.g. "rectangle") is refused and no pad is added.
            layer: SMD pad layer ("TopLayer"/"BottomLayer").
            rotation: Pad rotation in degrees
            corner_radius: roundrect corner radius, % (Altium's unit).
            corner_radius_length: or the radius as a length, converted to
                that % of half the shortest side (so resizing the pad
                later changes it).
            footprint_name: footprint to write into; empty uses the
                current one. A name is made current first, refusing if
                it cannot.
            units: "mil" (default) or "mm", for every length and
                coordinate here; mm values are kept exact.

        Returns:
            Dictionary confirming pad addition
lib_add_footprint_via tool
Add a through-stack via to a footprint: the named one, or the current one.

        The via spans top to bottom. Its position is relative to the
        footprint origin, like a pad's. It goes into the focused PCB
        library; give ``library_path`` to refuse when that is not the one
        you mean.

        Args:
            x, y: Via centre, relative to the footprint origin.
            size: Via diameter (default 40 mil).
            hole_size: Drill diameter (default 20 mil). Must be below size.
            footprint_name: footprint to write into; empty uses the
                current one.
            units: "mil" (default) or "mm", for every length here.
            library_path: Full path to the .PcbLib. When given, the call
                refuses unless that library is the focused one.

        Returns:
            Dictionary confirming the via was added
lib_add_footprint_vias tool
Add many through-stack vias to a footprint in ONE call.

        One call for a whole via grid; a list of one adds a single via.
        Positions are relative to the footprint origin; the via spans top
        to bottom.

        Args:
            vias: list of ``{"x": .., "y": ..}``, each with an optional
                ``size`` and ``hole_size`` overriding the defaults below,
                and optionally its solder mask, set as it is made:
                ``tenting_top`` / ``tenting_bottom`` /
                ``mask_from_hole_edge`` / ``mask_separate`` (bool),
                ``mask_expansion`` / ``mask_bottom_expansion`` (length;
                the bottom follows the top unless given). Any of them
                makes the mask manual.
            size: Via diameter for vias that give none (default 40 mil).
            hole_size: Drill for vias that give none (default 20 mil).
            footprint_name: footprint to write into; empty uses the
                current one.
            units: "mil" (default) or "mm", for every length here.
            library_path: Full path to the .PcbLib. When given, the call
                refuses unless that library is the focused one.

        Returns:
            Dict with added, failed, bad_size (hole not inside the
            diameter), bad_number, masked (vias whose mask fields all
            read back), property_failures, total; a via refused here
            before sending is listed in ``refused`` with the reason.
lib_create_3d_model tool
Build a STEP model from the datasheet drawing and link it to a
        footprint in the open .PcbLib (brought forward itself).

        For a part no package family covers: read each feature off the
        mechanical drawing as a primitive. lib_create_footprint_from_package
        models the standard families. Written with CadQuery (FreeCAD when
        EDA_AGENT_STEP_WRITER is "freecad", plain shapes only).

        Terminals come from the footprint: ``terminals`` puts one on every
        land. A flat terminal box covering lands of two names is refused.

        Args:
            footprint_name: the footprint to link the model to.
            solids: primitives in mm, footprint origin, Z up from the
                board; each has ``kind`` and ``role`` (a colour, or
                ``cut``). box ``x0 y0 z0 x1 y1 z1``; extrude ``outline``
                [[x, y]...] ``z0 z1``; both take ``corner_r``, ``edge_r``
                (top edges), ``taper`` (deg); cylinder ``r cx cy z0 z1``
                (``axis`` "x": ``cy cz x0 x1``); sphere ``cx cy cz r``
                (``clip_z0 clip_z1``); prism ``profile`` [[u, z]...] over
                ``y0 y1`` (``axis`` "x": ``x0 x1``); text ``text size cx
                cy z1`` (``angle bold``), dot ``cx cy r z1``: marks cut
                flush into the top face at z1, inside its edges; instance
                ``group rot dx dy dz``. A cut is taken from what it
                overlaps, or from the ``cut_from`` names (``name``).
                Roles: body metal ceramic ceramic_ivory ball white lens
                gold pin1 nickel seal_ring silicon backside_coat
                substrate pcb_green tin lcp_white; marks ink, laser.
            source: the drawing (document, revision, page or figure).
                Required: a model is not built from guesses.
            output_dir: folder for the .step; empty: ``3D`` beside the
                library.
            replace_existing: remove the footprint's 3D bodies first.
            terminals: ``{"kind": "plate", "height"}`` shaped as each land
                (``chamfered`` {land: {size, corners}}), or ``{"kind":
                "ball", "height": A1, "diameter"}``, seated from the
                board to the package underside.
            groups: name -> solids that instance solids place.
            review: write a PNG from above and below.
            drawing: the outline drawing's totals in mm, a number or
                [min, max]: ``body_x``, ``body_y``, ``height`` (max only:
                [0, max]), ``span_x`` / ``span_y`` where printed. The
                model is refused when its extents differ.

        Returns:
            ``ok``, ``path``, ``writer``, ``height_mm``, ``drawing_dims``,
            ``linked``, ``replaced_bodies``, ``terminals``, ``review``, or
            ``ok: false`` with ``problems`` or ``reason``.
lib_add_footprint_bodies tool
Add extruded 3D bodies to a PcbLib footprint in ONE call.

        THE FALLBACK BODY. A part's 3D body should be its STEP model:
        the vendor's, linked with lib_link_3d_model, or one generated from
        the package description (lib_create_footprint_from_package does
        that first). Use this for a part with neither, or for a clearance
        or keep-in volume: an outline lifted from standoff_height to
        overall_height.

        Args:
            bodies: list of ``{"points": [[x, y], ...], "overall_height":
                ..}``, the outline relative to the footprint origin, with
                optional ``standoff_height`` (default 0), ``layer``
                (default TopLayer, the side the body projects from; a
                mechanical layer such as Mechanical13 is common),
                ``identifier`` (a name to find the body again by),
                ``color`` (Altium TColor integer) and ``opacity`` (0-1).
            footprint_name: footprint to write into; empty uses the
                current one.
            units: "mil" (default) or "mm", for outline and heights.

        Returns:
            Dict with added, failed, bad_points, bad_height,
            unknown_layers, total and ``bodies``, each read back
            (outline, heights, identifier, layer) with which optional
            properties were applied. Unless the Config tab allows basic
            3D models, ``basic_3d_models`` says to ask the user before
            these stand in for the part's model.
lib_set_via_properties tool
Modify one via inside a footprint of an open PCB library.

        The via is found by its position relative to the footprint origin
        (within 1 mil, whatever ``units``). No via there is an error, and so
        is more than one: nothing is changed. Only the fields given are
        written, and each is read back: one that did not take sets
        ``all_writes_ran`` false. A middle or bottom diameter raises the via
        to a local-stack via in the same call. The mask expansions are set
        through the pad cache.

        Tenting holds only on a manual mask expansion, so a rule-driven
        via is switched to a manual expansion at its current value first
        (``mask_made_manual``).

        Args:
            x, y: The via centre, relative to the footprint origin.
            library_path: Full path to the open .PcbLib; it must be the
                focused library, or the call refuses. Empty: the focused
                library.
            footprint_name: footprint to change; empty uses the current one.
            units: "mil" (default) or "mm".
            hole_size: Drill diameter.
            size: Top-layer diameter.
            dia_mid: Middle-layer diameter (makes a local-stack via).
            dia_bottom: Bottom-layer diameter (makes a local-stack via).
            stack_mode: "simple" (one diameter on every layer) or
                "top-middle-bottom", written before the sizes.
            tenting_top, tenting_bottom: Solder mask tenting on each side.
            mask_expansion: Solder mask expansion (manual), both sides
                unless ``mask_bottom_expansion`` is also given.
            mask_bottom_expansion: Bottom solder mask expansion (manual).
            mask_separate: Separate (True) or linked (False) mask expansions.
            mask_manual: True keeps the mask as written; False hands it
                back to the design rule (not with a mask value).
            mask_from_hole_edge: Measure the mask from the drill edge.

        Returns:
            Dictionary with ``all_writes_ran``, the via's drill and size,
            its tenting and mask expansions read back, ``mask_source``
            (manual or rule), ``mask_from_hole_edge``, ``stack_mode``,
            ``mid_unverified`` (a middle diameter that reads back 0 on
            this build, so the write could not be checked) and
            ``mask_made_manual``. A field this build cannot read comes back
            null.
lib_count_layer_objects tool
Count what is on each layer across every footprint of a PCB library.

        Read only. Answers "is this layer empty in every footprint?" before a
        layer is disabled or a layer scheme is tidied, and names the
        footprints that use each layer, so a layer that is not empty says
        where to look. Covers tracks, arcs, text, regions, fills, 3D bodies,
        pads, vias, polygons, dimensions and coordinate markers. Mechanical
        layers past 16 are named by number (``Mechanical17``...).

        Args:
            library_path: Full path to the open .PcbLib; it must be the
                focused library, or the call refuses. Empty: the focused
                library.

        Returns:
            Dictionary with ``layers`` (``{layer, count, footprints}`` for
            each layer that holds anything), ``footprints`` and ``objects``
lib_get_library_origin tool
Report where a PCB library's origin marker sits.

        Read from the library's backing board, in that board's absolute
        mils. Footprint writers place from the footprint's own reference
        point instead: for the origin in that frame read
        ``editor_origin_*`` from ``lib_get_footprint_primitives`` (the
        current footprint only). The library must already be open and
        focused in Altium.

        Args:
            library_path: Full path to the open .PcbLib. It must be the
                focused library, or the call refuses.

        Returns:
            Dictionary with origin_x_mil, origin_y_mil and library_path
lib_add_footprint_pads tool
Add pads to the current footprint in ONE call (a list of one adds
        a single pad). Coordinates are not snapped. A footprint new from
        lib_create_footprint takes lands only with ``compared``, the id
        footprint_compare_drawing returned for them.

        Args:
            pads: List of pad dicts, each with:
                - designator (required), e.g. "1", "A1"
                - x, y: pad centre
                - x_size, y_size (default 60 mil)
                - hole_size (default 0 = SMD; drilled pads are MultiLayer)
                - shape: round, rectangular (default), octagonal or
                  roundrect; oval is round with unequal sizes. Another
                  word refuses the whole call, no pad added
                - corner_radius: roundrect corner in % (default 25), or
                  corner_radius_length as a length
                - rotation: degrees
                - layer: SMD side, "TopLayer" (default) or "BottomLayer"
                - optional: hole_length (slot), hole_rotation (the
                  slot's turn from the pad's X axis; left out, the slot
                  runs along the pad's longer side),
                  plated (false = NPTH, which may have no designator),
                  unnumbered (true: copper with no designator, a fiducial),
                  paste_expansion, mask_expansion (minus the larger side
                  closes the paste); refused writes show in
                  ``property_failures``
            footprint_name: Footprint to write into; empty uses the
                current one, a name makes it current or refuses.
            units: "mil" (default) or "mm" for every pad, kept exact.

        Returns:
            Dict with added, failed, total counts.
lib_add_footprint_track tool
Add a track to the current footprint (for silkscreen/courtyard).

        Args:
            x1: Start X in mils
            y1: Start Y in mils
            x2: End X in mils
            y2: End Y in mils
            width: Track width in mils
            layer: Layer name. Default "TopOverlay" (silkscreen). Any
                Altium layer is accepted, e.g. "BottomOverlay" or
                "Mechanical1".."Mechanical16" for courtyard / assembly
                outlines.
            footprint_name: footprint to write into. Empty uses the
                editor's current footprint; a name makes that footprint
                current first and refuses if it cannot.
            units: "mil" (default) or "mm", for every length and
                coordinate here, kept exact rather than rounded to
                whole mils.

        Returns:
            Dictionary confirming track addition
lib_add_footprint_tracks tool
Add MANY tracks to the current footprint in ONE call.

        One call, one undo step and one save for a whole outline; a list
        of one adds a single track.

        Args:
            tracks: ``{x1, y1, x2, y2, width (default 10), layer
                (default "TopOverlay")}`` each; any layer name, e.g.
                "Mechanical13" for an assembly outline. ``keepout`` and
                ``keepout_for`` as in lib_add_footprint_regions.

        ``footprint_name`` picks the footprint; empty uses the current
        one, and a name that cannot be made current is refused.
        ``units`` is "mil" (default) or "mm", kept exact.

        Returns:
            Dict with added, failed, total counts, and keepouts,
            keepout_failures, bad_keepouts as for regions.
lib_add_footprint_regions tool
Add solid polygon regions to a PcbLib footprint in ONE call.

        For example, paste windows over an exposed pad (on TopPaste, with
        the pad's own paste closed by a negative paste_expansion in
        lib_add_footprint_pads), or a filled shape on any layer.

        Args:
            regions: list of ``{"layer": ..., "points": [[x, y], ...]}``,
                three or more points each, relative to the footprint
                origin. The layer is REQUIRED: there is no default,
                because a solid shape defaulted onto copper is a short.
                A point ``[x, y, sweep]`` makes the edge to the next point
                a true arc of ``sweep`` degrees, counterclockwise when
                positive (a slot's round end is 180 or -180); other edges
                are straight. ``"keepout": true`` makes the region a
                keepout on its own layer, and ``"keepout_for"`` lists
                what it keeps out ("copper", "track", "via", "smd_pad",
                "th_pad"; all five when left out). ``["copper"]`` on a
                signal layer keeps pours off that layer alone while
                tracks may cross; KeepOutLayer acts on every layer, and
                a region there is always made a keepout.
            footprint_name: footprint to write into; empty uses the
                current one, and a name that cannot be made current is
                refused.
            units: "mil" (default) or "mm", for every point, kept exact.

        Returns:
            Dict with added, failed, bad_points, unknown_layers, total,
            and arc_edges: the arc edges the created regions read back
            as holding; keepouts (made keepouts whose flags read back as
            asked), keepout_failures and bad_keepouts. A region refused
            here before sending is listed
            in ``refused`` with the reason.
lib_add_footprint_fills tool
Add rectangular fills to a PcbLib footprint in ONE call.

        A fill stays an Altium fill, not a four-point region, so it reads
        back and edits as one. Use it for a grid of paste windows over an
        exposed pad, or a solid block on a mechanical or overlay layer.
        For any other outline use lib_add_footprint_regions.

        Args:
            fills: list of ``{"layer": ..., "x1": .., "y1": .., "x2": ..,
                "y2": ..}``, opposite corners relative to the footprint
                origin, with an optional ``"rotation"`` in degrees about
                the fill's centre. The layer is REQUIRED: there is no
                default, because a solid shape defaulted onto copper is a
                short. A fill with no area is refused. ``keepout`` and
                ``keepout_for`` as in lib_add_footprint_regions.
            footprint_name: footprint to write into. Empty uses the
                editor's current footprint; a name makes that footprint
                current first and refuses if it cannot.
            units: "mil" (default) or "mm", for every corner, kept exact.

        Returns:
            Dict with added, failed, bad_extent, unknown_layers, total,
            keepouts, keepout_failures, bad_keepouts. A
            fill refused here before sending is listed in ``refused`` with
            the reason.
lib_add_footprint_arc tool
Add an arc to the current footprint.

        Args:
            x_center: Center X in mils
            y_center: Center Y in mils
            radius: Arc radius in mils
            start_angle: Start angle in degrees
            end_angle: End angle in degrees
            width: Line width in mils
            layer: Layer name. Default "TopOverlay" (silkscreen). Any
                Altium layer accepted, e.g. "Mechanical1".."Mechanical16"
                for pin-1 / assembly markers.
            footprint_name: footprint to write into. Empty uses the
                editor's current footprint; a name makes that footprint
                current first and refuses if it cannot.
            units: "mil" (default) or "mm", for every length and
                coordinate here, kept exact rather than rounded to
                whole mils.
            keepout, keepout_for: make the arc a keepout, as in
                lib_add_footprint_regions.

        Returns:
            Dictionary confirming arc addition; for a keepout also
            keepout_verified, keepout and keepout_for as read back.
lib_add_footprint_text tool
Add a text primitive to a PcbLib footprint.

        Args:
            text: The string to place. Required.
            x, y: Position relative to the footprint's origin.
            size: Text height (default 50 mil).
            width: Stroke width (default 8 mil); scale with ``size``.
            rotation: Degrees.
            layer: Layer name (``TopOverlay``, ``BottomOverlay``,
                ``Mechanical1`` ...).
            use_ttfont: TrueType instead of the stroke font.
            mirror: Mirror the text; set it for a BOTTOM layer.
            library_path: .PcbLib to focus first; default the active one.
            component_name: Footprint to switch to first; default the
                current one.
            units: "mil" (default) or "mm", kept exact.

        Returns:
            ``success``, ``footprint``, ``text``, ``layer``, ``x``, ``y``.
lib_extract_intlib tool
Extract .SchLib + .PcbLib sources from an .IntLib.

        Writes the sources into a folder beside the IntLib named after it,
        without opening the IntLib (no "Open Integrated Library" prompt).
        Pass the reported paths as ``library_path`` to the other library
        tools.

        Args:
            intlib_path: Absolute path to the .IntLib file.

        Returns:
            Dict with ``intlib_path``, ``extract_dir``, ``sch_lib_path``,
            ``sch_lib_found``, ``pcb_lib_path``, ``pcb_lib_found``, and
            ``sch_libs`` / ``pcb_libs`` listing every source extracted
            (their names come from inside the IntLib). A ``_found`` flag
            of False means that source did not appear.
lib_get_footprints tool
Enumerate every footprint in a PcbLib.

        The PcbLib counterpart of ``lib_get_components``.

        Args:
            library_path: Optional .PcbLib path to focus first.
                Defaults to the focused document.

        Returns:
            Dict with ``library_path``, ``count``, ``footprints``
            (a list of ``{name, description}``) and ``current``: the
            name of the footprint the editor has current in that
            library, or "" when none is. Writers called without a
            footprint name, the library origin read and processes such
            as ``PCB:SetComponentReference`` act on that footprint.
lib_audit_footprint_policies tool
Sweep a PcbLib and flag footprints that break the library's own
        conventions: inconsistent layer usage, pad rules, pin-1 markings,
        courtyard, silkscreen, 3D models, designator style.

        Each convention is the library's most common one, so any house
        style works; ``policy`` pins one instead, e.g.
        ``{"silk_layer": "Top Overlay", "courtyard": true}``. Each finding
        gives footprint, dimension, expected and actual. Designators must
        sit on the average pad centre, within
        ``policy={"designator_center_tol": <mils>}``. One library pass.

        Args:
            library_path: Optional .PcbLib to focus first; defaults to the
                focused library.
            policy: Optional explicit conventions to enforce; omitted
                dimensions are inferred from the library.

        Returns ``{library_path, footprint_count, conventions, findings,
        summary}``, and ``basic_3d_models`` when footprints have only
        extruded, cylinder or sphere bodies and the Config tab does not
        allow basic 3D models: tell the user and ask before replacing any.
lib_convert_designators_to_stroke tool
Convert every TrueType ``.Designator`` in a PcbLib to a stroke font.

        A TrueType designator's position reverts on reload, so it cannot be
        centred. This clears ``UseTTFonts``, ``Bold`` and ``Italic``, reads
        back, saves and reloads; ``lib_fix_designators`` can then centre
        them.

        Returns ``{library_path, designators, converted, names, saved}``.
lib_reload_library tool
Close and reopen a PcbLib so Altium rebuilds its caches from disk.

        A text's extent is not refreshed after it moves or is resized until
        the library is reloaded, so reload between a write and the next read.

        SAVE FIRST: this does not save, and closing a dirty document loses the
        edits or raises a prompt. ``lib_fix_designators`` already does this.
lib_probe_designator tool
Diagnostic: dump one footprint's raw designator geometry.

        Read-only. Returns the footprint origin and bounding rectangle, the pad
        extents, and the ``.Designator`` anchor, bounding rectangle, size and
        width, in Altium's internal units.

        Returns ``{footprint, fp_x, fp_y, fp_rect, pad_count, pad_rect,
        desig_anchor, desig_rect, desig_size, desig_width, desig_text}``.
lib_fix_designators tool
Bring every footprint's ``.Designator`` onto the library's OWN
        convention: the layer, height and centring the majority already use.

        The conventions are inferred from this library (see
        ``lib_audit_footprint_policies``); ``policy`` overrides them.
        "Centred" means on the average pad centre. A dry run by default.
        Applying repeats apply, save, reload until nothing is left; a few
        designators may not persist and come back in ``unrepairable``
        with ``converged: false``. ``applied`` counts only writes
        confirmed by read-back.

        Args:
            library_path: .PcbLib to fix; defaults to the focused library.
            dry_run: report the plan without writing (default True).
            fix_layer: move designators that are not on the convention
                layer onto it.
            fix_center: re-centre designators beyond the library's tolerance.
            fix_height: also normalise text height to the library norm.
            add_missing: create a ``.Designator`` on footprints that lack one.
            policy: explicit conventions, e.g.
                ``{"designator_center_tol": 50, "designator_height": 20}``.

        Returns ``{library_path, dry_run, conventions, planned, applied,
        created, passes, converged, failed, skipped, actions}``.
lib_update_footprint_heights_from_3d tool
Set every footprint's height in the active PcbLib from its
        tallest 3D body, for the height-clearance DRC (a height of 0
        makes that rule pass silently).

        Args:
            mode: ``raise`` (default) only increases a height, so a
                hand-set one survives. ``match`` also lowers it to the
                model; use it when heights are too tall. For one
                footprint, or one with no model, use
                ``lib_set_footprint_height``.

        A footprint with no 3D body is never set to 0; it is listed in
        ``without_model``. The library is not saved; review ``items``
        and save in Altium.

        Returns:
            Dict with ``mode``, ``inspected``, ``updated``, ``lowered``,
            ``without_model``, ``without_model_names``, and ``items``
            (``{name, old_height_mm, new_height_mm}`` per footprint).
lib_set_footprint_height tool
Set one footprint's Height directly, up or down.

        For a part with no 3D model, or a wrong one. The height drives the
        height-clearance DRC: too tall flags parts that are fine, and ZERO
        DISABLES the check for that footprint (the reply says so).

        Args:
            height_mm: the height in MILLIMETRES, not mils. Must be
                non-negative.
            footprint_name: which footprint. Empty uses the library's
                current component.

        Returns:
            ``{name, old_height_mm, new_height_mm, changed, saved,
            save_note, note}``. ``saved`` is always false: the library
            is modified in memory and left for you to review and save.
lib_link_footprint tool
Link a footprint to a schematic component in the open SchLib
        (brought forward itself).

        With replace=True (default) existing footprint models are removed
        first; False adds another.

        The symbol's pin numbers are compared with the footprint's pad
        names first (its .PcbLib must be open): a pin with no pad or a
        named plated pad with no pin refuses the link. Unnamed pads and
        unplated holes are left out.

        Args:
            component_name: Name of the schematic component, made current
                first. Empty uses the current component.
            footprint_name: Name of the footprint to link
            footprint_library: Not applied: the footprint is bound by
                name, so install its library and keep names unambiguous.
            replace: remove existing footprint models before adding (default True)

        Returns:
            {success, footprint, replaced, footprints, pin_pad_parity}:
            ``footprints`` is read back from the component. Altium's Models pane is
            not redrawn after a scripted link and can show the previous
            part; this list is the link as stored.
lib_link_3d_model tool
Link a 3D STEP model to a footprint in the ACTIVE .PcbLib, as a
        component body (drives the 3D view and height DRC).

        The footprint's existing 3D bodies are removed first
        (``replace_existing``, reported as ``replaced_bodies``).

        Args:
            component_name: Footprint name (empty: the current footprint).
            model_path: Existing .step/.stp file.
            offset_x: X offset in mils from the footprint's origin (the
                body is moved onto that origin first).
            offset_y: Y offset in mils.
            offset_z: Standoff height in mils (lifts the body).
            rotation_x, rotation_y, rotation_z: degrees, set on the
                model before it is bound to the body. It cannot be read back, so
                ``applied.rotation`` says it was written, not checked.
            replace_existing: remove the footprint's 3D bodies before
                linking (default True); False adds this one beside them,
                for a part built from several models.

        Returns:
            ``success``, ``footprint``, ``model``,
            ``footprint_origin_mils``, ``moved_to_footprint_origin``
            (false: the body may sit away from the footprint) and
            ``applied`` {standoff_height, rotation, offset_xy}; false
            means not written, including a zero left at its default.
lib_auto_link_3d_models tool
Batch-link STEP models to footprints by matching file names.

        Enumerates every footprint in the PcbLib, scans `model_dir` for
        .step/.stp files, and links each footprint whose name matches a model
        file's stem (case-insensitive). No offset or rotation is set.

        Args:
            model_dir: Folder containing .step/.stp model files.
            library_path: Optional .PcbLib to focus first; uses the focused
                document otherwise.

        Returns:
            {"linked": [{footprint, model}], "unmatched_footprints": [...],
             "unused_models": [...]}.
lib_get_components tool
List the components in a library: name, alias_name, part_count,
        description, fast. ``part_count`` here can read one high; use
        lib_get_component_details when it matters.

        Args:
            library_path: Library path (default: the active library).
            with_parameters: Add each component's parameters (slow on
                large libraries; for one symbol use
                lib_get_component_details).
            with_designator: Add each default designator ("U?"); also
                loads every symbol, so slow on large libraries.
            exact_part_counts: Count each symbol's parts in the open
                library (opening it if needed) instead of the file
                reader's count, which can be one high. Rows then carry
                ``part_count_checked``.

        Returns:
            ``count`` and ``components`` [{index, name, alias_name,
            part_count, description, parameters?, designator?}]. Pass
            ``index`` as component_index to the details, delete and
            rename tools when a name has characters you cannot type.
            The list is the SAVED file. When the library is open, two more
            keys compare it with the symbols in memory:
            ``unsaved_symbols`` (in the open library, not yet in the file,
            for example renamed or new) and
            ``saved_names_not_in_open_library`` (in the file, gone from the
            open library). Name a symbol as the open library has it.
lib_search tool
Search open SchLib documents and installed database libraries.

        Searched: every .SchLib open (in a project or standalone) and every
        installed DbLib, case-insensitive substring. NOT searched: IntLibs,
        query/SVN libraries, workspace components, closed SchLibs, so 0
        hits is not "no such part"; ``not_searched`` and ``coverage_note``
        say what was skipped. It reads files ON DISK: a symbol created and
        not yet saved is not found (use lib_get_component_details).
        DbLib rows match on every column (MPN, value) and are marked
        ``source: "dblib"``; lib_dblib_search narrows to a table.

        DATASHEET DISCIPLINE: fetch a part's datasheet before recommending
        it; do not go on symbol metadata alone.

        Args:
            query: Substring to match.
            search_type: "all" (name, alias, description; default),
                "name", "description", or "parameters" (slow).
            library_path: Restrict to one .SchLib or .DbLib.
            limit: Cap on matches, SchLib and DbLib together (default 100).
            include_dblibs: Also search installed DbLibs (default True;
                slower on large databases).

        Returns:
            ``query``, ``search_type``, ``count``, ``limit``,
            ``truncated``, ``results`` [{name, alias_name, description,
            library_path, part_count, source}; DbLib rows add table,
            key_field, symbol_ref, symbol_library, footprints,
            matched_field], ``_datasheet_guidance``,
            ``libraries_searched``, ``not_searched`` [{library_path,
            library_type, reason}], ``dblib_searches``, ``coverage_note``.
lib_dblib_info tool
What a database library (.DbLib) declares, and how it connects.

        Call it first on an unfamiliar DbLib: per table it names the key
        column and the symbol and footprint columns that
        ``lib_dblib_get_record`` and ``sch_place_dblib_component`` take.
        The password is never returned (``redacted``, ``has_password``).
        ``key_field_source`` says how the key was found; ``first_column``
        is a guess. Altium answers for the library; the file is not
        opened. A library that is not installed is installed for the read
        and uninstalled after it.

        Args:
            library_path: Full path of the .DbLib (or .SVNDbLib);
                lib_get_installed_libraries lists installed ones.
            with_fields: Connect read-only to list each table's columns
                (default True). False asks Altium only.

        Returns:
            {"library_path", "connection": {"provider", "kind" (access /
            excel / sql_server / odbc / oracle / other), "data_source",
            "has_password", "redacted", "read_only"}, "left_quote",
            "right_quote", "search_path", "table_count", "tables": [{"name",
            "enabled", "schema", "key_field", "key_field_source",
            "key_field_found", "symbol_ref_field", "symbol_library_field",
            "description_field", "footprint_fields": [{"ref_field",
            "library_field"}], "fields" (null when not read), "field_count",
            "error", "settings"}], "fields_included",
            "connected" (null when no connection was attempted)}.
lib_dblib_search tool
Search database libraries (.DbLib) for components, read-only.

        Case-insensitive substring match over every row of every enabled
        table (lib_search folds these in already; this narrows to a table
        or columns). The query never reaches the database as SQL: rows
        are read and matched inside Altium, bounded by ``max_rows``
        (``scan_capped`` says the bound was hit).

        Args:
            query: Text to find (case-insensitive substring).
            library_path: One .DbLib to search. Omitted, every installed
                database library is searched.
            table: One table the DbLib declares (as lib_dblib_info names
                it). Omitted, every enabled table.
            fields: Column names to match. Omitted, every column. A name
                a table lacks is reported under ``unknown_fields``.
            limit: Cap on returned rows (1 to 1000, default 50).
            max_rows: Cap on rows read in total (default 20000).

        Returns:
            "query", "count", "limit", "truncated", "rows_scanned",
            "scan_capped", "libraries" (per library: searched, an error
            code, tables searched and failed, unknown_fields), and
            "results" (library_path, table, key, key_field, symbol_ref,
            symbol_library, footprints, description, matched_field,
            matched_value). No connection string is ever returned.
lib_dblib_get_record tool
Every column of one row of a database library table.

        The row is found by its key, the value in the table's key column
        (``key`` in a ``lib_dblib_search`` result; the column is
        ``key_field`` in ``lib_dblib_info``). The key is passed to the
        database as a parameter, never as SQL text. ``lookup`` says how
        the row was found: ``parameter`` when the database matched it,
        ``scan`` when the parameterised query could not run and the
        table was read and compared instead.

        Args:
            library_path: Full path of the .DbLib file.
            table: A table the DbLib declares.
            key: The row's key value.
            key_field: Optional column to match instead of the DbLib's
                own key column; it must be a column of the table.

        Returns:
            {"library_path", "table", "key", "key_field",
            "key_field_source", "lookup", "found", "match_count",
            "rows_scanned", "scan_capped", "symbol_ref", "symbol_library",
            "footprints": [{"ref", "library"}], "description",
            "fields": {column: value}}. ``found`` False is an answer, not
            an error: the key is not in that table. ``match_count`` above
            1 means the key is not unique and the first row is shown.
sch_place_dblib_component tool
Place one database library (DbLib) part on a schematic sheet.

        Altium builds the part from the row (symbol, footprints,
        parameters and database link) and drops it at (x, y), with no
        cursor or click. The DbLib must be installed (lib_install_library)
        or in the project, or the call is refused. ``database_linked``
        says whether the placed part kept its link. For a whole sheet use
        sch_draw_template instead.

        Args:
            library_path: Full path of the .DbLib file.
            table: A table the DbLib declares.
            key: The row's key value (``key`` in a lib_dblib_search
                result).
            x, y: Location in mils.
            rotation: 0, 90, 180 or 270.
            designator: Optional designator to stamp on the part.
            sheet_path: Optional .SchDoc path; default the active sheet.
            part_id: Which part of a multi-part component to place, from
                1 (A); part 1 when left out.

        Returns:
            "placed", "library_path", "table", "key", "lib_reference",
            "database_table", "database_linked", "x", "y", "rotation",
            "part_id" (read back), "part_count", "part_id_applied",
            "designator"; "reason" PART_REFUSED when the part did not take.
sch_place_dblib_rows tool
Place many database library (DbLib) rows on one sheet in ONE call.

        Every row goes down as sch_place_dblib_component places one: the
        symbol, footprints, parameters and database link from the row, no
        cursor, then read back. Each library and table is checked once. A
        row Altium cannot build is reported with its reason and the rest
        are still placed.

        Args:
            rows: ``{"key", "x", "y"}`` each, optionally ``rotation`` (0,
                90, 180, 270), ``designator``, ``part_id`` (from 1, default 1), and
                ``table`` or ``library_path`` where it is not the call's.
            library_path: The .DbLib of rows that name none.
            table: The table of rows that name none.
            sheet_path: The .SchDoc; defaults to the active sheet.

        Returns:
            ``sheet``, ``placed``, ``refused`` and ``rows``: per row its
            ``row`` number and what sch_place_dblib_component reads back,
            or ``placed`` false with the ``reason``.
lib_get_component_details tool
Everything about one library symbol in one call: metadata, pins,
        parameters, models, and the style (font_id, color, is_hidden, x,
        y, orientation, justification) of its designator, comment and
        parameters. obj_get_font_spec expands a font_id. Naming
        library_path opens (focuses) that library; nothing is saved.

        DATASHEET DISCIPLINE: pins, parameters and MPN here are hints;
        fetch the datasheet and cite it before stating a pin or rating.

        Args:
            component_name: LibRef in the .SchLib.
            library_path: .SchLib path (default: the focused library).
            component_index: ``index`` from lib_get_components, for a name
                with characters you cannot reproduce. Give exactly one of
                name or index.

        Returns:
            name, library_path, description, alias_name, part_count (the
            file reader's), part_count_live (the open symbol's),
            parts_with_pins (highest part that has pins) and a
            part_count_note when they disagree, pin_count;
            ``designator`` and ``comment`` (text plus style);
            ``pins`` [{designator, name, electrical_type, x, y,
            orientation, hidden, label_hidden}]; ``parameters`` (name ->
            value); ``parameter_styles``; ``models`` [{model_name,
            model_type, is_current, datafile_links}];
            ``_datasheet_guidance``.
lib_audit_styles tool
Audit label styles across every symbol of a library in one call.

        Reports each symbol's designator style; comment, parameter styles
        and pins are opt-in. With an ``expect_designator_*`` filter only
        the symbols that do NOT match come back.
        ``check_standard_symbols`` adds ``standard_symbol_warnings``:
        amplifiers drawn as a rectangle instead of a triangle (warns only).

        Args:
            library_path: .SchLib (default: the focused one).
            with_comment: Add the comment style.
            with_parameters: Add parameter styles (slower).
            with_pins: Add pins, ``body`` (rectangle and polygon counts)
                and description.
            check_standard_symbols: Flag rectangular amplifiers (implies
                with_pins).
            expect_designator_font_id: Keep only symbols whose designator
                font differs.
            expect_designator_color: Keep only symbols whose designator
                colour differs (BGR int, e.g. 8388608 for navy).
            limit: Cap on symbols returned (default 5000).
            timeout: Poll timeout in seconds.
            refresh: SAVE the library and read it back in first. Symbols
                are listed from the saved file, so ones created or changed
                since the last save are otherwise missing or stale.

        Returns:
            library_path, count, mismatch_count, limit, truncated,
            filter_applied, refreshed, ``components`` [{name, designator,
            mismatched, comment?, pins?, parameter_styles?}].
lib_set_label_formats tool
Set label styles on SchLib symbols, several targets in ONE call
        (no single-target variant), across one symbol or the whole library.

        Each op writes only the fields it gives (at least one):
            {"target": "designator" | "comment" | "parameter:<Name>",
             "font_id", "color" (BGR int), "is_hidden", "orientation"
             (0/90/180/270), "justification", "x", "y" (mils, symbol
             frame), "text" (e.g. "=Partnumber" on the comment)}
        Resolve font_id with ``obj_get_font_id`` / ``obj_get_font_spec``.

        Args:
            ops: Non-empty list of ops; targets cannot contain ';' or
                '~~'.
            component_name: One symbol only; omit for the whole library.
            library_path: .SchLib (default: the focused one).
            only_mismatched: Skip labels already matching (default True).
            limit: Cap on components in a library walk.
            timeout: Poll timeout override.

        Returns:
            library_path, scope ("single"|"bulk"), total, limit,
            truncated, and ``ops`` [{target, modified, already_compliant,
            missing_target, failed}].
lib_set_mech_layers tool
Name, enable and set the kind of a library's mechanical layers.

        Takes the library by PATH (unlike the pcb_* layer tools, which act
        on whatever is focused) and refuses unless that library is the one
        focused. Every change is read back and failures are reported per
        layer. A Top/Bottom kind ("Courtyard Top") belongs to a layer PAIR,
        so give the partner kind to another layer in the same call. Use
        ``lib_run_across`` to apply one scheme to many libraries.

        Args:
            layers: [{layer (e.g. "Mechanical13"), name?, enabled?,
                kind?}].
            library_path: Library to edit (default: the focused one; only
                safe for a single library).
            tidy_pairs: Also remove layer pairs whose two layers are not a
                matching Top/Bottom kind pair (default off: it removes
                pairs).
            timeout: Seconds.

        Returns:
            ``library``, ``layers`` [{layer, changed, problem}],
            ``changed``, ``failed``, ``kinds_displaced``,
            ``pairs_removed``, ``pairs_tidied``, ``pairs_scanned_to``.
lib_run_across tool
Run one library command against several libraries in one call
        (the loop runs inside Altium; each library is still opened).

        Works for commands that accept a ``library_path`` (most reads and
        batch edits). Footprint editing commands (``create_footprint``,
        ``add_footprint_pad``, ``link_3d_model``...) act on the open
        library and cannot be swept.

        Failure is per library: one that will not open does not stop the
        rest, and each is reported separately.

        Args:
            action: Library command without its namespace, e.g.
                "get_components", "batch_rename", "audit_styles".
            libraries: Full paths. Passed to Altium separated by "|",
                which cannot occur in a Windows path.
            params: Parameters shared by every library. Any
                ``library_path`` here is overridden per library.
            timeout: Seconds for the whole sweep, not per library.

        Returns:
            Dict with ``results`` (each: library, success, data, error),
            ``succeeded``, ``failed`` and ``libraries``.
lib_batch_set_params tool
Batch set parameters on library components.

        Each assignment updates or creates one parameter. Three names set
        properties instead: ``"Description"``, ``"Designator"`` (the
        default, e.g. ``"U?"``) and ``"Comment"`` (e.g. ``"=Partnumber"``).
        A created parameter is hidden; ``lib_set_label_formats`` shows,
        hides or moves it.

        Args:
            assignments: List of dicts with keys:
                - component_name: Name of the component in the library
                - param_name: Parameter name (e.g., "Partnumber", "Manufacturer"),
                  or the special "Description" / "Designator" / "Comment" keys
                - param_value: Value to set
            library_path: Path to library (uses active library if not specified)

        Returns:
            Dictionary with counts of updated, created, and failed assignments
lib_batch_rename tool
Batch rename components in a schematic library.

        What ``lib_rename_component(items=[...])`` runs by name, kept under
        this name for callers that use it.

        Each assignment renames one component from old_name to new_name.

        Args:
            assignments: List of dicts with keys:
                - old_name: Current name of the component in the library
                - new_name: New name for the component
            library_path: Path to library (uses active library if not specified)

        Returns:
            Dictionary with counts of renamed and failed assignments
lib_diff_libraries tool
Compare two schematic libraries and report differences.

        Returns which components are only in library A, only in B, or shared.

        Args:
            library_a: Full path to the first SchLib file
            library_b: Full path to the second SchLib file

        Returns:
            Dictionary with only_in_a, only_in_b, common arrays,
            and count_a, count_b, only_a, only_b, shared counts
lib_add_symbol_arc tool
Add an arc to the current library symbol.

        Args:
            x_center: Center X coordinate in mils
            y_center: Center Y coordinate in mils
            radius: Arc radius in mils
            start_angle: Start angle in degrees (0 = right, 90 = up)
            end_angle: End angle in degrees
            width: Line width (0=zero, 1=small, 2=medium, 3=large)
            grid: snap grid (mils); arcs are glyph detail and don't need
                the 100-mil pin grid (rule 15), so the default is a finer
                25 mils (e.g. inductor coils). Pass 100 mils for coarse,
                0 for none.
            color: line colour (Altium colour integer); omit for the
                default.
            owner_part_id: the part of a multi-part symbol it belongs to;
                omit for the current part.

        Returns:
            Dictionary confirming arc addition, with ``color`` and
            ``line_width`` read back
lib_add_symbol_polygon tool
Add a polygon (filled shape) to the current library symbol.

        Args:
            vertices: Comma-separated x,y coordinate pairs.
                Example: "0,0,100,0,100,100,0,100" creates a square with
                vertices at (0,0), (100,0), (100,100), (0,100).
                Minimum 3 vertices (6 values) required.
            grid: snap grid (mils) for the vertices. A filled polygon is
                glyph detail (e.g. a diode triangle) and doesn't need the
                100-mil pin grid (rule 15), so the default is a finer 25
                mils; pass 100 mils for coarse or 0 to disable snapping.
            fill_color: omit for a solid glyph in the line colour (a diode
                triangle); a colour such as 8454143, Altium's block yellow,
                makes it a filled BODY (an amplifier triangle); -1 draws
                an outline only.
            owner_part_id: the part of a multi-part symbol to draw on;
                omit for the current part.
            color: border colour (Altium colour integer).
            line_width: border width, 0 (smallest) to 3 (large).
            is_solid: fill (True) or outline only (False), over what
                ``fill_color`` implies.

        Returns:
            Dictionary confirming polygon addition with vertex count, and
            the style it now holds read back: ``color``, ``area_color``,
            ``line_width``, ``is_solid``
lib_set_component_description tool
Set the description field on a library component.

        Args:
            component_name: Name of the component in the active library
            description: New description text

        Returns:
            Dictionary confirming the description was set
lib_get_pin_list tool
Get all pins of a library component.

        Name the component: without ``component_name`` this reads the
        current symbol, the one ``lib_add_pins`` writes into (see there),
        which need not be the one on screen. Pin names and types in a
        symbol can be wrong; check them against the datasheet before
        relying on them. With ``items`` the symbols of one library are
        read 25 to a request.

        Args:
            component_name: library reference of the symbol to read.
                Empty reads the current symbol.
            output_path: write the full pin array here as JSON and
                return a summary instead.
            inline_limit: above this many pins the array goes to a file
                (``pins_path``); 0 always returns inline.
            library_path: the .SchLib to read; it is brought to the front
                (opened if need be) first, so a sheet in front does not
                stop the read. Empty reads the library in front.

        Returns:
            "count", "component", and "pins", each with designator,
            name, electrical_type, x, y, orientation, hidden,
            ``owner_part_id`` and ``display_mode`` (0 normal, 1+ an
            alternate mode, not a duplicate). Spilled: "pins_path" and
            "summary" instead of "pins". Plus `_datasheet_guidance`.
lib_set_pin_owner_part tool
Reassign pins of a multi-part symbol to a sub-part, or to Part Zero.

        ``owner_part_id=0`` is Part Zero: the pin belongs to the package,
        not one sub-part, which is where supply pins go. A supply pin
        owned by a sub-part is drawn at every instance and can short two
        rails where instances sit close.

        Changes the library only. Placed instances pick it up on the
        next Update From Libraries, which produces an ECO.

        Args:
            pin_designators: comma-separated pin numbers, e.g. "3,12".
            owner_part_id: 0 for Part Zero, or 1..part_count.
            component_name: library reference of the symbol to edit.
                Empty edits the current symbol (see ``lib_add_pins``).

        Returns:
            Dictionary with "component", "owner_part_id", the
            "pins_changed" list and its "count".
lib_export_kicad_symbol tool
Export a SchLib symbol to a KiCad .kicad_sym file.

        A KiCad 6+ symbol: a body rectangle round the pins and every pin
        with number, name, type and position, in mm. Naming a component
        leaves it current in the library (``current_component``), so a
        later call without a name, such as ``lib_add_pins``, acts on it.

        Args:
            component_name: LibRef to export. If empty, exports whatever
                component is currently selected in the SchLib.
            output_path: Destination .kicad_sym file. Defaults to
                workspace/<name>.kicad_sym.
            reference: Reference designator prefix for the symbol (default
                "U").

        Returns:
            {"output_path", "symbol", "pin_count"} or an error.
lib_export_kicad_footprint tool
Export a PcbLib footprint to a KiCad ``.kicad_mod`` file.

        A KiCad 6+ footprint of the pads (number, position, size, shape,
        drill, layer set), in mm with the y axis flipped.

        Args:
            footprint_name: Footprint to export. If empty, exports the
                library's current footprint.
            output_path: Destination .kicad_mod file. Defaults to
                workspace/<name>.kicad_mod.

        Returns:
            {"output_path", "footprint", "pad_count"} or an error.
lib_copy_component tool
Copy a component WITHIN or BETWEEN schematic libraries.

        Copies pins, graphics and parameters. The destination ends
        focused with the copy selected; save with ``app_save_all``.

        Args:
            source_name: lib_ref of the component to copy.
            new_name: lib_ref for the clone. Defaults to ``source_name``
                (natural choice for cross-library copies that should
                keep their identity).
            source_library: .SchLib path to read from. Defaults to the
                currently focused document.
            dest_library: .SchLib path to write to. Omit (or pass the
                same path as ``source_library``) for a same-library
                duplicate.
            overwrite: When True, a component already named ``new_name``
                in the destination is removed first. Default False
                returns ``NAME_EXISTS`` and changes nothing.

        Returns:
            Dictionary with ``success``, ``source``, ``new_name``,
            ``source_library``, ``dest_library``, ``same_library`` and
            ``overwrote`` flags. ``source_holder`` true: the source held
            one symbol, so a temporary one was shown and removed; the
            source library is left modified, not saved.
lib_copy_footprint tool
Copy one footprint (all pads/primitives) into a PcbLib, optionally renaming.

        A same-library copy needs a different new_name; an existing
        new_name in dest is refused unless overwrite. A library that is
        not open is opened as a document, so the copy can be saved; the
        copy is read back before success.

        Args:
            source_name: the footprint to copy.
            new_name: name for the copy (default source_name).
            source_library: source .PcbLib path (default the focused lib).
            dest_library: destination .PcbLib path (default source).
            overwrite: replace a same-named footprint already in dest.

        Returns:
            {"success": true, "source": "...", "new_name": "...",
             "same_library": bool}.
lib_move_components tool
Move matching components (symbol + params + models) between SchLibs.

        Bulk lib_copy_component: copies each match whole, then removes it
        from the source unless ``delete_from_source`` is False. One already
        in the destination is skipped unless ``overwrite``. A failed copy
        is never deleted from the source.

        Args:
            source_schlib: source .SchLib path.
            dest_schlib: destination .SchLib path.
            names: explicit list of component LibReferences to move.
            name_regex: regex matched against source component names when names
                is not given.
            delete_from_source: remove moved components from source (default True).
            overwrite: replace a same-named component already in dest.
            dry_run: report the selection without moving anything. Use it
                with name_regex, which is a ``search``, not a full match
                (``R`` selects every name containing an R).

        Returns:
            {"success": true, "moved": N, "skipped": N, "failed": N}, or
            in dry-run {"dry_run", "resolved", "count", ...}.
lib_rotate_footprint tool
Turn a footprint in a .PcbLib about its own origin by 90, 180 or
        270 degrees, counter-clockwise (-90 is 270), every primitive with it:
        pads (position and pad rotation), tracks, arcs, fills, regions, vias,
        texts (.Designator / .Comment included) and 3D bodies, whose model
        turns with the body as it does under Altium's own Rotate Selection
        (the model's own rotation fields are never written). The library is
        opened by path; it need not be focused, and the user's selection is
        not touched.

        Every pad is read back: its centre must land where the turn puts it
        and its rotation must move by the angle. Any that did not are
        listed in ``pad_mismatches`` and counted in ``mismatches``; the
        library is then NOT saved, so it can be inspected (or the footprint
        turned back by the opposite angle). Polygons and dimensions in a
        footprint are counted in ``not_turned``. Look at one turned
        footprint in 3D before a batch (``show``), since the model's
        orientation cannot be read back.

        Args:
            library_path: the .PcbLib.
            footprint: footprint name (case-insensitive).
            angle: 90, 180, 270 or -90.
            dry_run: count what would be turned, change nothing.
            save: save the library afterwards when nothing mismatched.
            show: make the footprint the library's current one afterwards,
                to look at it (its 3D model shows only there). Changes what
                the library editor has on screen.

        Returns:
            ``kinds`` (count per primitive kind), ``turned``,
            ``not_turned``, ``mismatches``, ``pad_mismatches``,
            ``bodies_with_models`` and ``saved``.
lib_move_footprints tool
Move matching footprints between PcbLibs (the PcbLib analog of move).

        Copies each footprint whole, then removes it from the source
        unless delete_from_source is False; with lib_move_components it
        splits a library. Give names or name_regex. A footprint already in
        dest is skipped unless overwrite=True.

        Args:
            source_pcblib: source .PcbLib path.
            dest_pcblib: destination .PcbLib path.
            names: explicit list of footprint names to move.
            name_regex: regex matched against source footprint names when names
                is not given.
            delete_from_source: remove moved footprints from source (default True).
            overwrite: replace a same-named footprint already in dest.
            dry_run: report the selection and move nothing. Use it with
                name_regex: the pattern matches anywhere in a name, so a
                short one selects far more, and the default deletes them
                from the source.

        Returns:
            {"success": true, "moved": N, "skipped": N, "failed": N}, or
            in dry-run {"dry_run", "resolved", "count", ...} with nothing
            sent to the bridge.
lib_split_pin_functions tool
Split slash-delimited pin names into pin function lists.

        For the current library symbol (see ``lib_add_pins``), parses each
        pin whose name is `PRIMARY/ALT1/ALT2/...` into the pin's function
        list (the alternate-function popup). The pin's name is left as it
        was: shorten it yourself if only `PRIMARY` should show. Pins
        without a `/` are unchanged.

        Returns:
            {"pins_processed": N}, every pin looked at, with or without
            a `/`.
lib_get_installed_libraries tool
List the libraries installed in the Altium environment.

        Reads the environment's own list (IntLib, SchLib, PcbLib,
        database and query libraries), open or not; `lib_search` sees
        only open SchLibs. Installed means switched on; the available
        total comes beside it, so a library present but switched off
        shows as a gap between the two numbers.

        Args:
            with_counts: True (default) also reports how many components
                each library holds. That opens every library to count
                them, so pass False for a fast listing; the count then
                comes back as -1, meaning not asked rather than empty.

        Returns:
            {"libraries": [{"library_path", "file_name", "library_type",
            "library_type_ordinal", "component_count"}], "installed_count",
            "available_count", "counts_included"}. ``library_type`` is one
            of integrated / source / datafile / database / none / query /
            design_items, or unknown; it reads "unknown" with an ordinal of
            -1 when a library is installed but missing from the available
            list, which is a real state and not an error.
lib_install_library tool
Register a library with the environment's Available Libraries.

        An .IntLib / .SchLib / .PcbLib, so its parts resolve by name. A
        .PvLib goes into the PCB editor's pad/via libraries instead.

        Args:
            library_path: absolute path to the library file.

        Returns:
            {"installed": bool, "library_path": "..."}.
lib_get_vault_name tool
The Workspace name the managed tools would use, read off the design.

        Altium writes the Workspace name onto every managed part it
        places. This reads it from the active sheet, then from the other
        sheets that are already open; it never opens one. A part addressed
        by kind 4 (VaultName) is preferred; ``other_kind`` says when only
        another kind was found.

        Returns:
            ``found``, ``vault``, ``other_kind`` and ``seen``, every
            ``kind:name`` met, separated by ``|``.
lib_find_vault_components tool
Find the Design Item ID of a managed part by its exact name.

        Looks through the managed (Workspace) parts already placed on the
        sheets Altium has open, and matches ``name`` exactly, case
        ignored, against each part's comment, library reference and
        Design Item ID. Every match comes back, one per Design Item ID,
        with the lifecycle state the library manager reports, so two
        parts sharing a name are both shown rather than the first one
        being picked.

        It does not search the whole Workspace: a part not yet used in
        the design has to be looked up in Altium's Components panel.

        Args:
            name: The comment, library reference or Design Item ID.

        Returns:
            ``name``, ``count``, ``sheets_searched`` and ``matches``, each
            with design_item_id, comment, lib_reference, vault,
            lib_identifier_kind, revision_guid, lifecycle_state and sheet.
lib_get_vault_component tool
Check one managed (Workspace) component can be placed, without placing it.

        Loads the item the way ``sch_place_vault_components`` would, reads
        its identity, and throws it away again; nothing reaches a sheet.
        The kind asked for is tried first, then the others. The library
        manager's lookups (library path, lifecycle state, revisions,
        placement parameters) are reported alongside. Give the Design
        Item ID, not a part number.

        Args:
            design_item_id: The component's Design Item ID.
            vault: The Workspace name. Usually left out; see
                ``lib_get_vault_name``.
            lib_identifier_kind: Altium's TLibIdentifierKind, tried first:
                0 Any, 1 NameNoType, 2 NameWithType, 3 FullPath, 4 VaultName
                (the default). A managed part Altium placed shows the kind
                and identifier that work, through ``obj_query`` on
                ``eSchComponent``.

        Returns:
            ``placeable``, ``loader_callable``, lib_identifier_kind (the
            kind that loaded, -1 if none), ``load_probe`` (``kind:result``
            for each try), the loaded ``loaded_design_item_id``,
            ``vault_guid``, ``item_guid`` and ``revision_guid``, then
            ``library_path``, ``display_path``, ``lifecycle_state``,
            ``has_revisions``, ``revisions``, ``placement_parameters``,
            ``note`` and ``diag`` (library manager calls that raised).
lib_uninstall_library tool
Unregister a library from the environment's Available Libraries.

        A .PvLib is removed from the PCB editor's installed pad/via
        libraries instead.

        Args:
            library_path: absolute path to the library file.

        Returns:
            ``uninstalled`` (checked against the installed list),
            ``still_installed``, ``closed_document`` (an .IntLib open as a
            document was closed), ``library_path`` and ``file_locked``
            (True: Altium still holds the file, so it cannot be deleted
            or rebuilt in place until Altium restarts).
lib_delete_component tool
Delete one symbol from a schematic library (.SchLib).

        Removes one named component; save with app_save_all. An unknown
        name is COMPONENT_NOT_FOUND.

        Args:
            component_name: the component's LibReference (its library name).
            library_path: optional absolute .SchLib path to target; defaults
                to the currently focused library document.
            component_index: alternative to component_name; the integer
                `index` from lib_get_components. Use it to delete a part
                whose name carries unreproducible bytes (embedded quote or
                control char). Provide exactly one of the two.

        Returns:
            {"success": true, "library_path": "...", "deleted": "..."}.
lib_rename_component tool
Rename one symbol's LibReference in a schematic library (.SchLib).

        Also repairs a name a caller cannot type (a quote or control
        character from a broken import): address it by
        ``component_index``. A name another component has is NAME_EXISTS.
        Save with app_save_all.

        For several, give ``items``: a list of {component_name, new_name}
        dicts (component_index works too). Items by name in one library
        run as one batch in Altium; arguments given beside ``items`` apply
        to every item.

        Args:
            new_name: the clean LibReference to write.
            component_name: current LibReference of the target. Provide this
                or component_index.
            library_path: optional absolute .SchLib path; defaults to the
                focused library.
            component_index: the integer `index` from lib_get_components,
                the name-free way to pick the target. Provide this or
                component_name.

        Returns:
            {"success": true, "library_path": "...", "old_name": "...",
             "new_name": "..."}. With items by name: the counts of renamed
            and failed; otherwise each item's own reply.
lib_delete_footprint_primitives tool
Delete primitives inside ONE footprint of a PCB library.

        The library-scoped delete: ``obj_delete`` and ``pcb_delete_object``
        act on a BOARD, and aimed at a library can delete from another
        open PcbDoc. The library, footprint
        and type or layer must all match. Pads are kept unless
        ``include_pads``. A footprint on screen is edited with another
        made current, then shown again (``was_current``).

        Args:
            footprint_name: The footprint to edit. Required.
            object_type: e.g. "track", "arc", "text", "region", "fill".
                Give this or ``layer``.
            layer: One layer, e.g. "TopOverlay" or a stack name such as
                "Top Assembly"; an unknown name is refused.
            library_path: The .PcbLib; default the focused document.
            include_pads: Allow pads to be removed.
            confirm: Required True; check first with
                ``lib_get_footprint_primitives`` or
                ``lib_count_layer_objects``. In a library of one
                footprint a temporary ``EDA_AGENT_HOLD`` footprint is
                made current for the delete and removed again.
            identifier: 3D bodies whose Identifier starts with this (one
                prefix takes every suffix a tool wrote); implies
                object_type "body". Bodies built by a tool can be taken
                away without the footprint's own STEP model, which sits
                on the same layer.
            pad_name: The pads with this designator (every one of them;
                ``layer`` narrows to one side); implies object_type "pad"
                and include_pads.

        Returns:
            ``library``, ``footprint``, ``matched``, ``removed``,
            ``leftover`` (matching primitives still there after the
            delete, counted again), ``hint`` (why, when something matched
            and stayed or nothing matched), ``examined``, ``layers``,
            ``pads_included``, ``was_current``.
lib_move_bodies_to_layer tool
Put the 3D bodies of the focused PCB library on one mechanical
        layer.

        For libraries merged from sources that used different layers.
        Bodies already on the layer are counted and left; nothing is added
        or removed.

        Args:
            layer: The mechanical layer, by number ("Mechanical13") or by
                the name the library's stack gives it. Anything else is
                refused, as Altium's body dialog only offers mechanical
                layers.
            footprint_names: Only these footprints. Empty means every
                footprint in the library; names no footprint has come
                back in ``not_found``.
            keep_layers: Layers whose bodies stay where they are, by the
                same names as ``layer``. A body already on one of them is
                counted as already on the layer. Every other body moves.
                An unknown name refuses the whole call, and nothing moves.
                Empty: every body moves.

        Does NOT save the library. A mechanical layer the library has not
        enabled is accepted, with ``layer_enabled`` false and a
        ``warning``, since Altium does not draw what is on it.

        Returns:
            Dict with ``layer``, ``layer_enabled``, ``footprints``,
            ``bodies``, ``moved``,
            ``already_on_layer``, ``footprints_without_bodies``,
            ``not_found``, and ``items`` (``{name, moved, from}`` for
            each footprint that changed).
lib_set_symbol_parts tool
Set how many parts and display modes a SchLib symbol has.

        Uses the library editor's own Add Part / Remove Part and Add /
        Remove Display Mode, one step at a time, each read back. Parts
        and modes are added and removed at the end: a part count going
        from 4 to 2 removes parts 4 and 3 WITH THEIR PINS and graphics
        (``pins_removed`` says how many). A new part or mode is empty;
        draw it with lib_add_pins and the lib_add_symbol_* tools.

        Args:
            name: The symbol (its library reference).
            library_path: The .SchLib. Defaults to the focused library.
            part_count: Parts wanted, from 1. Omit to leave as is.
            display_mode_count: Display modes wanted, from 1 (the normal
                mode only). Omit to leave as is.

        Does NOT save the library.

        Returns:
            ``part_count_before``, ``part_count``,
            ``display_mode_count_before``, ``display_mode_count``,
            ``pins_removed``, and ``complete`` (false with ``stopped``
            saying which step did not take).
lib_set_symbol_aliases tool
Read, add or remove a SchLib symbol's aliases.

        An alias lets one symbol be placed under several part names (a
        74HC00 drawn once, offered as 74HCT00 too). Removal runs before
        adding. Call with only ``name`` to read.

        Args:
            name: The symbol (its library reference).
            library_path: The .SchLib. Defaults to the focused library.
            add: Alias names to add.
            remove: Alias names to remove.

        Does NOT save the library.

        Returns:
            ``aliases_before`` and ``aliases``.
lib_check_schlib tool
Run Altium's own component rule check on a schematic library.

        Checks every symbol for duplicate pins, duplicate parts, missing
        pin numbers, names, designator, footprint or description, and
        gaps in the pin numbering. No report window opens; Altium writes
        its report as <library>.ERR beside the library, and that is
        read back.

        Args:
            library_path: The .SchLib. Defaults to the focused library.
            checks: Only these: duplicate_pins, duplicate_component,
                missing_pin_number, missing_default_designator,
                missing_footprint, missing_description, missing_pin_name,
                missing_pins_in_sequence. ``None`` runs all.

        Returns:
            ``ran``, ``report`` (the .ERR file Altium wrote beside the
            library, None when it wrote none), ``symbols_with_problems``
            and ``problems`` (``symbol`` and the ``problems`` Altium
            named, such as "No Footprint").
lib_check_pcblib tool
Check a PCB library's footprints, as Altium's Component Rule Check.

        The same checks, run here without the dialog: duplicate_pads (one pad name used
        twice), duplicate_primitives (the same object drawn twice on one
        layer), missing_pad_names, mirrored_component (primitives on the
        bottom side only), offset_reference (the origin outside the
        footprint), shorted_copper (pads of different names joined by
        copper), unconnected_copper (copper touching no pad) and
        duplicate_footprints (two footprints with one name). Copper
        touches when Altium measures no gap between two pieces on a
        shared layer; a through-hole pad or via is on every copper layer.
        Each footprint is shown in turn to measure it, and the one shown
        before is shown again at the end. Nothing is changed.

        Args:
            library_path: The .PcbLib. Defaults to the focused library.
            checks: Only these, from the names above. ``None`` runs all.
            footprint_name: Only this footprint.

        Returns:
            ``footprints_checked``, ``footprints_with_problems`` and
            ``footprints`` [{footprint, pieces, problems [{check,
            detail}]}]; positions in a detail are mil from the
            footprint's origin. ``basic_3d_models`` names the footprints
            whose 3D model is only extruded, cylinder or sphere bodies
            when the Config tab does not allow basic 3D models: tell the
            user and ask before replacing any.
lib_set_pin_timing tool
Set symbol pins' package length and propagation delay.

        The length and delay inside the package, from the die to the
        pin, which Altium adds to a net's routed length when it matches
        lengths. Every pin with the designator is set, a pin repeated in
        another display mode too. The edit is in memory until
        app_save_all.

        Args:
            component_name: The symbol in the .SchLib.
            pins: designator -> ``{"package_length_mil": 120.5,
                "propagation_delay_ps": 35}``; either key alone sets only
                that value. 0 clears it.
            library_path: The .SchLib. Defaults to the focused library.

        Returns:
            ``pins_changed``, ``not_found`` (designators no pin has) and
            ``pins`` [{designator, package_length_mil,
            propagation_delay_ps}], read back from every pin.
lib_set_supplier_links tool
Replace a library symbol's manufacturer and supplier links.

        A file-based library keeps them as numbered parameters, the names
        Altium's Supplier Links writes: "Manufacturer 1",
        "Manufacturer Part Number 1", "Supplier 1", "Supplier Part
        Number 1", then 2 and on. Every existing one is removed and the
        given links are written from 1, so the list is the whole set; an
        empty list clears them. Other parameters are left alone. The
        edit is in memory until app_save_all.

        Args:
            component_name: The symbol in the .SchLib.
            links: ``{"manufacturer", "mpn", "supplier",
                "supplier_part_number"}`` each, any of them; a link with
                none is refused.
            library_path: The .SchLib. Defaults to the focused library.

        Returns:
            ``removed`` and ``written`` (parameters), ``parameters`` read
            back, and ``links`` grouped by number.
lib_get_supplier_links tool
A library symbol's manufacturer and supplier links.

        Read from the numbered parameters a file-based library keeps them
        in ("Manufacturer 1", "Manufacturer Part Number 1", "Supplier 1",
        "Supplier Part Number 1", ...). Changes nothing.

        Args:
            component_name: The symbol in the .SchLib.
            library_path: The .SchLib. Defaults to the focused library.

        Returns:
            ``links`` [{link, manufacturer, mpn, supplier,
            supplier_part_number}] (the fields it has) and the
            ``parameters`` they came from.
lib_library_report tool
Write a library report: every symbol or footprint on one page.

        One HTML page, read through Altium without its dialog: for a
        .SchLib each symbol's description, designator, parts, pins,
        models and parameters; for a .PcbLib each footprint's
        description and pads. One read per entry, so a large library
        takes a while.

        Args:
            library_path: The .SchLib or .PcbLib.
            out_path: The .html to write. Defaults to "<library> Library
                Report.html" beside the library.

        Returns:
            ``report`` (the file), ``kind``, ``entries`` and ``unread``
            (entries Altium gave nothing for, also named on the page).
lib_save_footprint_library tool
Write one footprint of a PCB library to a new .PcbLib of its own.

        Args:
            footprint_name: The footprint.
            out_path: Full path of the .PcbLib to write; never the source.
                On Altium 25 and later an existing file is written over; on
                older versions it must be a new file.
            library_path: The source library. Defaults to the focused one.

        Returns:
            ``written`` (a new file is at out_path) and ``reported``
            (whether the new destination was saved).
lib_export_3d_model tool
Write the STEP model of a footprint's 3D body to a file, through Altium.

        Altium re-encodes the model, so this gives the GEOMETRY, not the
        vendor's file: lib_extract_embedded_models gives the original
        bytes. Use this one for an unsaved library or a linked model.

        Args:
            footprint_name: The footprint whose model to write.
            out_path: Full path of the .step file to write.
            library_path: The .PcbLib. Defaults to the focused library.
            body_index: Which STEP body, 1-based, when a footprint has
                several.

        Returns:
            ``written`` (a new file is at out_path), ``model`` (the model
            file name Altium holds), ``footprint`` and ``out_path``.
lib_set_3d_body tool
Read or change the 3D bodies already in a PcbLib footprint.

        Edits bodies in place: height, opacity, layer, centre and standoff
        (the Properties panel's Standoff Height). Call with only
        ``footprint_name`` to read every body.

        ON A STEP BODY THE STANDOFF IS THE MODEL'S Z OFFSET. Writing it
        also writes the model's rotations, read from Altium's export of
        the footprint as it is now, unsaved edits included. A STEP body
        the export does not hold is ``skipped``.

        Args:
            footprint_name: The footprint whose bodies to edit. Required.
            library_path: The .PcbLib. Defaults to the focused document;
                the edit is refused if that library cannot be focused,
                and a path that is not a file is refused before Altium
                sees it, since Altium opens a new, empty library there.
            standoff_height: Height of the body's base above the board.
            overall_height: Height of the body's top above the board.
            opacity: 0 (clear) to 1 (solid), not a percentage.
            layer: Move the body to this mechanical layer, by number
                ("Mechanical5") or the name the library's stack gives it.
            body_index: 1-based, in the order ``before`` lists them.
                Empty edits every body of the footprint.
            units: "mil" (default) or "mm" for the two heights and the
                centre.
            center_x, center_y: Move the body so the centre of its box is
                here, relative to the footprint origin (one body: give
                ``body_index``). An axis left out stays. ``after`` reads
                the centre back as ``center_x_mils`` / ``center_y_mils``;
                ``moved_as_asked`` compares it.

        Does NOT save the library.

        Returns:
            Dict with ``library``, ``footprint``, ``bodies``, ``changed``,
            and ``before`` / ``after``: one ``{index, layer, step,
            standoff_height_mils, overall_height_mils, opacity}`` per body
            touched with ``center_x_mils`` / ``center_y_mils``, read
            back from Altium (for a STEP body
            ``standoff_height_mils`` is the unused body field).
            ``exported_bodies`` is each body as Altium exports it, with
            ``model_z_offset_mils`` and ``rotation_deg``.
            ``model_z_offset_written`` lists the STEP bodies whose Z
            offset was written; read again to see it in
            ``exported_bodies``. ``skipped``: bodies left alone, why.
lib_redraw_assembly tool
Draw the assembly layer of the focused PCB library again from
        each footprint's own geometry: a rectangle round the part and a
        ``.Designator`` in its middle.

        With ``replace`` (the default) the tracks, arcs, texts, fills and
        regions on ``layer`` are cleared first; bodies and pads are never
        touched. Does NOT save. A layer the library has not enabled is
        accepted with ``layer_enabled`` false and a ``warning``.

        Args:
            layer: The mechanical layer for the drawing.
            footprint_names: Only these footprints. Empty means all.
            outline_from: ``body``, ``pads``, ``courtyard`` (drawn on
                ``courtyard_layer``) or ``auto`` (that order of
                preference). A footprint with none is in ``skipped``.
            courtyard_layer: The courtyard's layer; not ``layer`` when
                replacing.
            width: Line width (default 4 mil).
            designator: Place a centred ``.Designator``, upright in a
                tall box.
            text_height: 0 sizes it to the box (0.2 to 1 mm).
            replace: Clear the layer first; False draws beside it.
            confirm: Required with ``replace``.
            units: "mil" (default) or "mm" for ``width`` and
                ``text_height``.

        Returns:
            ``layer``, ``layer_enabled``, ``redrawn``, ``cleared``,
            ``skipped``, ``not_found``, ``items`` (``{name,
            outline_from, cleared, width_mm, height_mm}``).
lib_delete_footprint tool
Delete one footprint from a PCB library (.PcbLib).

        Marks the library changed; does NOT write to disk: save with
        `app_save_all`. An unknown name is FOOTPRINT_NOT_FOUND.

        Args:
            footprint_name: the footprint's name in the library.
            library_path: optional absolute .PcbLib path to target; defaults
                to the currently focused library document.

        Returns:
            {"success": true, "library_path": "...", "deleted": "..."}.
lib_set_model_name tool
Set a model's model_name (footprint reference) on a SchLib symbol.

        Rewrites the ModelName of one of the component's implementations.
        If model_name is given, the model whose current ModelName matches is
        targeted; otherwise the current (or first) model is used.

        Args:
            component_name: the component's LibReference.
            new_model_name: the new model_name to write.
            model_name: optional current model_name to target a specific one.
            library_path: optional .SchLib path; defaults to the focused lib.

        Returns:
            {"success": true, "component": "...", "new_model_name": "..."}.
lib_set_model_source tool
Write the datafile-link Location (source library) on a footprint model.

        With an empty Location a footprint resolves by name in the editor
        but is missing from a compiled library, with no compile error.
        Targets footprint models named model_name, or all of them. Copy
        the exact source_library from a model that embeds correctly
        (``lib_get_component_details`` shows each model's location); it
        is written as given.

        Args:
            component_name: the component's LibReference.
            source_library: the source-library reference written into Location.
            model_name: optional footprint model name to target one model.
            use_component_library: optional; sets the embed-vs-search flag.
            library_path: optional .SchLib path; defaults to the focused lib.

        Returns:
            {"success": true, "component": "...", "source_library": "...",
             "models_updated": N}.
lib_remove_model tool
Remove models (implementations) from a SchLib component by name.

        Removes every implementation whose ModelName equals model_name. With
        keep_one=True it keeps the first match and removes the rest, which
        deletes duplicate model links while preserving one. Errors if the
        component is not found; returns removed=0 if no model matches.

        Args:
            component_name: the component's LibReference.
            model_name: the ModelName of the model(s) to remove.
            keep_one: keep the first match and remove the rest (dedup).
            library_path: optional .SchLib path; defaults to the focused lib.

        Returns:
            {"success": true, "model_name": "...", "removed": N,
             "kept_one": bool}.
lib_rename_footprint tool
Rename a footprint in a PCB library (.PcbLib).

        Renames the footprint whose name is footprint_name to new_name.
        Errors if footprint_name is not found or new_name already exists in
        the library.

        MARKS the .PcbLib dirty; it does not write. Call `app_save_all` to
        flush, and check what it reports actually reached disk.

        Args:
            footprint_name: the current footprint name.
            new_name: the new footprint name.
            library_path: optional .PcbLib path; defaults to the focused lib.

        Returns:
            {"success": true, "footprint": "...", "new_name": "..."}.
lib_set_footprint_description tool
Set the Description of a footprint in a PCB library (.PcbLib).

        The footprint twin of lib_set_component_description. The text is
        read back; ``success`` is false when Altium holds something else.
        Marks the library modified; app_save_document writes it.

        Args:
            footprint_name: The footprint.
            description: The new text; "" clears it.
            library_path: Optional .PcbLib path; defaults to the focused one.

        Returns:
            ``success``, ``footprint``, ``was`` and ``description`` (as read
            back).
lib_probe_footprint tool
Read-only dump of a PcbLib footprint's name-bearing fields.

        Finds where an old name persists after a rename: every text
        primitive with its object_id, plus name, description, height and
        primitive count.

        Args:
            footprint_name: the footprint name.
            library_path: optional .PcbLib path; defaults to the focused lib.

        Returns:
            {"success": true, "footprint": "...", "description": "...",
             "height_mils": N, "primitive_count": N,
             "texts": [{"object_id": N, "text": "..."}]}.
lib_get_pad_geometry tool
Pad geometry of one PcbLib footprint as floats in mm, relative
        to the footprint origin (no integer-mil rounding, for datasheet
        tolerance checks).

        Args:
            footprint_name: the footprint name in the library.
            library_path: optional .PcbLib path; defaults to the
                focused library.
            compact: pads as ``[name, x_mm, y_mm]`` rows only (a
                thousand-ball BGA in a short reply).

        Returns:
            {name, description, library_path, pad_count, pads: [{
             name, id, x_mm, y_mm, copper_x_mm, copper_y_mm, w_mm, h_mm,
             shape, corner_pct, rotation, hole_rotation, hole_mm,
             hole_w_mm, hole_type, slot_aligned (slots only), plated,
             layer, selected, mode, paste_expansion_mm,
             paste_expansion_source, paste_expansion_state,
             mask_expansion_mm, mask_bottom_expansion_mm, mask_separate,
             mask_expansion_source, mask_expansion_state}]}.
            selected is whether the pad is selected in the editor (what
            lib_set_pad_properties selected=True acts on); mode is the
            stack mode, 0 simple, 1 top-middle-bottom, 2 full stack.
            id names the pad for lib_set_pad_properties (stable while the
            library is open). x/y is the pad origin, copper_x/y the copper centre (differs
            on a custom pad). hole_rotation is relative to the pad.
            mask_expansion_mm is the top side when mask_separate, else
            both; mask_bottom_expansion_mm is the stored bottom value.
            *_source is 'manual' (pad override) or 'rule' (value 0; the
            rule holds it); *_state is the cache's manual/valid/invalid.
lib_set_pad_properties tool
Change existing pads in a PcbLib footprint, only the fields
        given, each read back. Pick pads by ``pad_name`` (every pad of
        that name), ``selected=True`` (the editor's selection) or ``id``
        (from ``lib_get_pad_geometry``).

        Many pads, different values: ``items``, one dict per pad. Items
        that all carry ``id`` are ONE walk, every item checked first and
        one bad item refusing the call, so a renumbering (3 -> 5,
        5 -> 7) needs no temporary names (about 6 s for 200 pads). Many
        pads, ONE value: select them with ONE broad set in
        ``lib_select_footprint_primitives``, then ``selected=True``.

        A written expansion is made manual (Altium ignores it otherwise);
        ``mask_manual`` / ``paste_manual`` False hands it back to the
        rule. On a per-layer stack ``x_size`` / ``y_size`` are the top
        size (``note``). Undo takes back one pad at a time.

        Args:
            footprint_name: The footprint holding the pad.
            pad_name: The designator; names need not be unique, so
                ``selected`` or ``id`` say which.
            selected: The pads selected in the editor.
            id: The pad's id (stable while the library is open).
            x_mm, y_mm: With ``id``, the position the read gave; a pad
                moved since refuses the call.
            library_path: .PcbLib path; default the focused library.
            units: "mil" (default) or "mm", for every length.
            x_size, y_size: Copper size (top size on a stacked pad).
            bottom_x_size, bottom_y_size: Bottom size; makes the pad
                top-middle-bottom.
            shape: "round", "rectangular", "octagonal" or "roundrect".
            corner_radius_pct: Roundrect corner, 0 to 100 % of half the
                shorter side; 25 when roundrect and not given.
            stack_mode: "simple" or "top-middle-bottom", written first.
            rotation: Degrees.
            hole_type: "round", "square" or "slot", written before the
                hole sizes.
            hole_size: Diameter, 0 for surface mount.
            hole_width: Slot length; makes a slot.
            hole_rotation: Slot rotation relative to the pad.
            plated: Whether the hole is plated.
            paste_expansion, mask_expansion: Expansions (mask: both
                sides unless ``mask_bottom_expansion`` is given).
            mask_bottom_expansion: Bottom mask; unlinks the sides.
            paste_manual, mask_manual: True keeps the value written,
                False hands it to the rule.
            mask_separate: Unlink (True) or link the mask sides.
            mask_from_hole_edge: Measure the mask from the drill edge.
            paste_top_enabled: The top paste opening on or off; holds
                only on a manual paste expansion (made manual first).
                Not before Altium Designer 25.
            x, y: Move the pad from the footprint origin; one pad only.
            new_name: Renumber the pad.
            clear_name: True leaves the pad without a name: a pad the part
                does not use (an unused ball of a standard BGA), which
                lib_link_footprint leaves out of its pin and pad check.

        Returns:
            ``pads_changed``, ``pads_with_a_failed_write``, ``note`` and
            ``pads`` as read back (sizes, shape, corner, stack, rotation,
            hole, plating, expansions and their state, flags,
            ``all_writes_ran``); by id also ``rows`` and ``repeats``.
lib_set_pad_geometry tool
Change many pads of one PcbLib footprint in ONE call.

        Each row names its pad by ``id`` (from ``lib_get_pad_geometry``)
        and carries the fields to write, under the names
        ``lib_set_pad_properties`` uses: x_size, y_size, bottom_x_size,
        bottom_y_size, shape, corner_radius_pct, stack_mode, rotation,
        hole_type, hole_size, hole_width, hole_rotation, plated,
        paste_expansion, paste_manual, mask_expansion,
        mask_bottom_expansion, mask_separate, mask_manual,
        mask_from_hole_edge, paste_top_enabled, x, y (a move, from the
        footprint origin), new_name and clear_name (True: no name). ``x_mm`` / ``y_mm`` as the read
        gave them (``x_mils`` / ``y_mils`` in a mil session) guard a row: a
        pad that has moved refuses the call.
        Every row is checked before anything is written. Pads are
        matched by id, never by name, so renumbering (3 -> 5, 5 -> 7)
        needs no temporary names. About 6 s for 200 pads. The same
        writer runs for ``lib_set_pad_properties`` given ``items`` that
        carry ``id``. In a library Undo takes back one pad at a time.

        Args:
            footprint_name: The footprint holding the pads.
            rows: One dict per pad: ``id`` (required), optional
                ``x_mm`` / ``y_mm`` guard, then the fields to change.
            library_path: Optional .PcbLib path; defaults to the
                focused library.
            units: "mil" (default) or "mm", for every length in rows.

        Returns:
            ``rows``, ``pads_changed``, ``pads_with_a_failed_write``,
            ``repeats`` (pads the walk handed out twice, expected 0),
            ``note``, and ``pads`` as read back, each with its ``id``.
lib_get_footprint_primitives tool
Every non-pad primitive of one PcbLib footprint, with where it is.

        Tracks, arcs, regions, fills, texts and vias, each with its layer
        (the name the library's stack gives it, plus ``layer_id``), in mm
        from the footprint's origin: the frame the ``lib_add_footprint_*``
        writers take. Pads are in ``lib_get_pad_geometry``. Read-only.

        Args:
            footprint_name: The footprint name in the library.
            library_path: Optional .PcbLib path; defaults to the focused
                library.
            kinds: Optional ``|`` list of what to read, from track, arc,
                region, fill, text, via and body (``"via|body"``); empty
                reads all. Each kind is its own filtered walk.

        Every primitive carries ``selected``. Each via also carries its
        mask (top, bottom, separate, ``mask_expansion_source`` manual or
        rule, ``mask_from_hole_edge``), tenting, the four testpoint flags
        (read only), ``stack_mode`` and its top / mid / bottom diameters;
        each body its outline box (x1, y1, x2, y2).

        Returns:
            {name, library_path, height_mm, editor_origin_x_mm /
            editor_origin_y_mm (the editor's origin marker in this
            footprint's frame; null unless the footprint is the current
            one, as only that one's marker can be read), current (whether
            it is), kinds, bodies (a count),
            body_layers (the layer of each body), body_models [{layer,
            identifier, has_model, model_file (the file the model was
            embedded from), model_type (Altium's T3DModelType; 1 for a
            STEP model), step_solids (solids in that file when it is
            still there, else null: a STEP model is ONE body whatever its
            detail, so read this, not ``bodies``), rotation,
            overall_height_mm, standoff_mm}], tracks
            [{layer, layer_id, x1, y1, x2, y2, width}], arcs [{layer,
            layer_id, xc, yc, r, start, end, width}], regions and fills
            [{layer, layer_id, x1, y1, x2, y2, area and arc_edges
            (regions)}], texts
            [{text, layer, layer_id, x, y, size, rotation, x1, y1, x2,
            y2}], vias [{x, y, diameter, hole}]}. Tracks, arcs, regions
            and fills also carry keepout, and keepout_for where the
            restrictions act (a keepout, or KeepOutLayer). A text's box
            is Altium's cached one and can lag an edit made this session.
lib_select_footprint_primitives tool
Select primitives of one PcbLib footprint in the editor, for an
        editor command that acts on the selection (obj_run_process with
        PCB:CustomPadShape to merge a pad and a region into a custom pad,
        or ``lib_set_pad_properties(selected=True)``). obj_select acts on a
        board, not a footprint. To delete, ``lib_delete_footprint_primitives``
        is far quicker than a selection and PCB:Clear.

        Several sets select together in one call; with ``clear=False`` a
        later call adds to the selection. Every object is checked against
        every set, so use ONE broad set (object_type + layer) for many
        objects: a set per pad name costs more than writing each pad. Pad names are not unique (an
        SMD "12" and a thru-hole "12" can share a footprint), so narrow by
        layer or box and check the reply before running the command.

        Args:
            footprint_name: The footprint, made current if it is not.
            objects: One or more filter sets; an object matching ANY set is
                selected. Each set has any of ``object_type`` ("pad",
                "region", "track", ...), ``layer`` ("TopLayer",
                "MultiLayer", ...), ``name`` (a pad's designator or a
                region's Name), ``box`` ([x1, y1, x2, y2] from the
                footprint origin, the box lib_get_footprint_primitives
                gives a region, fill or text; matched within 0.001 mm)
                and ``identifier`` (3D bodies whose Identifier starts with
                it, as lib_get_footprint_primitives reports in
                ``body_models``).
            clear: Deselect everything else first (default True).

        Returns:
            {selected (how many matched), layers (theirs), selected_total
            (everything the editor now holds selected)}
lib_extract_embedded_models tool
Get back the ORIGINAL 3D model files (STEP) embedded in a .PcbLib.

        Byte for byte, as Altium exports them: each footprint is exported
        by Altium (its own JSON export, unsaved edits included) and the
        model files it carries are written out. The library is not saved.

        With ``footprint_name``, that footprint's models; with
        ``model_names``, only those; otherwise every footprint's.

        Args:
            library_path: The .PcbLib.
            footprint_name: Extract only this footprint's models.
            model_names: Model file names, e.g. ["NE555DR.stp"].
            out_dir: Folder to write to (default: the workspace's
                models/<library name>).
            overwrite: Replace files already there.

        Returns:
            ``written`` [{name, footprint, path, bytes, sha256, checksum,
            step_header, rotation_deg}], ``refused`` [{name, reason}],
            ``not_found`` (asked for, used by no footprint exported).
lib_render_footprint tool
Draw a footprint as it is in its library, to look at.

        Read live (pads, every primitive, the library's layer kinds) and
        drawn the way ``footprint_render_package`` draws a planned one:
        copper with pad numbers and holes, paste, silkscreen, assembly
        dashed blue, courtyard magenta, anything else dashed grey. Which
        layer is the courtyard comes from Altium's layer KIND; a library
        whose layers have no kind set needs ``courtyard_layer`` /
        ``assembly_layer`` (e.g. "Mechanical15").

        Args:
            footprint_name: the footprint in the library.
            library_path: the .PcbLib; empty = the focused library.
            path: SVG to write; default <workspace>/renders/<name>_live.svg.
            png: also write a PNG beside it when a headless browser is
                installed.
            courtyard_layer / assembly_layer: layer names to use when the
                layer kinds do not say.

        Returns:
            {ok, svg_path, png_path, pads, roles (per role: count and
            extent in mm), height_mm, silk_over_copper (silkscreen lines
            that touch a pad, by pad), notes}.
lib_compare_footprints tool
What differs between two footprints, pad by pad and layer by layer.

        Both read live, from one library or two (a vendor's footprint
        against yours, an old revision against the new). Pads are matched
        by number: position, size, shape, corner radius, rotation, hole,
        plating, paste and mask expansion are compared. Silkscreen,
        assembly, courtyard and the other layers are compared by count and
        extent. ``same`` is true only when nothing differs over the
        tolerance.

        Args:
            footprint_a / footprint_b: footprint names.
            library_a / library_b: their .PcbLib files; empty = focused
                library (library_b defaults to library_a).
            tolerance_mm: smallest difference reported.
            courtyard_layer / assembly_layer: layer names to use when the
                layer kinds do not say.
lib_build_integrated_library tool
Package libraries into a LibPkg and compile it to an IntLib.

        Through Altium, end to end: the .LibPkg is created when it does
        not exist, each source library (.SchLib, .PcbLib, ...) is added to
        it, and the package is compiled. The IntLib Altium writes to
        "Project Outputs for <package>" is then looked for, and
        ``built`` is true only when a NEW file is there, so a compile
        that produced nothing is not reported as done. ``install`` adds
        the IntLib to the installed libraries.

        Args:
            package_path: the .LibPkg to create or update (full path).
            source_libraries: full paths of the libraries to package.
            install: install the compiled IntLib.
lib_audit_footprint_vs_datasheet tool
Audit a footprint against the manufacturer's land pattern.

        Compares the live pads (count, position, size, shape, drill,
        numbering, thermal pad and its paste) with a spec transcribed
        from the manufacturer datasheet fetched in this conversation and
        cited in ``spec.source``. Origin and 90-degree rotation are
        aligned out; a mirrored pattern is reported, not compensated.

        The spec (JSON object or string):
          source: {datasheet_url, reference, part_number}   REQUIRED
          pads: [{name, x, y, w, h, shape?, hole?}]         explicit, mm
          dual_row: {count, pitch, span, pad_w, pad_h, shape?}
          quad: {count, pitch, span_x, span_y, pad_w, pad_h, shape?}
          thermal_pad: {name, x, y, w, h, shape?}
          thermal_paste: 'full' | 'windowed'
          position_tol / size_tol: mm, default 0.05

        dual_row numbers like SOIC and quad like QFN (pin 1 top-left,
        CCW); otherwise give ``pads``. pad_w runs ACROSS the row in
        dual_row but ALONG it in quad. span / span_x / span_y are pad
        CENTRE to pad CENTRE (C on a vendor land pattern), never the
        outer extent Z or the package's lead span.

        Whatever the spec says, pads of different names whose copper
        overlaps are an error and a gap under 0.1 mm a warning
        (check ``pad_clearance``): a footprint that faithfully matches a
        misread spec still shorts.

        Returns:
            {ok, rotation_applied_deg, findings: [{check, severity,
             message, pad?, expected?, actual?}]} plus the footprint
            geometry under 'footprint' for reference. ok is true only
            with zero error-severity findings.
lib_audit_footprint_vs_package tool
Audit an existing PcbLib footprint against its package drawing.

        Takes the PackageSpec (as lib_create_footprint_from_package does).
        Reads only. Checks pad count, numbering and pin 1 (names a
        mirror-image footprint), pitch, lands against IPC-7351B within
        vendor tolerances, holes, exposed-pad paste, solder mask, origin,
        courtyard, silkscreen, assembly outline and height. Unread items
        are in ``not_examined``. Run footprint_check_package on the
        package first.

        Args:
            footprint_name: the footprint in the library.
            package: the PackageSpec as an object or JSON text.
            density: L, N or M, the IPC pattern compared against.
            library_path: optional .PcbLib path; default the focused one.
            assembly_layer, courtyard_layer: the mechanical layers for
                those roles; empty picks them by the library's layer kind
                ("Assembly Top" / "Courtyard Top"), then by name.

        Returns:
            ``{ok, errors, warnings, findings: [{check, severity, message,
            pad?, expected?, actual?}], examined, not_examined, alignment,
            metrics, notes, package_check}``. ``ok`` is true with no
            error-severity finding.
lib_easyeda_search tool
Search LCSC / EasyEDA for parts by MPN or description.

        EXPECT THIS TO FAIL: the service's search routes do not answer.
        Search LCSC in a browser and import by id instead
        (lib_easyeda_import(lcsc_id="C1234", ...)). EASYEDA_API_BASE
        overrides the endpoint.

        Args:
            query: MPN, keyword, or description fragment.
            limit: max candidates (default 20).

        Returns:
            {"ok": true, "count": N, "results": [{lcsc_id, mpn,
             manufacturer, package, description}]}.
lib_kicad_import tool
Convert a KiCad .kicad_sym / .kicad_mod into an Altium plan.

        target="altium" returns an ORDERED PLAN of this server's library
        tools, like lib_easyeda_import; nothing is written until you run
        the steps. target="inspect" only parses. A multi-unit symbol
        becomes one Altium multi-part symbol; hidden pins stay hidden;
        derived symbols take their parent's geometry. Audit a converted
        footprint with ``lib_audit_footprint_vs_datasheet`` before
        trusting it.

        Args:
            symbol_path, footprint_path: the KiCad files; give either or
                both.
            symbol_name: one symbol of a multi-symbol library; default
                the first.
            target: "altium" (default) or "inspect".
            schlib_path, pcblib_path: destination libraries, required
                for target="altium".
            include_body_art: also draw the symbol body; False gives
                pins only.
            unit: convert only this sub-part (0 = all).
            model_3d_path: a resolved 3D model file to link (for example
                from part_fetch).

        Returns:
            ``{"ok": ..., "component": {...}, "warnings": [...]}`` plus
            "steps"/"summary" for target="altium".
lib_easyeda_import tool
Convert an EasyEDA / LCSC part to KiCad files or an Altium plan
        (own converter, from EasyEDA's published format).

        Args:
            lcsc_id: fetch online, e.g. "C7420".
            payload_path: or read a saved component JSON (offline).
            target: "inspect" parses only (use first on an unfamiliar
                part); "kicad" writes ``.kicad_sym`` and ``.kicad_mod``
                into ``output_dir``; "altium" returns an ordered plan of
                this server's lib_* tools that recreates the part in
                ``schlib_path`` / ``pcblib_path``. Nothing is written to
                Altium; review the plan, then run the steps
                (tool_invoke).
            schlib_path, pcblib_path: required for target="altium".
            output_dir: required for target="kicad".
            symbol_name, footprint_name: override the part's own names.
            include_body_art: also draw the symbol body; False gives
                pins only.
            fetch_3d: kicad only; fetch the 3D model as a ``.wrl`` the
                footprint references (Altium needs STEP, not VRML).

        An imported footprint is a vendor drawing, not ground truth:
        audit it with ``lib_audit_footprint_vs_datasheet``. Polygon pads
        and slotted holes are reported in ``warnings``.

        Returns:
            {"ok": ..., "component": {...}, "warnings": [...]} plus
            "files" (kicad) or "steps"/"summary" (altium).
lib_clear_source_library tool
Unpin a SchLib's symbols from their source-library provenance.

        Symbols copied from another library keep pointing at it, and
        placements land in <Not Found>. This clears SourceLibraryName,
        sets TargetFileName to '*' and DesignItemId to LibReference.
        Save with app_save_all.

        Args:
            library_path: absolute .SchLib path; empty = focused library.
            component_names: restrict to these LibReferences; None/empty
                = every component in the library.
            clear_target_file_name: reset TargetFileName to '*'.
            sync_design_item_id: set DesignItemId = LibReference where
                they differ.

        Returns:
            {"library_path": ..., "total": inspected,
             "cleared_source_library": n, "cleared_target_file_name": n,
             "synced_design_item_id": n}.
lib_normalize_implementations tool
Clean up every component's models in a SchLib for a self-contained package.

        Per component: clears SourceLibraryName and TargetFileName; keeps
        ONE model per (type, name) in place, with its parameters, pin map
        and datafile link; applies ``rename_map``; and repairs footprints
        with no datafile link. Nothing is rebuilt, so nothing is lost.
        When renaming footprints, run lib_rename_footprint on the PcbLib
        first and pass the same map here.

        Args:
            library_path: optional .SchLib path; defaults to the focused lib.
            rename_map: optional {old_model_name: new_model_name} applied to
                the kept model's name and matching datafile entity.
            dedupe_only: skip renames; only collapse duplicates + clear source.
            source_library: optional; written into every PCBLIB model's
                datafile Location so footprints embed on compile (never
                blanked). Copy it from a known-good model (see
                lib_set_model_source).
            use_component_library: optional; sets the embed-vs-search flag on
                the models whose Location is written.

        Returns:
            {"success": true, "components_touched": N, "duplicates_removed": N,
             "sources_cleared": N, "links_repaired": N, "sources_set": N}.
lib_inspect_cse_zip tool
Identify the library members of a Component Search Engine zip.

        Reads a SamacSys / Component Search Engine zip WITHOUT extracting:
        which member is the .SchLib, the .PcbLib and the STEP model, the
        MPN, and any member attempting path traversal (``suspicious``).
        Then stage the files with ``lib_extract_cse_zip``. Offline.

        Args:
            zip_path: Absolute path to the downloaded zip.

        Returns:
            ``{"ok": True, "mpn", "schlib", "pcblib", "step", "extras",
            "suspicious"}`` (member names; None when absent) or
            ``{"ok": False, "reason": "..."}`` when the file is missing,
            not a zip, or contains no .SchLib/.PcbLib.
lib_extract_cse_zip tool
Extract a Component Search Engine zip and build its install plan.

        Writes the .SchLib, .PcbLib and STEP into ``dest_dir`` and returns
        an ordered ``install_plan`` of ``lib_install_library`` /
        ``lib_link_footprint`` / ``lib_link_3d_model`` calls; run them in
        order. A member with an absolute path, drive letter or ``..``
        rejects the WHOLE archive before anything is written.

        Args:
            zip_path: Absolute path to the downloaded zip.
            dest_dir: Where to stage the files. Default:
                ``<workspace>/cse_imports/<zip stem>``.

        Returns:
            ``{"ok": True, "mpn", "files": [abs paths], "extracted":
            {"schlib"/"pcblib"/"step": abs path or None}, "install_plan":
            [{"tool", "params"}]}`` or ``{"ok": False, "reason": "..."}``.
design_live_view tool
Open the live layout view and return its URL.

        Makes sure the local dashboard is running (it usually is, started
        with the MCP server) and points at its Layout tab, which draws the
        board as the in-house placer and router change it: parts, pads,
        tracks per layer, vias, pours, blocks and planned lanes, with new
        and moved items glowing for 30 s and removed copper fading out.
        Next to it is the decision log, newest first, and a status line
        (routed n / N nets, k partly). Give the URL to the user so they can
        watch while you work. Reads files only; no bridge call.

        Args:
            open_browser: also open the URL in the default browser.

        Returns:
            ``{"url", "dashboard": "running"|"started"|"disabled"|"failed",
            "version", "board", "status"}``, plus ``"reason"`` when the
            dashboard is not up. ``version`` is 0 until a board has been
            published.
design_live_note tool
Log a decision to the live view, before acting on it.

        The Layout tab lists decisions newest first next to the board, so
        the user sees what is about to happen and why, and can stop it.
        Call this BEFORE the step it describes, one decision per call, in
        a sentence or two: what you will do and the reason (the datasheet
        figure, the rule, the measurement).

        Args:
            section: what the decision is about, a short label such as
                ``placement``, ``routing``, ``rules`` or a block's name.
            text: the decision and its reason.

        Returns:
            The logged entry ``{"seq", "time", "ts", "section", "text"}``,
            or ``{"error": ...}`` when ``text`` is empty.
design_live_snapshot tool
Publish a board to the live view as its next version.

        Placement and routing jobs publish on their own; use this for any
        other state: the live board (``expect_file``, a few seconds on a
        large board, and never done unasked because reading some boards
        has crashed Altium's scripting engine), a LayoutBoard JSON file,
        or the last board again with a note.

        Args:
            note: what this snapshot shows; also logged as a decision.
            board_json_path: a LayoutBoard JSON file.
            expect_file: full path of the focused board, to read it from
                Altium as it is now. The read refuses if another board is
                focused.
            (Neither: republish the board the last engine job, apply or
            snapshot in this server published.)

        Returns:
            ``{"version", "board", "status": {nets, routed, partly,
            not_started}, "changes": {added, moved, removed}, "seconds",
            "url"}``, or ``{"error": ...}``.
part_search tool
Search EVERY enabled part provider and merge the results.

        All providers count equally; hits are ordered by provider then
        part, which is NOT relevance. A provider that cannot answer says
        why ("unavailable" is not "no such part"). Each hit has a
        ``kind``: "library" gives geometry (symbol or footprint),
        "catalogue" gives identity (MPN, datasheet, stock) and no
        geometry. Remote providers need the internet; local ones still
        answer without it. An empty query lists the providers.

        DATASHEET DISCIPLINE: a hit is a lead. Blank ``provenance`` or
        ``license`` means unknown; audit an imported footprint with
        lib_audit_footprint_vs_datasheet before trusting it.

        Args:
            query: Substring of part name, manufacturer or keywords.
            limit_per_provider: Cap per provider.

        Returns:
            {"ok", "count", "providers": {name: status}, "hits",
            "by_mpn"} (the same part across providers; wildcard part
            numbers are not merged), or {"ok", "providers"} for an empty
            query.
part_fetch tool
Fetch one part's detail, by the ``ref`` a search returned.

        The ``ref`` is ``provider:part_id``; pass it through. A bare id
        with no ``provider`` and no known prefix is refused, never
        guessed; ``provider`` wins over a prefix.

        ``download_dir`` also writes the provider's library files there.
        A downloaded KiCad file in a newer format than the local KiCad
        reads comes back with a ``*_warning`` entry.

        Returns the provider's own detail plus a normalised summary
        (mpn, manufacturer, datasheet, provenance, license) where the
        provider supplies one, and ``files`` when a download was asked
        for.
pcb_get_nets tool
Get all unique net names from the active PCB board.

        Returns:
            Dictionary with "nets" array of net name strings and "count"
pcb_focus_board tool
Make a specific PCB the focused/current board.

        When several PcbDocs are open, the other PCB tools
        (`pcb_get_components`, `pcb_delete_object`, `pcb_delete_net`,
        `pcb_plan_placement`, `design_visual_review`, …) operate on the
        *focused* board, and `app_set_active_document` does NOT reliably set
        that for a PcbDoc. Call this first to point them all at the board
        you mean. (`pcb_place_components` already accepts `board_path`
        directly.)

        Args:
            board_path: Absolute path to the .PcbDoc to focus.

        Returns:
            Dict with ``focused`` and the resolved ``board`` file name.
pcb_set_view_configuration tool
Switch a board's view configuration, e.g. "Altium 3D Black".

        Sets the PCB Standard toolbar's view configuration combo (the one
        showing "Altium Standard 2D") through the interface, and reads it
        back, so a pick that did not take is reported.

        Args:
            name: The configuration as the combo lists it. Omit it to
                read the current one; a name not on the list is refused
                with the names that are.
            board_path: Focus this .PcbDoc first. Omit it to act on the
                board already in front.
pcb_delete_net tool
Delete nets from the active PCB.

        By default only empty nets go, e.g. strays left after deleting
        components. A net with connections is skipped unless
        ``force=True``, which orphans its pads and tracks.

        Args:
            nets: Specific net names to delete. Omit (or pass an empty
                list) to sweep ALL empty nets on the board.
            force: Also delete nets that still have connected primitives
                (orphans them). Default False.

        A net name with a comma is refused, since the list travels comma
        separated and ``VCC,GND`` would delete VCC and GND.

        Returns:
            Dict with ``deleted`` (count removed), ``skipped_connected``
            (count), and ``skipped_nets`` (names skipped because still
            connected). Or ``{"ok": False, "reason": ...}`` if a name
            contains a comma, in which case nothing is sent.
pcb_get_net_classes tool
Get all net classes on the active PCB, with the nets in each.

        Members are found by asking each class about every net, so on a
        big board ``members=False`` is quicker when only names are needed.

        Args:
            members: Read each class's nets (default). False returns the
                class names only.

        Returns:
            Dictionary with "net_classes" (each with name, super_class and,
            when members are read, "nets", "member_count" and
            "probe_errors"), "count" (built-in superclasses included),
            "user_class_count" (without them) and "members_read". A class with
            probe_errors above 0 may have more nets than listed.
pcb_create_net_class tool
Create a net class (or add nets to an existing one) on the active PCB.

        Args:
            name: Name for the net class (e.g., "PowerNets", "HighSpeed")
            nets: Net names to add, as a list or comma-separated
                  (e.g., "VCC,GND,3V3")

        Returns:
            Dictionary with class_name, class_created (bool), nets_added count
pcb_create_nets_from_list tool
Create net objects on the active PCB for names not already there.

        Part of the scripted netlist transfer (see pcb_build_from_project,
        which runs it). Names already on the board are counted, not
        duplicated.

        Args:
            nets: Net names to ensure exist (e.g. from the compiled
                netlist). Duplicates and empty strings are ignored.

        Returns:
            Dict with ``created`` and ``existing`` counts.
pcb_bind_pad_nets tool
Assign component pads to existing board nets, batch in ONE call.

        Part of the scripted netlist transfer (see pcb_build_from_project).
        Each binding sets the net of a placed part's pad, matched by name.
        The net must already exist; a binding to a missing net fails.

        Keep rows for the same designator adjacent; it is faster.

        Args:
            bindings: List of dicts, each with ``designator`` (e.g. "U1"),
                ``pin`` (pad name, e.g. "3" or "A1"), ``net``.

        Returns:
            Dict with ``bound`` / ``failed`` counts plus
            ``missing_components`` / ``missing_pads`` / ``missing_nets``
            name lists (each capped at 50 entries).
pcb_build_from_project tool
Build the PCB's net set and pad connectivity from the netlist.

        The scripted stand-in for the ECO's netlist transfer: creates the
        missing nets and binds every pad from the compiled netlist, in two
        calls. It does NOT place footprints: place parts with
        `pcb_place_components` first, then run this, then check with
        `proj_compare_sch_pcb`.

        Args:
            netlist_csv_path: Optional path to a tabular netlist CSV
                written by ``proj_export_netlist(net_format="tabular")``
                (``component,pin,pin_name,net`` rows). Empty (default) =
                pull the compiled netlist from the open project directly.

        Returns:
            Dict with ``components`` (distinct designators in the
            netlist), ``nets_created``, ``nets_existing``, ``pads_bound``,
            ``failed``, plus the ``missing_components`` /
            ``missing_pads`` / ``missing_nets`` lists from the bind step.
pcb_find_dominant_rule tool
Which rule Altium itself applies to an object, or a pair of objects.

        Altium's own resolution (scopes and priorities), the rule DRC and
        the router use, not a reading of the scope text. Use it to check a
        rule really reaches the copper it was written for.

        Args:
            object1: "U1" a part, "U1.3" pad 3 of U1, or "net:GND" a net.
            object2: A second object, for a rule between two objects
                (clearance, for example). Empty for a one-object rule.
            rule_name: Any rule of the kind wanted (pcb_get_design_rules
                lists them); its kind is used. Or give rule_kind.
            rule_kind: The rule kind number, as pcb_get_design_rules
                reports it.

        Returns:
            ``found`` and ``rule`` (``name``, ``kind``, ``priority``,
            ``enabled``, ``scope1``, ``scope2``, ``descriptor``).
pcb_measure_clearance tool
How far apart two board objects are, and whether that breaks a rule.

        The edge-to-edge distance Altium measures between the two
        (PrimPrimDistance), the clearance rule Altium itself applies to the
        pair (its own scope and priority resolution) and Altium's own check
        of that rule against the pair (ActualCheck): the same resolution and
        the same check the online DRC makes, for one pair, without a DRC run.

        Args:
            object1: "U1.3" pad 3 of U1, or "<type>:<filter>" for a free
                primitive in the generic filter grammar, e.g.
                "track:Layer=TopLayer|X1=100|Y1=200|X2=300|Y2=200" or
                "via:Net=GND|X=1200|Y=800". The filter must match exactly
                one object. Net=, Component=, X1/Y1 or BoundsLeft/
                BoundsBottom find it at once; X=/Y= alone check every
                object of the type (seconds on a busy board). A whole component ("U1") or a net ("net:GND") is
                refused: a distance needs one primitive.
            object2: The second object, in the same forms.

        Returns:
            ``distance_mils``, ``distance_mm``, ``touching`` (distance 0),
            ``rule`` (``name``, ``kind``, ``priority``, ``enabled``,
            ``scope1``, ``scope2``, ``descriptor``; null when no clearance
            rule applies), ``gap_mm`` (the rule's gap, null when unknown)
            and ``violation`` (false when no rule applies). With no rule,
            ``scoped_rule`` is the clearance rule whose two scopes take the
            pair anyway, with ``scoped_gap_mm``, ``net_scope_matches`` (false
            when its net scope leaves the pair out, as for two objects with
            no net on a different-nets rule) and ``below_scoped_gap``.
pcb_check_rule_scope tool
Whether a rule's scopes take in an object, or a pair of objects.

        Altium's own test of the rule's scope queries against the real
        objects, before priorities: the check that a rule written as
        InNet('VBUS') really matches the VBUS pads.

        Args:
            rule_name: The rule.
            object1: "U1", "U1.3" or "net:GND".
            object2: A second object, for a two-scope rule.

        Returns:
            ``scope1_includes_object1``, ``scope2_includes_object2``,
            ``applies`` (Altium's unary or binary scope check), ``unary``
            and the rule's summary.
pcb_clean_net tool
Run Altium's own clean-up on one net's routing.

        It splits tracks where others meet them and removes nothing.
        Reports the net's track, arc and via count before and after.
        There is no script undo.

        Args:
            net: The net name.

        Returns:
            ``routing_before`` and ``routing_after``.
pcb_get_drill_pairs tool
List the board's drill layer pairs.

        Returns:
            ``count`` and ``pairs``: ``index``, ``low_layer``,
            ``high_layer``, ``description``, ``backdrill``,
            ``plot_drill_drawing``, ``plot_drill_guide``.
pcb_set_drill_pair tool
Mark a drill pair as a backdrill, and choose whether its drill
        drawing and drill guide are plotted.

        Args:
            index: The pair, from pcb_get_drill_pairs.
            backdrill, plot_drill_drawing, plot_drill_guide: True or
                False; omit to leave as it is.

        Returns:
            ``pair``, read back after the write.
pcb_export_component_3d tool
Write a placed part's 3D model to a STEP file.

        The part's own bodies as placed on the board, through Altium.

        Args:
            designator: The part, e.g. "U3".
            out_path: Full path of the .step file.

        Returns:
            ``written`` (a new file is at out_path) and ``reported``
            (what Altium said).
pcb_get_xsignals tool
List the board's xSignals with their lengths.

        An xSignal is a signal path from pin to pin that may run through
        series parts (a resistor or an AC-coupling capacitor), so a bus
        can be length-matched across them.

        Returns:
            ``count`` and ``xsignals``: ``name``, ``length_mils``,
            ``routed_length_mils``, ``unrouted_length_mils``,
            ``node_count`` and ``items`` (the pins and parts it runs
            through, as Altium names them).
pcb_create_xsignals tool
Create xSignals between pins, through any series parts.

        Altium works out the paths between the pins given, the same as
        its Create xSignals command, and can put the new xSignals in an
        xSignal class for length-matching rules.

        Args:
            pins: At least two pins as "U1.3" (designator.pad).
            class_name: Optional xSignal class to put them in.

        Returns:
            ``count_before``, ``count_after``, ``created`` (the new
            xSignals, as pcb_get_xsignals lists them),
            ``class_assigned`` (every new xSignal read back as a member of
            the class) and ``not_in_class`` (the ones that were not).
pcb_find_same_package tool
Find placed parts that share a package, as Altium judges it.

        Useful before copying a layout between repeated channels: parts
        with the same package can take each other's placement.

        Args:
            designator: One part, to list the parts with its package.
                Empty lists every group of two or more.

        Returns:
            With a designator: ``footprint`` and ``same_package``.
            Without: ``groups`` (``footprint``, ``count``,
            ``designators``), ``group_count``, ``parts_examined`` and
            ``parts_without_hash``.
pcb_auto_position_text tool
Put parts' designator and comment back in Altium's automatic
        positions, or at a chosen anchor.

        With no position given, Altium re-places both texts at each
        part's current anchor (a part set to manual stays). Altium moves
        only text that is shown: a hidden designator or comment takes
        the anchor and keeps its place (``name_shown`` /
        ``comment_shown`` in the reply). Unlike pcb_autoplace_silkscreen,
        this does not look for clearance.

        Args:
            designators: The parts. ``None`` means every part.
            name_position, comment_position: One of manual, top_left,
                center_left, bottom_left, top_center, center,
                bottom_center, top_right, center_right, bottom_right
                (the part's own frame, so a rotated part turns them),
                or Altium's number 0 to 9.

        Returns:
            ``parts``, ``not_found`` and ``changed`` (each part's
            anchors, shown flags and text positions ``before`` and
            ``after``, the first 200).
pcb_delete_xsignals tool
Delete xSignals by name, or all of them.

        Args:
            names: xSignal names, as pcb_get_xsignals lists them (any case).
            all: Delete every xSignal on the board.

        Returns:
            ``count_before``, ``count_after`` and ``deleted`` (names).
pcb_add_drill_pair tool
Add a drill layer pair between two copper layers, for blind and
        buried vias.

        Args:
            low_layer, high_layer: Layer names as the board shows them
                ("Top Layer", "Mid-Layer 1", ...).

        Returns:
            ``count_before``, ``count_after`` and ``pairs`` (as
            pcb_get_drill_pairs lists them).
pcb_net_display tool
Read, or set, whether nets show their connection lines,
        whether loop removal applies to them, their net colour and
        whether they draw in it, and whether their jumpers show.

        ``color`` with ``use_net_color=True`` draws nets in your colour;
        ``from_project=True`` gives each net its project colour
        (proj_net_color) so board and schematic highlight alike.

        Args:
            nets: Net names; with from_project and no nets, every net on
                the board.
            show_connections: Show (True) or hide (False) their
                connection lines; omit to leave as they are.
            loop_removal: Loop removal on or off; omit to leave.
            use_net_color: Draw the net in its own net colour on the
                board; omit to leave.
            show_jumpers: Show the net's jumpers; omit to leave.
            color: "#RRGGBB" to give the nets this colour; empty to leave.
            from_project: Give each net its project colour and draw it in
                it; a net the project gives no colour is listed in
                ``no_project_color`` and left as it is.

        Returns:
            ``board``, ``project`` (with from_project), ``nets``
            (``connections_shown``, ``loop_removal``, ``use_net_color``,
            ``color`` as "#RRGGBB", ``jumpers_shown`` and
            ``in_differential_pair``, read back), ``no_project_color`` and
            ``not_found``.
pcb_set_grids tool
Read, or set, the active board's grids, in mils.

        Call with nothing to read. Every value set is read back, and any
        that did not take is listed in ``not_applied``. The grid for
        moving parts (``component_x`` / ``component_y``) is read only: it
        follows the snap grid. obj_set_grid is the schematic's grid.

        Args:
            snap_x: Snap grid across.
            snap_y: Snap grid up.
            track: Grid for routing tracks.
            via: Grid for placing vias.
            visible: The fine visible grid.
            visible_big: The coarse visible grid.
            dot_grid: Draw the visible grid as dots (True) or lines.
            visible_big_factor: The coarse visible grid as a multiple of
                the snap grid. The fine one's (``visible_factor``) is
                read only.
            snap_unit / visible_unit / visible_big_unit: "mm" or "mil",
                the unit each grid is shown and stepped in.

        Returns:
            ``snap_x``, ``snap_y``, ``component_x``, ``component_y``,
            ``track``, ``via``, ``visible``, ``visible_big``,
            ``visible_factor``, ``visible_big_factor``, ``snap_unit``,
            ``visible_unit``, ``visible_big_unit``, ``dot_grid`` and
            ``not_applied``.
pcb_view_options tool
Read, or set, how the board editor draws a board: net names
        and numbers on pads and vias, test points, single layer mode,
        special strings shown as their values, and net highlighting.

        These are Altium's own preferences and apply to every board. A
        board must be open. Call with nothing to read; every option set
        is read back.

        Args:
            show_pad_nets: Net names on pads.
            show_pad_numbers: Pad numbers on pads.
            show_via_nets: Net names on vias.
            show_test_points: Mark test points.
            single_layer_mode: Show only the current layer.
            show_special_strings: Show special strings as their values.
            highlight_in_net_color: Highlight a net in its own colour.
            highlight_full: Highlight with a solid fill.
            highlight_whole_net: Highlight every object of the net.
            show_component_reference_point: Mark each part's origin.
            plane_draw_mode: How internal planes are drawn (Altium's
                number: read the current one first).
            pad_types_display: How pad types are shown (Altium's number).
            from_tos_display: How connection lines are drawn (Altium's
                number).
            layer_name_display: How layer names are shown on the layer
                tabs (Altium's number).
            draft_track_threshold_mils: Tracks narrower than this are
                drawn in outline in draft mode.
            show_invisible_objects: Draw objects on hidden layers too.
            transparent_layers: Draw layers see-through.
            clean_redraw: Clear the view before each redraw.
            redraw_layer_on_toggle: Redraw when a layer is switched.
            text_as_box_below: Text smaller than this many pixels is
                drawn as a box.
            pad_net_font: Font of the net names and numbers drawn on pads
                and vias; pad_net_min_font_size the smallest size it is
                drawn at.
            pad_net_font_color / pad_net_font_background: Its colours.
            default_truetype_font: TrueType font new board text starts
                with.
            board_area_color, board_line_color, sheet_area_color,
                sheet_line_color: Colours of the board area and outline
                and of the sheet area and border.
                Colours are Altium's numbers: red + 256 * green +
                65536 * blue, 0 to 16777215.

        Returns:
            ``options`` (each option by these names), ``changed``,
            ``not_applied``, ``refused`` and ``unknown``.
pcb_edit_options tool
Read, or set, how the board editor behaves while editing.

        These are Altium's own preferences and apply to every board. A
        board must be open. Call with nothing to read; every option set
        is read back. ``undo_levels`` is read only.

        Args:
            rotation_step: Degrees per rotate (Space), 0 or more.
            protect_locked: Locked objects cannot be moved or deleted.
            select_only_visible: Selection takes visible objects only.
            click_clears_selection: A click on empty space clears the
                selection.
            double_click_runs_inspector: Double-click opens the
                Inspector instead of the properties.
            snap_to_centre: Objects are picked up by their centre.
            allow_duplicate_designators: Parts may share a designator.
            auto_pan: Pan the view when dragging to its edge.
            drag_mode: What follows a dragged track (Altium's number).
            component_move: What a moved part takes with it (Altium's
                number).
            confirm_delete / confirm_global_edit / confirm_drag /
                confirm_selection_memory_clear: Ask before a delete, a
                change to many objects, dragging a selection, or clearing
                a selection memory.
            shift_to_select: Objects are picked only with Shift held.
            global_edit_includes_arcs: A change to tracks takes arcs along.
            pick_nearest_component: A click picks the nearest component.
            defaults_permanent: Object defaults stay as set, not taken
                from the last object placed.
            check_board_on_load: Check a board's objects when it opens.
            netlist_remove_unconnected_parts /
                netlist_remove_unconnected_objects: A netlist load removes
                components the netlist leaves out, and copper on no net.
            netlist_check_footprints / netlist_check_comments: A netlist
                load checks footprints and comments.
            auto_pan_mode: How the view pans at its edge (Altium's
                number); auto_pan_step, auto_pan_big_step (Shift held)
                and auto_pan_speed its steps and speed.
            pour_redraw_threshold: Pours of more pieces than this are drawn
                as outlines while they are edited.
            online_drc: Altium's Online DRC preference (PCB Editor >
                General): every object placed or changed is checked as it
                goes. Switching it off speeds up bulk edits a lot; read it
                first and put it back afterwards.

        Returns:
            ``options`` (each option by these names), ``changed``,
            ``not_applied``, ``refused`` and ``unknown``.
pcb_paste_options tool
Read, or set, what the board editor keeps when pasting, and
        its paste array (Paste Special > Paste Array): how many
        instances, how designators step, and a line or circle of them.

        These are Altium's own preferences and apply to every board. A
        board must be open. Call with nothing to read; every option set
        is read back.

        Args:
            paste_same_net / paste_same_class / paste_same_layer /
                paste_same_designator: Pasted objects keep their net,
                classes, layer and designators.
            repeat_count: How many instances a paste array places.
            repeat_increment: How each instance's designator steps, e.g.
                "1".
            repeat_circular: Lay the instances on a circle instead of a
                line.
            repeat_angle: Degrees between instances on a circle.
            repeat_rotate: Turn each instance on a circle with it.
            repeat_x_mils / repeat_y_mils: Step between instances in a
                line; may be negative.

        Returns:
            ``options`` (each option by these names), ``changed``,
            ``not_applied``, ``refused`` and ``unknown``.
pcb_route_options tool
Read, or set, the board editor's routing preferences.

        These are Altium's own preferences and apply to every board. A
        board must be open. Call with nothing to read; every option set
        is read back.

        Args:
            route_mode: The interactive routing conflict mode (Altium's
                number: ignore, walkaround, push ...; read it first).
            plow_through_pours: Route through pours rather than around.
            auto_via: Add a via when the routing layer changes.
            shove_depth: How far placement may push other parts.
            lock_pre_routes: Keep existing routes when re-routing.
            delete_dead_ends: Remove track stubs left after a reroute.
            smart_track_ends: Track ends follow the connection they make.

        Returns:
            ``options`` (each option by these names), ``changed``,
            ``not_applied``, ``refused`` and ``unknown``.
pcb_grow_pour tool
Move a pour's outline out by a distance all round, or in with a
        negative distance, as Altium's own Grow does: to pull a pour back
        from the board edge or spread it to a new keepout.

        The copper is not repoured: call pcb_repour_polygons afterwards.

        Args:
            name: The pour's name (pcb_get_polygons lists them). It must
                belong to one pour only (AMBIGUOUS_NAME lists the
                candidates); give ``index`` too to pick one of them.
            distance_mils: How far to move the outline; negative shrinks.
            index: The pour's index, alone or with the name (the pour
                there must then carry it).

        Returns:
            ``name``, ``index``, ``distance_mils``, ``bounds_before`` and
            ``bounds_after`` (left, bottom, right, top in mils).
pcb_plane_connections tool
How pads and vias meet the internal planes.

        Per object: the connection the board's rules give it (relief,
        direct or none) with the relief and clearance values, the ruling
        rule names, ``manual_reliefs`` (a hand-edited thermal relief; the
        rule's values do not show one) and ``plane_contacts``: the planes
        the object really passes through, each with the plane's net (on
        a split plane, the region under the object) and ``joins`` (same net) -- an SMD pad has none, a hole spans every
        plane, a blind / buried via only the planes it reaches.

        Use it to check that a power pad or via joins its plane, and that
        a signal via only clears the planes it passes.

        Args:
            designator: One part's pads, e.g. "U1".
            pad: One pad name of that part; empty lists every pad.
            kind: Without a designator, "via" for the board's free vias or
                "pad" for its free pads.
            net: Only objects on this net.
            limit: Most objects reported (``truncated`` says when more
                matched; ``matched`` counts them all).

        Returns:
            ``plane_layers``, ``planes`` (layer, name, net), ``matched``,
            ``truncated`` and ``pads`` or ``vias``, each with ``net``,
            ``connection`` (``rule_style`` is Altium's number), the relief
            values in mils, ``rule``, ``clearance_rule``,
            ``manual_reliefs`` and ``plane_contacts``; free objects also
            carry ``x`` / ``y`` in mils from the board origin.
pcb_pad_relief tool
Read or set ONE pad's or free via's own thermal relief.

        This is the pad's Properties > Thermal Relief, not a design rule.
        With a PcbLib in front it acts on a footprint's pad or via instead
        (the current footprint, or ``footprint``), which carries the relief
        onto every board the footprint is placed on.
        With no value given it reads; with any value it writes the pad
        (SMD pads only) and reads it back. The pour shows a pad's own
        relief only where the polygon connect rule lets the pad decide;
        repour afterwards (pcb_repour_polygons).

        Args:
            designator: The part, e.g. "C12"; empty for a free pad.
            pad: The pad name, e.g. "1"; a free pad by name or by x / y.
            x: A free pad's centre in mils from the board origin (with y).
            y: See x.
            style: "rule" (drop the pad's own values), "relief", "direct"
                or "none" (no connection).
            spokes: Standard spokes, 2 or 4.
            width: Spoke (conductor) width in mils.
            gap: Air gap in mils.
            rotation: Standard spokes at 45 or 90 degrees.
            custom: False switches custom spokes off; set them with
                pcb_pad_relief_spokes.
            read_spokes: Also list the custom spoke points. Marks the
                board modified (one undo step): a spoke is added and
                removed first, as reading a list never made stops the
                script.
            kind: "via" for a free via, named by x / y. A simple via has
                one record for every layer; on a top-middle-bottom via the
                record reached is the MIDDLE one (every inner layer) --
                ``record_scope`` in the reply says which.
            layer: For a via or a thru-hole pad: which layer's spoke list
                and outline to read ("top" by default, "mid", "bottom" or a
                layer name). A thru-hole pad's record behaves like a via's
                (``mode`` / ``record_scope`` in the reply). On a simple
                stack ONE spoke list serves every layer (``spoke_scope``
                "all layers"); a top-middle-bottom stack has one each for
                top, inner and bottom, a full stack one per copper layer,
                planes included ("per layer").
            footprint: With a PcbLib in front: the footprint to act on
                (made current); empty = the current one. x / y are then
                mils from the library's origin.

        Returns:
            The pad (``x`` / ``y``, ``layer``, ``side``, ``pad_rotation``,
            ``shape``, ``net``), its relief (``defined`` rule / manual,
            ``style``, ``spokes``, ``width``, ``gap``, ``rotation``,
            ``custom``), ``manual_reliefs``, the relief ``outline``
            (segments: a line's start, or an arc's centre / radius /
            angles) and, when read, ``custom_spokes``.
pcb_pad_relief_spokes tool
Place ONE pad's or free via's custom relief spokes, by direction.

        Replaces the pad's custom spoke list and switches the pad to its
        own relief with custom spokes. Each spoke is resolved from the
        pad's relief outline, read in the same call; a spoke the outline
        cannot carry is refused with the reason and nothing is written.
        The pour shows the spokes only where the polygon connect rule
        lets the pad decide; repour afterwards.

        Args:
            spokes: A list (or comma-separated text) of: a side "N", "E",
                "S", "W", optionally with an offset from -1 to +1 along it
                ("N:+0.5"; + is east on N / S and north on E / W; 1 puts
                the spoke's edge at the end of the straight part); a
                corner "NE", "SE", "SW", "NW"; or an angle in degrees
                ("30"; 0 = east, counter-clockwise), the way for round
                pads and oblong ends.
            designator: The part, e.g. "C12"; empty for a free pad.
            pad: The pad name; a free pad by name or by x / y.
            x: A free pad's centre in mils from the board origin (with y).
            y: See x.
            frame: "pad" (the names turn with the pad) or "board" (north
                is the top of the screen).
            width: Spoke width in mils (also the offset limit's width).
            gap: Air gap in mils.
            dry_run: Only resolve where each spoke would go.
            kind: "via" for a free via, named by x / y.
            layer: For a via or a thru-hole pad: the layer whose spoke list is replaced
                ("top" by default, "mid" for every inner layer of a
                top-middle-bottom via, "bottom", or a layer name); the
                other layers keep theirs. Width and gap go to the via's
                record (see pcb_pad_relief ``record_scope``).
            footprint: With a PcbLib in front: the footprint whose pad or
                via is meant (see pcb_pad_relief).

        Returns:
            ``planned`` (per spoke: ``segment``, ``fraction`` and the
            board point ``x`` / ``y``) and, when written, the pad read
            back with ``custom_spokes``.
pcb_get_board_regions tool
Read the active board's rigid-flex setup: its board regions
        (index, name, layer stack, 3D lock and bend lines), the split
        lines that divide it, and the layer stacks with their copper
        layers and whether each is flex.

        Returns:
            ``regions`` (each with its ``bend_lines``: ``from``, ``to``
            in mils, ``radius_mils``, ``angle``, ``fold_index``),
            ``split_lines`` (by index) and ``layer_stacks``. A region is
            named in the other tools by its name or by "#<index>".
pcb_split_board tool
Divide the board into layer stack regions along a split line
        from (x1, y1) to (x2, y2), in mils from the board origin, as
        Board Planning Mode's Define Split Line does. Draw it across the
        board, past the outline at both ends.

        Both halves may come back with the same name: tell them apart by
        index and give each its own (pcb_set_board_region), then a layer
        stack (pcb_layer_stacks assign).

        Returns:
            The rigid-flex setup afterwards, with ``changed`` true when a
            split line was added.
pcb_remove_split_line tool
Remove a split line (its index from pcb_get_board_regions); the
        regions on either side join again.
pcb_add_bend_line tool
Add a bend line across a flex board region, from (x1, y1) to
        (x2, y2) in mils from the board origin, with its bend radius, bend
        angle in degrees and fold order (the order bends are folded in 3D).
        The region is named as pcb_get_board_regions lists it, or
        "#<index>". Altium stretches the line to the region's edges; a
        line that does not cross the region is refused.

        Returns:
            The rigid-flex setup afterwards, the new line in
            ``bend_lines``.
pcb_modify_bend_line tool
Change a bend line's radius, angle or fold order: the region it
        belongs to and its index there, as pcb_get_board_regions lists
        them. Read back in the region's ``bend_lines``.
pcb_delete_bend_line tool
Delete a bend line: the region it belongs to and its index there,
        as pcb_get_board_regions lists them.
pcb_set_board_region tool
Rename a board region, or lock it in 3D (folding the board then
        moves the other regions around it) or unlock it.

        Args:
            region: The region, by name or "#<index>" (pcb_get_board_regions).
            name: Its new name.
            locked_3d: Lock (True) or unlock (False).
pcb_layer_stacks tool
List or change the board's layer stacks for rigid-flex: each
        region uses one stack, and a flex region a stack with fewer
        copper layers.

        Args:
            action: list, create (name, flex), rename (stack, name),
                remove (stack), set_flex (stack, flex), enable_layer /
                disable_layer (stack, layer: a copper layer of the board),
                or assign (stack, region: give a board region this stack).
            stack: The stack to act on, by name.
            name: The new stack's name, or the new name.
            flex: Whether the stack is flex.
            layer: A copper layer name, e.g. "Top Layer".
            region: A board region's name.

        Returns:
            The rigid-flex setup afterwards (see pcb_get_board_regions).
pcb_gloss tool
Run Altium's Gloss (smooth and shorten the routing) or Retrace
        (re-run it at the current width and clearance rules) on the
        routing of the given nets, and report each net's track count and
        routed length before and after.

        Only these nets' tracks and arcs are touched: they are selected,
        the command runs on the selection, and the selection is cleared.
        Gloss can reshape copper routed by hand: check the result.

        Args:
            nets: Net names.
            mode: "gloss" or "retrace".

        Returns:
            ``mode``, ``selected`` and ``nets`` (``tracks_before`` /
            ``tracks_after``, ``length_before_mils`` /
            ``length_after_mils``).
pcb_physical_stack tool
Read the board's whole physical layer stack top down, as Altium's
        Layer Stack Manager shows it: copper, dielectric, solder mask,
        overlay and paste layers, each with its Z top, Z bottom and
        thickness in mils; a dielectric or mask layer also with its type
        (Altium's number), material, constant, loss tangent and stiffener
        flag. Also the stack style and the finished board thickness.

        Args:
            style: Set the stack style (Altium's number; read it first).

        Returns:
            ``style``, ``stacks_count``, ``total_thickness_mils`` and
            ``layers``. The layers are the master stack's; a rigid-flex
            board has one stack per kind of board region (``stacks_count``
            more than 1), each listed by pcb_layer_stack_manager.
pcb_layer_stack_manager tool
Read the Layer Stack Manager's own data for the open board.

        Nothing is written.

        pcb_physical_stack reads the board's layer objects (Z, thickness,
        material, constant). This reads the Layer Stack Manager's own data,
        which holds more: each layer's type (copper, core, prepreg,
        dielectric, solder_mask, overlay or other), material, thickness, dielectric
        constant, copper weight, and every named material / process
        property that has a value, such as glass construction, resin
        content, Tg, frequency, copper weight and process, or pullback;
        the drill pairs; the stack (symmetric, flex), via spans, drill
        spans and impedance profiles. The manager's provider is dropped
        first, so the read follows the board as it is now.

        Args:
            include_model: "" for none; "xml" adds the manager's model as
                its StackupDocument XML, "records" the same as |KEY=VALUE|
                records.
            compare: Also read pcb_physical_stack and report where the
                manager disagrees with the board's own stack
                (``out_of_step``). The manager keeps its own copy of the
                stack; once it has one, a script write to the board's
                stack (pcb_set_dielectric, pcb_modify_layer, a rebuild)
                does not reach it, and the manager goes on showing, and on
                its next apply writing back, the old values.
                pcb_sync_stack_manager brings it back in step.

        A rigid-flex board has one stack per kind of board region. The
        top-level layers and spans are the first stack's; with more than one
        stack, ``stacks`` gives every stack with its own layers and spans, and
        ``branches`` which stack each section of the board uses.

        Returns:
            ``layers`` (name, guid, type_id, type, material,
            thickness_mils, dielectric_constant, weight, enabled,
            properties), ``property_names``, ``drill_pairs`` (the board's
            own pairs: name, start_layer / stop_layer ids and their names,
            micro_via, back_drill, stacks), ``stacks`` (name, id, flex,
            region, layers, via_spans, drill_spans), ``branches``
            (name, sections: name, parent, stacks), ``stack`` (name, id,
            symmetric, flex),
            ``stacks_count``, ``stackup_type``, ``roughness_model``,
            ``via_spans`` (name, type, start_layer, stop_layer),
            ``drill_spans``, ``impedance_profiles`` (name, impedance_ohm)
            and, when asked, ``model``; with compare, ``out_of_step``
            (layer, field, board, stack_manager) and ``in_step``.
pcb_sync_stack_manager tool
Bring the Layer Stack Manager's own copy of the stack back in step
        with the board.

        Once a board carries the manager's copy, script writes to its stack
        (pcb_set_dielectric, pcb_modify_layer, a rebuild) do not reach it:
        the manager shows the old values and writes them back on its next
        apply, pcb_move_layer included. This writes the board's thickness,
        dielectric constant, material and core / prepreg type into the
        manager's model, loads it and applies it to the board, all through
        Altium; the board's own values do not change. A layer only one side
        has is refused: the manager's layers are added or removed in the
        Layer Stack Manager itself.

        Args:
            dry_run: Only list what would change (the default).

        Returns:
            ``in_step`` before, ``changes`` (layer, field, value) and, once
            run, ``in_step_after``, ``out_of_step_after``, ``symmetric`` and
            ``symmetric_after`` (Altium keeps a stack symmetric only when it
            is). Refused: ``layers_differ``.
pcb_make_layer_stack tool
Make the board's layer stack match a wanted one, copper and
        dielectrics, top to bottom.

        Copper first: outer layers renamed, inner ones kept where the wanted
        stack has the same kind in the same order (a plane keeps its pour),
        the rest dropped (refused when objects lie on them), new ones added
        as plain copper. Then each gap's dielectrics are trimmed to the
        wanted count and set. A dielectric cannot be added, so a gap with
        fewer than wanted is refused: plan one per gap.

        The board must be saved first. Any failure closes it unsaved and
        reopens it, which restores it. A run that matches also brings the
        Layer Stack Manager's own copy of the stack in step
        (``stack_manager``, as pcb_sync_stack_manager reports it); save
        afterwards.

        Args:
            layers: Top to bottom: ``{"kind": "copper", "name",
                "thickness_mils", "plane": false}`` or ``{"kind":
                "dielectric", "thickness_mils", "type": "core" | "prepreg",
                "constant", "loss_tangent", "material", "name"}``.
            dry_run: Only plan (the default).
            board_path: The .PcbDoc; it is brought to the front.

        Returns:
            ``wanted``, ``copper_edits`` (and ``dielectric_edits`` once run),
            ``mismatches`` (empty when the board reads as wanted), ``done``,
            ``stack_manager`` after a run that matches, and ``restored``
            after a failure.
pcb_set_dielectric tool
Set a dielectric or solder mask (coverlay) layer of the stack:
        its type (Altium's number), material, dielectric constant (Dk),
        loss tangent (Df), thickness and whether it is a stiffener. Each
        value is read back; any that did not take is in ``not_applied``.
        The Layer Stack Manager's own copy of the stack is then brought in
        step (``stack_manager``, as pcb_sync_stack_manager reports it).

        Args:
            layer: The layer's name as pcb_physical_stack lists it.
            rename_to: Its new name.
pcb_impedance_profile tool
Create, change or remove an impedance profile in the Layer Stack
        Manager. pcb_get_impedance_profiles reads them, with the width
        Altium's solver works out per layer; pcb_impedance_profile_layer
        sets a profile's limits on one layer.

        Args:
            action: create, set or remove.
            profile: The profile's name (the new one's, for create).
            name: A new name (set).
            target_ohms: The target impedance.
            tolerance: The tolerance, in percent.
            differential: A differential pair profile.
            coplanar: Coplanar (reference copper beside the trace).

        Returns:
            ``profiles_before``, ``profiles_after`` and ``not_applied``.
pcb_impedance_profile_layer tool
Read, or set, one impedance profile's settings on one layer:
        whether it applies there, the trace width (locked, or worked out by
        Altium within its limits), the pair gap and its limits, clearance
        to plane for coplanar work, and how the solder mask over the trace
        is modelled. Every value set is read back.

        Args:
            profile: The profile's name.
            layer: The copper layer's name.
            top_reference, bottom_reference: The layers the solver takes
                as the trace's return above and below it ("none" clears
                one), as on a stack whose ground is a poured signal layer.

        A layer the profile does not hold yet is added to it
        (``layer_added``); it starts disabled with no width until Altium's
        solver runs in the Layer Stack Manager.

        Returns:
            The layer's settings with ``calculated_ohms`` (a maximum of
            ``null`` is no limit), and ``not_applied``.
pcb_via_structures tool
How the board's vias are protected and drilled: each via's
        structure type and its features (the IPC-4761 tenting, plugging,
        filling and capping, each with side and material; Altium's numbers)
        and its back drilling (stub lengths and hole oversize). Vias that
        agree are counted together.

        Args:
            limit: The most distinct kinds listed.

        Returns:
            ``vias`` and ``structures`` (``vias``, ``structure_type``,
            ``features``, ``back_drilled``, ``top_stub_mils``,
            ``bottom_stub_mils``, ``oversize_mils``).
pcb_pours_at tool
Which pours on the active board have a point inside their
        outline, with each pour's net and layer: is this via inside the
        GND pour, which pours overlap here.

        The outline, not the poured copper: a point in a gap of a poured
        pour still counts.

        Args:
            x: X in mils, from the board origin.
            y: Y in mils, from the board origin. ``obj_query``,
                ``pcb_get_vias`` and ``pcb_get_copper`` give ABSOLUTE
                positions: subtract the board origin first.

        Returns:
            ``pours`` (``name``, ``net``, ``layer``), ``found`` and
            ``pours_examined``.
pcb_board_options tool
Read, or set, settings saved in the active board: the template
        new pours are named from, and (read only) whether split planes
        are made automatically.

        Args:
            polygon_name_template: Altium's number for the naming
                template (read the current one first). A pour with
                AutoGenerateName set takes its name from it.

        Returns:
            ``polygon_name_template``, ``automatic_split_planes``,
            ``changed`` and ``not_applied``.
pcb_gerber_options tool
Read, or set, the Gerber setup saved in the active board: the
        units and decimals, apertures, flashing, film size and border.

        Call with nothing to read; every option set is read back.
        proj_generate_fab_package writes the files.

        Args:
            units: Altium's number for the Gerber units (read it first).
            decimals: Altium's number for the coordinate format.
            sort_output: Sort the plot output.
            software_arcs: Write arcs as short straight segments.
            centre_on_film: Centre the plots on the film.
            embed_apertures: Write the apertures into each file (RS-274X).
            panelize: Plot the panel's layers.
            g54: Write G54 before each aperture change.
            relief_shapes_allowed: Allow relief apertures.
            flash_pads_only: Flash pad shapes only.
            flash_all_fills: Flash every fill.
            plus_tolerance_mils / minus_tolerance_mils: Aperture match
                tolerances.
            film_x_mils / film_y_mils: Film size.
            border_mils: Border around the plot.
            max_aperture_mils: Largest aperture.

        Returns:
            ``board``, ``options`` (by these names), ``changed``,
            ``not_applied``, ``refused`` and ``unknown``.
pcb_print_options tool
Read, or set, the print setup saved in the active board:
        scale, fit to page, corrections, holes and pad labels.

        Call with nothing to read; every option set is read back.
        proj_export_pdf prints.

        Args:
            scale: Print scale (1 is full size).
            scale_to_fit_page: Fit the board to the page instead.
            x_correction / y_correction: Scale corrections for the
                printer (1 is none).
            show_holes: Draw the holes.
            printer_fonts: Print text with the printer's fonts.
            software_arcs: Draw arcs as short straight segments.
            pad_nets: Print net names on pads.
            pad_numbers: Print pad numbers.
            border_mils: Border around the print.
            composite_type / batch_type: Altium's numbers for how layers
                are combined and split into pages (read them first).

        Returns:
            ``board``, ``options`` (by these names), ``changed``,
            ``not_applied``, ``refused`` and ``unknown``.
pcb_export_component_model tool
Write one placed part's 3D model, as it sits on the board, to
        a STEP file. No dialog.

        proj_export_step writes the whole board; lib_export_3d_model
        writes a model from a library footprint.

        Args:
            designator: The part, e.g. "U1".
            out_path: Full path of the .step file to write.

        Returns:
            ``saved`` (what Altium answered) and ``written`` (a file is
            at out_path that was not there before, or is newer).
pcb_get_design_rules tool
Get all design rules from the active PCB.

        Every rule kind. ``rule_kind`` is a raw enum ordinal that differs
        between builds; read ``descriptor``, which names the kind and its
        values. Clearance-family rules also carry ``gap_mm``; trust it
        over the descriptor for Board Outline Clearance, whose descriptor
        always says ``Gap=0mil``. That rule's per-object table cannot be
        read. ``from_schematic``
        is true for a rule defined by a directive or parameter on the
        schematic: the next update from the schematic rewrites it, so
        change it there.

        Returns:
            Dictionary with "rules" array (each with name, rule_kind,
            enabled, priority, scope_1, scope_2, comment, descriptor,
            from_schematic, and
            gap_mm for clearance, component, hole-to-hole and board
            outline clearance rules) and "count".
pcb_drc_rules tool
The design rules a DRC checks against, and the approved set.

        A DRC passes under whatever rules the board holds, so the rules
        themselves are approved: the approved sheet is kept beside the
        board (<board>.DrcRules.json), and every DRC compares against it
        and names each rule added, removed, loosened, re-scoped or switched
        off since. Rule edits made through the tools are logged beside it
        (<board>.DrcRules.log.jsonl).

        Args:
            action: "show" (the rule sheet, its fingerprint and its
                difference from the approved set), "changes" (only the
                difference and the logged edits), or "approve" (keep the
                current rules as the approved set). Approve only when the
                user has read the sheet and said to approve it; never to
                make a DRC pass.
            note: Kept with an approval: who approved it and why.

        Returns:
            ``board_path``, ``fingerprint``, ``approved`` with
            ``approved_at``, ``changes_since_approval`` (each with
            ``loosened``: true lets more through, null needs review),
            ``logged_changes``, and for show the ``sheet``.
pcb_set_rules_enabled tool
Bulk-toggle the DRC-enabled flag on design rules by name.

        For example, silence Silk-to-Silk while sweeping Clearance. It
        flips ``DRCEnabled`` (whether DRC checks the rule), not
        ``Enabled``.

        Args:
            names: Rule names to toggle. With ``match="name"`` (default)
                each entry is matched case-insensitively against
                ``Rule.Name``; a trailing ``*`` wildcards the suffix
                (``"Clearance*"``). With ``match="kind"`` each entry is
                a TRuleKind ordinal as a string (look up via
                ``pcb_get_design_rules``).
            enabled: New value for ``DRCEnabled``. True turns the rule
                ON in DRC; False disables it for this run.
            match: ``"name"`` (default) or ``"kind"``.

        Returns:
            Dict with:
              - ``matched``: rules that matched any pattern
              - ``updated``: how many actually changed value
              - ``enabled``: the requested target value (for confirmation)
              - ``items``: per-matched ``{name, kind, prev_enabled, new_enabled}``
pcb_get_clearance_violations tool
Read the violations ALREADY on the board, optionally filtered
        to one net. Does NOT run DRC.

        Reads the violation records the last DRC left; opens no dialog.
        ``violation_count: 0`` means none are STORED, not that the board
        passes: with no DRC run this session it is 0 either way (see
        ``note``). ``pcb_run_drc`` runs a fresh check, with no dialog.

        Each violation has ``x_mils``, ``y_mils``, ``layer`` and
        ``primitive1`` / ``primitive2`` ``{detail, type, net, layer,
        x_mils, y_mils}``.

        Args:
            net: Substring matched against each violation's description
                and name. Empty returns all.
            offset: How many matching violations to skip, for paging.
            limit: How many to return, 200 by default.

        Returns:
            ``violation_count`` (all matches), ``offset``, ``limit``,
            ``returned``, ``has_more`` (page on by ``returned``),
            ``drc_triggered``, ``note``, ``violations``.
pcb_run_drc tool
Run Design Rule Check on the active PCB, with no dialog.

        Altium's batch check of the rules ticked for batch checking, and
        the violations it leaves on the board. Nothing opens, the focus
        does not move, and the report goes to the bridge workspace.
        ``drc_confirmed`` is true only if this run wrote its report.

        Args:
            allow_modal: True runs the check through Altium's Design Rule
                Checker DIALOG instead, which blocks the bridge for every
                session until a person presses Run or Cancel. Only for
                someone at the keyboard who wants that dialog's options.
            detail: "full" (default) or "summary": no ``rules.sheet``
                (``sheet_omitted``; read it with pcb_drc_rules) and
                ``report_rules`` only with violations
                (``report_rules_checked`` counts all). Fingerprint,
                changes and verdict stay. For repeated runs.

        Returns:
            ``violation_count`` (all), ``mode`` ("batch" or "dialog"),
            ``drc_triggered``, ``drc_confirmed``, ``report_path`` and
            ``violations`` (first 100): name, description, rule, x_mils,
            y_mils, layer, and ``primitive1`` / ``primitive2`` {detail,
            type, net, layer, x_mils, y_mils} (primitive2 empty for
            single-object rules). ``reason`` when not confirmed.
            From the report Altium wrote: ``report_counts`` (warnings,
            rule_violations, waived_violations, kept apart),
            ``report_rules`` (every rule checked and its count; a rule
            not listed was not checked), ``report_rules_add_up`` and
            ``report_stopped_at_limit`` with ``report_violation_limit``
            (Altium stopped early, so the run is not complete).
            ``rules``: what the check ran under, ``sheet`` (every rule's
            values, scopes, priority, enabled and drc_enabled),
            ``fingerprint``, ``not_checked`` with why, pours set to ignore
            violations, and against the rules the user approved
            (pcb_drc_rules) ``changes_since_approval`` and the logged rule
            changes. ``verdict``: pass, pass_with_waivers,
            pass_under_changed_rules, pass_unapproved_rules, fail,
            incomplete, not_run; ``verdict_reason`` says why. Report the
            verdict, never only the violation count.
pcb_get_components tool
Get all components from the active PCB with position and properties.

        DATASHEET DISCIPLINE: The response carries a `_datasheet_guidance`
        block. Before drawing any conclusion about a listed part's
        electrical behavior, pin function, or voltage rating, fetch its
        manufacturer datasheet (use WebSearch + WebFetch if you don't
        already have it). Library metadata here is NOT authoritative.

        Returns:
            Dictionary with "components" array (each with designator, x, y,
            rotation, layer, footprint, bbox, and bbox_no_name_comment: the
            box without the part's designator and comment) and "count", plus
            `_datasheet_guidance` + `_datasheet_parts`.

            Two heights, in mils above the part's own side of the board,
            and neither is chosen for you: ``height_mils`` is the
            footprint's Height field as entered in the library, and
            ``model_height_mils`` the tallest 3D body (STEP or extruded;
            null without one). ``height_mismatch`` is true when they
            differ; ``body_count`` says how many bodies were read and
            ``step_body_count`` how many are STEP models. Either height
            can be wrong for a given part: check the datasheet when it
            matters. ``basic_3d_models`` names the footprints placed with
            only extruded, cylinder or sphere bodies when the Config tab
            does not allow basic 3D models: tell the user and ask before
            replacing any.

        Args:
            body_heights: ``max`` (default) gives the tallest body per
                part; ``all`` adds ``bodies``: identifier, kind (step,
                extruded, cylinder, sphere), layer, standoff_mils,
                overall_mils.
pcb_move_components tool
Move and/or rotate MANY PCB components in ONE IPC round-trip.

        One Altium transaction for the whole list.

        Args:
            moves: List of move dicts. Each dict supports:
                designator (required) , target component
                x        (optional)   , new X in mils
                y        (optional)   , new Y in mils
                rotation (optional)   , new rotation in degrees

            Example:
                [
                  {"designator": "U1", "x": 5000, "y": 5000, "rotation": 0},
                  {"designator": "R1", "x": 5200, "y": 4800},
                  {"designator": "C1", "rotation": 90},
                ]

        Returns:
            Dictionary with per-designator results and a count.
pcb_place_ring tool
Place parts evenly round a circle (or an arc of one), in order.

        For rings of LEDs, buttons or mounting features: the first part at
        ``start_angle`` (degrees, 0 = +X, 90 = +Y), the rest every
        ``span / n`` degrees (``span / (n - 1)`` for an arc short of a full
        turn, so both ends are used), clockwise by default. Each part
        faces the centre the same way (its rotation follows its angle plus
        ``rotation_offset``), unless ``rotation`` fixes one rotation for
        all. Placed with the exact batch placement of pcb_move_components
        (side, then turn, then origin) and read back.

        Args:
            designators: the parts, in ring order.
            center_x, center_y: the circle's centre, mils.
            radius: mils.
            start_angle: the first part's angle, degrees.
            clockwise: direction round the ring.
            span: degrees covered (360 for a full ring).
            rotation: one rotation for every part, instead of following
                the ring.
            rotation_offset: added to each part's angle when following
                the ring (0 turns a part's +X outward).
            side: "top" or "bottom" for every part; empty keeps each.

        Returns:
            The batch placement reply, plus ``positions`` [{designator, x,
            y, rotation}] as sent.
pcb_import_placement tool
Position components from a coordinate list (pick-and-place import).

        The inverse of `pcb_export_coordinates`. Each entry repositions a
        component already on the board, by designator. Absolute coordinates in
        mils, rotation in degrees; supplying `side`/`layer` flips the component
        to that side (a part already there is left alone).

        Applied in the order that gives an exact result: the side first, then
        the rotation, then the move. ``rotation`` is the FINAL rotation as
        Altium shows it, after any flip, and x/y are the component origin
        exactly, whatever the flip and the turn did to it (both move an
        asymmetric part). A part given only a side or a rotation keeps its
        origin. Every part is read back.

        A FLIP MIRRORS THE PART LEFT-RIGHT (seen from the top) about its
        origin, and Altium changes the rotation it reports: a part facing
        +Y in its library faces +Y on either side at the same rotation,
        one facing +X faces -X on the bottom. For a connector, read the
        pads back (pcb_get_component_pads) to confirm which way it faces.

        Args:
            placements: list of dicts, each supporting:
                designator (required)
                x        (optional) , X in mils
                y        (optional) , Y in mils
                rotation (optional) , degrees
                side     (optional) , "top" or "bottom"
                layer    (optional) , "TopLayer" / "BottomLayer" (overrides side)

        Returns:
            ``applied``, ``failed``, ``unknown_layers``, and ``mismatched``
            with ``mismatches`` (the first 20: designator, what is wrong,
            and the read-back x, y, rotation and layer).
pcb_add_teardrops tool
Add teardrops through Altium's Teardrops dialog.

        With Dialogs Automatic (Config tab) the tool sets Add, the scope
        and the options given, then OK; None keeps the dialog's value.
        Otherwise the dialog waits for the user. A repour can delete them.

        Args:
            scope: "all" or "selected".
            via_th_pads, smd_pads, tracks, t_junctions: Objects to treat.
            force: Place even where a rule is broken.
            adjust_size: Shrink one that would not fit.

        Returns:
            ``teardrops_before``, ``teardrops_after``, ``dialog``.
pcb_remove_teardrops tool
Remove teardrops, as pcb_add_teardrops with Remove.

        Args:
            scope: "all" or "selected".
pcb_autoplace_silkscreen tool
Move designators that break silk clearance to a clear position.

        A visible designator that is closer than the silk clearance to
        anything else on its overlay layer (component outlines, texts,
        fills), closer than the mask clearance to a pad's mask opening on
        its side, or off the board, is tried at a ring of auto-position
        anchors and left on the first that clears. A designator that is
        already clear is not touched, and one no anchor clears goes back
        where it was and is listed in ``unplaced_designators`` for a
        person. First-fit on bounding rectangles, so it errs towards
        "blocked"; run DRC after.

        Args:
            silk_clearance_mils: Silk to silk clearance. ``None`` reads the
                board's Silk To Silk rule.
            mask_clearance_mils: Silk to solder mask clearance. ``None``
                reads the board's Silk To Solder Mask rule.
            mask_expansion_mils: How far a pad's mask opening extends past
                its copper (default 4, Altium's default).
            designators: Only these components. ``None`` means all.
            rotations: Reading directions in board degrees, tried in
                order (``[0, 90]``: horizontal, else vertical). A
                designator at none of them is turned even when clear;
                each angle gets the whole anchor ring before the next.
                One that nothing clears keeps its own angle and place.
                Different parts, different directions: ``items``.

        Refused with NO_CLEARANCE, moving nothing, when a clearance is
        neither given nor readable from an enabled rule.

        Returns:
            ``placed``, ``turned`` (placed at a new angle),
            ``already_clear``, ``unplaced``, ``hidden``,
            ``total``, the placed and unplaced designators, and each
            clearance used with its source (``argument`` or the rule's
            name). ``skipped`` is ``unplaced + hidden``.
pcb_tune_length tool
Add approximate routed length to a net with a square serpentine.

        Lays a square meander on `net` at (x_mils, y_mils) sized to add about
        `add_length_mils`, then reports the net's routed length before and
        after.

        Open-loop and NOT DRC-checked: you choose where the meander goes and
        check clearance afterwards (`pcb_run_drc`). Finish in Altium's
        interactive tuner if needed; that one cannot be scripted.

        Args:
            net: net name.
            add_length_mils: target length to add (mils).
            x_mils, y_mils: anchor point of the meander (mils).
            layer: routing layer (default TopLayer).
            amplitude_mils: meander height; bump count = add_length / (2*amplitude).
            width_mils: track width.

        Returns:
            {"length_before_mils", "length_after_mils", "added_mils", "bumps",
             "drc_checked": false}.
pcb_panelize tool
Build a production panel on the CURRENT (blank) PCB document.

        Open a new empty .PcbDoc and run this on it. Creates an embedded-board
        array of `child_path`, a rectangular panel outline, corner tooling
        holes, and fiducials. Supply the source board size
        (`board_width_mils` / `board_height_mils`).

        Args:
            child_path: path to the source .PcbDoc to array.
            board_width_mils, board_height_mils: source board size (mils).
            rows, cols: array dimensions.
            col_gap_mils, row_gap_mils: spacing between adjacent boards.
            border_mils: rail width around the array (also half the tooling inset).
            tooling_holes, fiducials: whether to add them.

        Returns:
            {"panel_width_mils", "panel_height_mils", "rows", "cols",
             "tooling_holes", "fiducials"}.
pcb_delete_invalid_objects tool
Remove degenerate primitives from the active PCB.

        Deletes zero-length tracks and zero-area regions (board hygiene that
        accumulates from edits and imports). Returns the count removed.
        Free objects only: primitives of a placed component, a polygon pour
        or a dimension belong to their owner and are left alone (a
        zero-length track in a footprint is a round dot, often a pin-1
        mark).

        Returns:
            {"removed": N}.
pcb_audit_pad_center_connected tool
Find pads whose center has no copper entering it (acid-pad check).

        For every netted pad, checks that a track / arc / via on the same net
        reaches the pad centroid. A pad connected only at its edge (an "acid
        pad") can fail in fab. Read-only; reports offenders with designator,
        pad, net, and location.

        Returns:
            {"checked": N, "offenders": M, "items": [...]}.
pcb_auto_size_board_outline tool
Fit the board outline around the embedded-board array(s) plus a margin.

        Use after `pcb_panelize` (or any embedded-board layout) to size the
        panel outline to its content. Unions the embedded boards' extents, adds
        `margin_mils` on every side, and converts the result to the board
        outline.

        Args:
            margin_mils: border added on each side (default 100).

        Returns:
            {"width_mils", "height_mils"}.
pcb_normalize_vias tool
Set free vias to their Routing Via rule's sizes, or to given ones.

        Without ``size_mils``/``hole_mils``, each via takes its dominant
        Routing Via rule's preferred diameter and hole. A rule in template
        mode ("Templates Used To Check Via") is refused for its vias, since
        its size fields are not what it checks: use pcb_apply_via_template.
        Any target without an annular ring is refused.
        Refused vias are left as they were.

        Args:
            size_mils, hole_mils: An explicit diameter and hole, together.
            net: Only vias on this net.
            from_size_mils, from_hole_mils: Only vias at this size now
                (within 0.05 mil), e.g. to fix one group.
            dry_run: Report what would change and change nothing.

        Returns:
            ``changed``, ``unchanged``, ``failed`` (did not read back), the
            refusal counts, and ``before``/``after``: vias counted by
            "diameter/hole" in mils. ``success`` is false when any via was
            refused or failed.
pcb_apply_via_template tool
Make free vias match a source via: its via template, hole and diameter.

        Point at a via using the wanted template; every other free via, or
        those matching the filters, takes its template link, mode, hole
        and diameter, e.g. to meet a template-mode Routing Via rule
        (AD22+). Diameter and hole are read back, the link cannot be, so
        check one via in Properties. Larger vias can break clearance: run
        DRC.

        Args:
            source_x, source_y: A point on the source via, in mils.
            net: Only vias on this net.
            from_size_mils, from_hole_mils: Only vias at this size now.
            dry_run: Report what would change and change nothing.

        Returns:
            ``source`` (position, size, hole, net), ``changed``, ``failed``,
            ``before``/``after`` counted by "diameter/hole" in mils.
            Refused with LOCAL_STACK for a source with a per-layer stack
            and NO_ANNULAR_RING for a source without a ring.
pcb_copy_designators_to_mech tool
Copy each component designator onto a mechanical layer (assembly prep).

        Places a `.Designator` special-string text on `layer` over every
        component, for an assembly drawing that survives silkscreen edits.

        Args:
            layer: target mechanical layer (default Mechanical1).

        Returns:
            {"copied": N, "layer": "..."}.
pcb_resize_designators tool
Resize, turn and centre designators to fit their parts, for an
        assembly drawing.

        A stroke font centred on the part, along its longer side, the characters
        sharing that side but no taller than the part is wide, kept between
        ``smallest_mm`` and ``largest_mm``; the stroke is ``stroke_share`` of
        the height, at most ``stroke_cap_mm``. Bottom parts read mirrored;
        upright parts turn 90 degrees on the top and 270 on the bottom. The
        outline is the part without its designator and comment. Run it
        again after parts move.

        Args:
            designators: Only these parts; empty for every part.
            top_layer, bottom_layer: Layers to move the texts to, usually two
                mechanical layers of an assembly drawing ("Mechanical10",
                "Mechanical11"). Empty leaves each text on its layer.
            smallest_mm, largest_mm, stroke_share, stroke_cap_mm: The bounds.
            dry_run: True (default) only plans; False writes and reads back.
            board_path: The .PcbDoc; defaults to the focused board.

        Returns:
            ``plan`` per part (height, stroke, angle, mirrored, ``move_to``;
            ``limited_by_width`` and ``natural_mm`` where they apply),
            ``turned``, ``limited_by_width``; once written also ``held``,
            ``refused``, ``missing`` and ``wrong`` (part and what read back
            differently).
pcb_trim_extend_track tool
Trim or extend one track endpoint along the track's own slope.

        Finds the track endpoint nearest (from_x, from_y), then slides it to
        the perpendicular projection of (to_x, to_y) onto that track's line.
        The track stays collinear (no bend introduced) and the opposite end
        stays put, so this cleanly lengthens a track up to a target or pulls
        it back. All coordinates in mils.

        Args:
            from_x, from_y: Picks which endpoint moves (nearest one wins).
            to_x, to_y: Target the moving end is projected toward.
            tolerance_mils: How close (from_x, from_y) must be to a real
                endpoint (default 5).

        Returns:
            {"moved_end", "old_x", "old_y", "new_x", "new_y", "layer"}.
pcb_cleanup_tracks tool
Tidy stray track geometry: delete slivers and/or merge collinear runs.

        Modes:
        - "slivers" (default): delete every track shorter than
          min_length_mils. Catches the zero/near-zero stubs left behind by
          editing.
        - "merge": join two collinear, same-layer, same-width, same-net tracks
          that meet end to end into a single track. The merge only fires when
          the shared point is a clean degree-2 junction (exactly those two
          track ends, with no via, pad, arc, or third track present), so it is
          safe to run on routed copper without breaking connectivity.
        - "both": slivers pass, then merge pass.

        A straight chain of any number of tracks becomes one track. Free
        tracks on every layer are taken; a footprint's own, a pour's and a
        dimension's are not. The whole change is one edit in Altium.
        Stepped runs are pcb_tidy_tracks' work, not this tool's.

        Args:
            mode: "slivers", "merge", or "both" (default "slivers").
            min_length_mils: Sliver threshold (default 1).
            dry_run: Work the change out and match it to the board
                without writing it.

        Returns:
            {"slivers_deleted", "merged", "mode", "tracks" (looked at),
            "joints_kept" (straight joints left alone, by why: junction,
            pad, via, arc, third_track, net_unknown), "map" (what was
            matched and applied)}.
pcb_unroute tool
Take up the focused board's routing: its tracks, arcs and vias.

        Removes the free tracks and arcs on signal layers, and the free
        vias, that carry a net. Never removes a footprint's own copper,
        polygons or their hatching, dimensions, keepouts, or copper with
        no net (an antenna, a logo, a heat spreader): those are drawn,
        not routed. Locked routing stays unless ``include_locked``, since
        locking is how a designer keeps a route. Polygons are not
        repoured; ``pcb_repour_polygons`` does that.

        Refuses unless the focused board is ``expect_file``. With
        ``checkpoint`` (default), first snapshots the board's folder as it
        is ON DISK, so it can be restored with ``app_restore_checkpoint``;
        unsaved edits in the editor are not in it, so save first if there
        are any.

        For other selections of board copper, ``obj_delete`` (one filter
        or a list as ``items``) takes a board type with a filter, e.g.
        ``eTrackObject`` with ``Layer=TopLayer|InComponent=false``.

        Args:
            expect_file: full path of the board to un-route.
            nets: take up only these nets' routing. None takes every
                net's. A name that is not a net on the board refuses the
                whole call and nothing is removed.
            include_locked: take locked routing as well (default False).
            checkpoint: take a checkpoint first (default True).

        Returns:
            ``{"tracks", "arcs", "vias", "nets", "kept_locked", "failed",
            "checkpoint"}``: how many of each were removed, how many nets
            they were on, and how many locked primitives stayed. Or
            ``{"error": ...}``.
pcb_place_thieving_pads tool
Fill bare copper area with a grid of isolated thieving pads.

        Drops a regular grid of small round pads on `layer`, inside the board
        outline minus `margin_mils`. A grid point is skipped whenever any
        existing primitive (track, arc, via, pad, fill, region, polygon, or
        component body) sits within half-pad + clearance of it, so pads land
        only in genuinely empty regions. Pads carry no net. Evens out plating
        current on sparse boards. Capped at 5000 pads per run.

        Args:
            layer: Copper layer to populate (default TopLayer).
            pad_size_mils: Pad diameter (default 20).
            pitch_mils: Grid spacing (default 50).
            clearance_mils: Keep-out from existing copper (default 15).
            margin_mils: Inset from board edge (default 100).

        Returns:
            {"placed", "scanned", "layer"}.
pcb_move_tracks_to_layer tool
Move all tracks of a net to one layer, adding vias where needed.

        Relayers every track of `net_name` onto `target_layer`, then drops a
        via at each same-net single-layer (SMD) pad that is NOT on the target
        layer, since that pad can now only connect through a layer change.
        Multilayer (through-hole) pads need no via. This flattens a net's
        routing onto one layer, so use it deliberately. Tracks only (arcs
        stay where they are), and every track of the net moves: those
        inside footprints and a hatched pour's tracks too.

        Args:
            net_name: Net whose tracks move.
            target_layer: Destination signal layer (e.g. "BottomLayer").
            via_size_mils: Via pad diameter for added vias (default 50).
            via_hole_mils: Via hole diameter (default 28).

        Returns:
            {"net", "target_layer", "moved", "vias_added"}.
pcb_bevel_polygon_corners tool
Chamfer the corners of a copper polygon pour.

        Replaces each sharp vertex with two points set back along its edges by
        bevel_mils (auto-clamped so neighbouring bevels never overlap), giving
        every corner a straight 45-style cut. Only straight-outline polygons
        are handled, a polygon containing arc segments is left untouched. The
        polygon is repoured after the edit.

        Args:
            index: Which polygon to bevel (0-based, in board iteration order).
            net_name: If set, count only polygons on this net when applying
                index.
            bevel_mils: Set-back distance per edge (default 25).

        Returns:
            {"beveled", "index", "orig_vertices", "new_vertices", "bevel_mils"},
            or an error code (NOT_FOUND / BAD_POLYGON / HAS_ARC).
pcb_plan_placement tool
Auto-place components to shorten wirelength, legally. Dry-run by
        default: returns proposed moves and metrics, changes nothing.

        Reads the netlist and each footprint's real bounding box, then
        minimises half-perimeter wirelength (HPWL) inside the outline with
        no same-layer overlaps. Parts on opposite layers may overlap.
        Workflow: run with apply=False, check ``summary``,
        ``hpwl_improvement_pct``, ``overlap_pairs_after`` and ``moves``,
        then run again with apply=True to commit in one transaction.

        Args:
            designators: Only these move; the rest stay put but still pull
                their nets and block overlaps. Default: all but ``fixed``.
            fixed: Designators held in place. You choose them; nothing is
                guessed from prefixes.
            region: Bounds {x1, y1, x2, y2} in mils. Default: the board
                outline's bounding box.
            iterations: Relaxation steps (default 400).
            grid_mils: Snap grid for final positions (default 5).
            clearance_mils: Extra spacing between parts (default 15).
            max_net_fanout: Ignore nets on more components than this
                (0 = keep all; ~20 drops power planes).
            exclude_nets: Net names to ignore, e.g. ["GND"].
            critical_nets: Nets whose pull is multiplied by
                ``critical_weight`` so they come out shortest.
            critical_weight: Multiplier for critical nets (default 3,
                clamped to 1..20).
            edge_parts: {refdes: "L"|"R"|"T"|"B"}: seat a part against that
                board edge (connectors, mounting holes).
            keepout_groups: {refdes: group}: parts in different groups are
                pushed apart, e.g. switching vs analog. construct only.
            match_groups: {refdes: group}: parts in one group are kept
                adjacent even without a shared net (matched pairs).
                construct only.
            match_roles: {refdes: role} within a match group (e.g. A/B):
                drives each role's centroid together for a common-centroid
                (ABBA) layout. Needs match_groups; construct only.
            plan_json: Your DesignPlan (JSON or dict). Adds match groups
                from differential nets and keepout groups from analog vs
                digital roles; explicit groups win. Echoed in
                ``auto_constraints``.
            reseed_grid: Re-place from scratch instead of refining current
                positions (unplaced or scrambled boards only).
            optimize_rotation: Also pick 0/90/180/270 per top-side part to
                point pins at their nets (default True).
            engine: "refine" (default) nudges current positions;
                "construct" places from scratch with a multi-term objective
                (wirelength, overlap, edge, decoupling, connectors,
                thermal) and sizes the board.
            restarts: construct only: run this many seeded restarts and
                keep the best legal result (default 1).
            render_png: Path for a preview image of the proposal, returned
                as ``preview_png`` (``preview_error`` on failure).
            apply: Commit the moves (default False).

        Returns:
            ``dry_run``, ``engine``, counts (component, movable, fixed,
            net, pin), ``summary`` (read first), ``hpwl_before/after`` and
            ``hpwl_improvement_pct``, ``overlap_pairs_before/after``,
            ``objective_report`` (each term unweighted plus
            ``weighted_total``, ``legal``, ``utilization``),
            ``net_length_report`` (``longest_nets``,
            ``critical_net_spans``), ``ratsnest`` (``signal_crossings``
            predicts layer changes), ``decoupling_report`` ([{decap, ic,
            distance_mils}], worst first, found from connectivity),
            ``suggested_board`` (construct only), ``moved_count``,
            ``rotated_count``, ``moves`` [{designator, from, to}] in
            mils/degrees, ``region``, ``notes``, and ``apply_result`` when
            applied.
pcb_copy_component_placement tool
Clone placement from source components onto destination components.

        Copies layer, X, Y and rotation, and optionally the designator
        and comment text placement. For repeated channels: lay out one,
        then map it onto the next, e.g. ``{"R1": "R11", "U1": "U2"}``.

        Args:
            mapping: ``{source_designator: dest_designator}``. Each
                source must already be placed somewhere; each dest gets
                overwritten with the source's placement.
            include_designator: Also copy designator-text placement
                (offset, rotation, size, layer, visibility). Default
                True.
            include_comment: Also copy comment-text placement. Default
                True.

        Returns:
            Dict with:
              - ``applied``: pairs that succeeded
              - ``failed``: pairs that failed (src/dst missing or apply
                exception)
              - ``items``: per-pair ``{src, dst, ok, error}``
pcb_replicate_layout tool
Copy one channel's routing onto a matching channel.

        Copies the source group's tracks, arcs, vias, polygons, regions
        and fills onto the destination group, remapping each net to the
        matching destination net. One rigid transform comes from the
        FIRST mapping pair. Only nets internal to the source group are
        copied (every pad on the net belongs to a mapped part), so shared
        GND or power nets are left alone; ``nets`` overrides that.

        The destination parts must already sit like the source (run
        ``pcb_copy_component_placement`` first, or pass
        ``move_components=True``); ``congruence_warnings`` counts those
        that don't.

        Args:
            mapping: ``{source_designator: dest_designator}``; include
                every part in the channel.
            nets: Source net names to copy instead of the internal ones.
            move_components: Also move the destination parts onto the
                transform (default False).

        Returns:
            ``copied``, ``net_assigned``, ``internal_nets``,
            ``shared_nets_skipped``, ``congruence_warnings``, ``notes``.
pcb_filter_variant_components tool
Select a variant's components of one fitted-class on the board.

        Classifies every component under ``variant_name`` (fitted original /
        alternate / not fitted) and selects exactly the chosen class on the
        active PCB, deselecting the rest, e.g. so a variant's not-fitted
        parts stand out for review.

        Args:
            variant_name: The project variant to classify against.
            select: ``not_fitted`` (default), ``fitted_original``,
                ``alternate``, or ``all_fitted`` (fitted_original +
                alternate). Any other word is refused.

        Returns:
            {"variant", "select", "matched", "designators"}, or
            ``{"ok": False, "reason": ...}`` if ``select`` is not one of
            the four classes, in which case nothing is sent or selected.
pcb_renumber_pads tool
Renumber the current PcbLib footprint's pads in spatial order.

        Pads are sorted by position and numbered in sequence; rows and
        columns are banded by a small tolerance so a grid numbers cleanly.
        A pad's position is its copper centre, not its origin, so a custom
        pad numbers where it is drawn.
        Acts on the active PCB library's current footprint.

        Args:
            order: ``lr_tb`` (default) numbers rows top-to-bottom,
                left-to-right within a row; ``tb_lr`` numbers columns
                left-to-right, top-to-bottom within a column.
            start: First designator number (default 1).
            increment: Step between successive pads (default 1).
            prefix: Optional string prefixed to each number (e.g. ``A`` ->
                ``A1``, ``A2``).

        Returns:
            {"renumbered", "order", "mapping": [{old, new}, ...]} or an error.
pcb_copy_tracks_radial tool
Array the selected tracks/arcs/vias radially about a center point.

        Replicates the current selection ``count - 1`` more times, each rotated
        a further ``angle_step`` degrees about ``(center_x, center_y)``.
        Copies are added unselected so the source set stays put.

        Args:
            center_x: Rotation-center X in mils.
            center_y: Rotation-center Y in mils.
            count: Total instances including the original (>= 2).
            angle_step: Degrees between instances. Defaults to ``360 / count``
                (a full even ring).

        Returns:
            {"copied", "count", "angle_step"} or an error.
pcb_scale tool
Scale the selected free primitives by a ratio about an anchor.

        Each coordinate maps ``P' = anchor + ratio*(P - anchor)`` and sizes
        scale by ``ratio``. Handles free tracks, arcs, vias, pads, fills and
        text. Primitives inside a component, dimension, or polygon are skipped
        (as are polygons/regions), so this scales free copper and artwork,
        not footprints.

        Args:
            ratio: Scale factor (> 0). ``0.95`` shrinks 5%, ``1.05`` grows 5%.
            anchor: ``selection_center`` (default), ``board_center``, or
                ``origin``.

        Returns:
            {"scaled", "skipped", "ratio", "anchor_x", "anchor_y"} or an error.
pcb_save_copy_as tool
Write the open board to another path, as File > Save Copy As.

        The target gets the board as it is in Altium, unsaved edits
        included; the open document keeps its path, project and modified
        state. An existing target is overwritten, after Altium saves it
        as ``<target>.bak`` with ``backup`` (default); a target open in
        Altium is refused. The copy joins no project.

        Args:
            target_path: Full path of the .PcbDoc to write.
            source_path: The open board to copy. Empty uses the focused
                board, or the only one open; several open with none
                focused is refused rather than guessed.
            backup: Keep the overwritten target as ``<target>.bak``.

        Returns:
            {"source", "target", "target_existed", "written",
            "open_board_path", "backup"} or an error. ``written`` is read
            from the target's file time, not assumed.
pcb_make_library tool
Make a PCB library of every footprint on a board, and save it.

        Altium's Design > Make PCB Library, which runs with no dialog.
        Altium names the library after the board, with a digit added
        when that name is taken, and leaves an empty file of that name
        until it is saved; with ``out_path`` the library is saved there
        instead and that empty file is removed. The saved library is then
        closed, because until it is reopened its footprints read in the
        board's frame.

        Args:
            out_path: Full path of the .PcbLib to write. Empty keeps
                Altium's name beside the board. An existing file is
                refused.
            add_to_project: Add the library to the board's project.
            board_path: The .PcbDoc. Defaults to the focused board.

        Returns:
            ``library`` (where it was saved), ``saved``, ``bytes``,
            ``footprint_count``, ``footprints``, ``made_as`` (Altium's
            name for it), ``added_to_project`` and ``closed``.
pcb_get_pad_via_library tool
The pad and via templates a board holds, or a .PvLib holds.

        A board keeps its own pad/via library of the templates its pads
        and vias use. With ``library_path`` the .PvLib file is opened and
        read instead. Either way the installed pad/via libraries are
        listed too. Changes nothing.

        Args:
            board_path: The .PcbDoc. Defaults to the focused board.
            library_path: A .PvLib to read instead of a board.

        Returns:
            ``board_templates`` (or ``templates`` for a .PvLib)
            [{name, description, id, used_by}] and
            ``installed_libraries`` [{name, path, templates}].
pcb_add_pad_via_template tool
Make a pad or via template in the board's own pad/via library.

        From a pad (``component`` and ``pad``) or a via (``x``, ``y`` in
        mil from the board origin). Altium names the template from the
        object's shape and sizes, as "r55_60r14". The object itself is
        not linked to the template. Save the board to keep it.

        Args:
            component: Designator of the part that has the pad.
            pad: The pad's name on that part.
            x: A via's x, mil.
            y: A via's y, mil.
            board_path: The .PcbDoc. Defaults to the focused board.

        Returns:
            ``templates_before``, ``templates_after`` and
            ``board_templates`` read back.
pcb_make_pad_via_library tool
Write a board's pad and via templates to a new .PvLib file.

        A new pad/via library is made, each template of the board's own
        library is copied into it, and it is saved; Altium puts one
        default template in every new pad/via library, so that one is
        there too. The saved library is closed, and ``install`` then adds
        it to the installed pad/via libraries, read back from that list.

        Args:
            out_path: Full path of the .PvLib to write; an existing file
                is refused.
            install: Install the new library.
            board_path: The .PcbDoc. Defaults to the focused board.

        Returns:
            ``board_templates``, ``copied``, ``saved``, ``closed``,
            ``installed`` and ``templates`` (the new library's, read back).
pcb_apply_geometry_map tool
Move and reshape thousands of free primitives in ONE pass, from a
        JSON map of each object's CURRENT geometry and its new one.

        Use it past a few hundred objects, where obj_modify with items is
        slow.
        Each entry is matched to exactly one object within the tolerance;
        none, several, or one object named twice is reported, never
        guessed, and an object changed since the dump is left alone. Free
        primitives only (not in a component, pour or dimension): move
        components with pcb_move_components.

        The map (mils, absolute board coordinates)::

            {"tracks":   [{"layer", "width", "key": [x1,y1,x2,y2],
                           "new": [x1,y1,x2,y2], "new_width"?}],
             "arcs":     [{"layer", "width", "key": [cx,cy,r,start,end],
                           "new": [cx,cy,r,start,end], "new_width"?}],
             "vias":     [{"key": [x,y], "new": [x,y]}],
             "texts":    [{"layer", "key": [x,y,text], "new": [x,y,text?]}],
             "fills":    [{"layer", "key": [x1,y1,x2,y2], "new": [...]}],
             "regions":  [{"layer", "key": {"n", "first": [x,y], "holes"},
                           "contour": [[x,y],...], "holes": [[[x,y],...],...]}],
             "polygons": [{"layer", "key_first": [vx,vy], "segments": [seg]}],
             "board_outline": [seg] or {"segments": [seg]},
             "delete":   [{"kind": "track"|"arc", "layer", "width", "key"}
                          | {"kind": "region", "layer", "key": {"n", "first", "holes"}}
                          | {"kind": "via", "key": [x,y]}
                          | {"kind": "polygon", "layer", "key_first": [vx,vy]}],
             "create":   [{"kind": "track"|"arc", "layer", "width",
                           "geom": [x1,y1,x2,y2] | [cx,cy,r,start,end],
                           "net"?, "keepout"? (default true on KeepOutLayer), "stub"?}
                          | {"kind": "region", "layer", "contour": [[x,y],...],
                           "net"?, "teardrop"?, "keepout"?}
                          | {"kind": "via", "x", "y", "size", "hole", "net"?}
                          | {"kind": "polygon", "layer", "contour": [[x,y],...],
                           "net"?, "name"?, "order"?, "pour_over"? (true)}]}

        A seg is {"kind": 0, "vx", "vy"} (line) or {"kind": 1, "vx", "vy",
        "cx", "cy", "r", "sa", "ea"} (arc). Track ends match in either
        order. A region's outline and holes are replaced whole: any
        number of holes, each of any vertex count. Polygons match by layer and
        first vertex. A repour also deletes free regions lying in the pour,
        teardrops included, so create those after the last repour. ``components`` entries
        are counted and ignored. A delete is matched like a move (an
        object both moved and deleted is refused). Identical objects need
        one identical entry per copy; fewer entries than copies is
        ambiguous and deletes none. Creates are free, on
        the layer named, each with an optional ``net``; a net the board
        lacks creates nothing and is listed in ``apply.create_refused``
        with the map ``entry``. A via is a through via. A polygon pour is made but NOT poured: pour many
        with pcb_repour_polygons afterwards (small ones first); ``order``
        sets its pour index (``pour_order_off`` counts any that did not
        take). Copper fills that are rotated or not rectangular are best
        sent as regions. A created region takes, with ``teardrop``,
        Altium's teardrop flag. THIS IS THE BULK COPPER CREATE: one file,
        one transaction. A value past +/-214,748 mil (an arc's
        centre plus radius included) stops the whole apply before anything
        is sent, since Altium's coordinates cannot hold it; ``out_of_range``
        counts them per kind. Draw a near-straight arc as a line.

        Args:
            map_path: The JSON map.
            board_path: The .PcbDoc to change (required; refused unless
                that file is the board Altium opens).
            tolerance_mil: Allowed distance per coordinate and width.
            angle_tolerance_deg: The same for arc angles, modulo 360.
            dry_run: Dump and match only. Run this first.
            repour: Repour each reshaped polygon. False leaves pours for
                pcb_repour_polygons (small ones first, big hatched once).
            region_shape: For regions that carry shape segments (what
                Altium draws): "rebuild" (default) rewrites them from the
                new outline; "clear" drops them; "keep" leaves the OLD
                shape on screen.
            kinds: Dump only these kinds, comma-separated (track, arc,
                via, text, fill, region, polygon); empty is every kind.
                A map that edits one layer's tracks need not have the
                whole board dumped first.
            layer: Dump only these layers, comma-separated (any layer
                name, Mechanical17 and up included); empty is every layer.
                The apply pass walks the same kinds and layers, so
                entries outside them are unmatched, never applied
                elsewhere.
            nets: Dump only objects on these nets, comma-separated (an
                object with no net is left out).
            selected: Dump only selected objects.
            name: Dump only polygons of this name (exact, or a prefix
                ending in ``*``); other kinds are not affected.
            bounds: Dump only objects whose box touches this area,
                ``"x1,y1,x2,y2"``.
            nets, selected, name and bounds only decide what is written
            of the walk: the ordinals still count every walked object, so
            the apply pass needs nothing for them.

        Returns:
            {"board", "dry_run", "match": {kind: {entries, matched,
            unmatched, ambiguous, refused, samples?}}, "apply": {applied,
            stale, missing, region_readback_off, track_arc_readback_off,
            region_bbox_off, region_shapes_changed, deleted, created,
            create_failed, create_readback_off, teardrops_created,
            by_kind}}. Any nonzero ``*_off`` means something did not read
            back as written (a track's or arc's ends, radius or width
            included); ``by_kind.O.open`` 1 means the
            outline's closing vertex did not read back on its first. A dry run keyed on the new
            geometry shows what landed.
pcb_tidy_tracks tool
Lay the board's free tracks again as the shortest clean 45/90 runs.

        Each run between fixed points (pads, vias, arcs, junctions, width
        changes) becomes the shortest octilinear path that turns 90 degrees
        or less, leaves and enters a surface pad from its centre along a pad
        axis, crosses no other pad of its net, keeps every join it had, and
        clears every other net, the board edge and keep-outs by the board's
        rules. A run is changed only when it gets shorter, or as short with
        fewer bends. The board's pcb_route_brief holds too: its areas,
        spacings and barriers, and each net's region and keep-outs. Footprint tracks and arcs are left as they are. Altium's
        own Gloss is pcb_gloss.

        Args:
            board_path: The .PcbDoc; refused if another board is focused.
            nets: Only these nets (default every net).
            layers: Only these copper layers (default every signal layer).
            dry_run: Work out and match the changes without writing them.

        Returns:
            ``gloss`` (runs, relaid, length and bends before and after,
            nets), ``removed`` and ``added`` track counts, and ``map``:
            what matched on the board and, when written, what was applied.
pcb_place_stitching_vias tool
Place a grid of stitching vias on a named net.

        The grid covers the rectangle, or the whole board when no
        rectangle is given. With ``within_board`` (default) only grid
        points inside the board outline, at least ``edge_clearance_mils``
        from its edge, are tried, so a round or flanged board gets vias
        only on the board. A point is skipped when any pad or via (any
        net: no via in a pad), a part's 3D body (``avoid_parts``), or a
        track, arc or keep-out of another net lies within
        ``via_size_mils/2 + clearance_mils``; the rest get a through via
        on the net. Dry run by default: check ``placed`` and
        ``skipped``, then call again with ``dry_run=False``.

        Args:
            net: Target net (must already exist on the board).
            x1_mils, y1_mils, x2_mils, y2_mils: Inclusive rectangle for
                the grid; all zero (default) uses the board's extent.
            spacing_mils: Grid spacing (default 50).
            via_size_mils: Via pad diameter (default 30).
            via_hole_mils: Via drill diameter (default 14).
            clearance_mils: Min gap to a blocking primitive (default 10).
            dry_run: When True (default), only count would-be
                placements without mutating the board.
            within_board: Keep to the board outline (default True).
            edge_clearance_mils: Minimum distance from a via centre to
                the board edge when ``within_board`` (default 30).
            avoid_parts: Keep out from under every part's 3D body
                (default True). False stitches under bodies too, as under
                a QFN's thermal area.

        Returns:
            Dict with ``{net, dry_run, placed, skipped, spacing_mils,
            clearance_mils}``, plus ``outside_board`` (grid points left out).
pcb_calc_impedance tool
Characteristic impedance of a PCB trace (IPC-2141 microstrip and
        stripline, Wadell coupling for pairs). Pure math, about +/-10%:
        fine for choosing widths; the fab's field solver has the final
        word. Read real heights and Er with pcb_get_layer_stackup first
        rather than assuming FR-4.

        Args:
            geometry: "microstrip", "microstrip_diff", "stripline" or
                "stripline_diff".
            width_mils: Track width; for a pair, each conductor's.
            dielectric_height_mils: Microstrip: trace to plane below.
                Stripline: total between the two planes.
            dielectric_constant: Er (default 4.2, FR-4).
            copper_oz: Copper weight; 1 oz = 1.378 mil thick (default 1).
            spacing_mils: Edge-to-edge gap of a pair.

        Returns:
            Inputs echoed, ``thickness_mils``, ``z0_ohms``, ``zdiff_ohms``
            (pairs) and ``propagation_delay_ps_per_inch``.
pcb_calc_trace_width_for_impedance tool
Trace WIDTH to hit a target impedance (inverse of pcb_calc_impedance).

        Inverts the same IPC-2141 / Wadell forms, so it round-trips with
        the forward calculation. Offline, about +/-10 %: the fab's field
        solver has the final word. Read real heights and Er with
        ``pcb_get_layer_stackup``.

        Args:
            target_ohms: Single-ended Z0 for ``microstrip``/``stripline``, or
                the differential Zdiff for ``microstrip_diff``/
                ``stripline_diff``.
            geometry: One of microstrip, microstrip_diff, stripline,
                stripline_diff.
            dielectric_height_mils: Trace-to-plane height (microstrip) or full
                between-plane thickness (stripline).
            dielectric_constant: er (default 4.2 FR-4).
            copper_oz: Copper weight for trace thickness (default 1.0).
            spacing_mils: Edge-to-edge gap (required for ``*_diff``).

        Returns:
            ``{"ok": True, "width_mils", "single_ended_z0_ohms", "feasible",
            ...}`` (feasible False when the target needs a width <= 0: raise the
            dielectric height or lower the target), or ``{"ok": False, ...}``.
pcb_calc_termination tool
Decide if a net needs termination and size the resistor(s).

        Offline. A net is electrically long when its one-way flight time
        exceeds ``length_fraction`` of the rise time (Johnson & Graham's
        1/6 by default). Microstrip Er_eff is Hammerstad when width and
        height are given, else 0.475*Er+0.67.

        Args:
            length_mils: Routed (or estimated) net length.
            rise_time_ns: Signal edge rate (the driver's 10-90 % rise time).
            z0_ohms: Line characteristic impedance (size it with
                ``pcb_calc_impedance``; default 50).
            dielectric_constant: er (default 4.2 FR-4).
            geometry: ``microstrip`` or ``stripline``.
            driver_impedance_ohms: Driver output impedance, subtracted for the
                series value (``Rs = Z0 - Rdriver``).
            vcc: Supply rail; enables the Thevenin split option when > 0.
            width_mils, dielectric_height_mils: Microstrip geometry for the
                Hammerstad Er_eff (optional; falls back to the approximation).
            length_fraction: Electrically-long threshold (default 1/6).
            multi_load: True for a bus / multi-receiver net (recommends
                far-end Thevenin/parallel instead of source series).
            z0, er, driver_impedance, height_mils: the EasyEDA and KiCad
                spellings of the same four values; giving both spellings
                with different values is refused.

        Returns:
            ``ok``, ``needs_termination``, ``recommended``,
            ``critical_length_mils``, ``flight_time_ns``, ``options`` (ideal
            and nearest-E24 values per scheme), ``summary``.
pcb_calc_length_match tool
Length-match tolerance and serpentine compensation for a bus / pair.

        Turns a timing budget into the length window the routing must hold
        and, given routed lengths, the serpentine each net needs (lay it
        with pcb_tune_length). Offline. Propagation uses the effective
        dielectric constant (stripline = Er; 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"}``.
pcb_calc_thermal_vias tool
Size a thermal-via field under a power pad, or score a given
        ``via_count``. Each barrel conducts ``R = L / (k * A)`` and the vias
        add in parallel. The target is ``target_k_per_w``, or ``power_w``
        with a ``delta_t_c`` budget. Pure math, no Altium; copper spreading
        in the pad and plane is assumed good.

        Args:
            drill_mm: Finished via drill diameter.
            board_thickness_mm: Conduction length, from the top layer to the
                heat-spreading plane (full thickness for a bottom plane).
                The EasyEDA and KiCad builds spell this ``length_mm``;
                either is accepted.
            length_mm: Alias for ``board_thickness_mm``.
            plating_um: Barrel plating thickness in microns.
            filled_copper: True for a copper-filled via (full-circle copper),
                False for an unfilled / resin-filled barrel (annulus only).
            k_cu: Copper thermal conductivity, W/(m.K) (default 385).
            power_w: Dissipation, for the target (with ``delta_t_c``) and the
                realized temperature rise.
            delta_t_c: Allowed rise across the via field.
            target_k_per_w: Explicit target array resistance.
            via_count: Score this exact count instead of solving one.

        Returns:
            ``{"ok": True, "via_count", "single_via_k_per_w", "array_k_per_w",
            "target_k_per_w", "temp_rise_c", "barrel_area_mm2", "summary"}``.
pcb_calc_track_current_capacity tool
IPC-2221 current-carrying capacity for a PCB track.

        Offline math. ``I = k (dT)^0.44 (h w)^0.725`` in mils and degrees
        C, with k 0.048 external and 0.024 internal, at rises of 1, 5,
        10, 20 and 30 C. A length adds DC resistance (annealed copper,
        20 C) and the voltage drop at each current.

        Args:
            width_mils: Track width in mils.
            copper_oz: Copper weight in oz/ft² (1 oz = 1.378 mil).
            layer: ``"external"`` (default) or ``"internal"``.
            length_mils: If > 0, also return resistance and voltage drop.
            delta_t_c: The temperature rise asked about, in C (10 by
                default). The 1, 5, 10, 20 and 30 C table is returned too.

        Returns:
            ``width_mils``, ``copper_oz``, ``thickness_mils``, ``layer``,
            ``delta_t_c`` with ``current_a`` for it, ``current_amps``
            (keys ``1c`` ... ``30c``), and with a length
            ``resistance_mohm`` and ``voltage_drop_mv``.
pcb_calc_trace_width_for_current tool
Minimum track WIDTH to carry a target current (inverse IPC-2221).

        Offline. Solves ``I = k * dT^0.44 * (h*w)^0.725`` for ``w`` with the
        constants of pcb_calc_track_current_capacity (``k = 0.048`` external,
        ``0.024`` internal, ``h = copper_oz * 1.378 mils``).

        Args:
            current_amps: Target current the track must carry.
            current_a: Alias for ``current_amps``.
            copper_oz: Copper weight, oz/ft^2 (0.5 / 1.0 / 2.0 / 3.0).
            delta_t_c: Allowed temperature rise above ambient (10 degC is a
                common conservative budget; 20-30 degC for tight boards).
            layer: ``"external"`` (top/bottom) or ``"internal"`` (inner; needs
                ~2.6x the width for the same rise).
            margin: Fractional widening above the bare IPC minimum for the
                recommendation (default 0.2 = 20 %).
            length_mils: If > 0, also returns DC resistance and voltage drop at
                the recommended width.

        Returns:
            ``{"ok": True, "min_width_mils", "recommended_width_mils",
            "copper_oz", "delta_t_c", "layer", ...optional resistance/drop}``
            or ``{"ok": False, "reason": ...}``.
pcb_add_testpoints_for_net_class tool
For each net in a netclass with no testpoint yet, place a pad
        with the net and testpoint flags, in a row above the board, to be
        moved into place.

        A net counts as covered when any pad or via on it carries any of
        the four testpoint flags; ``force`` places anyway.

        Args:
            net_class: Netclass name to scan.
            type: ``"smd"`` (top-layer SMD pad, no hole) or
                ``"through_hole"`` (multi-layer pad with drill).
            pad_size_mils: Outer pad size in mils. Default 40.
            hole_size_mils: Drill diameter, only used for through-hole
                testpoints. Default 20.
            fab_top: Set ``IsTestpoint_Top`` (top-side bed-of-nails).
            fab_bottom: Set ``IsTestpoint_Bottom``.
            assy_top: Set ``IsAssyTestpoint_Top`` (top-side assembly
                probe). Default True.
            assy_bottom: Set ``IsAssyTestpoint_Bottom``.
            force: Ignore existing testpoint coverage and always
                place a new pad.

        Returns:
            Dict with ``{net_class, type, placed, skipped_already_covered,
            placed_nets[], skipped_nets[]}``.
pcb_apply_dnp_paste_exclusion tool
Suppress stencil paste on Not-Fitted (DNP) components, so no
        paste lands on empty pads. Each surface pad gets a paste expansion
        of minus its larger size; through-hole pads are skipped.

        Apply with no ``designators`` uses the current variant's
        Not-Fitted list. RESTORE THE SAME LIST YOU APPLIED: restore
        refuses without ``designators``, because restoring from a
        different variant would silently leave a fitted part without
        paste. Pass back the ``items`` the apply returned.

        Args:
            designators: Components to treat (apply default: the current
                variant's Not-Fitted list; required for restore).
            restore: Remove the override so the design rules apply again.
            dry_run: Report what would change, change nothing (use first).
            use_current_variant: Let a restore with no designators use the
                current variant (you own that choice).

        Returns:
            ``restored``, ``components_requested`` vs
            ``components_matched``, ``pads_changed``,
            ``pads_skipped_through_hole``, ``items``; a dry run gives
            ``designators`` and ``source``; a refused restore gives
            {"ok": False, "reason"} and touches nothing.
pcb_make_paste_grid tool
Split one pad's solder-paste opening into a regular grid of
        smaller fills, typically for a QFN/DFN exposed pad. Use the
        stencil pattern from the IC's datasheet when it gives one;
        this tool only does a regular grid.

        Args:
            designator: Component designator, e.g. ``"U5"``.
            pad_name: Pad name on that component. Check the footprint
                for an exposed pad's name.
            min_grid_size_mils: Starting block size; raised in 5-mil
                steps until coverage is met.
            min_gap_mils: Minimum gap between blocks.
            min_coverage_pct: Target paste coverage, % of pad area.

        Returns:
            ``{designator, pad_name, grid_x, grid_y, grid_size_mils,
            gap_x_mils, gap_y_mils, fills_placed, coverage_pct}``. The
            pad's own paste opening is suppressed with a manual
            negative paste-mask expansion before the fills go down.
pcb_get_differential_pairs tool
Enumerate every ``IPCB_DifferentialPair`` on the active PCB
        and report each pair's two halves with length skew.

        Compare ``skew_mils`` with the limit in the interface's own
        specification or the part's datasheet. One row per pair:
          - ``name``: pair name (e.g. ``"USB_DATA"`` if the SCH had
            ``.DiffPair`` directives ``USB_DATA_P`` / ``USB_DATA_N``)
          - ``positive_net`` / ``negative_net``: the two member nets
          - ``pos_length_mils`` / ``neg_length_mils``: summed track +
            arc length for each half (signal layers only)
          - ``skew_mils``: absolute difference
          - ``both_routed``: false means a half is unrouted and the
            lengths mean little

        Returns:
            Dict with ``{count, pairs: [...]}``.
pcb_clear_source_footprint_library tool
Clear ``Comp.SourceFootprintLibrary`` on board components.

        A component remembers the library it came from, so after that
        library is renamed or moved, updates fail with "library not
        found". Clearing it makes Altium re-match by name from the
        Available Libraries: install the new library, run this, then the
        ECO.

        Args:
            designator_filter: Restrict to these designators
                (e.g. ``["U1", "U5"]``). ``None`` / empty clears all
                components on the board. Match is case-sensitive
                whole-string.

        Returns:
            Dict with ``{total, cleared}``. ``total`` counts components
            inspected after filter; ``cleared`` counts ones that
            actually had a non-empty SourceFootprintLibrary cleared.
pcb_update_footprints_from_library tool
Refresh placed parts from their edited PcbLib, with no ECO.

        For a footprint fixed in its library (silk, pads, 3D body) when
        the project ECO would also propose every other difference. Each
        part is replaced by a
        fresh copy from the library that keeps its side, rotation,
        position, designator and comment text as placed, locked state,
        pad nets by pad name, and its schematic link (SourceUniqueId and
        SourceHierarchicalPath, which multi-channel designs match on).

        A part is replaced only when the library holds its pattern and
        every pad that carried a net exists on the new footprint;
        otherwise it is left as it was and the reason is given. Routed
        copper is not touched, so check connectivity where pads moved.

        The part's PARAMETERS (LCSC number, manufacturer and the rest) are
        NOT carried over. Run proj_sync_pcb after a refresh, before writing
        a BOM from the board; pcb_component_parameters reads them.

        Args:
            designators: The parts to refresh, e.g. ``["C12", "J3"]``.
            library_path: The .PcbLib to load from. Empty uses each
                part's own SourceFootprintLibrary; for an integrated
                library that is its source .PcbLib, found beside it or up
                to three folders above (an IntLib is never opened: Altium
                asks to install or extract it).
            board_path: Focus this .PcbDoc first. Omit for the board in
                front.
            dry_run: Report what would be refreshed and change nothing.

        Returns:
            ``updated``, ``failed`` and per part ``ok``, ``pattern``,
            ``library``, ``pads_before``/``pads_after``, ``nets_bound``
            and a ``reason`` when it was left alone.
pcb_get_fab_stats tool
DFM (Design For Manufacturing) summary -- the numbers fab
        houses ask for on their quote forms.

        One IPC call returns:
          - ``board_width_mm``, ``board_height_mm``, ``board_area_mm2``
          - ``num_copper_layers``
          - ``vias_total``, ``vias_through``, ``vias_blind``,
            ``vias_buried``
          - ``pads_plated``, ``pads_unplated``, ``pads_slotted``
          - ``min_annular_ring_mils`` (plated holes, vias and pads)
          - ``min_track_width_mils`` (all copper layers)
          - ``smallest_hole_mils``, ``largest_hole_mils``,
            ``distinct_hole_count``

        Compare them with the chosen fab's published capabilities
        (``design_load_fab_profile``). Aspect ratio is not included; it
        needs ``pcb_get_layer_stackup``.

        Returns:
            Dict with all keys above. All linear measurements use the
            stated unit suffix (``_mm`` vs ``_mils``).
pcb_lock_net_routing tool
Lock or unlock track / arc / via primitives on a list of nets.

        Locked objects stay put when "Protect Locked Objects" is on in the
        PCB preferences.

        Args:
            nets: Net names to lock / unlock (e.g. ``["VCC", "GND",
                "CLK_24M"]``). Case-sensitive.
            lock: True to lock (sets Moveable=False), False to unlock.
            lock_components: Also lock any component with a pad on a
                matched net. Default False.

        Returns:
            Dict with:
              - ``locked``: True / False mirror of the input
              - ``matched_primitives``: track + arc + via objects whose
                net matched
              - ``updated_primitives``: how many actually changed state
              - ``matched_components``: components touched (only filled
                when ``lock_components=True``)
              - ``updated_components``: components whose Moveable flipped
pcb_set_text_visibility tool
Bulk-toggle component designator and / or comment visibility.

        Args:
            designators: If True/False, set ``Component.NameOn`` for
                matched components. ``None`` leaves designator visibility
                alone.
            comments: If True/False, set ``Component.CommentOn``. ``None``
                leaves comment visibility alone.
            filter: Restrict to these designator names (e.g. ``["U1",
                "U2", "C5"]``). ``None`` applies to every component.
                Match is case-sensitive whole-string.

        At least one of ``designators`` / ``comments`` must be supplied.

        Returns:
            Dict with:
              - ``matched``: components inspected (after filter)
              - ``updated_names``: components whose NameOn flipped
              - ``updated_comments``: components whose CommentOn flipped
pcb_set_text_style tool
Set the height and stroke width of component designators or comments.

        Stroke text has a height and a stroke width only; the characters
        scale with the height (0.8 mm / 0.1 mm is ``height_mils=31.5,
        stroke_mils=3.94``).

        For free texts use ``obj_modify`` on ``eTextObject`` with
        ``Height`` and ``StrokeWidth`` (filter ``IsDesignator=false``).

        Args:
            height_mils: Text height in mils. ``None`` leaves it.
            stroke_mils: Stroke width in mils. ``None`` leaves it.
            designators: Only these components (e.g. ``["U1", "R5"]``).
                ``None`` applies to every component.
            which: ``"designator"`` (default), ``"comment"`` or ``"both"``.

        At least one of ``height_mils`` / ``stroke_mils`` must be given.

        Returns:
            Dict with ``matched`` components, ``changed`` and ``failed``
            texts, ``not_found`` designators, and ``texts``: each one's
            height and stroke as read back after the write. ``success``
            is false when any text did not take or a designator was not
            found.
pcb_check_placement_collision tool
Check, without moving it, whether a component at (x, y[,
        rotation]) would overlap another component on the same side.
        Use before ``pcb_move_components`` on a populated board.

        Bounding boxes only: a non-quarter rotation reuses the current
        box, and courtyards and pad clearances are not checked (use DRC).

        Args:
            designator: Component to test.
            x, y: Proposed reference point in mils.
            rotation: Proposed rotation; default the current one.
            margin_mils: Extra clearance; at 0, touching boxes collide.

        Returns:
            ``{designator, proposed: {x, y, rotation, bbox, margin_mils},
            clear, colliding_count, colliding: [{designator, bbox}]}``.
pcb_get_trace_lengths tool
Get total routed track length per net on the active PCB.

        Sums all track segment lengths for each net. Useful for length
        matching analysis and checking differential pair balance.

        Args:
            net: Optional net name filter. If provided, only returns the
                 length for that specific net. Empty = all nets.

        Returns:
            Dictionary with "trace_lengths" array (each with net name and
            length_mils) and "net_count"
pcb_get_layer_stackup tool
Get the full PCB layer stackup information.

        Returns copper layers with thickness, dielectric type/height/constant,
        and board name.

        Returns:
            Dictionary with "layers" array (each with name, order,
            copper_thickness_mils, dielectric_type, dielectric_height_mils,
            dielectric_constant), "layer_count", and "board_name"
pcb_get_impedance_profiles tool
Read the impedance profiles in the active board's Layer Stack Manager.

        Altium's field-solver figures: per profile and layer, the trace
        width (and pair gap) it chose, the impedance it calculated and its
        error from the target.

        Returns:
            ``profile_count``, ``read_errors`` (fields this build would
            not report) and ``profiles``: each with ``name``,
            ``target_ohms``, ``tolerance``, ``differential`` and
            ``layers``: ``layer``, ``stack`` (a rigid-flex board has one
            stack per kind of board region, each with its own lines),
            ``enabled``, ``trace_width_mils``, ``diff_pair_gap_mils``,
            ``calculated_impedance_ohms``, ``impedance_error``,
            ``etch_factor``, ``propagation_speed``, ``line_type`` and the
            ``top_reference`` / ``bottom_reference`` layers. A board with
            no profiles returns an empty list. Stack names, line types and
            references come from the Layer Stack Manager's model; when it
            cannot be read (below AD 22) rows keep only ``stack_index``.
pcb_render_png tool
Draw the board as Altium itself draws it, into a PNG file.

        Altium's own renderer, so the picture is the board as the editor
        shows it (layers, colours, the view configuration), not a redraw
        from read-back data like ``pcb_render_svg``.

        Args:
            path: Full path of the .png to write.
            dpi: 25 to 2400 (default 300).
            side: ``top`` or ``bottom``.
            config_type, config: A view configuration to draw with; empty
                uses the board's current one.

        Returns:
            ``written`` (a new file is there), ``size_bytes``,
            ``return_code`` (Altium's) and ``problem``.
pcb_save_board_text tool
Write the whole board to a JSON or ASCII text file, for diffs.

        Altium's own text form of the board, written to a separate file:
        the board document is not saved, renamed or marked changed
        (``board_name_kept`` confirms it). Two dumps of the same board
        compare line by line, which a binary PcbDoc does not.

        Args:
            path: Full path of the file to write; never the board itself.
            format: ``json`` or ``ascii``.
pcb_net_figures tool
Altium's own figures for each net: lengths, delays, vias and pads.

        ``routed_length_mils`` (the copper laid), ``signal_length_mils``
        (pad to pad, as Altium measures it for length matching),
        ``delay_total`` and ``signal_delay`` (Altium's propagation
        figures), ``vias``, ``pads`` and ``in_differential_pair``.

        Args:
            nets: Only these nets. Empty lists every net.
            limit: The most nets to list (default 500).
pcb_clear_guides tool
Remove every placement guide and snap point from the active board.

        Altium's SDK lets scripts delete guides but not add them; add
        them in the editor.
pcb_local_grid tool
Add a cartesian or polar grid for one area, list or delete grids, or read the grid at a point.

        A polar grid places parts on circles and spokes about a centre, as
        on a round board; a cartesian grid can be rotated. A local grid
        wins over the board grid in its area.

        Args:
            action: ``add_cartesian``, ``add_polar``, ``at`` (the grid that
                applies at x, y), ``list`` (every grid), ``delete`` (the
                grids named ``name``) or ``delete_all`` (every user grid).
            x, y: The grid origin (the centre of a polar grid), absolute.
            name: The grid's name. A new grid is stored with its kind at
                the end, _cart or _pol; list and delete take the name with
                or without it. A grid without the tag (made in Altium) is
                listed with kind unknown and without steps or extent.
            step_x, step_y, rotation: Cartesian steps and its angle.
            width, height: How far a cartesian grid reaches from its
                origin in each direction (one quadrant's size).
            angular_step, radial_step, min_radius, max_radius,
            start_angle, end_angle: Polar angles in degrees, the step and
                radii as lengths.
pcb_plane_state tool
For each internal plane layer, whether Altium holds it poured.
pcb_hole_symbols tool
Show or hide the drill symbols Altium draws on every hole.

        Args:
            show: True draws them, False removes them.
            symbol_size: Symbol size in mils (default 50).
            symbol_type: Altium's symbol style code (default 0).
            layer_pair: Which drill pair's holes (index, default 0).
pcb_object_outline tool
The outline of each SELECTED board object, grown by a clearance.

        Altium's own outline of the object's copper on one layer: a pad or
        via by its shape there, a track or arc with its round ends, text by
        its strokes, a region or pour by its edge. Grown by ``expansion``
        it is the area a clearance of that size keeps free, ready to place
        as a keepout or cutout region. Select the objects first with
        obj_select. Arcs come back as short straight segments.

        Args:
            expansion: Mils to grow each outline by (negative shrinks).
            layer: Layer to take the outline on. Empty: each object's own
                layer, top copper for a through-hole pad or via.
            limit: The most objects to return (default 200).

        Returns:
            ``expansion``, ``selected``, ``listed``, ``failed``,
            ``truncated`` and ``objects``, each with ``kind``, ``layer``,
            ``outlines`` and ``holes`` (point lists in mils),
            ``area_sqmils`` and ``problem`` (empty when it worked).
            NOTHING_SELECTED when no object is selected.
pcb_component_parameters tool
Read, set, add or remove the parameters a placed part carries on the board.

        These are the board-side parameters of the part (as in its
        Properties panel on the PCB), not the schematic's. They come from
        the schematic and the library when the board is updated, so treat
        them as read-only: an update from the schematic can put them back.
        ``add`` only creates a new parameter; it never changes one.

        Args:
            designator: The part.
            action: ``list``, ``set`` (name and value), ``add`` (name and
                value; refused with EXISTS when the name is already there
                in any group) or ``remove`` (name).
            group: Which parameters ``list`` reads. ``own`` (default): the
                part's own parameters, from its schematic symbol and
                library component. ``system``: the ones Altium keeps for
                itself, such as Component.VaultGUID, ItemGUID and
                RevisionGUID. ``footprint``: those of the footprint.
                ``all``: every group, each row naming its ``group``.
                ``set``, ``add`` and ``remove`` act on ``own`` only.

        Returns:
            ``parameters`` as they now read (each with ``name``, ``value``
            and ``group``), ``read_back`` (the value of ``name`` after the
            change) and ``done``.
pcb_place_simple_body tool
Place a cylinder or sphere 3D body on the board, with no STEP file.

        Altium's own model factory makes the shape: enough for an
        electrolytic can, an LED dome, a standoff or a clearance check.

        Args:
            shape: ``cylinder`` or ``sphere``.
            x, y: The centre, absolute mils.
            radius: Mils.
            height: Mils, for a cylinder.
            standoff: Height above the board, mils.
            layer: The mechanical layer the body sits on.
            side: ``top`` or ``bottom``.
            color: BGR colour as an integer; grey when omitted.
            identifier: A name to find the body by later.
pcb_file_info tool
The file format version the board was last saved in, and its id.
pcb_export_stackup_csv tool
Write the layer stackup to a conventional fab CSV report.

        Fetches the structured stackup (``pcb_get_layer_stackup``) and writes
        it as the board-house stackup table: one row per physical layer,
        copper and dielectric interleaved top-to-bottom, thickness in mil and
        mm, dielectric constant where it applies. Columns: index, layer, type,
        material, thickness_mil, thickness_mm, dielectric_constant.

        Args:
            output_path: Destination .csv file. Defaults to
                ``workspace/<board>_stackup.csv``.

        Returns:
            {"output_path", "rows", "layer_count", "total_thickness_mils"} or
            an error dict if the board / stackup could not be read.
pcb_add_layer tool
Insert a copper layer into the PCB layer stack, then save and
        reopen the board so every via counts on the new layer.

        Valid names include MidLayer1..MidLayer30 (signal layers) and
        InternalPlane1..InternalPlane16 (power / ground planes). Top / Bottom
        are always present, they cannot be added; a layer already in the
        stack is refused (ALREADY_IN_STACK) and nothing is saved. With ``above`` or
        ``below`` (a layer already in the stack) it goes in at that place;
        otherwise Altium chooses.

        THIS SAVES THE BOARD, with every change made to it so far. A via
        placed since the board was opened does not count on a layer added
        after it was opened until the board is loaded again, and a pour
        there that removes dead copper stays empty. ``reopen=False`` adds
        the layer without saving: vias loaded with the board count at
        once, the others after a save and reopen (``note``).

        Args:
            layer: Layer name, e.g. "MidLayer1", "InternalPlane1"
            above: Put it directly above this layer.
            below: Put it directly below this layer.
            reopen: Save, close and reopen the board after the insert.

        Returns:
            ``layer`` and ``stack_order``, the copper layers top down;
            ``vias_refreshed``: free vias taken off the board and added
            back (a via in a component is left, ``vias_in_components``);
            ``reopened`` with ``saved``. ``reopened`` false carries
            ``reopen_stage`` and ``reopen_reason`` (a board never saved to
            a file is one) and the ``note``: the layer is in, the board
            is as it was left.
pcb_move_layer tool
Move a layer up or down the board's layer stack.

        Moves it one or more places and writes the new order into the board.

        This is the Layer Stack Manager's own intelligent move: the layer
        swaps with its neighbour of the same kind (copper with copper) and
        the dielectrics between them go with it. Objects stay on their
        layers, so the routing on a moved layer moves with it. A move that
        would leave the stack is refused; the moves done before it stay.

        On a symmetric stack the move is mirrored on the opposite half
        (moving L2 down also swaps the matching layers near the bottom),
        unless ``alone`` is set: symmetry is then switched off for the move
        and asked back on afterwards. Altium keeps a stack marked symmetric
        only when it is: after a move alone that leaves it lopsided it
        stays non-symmetric (``symmetric_after``).

        The move goes through the Layer Stack Manager's own copy of the
        stack and writes that copy into the board. Once a board carries
        that copy, script writes to the board's stack (pcb_set_dielectric,
        pcb_modify_layer, a rebuild) do not reach it, and a move would put
        the old values back. So the two are compared first and the move is
        refused while they disagree (``out_of_step``, as
        pcb_layer_stack_manager reports it; pcb_sync_stack_manager brings
        them in step); ``force`` moves anyway.

        Args:
            layer: The layer's name as the stack shows it, e.g. "Layer 2".
            direction: "up" or "down".
            steps: How many places, 1 to 64.
            alone: Move only this layer on a symmetric stack.
            force: Move even when the Layer Stack Manager disagrees with
                the board's stack (its values are then written back).

        Returns:
            ``layer``, ``direction``, ``steps_requested``, ``steps_done``,
            ``refused`` (the next move was refused), ``symmetric`` (the
            stack was symmetric), ``alone``, ``mirrored`` (the opposite
            layers moved too), ``symmetric_after``, ``order_before`` /
            ``order_after`` (the board's copper layers top down) and
            ``stack``; refused for disagreement: ``out_of_step``.
pcb_remove_layer tool
Remove a copper layer from the PCB layer stack.

        Does nothing if the layer is not in the stack.

        Args:
            layer: Layer name, e.g. "MidLayer1", "InternalPlane2"

        Returns:
            Dictionary confirming the layer was removed.
pcb_modify_layer tool
Tune properties on an existing copper layer.

        Only the values given (non-empty, non-zero) are applied.

        Args:
            layer: Target layer name, e.g. "MidLayer1"
            name: New layer name (optional)
            copper_thickness_mils: New copper thickness in mils (optional);
                fractions are kept, 1 oz is 1.378
            dielectric_type: "none" | "core" | "prepreg" | "surface" (optional)
            dielectric_height_mils: New dielectric height in mils (optional);
                fractions are kept
            dielectric_constant: New Dk value (optional)
            dielectric_material: New dielectric material string (optional)

        Returns:
            Dictionary confirming the changes, and ``stack_manager``: the
            Layer Stack Manager's own copy of the stack brought in step, as
            pcb_sync_stack_manager reports it.
pcb_check_stackup tool
Compare the active board's stack-up with a fab stack-up.

        Reads the board (``pcb_get_layer_stackup``) and compares copper
        thickness, the dielectric height under each copper layer and its
        Dk with the template (``design_list_stackups``). The board keeps
        one dielectric per copper gap; a template gap of several plies is
        summed (heights) and thickness-weighted (Dk) first, so a correct
        board is not reported wrong for having fewer entries. A different
        copper count is ONE finding. Read only.

        Args:
            template: stack-up name, e.g. "JLC04161H-7628"
            thickness_tol_pct: allowed difference in thickness, percent
            er_tol: allowed difference in Dk

        Returns:
            ``{"ok": True, "matches": bool, "findings": [...], "board":
            {...}}`` or the bridge's error.
pcb_apply_stackup_template tool
Give the active board a fab stack-up's thicknesses and Dk.

        A dry run by default: it returns the ``pcb_modify_layer`` calls it
        would make. With ``dry_run=False`` it makes them, each read back.
        Existing layers only: a board with a different copper count is
        refused (add or remove layers first). If a call fails part way,
        the result says which layers changed and which did not.

        Args:
            template: stack-up name, e.g. "JLC04161H-7628"
            dry_run: True to only plan (default)

        Returns:
            ``{"ok", "template", "calls", "dry_run"}``, plus per-layer
            ``results`` and ``changed`` / ``not_changed`` when applied.
pcb_set_plane_net tool
Tie an internal plane layer to a net.

        A plane's net belongs to the layer; a polygon poured on a plane
        connects nothing.

        The net must exist on the board. A signal layer is refused
        (``NOT_A_PLANE``) and a layer the board lacks is ``UNKNOWN_LAYER``;
        "Internal Plane 1" and "InternalPlane1" both work. The net is
        read back, and if it did not take the reply is ``success: false``,
        ``applied: false``, with the board left unmarked.

        Args:
            layer: Internal plane layer, e.g. "InternalPlane1" or the name
                the stackup reports for it
            net: Existing net name to tie the plane to, e.g. "PGND"

        Returns:
            Dictionary with "success", "layer" (the RESOLVED layer),
            "layer_name", "net", "net_readback", "applied", "route" (which
            write took) and "note".
pcb_get_board_outline tool
Get the board outline vertices and bounding rectangle.

        Returns outline geometry as a list of vertices (line segments and
        arcs) plus the bounding rectangle dimensions.

        Returns:
            Dictionary with "point_count", "vertices" array (each with
            index, kind, x, y, and optionally cx, cy, angle1, angle2 for arcs),
            "closing" (the vertex saved after the last, which must equal
            the first) with "closed", and "bounding_rect" (left, bottom,
            right, top in mils)
pcb_get_selected_objects tool
Get properties of currently selected objects on the active PCB.

        Reads Altium's selection list, not the board: the quick way to
        read what is selected (``obj_query`` with ``Selected=true`` checks
        every object; ``pcb_get_copper(selected=True)`` gives geometry).

        Args:
            properties: Comma-separated property names to return; any
                name ``obj_query`` reads, e.g. ObjectId, X, Y, X1, Y1, X2,
                Y2, Layer, Net, Width, Name, Rotation, HoleSize, TopXSize,
                TopYSize, Size, Pattern, SourceDesignator, Text,
                Descriptor, Selected. A misspelt name reads blank.

        Returns:
            Dictionary with "objects" array and "count"
pcb_set_layer_visibility tool
Show or hide a PCB layer, or several.

        Args:
            layers: Several layer names to set at once (a list, or a JSON
                list as text), instead of ``layer``.
            layer: Layer name string, e.g.:
                Copper: "TopLayer", "BottomLayer", "MidLayer1"-"MidLayer30"
                Overlay: "TopOverlay", "BottomOverlay"
                Mask: "TopPaste", "BottomPaste", "TopSolder", "BottomSolder"
                Plane: "InternalPlane1"-"InternalPlane16"
                Other: "DrillGuide", "DrillDrawing", "MultiLayer",
                       "KeepOutLayer", "Mechanical1" and up, or the
                       board's own name for a layer
            visible: True to show, False to hide

        Returns:
            Dictionary with layer name and visibility state
pcb_repour_polygons tool
Repour poured polygons on the open PCB, in pour order.

        Each polygon is rebuilt through the API, so a changed clearance
        or board-edge rule takes effect. Shelved polygons stay shelved.
        ``repoured`` is true only when at least one polygon was rebuilt
        and none failed; each item reports its copper pieces and poured
        area before and after, so a repour that changed nothing shows.

        With no filter every polygon is repoured. ``names`` and
        ``indices`` (places in the board's polygon order, as
        pcb_modify_polygon counts them) pick polygons and add up;
        ``exclude`` drops names and wins. Use them to redo many small
        pours quickly and a slow hatched one once, at the end.

        A large hatched pour can take minutes. The call waits up to 30
        times ``timeout`` while Altium reports it is still working, so
        the default of 60 s allows 30 minutes.

        Args:
            names: Polygon names to repour (any case).
            indices: Polygon indices to repour.
            exclude: Polygon names to leave alone.
            board_path: The .PcbDoc to act on. Empty uses the open board;
                a path is refused unless that file is the board opened.
            timeout: Seconds per wait window, see above.
            clean_first: Empty every selected poured polygon before any
                is rebuilt. Use it after polygons were moved: otherwise
                an early pour flows around later pours' stale copper and
                a later one can then fill the space it left.
            empty_only: Empty the selected poured polygons and rebuild
                none, leaving them with no copper until the next repour.
                For a command that avoids pour copper, such as
                Teardrops, so that the pours are poured around its result.

        Returns:
            ``repoured``, counts of ``polygons`` (selected), ``skipped``,
            ``rebuilt``, ``shelved`` and ``failed``, ``clean``, ``empty``
            and ``cleared_primitives``, per-polygon ``items``, and
            ``not_found``: requested names no polygon has.
pcb_polygon_repour_mode tool
Read or set Altium's "Repour Polygons After Modification" preference.

        With ``always``, editing anything a pour touches rebuilds that pour
        after the edit, and a large hatched pour (tens of thousands of
        pieces) can then take minutes per edit. Set ``never`` before a run
        of geometry edits and repour once at the end with
        pcb_repour_polygons, which rebuilds whatever this is set to. Put
        the user's setting back afterwards: it is an application
        preference, not a board property, and it stays until changed.

        Args:
            mode: "" reads only; "never", "threshold" or "always" sets it.

        Returns:
            {"mode_before", "mode", "before", "after"}: names and Altium's
            raw values (0 never, 1 threshold, 2 always).
pcb_set_board_shape tool
Define the physical PCB board outline: a rectangle, a circle or
        a polygon.

        Overwrites the current board shape. Use this right after creating a
        new PCB document to establish the board size before placing parts.
        Coordinates are in mils.

        Args:
            x1: rectangle: first corner X.
            y1: rectangle: first corner Y.
            x2: rectangle: opposite corner X (corners in any order).
            y2: rectangle: opposite corner Y.
            shape: "rectangle" (default), "circle" or "polygon".
            center_x: circle: centre X.
            center_y: circle: centre Y.
            radius: circle: radius.
            points: polygon: the vertices in order, three or more, not
                repeating the first at the end. Each is ``[x, y]`` (a
                straight edge to the next vertex) or ``{"x", "y",
                "arc_center": [cx, cy], "clockwise": false}`` (an arc
                about that centre to the next vertex, counter-clockwise
                unless ``clockwise``). A round board with mounting tabs
                is arcs of the board circle between straight tab sides
                and an arc around each hole.

        Returns:
            ``success`` and the shape as written.
pcb_place_polygon_rect tool
Drop a copper polygon pour on a rectangular area.

        Useful for placing a ground plane or power plane: pass the board's
        corners, the layer, and the net name (typically "GND"). Set
        pour_over=False to force the pour around same-net tracks/pads
        instead of covering them.

        On a board that is not a rectangle (round, flanged), draw the
        outline as a keep-out first (pcb_keepout_board_outline) and make
        the rectangle larger than the board: the pour stops at the
        keep-out, and copper left outside it, joined to nothing, is
        removed as dead copper.

        Args:
            x1: First corner X in mils
            y1: First corner Y in mils
            x2: Opposite corner X in mils
            y2: Opposite corner Y in mils
            net: Net name to assign (empty = no-net fill, unusual)
            layer: Copper layer (default "TopLayer")
            pour_over: Pour over same-net objects (default True)
            remove_dead: Remove copper islands joined to nothing
                (default True).
            pour: Pour it now (default True). False skips the pour, so
                its hatch, grid or thresholds can be set first and it is
                poured once, with pcb_repour_polygons by the ``name`` in
                the reply. Altium may pour it anyway: ``poured`` reports
                the copper that is there.

        Returns:
            Dictionary confirming the polygon placement, with
            ``pour_skipped``, ``poured``, ``repour_mode`` and ``name``.
pcb_place_polygon tool
Drop a copper polygon pour on an outline of straight edges.

        As pcb_place_polygon_rect, on any shape: a zone from another tool,
        an L-shaped plane. The pour keeps its clearance from other nets
        by the board's rules.

        Args:
            points: The outline, three or more ``[x, y]`` (or ``{x, y}``)
                in mils, in order; it closes by itself.
            net: Net of the pour; it must exist on the board.
            layer: Copper layer (default "TopLayer").
            name: The pour's name, to pour or find it again by.
            pour_over: Pour over same-net objects (default True).
            remove_dead: Remove islands joined to nothing (default True).
            pour: Pour it now (default True); False leaves it for one
                pcb_repour_polygons after the rest of the board is drawn.

        Returns:
            ``placed``, ``vertices`` read back, ``name``, ``layer``,
            ``net``, ``poured`` and ``repour_mode``.
pcb_keepout_board_outline tool
Draw the board outline on the Keep-Out layer.

        Every outline edge, arcs included, becomes a keep-out track or arc
        of ``width_mils`` centred on the edge. Copper on every layer (a
        pour, a route) then stays half that width plus the clearance rule
        from the board edge, and a pour larger than the board stops there.
        Edges already drawn on the Keep-Out layer are left alone, so a
        second call adds nothing.

        Args:
            width_mils: Keep-out width (default 20, so copper keeps 10 mil
                plus clearance from the edge).

        Returns:
            ``edges``, ``added``, ``already_there`` and ``width_mils``.
pcb_place_polygon_board tool
Pour copper over the whole board shape, following its outline.

        The pour takes the board outline's own vertices, arcs included, so
        it fits a round or flanged board exactly. The outline is drawn on
        the Keep-Out layer first (pcb_keepout_board_outline, twice
        ``edge_clearance_mils`` wide), which keeps the copper that far
        plus the clearance rule from the edge. Pour every copper layer
        that wants it, then stitch them with pcb_place_stitching_vias.

        Args:
            net: Net of the pour, typically "GND". Must exist on the board.
            layer: Copper layer (default "TopLayer").
            edge_clearance_mils: Copper-free band inside the board edge
                (default 10; 0 draws no keep-out).
            pour_over: Pour over same-net objects (default True).
            remove_dead: Remove copper islands joined to nothing
                (default True).
            pour: Pour it now (default True); False skips the pour, to
                pour once with pcb_repour_polygons (by the ``name`` in the
                reply) after its settings are made. Altium may pour it
                anyway: ``poured`` reports the copper that is there.

        Returns:
            The pour (``vertices``, ``name``, ``layer``, ``net``,
            ``remove_dead``, ``pour_skipped``, ``poured``,
            ``repour_mode``) and ``keepout`` (what the keep-out outline
            added).
pcb_place_via_array tool
Stitch vias in a regular grid across a rectangle.

        Typical use: GND stitching between top and bottom layer copper
        pours. Places vias at every (pitch × pitch) grid intersection
        inside the rectangle.

        Args:
            x1: First corner X in mils
            y1: First corner Y in mils
            x2: Opposite corner X in mils
            y2: Opposite corner Y in mils
            pitch: Grid spacing in mils (default 50)
            net: Net to assign (typically "GND"; empty = no net)
            size: Via pad diameter in mils (default 30)
            hole_size: Drill hole diameter in mils (default 12)
            low_layer: Start layer (default "TopLayer")
            high_layer: End layer (default "BottomLayer")

        Returns:
            Dictionary with count of vias placed and rectangle/pitch echo
pcb_place_via tool
Place a via at specific coordinates on the active PCB.

        Sizes take fractions of a mil, or millimetres through ``size_mm``
        and ``hole_size_mm``. A hole as wide as the pad is refused.

        Args:
            x: Via X position in mils
            y: Via Y position in mils
            net: Net name to assign (optional, empty = no net)
            size: Via pad diameter in mils (default 50)
            hole_size: Drill hole diameter in mils (default 28)
            low_layer: Start layer (default "TopLayer")
            high_layer: End layer (default "BottomLayer")
            size_mm: pad diameter in mm, used instead of ``size``
            hole_size_mm: hole diameter in mm, used instead of
                ``hole_size``

        Returns:
            Dictionary with placed via position and size (mils)
pcb_place_tracks tool
Place many track segments on the active PCB in ONE IPC round-trip.

        One Altium transaction for the whole list. Past a few hundred,
        pass ``file`` instead, or create them with pcb_apply_geometry_map.

        Args:
            tracks: List of track dicts. Each dict supports:
                x1, y1, x2, y2 (required, mils; decimals are kept)
                width (default 10, mils; decimals are kept, so a 0.1 mm
                rule stays 3.937), layer (default "TopLayer"; "current" =
                the editor's current layer, see pcb_layer_view),
                net_name (optional, empty = no net; a net the board does
                not have skips the track), stub (true marks a track
                shorter than its width as a real stub into a pad or via)
            board_path: The board to place on, taken by its path and
                refused when it is not open; empty acts on the board in
                front, which another session can change between calls.
            file: A JSON file holding the same list, or an object with it
                under "tracks"; in place of tracks.

            Example:
                [
                  {"x1": 5010, "y1": 4785, "x2": 5070, "y2": 4785,
                   "width": 10, "net_name": "NetC8_2"},
                  {"x1": 5070, "y1": 4785, "x2": 5070, "y2": 4862,
                   "width": 10, "net_name": "NetC8_2"},
                ]

        Returns:
            Dictionary with "placed" and "failed" counts, "zero_length"
            (tracks not placed because both ends are the same point),
            "unknown_layers" and "unknown_nets" naming what did not
            resolve, and, when any track took "current", "current_layer"
            and "on_current_layer". Nothing is placed, with error
            STAIRCASE_TRACKS or SHORT_TRACKS, when the tracks on a net
            hold a run drawn as a chain of tiny steps, or a track shorter
            than its own width that is not marked a stub.
pcb_place_vias tool
Place many vias on the active PCB in ONE IPC round-trip.

        One Altium transaction for the whole list; a list of one places
        a single via. Coordinates and sizes keep their decimals. Past a
        few hundred, pass ``file`` instead, or use pcb_apply_geometry_map.

        Args:
            vias: List of via dicts. Each dict supports:
                x, y (required, mils), size (default 50), hole_size
                (default 28), low_layer (default "TopLayer"), high_layer
                (default "BottomLayer"), net (optional, empty = no net);
                size_mm and hole_size_mm in place of size and hole_size
            board_path: The board to place on, taken by its path and
                refused when it is not open; empty acts on the board in
                front, which another session can change between calls.
            file: A JSON file holding the same list, or an object with it
                under "vias"; in place of vias.

        Returns:
            Dictionary with "placed" and "failed" counts, "unknown_layers"
            naming any layer pair and "unknown_nets" any net that did not
            resolve; a via on an unknown net is not placed. Error BAD_VIA,
            with nothing placed, when an entry has a key that is not read
            or a hole that is not smaller than its pad.
pcb_place_arc tool
Place an arc on the active PCB.

        Creates a circular arc segment defined by center, radius, and
        angular range. For many arcs ``pcb_place_arcs`` takes the list
        and resolves each layer and net once.

        Args:
            x_center: Arc center X position in mils
            y_center: Arc center Y position in mils
            radius: Arc radius in mils
            start_angle: Start angle in degrees (default 0)
            end_angle: End angle in degrees (default 360 = full circle)
            width: Arc line width in mils (default 10)
            layer: PCB layer name (default "TopLayer")
            keepout: Mark the arc a keep-out, which routing and pours
                keep clear of. Omitted: on for "KeepOutLayer", off
                elsewhere; True on a copper layer keeps that layer
                clear only.

        Returns:
            Dictionary with placed arc geometry, layer and ``keepout``
pcb_place_arcs tool
Place many arcs on the active PCB in ONE call and one Altium edit.

        Each layer and net name is looked up once for the whole list. Mils,
        decimals kept.

        Args:
            arcs: List of arc dicts. Each dict supports:
                x_center, y_center, radius (required),
                start_angle (default 0), end_angle (default 360),
                and optionally its own width, layer, net, keepout
            width: Line width for every arc that gives none (default 10)
            layer: Layer for every arc that gives none (default
                "TopLayer"). "current" = the editor's CURRENT layer, set
                with pcb_layer_view current_layer; it is read once per call
                and named in the reply, since a click on another layer tab
                between calls moves it.
            net: Net for every arc that gives none (empty = no net); an
                arc on a net the board does not have is skipped
            keepout: Mark the arcs keep-outs. Omitted: on for
                "KeepOutLayer", off elsewhere.
            board_path: The board to place on, taken by its path and
                refused when it is not open; empty acts on the board in
                front, which another session can change between calls.

        Returns:
            "placed" and "failed" counts, "bad_geometry" (radius not above
            0 or a negative width), "unknown_layers" and "unknown_nets";
            "current_layer" / "on_current_layer" when arcs went there.
pcb_place_pads tool
Place many free pads that are all ONE pad, moved, turned and
        named, in ONE call and one Altium edit.

        The pad is described once by the arguments; each item of ``pads``
        only says where it goes. Use for pad arrays, test point rows,
        fiducials, mounting holes.

        Args:
            pads: List of dicts: x, y (required), rotation (degrees,
                default 0), name, and optionally its own layer and net
            shape: "round" (default) / "rect" / "oct" / "roundrect";
                "rectangular", "octagonal", "rounded_rectangular" taken too
            x_size, y_size: Pad size (default 60 mil)
            corner_radius: roundrect corner, percent of half the shorter
                side (default 25)
            hole_size: Drill (0 = SMD). A pad with a hole goes on
                MultiLayer.
            hole_length: Slot length; above hole_size the hole is a slot
                along the pad's X, turned by hole_rotation
            plated: False for a non-plated hole
            mask_expansion, paste_expansion: Manual solder / paste mask
                expansion (omitted = the board's rules)
            layer: Copper layer of an SMD pad (default "TopLayer").
                "current" = the editor's CURRENT layer, read once and named
                in the reply.
            net: Net for every pad that gives none; a pad on a net the
                board does not have is skipped
            units: "mil" (default) or "mm" for every length
            board_path: The board to place on, taken by its path and
                refused when it is not open; empty acts on the board in
                front, which another session can change between calls.

        Returns:
            "placed", "failed", "total", "slots", "unplated",
            "expansions", "property_failures", "unknown_layers",
            "unknown_nets"; "current_layer" / "on_current_layer" when pads
            went there.
pcb_place_text tool
Place a text string on the active PCB.

        Args:
            text: Text content to place
            x: Text X position in mils. With a justification, the point
                the justification names (the centre for "center").
            y: Text Y position in mils, as x.
            layer: PCB layer name (default "TopOverlay"). Common choices:
                "TopOverlay", "BottomOverlay", "TopLayer", "BottomLayer",
                "Mechanical1" and up, or the board's own layer name
            height: Text height in mils (default 60), decimals allowed
            rotation: Rotation angle in degrees (default 0); a justified
                text turns about its justification point.
            stroke: Stroke width in mils; 0 keeps Altium's default.
                To resize existing designators use ``pcb_set_text_style``.
            kind: "stroke" or "truetype"; empty keeps Altium's default.
                font_name, bold, italic or inverted alone ask for truetype.
            stroke_font: "default", "sans_serif" or "serif" (stroke only).
            font_name: TrueType font name, e.g. "Arial".
            bold: TrueType bold.
            italic: TrueType italic.
            justification: top_left, top_center, top_right, center_left,
                center, center_right, bottom_left, bottom_center or
                bottom_right. Makes the text multiline: Altium justifies a
                text only inside its frame, a single-line text ignores it.
            frame_width: Frame width in mils; 0 = as wide as the text's
                longest line, measured on the placed text. A frame narrower
                than a line wraps it at its spaces: Altium grows a frame
                only to the longest word (plus margin).
            frame_height: Frame height in mils; 0 = fitted to the text (all
                its lines).
            inverted: TrueType text cut out of a filled box (silkscreen
                labels). On a justified text the filled box is the frame,
                so frame_width / frame_height make the label larger.
            margin: Inverted margin in mils, the minimum fill round the text.
            mirror: None mirrors a text on a bottom layer (BottomOverlay,
                BottomLayer, BottomSolder, BottomPaste), as Altium's Place
                String does, so it reads right from below. True / False
                force it (True for a bottom mechanical layer). The text
                keeps the box it has unmirrored, so x / y mean the same.

        Returns:
            Dictionary with placed text properties as read back from the
            placed text: height, stroke, kind, font_id, font_name, bold,
            italic, mirror, multiline, justification, frame, inverted,
            margin, location (the frame's corner) and bounds.
pcb_place_fill tool
Place a rectangular copper fill on the active PCB.

        Creates a solid copper rectangle. Useful for thermal pads,
        ground planes, and copper pours in specific areas.

        Args:
            x1: First corner X in mils
            y1: First corner Y in mils
            x2: Second corner X in mils
            y2: Second corner Y in mils
            layer: PCB layer name (default "TopLayer")
            net_name: Net name to assign (optional, empty = no net)

        Returns:
            Dictionary with placed fill coordinates and layer
pcb_start_polygon_placement tool
Start INTERACTIVE polygon pour placement on the active PCB.

        Starts Altium's polygon placement mode; a person then draws the
        outline in Altium. It does NOT make a polygon from coordinates
        (pcb_place_polygon_rect and pcb_place_polygon_board do).

        Args:
            layer: Target copper layer (default "TopLayer")
            net_name: Net to assign to the polygon pour (optional)

        Returns:
            Dictionary confirming polygon placement mode was initiated
pcb_create_design_rule tool
Create a new design rule on the active PCB.

        Args:
            name: Rule name (e.g., "Min Clearance 6mil"). A name already on
                the board is refused (RULE_EXISTS).
            rule_type: "polygon_connect" / "plane_connect" (no value:
                connect_style decides, e.g. scope "IsVia" with "direct"
                so vias never get thermal reliefs; set relief widths
                and gaps afterwards with pcb_set_rule_properties),
            rule_type: "clearance" (value = gap), "width" (value = min,
                max_value/favored_value optional), "via_size" (value = min
                hole), "differential_pairs" (value = min gap, max_value,
                favored_value, max_uncoupled_length),
                "solder_mask_expansion" / "paste_mask_expansion" (value =
                SIGNED radial expansion; negative with scope "IsVia" tents
                vias), "vias_under_smd" (set ``allowed``, not value),
                "length" (value = min length in mils, max_value = max),
                "signal_impedance" (value = min ohms, max_value = max),
                "flight_time_rising" / "flight_time_falling" (value =
                max flight time in ns). These four read their limits back
                in ``limits``; change them later with
                pcb_set_rule_properties. "matched_lengths" (value =
                tolerance in mils; scope a net / pair / xSignal class)
                reads its settings back in ``settings``.
            value: Primary value in mils (the MIN for ranged kinds).
            max_value: MAX for ranged kinds (default 5x value).
            favored_value: Preferred value (default value).
            max_uncoupled_length: differential_pairs only, mils
                (default 1000).
            scope: Query for Scope1, matching the kind: "InNet('GND')",
                "InNetClass('Power')" or "All" for net rules;
                "InDifferentialPair('USB')" or "IsDifferentialPair" for
                pairs (InNet on a pair rule never matches). Bracket
                comparisons: "IsPad And (HoleSize > 3)"; the unbracketed
                form is refused with ``suggested_scope``.
            net_scope: "different_nets" (default), "any_net" or
                "same_net"; ignored by pair, mask and via-in-pad rules.
            allowed: vias_under_smd only: False forbids via-in-pad.
                Omitted means True, Altium's default.
            match_mode: matched_lengths only: "group" (the pairs,
                xSignals and nets in scope against each other, Altium's
                default) or "within_pair" (the two nets of each pair).

        Returns:
            Dictionary with created rule details.

        Component, hole-to-hole and board-outline clearance rules cannot
        be created; existing ones can be changed with
        pcb_set_rule_properties.
pcb_delete_design_rule tool
Delete a design rule by name from the active PCB.

        Args:
            name: Exact name of the design rule to delete

        Returns:
            Dictionary confirming deletion
pcb_get_component_pads tool
Get all pads of a specific PCB component.

        Returns detailed pad information including pin name, position,
        net assignment, size, and hole information.

        DATASHEET DISCIPLINE: Pad name -> pin function mapping comes
        from the footprint, which can be wrong (especially the thermal
        pad on QFN/DFN, which is rarely numbered consistently across
        vendors). Before stating which pin a pad corresponds to,
        cross-check the manufacturer datasheet's mechanical /
        recommended-land-pattern section. The response carries
        `_datasheet_guidance` + `_datasheet_parts`.

        Args:
            designator: Component reference designator (e.g., "U1", "J3")

        Returns:
            Dictionary with "designator", "pads" array (each with name,
            x, y, net, layer, hole_size, top_x_size, top_y_size,
            rotation), "pad_count", plus `_datasheet_guidance` +
            `_datasheet_parts`.
pcb_flip_component tool
Flip a component to the other side of the board (top to bottom
        or bottom to top).

        The part is mirrored left-right about its origin, as seen from the
        top, and Altium changes the rotation it reports. To end at an
        exact place and rotation, use pcb_import_placement with ``side``,
        which sets the rotation after the flip.

        Args:
            designator: Component reference designator (e.g., "U1", "R5")

        Returns:
            Dictionary with designator, old_layer, and new_layer
pcb_align_components tool
Align multiple PCB components along a common edge or center.

        Args:
            designators: Comma-separated component reference designators
                (e.g., "R1,R2,R3,R4")
            alignment: Alignment mode. Options:
                "left" - Align to leftmost X
                "right" - Align to rightmost X
                "top" - Align to topmost Y
                "bottom" - Align to bottommost Y
                "center_x" - Center horizontally
                "center_y" - Center vertically

        Returns:
            Dictionary with alignment result and component count
pcb_snap_to_grid tool
Snap a component to the nearest grid point.

        Rounds the component's X and Y position to the nearest multiple
        of the specified grid size.

        Args:
            designator: Component reference designator (e.g., "U1", "R5")
            grid_size: Grid spacing in mils (default 50)

        Returns:
            Dictionary with designator, old and new positions, and grid_size
pcb_get_diff_pair_rules tool
Get all differential pair routing rules from PCB design rules.

        The routing rules, not the pairs themselves
        (pcb_get_differential_pairs lists those).

        Returns:
            Dictionary with "diff_pair_rules" array (each with name, enabled,
            scope_1, scope_2, comment, descriptor) and "count"
pcb_get_vias tool
Get the vias on the active PCB board.

        Returns via position, pad size, hole size, net assignment, and
        start/end layer. Positions are absolute (not from the board origin).

        Args:
            net: Only this net's vias (exact name). Empty is every via.
                Every via is still looked at; ``obj_query("eViaObject",
                ..., filter="Net=GND")`` reads only the net's own.
            offset, limit: Page a large board; limit 0 returns every match.

        Returns:
            Dictionary with "vias" array (each with x, y, size, hole_size,
            net, low_layer, high_layer), "count" (every via that matches),
            "returned" (on this page), "offset" and "more".
pcb_calc_polygon_area tool
Report the area of each copper polygon on the active board.

        Returns each polygon's overall boundary area in square mils and
        square millimetres, optionally filtered by net and/or layer.
        Useful for estimating copper coverage / plane area.

        Args:
            net: Only polygons on this net (optional).
            layer: Only polygons on this layer name (optional).

        Returns:
            Dict with ``polygons`` (each: name, net, layer, area_sq_mils,
            area_sq_mm) and ``count``.
pcb_set_via_soldermask_relief tool
Open the solder mask round each via's barrel, measured from the
        hole edge, on both sides.

        The opening is the hole plus ``expansion_mils``, written as a
        manual value on both sides (a linked via still stores the bottom
        one) and read back into ``vias_verified``. Vias inside footprints
        are written too (``pcb_set_via_tenting`` leaves them alone). A rule scoped
        ``IsVia`` also covers vias placed later:
        ``pcb_create_design_rule(rule_type="solder_mask_expansion",
        scope="IsVia", value=<mils>)``.

        Args:
            expansion_mils: Mask expansion from the hole edge, in mils.
                Default 4.
            net: Only vias on this net. Empty means every via.

        Returns:
            ``vias_matched``, ``vias_verified``, ``expansion_mils``,
            ``net``, ``from_hole_edge``.
pcb_set_via_tenting tool
Set a board via's own Tenting Top / Bottom flags.

        Tenting holds only on a manual solder mask expansion, so a
        rule-driven via is switched to a manual mask at the values it
        already has (``mask_made_manual``). Every flag is read back. Vias inside
        footprints are skipped: use ``lib_set_via_properties`` in the
        PcbLib.

        Args:
            points: ``[{x, y}]`` in mils; each picks the via whose pad
                covers that point (nearest centre wins).
            net: Without points, every free via on this net; with points,
                only vias on this net are considered.
            top, bottom: True tents that side, False opens it; leave one
                out to keep it as it is.

        Returns:
            ``matched``, ``changed``, ``failed``, ``points_without_a_via``,
            ``footprint_vias_skipped`` and ``vias`` [{x_mils, y_mils, net,
            tenting_top, tenting_bottom, mask_made_manual, ok}].
pcb_get_mech_layer_names tool
Every enabled mechanical layer on the board, and what is on it.

        ``primitive_count`` counts what sits on each layer: 0 is a spare
        layer, -1 not counted. Every enabled layer is listed, shown or
        not (``displayed``). ``kind`` is what the layer is FOR; a kind
        belongs to one layer (a paired kind to the pair), so assigning it
        moves it. ``kind_id`` -1 means this build has no layer kinds.

        Args:
            count_primitives: Count what sits on each layer. The board is
                walked once per enabled layer, so pass False when only
                the names are wanted.

        Returns:
            Dict with ``mechanical_layers`` (each: layer, number, name,
            enabled, displayed, kind, kind_id, partner_layer -- the
            enabled layer it is paired with, or None -- and
            primitive_count),
            ``count``, ``occupied_count``, ``counted_primitives`` and
            ``scanned_to``, the layer number the scan stopped at.
pcb_set_mech_layers tool
Name, enable and kind the mechanical layers of the open BOARD.

        The board counterpart of ``lib_set_mech_layers`` (which refuses
        a PcbDoc). Every change is read back, and one that did not take
        is reported against its layer.

        A kind ending in Top or Bottom belongs to the layer PAIR, stored
        without the side ("Courtyard Top" is pair kind "Courtyard"):
        give both sides in one call and they are paired and given the
        kind. Single kinds such as "Fab Notes" need no partner.

        Read ``pcb_get_mech_layer_names`` first: moving a kind off a
        layer whose ``primitive_count`` is not 0 orphans that geometry
        from anything that finds the layer by purpose.

        Args:
            layers: One dict per layer. Keys: ``layer`` (required, e.g.
                "Mechanical13"), and any of ``name``, ``enabled``
                (bool), ``kind`` (e.g. "Courtyard Top"). A layer with
                none of the three is reported as nothing asked for.
            tidy_pairs: Remove layer pairs no kind justifies. Off by
                default, because it REMOVES pairs.
            timeout: Seconds.

        Returns:
            Dict with ``document``, ``layers`` (each: layer, changed,
            problem), ``changed``, ``failed``, ``kinds_displaced``,
            ``pairs_removed``, ``pairs_tidied`` and ``pairs_scanned_to``.
pcb_get_layer_display tool
Visibility and colour for every layer on the active board.

        Covers signal, plane, mechanical, mask, paste, silk, keepout and
        multilayer. Each entry gives the internal ``layer`` id, the user's
        ``name`` for it, whether it is ``visible``, ``in_stack``
        (a mid layer the stack does not use still reads as displayed), and
        its colour both as Altium's raw integer and as ``color_hex``.

        ``color_hex`` is #RRGGBB; the raw integer is byte-reversed.

        Returns:
            Dict with ``layers``, ``count`` and ``visible_count``.
pcb_layer_view tool
Read the board view, and change it in one call.

        With no arguments it only reads. The reply lists every layer with
        ``visible``, Mechanical17 and up included (enabled ones only), and
        for a mechanical layer ``single_layer_lock``: whether it stays drawn
        in single layer mode (the Ctrl+click lock in View Configuration).
        It also gives ``current_layer`` and ``single_layer_mode``, which is
        enough to put a view back the way it was.

        With a PcbLib in front it reads and changes the library's own
        view, the footprint being edited, never another open board.

        Args:
            show: Layers to display (a list, or text with commas).
            hide: Layers to hide.
            lock: Mechanical layers to keep drawn in single layer mode.
            unlock: Mechanical layers to release from that.
            current_layer: The layer to make current.
            single_layer_mode: True or False to switch single layer mode.

        A layer is a stack name, an id such as "Mechanical21", or the
        user's name of any mechanical layer. Every write is read back:
        ``not_applied`` lists what did not take, ``unknown_layers`` the
        names that matched no layer. View state only; the board is not
        marked modified.
pcb_view tool
Read or set the area of the board the PCB editor shows.

        Save the user's view with ``action="get"``, zoom wherever the work
        needs, then put the view back with ``action="set"`` and the saved
        ``left``, ``bottom``, ``right``, ``top``.

        Args:
            action: "get" (the default) reads the view; "set" zooms the
                editor on the rectangle given.
            left, bottom, right, top: the rectangle for "set", in mils
                (board coordinates, kept to 0.0001 mil).

        Returns:
            ``left``, ``bottom``, ``right``, ``top``, ``width`` and
            ``height`` of the view in mils. After "set" these are read back
            from the editor: Altium fits the rectangle to the window's
            shape, so the view shown is larger than the one asked for on
            one axis. The view moves in fixed steps; "set" also returns
            ``centre_error_mils``, at most half a step. A rectangle
            read by "get" after any zoom puts that view back exactly. On a
            board just opened, "get" reads the view saved in the file, which
            Altium refits to the window on the first zoom. A missing side,
            right <= left or top <= bottom is refused (BAD_RECT). View state
            only; the board is not marked modified.
pcb_set_layer_color tool
Recolour one layer.

        Read back before success is reported. Colour is a display setting
        of the installation, not saved in the board.

        Args:
            layer: Layer name, e.g. "TopOverlay" or "Mechanical13".
            color: Colour as "#RRGGBB".

        Returns:
            Dict with ``layer``, ``color`` and ``color_hex``.
pcb_set_mech_layer_kind tool
Set what a mechanical layer is FOR, not what it is called.

        Naming a layer "Courtyard Top" does not make it one: courtyard
        checks, assembly drawings, 3D bodies and via treatments read the
        KIND. A single kind ("Fab Notes") moves off any layer holding it
        (``cleared_from``). A kind ending in Top or Bottom belongs to a
        layer PAIR and needs ``partner_layer``; it moves off any other
        pair holding it (``pairs_released``). The write is read back.

        Args:
            layer: Mechanical layer, e.g. "Mechanical13".
            kind: e.g. "Courtyard Top", "Assembly Top", "3D Body Top",
                "Fab Notes", "Not Set", or a bare number. Read the
                current kinds with ``pcb_get_mech_layer_names``.
            partner_layer: The layer for the other side; required for a
                Top or Bottom kind.

        Returns:
            Dict with ``layer``, ``kind``, ``kind_id``, ``paired``,
            ``pair_kind``, ``partner_layer``, ``pairs_released`` and
            ``cleared_from``.
pcb_delete_object tool
Delete a PCB object closest to specific coordinates on a layer.

        Finds the nearest matching object within 100 mils of the given
        coordinates and removes it from the board. Distance is to the
        object itself: a track by its segment less half its width, an arc
        by its curve, a via by its centre less its radius, anything else
        by its bounding rectangle (0 inside it). A point anywhere on a
        track finds that track.

        Args:
            x: Target X position in mils
            y: Target Y position in mils
            layer: PCB layer name to search; empty searches every layer,
                which is where a through via, a through-hole pad or a part
                is found (they sit on the multi-layer).
            object_type: Type of object to delete. Options:
                "track" - Track segment
                "via" - Via
                "fill" - Copper fill
                "text" - Text string
                "pad" - Free pad
                "arc" - Arc
                "polygon" - Copper polygon pour
                "region" - Region / split-plane
                "component" - Placed component
                (for bulk/filter-based deletes use ``obj_delete``)

        Returns:
            Dictionary with deleted status, object_type, distance_mils,
            the deleted object's net, layer and bbox_mils, and others_as_close:
            how many other objects were exactly as near, so a pick among
            equals is visible.
pcb_get_pad_properties tool
Get detailed pad information filtered by net or component.

        Returns pad shape, size, hole, thermal relief, and solder/paste
        mask expansion details. Provide at least one filter (net or
        designator) to avoid returning all pads on the board. AT MOST 500
        pads come back, with nothing to say more were left, and every pad
        is looked at: for one part ``pcb_get_component_pads``; for one net
        ``obj_query("ePadObject", ..., filter="Net=GND")``.

        Args:
            net: Filter by net name (e.g., "GND", "VCC"). Optional.
            designator: Filter by component designator (e.g., "U1"). Optional.

        Returns:
            Dictionary with "pads" array (each with name, component, x, y,
            net, layer, shape, top_x_size, top_y_size, hole_size, rotation,
            is_smd, solder_mask_expansion, solder_mask_bottom_expansion,
            solder_mask_separate, paste_mask_expansion) and "count".
            solder_mask_expansion is the TOP side when
            solder_mask_separate is true and both sides when it is false;
            the bottom value is stored either way and takes effect once
            the sides are unlinked. Expansions read 0 when the pad follows
            the board's rule.
pcb_set_track_width tool
Modify track width for all tracks on a specific net.

        Changes the width of every routed track segment assigned to
        the given net. Useful for adjusting power or signal trace widths.
        Tracks only: arcs keep their width (``obj_modify`` on eArcObject
        with ``Net=``). Footprint, pour and dimension tracks are left.

        Args:
            net_name: Name of the net whose tracks to modify (e.g., "VCC")
            width_mils: New track width in mils (e.g., 10, 20, 50)

        Returns:
            Dictionary with net_name, width_mils, and tracks_modified count
pcb_get_unrouted_nets tool
Get list of nets with unrouted connections (ratsnest lines).

        Identifies nets that still have ratsnest lines, meaning they are
        not fully routed. Useful for checking routing completion status.

        Stored connection lines go out of date, so by default Altium
        re-derives them first. ``obj_query`` on ``eConnectionObject`` lists
        each line with its ends.

        Args:
            reanalyze: re-derive the ratsnest before counting (default
                True). False reads the stored lines as they are, faster
                on a large board.

        Returns:
            Dictionary with "unrouted_nets" array (each with net name and
            unrouted_connections count), "net_count", "total_unrouted" and
            "reanalyzed"
pcb_get_polygons tool
Get all polygon pours on the active PCB with copper area.

        Outlines with true arcs: ``pcb_get_copper(kinds="polygon")``; one
        pour's poured copper: ``pcb_get_pour_copper``.

        Each row: ``index``, ``name``, ``net``, ``layer``,
        ``hatch_style``, ``pour_over``, ``poured`` (false when shelved),
        ``vertex_count``, ``bbox_mm2``, and:
          - ``area_sqmils`` / ``area_mm2``: the OUTLINE's area, unchanged
            by the pour and including copper cut away by clearances.
          - ``copper_area_mm2``: copper actually poured (regions minus
            their holes). A hatched pour is tracks, so its region area
            is 0.
          - ``copper_area_exact``: false when holes could not be read;
            the area then overstates the copper.
          - ``copper_pieces``: 0 on a poured polygon means nothing
            poured.

        Returns:
            Dict with ``{polygons: [...], count: N}``.
pcb_get_pour_outline tool
The outline one pour fills (not the copper it poured), arcs included,
        as Altium holds it.

        Args:
            index: The pour's ``index`` from pcb_get_polygons.
            name: Its ``name`` there. Positions shift as pours are added or
                removed, so a pour at ``index`` with another name is refused
                (POUR_CHANGED).

        Returns:
            ``index``, ``name``, ``net``, ``layer``, ``corners``, ``outline``
            (each ``at`` [x, y], and ``arc`` with ``centre``, ``radius``,
            ``from_deg``, ``to_deg`` where the edge is an arc), the
            ``closing_vertex`` and ``closes_on_first`` (a closing vertex off
            the first spikes the poured shape).
pcb_get_pour_copper tool
The copper one pour poured: every piece with its outline and holes.

        Args:
            index: The pour's ``index`` from pcb_get_polygons.
            name: Its ``name`` there. Positions shift as pours are added or
                removed, so a pour at ``index`` with another name is refused
                (POUR_CHANGED). Names repeat on many boards, so the index
                is what picks the pour.

        Returns:
            ``index``, ``name``, ``net``, ``layer``, ``pieces``, ``holes``,
            ``vertices``, ``area_sqmils`` (copper less its holes) and
            ``copper``: one entry per poured region with ``outlines`` and
            ``holes`` (each a list of [x, y] in mils, arcs as Altium
            flattened them) and its ``area_sqmils``. ``strokes`` counts the
            tracks and arcs of a hatched pour, which pcb_get_copper reads.
pcb_embedded_data tool
Keep named text records inside the board file, out of sight.

        Each record is an Altium embedded object on Mechanical1: it is saved
        with the PcbDoc, survives close and reopen, and is neither drawn nor
        selectable on the canvas, so a designer cannot move or delete it by
        accident. The data is plain text: encode JSON or anything else
        yourself; it comes back exactly as written. Not for secrets: anyone
        who opens the file can read it. Several records can share a name
        (another writer may have made one), so read, write and delete act
        on every record with that name, in board order.

        Args:
            action: ``list`` (every record: ``name``, ``length``, ``head`` =
                the first 200 characters, ``layer``), ``read`` (the full
                ``text`` of each record named ``name``), ``write`` (replace
                the text of every record named ``name``, or make one when
                there is none) or ``delete`` (remove every record named
                ``name``).
            name: The record's name, matched exactly (case and spaces
                count). Required for read, write and delete.
            text: The record's text, required for write. Sent unchanged.

        Returns:
            list: ``count`` and ``records``. read: ``found`` and ``records``
            with ``text``. write: ``created``, ``updated``, ``length`` and
            ``exact`` (the text read back equals the text sent). delete:
            ``deleted``. The board is marked modified after a write or a
            delete; save it to keep the change.

        Name and text are Latin-1 (U+0000 to U+00FF): an embedded record
        holds 8-bit text, so other characters are refused here rather than
        stored changed. Encode them first, for example as JSON with
        ``ensure_ascii=True``.
pcb_special_strings tool
List Altium's special strings on the active board, or resolve some.

        A special string is a text such as ``.Layer_Count`` that Altium
        draws as a value (``8``). Read only: nothing is left on the board.

        Args:
            action: ``list`` (default): every special string name Altium
                offers on a board, plus the names that belong to this board
                (for example ``.Total_Thickness(Board Layer Stack)``).
                ``resolve``: the value of each text in ``names``.
            names: For resolve, a ``|`` separated list of up to 200 texts,
                each a name (``.Layer_Count|.Total_Thickness|.Via_Count``)
                or mixed text (``Rev .Layer_Count/.Via_Count``).

        Each text is resolved the only way found to work from a script:
        placed as a temporary free text on the top overlay at the board
        origin, its converted string read, and removed again in the same
        call (one edit). Altium may still mark the board modified and keep
        an undo step that changes nothing.

        Only strings that a free text on a board can show resolve. Part
        strings (``.Designator``, ``.Comment``, a part parameter such as
        ``.Tolerance``) resolve only on a part's own text, and project
        parameters (``.Designer``) only on a board inside a project; on a
        free text they come back unresolved. Layer strings answer for the
        top overlay, where the text sits.

        Returns:
            list: ``count``, ``capped`` (the walk stopped at 2000),
            ``names`` and ``board_names``. resolve: ``count``, ``placed``,
            ``removed`` and ``strings``: per text ``name``, ``value`` (as
            Altium draws it), ``resolved`` (value present and different
            from the name) and ``underlying`` (the text as written, read
            back).
pcb_connected_copper tool
The copper joined to one seed object, found by geometry, not net name.

        Altium's Tab-select grows from the editor's last clicked object and
        cannot be seeded from a script; this walk can. It finds copper of
        another net touching a net (a short), free copper with no net that
        touches it, and what a pour piece connects to. Each object found is
        searched round its bounding box; copper tracks, arcs, vias, pads,
        fills and copper regions join when they share a layer (or one spans
        every layer: a via, a through-hole pad) and Altium measures no gap.

        Args:
            object_type: The seed's object type (e.g. ``pad``, ``track``).
            filter: The generic filter for the seed (e.g.
                ``Component=U1|Name=3``); the first match is the seed.
            pad: Shorthand for a component pad, ``U1.3`` (designator, then
                the pad name after the first dot). Replaces object_type and
                filter.
            limit: The most objects the walk collects; ``capped`` says it
                stopped there. On a busy board a ground net of ~700 objects
                took about 30 s.
            include_objects: Add ``objects``: per object its ``kind``,
                ``layer``, ``net`` and bounding box in mils.
            select: Select every object found (the Selection Filter is
                bypassed for the run and put back afterwards). Otherwise the
                walk changes nothing.
            clear_selection: With select, deselect everything first.

        Returns:
            ``total``, counts per kind (``tracks``, ``arcs``, ``vias``,
            ``pads``, ``fills``, ``regions``), ``nets`` (sorted, unique;
            ``(no net)`` for copper with no net -- poured polygon pieces read
            no net, their net is on their polygon), ``ms``, ``capped``,
            ``selected`` with select, ``objects`` with include_objects.
            NOT_FOUND when the seed matches nothing, NOT_COPPER when it is not
            copper on a signal layer.
pcb_update_free_primitive_nets tool
Design > Netlist > Update Free Primitives From Component Pads.

        Free tracks, arcs, vias, fills and regions with no net that touch a
        component pad take that pad's net, and copper touching them follows,
        as Altium decides. Altium asks "Update free-primitives nets from
        component-pad nets?" in a Confirm box; this tool presses Yes on that
        box, and on nothing else. Without UI Automation it refuses before
        sending anything: a direct bridge call (not through this tool)
        blocks the bridge until someone answers the Confirm box in Altium.

        Returns:
            What the bridge replied: ``no_net_before`` and ``no_net_after``
            (free copper with no net), ``changed_count`` and ``changed``
            (each object that gained a net, at most 200: ``kind``,
            ``layer``, ``net`` and its box ``x1``, ``y1``, ``x2``, ``y2``
            in mils), plus ``prompt_answered``.
pcb_get_copper tool
Read the board's tracks, arcs, vias, regions, fills and pours with
        their geometry, a page at a time. Pours carry their outline in
        ``pts`` (``[x, y]`` per vertex, ``[x, y, cx, cy, r, a1, a2]`` where
        the edge is an arc). Unlike the other tools, lengths here are in
        Altium's internal units: divide by ``coord_per_mil`` in the reply.
        ``v`` is, per kind: track ``[x1, y1, x2, y2, width]``; arc ``[cx,
        cy, r, a1, a2, width]``; via ``[x, y, size, hole]`` with ``low``,
        ``high``, ``sizes`` per layer and its mask; fill ``[x1, y1, x2,
        y2, rotation]``. ``in_polygon``, ``pour`` and ``pour_net`` name the
        pour a piece was poured by.

        The fast bulk board reader: one layer of one kind reads in a
        second or two, where all copper of a busy board takes minutes.
        Narrow it with kinds and layer; every page walks the board again.

        Args:
            kinds: Comma list of track, arc, via, region, fill, polygon;
                read in that order. Empty reads every kind in one pass. An
                unknown kind is refused (BAD_KINDS).
            layer: One layer name, Mechanical17 and up included. Unknown is
                refused (UNKNOWN_LAYER) with the board's layer names.
            selected: Only the selected objects; offset and limit page
                through the selection.
            offset, limit: Paging; ``more`` says whether another page is
                left.

        Returns:
            ``copper`` (one entry per object: ``k`` its kind, ``layer``,
            ``net``, ``comp``, ``keepout`` and its geometry), ``offset``,
            ``count`` and ``more``.
pcb_modify_polygon tool
Modify a polygon pour's properties and its pour options.

        Name the pour by ``name``, ``index`` or both, from
        ``pcb_get_polygons``. Indices shift after every modify and repour,
        so prefer the name: a name alone must belong to exactly one pour
        (AMBIGUOUS_NAME lists the candidates); with an index too, the pour
        at that index must carry the name (POUR_CHANGED). Nothing here
        repours: run ``pcb_repour_polygons`` after (``repour_needed`` says
        so).

        Args:
            index: Polygon index (from pcb_get_polygons output).
            name: Polygon name, case ignored.
            net: New net; an unknown name goes to ``not_applied``.
            layer: New layer name.
            hatch_style: "Solid", "NoHatch", "45Degree" or "90Degree".
            remove_dead: Remove copper islands off the net. None leaves
                it unchanged, as for the next two.
            remove_narrow_necks: Remove necks under the threshold.
            remove_islands_by_area: Remove islands under the area
                threshold.

        Returns:
            ``modified`` (something changed), ``success``, ``index``
            (where the pour was), ``name`` (its name now), ``changed``,
            ``not_applied``, ``repour_needed``, ``note``.
pcb_place_3d_body tool
Place a STEP model on the open PCB as a free 3D body (Place >
        3D Body > Generic STEP Model), not inside a component, e.g. a
        fixture, enclosure or device under test.
        Use this rather than ``lib_link_3d_model``, which writes into a
        library footprint, unless the model belongs to a part.

        Rotation cannot be set from here (``rotation_applied: false``);
        rotate in the editor.

        Args:
            model_path: absolute path to the .step / .stp file.
            x: X translation from the STEP's authored coordinates, in mils.
                Nonzero internal model coordinates are preserved.
            y: Y translation from the STEP's authored coordinates, in mils.
            layer: board layer to attach it to.
            standoff_height: additional model Z translation, in mils. Authored
                Z coordinates are preserved; this is not underside clearance.

        Returns:
            ``{"success", "model_path", "x", "y", "layer",
            "standoff_height", "standoff_applied", "rotation_applied",
            "note"}``; x and y are verified by the change in primitive
            bounds. ``position_verified`` reports that check; ``bounds``
            contains the placed outline bounds. No body X/Y member is used.
            This verifies XY only. ``standoff_applied`` reports a model Z write,
            not an independent Z readback; inspect the 3D view before use.
pcb_place_extruded_body tool
Place an extruded 3D body on the open PCB: an outline lifted
        from ``standoff_height`` to ``overall_height``.

        A clearance volume, an enclosure feature, or the body of a part
        with no STEP model (a STEP model is preferred when there is one).

        Args:
            overall_height: top of the body above the board, mils.
            points: outline ``[{x, y}]`` or ``[[x, y]]`` in mils, three or
                more vertices, decimals kept; or leave it out and give the
                rectangle x1, y1, x2, y2.
            x1, y1, x2, y2: opposite corners in mils when no points.
            standoff_height: underside above the board, mils (default 0).
            layer: the layer the body belongs to; a bottom layer makes it
                project from the bottom side.
            identifier: a name to find the body again by.
            color: Altium TColor integer.
            opacity: 0 (clear) to 1 (solid).

        Returns:
            ``placed``, ``outline``, ``standoff_height``,
            ``overall_height``, ``identifier`` and ``layer`` read back
            from the body, and ``*_applied`` for each optional property.
pcb_get_room_rules tool
Get all room-like rules (confinement constraint design rules).

        The confinement rules, not room objects. Bounds in mils.

        Returns:
            Dictionary with "room_rules" array (each with name, enabled, kind,
            scope_1, comment, x1, y1, x2, y2) and "count"
pcb_create_room tool
Create a room for component grouping on the active PCB.

        Creates a confinement constraint rule that defines a rectangular
        region. Components can be assigned via scope expression.

        Args:
            name: Room name (e.g., "Power Section", "USB Block")
            x1: First corner X in mils
            y1: First corner Y in mils
            x2: Second corner X in mils
            y2: Second corner Y in mils
            components: Comma-separated component designators to confine
                (e.g., "U1,U2,R1,R2"). Optional; empty = applies to all.

        Returns:
            Dictionary with created status, name, coordinates, and scope
pcb_get_board_statistics tool
Get comprehensive statistics for the active PCB board.

        Returns counts of all object types, total trace length, board
        dimensions, and layer count. Useful for design reviews and
        progress tracking.

        Returns:
            Dictionary with track_count, via_count, pad_count,
            component_count, fill_count, text_count, polygon_count,
            unrouted_connections, total_trace_length_mils,
            board_width_mils, board_height_mils, board_area_sq_mils,
            layer_count, and board_name. ``unrouted_connections``
            counts stored ratsnest lines, which can be out of date;
            pcb_get_unrouted_nets re-derives them first.
pcb_export_coordinates tool
Export component placement coordinates formatted for pick-and-place (like `pcb_get_components`, but the pick-and-place shape: adds side, omits bbox detail).

        Returns designator, footprint, comment, position (x, y),
        rotation, layer, and side (Top/Bottom) for every component.
        Useful for manufacturing pick-and-place machine programming.

        Returns:
            Dictionary with "placements" array (each with designator,
            footprint, comment, x, y, rotation, layer, side) and "count"
pcb_create_diff_pair tool
Create a differential pair object from two existing nets.

        Both nets must exist on the board.

        A PAIR MADE ONLY ON THE BOARD IS REMOVED BY THE NEXT SCHEMATIC
        SYNC. To keep it, define it in the schematic too: net names ending
        _P/_N with a DifferentialPair directive (sch_add_directive).

        Args:
            positive_net: Positive-side net name (e.g. "USB_DP")
            negative_net: Negative-side net name (e.g. "USB_DM")
            name: Optional diff-pair name (defaults to "<pos>_<neg>")

        Returns:
            Dictionary confirming creation with name, positive_net, negative_net
pcb_place_region tool
Place a solid copper region on a rectangle or a polygon outline.

        A solid shape, connected only if given a net. For a ground pour
        use pcb_place_polygon_rect.

        Args:
            x1, y1, x2, y2: Opposite corners in mils (any order); not used
                when points is given
            layer: Copper or mech layer (default "TopLayer")
            net: Optional net assignment
            points: Optional outline, ``[{x, y}]`` (or ``[[x, y]]``) in
                mils, three or more vertices in order, decimals kept; the
                outline closes by itself. A vertex given as ``{x, y, sweep}``
                (or ``[x, y, sweep]``) makes the edge from it to the next a
                true arc of ``sweep`` degrees, counterclockwise when
                positive, as in lib_add_footprint_regions
            name: Optional region Name, a tag to find the region again by
                (``obj_query`` filter ``Name=...``); avoid ``=`` and ``|``,
                which split a filter

        Returns:
            Dictionary confirming the region placement, with the ``name``
            read back from the region; with points, also ``vertices`` and
            ``points``, the outline read back from the placed region in mils;
            with arcs, ``arc_edges`` and ``shape``, ``[x, y, sweep]`` per
            vertex read back
pcb_get_dimensions tool
Read the board's dimensions: kind, position, references, callouts.

        Each dimension's ``references`` say whether Altium bound that end to
        a board object (``bound``: it follows the pad or arc when that
        moves). ``texts`` are the callouts as drawn. Kinds: linear, angular,
        radial, leader, datum, baseline, center, original, linear_diameter,
        radial_diameter, each with its own values (angle, size, radius,
        sector, label, shape, text_locations).

        Args:
            index: One dimension by its index; -1 (default) reads all.
            pieces: Also list the tracks, arcs and texts it is drawn from.

        Returns:
            ``count`` (dimensions on the board) and ``dimensions``.
pcb_dimension_bindings tool
Which dimensions have ends bound to board objects.

        A bound end follows its pad or arc when that moves. pcb_edit_dimension
        refuses to change a bound dimension's geometry unless told to unbind
        it, after which it no longer follows. A radial or diameter is bound
        to its arc and is never unbound (free, it reads 0).

        Returns:
            ``bound``: each bound dimension's index, kind, x, y and how many
            of its references are bound; ``count`` dimensions on the board.
pcb_create_dimension tool
Draw a measuring dimension from points: Altium works out the value.

        Its ends are FREE points: they do not follow a pad that moves later
        (a script cannot bind them; dragging an end onto a pad in Altium
        does). A radial needs that binding (free, it draws 0), so a radius
        is drawn as a leader from the arc labelled "R <radius>": right when
        placed, not following the arc after. A diameter is refused.

        Args:
            kind: linear, angular, radial, leader, datum, baseline, center,
                original.
            points: [x, y] pairs. linear: the two points. angular: vertex,
                one point on each line. radial: the arc's centre, and the
                point on the arc to call out from unless radius is given.
                leader: tip, bends, end. datum: origin, then each point.
                baseline: base, then each point. center: the centre.
                original: start, end.
            layer: Layer to draw on (default TopOverlay).
            angle: Measuring direction in degrees (linear, datum, baseline;
                the cross's turn on a center).
            offset: How far the line (linear), callout row (datum) or first
                line (baseline) sits from the points.
            spacing: Distance between a baseline's lines.
            label, shape: A leader's text and frame (none, round, square).
            radius, sector: An angular's arc radius and which of the four
                angles (1-4); the radius a radial calls out.
            size: A center mark's size.
            text_height, line_width, unit (mil, mm, deg), precision,
                prefix, suffix: The callout's style.

        Returns:
            ``created`` and the new ``dimension`` as pcb_get_dimensions
            reads it (its ``index`` for pcb_edit_dimension).
pcb_edit_dimension tool
Change a dimension: its points, position, angle or style.

        A dimension with ends bound to board objects (pcb_dimension_bindings)
        is refused for geometry changes while keep_bindings is true. With
        keep_bindings=false its ends are unbound first: it is then drawn as
        before but NO LONGER FOLLOWS the pad or arc it was bound to (fine
        when the drawing is redone by a tool anyway; rebind by dragging an
        end onto the object in Altium). keep_bindings=false alone just
        unbinds. A radial or diameter keeps its arc: only style changes.

        Args:
            index, x, y: The dimension, as pcb_get_dimensions gives it; x, y
                must still match (a stale index is refused).
            keep_bindings: False unbinds bound ends (see above).
            points: New points, as pcb_create_dimension takes them.
            dx, dy: Move the whole dimension.
            angle, offset, spacing, label, shape, radius, sector, size,
                text_height, line_width, unit, precision, prefix, suffix:
                As in pcb_create_dimension.

        Returns:
            ``edited``, ``unbound`` (references released) and the
            ``dimension`` as read afterwards.
pcb_place_pad tool
Place a standalone pad on the active PCB.

        Not part of any component. Use for fiducials, test points,
        mounting holes. Set hole_size=0 for surface-mount pads,
        nonzero for through-hole. For many pads ``pcb_place_pads``
        takes the list and resolves each layer and net once.

        Args:
            x, y: Position in mils
            name: Pad designator / label (optional)
            net: Net to connect to (optional); one the board does not
                have is refused and nothing is placed
            shape: "round" (default) / "rect" / "oct", or spelled out as
                the library tools take them ("rectangular", "octagonal").
                Any other word is refused.
            x_size, y_size: Pad dimensions (default 60 mil)
            hole_size: Drill diameter (0 = SMD)
            layer: Copper layer (default "TopLayer")
            units: "mil" (default) or "mm", for the position and every
                size, kept exact rather than rounded to whole mils.

        Returns:
            Dictionary confirming pad placement
pcb_place_components tool
Place one or many footprints from PcbLibs onto the board in ONE call.

        The unattended stand-in for the ECO (which always raises a modal):
        one Altium transaction for the whole list.

        Per part: **geometry only** (no ``unique_id`` / ``pad_nets``)
        leaves pads unconnected; **synced** (both) stamps the schematic
        UniqueId so a later ECO matches the part, and sets each pad's net.
        Read ``unique_id`` with ``obj_query`` (``eSchComponent``,
        "Designator.Text,UniqueId") and ``pad_nets`` from
        ``proj_get_connectivity_many``.

        Args:
            placements: List of placement dicts, each with:
                footprint (required), library_path (required, .PcbLib),
                x, y (mils, decimals kept), designator, lib_reference, comment,
                rotation, layer, unique_id, and pad_nets
                (``{pad_name: net_name}``); omit unique_id/pad_nets for
                geometry-only, include them for a synced placement.
                The designator and comment texts: ``name_shown`` /
                ``comment_shown`` (bool), then optionally ``_layer``,
                ``_height``, ``_stroke`` (mils), ``_angle``, ``_mirror``
                (bool) and ``_x``, ``_y`` (mils, where the middle of the
                text lands), e.g. ``name_height``. Without ``*_shown`` the
                text keeps the footprint's defaults.
            board_path: Absolute .PcbDoc path to place onto (optional).

        Returns:
            Dict with ``placed`` (count), ``failed`` (count), ``total``,
            ``label_layers_unknown`` (texts whose layer was not found).
pcb_distribute_components tool
Evenly space components along an axis.

        Moves each named component so its X (or Y) coordinate lands at
        equally-spaced stops from `start` to `end`. Order follows the
        designators list, designators="R1,R2,R3" with start=0 end=200
        places R1 at 0, R2 at 100, R3 at 200 on the chosen axis. Y (or X)
        is untouched.

        Args:
            designators: Comma-separated list of component designators
            axis: "x" or "y" (default "x")
            start: First position in mils
            end: Last position in mils

        Returns:
            Dictionary with distribution result
pcb_get_rule_properties tool
Read a named PCB design rule: name, rule_kind, enabled,
        priority, and a ``descriptor`` string holding the constraint
        values as Altium words them, e.g.
        ``"Clearance Constraint (Gap=0.127mm) (All),(All)"``. Parse it
        for numbers.

        To CHANGE a constraint use ``pcb_set_rule_properties``;
        ``obj_modify`` reports a match and changes nothing.

        A clearance-family rule also returns ``gap_mm`` from the rule
        itself; for Board Outline Clearance the descriptor says
        ``Gap=0mil`` whatever the rule holds, so read ``gap_mm``.

        Args:
            name: Design rule name (e.g., "Clearance", "Width", "RoutingVias").

        Returns:
            Dict with name, rule_kind, enabled, priority, descriptor, and
            gap_mm for a clearance-family rule.
pcb_set_rule_properties tool
design_validate_plan tool
Validate a candidate DesignPlan JSON against the schema, cross-check
        references, and run offline ERC-lite. Returns ``{"ok": True,
        "summary": ...}`` or ``{"ok": False, "errors": [...]}``.
design_review_plan tool
One-call offline pre-flight for a DesignPlan: bundles stats, ERC-lite,
        recognised circuit behaviour, auto-derived placement constraints, and
        net classes -- everything the planner would otherwise call one by one.
proj_create tool
Create a new, empty Altium project, made and saved by Altium.

        The file's extension decides the kind: .PrjPcb a PCB project,
        .PrjHar a harness project (then add a wiring diagram with
        app_create_document kind "HarnessWiringDiagram" and a .WirDoc
        path), .LibPkg an integrated library package. An existing file is
        refused, never overwritten: open it with proj_open.

        Args:
            project_path: Full path for the new project file.
            project_type: Not needed; the extension decides the kind.

        Returns:
            Dictionary with created project information
proj_open tool
Open an existing Altium project.

        Args:
            project_path: Full path to the project file

        Returns:
            Dictionary with opened project information
proj_save tool
Save the current or specified project.

        Args:
            project_path: Optional path to specific project. If None, saves active project.

        Returns:
            Dictionary confirming save operation
proj_close tool
Close a project, saving its documents (default) or discarding
        their unsaved edits (save=False).

        Altium closes the FOCUSED project, so this focuses the named one
        first and refuses if it cannot; if any other project closes, it
        stops and reports it as ``closed_instead``. Without saving, it
        clears each member's modified flag so no save prompt appears; if
        one appears anyway it answers "Save None" then "OK", but only
        when every listed document belongs to this project. A prompt
        that lists another project's documents is cancelled, in either
        mode, and the close reported as not done with
        ``foreign_documents``. A document shared with another
        open project loses its edits too. A prompt left open blocks the
        bridge: answer it with app_press_dialog_button.

        Args:
            project_path: Project to close; omit for the focused one (a
                save=False prompt is then left for a human).
            save: Write modified documents first (True) or discard (False).

        Returns:
            ``success``, ``closed`` (checked by looking again),
            ``project_path``; ``prompts_answered`` and ``discarded`` when a
            prompt was answered, ``prompt`` and ``reason`` when one was
            left; otherwise ``discarded`` (members closed unsaved, not
            proof of edits) and ``attempts``.
proj_list_documents tool
List all documents in a project.

        Args:
            project_path: Optional path to specific project. If None, uses active project.

        Returns:
            List of document information dictionaries containing:
            - file_name: Document file name
            - file_path: Full file path
            - document_kind: Type of document
proj_add_document tool
Add an existing document to a project.

        Args:
            document_path: Full path to the document to add
            project_path: Optional project path. If None, uses active project.

        Returns:
            Dictionary confirming the operation
proj_remove_document tool
Remove a document from a project.

        Note: This only removes the document from the project, it doesn't delete the file.

        The project file is saved and read back. Altium's save keeps the
        old [DocumentN] sections, so a removed document would come back
        on reopen. When the file lists more than the project holds,
        Altium saves the project as a copy, the original is deleted and
        Altium saves the project back onto no file, which writes only its
        documents. No dialog. A list of items rewrites the file once.

        Args:
            document_path: Full path to the document to remove
            project_path: Optional project path. If None, uses active project.
            save_project: Write the .PrjPcb so the removal lasts (default).
                False leaves it for a later proj_save.

        Returns:
            ``removed`` (gone from the project in memory),
            ``project_saved``, ``in_project_file`` (the file on disk
            still lists it, with ``project_file_entry``) and
            ``stale_sections`` when the file was rewritten (``before``,
            ``after``, ``copy_kept`` naming the copy when the rewrite
            could not finish). ``success`` is true only
            when the file no longer lists it.
proj_rename_document tool
Rename a project document, keeping the project and its sheet
        symbols pointing at it.

        Altium saves the document under the new name in the same folder
        (its Save As, unsaved edits included), the project entry follows
        it, every sheet symbol in the project whose file name names the
        old file is changed to the new one, and the project is saved and
        compiled. The old file is left on disk. Refused when the new
        name exists, changes the extension, or the document is in no
        open project.

        Args:
            document_path: Full path of the document.
            new_name: The new file name (extension optional, same kind).
            project_path: The project; defaults to the one holding it.

        Returns:
            ``old_path``, ``new_path``, ``project_path``, ``in_project``,
            ``old_entry_left``, ``entry_moved_last`` (Altium did not move
            the entry, so it was added again at the end),
            ``sheet_symbols`` changed (sheet and new file name),
            ``sheet_symbols_not_changed``, ``project_saved``; ``success``
            when the project lists only the new name and every symbol
            took the change.
proj_get_parameters tool
Get all parameters defined at the project level.

        Args:
            project_path: Optional project path. If None, uses active project.

        Returns:
            List of parameter dictionaries with name and value
proj_set_parameter tool
Set a project-level parameter, new or existing, and write the
        project file (only that file).

        Args:
            name: Parameter name
            value: Parameter value
            project_path: Optional project path. If None, uses active project.

        Returns:
            Dictionary confirming the operation
proj_remove_parameter tool
Remove a project-level parameter and write the project file
        (only that file).

        Args:
            name: Parameter name (exact).
            project_path: The .PrjPcb. Defaults to the focused project.

        Returns:
            ``removed`` (read back), ``parameters_before`` /
            ``parameters_after`` and ``project_file_saved``. A name the
            project does not have is refused (NOT_FOUND).
proj_push_parameters tool
Copy all project-level parameters onto each loaded schematic sheet.

        Every project parameter is written as a document (sheet) parameter on
        each LOADED schematic in the focused project, so title blocks can
        reference project-wide values. Unloaded sheets are skipped -- call
        ``proj_load_sheets`` first to include every sheet.

        Returns:
            Dict with param_count, sheets_updated, sheets_skipped_not_loaded,
            and params_pushed.
proj_get_nets tool
Get net-to-pin connectivity from the compiled project netlist.

        For more than one component or net, do NOT loop: call once with
        no filters (raise ``limit``) and slice locally. Each call
        compiles the project, about 700 ms.

        Args:
            component: Filter by component designator. Empty = all.
            net_name: Filter by net name; * and ? match any run and
                one character (SD*), case ignored. Empty = all.
            project_path: Optional project path. If None, uses active.
            limit: Max pin records (default 500); 0 lists every pin.
            force_recompile: Save dirty docs and recompile from scratch
                (5-10 s more), for a netlist that is surely fresh, e.g.
                after the user edited sheets. ``proj_get_compile_freshness``
                tells whether any doc is dirty.

        Returns:
            Dict with "pins", "count", "limit", "limit_hit" (true when
            the list stopped at ``limit`` with pins left over) and
            "skipped_nil" (entries Altium returned empty).
proj_export_netlist tool
Write the compiled connectivity to a flat netlist file.

        "pads" (PADS-PCB ASCII) or "tabular" (component,pin,pin_name,net
        CSV). Single-pin and unnamed nets are included.

        Args:
            output_path: Destination file. Defaults to
                workspace/netlist.<ext> if omitted.
            net_format: "pads" (default) or "tabular".
            project_path: Optional project path; uses active if omitted.

        Returns:
            Dictionary with output_path, net_format, net_count, node_count.
proj_compile tool
Compile a project to check for errors.


        Args:
            project_path: Optional project path. If None, uses active project.

        Returns:
            Dictionary with compilation results including any errors/warnings
proj_load_sheets tool
Load every schematic sheet of a project into the Altium editor.

        Project-scope queries and edits see only loaded sheets
        (``loaded`` in app_list_documents); call this first. Safe to
        repeat.

        Args:
            project_path: Optional project path. If None, uses focused project.

        Returns:
            Dictionary with:
            - total_sheets: Total SCH sheets in the project
            - loaded: Sheets newly loaded by this call
            - already_loaded: Sheets that were already resident
            - failed: Sheets that could not be opened
proj_export_jlc_assembly tool
Write the BOM and pick-and-place (CPL) files JLCPCB assembly takes.

        BOM: Comment, Designator, Footprint, LCSC Part #, one row per part
        kind. CPL: Designator, Mid X, Mid Y (mm, from the board origin, as
        Altium's own pick-and-place and the Gerbers), Layer (Top/Bottom),
        Rotation (degrees, as Altium shows it). Read from the board and the
        compiled project, so nothing is copied by hand.

        Mid X/Y is each part's ORIGIN: right for a footprint whose origin
        is its centre (every footprint lib_create_footprint_from_package
        makes); a part with its origin elsewhere is placed off by that much.
        Rotations follow Altium; JLC's preview shows each part on its pads,
        so check polarised and bottom-side parts there before ordering.

        Args:
            output_dir: folder for the two files (made when missing).
            lcsc_parameter: the parameter holding the LCSC number. Empty
                tries "LCSC Part #", "LCSC Part Number", "LCSC", "LCSC Part",
                "JLCPCB Part #".
            name: file name stem; default the board's name.
            not_placed: designators meant to be left off the assembly
                (fitted by hand, not fitted). Any other part without an
                LCSC number refuses the export.
            board_path: the .PcbDoc to export. Empty uses the only open
                board; with several open the export is refused until one
                is named.

        Returns:
            ``bom_path``, ``cpl_path``, ``parts``, ``bom_rows``,
            ``without_lcsc`` (designators with no LCSC number) and
            ``origin_mils``.
proj_get_bom tool
Export a full BOM from the compiled project.

        DATASHEET DISCIPLINE: library metadata is NOT authoritative; read
        a part's datasheet before drawing conclusions about it
        (``_datasheet_guidance`` has search queries).

        Every component with designator, comment, footprint, library
        reference and pin nets.

        With ``variant``, the BOM is the one that variant builds: its
        not-fitted parts leave ``components`` (listed in ``not_fitted``),
        an alternate part takes the alternate's library reference and
        footprint (``alternate`` holds its library link), and varied
        parameter values replace the base ones (``varied_parameters``;
        a varied Comment becomes ``comment``). An alternate keeps the base
        comment unless the variant varies it.

        Args:
            project_path: Optional project path. If None, uses active project.
            limit: Max components to return (default 1000).
            variant: A variant's name or description. Leave empty for the
                base design.

        Returns:
            Dictionary with "components" array and "count", "limit",
            "limit_hit" (true when the list stopped at ``limit`` with
            components left over), "skipped_nil", plus
            `_datasheet_guidance` + `_datasheet_parts`. With ``variant``
            also ``variant``, ``not_fitted``, ``alternates``, ``varied``
            and ``entries_not_in_bom``; each component carries
            ``variation`` (none, fitted or alternate).
proj_get_component_info tool
Get full information about one placed component.

        Pin nets need a project compile (30-60 s on a large project);
        with_pin_nets=False answers in under a second.

        DATASHEET DISCIPLINE: parameters and comment are not
        authoritative; fetch the datasheet before stating pin functions
        or ratings.

        Args:
            designator: e.g. "U1".
            project_path: Project (default: the active one).
            with_pin_nets: Compile and give each pin's net (default True).
            with_parameters: Include parameters (default True).
            timeout: Poll timeout in seconds (raise to ~90 with pin nets
                on large projects).

        Returns:
            designator, comment, footprint, lib_ref, sheet, ``pins``
            [{pin, name, net?}], ``parameters`` when asked, and
            ``_datasheet_guidance``.
proj_get_component_info_many tool
Full per-component info for MANY designators in ONE round-trip.

        One compile for the whole list (a list of one for a single part).
        ``with_pin_nets=False`` skips the compile for a sub-second read.

        Parameters and library metadata are not authoritative: read the
        manufacturer datasheet before reasoning about pin functions,
        ratings or behaviour (see `_datasheet_guidance`).

        Args:
            designators: List of component designators.
            project_path: Optional project path. If None, uses active.
            with_pin_nets: When True (default) compile once and emit
                the flattened net for each pin on every component.
                Set False to skip the compile.
            with_parameters: When True (default) include each
                component's parameter dict.
            timeout: Optional bridge poll-timeout override (seconds).
                Raise this when keeping `with_pin_nets=True` on large
                hierarchical projects.

        Returns:
            Dict with components[], matched, requested, not_found[],
            plus `_datasheet_guidance` + `_datasheet_parts`.
proj_export_pdf tool
Open Altium's PRINT dialog for the active document, for a PDF.

        NOT UNATTENDED. This opens the print preview / print setup dialog
        with the user's real printer selected and a live Print button,
        and blocks the bridge until a person finishes or cancels it; a
        wrong press prints paper. ``written`` says whether the PDF exists
        afterwards. For a PDF with nobody at the machine, run an OutJob
        container whose medium is PDF (proj_list_outjob_containers, then
        proj_run_outjob).

        Args:
            output_path: Full path for the output PDF file

        Returns:
            Dictionary confirming export
proj_cross_probe tool
Jump to and highlight a component in the schematic or PCB.

        Args:
            designator: Component designator to find (e.g., "U1", "R8")
            target: "schematic" or "pcb"

        Returns:
            Dictionary confirming the operation
proj_get_stats tool
Get design statistics from the compiled project.

        Returns counts of sheets, components, pins, and nets.

        Args:
            project_path: Optional project path. If None, uses active project.

        Returns:
            Dictionary with sheets, components, pins, nets counts
proj_get_board_info tool
Get PCB board information, outline vertices, layer stack, origin.

        It answers about ANY open board when none is focused. Check
        ``board_path`` (the board that answered), or focus the board you
        mean first.

        Returns:
            Dictionary with origin_x, origin_y, board_path, outline
            (vertex array), and layers (active copper layer names)
proj_annotate tool
Annotate schematic designators programmatically, no dialog, no user interaction.

        Numbers every unlocked component on every sheet in the chosen
        order, per prefix (R1, R2, ... C1, ...), keeping each prefix ("R?"
        and "R13" both stay R). Locked designators are skipped. Undoable.

        Args:
            order: Annotation traversal order:
                   "down_then_across" (default: row-major top-to-bottom, left-to-right)
                   "up_then_across"   (row-major bottom-to-top, left-to-right)
                   "across_then_down" (column-major left-to-right, top-to-bottom)
                   "across_then_up"   (column-major left-to-right, bottom-to-top)
                   "none"             (reset all designators to "<prefix>?")

        Returns:
            Dictionary with:
              - success: True
              - order: the order that was applied
              - renamed: count of components renumbered
              - reset: count reset to "?" (only for order="none")
              - skipped_locked: count of locked components left untouched
              - documents_processed: count of schematic sheets visited
              - programmatic: True (marks this as the non-interactive path)
proj_run_output tool
Generate manufacturing output files from the active PCB.

        Note: These may open Altium's export dialogs for configuration.

        Args:
            output_type: Type of output, "gerber", "drill", "pick_place", "ipc_netlist"
            output_path: Optional output directory/file path

        Returns:
            Dictionary confirming generation
proj_get_focused tool
Get information about the currently focused project.

        Returns:
            Dictionary with project information:
            - project_name: Name of the project
            - project_path: Full path to the project file
            - document_count: Number of documents in the project
proj_export_step tool
Export a board to a STEP 3D model with Altium's own exporter.

        First with no dialog, on the options last used in File > Export >
        STEP 3D (``route: "exporter"``). If that writes nothing, through
        File > Export > STEP 3D, answering its three dialogs (``route:
        "dialogs"``, with ``exporter_reason``); any other dialog stops it.
        ``generated`` is true only when a new file is at output_path.

        Args:
            output_path: Full path for the .step file.
            board_path: Focus this .PcbDoc first; it must then be the
                board in front, since the export acts on the front view.
                Omit it to export the board already in front.
            overwrite: Replace an existing file. Off by default, so an
                earlier export is never lost by accident.
            options: Exporter settings to apply first, by the names
                ``proj_step_export_options`` reads (``folded``,
                ``fold_rate``, ``copper_option``, ``holes_option`` ...).
                Altium keeps them for later exports, as the dialog does.
                Applied on the exporter route only.

        Returns:
            ``generated``, ``output_path``, ``size_bytes``, the board that
            was exported (``front_document``) and every dialog answered.
proj_create_outjob tool
Give a project an OutJob by copying one in the user's own style.

        It invents no outputs: it copies an existing OutJob (the user's
        own, or one Altium ships), points each output at this project's
        documents, writes every container to ``output_dir``, and adds the
        copy to the project. Altium saves the project's file itself, so
        when Altium does not save, the project gets none. Run it afterwards
        with proj_run_outjob or proj_generate_fab_package.

        ASK THE USER FIRST. With no ``source_outjob`` nothing is written:
        the reply lists the OutJobs found in open projects. Ask the user
        which one to copy, or how they prefer their outputs (Gerber
        format and units, drill files, pick-and-place, BOM, folders) and
        pick the closest. Altium's own templates are a fallback, used
        only with ``use_fallback`` once the user has agreed. While the
        dashboard's Saving switch is off it is refused and writes nothing.

        Args:
            project_path: The target .PrjPcb.
            source_outjob: The .OutJob to copy.
            outjob_name: File name for the copy; defaults to the source's.
            output_dir: Absolute folder for the outputs; defaults to
                "Project Outputs for <project>" beside the project.
            use_fallback: With no source, copy Altium's shipped
                Fabrication template. Only once the user has agreed.

        Returns:
            ``outjob_path``, the ``outputs`` it holds, which documents
            were ``retargeted`` and which were left ``unmapped``, and the
            containers Altium reads back from it.
proj_export_dxf tool
Export the active PCB to DXF (AutoCAD) format.

        Requires an active PCB document. If output_path is omitted,
        Altium may show a file-save dialog.

        Args:
            output_path: Full path for the output .dxf file (optional)

        Returns:
            Dictionary confirming the export
proj_export_image tool
Export a schematic sheet or a board to PDF, PNG, JPG or BMP.

        WITH ``document_path``: that .SchDoc or .PcbDoc is printed by
        Altium whatever is in front, loaded or not, with no dialog. A
        temporary one-output OutJob in the bridge's workspace is added to
        the document's project, its PDF container is run, and it is taken
        out again; the project's file and folder are not written, and the
        document in front is put back. Altium may still show the project
        as modified. A board gives two pages, top and bottom mirrored;
        png / jpg / bmp are ``page`` of that PDF at ``dpi``. The project
        must be open; a free document has no route here.

        WITHOUT it: the FOCUSED document, PDF only, through Altium's
        Print, which on some builds opens the print preview and waits.
        An old file at ``output_path`` is deleted first.

        Args:
            output_path: Full path of the file to write; its folder must
                exist. An old file there is replaced.
            format: "pdf" (default), "png", "jpg" or "bmp".
            width, height: Unused.
            document_path: Full path of the .SchDoc / .PcbDoc to print.
            project_path: Its open .PrjPcb, when more than one open
                project lists the document.
            dpi: Picture resolution, 20 to 1200.
            page: The PDF page to draw, from 1.

        Returns:
            With ``document_path``: ``success``, ``output_path``,
            ``format``, ``kind``, ``project_path``, ``pages``,
            ``file_size_bytes``, ``width_px`` / ``height_px`` for a
            picture, ``outjob_removed``, ``restored_front``; ``error`` and
            ``details`` when nothing was written, with ``outjob_left``
            when the temporary OutJob could not be taken out. Without:
            the path, ``file_exists`` and ``file_size_bytes``.
proj_list_outjob_containers tool
List all output containers defined in an OutJob file.

        Run one with `proj_run_outjob`.

        Args:
            outjob_path: Path to the .OutJob file. If omitted, uses the
                         first OutJob found in the focused project.

        Returns:
            Dictionary with "outjob_path" and "containers" array (each:
            name, type, outputs, output_names, output_path, output_dir,
            index), read through Altium's OutJob API.
proj_run_outjob tool
Execute a specific output container from an OutJob file.

        Containers are listed by `proj_list_outjob_containers`; both
        generated-file and publish (PDF) containers run.

        SUCCESS MEANS A FILE WAS WRITTEN under ``output_dir`` after the
        run started; a container bound to a managed release or with its
        outputs off runs cleanly and writes nothing. Output written
        elsewhere reads as ``success: false``, and ``reason`` says what
        was examined.

        The OutJob is opened if needed and made the ACTIVE document
        first: Altium writes nothing for a container whose OutJob is
        not active. A dialog Altium raises during the run (an error
        after the files are out, say) comes back as ``dialog`` with the
        files found so far, not as a bare failure; close it before the
        next call. An error Altium raises without a dialog comes back as
        ``run_raised`` with the files found. OutJobs an earlier run
        opened are closed first, unless they have unsaved changes.

        Args:
            container_name: Name of the output container to execute
            outjob_path: Path to the .OutJob file. If omitted, uses the
                         first OutJob found in the focused project.
            fresh_window_seconds: files modified up to this many seconds
                before the run started still count as written, for file
                systems with coarse timestamps. Default 5s.
            fab, fab_tier, outer_oz: the fab the files go to
                (design_list_fab_vendors), its tier and the finished outer
                copper in oz. A container writing Gerber, NC drill, ODB++
                or IPC-2581 is not run until the board is inside that
                fab's published limits (``fab_check``).
            fab_limits: with fab "custom", the user's own figures in mils
                (min_track, min_gap, min_drill, min_annular_ring,
                min_hole_to_hole, min_mask_sliver, copper_to_edge;
                copper_layer_counts a list), for a fab with no data here.

        Returns:
            ``success``, ``container_name``, ``container_type``,
            ``output_dir``, ``output_dir_exists``, ``files_written`` (a
            count), ``written`` (up to 50 paths), ``fab_check``, and
            ``reason`` when nothing was written.
proj_generate_fab_package tool
Generate a fabrication package from an OutJob (Gerbers, NC drill,
        IPC-356, pick-and-place, assembly, BOM) and report every file produced.

        Those formats exist only as OutJob containers, so this runs every
        container in the OutJob and lists the files each wrote; STEP and
        DXF are optional extra exports. The OutJob's outputs must already
        be enabled: a script cannot switch them on.

        Args:
            outjob_path: path to the .OutJob; omit to use the first one in the
                focused project.
            include_step: also export a STEP 3D model of the active PCB.
            include_dxf: also export a DXF of the active PCB.
            fresh_window_seconds: files modified within this window before a
                container ran still count as newly produced.
            fab, fab_tier, outer_oz: as proj_run_outjob; nothing is
                generated while the board is outside the fab's limits.

        Returns:
            {"ok", "outjob_path", "containers_run", "results" (per-container
             with output_dir + files), "extras" (step/dxf results),
             "all_files" (flat list of newly-produced file paths)}.
proj_list_variants tool
List all project variants with their component overrides.

        Compiles the project and returns every variant definition including
        component variation details (Fitted / Not Fitted / Alternate) and
        any parameter overrides.

        Args:
            project_path: Optional project path. If None, uses active project.

        Returns:
            Dictionary with "variants" array and "count". Each variant has
            name, description, its own ``parameters``, and variations
            array (designator, unique_id, kind, alternate_part (Altium
            reads it from the varied Comment, so a fitted part with a
            varied Comment shows one too),
            ``alternate_link`` for an alternate: the alternate's library,
            symbol reference and footprint, and ``parameters``, the varied
            parameter values).
proj_get_active_variant tool
Get the currently active project variant.

        Args:
            project_path: Optional project path. If None, uses active project.

        Returns:
            Dictionary with variant "name" and "description".
            Returns "[No Variations]" if no variant is active.
proj_set_active_variant tool
Switch the active project variant, or back to the base design.

        Args:
            variant_name: The variant's name or description, or
                "[No Variations]" for the base design.
            project_path: Optional project path. If None, uses active project.

        Returns:
            ``success``, ``variant_name`` (the variant now current) and
            ``verified``, read back from the project; ``success`` false
            with ``current_variant`` and a ``reason`` otherwise.
proj_export_variant_matrix_csv tool
Write the variant fitted/not-fitted matrix to a CSV.

        One row per component (every one), one column per variant, each
        cell ``Fitted`` / ``Not Fitted`` / ``Alternate``.

        Args:
            output_path: Destination .csv. Defaults to
                ``workspace/variant_matrix.csv``.
            project_path: Optional project path. If None, uses the focused
                project.

        Returns:
            {"output_path", "component_count", "variant_count"} or an error.
proj_print_all_variants tool
Export a PDF for every project variant.

        One ``<variant>.pdf`` per variant, each made active in turn; the
        original variant is restored at the end.

        Args:
            output_dir: Folder for the per-variant PDFs. Defaults to the
                workspace directory.
            project_path: Optional project path. If None, uses the focused
                project.

        Returns:
            {"exported": [{variant, output_path, ok, error}], "count"} plus
            ``restored``: the variant put back, or null if putting it
            back FAILED: the project is then on another variant, and any
            variant-sensitive call (a BOM, an export,
            ``pcb_apply_dnp_paste_exclusion``) acts on the wrong set. A
            failure also carries ``restore_error`` and a ``note``.
proj_create_variant tool
Create a new project variant.

        After creating, use `proj_set_active_variant` to switch to it,
        and `proj_set_component_variation` to mark parts not fitted or
        give them an alternate part.

        Altium saves only the description and shows it as the variant's
        name; leave ``description`` empty and it takes ``name``. A name
        that differs from the description lasts until the project is
        reopened.

        Args:
            name: Name for the new variant
            description: Optional description
            project_path: Optional project path. If None, uses active project.

        Returns:
            Dictionary confirming creation with name and description
proj_set_component_variation tool
Set one part's entry in a project variant: fitted, not fitted,
        an alternate part, or no entry at all.

        Adds the variation when the part has none in that variant, changes
        it when it has one, and with ``kind="remove"`` deletes it, varied
        parameter values included, so the part follows the base design
        again. Parameter values: ``proj_set_parameter_variation``. The part is found by its
        designator in the compiled project; the entry is read back.

        Args:
            variant: The variant's name or description.
            designator: The part, e.g. "R12".
            kind: "fitted", "not_fitted", "alternate" or "remove".
            alternate_part: For ``alternate``: the alternate part's name,
                which Altium keeps as the part's varied Comment.
            project_path: The .PrjPcb. Defaults to the focused project.
            alternate_library: For ``alternate``: the library the
                alternate comes from, e.g. "Miscellaneous Devices.IntLib".
                Without it Altium saves the entry but loads it back as
                fitted when the project is reopened.
            alternate_lib_ref: The alternate's symbol in that library;
                defaults to ``alternate_part``.
            alternate_footprint: The alternate's footprint when it differs
                from the base part's.

        Save the project (proj_save) to keep the change.

        Returns:
            ``before`` and ``after`` (the entry's kind, or "none"),
            ``alternate_part``, ``alternate_link``, ``unique_id`` and
            ``applied``.
proj_set_parameter_variation tool
Set or clear the parameter values one part takes in a variant,
        e.g. R5's Value 4k7 in variant "Lite" while the base design has 10k.

        A value of None clears that parameter's variation, so the part
        takes the base value again. A part with no entry in the variant
        gets a fitted one to hold the values; a not-fitted part is
        refused. Every value is read back. ``proj_get_bom`` with
        ``variant`` applies them. Altium keeps an alternate part's name
        as its varied Comment, so changing Comment on an alternate
        renames the alternate.

        Args:
            variant: The variant's name or description.
            designator: The part, e.g. "R5".
            parameters: Parameter name to value, e.g. {"Value": "4k7",
                "Comment": "4k7"}; None clears it.
            project_path: The .PrjPcb. Defaults to the focused project.

        Save the project (proj_save) to keep the change.

        Returns:
            ``parameters`` (the part's varied values afterwards),
            ``entry_created``, ``not_on_part`` (names the part does not
            carry, written anyway), ``not_applied`` and ``applied``.
proj_rename_variant tool
Rename a project variant.

        Altium saves a variant's description and shows it as the name, so
        the new name is written there (and to the in-memory name). A name
        another variant already has is refused. The name is read back.

        Args:
            variant: The variant's current name or description.
            new_name: Its new name.
            project_path: The .PrjPcb. Defaults to the focused project.

        Save the project (proj_save) to keep the change.

        Returns:
            ``name_before``, ``name``, ``was_active`` and ``applied``.
proj_copy_variant tool
Start a new variant from an existing variant's entries.

        Carries over every entry (fitted, not fitted, alternate with its
        library link), every varied parameter value and the variant's own
        parameters, then compares each entry with its source. Also the way
        to keep a copy before ``proj_delete_variant``.

        Args:
            source: The variant to copy, by name or description.
            name: The new variant's name (saved as its description, which
                Altium shows as the name); one already in use is refused.
            project_path: The .PrjPcb. Defaults to the focused project.

        Save the project (proj_save) to keep the change.

        Returns:
            ``entries_copied``, ``parameter_values_copied``,
            ``variant_parameters``, ``alternate_links_not_copied``,
            ``differs`` (designators whose copy does not match) and
            ``applied``.
proj_net_color tool
Read, or set, the colour the project gives a net.

        Args:
            net: The net name.
            color: "#RRGGBB", "none" to clear the project's colour for
                the net, or empty to only read.
            project_path: The .PrjPcb. Defaults to the focused project.

        Returns:
            ``color_before`` and ``color`` as "#RRGGBB", or "none" when the
            project sets no colour (and Altium's own integers as
            ``color_before_bgr`` / ``color_bgr``).
proj_get_net_items tool
Show what gives each compiled net its name, and where.

        For each net: its net labels, power ports, ports, sheet entries,
        off-sheet connectors and ``directives`` (the ones the compiled net
        carries) with sheet and location, whether the
        compiler made the name up (``auto_generated``),
        ``local_scope`` (False when a power port gives the net a global
        name; a net joined across sheets by ports still reads True), its
        ``electrical`` type as Altium words it (Passive, Input, Output,
        I/O ...), ``erc_suppressed`` (a No ERC marker sits on it), and
        for a bus member ``bus_prefix`` and ``bus_index``. With one net,
        its pins too.

        Args:
            net: One net (any case). Empty lists every net.
            named_only: Skip nets that nothing names.
            limit: The most nets to list (default 500); ``truncated``
                says when more were left out.
            project_path: The .PrjPcb. Defaults to the focused project.
            structure: Add how each net is built, from the compiled
                model: ``sub_wires``, ``lines``, ``all_items``,
                ``removed_items``, ``scope``, ``signal_type``,
                ``calculated_name``, ``hidden_name``, ``bus_width``,
                ``net_number``, ``non_pin_items`` (labels, ports and other
                objects on it), ``harness_type`` and the count of
                ``output_pins``, ``io_pins``, ``power_pins`` and
                ``open_collector_pins`` it joins (two outputs on one net
                drive against each other). For buses: ``bus_section``
                (the bus itself, e.g. D[0..7]) with ``bus_kind``,
                ``bus_range_from`` / ``bus_range_to`` as written,
                ``bus_range_value_from`` / ``bus_range_value_to`` and
                ``bus_range_by_value``; ``bus_element`` (one member) with
                ``bus_section_parent`` naming its bus.

        Returns:
            ``nets_examined``, ``nets_listed``, ``truncated`` and
            ``nets``.
proj_step_export_options tool
Read, or change, the settings Altium's STEP exporter keeps.

        These are the settings File > Export > STEP 3D last used, kept
        between exports: export the folded rigid-flex board, copper,
        holes, how 3D models and parts are written, and the part name
        suffix. ``proj_export_step`` uses whatever is set here. Nothing
        is exported by this call.

        Args:
            options: Settings to write, by name: ``folded`` (bool),
                ``fold_rate`` (int), ``component_option``,
                ``models_option``, ``holes_option``, ``copper_option``
                (Altium's codes, read them first), ``mechanical_pad_holes``,
                ``electrical_pad_holes``, ``free_pad_holes``,
                ``barrels_only``, ``cover_layer`` (bool),
                ``component_suffix_type`` (int), ``component_suffix``
                (text). Omit to read only.

        Returns:
            Every setting as it now reads, ``not_taken`` (names that did
            not take) and ``read_errors``.
proj_get_channels tool
List the sheet instances of a multi-channel design, as compiled.

        Every compiled sheet instance with its ``instance`` name,
        hierarchical ``path``, ``room``, ``channel_prefix``,
        ``channel_index`` and ``instance_number``, and the project's
        ``room_naming_style``. A design without repeated channels lists
        each sheet once.

        Args:
            project_path: The .PrjPcb. Defaults to the focused project.
proj_get_hierarchy tool
The compiled sheet hierarchy: each sheet's ``parents``,
        ``ports`` and ``sheet_symbols`` with their ``entries``, and the
        ``problems``: a missing child, an entry without a port or a port
        without an entry, opposite directions, an orphan sheet.

        Each port and entry gives ``net``, the net's name on its own sheet,
        and ``physical``: per copy of the sheet (one per channel), the
        ``instance`` and the ``net`` it joins across the project. They
        differ when a name from another sheet wins. ``x`` / ``y`` (mils)
        tell apart items of one name.

        Args:
            project_path: The .PrjPcb. Default: the focused project.
proj_component_models tool
Show where each part's models resolve, as Altium finds them.

        For each compiled part, each model (footprint, simulation, 3D...)
        with its name, type, whether it is the current one and whether it
        comes from an integrated library, and per datafile the library it
        names, the entity, the kind and ``found_at``: the full path Altium
        resolves it to, empty when it finds none. ``datafiles_not_found``
        counts the links that resolve nowhere.

        Args:
            project_path: The .PrjPcb. Defaults to the focused project.
            designator: One part. Empty lists every part.
            limit: The most parts to list (default 300).
lib_library_manager tool
Ask Altium's own library manager about a library or a part.

        Args:
            action: ``locate`` (where Altium finds ``component``, in
                ``library`` or across the installed ones when it is
                empty), ``contents`` (the parts of the library at
                ``library``, a full path, with model counts, whether each
                has a footprint and its first datafile; Altium reads only
                a library it has installed or an open project uses, and
                ``known_to_manager`` says which), or ``extract``
                (an IntLib at ``library`` back into its source libraries,
                in ``destination``).
            library: A library name for locate, a full path otherwise.
            component: The part, for locate.
            destination: The folder for extract.
            limit: The most parts contents lists (default 500).
proj_output_panel tool
Read the lines in Altium's Output panel, newest last.

        Altium writes progress and results of many processes there
        (compiles, generators, scripts). ``clear`` empties the panel after
        reading, so the next read shows only what came since.
proj_add_generated_document tool
List a file the project produced under its Generated documents.

        For a report, PDF, STEP or drawing written outside an OutJob, so it
        shows with the project. The file itself is not changed. ``listed``
        is true once the project holds it.
proj_project_setup tool
Read, or change, a project's document order, library search
        paths, net naming options, net identifier scope, output path,
        pin swap options, single-pin nets, automatic sheet numbering and
        class generation.

        Call with no changes to read. Every change is read back, and
        any that did not take is listed in ``not_applied``. Save the
        project (proj_save) to keep the changes.

        Args:
            move_document: Full path of a document to move.
            move_to_index: Its new position, from 0 (with move_document).
            add_search_path: A folder to add to the library search paths.
            include_subfolders: Search below that folder too.
            allow_port_net_names: Ports name nets.
            allow_sheet_entry_net_names: Sheet entries name nets.
            hierarchy_mode: The net identifier scope: automatic, flat,
                hierarchical, global or strict_hierarchical (or Altium's
                number 0 to 4, in that order).
            output_path: The folder outputs are written to.
            append_sheet_number_to_local_nets: Add the sheet number to
                the names of nets local to one sheet.
            pin_swap_by_net_label: Pin swaps on the board may change
                net labels on the schematic.
            pin_swap_by_pin: Pin swaps on the board may move pins on
                the schematic.
            single_pin_nets: Allow single pin nets.
            auto_sheet_numbering: Altium numbers the sheets itself.
            class_generation: Project-wide class generation flags, any
                of comp_class_manual, comp_class_manual_room,
                net_class_auto_bus, net_class_auto_comp,
                net_class_auto_named_harness, net_class_manual,
                net_class_separate_bus_sections (True / False).
            class_gen_document: Full path of the sheet that
                sheet_class_generation applies to.
            sheet_class_generation: That sheet's flags: comp_class_auto,
                comp_class_auto_room, generate_class_cluster (True /
                False) and net_class_auto_scope (none, local or all).
            project_path: The .PrjPcb. Defaults to the focused project.

        Returns:
            ``documents`` (in project order), ``search_paths``,
            ``generated_documents``, the two naming options,
            ``hierarchy_mode`` (Altium's number) and
            ``hierarchy_mode_name``, ``output_path``,
            ``append_sheet_number_to_local_nets``,
            ``pin_swap_by_net_label``, ``pin_swap_by_pin``,
            ``single_pin_nets``, ``auto_sheet_numbering``, the read-only
            ``name_nets_hierarchically`` and
            ``power_port_names_take_priority``, ``class_generation``
            (``project`` and one entry per sheet), ``changed``, ``moved_from`` / ``moved_to`` and
            ``not_applied``.
proj_make_schematic_library tool
Make a schematic library of every symbol placed in the project.

        Altium's Make Schematic Library, run without its dialogs, then
        saved. One sheet of the project must be loaded
        (proj_load_sheets). The new library stays open in Altium.

        Args:
            out_path: Full path of the new .SchLib.
            add_to_project: Add the library to the project.
            project_path: The .PrjPcb. Defaults to the focused project.

        Returns:
            ``saved``, ``written`` (a new file is at out_path),
            ``sheet`` (the one it ran from) and ``in_project``.
proj_make_integrated_library tool
Make an integrated library of every part the project places.

        Altium's Design > Make Integrated Library, which runs with no
        dialog: the symbols and footprints of the placed parts are
        compiled into "<project>.IntLib" in the project folder,
        replacing one already there. One document of the project must
        be open (proj_load_sheets).

        Args:
            project_path: The .PrjPcb. Defaults to the focused project.

        Returns:
            ``intlib``, ``built`` (a new file is there, read from its
            time), ``bytes`` and the ``focused_document`` it ran from.
proj_get_declared_design_objects tool
The net classes, component classes, differential pairs and rooms
        the project's schematics declare, from the compiled project.

        What an Update PCB would create on the board; compare with
        pcb_get_net_classes / pcb_get_differential_pairs.

        Returns:
            ``sheets_examined`` (an empty answer from 0 sheets means
            nothing was read), ``net_classes`` and
            ``component_classes`` (``name``, ``sheet``,
            ``members``), ``differential_pairs`` (``name``, ``positive``,
            ``negative``) and ``rooms`` (``name``, ``scope``).
proj_delete_variant tool
Delete a project variant, with every component variation in it.

        NOT REVERSIBLE: run ``proj_copy_variant`` first to keep a copy.
        Read the variant with ``proj_list_variants`` first if you did not
        create it; ``entries_removed`` reports how many went. Addressed
        by name, since deleting one renumbers the rest.

        Args:
            variant_name: name of the variant to remove.
            project_path: optional project path; defaults to the focused
                project.

        Returns:
            ``{"success": true, "variant_name": ..., "entries_removed": N,
            "variant_count_before": N, "variant_count_after": N,
            "verified": true}``, or ``success: false`` with a ``reason``
            when the variant is still listed afterwards.
proj_list_open tool
List all currently open projects in the Altium workspace.

        Returns:
            Dictionary with "projects" array (each: project_name,
            project_path, document_count) and "count"
proj_get_messages tool
Get all messages from the Messages panel (compile errors, ERC violations, etc.).

        Compiles the project first.

        Args:
            project_path: Optional project path. If None, uses active project.

        Returns:
            Dictionary with "messages" array (each: message, severity, source) and "count"
proj_find_component tool
Search for components across all project sheets.

        Case-insensitive partial match. For a technical question about a
        match, read its datasheet; symbol metadata is not ground truth.

        Args:
            search_text: Text to search for (e.g., "U1", "100nF", "LM317")
            search_by: Property to search, "designator", "value", or "comment" (default "designator")
            project_path: Optional project path. If None, uses active project.

        Returns:
            Dictionary with "results" array (each: designator, comment, footprint,
            lib_ref, sheet, location_x, location_y) and "count", plus
            `_datasheet_guidance` + `_datasheet_parts`.
proj_get_connectivity tool
Get pin-to-net connectivity for a specific component.

        Compiles the project; every pin with number, name and net. A
        multi-part component placed across sheets is read from all of
        them (``sheets``).

        Args:
            designator: Component designator (e.g., "U1", "R8")
            project_path: Optional project path. If None, uses active.
            force_recompile: SaveAll + invalidate cache + recompile
                before reading. Use when you need a guaranteed-fresh
                netlist.
            pins: Only these pins, by number or name; ``pins_left_out``
                counts the rest.
            connected_only: Leave out pins on no net ("" or "?").

        Pin names come from the symbol and can be wrong: check a pin's
        function against the manufacturer datasheet before relying on it
        (see `_datasheet_guidance`).

        Returns:
            Dict with designator, comment, sheet, sheets, pin_count,
            pins[], plus `_datasheet_guidance` + `_datasheet_parts`.
proj_get_connectivity_many tool
Pin-net connectivity for MANY components in ONE round-trip.

        One compile for the whole list (a list of one for a single part).
        Pin names come from the symbol and can be wrong: check pin
        functions in the datasheet. A multi-part component placed across
        sheets is read from all of them (``sheets``).

        Args:
            designators: List of component designators.
            project_path: Optional project path.
            force_recompile: SaveAll + invalidate cache + recompile
                before reading. Use when you need a guaranteed-fresh
                netlist.
            pins: Only these pins (number or name) of each component;
                ``pins_left_out`` counts the rest.
            connected_only: Leave out pins on no net ("" or "?").

        Returns:
            Dict with components[], matched, requested, not_found[],
            plus `_datasheet_guidance` + `_datasheet_parts`.
proj_get_erc_levels tool
The project's ERC report level for every violation type (Project
        Options > Error Reporting): no_report, warning, error or fatal.

        Args:
            match: only types whose description contains this text, e.g.
                "multiple names" or "driving source".
            project_path: the .PrjPcb; default the focused project.

        Returns:
            ``levels``: [{kind, description, level}], and ``count``.
proj_set_erc_levels tool
Set ERC report levels (Project Options > Error Reporting).

        A project's policy, not a way to a clean ERC. Before turning a
        check off because it reports something that is not there, rule out
        a stale compile (proj_force_recompile): a resized or redrawn sheet
        can report "Off sheet" or duplicates that are gone.

        Args:
            levels: {violation type: level}. A type is its exact description
                as proj_get_erc_levels lists it ("Nets with multiple names")
                or its kind number; a level is no_report, warning, error or
                fatal. Example: {"Nets with no driving source": "no_report"}.
            project_path: the .PrjPcb; default the focused project.
            save: save the project file afterwards so the setting persists.

        Returns:
            ``set``, ``failed`` and per item ``results`` with the level read
            back (``problem`` when it did not take), and ``saved``.
proj_force_recompile tool
Flush all dirty docs, invalidate the compile cache, and recompile.

        For a netlist that is surely fresh. The compile ticks before and
        after show the recompile happened.

        Returns:
            Dict with recompiled, prev_compile_tick, new_compile_tick,
            project path.
proj_get_compile_freshness tool
Report the age of the cached netlist and which docs are dirty.

        Check this before disagreeing with the user about connectivity:
        a dirty document means the netlist does NOT reflect what the user
        is looking at.

        ``needs_compile`` and ``violation_count`` are Altium's own
        answer: whether the project needs compiling now, and how many
        violations its last compile left (-1 when it would not say).

        Returns:
            Dict with compile_age_ms, needs_compile, violation_count,
            compile_cached (bool), ttl_ms, open_doc_count,
            dirty_doc_count, dirty_docs[], project.
proj_import_document tool
Import a document into the focused project from an external path.

        Altium writes a copy into the project directory (if not already
        there), as Save Copy As, then it is added to the project and the
        project file saved. A file already at the new path is refused.

        Args:
            source_path: Full path to the source document (SchDoc, PcbDoc, etc.)

        Returns:
            Dictionary with success status, source_path, and dest_path
proj_get_path tool
Get the full path of the currently focused project file.

        Returns:
            Dictionary with project_path, project_dir, and project_name
proj_set_document_parameter tool
Set a document-level parameter on a specific schematic sheet.

        Useful for per-sheet title block data (e.g., "SheetTitle", "Revision").
        If the parameter already exists it is updated; otherwise a new hidden
        parameter object is created on the sheet. Of two with one name the
        first is updated; sch_sheet_parameters picks one by index, adds
        sheet rules and removes parameters.

        The sheet must be loaded (`proj_load_sheets`), else NOT_LOADED.
        The sheet is marked modified, not written: `app_save_all` or
        `proj_save` writes it.

        Args:
            file_path: Full path to the schematic document (.SchDoc).
                Use Windows-style backslashes (e.g. C:\\\\path\\\\Sheet.SchDoc),
                not forward slashes.
            name: Parameter name
            value: Parameter value

        Returns:
            Dictionary with file_path, name, value, action (added /
            updated), saved=false and pending_save=true.
proj_compare_sch_pcb tool
Compare schematic and PCB component counts.

        Compiles the project. ``proj_get_differences`` gives the
        per-component breakdown. Before proposing a footprint or pin fix,
        read the parts' datasheets.

        Args:
            project_path: Optional project path. If None, uses active project.

        Returns:
            Dictionary with sch_components, pcb_components, components_match
            (bool), and pcb_path. (Net-count comparison is not provided here;
            use ``proj_get_nets`` / ``pcb_get_nets``.)
proj_sync_pcb tool
Push schematic changes to the PCB (Design > Update PCB Document).

        With Dialogs Automatic (Config tab) the tool executes and closes
        the change order (``change_order``); otherwise it waits for the
        user and blocks the bridge (``app_list_open_dialogs`` reads it).
        Focuses the PCB first (WRONG_FOCUS if it cannot).

        Returns:
            success, pcb_path, mapping counts, components added, removed
            and in sync, ``change_order``, and ``after_sync``:
            ``footprint_mismatch``, ``missing_on_board``,
            ``diff_pairs_removed`` (board-only pairs),
            ``pad_nets`` (pads ``unbound`` or ``mismatched``).
            ``change_order.failed_lines``: failed lines read by OCR (0/O,
            1/l slips); a mismatch it explains carries ``eco_line``
            and, for Footprint Not Found, ``footprint_source``: each
            library and ``found_at`` ('' if none).
proj_update_from_libraries tool
Update the project's parts from their libraries: Tools > Update
        From Libraries (symbols, parameters, models) or Update From PCB
        Libraries (the board's footprints). Run as Altium's own process,
        so neither the menu nor the focus is touched.

        With Dialogs Automatic (Config tab) every dialog is answered: the
        wizard finishes with its options as set, a count of footprints no
        library has is answered Yes (its sentence kept in
        ``change_order.passed``), and the change order is executed, its
        failed lines read, and closed. With Manual the wizard is left to
        you and the bridge waits until it closes.

        Args:
            target: "schematic" or "pcb".
            document_path: a sheet (schematic) or the board (pcb) of the
                project, focused first. Default: the document in front.

        Returns:
            ``document``, ``updated`` (a change order was executed) and
            ``change_order``: ``done``, ``passed`` and ``failed_lines``.
proj_sync_schematic tool
Push PCB changes back to schematic (back-annotate ECO).

        Design > Update Schematic, compiled before and after. A change
        order it opens is answered as in proj_sync_pcb.

        Returns:
            success, pcb_path, mapping counts, components added and
            removed, in_sync, ``change_order``.
proj_get_differences tool
Get detailed differences between schematic and PCB netlist.

        Compiles the project and uses component mappings to find:
        - Matched components (present in both schematic and PCB)
        - Extra components in schematic (not yet in PCB)
        - Extra components in PCB (not in schematic)

        Args:
            project_path: Optional project path. If None, uses active project.

        Returns:
            Dictionary with matched_components, extra_in_schematic (array),
            extra_in_pcb (array), and in_sync (bool)
proj_lock_designator tool
Lock or unlock component designators to prevent re-annotation.

        When locked, designators are preserved during annotation operations.
        Use designator="all" to lock/unlock all components on the active sheet.

        Args:
            designator: Component designator (e.g., "U1", "R3") or "all" for all components
            lock: True to lock, False to unlock (default True)

        Returns:
            Dictionary with designator, locked status, and count of affected components
proj_get_options tool
Get project options: output path, hierarchy mode, compiler settings.

        Returns configuration details including output directory, hierarchy mode,
        document counts, variant count, channel settings, and net naming options.

        Args:
            project_path: Optional project path. If None, uses active project.

        Returns:
            Dictionary with project_name, output_path, hierarchy_mode,
            logical_document_count, physical_document_count, variant_count,
            channel settings, and net naming options
fn tool
sch_render_svg tool
Render the active SchDoc to an SVG file.

        For a picture of layout and readability. Never judge
        connectivity, values or pin functions from it: use
        ``proj_get_nets``, ``proj_get_connectivity_many`` or
        ``design_review_snapshot``.

        Draws components as labelled boxes with pin stubs (not the symbol
        art), wires, junctions, labels, ports and power ports, each group
        carrying ``data-designator``, ``data-net`` and ``data-pin``.

        Args:
            output_path: SVG path; default the workspace renders folder.
            margin_mils: Padding around the drawing (default 200).
            flip_y: Flip Y to Altium's bottom-left origin (default True).

        Returns:
            ``ok``, ``svg_path``, ``doc``, ``counts``, ``bytes``.
pcb_render_svg tool
Render the active PcbDoc to an SVG file.

        For a picture of placement, silkscreen or spacing. Never judge
        connectivity, nets or clearance from it: use ``pcb_get_nets``,
        ``pcb_get_unrouted_nets``, ``pcb_run_drc`` or
        ``proj_compare_sch_pcb``.

        Draws the outline, tracks, arcs, pads, vias and overlay texts;
        not regions, pours or component-body outlines. Each primitive
        group carries ``data-net``, ``data-layer`` and ``data-shape``.

        Args:
            output_path: SVG path; default the workspace renders folder.
            layers: Only these layer names (e.g. ``["TopLayer",
                "TopOverlay"]``); default all. Vias and the outline are
                always drawn.
            margin_mils: Padding around the board.
            flip_y: Flip Y to Altium's bottom-left origin (default True).
            show_drills: Draw pad and via holes.
            show_texts: Draw overlay texts.
            show_designators: Draw designators.
            interactive_legend: Add a clickable per-layer legend.
            background: Background fill; ``"none"`` for transparent.

        Returns:
            ``ok``, ``svg_path``, ``counts``, ``bbox`` (mils), ``bytes``.
pcb_render_3d tool
A photographic picture of the active board, raytraced: solder
        mask over raised copper, finish, silkscreen, drills, edges, the
        parts with their solder joints, studio light, shadows and a lens.

        This is eda-agent's 3D picture; flat 2D pictures of the board
        are pcb_render_png and pcb_render_svg. Ask the user which backdrop
        they want before the first render: called without ``background``
        it reads nothing and returns ``choices`` to put to them.

        Read-only. The parts come from Altium's STEP export of the board,
        written to the renders folder and read with CadQuery's kernel
        (``pip install eda-agent[models3d]``). Angled views need the path
        tracer (``pip install eda-agent[render3d]``); top and bottom work
        without it, flat-shaded.

        Args:
            view: top, bottom, iso, iso_back, iso_bottom, front, back,
                left or right.
            output_path: PNG path; default the workspace renders folder.
            width, height: Pixels.
            quality: draft (fast), normal or high (smooth shadows).
            azimuth, elevation: Degrees, overriding the view's camera:
                azimuth 0 looks along +Y, elevation 90 straight down.
            zoom: 1 (default) shows everything drawn, in the middle of
                the picture with an even margin; above 1 frames closer.
            mask_color: green, black, blue, red, white, purple, yellow,
                matte_black or matte_green.
            finish: enig, hasl, osp or bare.
            silk_color: white, black or yellow.
            background: The backdrop, the user's choice: studio (a white
                sweep), charcoal (the dark fibre mat of a photo bench),
                desk (an oak-melamine worktop), esd_mat (a blue-grey bench
                mat), black (matte), transparent, a colour like
                "#202428", or the path of the user's own photo of a
                surface, seen from above.
            backdrop_width_mm: How wide the area in that photo is, so it
                is laid at its real size.
            show_components: Draw the fitted parts and their solder.
            depth_of_field: 0 all sharp; 0.15 (default) as a phone
                camera sees a board, and up to 2 blur what
                is nearer or farther than the board's middle, more as
                ``zoom`` comes closer, as a macro lens does.

        Returns:
            ``ok``, ``path``, ``renderer``, ``seconds``, ``board_mm``,
            ``thickness_mm``, ``parts`` (how many were drawn), ``notes``,
            and for the review: ``realism_checks``, ``models``
            (``parts_without_a_model``, ``placeholder_models``) and
            ``next_step``. Look at the picture against the checks and
            propose what would make it more real; ask the user before
            changing any 3D model.
design_visual_review tool
Render the active sheet or board to a PNG you can Read, with a
        critique ``rubric`` naming the audit tool that measures each item.

        SCOPE: layout and placement only (readability, spacing, overlaps,
        silkscreen). Never judge connectivity, values or wiring from the
        image: use ``design_review_snapshot`` and the netlist tools. Loop:
        render, Read ``png_path``, critique, run the named audits, fix,
        render again.

        Args:
            target: "auto" (the active document), "schematic" or "pcb".
            output_path: SVG path (PNG beside it); default the workspace
                renders folder.
            rasterize: Also make the PNG (default True; ``rasterize_note``
                if no browser).
            width: PNG width in pixels.
            margin_mils: Render margin.
            layers: PCB only: these layers.

        Returns:
            ``ok``, ``target``, ``doc``, ``svg_path``, ``png_path``,
            ``counts``, ``bbox``, ``rubric``, ``loop_protocol``,
            ``next_step``.
proj_export_bom_html tool
Export the project BOM as a self-contained interactive HTML file.

        Standalone HTML page, no external CSS / JS / Altium runtime
        dependency. Open it in any browser; sortable columns, free-text
        filter, toggle between grouped (one row per value+footprint) and
        per-component layouts. A self-contained one-shot static export.

        Useful for emailing the BOM to a manufacturer, archiving with a
        board release, or sharing with a non-Altium reviewer.

        Args:
            output_path: Where to write the HTML. Defaults to
                ``<workspace>/bom.html``.
            title: Heading + ``<title>`` for the page.
            limit: Max components to include (default 5000; the BOM call
                supports up to ~10000 cleanly).

        Returns:
            Dict with ``ok``, ``html_path``, ``components`` (count
            written), ``bytes``.
design_review_snapshot tool
Fetch a whole design-review snapshot in ONE call: the compiled
        netlist and part data that are the BASIS of a review. Judge
        connectivity, values and pin functions from this and the
        datasheets, never from a render (renders are geometry only).

        CRITICAL: read the datasheet of every part in ``_unique_parts``
        before concluding anything about its pins or ratings, and cite it.
        Turn ERC/DRC output into traced findings, not relayed lists, and
        never hand back "verify X". The full rules come in
        ``_review_guidance`` and must be followed.

        Args:
            sections: Sections to include. Default: project_info,
                design_stats, components, nets, design_rules, unrouted,
                diff, messages, board_stats, fab_stats. Extras: "bom",
                "drc", "erc", "unconnected_pins", "project_options".
            include_bom: Add "bom" (default True; best source of MPNs).
            run_drc: Run DRC too (slow, 30-90 s; default off).
            run_erc: Run ERC too (default off).
            force_recompile: Save, drop the compile cache and recompile
                first (~5-10 s) when the user has edited in Altium.

        Returns:
            One key per section, plus ``_review_guidance``,
            ``_unique_parts`` [{manufacturer, part_number, designators}]
            and ``_sections_failed`` (the rest is still usable).
design_lint_report tool
Run every design-lint audit and return one report.

        Runs the schematic and PCB audits (the same ones as the
        standalone ``audit_*`` tools) plus the BOM-side pin and
        decoupling checks, each section in the shape its audit tool
        returns.

        Args:
            run_drc: Also run Altium's DRC (off by default; it rewrites
                the .DRC report).
            bad_connection_tolerance_mils: Tolerance for
                ``find_bad_connections`` (default 1.0).
            checks: Run only these section names, e.g.
                ``["find_floating_ports", "find_missing_decoupling"]``;
                None runs all. Unknown names come back in
                ``_unknown_checks``.

        Returns:
            ``summary`` (per check ``{checked, violations, severity}``),
            ``sections`` (raw results), ``totals`` (violations, by
            severity, checks run and failed; DRC not counted),
            ``_failed``.
design_datasheet_checklist tool
Return the datasheet-first discipline checklist for design review.

        Use this when you need the rules without pulling the full
        snapshot. The rules also ship inside the _review_guidance
        block of design_review_snapshot - no need to call this
        separately if you already ran a snapshot.

        Returns:
            Dict with datasheet_rules (list of rules) and a short
            action_required summary.
pcb_autoroute tool
Route many nets in one run; to route a board use pcb_route_round.

        Rounds (pcb_route_round) route a group at a time, stop for your
        review and advise on nets left unrouted. This runs as a job.

        Returns a job id at once. Poll design_job_status; design_job_result
        gives the tracks and vias, the DRC verdict, the pours used as planes
        and the same ``review`` a round gives (per-net figures, a picture,
        ``questions``). Nothing is written until pcb_autoroute_apply, which
        refuses while a finding is unanswered. Stages: differential pairs,
        plane fanout, IC pin lanes, buses, then every other connection
        once, shortest first; nothing laid is moved, and a connection with
        no room is left unmade for you to decide. Turns and vias are
        priced, no bend is sharper than 90 degrees, pads are met by a
        dogleg onto their centre, no via goes in a passive's pad. Lays
        only what pcb_route_brief decides: a net with no entry is left
        out (decision_needed), a critical one without a source too
        (brief_needed).

        Args:
            expect_file: Full path of the board; refused if another board
                is focused.
            nets: Route only these nets (default: every net with 2+ pads).
            use_planes: Inner layers a pour covers are planes (default
                True); routed on only if a brief entry names the layer
                (else summary.plane_declined).
            diff_pairs: Route differential pairs (defined, else _P/_N,
                +/-, DP/DM names) first, coupled (default True).
            plane_fanout: Dog-bone via for every plane-net surface pad
                first (default False; it cost completion).
            pin_lanes: Keep 0.8 mm straight out of IC pins at 0.65 mm pitch
                or finer (default True).
            bus_lanes: Route 3+ nets between the same two parts as nested
                lanes (default True).
            gloss: Lay the routed tracks again as the shortest clean 45/90
                runs (default True).
            axis_entry: Reach surface pads only straight out of their centre
                along an axis.
            neck_pads: A net with a wider width rule than most keeps it,
                necking into a narrower pad (default True).
            join_existing: Route only what the board's copper leaves apart;
                a net it joins whole is left alone.
            exclude_layers: Copper layers no route may use (not one a
                net's surface pad is on).
            time_limit_s: Stop then, keeping what is made; 0: none.

        Returns:
            {"job_id", "board", "read": {pads, components, nets, layers}}
            or {"error"}. The job result adds ``via_in_pad`` (for fab
            notes), ``pairs`` (lengths, skew), ``buses`` and ``unreached``
            (pads left unrouted and what blocks them).
pcb_route_brief tool
Set, change or read the board's routing brief: how the nets that
        matter are to be routed, which the router obeys.

        You decide; the router lays only that: a net is routed once an
        entry gives its layers and reason (one may decide a group) and a
        later call confirms it: confirm [{nets, verified, confidence,
        alternative}], what you checked per net (name it and its parts; a
        big plain group: its check_first net) against the reply's
        to_confirm facts, how sure you are it is the best choice (0-100,
        80 or more to route) and the other choice you weighed. A critical
        net (the reply names them) needs a sourced entry: read the
        datasheet's layout section and the standards first.

        Entry: nets, kind, layers, width (mils, not under the width rule),
        region / keep_out (polygons), max_vias, min_ / max_length, match +
        skew, reference (plane net under every track), return_via (mils: a
        reference via that near each via of the net), impedance or
        diff_impedance + gap, impedance_tol (%), apart_from (nets, classes)
        + spacing, max_parallel + parallel_gap, max_broadside; guard,
        guard_gap, max_unguarded; terminate, terminate_at (end|source),
        driver, max_stub; current (A) + temp_rise (C, IPC-2221); source,
        reason. An impedance or current gets each layer's width.

        Areas bar all nets but those allowed: name, polygons, kind, layers,
        allow, source (an antenna feed needs one). Loops: name, members
        (pads in current order, "C5.1"), kind, max_area (sq mils) or
        max_length, source; a read lists ``loops_found``. Barriers: name,
        nets, apart_from, creepage / clearance, source. Assembly:
        via_to_pad, vias_under_parts, part_gap, source. Orient: name,
        parts, rotation, side, pins ({"D1.K": "VIN"}), source. Pdn: name,
        part, rails, decaps, max_distance, min_vias + via_reach, source.
        Thermal (a power part): name, part, pad (default its largest),
        min_area (sq mils of its net's copper there), min_vias +
        via_reach, power (W) + theta_ja (C/W) + ambient + tj_max (C),
        source (its datasheet).

        Args:
            expect_file: full path of the focused board.
            add: entries to add (a net in another entry moves here).
            drop: [{nets, rules}] rules to take out of those nets' entries.
            remove: nets to take out of the brief.
            replace: the whole brief (an empty list clears it).
            areas, loops, barriers, orient, pdn, thermal: to add; one of the
                same name is replaced. remove_*: names to take out.
            assembly: sets the assembly rule ({} clears it).

        Returns:
            ``brief``, the other rules by name, ``errors`` (nothing is saved
            then), ``needed`` (critical nets with no sourced entry, why,
            what to read), ``undecided`` (and its count), ``to_confirm``,
            ``rounds``, ``file``.
pcb_route_round tool
Route the next round of nets under the brief, then stop for review.

        The rounds go: differential pairs, switching nodes, high-current
        paths, clocks, the other nets the brief rules, then the rest. A
        round routes only what the board's copper leaves apart: earlier
        rounds and every route you laid by hand stay as they are. The
        router lays only what you decided: a net in the round no brief
        entry decides (its layers and the reason) stops the round before
        anything is routed (decision_needed), and so does a critical net
        without a sourced entry (brief_needed, with what to read).
        When the user has set Routing discipline to advisory or off on
        the Config tab, the round goes ahead and the reply says so.

        Runs as a job: poll design_job_status, then design_job_result. Its
        ``review`` holds per net the length, vias, layers and detour; a
        picture (PNG) to look at; ``questions`` to answer; and for each net
        left unrouted, ``advice``: options tried by routing them (a part
        moved clear, a net laid before ripped up, a brief rule dropped),
        each with what it gave and the tool call that applies it. Nets
        whose route would break the brief are held back, not laid.

        Look at the picture, answer the questions, then accept with
        pcb_autoroute_apply(job_id), or change the brief or the board and
        route the round again (same nets). Nothing is written before.

        Args:
            expect_file: full path of the focused board.
            nets: route these nets as the round (default: the next round);
                the other net of a pair named comes too.
            advise: try options for nets left unrouted (default True).
            use_planes: inner layers a pour covers are planes (default True);
                one goes to routing only if a brief entry names its layer
                (summary.plane_declined says what it would close).
            time_limit_s: stop at this many seconds and keep what is made
                (summary.stopped_at_time_limit); 0: no limit. Cancel with
                design_job_cancel.

        Returns:
            ``job_id``, ``round`` {kind, nets}, ``rounds_left``, or
            ``brief_needed`` (and no job), or ``done`` when no net is open.
pcb_route_review tool
Review the copper on the board against the routing brief, without
        routing anything: tracks you laid by hand, an earlier round, or a
        router job's result once applied.

        The same review a round gets, on the board as it is: each brief rule
        measured on the copper (length, skew, return plane and return vias,
        impedance, current against IPC-2221, spacing and parallel runs,
        guards, termination, loops, decoupling, thermal pads and junction
        temperature, barriers, areas, assembly), then the
        judgements (detour, vias, off-45 pieces, pad entries, staircases,
        short tracks). Use it to check your own routing before going on, and
        a finding's ``simulate`` call where a closed form cannot settle it.
        Reads only; nothing waits on an answer here.

        Args:
            expect_file: full path of the focused board.
            nets: the nets to review (default: every net with free copper).
            picture: draw the reviewed nets (PNG, default True).

        Returns:
            ``findings`` (each id, check, text, and measured / limit where it
            has them), ``nets`` (length, vias, layers, detour per net),
            ``open`` (nets in scope the copper does not join yet),
            ``picture`` and ``brief_errors`` when the brief cannot be read
            as written.
pcb_autoroute_apply tool
Write a finished ``pcb_autoroute`` job's tracks and vias to the board.

        Refuses while the job has findings (its review's rules measured on
        the copper, and the judgements that are yours) you have not
        answered: route again, or accept each with ``accept``. An answer
        given before on this board to the same finding stands. With
        Routing discipline advisory on the Config tab (the user's choice)
        it writes and lists them in ``unanswered``; off, it writes.

        Refuses unless the focused board is ``expect_file``. With
        ``checkpoint`` (default), first snapshots the board's folder as it
        is ON DISK, so it can be restored with ``app_restore_checkpoint``.
        Nothing is saved first: unsaved edits in the editor are not in the
        checkpoint, so save the board yourself beforehand if it has any.
        Coordinates, widths and via sizes keep their decimals.

        Args:
            job_id: a ``layout_route`` job that has finished.
            expect_file: full path of the board the job routed.
            checkpoint: take a checkpoint first (default True).
            repour: repour the board's polygons afterwards when the job
                relied on them, as planes or as pours joining a net, or
                routed through their old poured copper (default True). A
                poured net's connections are not there, and the new copper
                is not cleared, until the polygons are repoured round it.
            accept: answers to findings, each {id, reason}. {check,
                reason} answers every finding of a judgement check
                (detour, vias, angle, pad_entry) or of unrouted / held; a
                brief rule the copper breaks is answered by id. The
                reason is kept with the board's brief.

        Returns:
            ``{"tracks": {placed, failed}, "vias": {placed, failed},
            "checkpoint": ..., "repoured": bool, "via_in_pad": [...],
            "decisions": [...], "notes": [...]}``, ``{"error": ...,
            "unanswered": [...]}`` or ``{"error": ...}``. ``via_in_pad`` lists the
            vias written into pads (BGA balls, exposed pads), which the
            fabrication notes must ask to be filled and capped.
pcb_route_simulate tool
Simulate what a routing finding asks, on the board's real copper.

        A finding's ``simulate`` gives the call. Give the result file as
        the ``evidence`` of your answer in pcb_autoroute_apply(accept=...).
        The copper is the board's, or, with job_id, the board's plus that
        round's routes before they are written.

        what:
            loop (ngspice): the brief loop ``name`` as the resistance and
                inductance of its routed path, driven by ``drive`` {i (A),
                rise_ns, source}; gives the peak voltage, L di/dt.
            pdn (ngspice): the pdn rule ``name``: each rail at its IC as
                the capacitors serving it, ``models`` {ref: {c_uf, esr_ohm,
                esl_nh, source}} from their datasheets, behind the
                inductance of the track and vias that mount them; swept over
                ``band`` {f_start, f_stop} Hz; gives |Z| max and where it is
                over ``target_ohm``.
            impedance (openEMS): ``net``'s tracks and vias on the stack, its
                brief reference as sheets where it is a plane or pour, ports
                at its end pads (the brief's driver first); S11, S21, line
                impedance.
            crosstalk (openEMS): ``net`` the victim, ``other`` the
                aggressor, ports at each end; near and far end coupling.

        Where a simulator is not installed the reply says so with the
        install offer for the user (never install without them); an
        openEMS model and script are written either way.

        Args:
            expect_file: full path of the focused board.
            f_max_ghz: openEMS's highest frequency (default 10).

        Returns:
            {engine, ok, the figures, inputs (what was measured on the
            copper), result_file or script} or {error}.
pcb_autoplace tool
Place the focused board's parts with the in-house placer, as a job.

        Returns a job id at once; poll ``design_job_status``, and
        ``design_job_result`` gives the moves, wirelength before and after,
        overlaps and the DRC verdict. Nothing moves until
        ``pcb_autoplace_apply``. Parts keep their side; locked parts and
        mechanical ones (connectors, mounting holes, fiducials, test
        points, switches, batteries) stay unless named in ``parts``.
        Routing does not follow its parts: place first, or ``pcb_unroute``.

        Args:
            expect_file: Full path of the board; refused if another is
                focused.
            parts: Designators to move (default: all movable parts).
            compact: Use only the room the parts need (small circuit on a
                big board; analytic only).
            strategy: "blocks" (default: by sub-circuit, decoupling round
                each IC, repeated channels tiled, signal-flow order) or
                "analytic" (wirelength only). "blocks" falls back to
                "analytic" when its floorplan would push over a quarter of
                the parts (``fallback``).

        Returns:
            {"job_id", "board", "strategy", "read"} or {"error"}.
pcb_autoplace_apply tool
Move the parts of a finished ``pcb_autoplace`` job on the board.

        Refuses unless the focused board is ``expect_file``. With
        ``checkpoint`` (default), first snapshots the board's folder as it is
        ON DISK, so it can be restored with ``app_restore_checkpoint``;
        unsaved edits in the editor are not in it, so save first if there
        are any. Positions are whole mils, as the job reported and judged
        them.

        Args:
            job_id: a ``layout_place`` job that has finished.
            expect_file: full path of the board the job placed.
            checkpoint: take a checkpoint first (default True).

        Returns:
            ``{"moved", "failed", "expected", "checkpoint", "notes"}`` or
            ``{"error": ...}``.
route_plan tool
Route a board given as a geometry dict and return the copper to
        place, checked by the exact DRC. Nothing is drawn.

        The same router as pcb_autoroute: each connection shortest first,
        committed before the next, turns and vias priced, pads entered on
        their centre, every route checked against the exact copper.
        ``tracks`` come in the pcb_place_tracks shape and ``vias`` in the
        pcb_place_vias shape, mils to a thousandth. A net that fails is reported
        with the connections it leaves unmade. On a live Altium board
        pcb_autoroute reads the board itself and takes the brief.

        Args:
            geometry: pads (x, y, x_size, y_size, rotation, shape, layer,
                net, hole_size), tracks, vias, regions, outline or bbox,
                in mils. Copper already there stays as it is.
            rules: clearance_mils, track_width_mils (a number, or a dict of
                net class to width with "default"), via_size_mils,
                via_drill_mils, layers (top first; default TopLayer and
                BottomLayer).
            nets: Route only these (unknown ones in ``unknown_nets``).
            net_classes: net -> class, for the per-class widths.
            fetch_geometry: Read the live board when geometry is None.

        Returns:
            {"ok", "summary" (connections, made, completion, routed,
            failed, tracks, vias, length), "nets" {net: {status,
            unmade}}, "tracks", "vias", "validation" (violation_count,
            violations), "geometry" (source "live" or "caller", bbox,
            counts)}. A caller-supplied geometry is only as fresh as its
            snapshot: read it again after placing anything.
route_plan_repairs tool
Turn a DRC violation payload into an ordered repair plan.

        Pure Python. Apply the actions in order, then run
        ``pcb_run_drc`` and plan again:
          ``rip_and_reroute`` {net}: ``pcb_delete_net``, then route it
            again (``route_plan`` with ``nets``); worst offender first.
          ``nudge`` {net, dx, dy, x_mils, y_mils}: ``obj_modify`` on the
            primitive nearest (x_mils, y_mils).
          ``widen`` / ``narrow`` {net}: ``pcb_set_track_width``.
          ``escalate`` {reason}: stop and report it.
        Coordinates and deltas are integer mils.

        Args:
            violations: ``pcb_run_drc`` result ``{violation_count,
                violations}`` or a bare list of violation dicts.
            max_rounds: Rip budget for the clearance worst-offender
                loop, integer >= 0 (0 = escalate-only for clearance).

        Returns:
            ``{"ok": True, "actions": [...], "rounds_used": n,
            "ripped_nets": [...], "counts": {bucket: n}}``;
            ``{"ok": False, "reason": ...}`` on malformed input.
sch_preview_template tool
Check a schematic template and draw it to a PNG, without
        touching any sheet. Read the PNG to look at it.

        A template is the sheet planned by hand, every coordinate on the
        grid (mils):

            {"parts": [{"designator": "U1", "lib_reference": "TPS62130",
                        "library_path": "C:/.../Power.SchLib",
                        "x": 3000, "y": 4000, "rotation": 0,
                        "value": "TPS62130"}],
             "wires": [{"net": "VIN",
                        "path": [[2000, 4600], "U1.PVIN"]}],
             "ports": [{"net": "+12V", "at": [2000, 4600], "style": "bar"}],
             "labels": [{"net": "PG", "at": [4200, 3700]}],
             "nets": {"VIN": ["U1.PVIN", "C1.1"]}}

        A path point is [x, y] or a pin anchor "U1.11" / "U1.EN" (the pin's
        wire end, from the symbol). Two points off-axis get one corner,
        horizontal first ("corner": "vh" for vertical first). A part's
        ``"mirror": true`` flips it left to right. Altium adds the junction dots itself
        where a wire ends on another; do not plan any. Ports default to
        style "bar" pointing up, or "gnd_power" pointing down for a net
        containing GND. ``nets`` is the netlist the sheet must produce,
        checked pin by pin.

        REDRAWING a sheet whose parts are on a board: give each part its
        old ``"unique_id"`` (obj_query eSchComponent,
        "Designator.Text,UniqueId", before clearing). sch_draw_template
        sets it and reads it back (``unique_ids``), so the board stays
        linked; without it the redrawn parts are new to the board.

        A MULTI-PART symbol takes one entry per
        part on this sheet, the same designator and symbol with ``"part": 2``
        and so on (absent means 1). Anchors name the designator only:
        "U2.B22" finds the pin on whichever drawn part shows it. With plan
        nets, pins of parts not drawn here are warnings, not errors.

        Args:
            template: as above.
            png_path: where to write the picture; default the workspace's
                renders folder.
            grid: the grid in mils every vertex should sit on.
            plan_json: the DesignPlan, if there is one. Parts then need
                only designator and position (symbol, library and value
                come from the plan) and the plan's nets are checked pin
                by pin. A part the plan lacks is an error.
            sheet: the plan sheet this template draws, to list the plan
                parts it leaves out.
            template_path: a JSON file holding the template, instead of
                passing it inline (a big sheet's template is tens of KB).

        Returns:
            ``ok``, ``errors`` (shorts, overlapping wires, bad anchors,
            netlist differences, a port touching nothing), ``warnings``
            (crossings, a wire through a body, dangling ends, off-grid
            points, stacked labels), ``netlist``, ``unconnected_pins``,
            ``auto_junctions`` and ``preview_png``.
sch_draw_template tool
Draw a schematic sheet from a hand template: THE way to draw
        or redraw a block. Same template as sch_preview_template; run that
        first and look at the PNG.

        Order: the template is checked against the library symbols, the
        parts are placed, their pins are read back off the sheet, the
        wiring is checked again against those real pins (and every other
        part already on the sheet), and only then are the wires, power
        ports, net labels and values (the Comment) drawn. Any error stops
        it before the first wire. A designator already on the sheet is
        refused: redraw on a fresh sheet rather than patching. Does not
        save.

        A multi-part symbol is placed one part per entry (``"part"``), each
        set to its part and read back; a part the symbol does not have
        stops the call before any wire.

        Args:
            template: parts, wires, ports, labels and optional nets.
            document_path: the .SchDoc to draw on (it is focused first).
            png_path: where to write a picture of what was drawn.
            grid: grid in mils for the off-grid check.
            plan_json: the DesignPlan, as for sch_preview_template. Its
                Value, Manufacturer, Manufacturer Part Number and
                Footprint are stamped on every drawn part.
            sheet: the plan sheet this template draws.
            template_path: a JSON file holding the template, instead of
                passing it inline.

        Returns:
            The same report as sch_preview_template, plus ``placed``,
            ``wires``, ``ports``, ``labels``, ``values`` counts and
            ``stage`` (where it stopped, or "done").
sim_get_readiness tool
Audit every component on the active schematic for SPICE readiness.

        Step 1 of any simulation. Each component lands in one bucket:
        ``ready`` (SpicePrefix set AND a SIM model linked, which is what
        Altium's netlister reads), ``no_sim_model`` (SpicePrefix written
        but no model link: the netlister reports "Missing component
        models" for these; sim_run_deck runs a plain SPICE deck without
        them), ``needs_primitive`` (R/L/C or a
        V/I/D/Q source needing SpicePrefix and Value; pass them all to
        sim_attach_primitives in one call) or ``needs_file`` (an IC or
        active part needing the vendor's .mdl/.ckt/.lib, for
        sim_attach_model).

        VENDOR SPICE MODELS ONLY. Never build a model from a datasheet:
        the parameters that set convergence and bias are not in it, and
        a plausible hand-made model gives confidently wrong results.
        ``_spice_guidance`` repeats this and gives per-part search
        queries.

        Returns:
            Dict with:
              - ready, ready_count (each with sim_model)
              - no_sim_model, no_sim_model_count
              - needs_primitive, needs_primitive_count
                (each entry has designator, comment, suggested_prefix,
                 suggested_value)
              - needs_file, needs_file_count
                (each entry has designator, comment, lib_ref,
                 manufacturer, manufacturer_part)
              - _spice_guidance (rules + structured search_hints +
                primitive_hints)
sim_attach_model tool
Attach an external SPICE model file (.mdl / .ckt / .lib) to a component.

        Use this after fetching a vendor SPICE model file from the
        manufacturer and saving it locally. The model_name parameter
        must be the exact ``.SUBCKT <name>`` declaration from inside
        the file, not the file name.

        Args:
            designator: Component reference (e.g. "U1").
            file_path: Full path to the locally-saved .mdl / .ckt / .lib.
            model_name: Subcircuit / model name declared inside the
                file. Open the file and look for ``.SUBCKT <name>``
                or ``.MODEL <name>``.
            primitive: SPICE prefix letter. Default "X" (subcircuit).
                Use "D"/"Q"/"M" when the file declares a .MODEL of
                that kind instead of a subcircuit.

        The file is checked first: the model must be declared in it
        (a .SUBCKT for "X", a .MODEL of the element's type otherwise),
        its header comments must name the publisher, and a subcircuit
        may not have more nodes than the part has pins.

        Returns:
            Dict with success, designator, file_path, model_name and
            ``model_check`` (kind, nodes, publisher).
sim_run tool
Run Altium's mixed-signal simulation of the focused project.

        Runs the sheet's setup the way the Simulation Dashboard's Run
        does (set with sim_setup_analysis, or in the dashboard), and
        reports in ``ran_analyses`` which analyses this run produced,
        read back from the results.

        MEASURED on AD 26.11: Altium takes the on/off switches from the
        setup at the first run after the project opens and keeps that
        selection until the project is reopened; each run also switches
        operating point, DC, transient and AC back on in the setup. So
        ``analyses`` writes the switches and is applied by the first run
        after opening; otherwise the run does what Altium kept, and
        ``selection_applied`` is false. sim_get_results(analysis=...)
        reads one analysis either way.

        With no sheet in front and none given, the project's first
        simulator output runs instead (``run_mode`` "project"), which
        always does those four.

        Succeeds only when a results document (.sdf) appears, else
        SIM_NOT_RUN; the reply summarises each wave, sim_get_results
        gives the traces. Order: focus a sheet, sim_get_readiness and
        sim_attach_*, sch_place_probe, sim_setup_analysis, sim_run.

        Args:
            analysis: Free-form label echoed back in the response.
            analyses: switch on only these before the run: "op", "dc",
                "transient", "ac".
            sheet: the schematic whose setup to run; empty uses the
                sheet in front.

        Returns:
            Dict with success, ran, results_document (the .sdf path),
            results_saved, run_mode ("sheet" or "project"), sheet,
            ran_analyses, results (this run's analyses, per wave: unit,
            points, min, max, first, last; magnitude for an AC wave),
            analysis and note; with analyses, ``switched`` and
            ``selection_applied``.
sim_run_deck tool
Run a SPICE deck in Altium's simulator; the waves open as a chart.

        The way to simulate a circuit that is not a schematic of parts with
        simulation models: a hot-plug, an inrush, a supply under a load
        step. Write it as plain SPICE (elements, models, one analysis such
        as .TRAN, a .PLOT line per analysis naming the waves to chart, and
        .END). Altium opens the results as a chart in front, and the reply
        gives each wave's figures. Passive and source values are yours to
        state; an IC's behaviour needs its vendor's model (SPICE_MODEL_RULES).

        A schematic of your own symbols does not run through sim_run: each
        part needs a simulation model link, and the parameters
        sim_attach_primitives writes are not one (Altium answers "Missing
        component models").

        Args:
            deck: the SPICE text, e.g. "* hot-plug\\\\nV1 in 0 PULSE(0 5 10u
                1u)\\\\nR1 in out 0.25\\\\nC1 out 0 22u\\\\n.TRAN 1u 2m\\\\n.PLOT TRAN
                V(out)\\\\n.END".
            file_path: where to write it: a full path ending in .nsx, in
                the project's folder. An existing deck there is replaced.

        Returns:
            ``ran``, ``deck``, ``results_document`` (the .sdf), and
            ``results`` per analysis per wave (unit, points, min, max,
            first, last); sim_get_results gives the traces.
sim_setup_analysis tool
Set the analyses sim_run will use, in the project's .simcfg.

        Values are SPICE values: a number in SI units, or a string with a
        SPICE suffix ("5u", "10n", "1k", "100meg").

        Args:
            transient: {"stop", "step", "start" (default 0),
                "max_step" (default step)}.
            ac: {"start", "stop", "points", "sweep": "dec" | "oct" | "lin"}.
                Points are per decade or octave, or in total for lin.
            dc: {"source" (a source designator such as "V1", or "Temp"),
                "start", "stop", "step"}.
            outputs: expressions to plot in each analysis set here, e.g.
                ["v(out)", "i(v1)"].
            project_path: the project; empty uses the focused one.

        Each analysis set here is switched on; one already on stays on
        and runs on its last settings. sim_run(analyses=[...]) runs only
        the ones named, and sim_get_setup shows what is on. Dashboard
        changes are saved first and kept; a project without a .simcfg
        gets one.

        Returns:
            Dict with simcfg (the file), set (the keys written), reloaded,
            and created when the file is new.
sim_get_setup tool
What a simulation run would do: the analyses on and their settings.

        Reads the project's .simcfg as Altium last saved it (its edits in
        the dashboard are saved first). Altium uses a sheet's own settings
        when ``affect`` is Document and the project's when it is Project;
        ``source`` says which were read.

        Args:
            sheet: the schematic to report for; empty uses the sheet in
                front.
            project_path: the project; empty uses the focused one.

        Returns:
            Dict with simcfg, affect, source, enabled (of op, dc,
            transient, ac), other_enabled (any other analysis switched
            on), settings (per enabled analysis: its sweep or times and
            its output expressions), sheets with settings of their own,
            and results (each recorded run: name, type, date, locked).
sim_get_probes tool
List the probes on the focused project's sheets.

        Each probe with its sheet, location and parameters. ``simulation``
        is true for a probe the simulator uses (it carries
        SimulationProbe: V, I, P, VD+ or VD-, given as ``kind``);
        ProbeName is the node Altium resolved ("Empty Probe" when it sits
        off a wire), ProbeCustomName the name shown instead, and
        ProbeValueDisplay the value shown on the sheet. Sheets that are
        not open are listed in ``not_loaded`` (proj_load_sheets opens
        them).

        Returns:
            Dict with project, count, probes and not_loaded.
sim_get_results tool
Read a simulation's results: every wave, with sampled points.

        Reads the .sdf that sim_run saved (the last one by default). Each
        wave comes with its unit, point count, min/max/first/last over
        every point, and up to max_points samples evenly spaced from first
        to last. An AC wave reports magnitude and phase in degrees against
        frequency. The sweep variable (time, frequency, the swept source)
        is marked independent.

        Args:
            results_document: path of a .sdf; empty uses the last sim_run.
            analysis: one analysis by name ("Transient Analysis", "AC
                Analysis", "Operating Point", "DC Sweep", ...); empty
                returns all.
            waves: wave names to keep, e.g. ["v(out)", "i(v1)"]; empty
                keeps all.
            max_points: samples per wave; 0 returns statistics only.
            all_runs: a document run more than once holds every run; by
                default only the latest run of each analysis is returned.

        Returns:
            Dict with results_document and analyses: a list of
            {analysis, waves: [...]}, or an error naming what is missing.
app_update_from_libraries tool
Drive Tools > Update From Libraries, ECO included, from the GUI.

        proj_update_from_libraries does the same through the bridge, with
        no menu or focus taken; use this for a wizard already open. Each
        dialog is read and answered by the role of its buttons; it STOPS
        on an error, an unexpected question or unknown buttons. The end
        presses EXECUTE CHANGES on the ECO, which is not undoable here:
        take app_checkpoint first, and run dry (the default) first. The
        reply lists dialogs and buttons, not the change list; read the
        Messages panel for that.

        Args:
            target: "schematic" (Update From Libraries) or "pcb" (Update
                From PCB Libraries).
            launch: "already_open" (default; attach to a wizard you
                opened) or "menu" (open it via the menu bar).
            dry_run: Report what it would press, press nothing (default).
            confirm_execute_eco: Must be True for a real run.
            answer_confirmations: Answer routine "continue?" prompts,
                needed to finish; prompts about deleting or overwriting
                are never answered.
            menu_may_steal_focus: Required for launch="menu", which brings
                Altium to the front and moves the pointer.
            first_step_timeout: Seconds to wait for the first dialog.

        Returns:
            ``ok``, ``dry_run``, ``committed``, ``stopped_for_a_human``,
            ``finished`` (how it ended) and ``steps`` (each dialog, what it
            offered, what was pressed and why).
app_set_dialog_control tool
Read or change a checkbox, radio, field or list row in the open
        dialog, found by its label (e.g. ``"Include Variants"``). Buttons
        are pressed by the dialog driver instead.

        Every change is read back; a click that did nothing is a
        failure. It refuses a disabled control and a request to switch
        a radio off. Asking for the current state clicks nothing
        (``changed: false``), so repeating a call is safe.

        Args:
            control_label: the control's visible label.
            checked: desired state for a checkbox.
            text: desired contents for an edit field.
            select_row: for a list, grid or tree, the row to select by
                name.
            dialog_title: substring to pick one dialog when several are
                open. Empty uses the first.
            list_only: change nothing, just report every control in the
                dialog with its role, state and whether it is enabled.

        Returns:
            For a read, the control list. For a change, ``ok``,
            ``changed`` and the state read back afterwards.
app_click_menu tool
Invoke ANY Altium menu command by clicking the real menu. Unlike
        ``app_run_menu``, which can report success for commands it never
        ran, this either runs the command or says why not. A last resort:
        try ``tool_guide`` first.

        Path by name, e.g. "Design|Rules" (accelerators and "..."
        ignored). Give the English names on any language: a translated
        Altium's own captions are matched from its install, and the
        reply's ``ui_language`` says which it was. It needs the
        foreground: it brings Altium forward and
        briefly moves the pointer, so ``may_steal_focus`` must be True.
        The menu bar depends on the focused editor, so focus the right
        document first. Read any dialog it opens with
        ``app_list_open_dialogs``.

        Args:
            menu_path: Pipe-separated path, top level first.
            may_steal_focus: Required to click anything.
            list_only: Only list the top-level menus on screen.
            expect_dialog: Part of the title the command should open;
                ``ok`` then means that dialog appeared.

        Returns:
            ``ok``, ``opened`` (dialog titles); on failure ``reason`` and
            ``offered`` (what that level contained). A path ending at a
            submenu is a failure. ``retried`` and ``first_read`` show a
            level read twice.
app_list_open_dialogs tool
What Altium has on screen, what it says, and if it is stuck.

        The tool for a quiet bridge: it reads the Windows process, not
        the bridge, so it answers while a modal blocks everything else.
        ``blocked`` means the main window is disabled; ``blocked: false``
        does not prove the UI is alive (a crashed UI read that way).

        Per dialog: caption, message, buttons and a ``kind``: ``error``,
        ``warning`` or ``confirm`` (set ``needs_a_human``),
        ``nothing_to_do`` (a success with no work, e.g. "No
        Differences"), ``engineering_change_order``, ``wizard``,
        ``progress`` or ``unknown``. Grids and owner-drawn lists can't be
        read (``has_unreadable_content``). Presses nothing.
        ``needs_a_human`` means no driver answers it blindly: read the
        message and press the answer the task calls for with
        app_press_dialog_button. Ask the user only when the choice is
        theirs, never to click a button for you.

        Returns:
            Dict with ``blocked``, ``dialog_count``, ``dialogs``,
            ``needs_a_human``, and a one-sentence ``summary``.
app_press_dialog_button tool
Press ONE named button in an open Altium dialog.

        By caption, ignoring ampersands and a trailing ellipsis ("Report
        Changes" finds "&Report Changes..."). It works while a modal
        blocks the bridge, since it presses through Win32. A caption that
        commits a change order or applies a wizard needs
        ``allow_irreversible``. For a sequence use ``app_drive_dialogs``.

        Args:
            button_caption: the visible caption.
            dialog_title: substring picking one dialog when several are
                open. Empty uses the first.
            allow_irreversible: permit a committing press.
            button: the same as ``button_caption``, the name clients reach
                for first.

        Returns:
            ``ok``, the dialog and button actually matched, and whether
            the dialog closed afterwards.
app_drive_dialogs tool
Answer dialogs reactively until none is left.

        Reads what is on screen, classifies it, decides a press and
        repeats, so dialogs in any order are handled. It STOPS on a
        dialog it cannot classify or one that needs a person. Dry run by
        default: it reports each decision and presses nothing.

        Two separate gates: ``allow_confirm`` answers a yes/no that moves
        an operation along; ``allow_commit`` permits the press that
        changes the design.

        Args:
            intent: "proceed" to carry the operation forward, or
                "cancel" to back out of whatever is open.
            allow_commit: permit the design-changing press.
            allow_confirm: permit answering a confirmation.
            dry_run: decide and report, press nothing. Default True.
            wait_first: seconds to wait for the first dialog, since a
                caller fires a command and then drives.
            budget: seconds before giving up on a wedged editor.

        Returns:
            Every observation and decision, plus ``committed``,
            ``stopped_for_a_human`` and why it finished.
app_run_ui_command tool
Invoke a menu command and answer the dialogs it raises, in one
        call (a modal blocks the scripting engine, so the two cannot be
        separate bridge calls). Prefer an API tool when one exists.

        The gates are app_drive_dialogs': confirmations are answered by
        default, a design-changing press (a change order) is not, and
        unlike app_drive_dialogs ``dry_run`` defaults off.

        Args:
            menu_path: pipe-separated, for example
                "Tools|Annotation|Force Annotate All Schematics...".
                Discover paths with app_click_menu(list_only=True).
            allow_commit: permit a design-changing press.
            allow_confirm: permit answering confirmations.
            dry_run: invoke the command but press nothing.
            may_steal_focus: opening a menu needs real input.
            wait_first: seconds to wait for the first dialog.
            budget: seconds before giving up.
            expect_dialog: part of the title of the dialog the command
                should open. When a different dialog (or none) appears,
                the reply fails at the menu stage and nothing is driven.

        Returns:
            ``ok``, the ``menu`` result, and the full ``dialogs`` record.
            ``ok`` is true only when the menu click AND the drive both
            succeeded, so a command that opened something nobody could
            answer does not read as a success.
app_list_panels tool
Altium's dockable panels that are currently on screen.

        PANELS ARE NOT DIALOGS and were unreachable until now. A dialog
        is a top-level window; a docked panel is a child of the main
        frame, so ``app_list_open_dialogs`` never saw one. Projects,
        Navigator, PCB, Properties and Messages all live here.

        Args:
            offered_too: also read what View > Panels lists, which is
                what COULD be opened rather than what is open. That
                needs a real menu click and steals focus, so it is off
                by default.

        Returns:
            ``{"ok": true, "panels": [{name, rect, button_hwnd,
            content_count}], "count": N}``, plus ``offered`` when asked
            for. A panel is found by the tab it carries, so an empty list
            comes with a ``note``: it has been reported empty on AD 25
            while Properties was open.
app_open_panel tool
Open a dockable panel by name, and confirm it appeared.

        Goes through View > Panels, because Altium exposes no scripted
        way to show a panel and ``application.execute_menu`` reports
        success while invoking nothing. So this STEALS FOCUS, like every
        menu click. Reading a panel afterwards does not.

        A panel that is already open is reported as such and NOT clicked.
        Those menu entries are toggles, so clicking one you already have
        would close it, and asking for a panel is not a request to lose
        it. When the panel cannot be seen after the click (it may have
        been open with no tab the scan reads), the entry is clicked once
        more so the panel is left as it was, and the reply says so with
        ``toggled_back``. Calling again does not help in that case.

        Args:
            name: the panel's name as View > Panels spells it, e.g.
                "Projects", "Messages", "PCB", "Properties".
            settle: how long to allow for it to appear.

        Returns:
            ``{"ok": true, "name": ..., "opened": bool, "rect": ...}``.
            ``opened`` is false when it was already there.
app_read_panel tool
Read what is inside an open panel.

        Takes no focus and moves nothing, so it is safe while a user is
        working. The panel must already be open: use ``app_open_panel``
        first, or ``app_list_panels`` to see what is there.

        Reads the WHOLE panel. It is not fast: Altium materialises its
        accessible tree lazily, so the first touch of a node costs about
        116 ms and 162 rows is roughly thirty seconds. Slow and complete
        beats fast and partial.

        Returns:
            ``{"ok": true, "name": ..., "row_total": N,
            "grids": [{control, hwnd, row_count, rows}]}``. Grids are
            reported separately because a panel holds more than one and
            they mean different things.
app_set_dropdown tool
Choose an option in a combo box or drop list, and verify it.

        THESE WERE READABLE AND UNSETTABLE. combobox and droplist have
        been reported by ``app_list_open_dialogs`` from the start, so a
        caller could see a combo and its current value with no way to
        change it, which is the same shape as a property that reads and
        will not write.

        Three routes are tried, cheapest first: the option's own default
        action, an accessible selection, then a real click on it. The
        value is READ BACK afterwards, so a route that runs and changes
        nothing is reported rather than believed.

        Args:
            control_label: the combo's label.
            option: the option to choose, matched by name.
            dialog_title: which dialog, when several are open.
            list_only: report the options and change nothing.

        Returns:
            ``{"ok": true, "value": ..., "how": ..., "was": ...}``, or
            ``ok: false`` with ``offered`` listing what is there.
app_expand_tree_node tool
Open or close a node in a tree, and verify the state changed.

        Trees were readable and could not be OPENED, so anything nested
        inside one did not exist as far as a caller was concerned.

        Args:
            control_label: the tree's label.
            node_name: the node to open, matched by name.
            expand: True to open, False to close.
            dialog_title: which dialog, when several are open.

        Returns:
            ``{"ok": true, "node": ..., "expanded": bool,
            "changed": bool}``. ``changed`` is false when it was already
            in that state, which is a success rather than a no-op to
            worry about.
app_set_grid_cell tool
Type into one cell of a grid, and read it back.

        How Altium's rule and property editors take input. The cell is
        activated, typed into, and read back from the cell itself.

        Args:
            control_label: the grid's label.
            row: the row, matched by name.
            column: the column name, or an index for unnamed cells.
            text: what to type.
            dialog_title: which dialog, when several are open.
            list_only: report the row's cells and change nothing; do it
                first to see the column names.

        Returns:
            ``{"ok": true, "row": ..., "column": ..., "value": ...}``,
            or ``ok: false`` when the cell reads back differently, which
            happens on read-only columns and on ones that validate and
            revert.
app_send_keys tool
Send a key sequence to whatever currently has focus.

        THE THINGS THAT TAKE NEITHER A CONTROL NOR A MENU: a canvas
        shortcut, a grid that commits on Enter, a dialog answered with
        Escape, a chord like Ctrl+Shift+D. Every other tool here
        addresses a control; this addresses the keyboard.

        Space separated, each item a key or a '+' chord:

            "escape"              one key
            "ctrl+s"              a chord
            "tab tab enter"       three in order

        Modifiers: ctrl, alt, shift. Keys: letters a to z, digits 0 to
        9, enter, escape, tab, space, backspace, delete, insert, the
        arrows, home, end, pageup, pagedown and F1 to F12. An unknown
        name is refused and the known ones listed, rather than sent as
        nothing. For literal text use app_type_text.

        THIS GOES WHEREVER FOCUS IS. Establish focus first, with
        app_click_menu or app_open_panel, and check the result
        afterwards: a keystroke has no read-back, so the reply says what
        was sent and never that it worked.
app_type_text tool
Type literal text into whatever has focus.

        For a field that HAS a handle, app_set_dialog_control is better:
        it addresses the control by name and reads the value back. This
        is for the places with no handle to address, where typing is the
        only route in.

        Carries punctuation and case, since it sends characters rather
        than virtual keys. No read-back, for the same reason as
        app_send_keys.
app_context_menu tool
Right click at a point: read the context menu, or pick from it.

        CONTEXT MENUS WERE ENTIRELY UNREACHABLE, and Altium puts a great
        deal in them that no top-level menu duplicates: what you can do
        to a component, a net, a polygon, a row in a panel. Driving the
        menu bar while ignoring these leaves most of the editor shut.

        With no ``item`` this OPENS the menu, reads what it offers and
        CLOSES it again, invoking nothing. Leaving a popup dropped
        blocks the next operation and looks to a user like a hang.

        Args:
            x, y: screen coordinates to right click. Panel and control
                rectangles from app_list_panels and
                app_set_dialog_control(list_only=true) give you these.
            item: the entry to choose. Nested entries take a '|' path,
                matched by name at each level like the menu bar.
            relative_to: "window" takes x, y as pixels of the main
                window, as app_screenshot pictures it.

        Returns:
            Reading: ``{"ok": true, "items": [...], "count": N}``.
            Choosing: ``{"ok": true, "item": ...}``, or ``ok: false``
            with ``offered`` listing what was actually there.
app_toolbar tool
List toolbar buttons, or press one by name.

        Toolbars are the other half of the bar framework the menus use
        and were not addressed at all. Many carry a command with no menu
        equivalent, or reach in one click what the menu takes three to.

        With no ``name`` this lists every button it can see with its
        rectangle. With one, it presses that button and reports whether
        a menu dropped as a result, since many toolbar buttons open one
        rather than acting.
app_dialog_tab tool
List a dialog's tab pages, or switch to one.

        PROPERTY DIALOGS HIDE MOST OF THEMSELVES BEHIND TABS. Nothing
        could switch one, so app_set_dialog_control only ever saw the
        front page and reported it as the whole dialog: a control on any
        other page read as a control the dialog does not have.

        With no ``name`` this lists the pages and which is selected.
app_scroll_control tool
Scroll a list, grid or tree so more of it comes into view.

        A LONG LIST HIDES ITS OWN CONTENTS. A virtualised DevExpress
        grid exposes roughly what is on screen, so a row further down
        did not exist as far as a caller was concerned, and the reply
        gave no hint that anything was missing.

        Positive scrolls down, negative up. The reply reports whether
        the rows actually changed: ``moved: false`` at the end of a list
        is a real answer rather than a failure.
app_activate_row tool
Invoke a row, rather than merely selecting it.

        ``app_set_dialog_control(select_row=...)`` highlights a row.
        This ACTS on it, which in a panel is the difference between
        pointing at a document and opening it.

        A click has no read-back, so the reply reports what was done and
        not what it caused.
app_screenshot tool
Capture Altium, or one dialog, to a PNG.

        THE AGENT COULD NOT SEE THE UI. ui/ocr.py has been able to
        capture and read a window since it was written and none of it
        was exposed, so every judgement about what was on screen came
        from an accessible tree that omits anything drawn rather than
        placed. A picture settles what a tree cannot: which page is in
        front, whether a control is greyed, what a rendered dialog
        actually says.

        Args:
            path: where to write the PNG. Defaults to the workspace
                directory, so the file is somewhere findable.
            dialog_title: capture that dialog rather than the main
                window.

        Returns:
            ``ok``, ``path``, ``hwnd``, and the picture's ``width`` and
            ``height`` in pixels; it is the window at its real size, so
            things can be measured on it. ``window_left`` /
            ``window_top`` place it on the screen. Read the file to look
            at it.
app_recover_script tool
Clear a crashed bridge script and restart the loop.

        A call that crashes the script does this by itself. This is for a
        script found halted later: the Script IDE holding a line, or
        "Another script executing now". It screenshots and answers OK on a
        script error box, screenshots the halted line, stops the script
        (Run > Stop, Ctrl+F3) and restarts the loop, with other sessions'
        calls waiting through it. Screenshots and a record go to
        logs/crashes in the workspace.

        Args:
            force: restart even when Altium's title does not name the
                script project and the loop answers a ping. Without it a
                loop that does not answer, while no session's call is
                running, is restarted.

        Returns:
            ``halted`` (whether a restart ran), ``screenshots``,
            ``dialog``, ``title``, ``restart`` {restarted, output} and
            ``record``.
app_canvas tool
Click or drag on the editor canvas, at screen coordinates.

        THE CANVAS HAS NO NAMED CONTROLS, so every other tool here could
        not touch it. Placing, moving, rubber-band selecting and routing
        are pointer gestures and there was no way to make one.

        With ``to_x``/``to_y`` this DRAGS, moving in steps rather than
        jumping, because a jump reads as a click at the destination.
        Without them it clicks.

        NO READ-BACK IS POSSIBLE. The reply says what gesture was made
        and never what it did. Confirm with a bridge read, which can see
        the document, rather than trusting this.

        ``relative_to="window"`` takes the points as pixels of the main
        window, as app_screenshot pictures it.
app_wait_for_dialog tool
Block until a dialog appears, and report which one.

        A COMMAND THAT RAISES A DIALOG RETURNS BEFORE THE DIALOG EXISTS.
        A caller that acted and then looked found nothing and concluded
        none was coming; the alternative was a fixed sleep long enough
        to be safe, which is the pattern this layer spent the day
        removing everywhere else.
app_ui_snapshot tool
Everything on screen, in one call: menus, panels, dialogs, toolbars.

        ORIENTATION IS THE EXPENSIVE PART. Finding out what is available
        took four calls and knowing which four to make, and a caller who
        guessed wrong concluded a capability was missing. This is the UI
        equivalent of app_context: one call that answers "what am I
        looking at".

        Reads only. Takes no focus, moves no pointer, changes nothing,
        so it is safe while somebody is working. The menu BAR is listed
        because reading it needs no click; menu contents are not,
        because opening one does.
app_read_window tool
Read a window through UI Automation, which sees what MSAA cannot.

        THE LAYER THAT WAS MISSING. This project read Altium three ways:
        window text, which returns nothing for anything without a handle;
        MSAA, which handles the VCL dialogs well and the WPF ones not at
        all; and OCR on the pixels. UIA sits between the second and the
        third.

        It matters most for the case that forced OCR into existence.
        Altium's newer WPF dialogs have buttons that are NOT child
        windows, so EnumChildWindows finds nothing and MSAA has nothing
        to press. WPF is UIA-native, so those same buttons are ordinary
        elements here, with names, and they can be pressed properly with
        app_invoke_element.

        WHAT IT STILL WILL NOT SEE. Delphi's TLabel owns no handle and
        publishes no accessible object, so its text exists only as
        pixels. Use app_screenshot there; that is what OCR is for and
        why it stays.

        Returns:
            ``{"ok": true, "count": N, "elements": [{name, type,
            automation_id, enabled, rect}], "text": [...]}``.
app_invoke_element tool
Press, set or expand an element through UI Automation patterns.

        Not a simulated click: Invoke presses, Value sets text and
        ExpandCollapse opens a node, so no pointer moves, no focus is
        taken and nothing under the cursor is hit. The right tool for WPF
        dialogs and for work while the user keeps working. A client that
        does not list it can call it through ``tool_invoke``.

        Args:
            name: the element's name or automation id. A Button of that
                name is preferred over a label carrying the same text.
            dialog_title: which dialog. Empty uses the frontmost open
                dialog, or the main window when no dialog is open.
            text: set this value instead of pressing.
            expand: "true" or "false" to open or close a node instead.

        Returns:
            ``ok`` with what was done and, for a press in a dialog,
            ``dialog_closed``; or a refusal naming which pattern the
            element lacks and its rectangle, so a real click remains
            possible as a fallback.
server_update tool
Check the eda-agent repository for a newer version, or install it.

        ASK THE USER FIRST. Call with apply=True only after the user has
        agreed in this conversation to update; describe what is new
        (``new_commits``) when you ask. app_ping and app_context report
        ``update`` when the daily check found one.

        With apply=False (default) it fetches and reports what an update
        would bring, and changes nothing. With apply=True it fast-forwards
        the clone, reinstalls when the dependencies changed, copies the
        Altium scripts again when they changed and, with ``relaunch``,
        restarts the Altium loop so it compiles them (other sessions' calls
        wait through the restart). A clone with uncommitted changes or
        commits of its own is refused and left untouched.

        Args:
            apply: Install the update. Only after the user says yes.
            relaunch: Restart the Altium loop when the scripts changed.

        Returns:
            Check: ``update_available``, ``commits_behind`` (as ``behind``),
            ``new_commits``, ``local_changes``, ``ahead``. Apply: ``updated``,
            ``from``, ``to``, ``commits``, ``steps`` (each ok and its output)
            and ``next_step``: reconnect the MCP server to run the new
            Python.
pcb_place_simple_body tool
pcb_place_tracks tool
autonomous_design prompt
Drive a full spec-to-board design run with the harness.
(name computed at run time) prompt
(name computed at run time) prompt
(name computed at run time) resource

What we checked

The same checks run on every server. Each line below has one of these marks:

FoundA published issue such as a risky tool or a CVE
PassedWe ran the check on this server and found nothing
After reviewChecked; we publish it once a person verifies it
Partly tracedRan, but the scanner could not follow every path to its end
FactWhat the code does, not a judgement either way
Not checkedThe scanner had nothing to read for it, or it needs the live server
Code Safetypartly traced
  • 8 checks: command injection, argument injection, path traversal, server-side request forgery, SQL injection, code execution, unsafe deserialization, template injection
    Checked on every scan. Results in this category are published only after a person has verified them.
Capability Exposure0.0
  • Runs programs the caller chooses
    No tool runs a command or program the caller supplies — 1117 tool handlers traced. Not every path could be followed, so this is not a clean pass.
  • Executes caller-supplied code
    No tool evaluates code the caller supplies — 1117 tool handlers traced. Not every path could be followed, so this is not a clean pass.
  • Reads or writes any file path HIGH
    38 findings in kicad_create_footprint, kicad_create_symbol, kicad_export_drill, kicad_export_dxf and more; 37 more to review
  • Requests any address HIGH
    2 findings in part_fetch
  • Runs caller-supplied SQL
    No tool executes a query the caller supplies — 1117 tool handlers traced. Not every path could be followed, so this is not a clean pass.
  • Tools that start processes
    5 of 1117 capabilities start processes; 1103 more call code the scanner could not follow, where it may happen
  • Tools that touch files
    224 of 1117 capabilities touch files; 884 more call code the scanner could not follow, where it may happen
  • Tools that call the network
    240 of 1117 capabilities call the network; 868 more call code the scanner could not follow, where it may happen
Where the code is: 1117 handlers in 34 files at commit 7a23938bf2f7
Prompt Integrity10.0
  • 5 checks: tool poisoning, instruction override, hidden content, exfiltration requests, metadata integrity
    Checked on every scan. Results in this category are published only after a person has verified them.
Supply Chain6.4
  • Dependency manifests
    5 manifests: pyproject.toml, render-core/Cargo.toml, render-core/pyproject.toml, route-core/Cargo.toml, route-core/pyproject.toml
  • Lockfiles checked against OSV
    2 files resolved and checked against the OSV database; 3 not resolved: pyproject.toml: dependency ranges declared here were not resolved against a lockfile and were not checked; render-core/pyproject.toml: dependency ranges declared here were not resolved against a lockfile and were not checked
  • Known vulnerabilities in production dependencies HIGH
    1 production package with known advisories
  • Known vulnerabilities in other dependencies
    No package used only for development, tests or examples has a known advisory
  • MCP SDK version
    mcp >=1.0.0,<2
Secrets & Credentials10.0
  • 3 checks: credential harvesting, undeclared credential access, credentials sent over the network
    Checked on every scan. Results in this category are published only after a person has verified them.
  • Tools that read credentials
    3 of 1117 capabilities read credentials; 1105 more call code the scanner could not follow, where it may happen
  • Environment variables
    252 capabilities read environment variables (often API keys)
  • Authentication declared
    Not checked: needs the live server's tools/list (a remote server declares how clients authenticate)
Behavior Transparency10.0
  • 3 checks: undeclared network access, undeclared file access, undeclared process execution
    Checked on every scan. Results in this category are published only after a person has verified them.
  • Tool descriptions present
    Every tool has a description the model and the user can read (1 only in code no tool reaches)
  • Statically known names
    Every tool's name could be read from the code
  • Input schemas
    Not checked: needs the live server's tools/list (every tool declares an input schema)
  • Destructive tools annotated
    Not checked: needs the live server's tools/list (tools that write, delete or run commands carry destructivehint)

Dependencies with known vulnerabilities (1 in production)

Dependency ranges were not resolved against a lockfile, so the score is capped at 7.

PackageInstalledWorstAdvisoriesFixed in
pyo3crates.io 0.23.5 HIGH 5 advisories 0.24.10.29.0
  • HIGHGHSA-36hh-v3qg-5jq4 RUSTSEC-2026-0176PyO3 has an Out-of-bounds Read in `nth` / `nth_back` for `PyList` and `PyTuple` iterators
  • MEDIUMGHSA-chgr-c6px-7xpp RUSTSEC-2026-0177PyO3 has a missing `Sync` bound on `PyCFunction::new_closure` closures
  • MEDIUMRUSTSEC-2026-0177 GHSA-chgr-c6px-7xppMissing `Sync` bound on `PyCFunction::new_closure` closures
  • MEDIUMRUSTSEC-2025-0020 GHSA-pph8-gcv7-4qj5Risk of buffer overflow in `PyString::from_object`
  • LOWGHSA-pph8-gcv7-4qj5 RUSTSEC-2025-0020PyO3 Risk of buffer overflow in `PyString::from_object`

Past security advisories

Vulnerabilities published for this server itself, from the GitHub Advisory Database.

No security advisories have been published for this server in the GitHub Advisory Database.

How it runs

Where it runsOn your machine, started by your MCP client from this repository or its package
Transportnot stated in the code the scanner read; most local servers talk over stdio
Sign-innot checked needs the live server
MCP SDKmcp >=1.0.0,<2
Servers in the code20 (gen, t, test, k, e, m)

The project's own security

Security policyyes SECURITY.md
Private reportingthe policy does not name a private channel
Past advisoriesnone in the GitHub Advisory Database
Last push2026-11-16
Signed releasesnot checked yet

Where it is published

MCP Registryio.github.salitronic/eda-agent
Listed in6 catalogs (awesome_tensorblock, github_search, glama, mcp_registry, mcp_toplist, mcpservers_org)
LicenseApache-2.0
Created2026-04-16
Topicsai ai-agent altium altium-designer claude claude-code delphiscript design-review drc easyeda

Attack map

How the server is built and where its risky tools lead: servers, their tools, what the tools' code can do, and the traced route from a declared risky tool's argument to the operation it reaches. Click a node for details.

Request a scan or an audit

Tell us about your server. We reply within 5 working days.

What do you need? *

We use these details only to answer you.