Create attachment
create_attachmentAttach 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
| Name | Required | Description | Default |
|---|---|---|---|
| mime | No | Optional MIME type (e.g., "image/png", "application/pdf") — auto-detected from a data URL, magic bytes, or file extension. Set only to override detection. | |
| role | Yes | "image" for pictures embedded in the note, "file" for downloadable files (Trilium accepts other values, but these are the two in normal use). | |
| title | No | Title/filename of the attachment. Optional when content is a file path or URL (defaults to its basename); required for inline content. | |
| content | Yes | 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. | |
| ownerId | Yes | ID of the note that will own this attachment | |
| position | No | Position for ordering (10, 20, 30...) |