noteTypes.editStructure
noteTypes_editStructureApply ordered field and template edits to an Anki note type in a single validated save, preserving card identity and rejecting invalid removals or cloze structures.
Instructions
Apply ordered structural edits and persist once using native note-type updates.
Carry original field/template ordinals to preserve card identity. Added entries have no original ordinal. Validate all edits on a copy before saving; reject last field/template removal and invalid cloze structures.
Anki-Connect method noteTypes.editStructure. Scope: collection. Effect: write. Completion: completed. Undo: single.
Possible errors: collectionUnavailable, editorConflict, internalError, invalidParams, notFound, staleSession, validationFailed.
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": {
"noteType": "<noteType>",
"edits": "<edits>"
},
"name": "noteTypes_editStructure"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| edits | Yes | Ordered structural edits, each {op, ...} with op one of addField, updateField, moveField, removeField, addTemplate, updateTemplate, moveTemplate, removeTemplate. Saved once after all edits apply. | |
| session | No | Optional. Collection session ID: the `session` field returned by `collection_get`. Usually omit it — the server then uses the session current at the time of the call. Pass it to make the call fail with `staleSession` instead of acting on a different profile/collection than the one your IDs, cursors and tokens came from. | |
| noteType | Yes | Note type: exactly one of {"id": "<noteTypeId>"} or {"name": "<note type name, e.g. Basic>"}. |