feat: support arbitrary custom properties on schematic components
Promotes BOM / sourcing fields (MPN, Manufacturer, DigiKey_PN, LCSC,
JLCPCB_PN, Voltage, Tolerance, Dielectric, ...) to first-class citizens
on placed schematic symbols.
New MCP tools:
- set_schematic_component_property: add or update one custom property
on a component (convenience wrapper around edit_schematic_component).
- remove_schematic_component_property: delete one custom property.
The four built-in fields (Reference, Value, Footprint, Datasheet) are
protected and rejected.
edit_schematic_component enhancements:
- New `properties` parameter: map of property name to either a string
value or a full spec object { value, x?, y?, angle?, hide?, fontSize? }.
Adds the property when missing, otherwise updates the existing field
(and optionally its label position / visibility). Lets a single tool
call attach an entire BOM payload to a component.
- New `removeProperties` parameter: list of custom property names to
delete in the same call.
- Property values are now backslash-escaped so descriptions containing
a double-quote or a backslash no longer corrupt the .kicad_sch file.
- New properties default to (hide yes) so they appear in BOM exports
without cluttering the schematic canvas.
get_schematic_component description clarified to highlight that it
already returns every field on the symbol, including custom ones.
New MCP prompt component_sourcing_properties guides agents through the
conventional property names recognised by downstream BOM tooling and
the recommended call sequence.
Implementation (python/kicad_interface.py):
- _PROTECTED_PROPERTY_FIELDS frozenset
- _escape_sexpr_string / _find_matching_paren static helpers
- _set_property_in_block / _set_hide_on_property /
_remove_property_from_block surgical text-level edits that preserve
formatting and the property's UUID
- _handle_edit_schematic_component rewritten to orchestrate
add/update/remove and return a per-property summary
- New handlers _handle_set_schematic_component_property and
_handle_remove_schematic_component_property registered in the
command dispatch table
Tests (tests/test_schematic_component_properties.py):
32 tests covering escape helper, paren matcher, add/update/remove
(single + batched), full spec dicts, default position, default
(hide yes), special-character escaping, UUID preservation, protected
built-in field rejection, no-op removal, both new convenience tools,
and input validation. All 590 tests in the project still pass.
Docs: README, SCHEMATIC_TOOLS_REFERENCE, TOOL_INVENTORY, CHANGELOG.
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
# KiCAD MCP Server - Complete Tool Inventory
|
||||
|
||||
**Version:** 2.2.3
|
||||
**Total Tools:** 122 (18 direct + 65 routed + 4 router + 35 additional)
|
||||
**Last Updated:** 2026-03-21
|
||||
**Total Tools:** 124 (18 direct + 65 routed + 4 router + 37 additional)
|
||||
**Last Updated:** 2026-04-20
|
||||
|
||||
## How Tools Are Organized
|
||||
|
||||
@@ -130,22 +130,24 @@ _Source: `src/tools/export.ts`_
|
||||
|
||||
---
|
||||
|
||||
## Schematic (27 tools)
|
||||
## Schematic (29 tools)
|
||||
|
||||
_Source: `src/tools/schematic.ts`_
|
||||
|
||||
### Component Operations
|
||||
|
||||
| Tool | Description | Access |
|
||||
| ---------------------------- | ------------------------------------------------------- | ------------------ |
|
||||
| `add_schematic_component` | Add component to schematic (symbol from library) | Direct |
|
||||
| `delete_schematic_component` | Remove component from schematic | Additional |
|
||||
| `edit_schematic_component` | Edit component properties (footprint, value, reference) | Additional |
|
||||
| `get_schematic_component` | Get component info with field positions | Additional |
|
||||
| `list_schematic_components` | List all components in schematic | Direct |
|
||||
| `move_schematic_component` | Move component to new position | Routed (schematic) |
|
||||
| `rotate_schematic_component` | Rotate component | Routed (schematic) |
|
||||
| `annotate_schematic` | Auto-annotate reference designators | Direct |
|
||||
| Tool | Description | Access |
|
||||
| ------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ------------------ |
|
||||
| `add_schematic_component` | Add component to schematic (symbol from library) | Direct |
|
||||
| `delete_schematic_component` | Remove component from schematic | Additional |
|
||||
| `edit_schematic_component` | Edit footprint, value, reference, label positions, and **arbitrary custom properties** (MPN, Manufacturer, DigiKey, …) | Additional |
|
||||
| `set_schematic_component_property` | Add or update a single custom property (BOM/sourcing field) on a component | Additional |
|
||||
| `remove_schematic_component_property` | Delete a single custom property from a component | Additional |
|
||||
| `get_schematic_component` | Get component info: built-in fields + all custom properties + label positions | Additional |
|
||||
| `list_schematic_components` | List all components in schematic | Direct |
|
||||
| `move_schematic_component` | Move component to new position | Routed (schematic) |
|
||||
| `rotate_schematic_component` | Rotate component | Routed (schematic) |
|
||||
| `annotate_schematic` | Auto-annotate reference designators | Direct |
|
||||
|
||||
### Wiring and Connections
|
||||
|
||||
|
||||
Reference in New Issue
Block a user