Skip to main content
Glama
triliumnext-mcp

triliumnext-mcp

by perfectra1n

Create attachment

create_attachment

Attach images, files, URLs, or inline content to a TriliumNext note and return attachment metadata, with MIME type and title auto-detected from the source.

Instructions

Attach content to a note and return the attachment metadata. mime and title are auto-detected from the source (a path or URL basename becomes the title); inline base64/text needs a title. Example: {ownerId, role: "image", title: "dot.png", content: "data:image/png;base64,iVBORw0..."}.

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": {
      "ownerId": "<ownerId>",
      "role": "<role>",
      "content": "<content>"
    },
    "name": "create_attachment"
  }
}

Input Schema

NameRequiredDescriptionDefault
mimeNoOptional MIME type (e.g., "image/png", "application/pdf") — auto-detected from a data URL, magic bytes, or file extension. Set only to override detection.
roleYes"image" for pictures embedded in the note, "file" for downloadable files (Trilium accepts other values, but these are the two in normal use).
titleNoTitle/filename of the attachment. Optional when content is a file path or URL (defaults to its basename); required for inline content.
contentYesContent of the attachment. Pass any of: an http(s) URL, a data URL (data:image/png;base64,...), or inline base64 (binary types) / raw text (text types) — the source is auto-detected. A file path ("/abs/path", "~/path", or file://...) refers to the MCP SERVER's filesystem and only works when the server permits local file reads.
ownerIdYesID of the note that will own this attachment
positionNoPosition for ordering (10, 20, 30...)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed4 schema fields changedv0.4.0
    • changedInput schema / properties / content / description
      Previous value: -"Content of the attachment. Pass any of: a local file path (\"/abs/path\" or \"~/path\"), an http(s) URL, a data URL (data:image/png;base64,...), or inline base64 (binary types) / raw text (text types) — the source is auto-detected. Use a file:// prefix to force path interpretation."New value: +"Content of the attachment. Pass any of: an http(s) URL, a data URL (data:image/png;base64,...), or inline base64 (binary types) / raw text (text types) — the source is auto-detected. A file path (\"/abs/path\", \"~/path\", or file://...) refers to the MCP SERVER's filesystem and only works when the server permits local file reads."
    • addedInput schema / properties / ownerId / maxLength
      Added value: +128
    • addedInput schema / properties / ownerId / pattern
      Added value: +"^[A-Za-z0-9_]+$"
    • changedInput schema / properties / role / description
      Previous value: -"Role of the attachment (e.g., \"file\", \"image\")"New value: +"\"image\" for pictures embedded in the note, \"file\" for downloadable files (Trilium accepts other values, but these are the two in normal use)."
  2. First observedv1.0.0

TDQS

A3.7/5.0
Behavior4/5

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

Annotations already declare this is a non-read-only, non-idempotent, open-world write, so the safety bar is partly covered. The description adds genuinely useful behavior: the call returns attachment metadata, mime/title are auto-detected from the source, and file paths refer to the MCP server's filesystem and only work when local reads are permitted — a real constraint not in the annotations.

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

Conciseness4/5

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

Front-loaded with the action and return value, then the detection rules, then a compact example. No filler sentences. Minor cost: the example's truncated base64 string adds bulk for limited marginal value.

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 a six-parameter mutation tool with full schema coverage, rich annotations, and no output schema, the description covers purpose, source auto-detection, return value, and the server-filesystem caveat. The only gap is guidance on choosing this over write_attachment.

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

Parameters3/5

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

Schema description coverage is 100%, so the baseline is 3. The description's notes on mime/title auto-detection and the title requirement for inline content largely restate what the schema properties already say; the worked example is helpful but adds no new semantics for ownerId, role, or position.

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

Purpose4/5

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

States a specific verb and resource: 'Attach content to a note and return the attachment metadata.' An agent knows immediately this creates an attachment. It does not, however, distinguish itself from the close sibling write_attachment, which leaves a real ambiguity unresolved.

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

Usage Guidelines3/5

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

Usage is implied rather than stated: the auto-detection rules and the 'inline base64/text needs a title' note tell the agent how to call it, but there is no explicit when-to-use versus write_attachment or other sibling, and no exclusions or prerequisites beyond a side remark about server filesystem access.

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