Skip to main content
Glama
triliumnext-mcp

triliumnext-mcp

by perfectra1n

Set attribute

set_attribute

Add 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

NameRequiredDescriptionDefault
modeNo"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
nameYesAttribute name without the leading # or ~.
typeYes"label" (#name) or "relation" (~name).
valueYesLabel value ("" for a valueless label such as #archived), or the target noteId for a relation.
noteIdYesNote that owns the attribute.
positionNoOrdering among attributes (10, 20, 30...); lower comes first.
attributeIdNoForce the ID of a newly created attribute (imports/migrations; 4-32 alphanumeric chars). Always creates — it does not select an existing attribute.
isInheritableNoWhether child notes inherit the attribute. On upsert, changing it replaces the attribute (delete + create, new attributeId).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed10 schema fields changedv0.4.0
    • changedInput schema / properties / attributeId / description
      Previous value: -"Force a specific attribute ID (for imports/migrations). Must be 4-32 alphanumeric chars."New value: +"Force the ID of a newly created attribute (imports/migrations; 4-32 alphanumeric chars). Always creates — it does not select an existing attribute."
    • changedInput schema / properties / isInheritable / description
      Previous value: -"Whether inherited by child notes"New value: +"Whether child notes inherit the attribute. On upsert, changing it replaces the attribute (delete + create, new attributeId)."
    • changedInput schema / properties / mode / description
      Previous value: -"\"upsert\" (default) — update the first existing attribute with the same type+name, or create one if none exists. \"add\" — always create a new attribute, enabling multiple same-name labels (e.g. several #tag values on one note). Ignored when attributeId is provided."New value: +"\"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."
    • changedInput schema / properties / name / description
      Previous value: -"Name of the attribute (without # or ~)"New value: +"Attribute name without the leading # or ~."
    • changedInput schema / properties / noteId / description
      Previous value: -"ID of the note to set attribute on"New value: +"Note that owns the attribute."
    • addedInput schema / properties / noteId / maxLength
      Added value: +128
    • addedInput schema / properties / noteId / pattern
      Added value: +"^[A-Za-z0-9_]+$"
    • changedInput schema / properties / position / description
      Previous value: -"Position for ordering (10, 20, 30...). Lower = earlier when multiple attributes share a name"New value: +"Ordering among attributes (10, 20, 30...); lower comes first."
    • changedInput schema / properties / type / description
      Previous value: -"Type of attribute"New value: +"\"label\" (#name) or \"relation\" (~name)."
    • changedInput schema / properties / value / description
      Previous value: -"Value (for labels) or target noteId (for relations)"New value: +"Label value (\"\" for a valueless label such as #archived), or the target noteId for a relation."
  2. First observedv1.0.0

TDQS

A3.8/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The description discloses useful behavior beyond the annotations, including in-place edits, delete-and-recreate replacement, and response fields. However, it directly conflicts with destructiveHint=false by saying those changes 'delete and recreate the attribute,' which is a material annotation contradiction for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is front-loaded and compact: purpose first, then the upsert/replacement rule. Sentences are dense but every one carries operational meaning, with no filler.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For an 8-parameter mutation tool with no output schema, it covers the key upsert/replacement semantics and the unusual replacement response fields. It still omits normal response shape and error or permission behavior, but is largely complete relative to the schema and annotations.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3. The description adds cross-parameter meaning by tying upsert behavior to type+name, label value, position, relation target, and isInheritable, and it explains the replaced/oldAttributeId/newAttributeId response.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: 'Add or update a label or relation on a note.' It also scopes the operation to attribute upsert behavior, making it distinguishable from sibling delete/get attribute tools.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives clear context for when the tool is used: adding/updating an attribute, with upsert as the default and replacement behavior explained. It does not explicitly name when to choose add mode or a sibling alternative, so it stops short of full when/when-not guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.