fix: footprint param ignored, delete duplicates, add edit_schematic_component
Bug 1 - add_schematic_component: footprint parameter silently ignored The footprint value from MCP params was never passed through to DynamicSymbolLoader.add_component() / create_component_instance(). Every placed symbol had an empty Footprint field regardless of input. Fix: added footprint: str='' to both functions, passed through all call sites, added footprint to schematic.ts tool schema. Bug 2 - delete_schematic_component: only deleted first duplicate When a reference appeared multiple times (e.g. after a failed add attempt), only the first instance was removed due to break after first match. Fix: collect all matching blocks first, then delete back-to-front to preserve indices. Response now includes deleted_count. New tool - edit_schematic_component Update footprint, value or reference of a placed symbol in-place. More efficient than delete+re-add: preserves position and UUID. Accepts: schematicPath, reference, footprint?, value?, newReference? All 3 fixes verified by live tests on a real JLCPCB/KiCAD 9 project: - R_TEST1: footprint Resistor_SMD:R_0603_1608Metric written correctly - J1 duplicate: deleted_count=2 with single call - J2 edit: PinSocket footprint assigned in-place, no delete+add needed - PCB update (F8) confirmed: only components with footprint imported
This commit is contained in:
62
CHANGELOG.md
62
CHANGELOG.md
@@ -4,44 +4,42 @@ All notable changes to the KiCAD MCP Server project are documented here.
|
||||
|
||||
## [2.2.1-alpha] - 2026-02-28
|
||||
|
||||
### New MCP Tools
|
||||
|
||||
- `edit_schematic_component` – Update properties of a placed symbol in-place (footprint,
|
||||
value, reference rename). More efficient than delete + re-add: preserves position and UUID.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- `add_schematic_component`: `footprint` parameter was accepted but silently ignored – the
|
||||
value was never passed through to `DynamicSymbolLoader.add_component()` /
|
||||
`create_component_instance()`. All newly placed symbols always had an empty Footprint
|
||||
field. Fix: added `footprint: str = ""` to both functions and threaded it through every
|
||||
call site including the TypeScript tool schema.
|
||||
|
||||
- `delete_schematic_component`: only deleted the first matching instance when duplicate
|
||||
references existed (e.g. after an aborted add attempt). Root cause: loop used `break`
|
||||
after the first match. Fix: collect all matching blocks first, then delete them all back-
|
||||
to-front (to preserve line indices). Response now includes `deleted_count`.
|
||||
|
||||
- `templates/*.kicad_sch`, `project.py`, `schematic.py`: Update KiCAD schematic format
|
||||
version from `20230121` (KiCAD 7) to `20250114` (KiCAD 9).
|
||||
version from `20230121` (KiCAD 7) to `20250114` (KiCAD 9). The MCP server targets
|
||||
KiCAD 9 exclusively (`pcbnew.pyd` compiled for KiCAD 9.0, Python 3.11.5) – generating
|
||||
files in an outdated format caused a spurious "This file was created with an older
|
||||
KiCAD version" warning on every newly created schematic.
|
||||
|
||||
**Root cause:** The MCP server targets KiCAD 9 exclusively – `pcbnew.pyd` is compiled
|
||||
for KiCAD 9.0 / Python 3.11.5, and the server explicitly selects the KiCAD 9 bundled
|
||||
Python on Windows. Generating new schematics with a 2-year-old format tag caused a
|
||||
spurious "This file was created with an older KiCAD version, it will be updated on
|
||||
save" dialog on every newly created schematic, which confused users into thinking
|
||||
something was broken.
|
||||
- `template_with_symbols_expanded.kicad_sch`: Remove 13 corrupt `_TEMPLATE_*` placed-symbol
|
||||
blocks with `(lib_id -100)` – an integer caused by old sexpdata serializer (same bug
|
||||
PR #40 fixed for the add path). KiCAD crashed with a null-pointer when selecting these
|
||||
symbols. They appeared as grey `_TEMPLATE_R?`, `_TEMPLATE_U_REG?` etc. labels far
|
||||
outside the sheet boundary (~5000mm off-sheet).
|
||||
|
||||
**Fix:** Updated header in all 4 template files and both inline schematic generators
|
||||
(`project.py`, `schematic.py`) to emit `(version 20250114)`.
|
||||
**Discovered via:** live testing on a real JLCPCB/KiCAD 9 project.
|
||||
**Affected users:** schematics created from this template before this fix contain the
|
||||
same corrupt blocks – remove all `(symbol (lib_id -100) ...)` blocks whose Reference
|
||||
starts with `_TEMPLATE_`.
|
||||
|
||||
- `template_with_symbols_expanded.kicad_sch`: Remove 13 corrupt `_TEMPLATE_*`
|
||||
placed-symbol blocks containing `(lib_id -100)`.
|
||||
|
||||
**Root cause:** The expanded template was generated by the old sexpdata serializer
|
||||
(the same corruption PR #40 fixed for the DynamicSymbolLoader add-path). The serializer
|
||||
converted the string `"Device:R"` to the integer `-100`, producing `(lib_id -100)`
|
||||
instead of `(lib_id "Device:R")`. KiCAD cannot resolve an integer as a library
|
||||
reference and crashes with a null-pointer when the user attempts to select or box-select
|
||||
these symbols. They appeared as grey `_TEMPLATE_R?`, `_TEMPLATE_C?`, `_TEMPLATE_U_REG?`
|
||||
etc. labels ~5000 mm outside the sheet boundary – invisible during normal work but
|
||||
triggering a crash when accidentally selected.
|
||||
|
||||
**Discovered via:** Live testing on a real JLCPCB/KiCAD 9 project where Claude Desktop
|
||||
(via MCP) created a schematic from the expanded template.
|
||||
|
||||
**Fix:** Removed all 13 `_TEMPLATE_*` placed-symbol blocks using parenthesis-depth
|
||||
tracking (same text-manipulation approach as PR #40). The `lib_symbols` section
|
||||
(symbol definitions) is unchanged – only the corrupt placed instances were removed.
|
||||
|
||||
**Affected users:** Any schematic created from `template_with_symbols_expanded.kicad_sch`
|
||||
before this fix contains the same corrupt blocks. To clean an existing schematic,
|
||||
remove all `(symbol (lib_id -100) ...)` blocks whose `Reference` property starts
|
||||
with `_TEMPLATE_`.
|
||||
---
|
||||
|
||||
---
|
||||
|
||||
|
||||
Reference in New Issue
Block a user