rename_library_footprint
Give a footprint of a project library an other name, as "Rename" of the library tree of the footprint editor of KiCad 10 does.
Instructions
Give a footprint of a project library an other name, as "Rename" of the library tree of the footprint editor of KiCad 10 does.
KiCad saves the footprint as ".kicad_mod", then removes the old file. The Value gets the new name when it was equal to the old name. As the rename dialog, the tool removes the white space at the two ends of the name. A name with one of the characters \ / : " < > | * ? is an error: KiCad changes them to "_" in the file name, and reads the name from the file name.
A name that the library has already is an error: the tool does not replace a footprint. On a file system with no difference of case in file names (Windows, macOS), a change of only the case of the name is one file: KiCad 10.0.7 and later delete the old footprint first, then save the new one, and so does the tool. With KiCad 10.0.6 (it saves first, then deletes, and thus removes the footprint) the tool refuses such a rename: do it in two steps.
KiCad does not change the uses of the old name, and neither does the tool: the answer gives as a warning the Footprint fields of the placed symbols (also of their variants) and of the symbols of the project symbol libraries, and the footprints of the board of the project, that have the old library ID.
The library must be a footprint library of the project table, in the version of the installed KiCad (else: upgrade_project_libraries first). A footprint that is not on F.Cu is refused. KiCad saves the footprint (kicad-cli), and a second save must give the same bytes. KiCad must not have the project open. 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": {
"project_path": "<project_path>",
"lib_id": "<lib_id>",
"new_name": "<new_name>"
},
"name": "rename_library_footprint"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| lib_id | Yes | The footprint, "<library>:<footprint>", of a library of the project table. | |
| new_name | Yes | The new name. | |
| project_path | Yes | The .kicad_pro file or the project folder. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |