delete_note
Remove unwanted notes by specifying their ID in TriliumNext Notes. This tool ensures efficient note management by deleting selected entries instantly.
Instructions
Delete a note
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| noteId | Yes | ID of the note to delete |
Input Schema (JSON Schema)
{
"properties": {
"noteId": {
"description": "ID of the note to delete",
"type": "string"
}
},
"required": [
"noteId"
],
"type": "object"
}
Implementation Reference
- src/modules/noteManager.ts:846-862 (handler)Core handler function that executes the actual DELETE request to the TriliumNext API endpoint `/notes/{noteId}`.export async function handleDeleteNote( args: NoteOperation, axiosInstance: any ): Promise<NoteDeleteResponse> { const { noteId } = args; if (!noteId) { throw new Error("noteId is required for delete operation."); } await axiosInstance.delete(`/notes/${noteId}`); return { noteId, message: `Deleted note: ${noteId}` }; }
- src/modules/noteHandler.ts:225-252 (handler)MCP tool request handler that validates permissions, prepares the noteOperation, calls the core handler, and formats the MCP response.export async function handleDeleteNoteRequest( args: any, axiosInstance: any, permissionChecker: PermissionChecker ): Promise<{ content: Array<{ type: string; text: string }> }> { if (!permissionChecker.hasPermission("WRITE")) { throw new McpError(ErrorCode.InvalidRequest, "Permission denied: Not authorized to delete notes."); } try { const noteOperation: NoteOperation = { noteId: args.noteId }; const result = await handleDeleteNote(noteOperation, axiosInstance); return { content: [{ type: "text", text: result.message }] }; } catch (error) { if (error instanceof McpError) { throw error; } throw new McpError(ErrorCode.InvalidParams, error instanceof Error ? error.message : String(error)); }
- Tool schema definition including name, description, and input schema requiring 'noteId' parameter.name: "delete_note", description: "Delete a note permanently. ONLY use this tool when the user explicitly requests note deletion (e.g., 'delete the note', 'remove this note', 'delete this permanently'). TRY NOT to use this tool proactively or for automated cleanup. CAUTION: This action cannot be undone and will permanently remove the note and all its content.", inputSchema: { type: "object", properties: { noteId: { type: "string", description: "ID of the note to delete", }, }, required: ["noteId"], }, },
- src/index.ts:99-100 (registration)Registration of the 'delete_note' tool in the main MCP request handler switch statement, dispatching to handleDeleteNoteRequest.case "delete_note": return await handleDeleteNoteRequest(request.params.arguments, this.axiosInstance, this);