Set attribute
set_attributeAdd or update a label or relation on a note to organize and link Trilium content. Upsert edits an existing attribute in place; use add mode for repeated labels.
Instructions
Add or update a label or relation on a note. Upsert (default) edits the first own attribute with the same type+name in place when only a label's value or the position changes. Trilium cannot edit a relation's target or isInheritable in place, so those changes delete and recreate the attribute; the response then has replaced:true, oldAttributeId and the new attributeId.
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": {
"noteId": "<noteId>",
"type": "<type>",
"name": "<name>",
"value": "<value>"
},
"name": "set_attribute"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| mode | No | "upsert" (default): change the first own attribute with the same type+name, or create one. "add": always create, for repeated labels (e.g. several #tag values). Ignored when attributeId is given. | upsert |
| name | Yes | Attribute name without the leading # or ~. | |
| type | Yes | "label" (#name) or "relation" (~name). | |
| value | Yes | Label value ("" for a valueless label such as #archived), or the target noteId for a relation. | |
| noteId | Yes | Note that owns the attribute. | |
| position | No | Ordering among attributes (10, 20, 30...); lower comes first. | |
| attributeId | No | Force the ID of a newly created attribute (imports/migrations; 4-32 alphanumeric chars). Always creates — it does not select an existing attribute. | |
| isInheritable | No | Whether child notes inherit the attribute. On upsert, changing it replaces the attribute (delete + create, new attributeId). |