Skip to main content
Glama

assign_footprint

Assign footprints to placed symbols, as CvPcb ("Assign Footprints") of KiCad 10 does it when it saves.

Instructions

Assign footprints to placed symbols, as CvPcb ("Assign Footprints") of KiCad 10 does it when it saves.

The tool writes the footprint into the Footprint field of each unit of the reference, in the symbol, not in a variant. A variant with a Footprint of its own keeps it (the tool gives a warning; set_symbol_fields with the variant changes it). When the old footprint is empty and the field is visible, the field becomes hidden, as the save of CvPcb does ("Footprint field visible" in the table), also when the footprint stays empty. CvPcb hides such a field in each symbol of the netlist; the tool changes only the references of the call. An empty footprint removes the footprint.

The tool checks each footprint as CvPcb has it:

  • The footprint must be in a library that KiCad loads (the global and the project footprint library tables, an enabled row of the type "KiCad"), with the same case: else an error.

  • The footprint filters of the symbol (anchored wildcards, with no difference of case; a filter with ":" compares ":") and the pin count (the pins of the symbol against the pads of the footprint) give a warning when they do not match. CvPcb then does not show the footprint in that filtered list. The tool still writes the footprint.

The tool gets the pin count and the filters from the netlist of kicad-cli (the netlist that CvPcb reads). It refuses a reference that the netlist does not have (a symbol that is excluded from the board, or in a sheet that is excluded from the board), a power symbol (a reference that starts with "#"), a reference that is not annotated (U?), a duplicate reference, a symbol with no Footprint field, a Footprint field with a text variable (KiCad compares the resolved text), a footprint ID with no library name, and a library of an other type than "KiCad". With kicad-cli 10.0.0 to 10.0.6, a project with more than one top-level sheet is an error.

A symbol in a sheet that the hierarchy uses more than one time has one Footprint field for all its references (U201 and U301): give the same footprint for each of these references. CvPcb changes all of them; the tool refuses a call that gives only one.

The tool checks all assignments and all files first, and writes no file when a check fails. It writes all files or no file. KiCad must not have the files open. A schematic file of the project with an older version than the installed KiCad writes is an error: the user converts it in KiCad first. The installed KiCad must be KiCad 10.0.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "schematic_path": "<schematic_path>",
      "assignments": "<assignments>"
    },
    "name": "assign_footprint"
  }
}

Input Schema

NameRequiredDescriptionDefault
assignmentsYesOne item for each reference: the reference and the footprint ("<library>:<footprint>", or empty to remove it).
schematic_pathYesA .kicad_sch file of the project. The tool finds the references in the full project.

Output Schema

NameRequiredDescriptionDefault
resultYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.2.0

TDQS

A4.7/5.0
Behavior5/5

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

With no annotations, the description carries the full behavioral burden and does so: it discloses write target, warning-vs-error behavior for filter and pin-count mismatches, the field-visibility side effect on empty footprints, all-or-nothing atomicity ('writes all files or no file'), and the precondition that KiCad must not have the files open. It also pins version constraints (KiCad 10.0, multi-sheet bug in 10.0.0–10.0.6).

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The purpose is front-loaded in the first sentence and the refusal conditions are grouped sensibly, but the text is bloated: empty-footprint removal is stated twice, and the repeated 'as CvPcb does' comparisons and parenthetical asides add length without new decision-relevant information. The core guidance could be conveyed in roughly half the words.

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

Completeness5/5

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

For a high-complexity mutation tool, the description covers preconditions, validation semantics, partial-failure guarantees, side effects, and version requirements; return values needn't be explained because an output schema exists. An agent has everything needed to call it correctly or know why it will fail.

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

Parameters4/5

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

Schema coverage is already 100%, so the baseline is 3; the description goes beyond it by explaining that an empty footprint removes the assignment, that the footprint must match a loaded KiCad library case-sensitively, and that hierarchical multi-instance symbols require one entry per reference. It does not add syntax detail beyond the schema's example library ID, which keeps it at 4 rather than 5.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The opening sentence names a specific verb and resource ('Assign footprints to placed symbols') and immediately locates the effect ('writes the footprint into the Footprint field ... in the symbol, not in a variant'). It also distinguishes itself from set_symbol_fields, which is the tool to use for variant-level footprints, so an agent can separate the two without opening either schema.

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

Usage Guidelines5/5

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

Usage is spelled out in both directions: it lists when the tool refuses a call (unannotated reference, power symbol starting with '#', duplicate reference, symbol excluded from the board, footprint ID without library name, non-'KiCad' library, older file version, KiCad version mismatch) and what to do instead (set_symbol_fields for variants, convert the file in KiCad first). The multi-instance rule ('give the same footprint for each of these references') is stated with an example.

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

Deploy Server

Other Tools