delete_note
Permanently remove a note and all its content from TriliumNext Notes. Use only when explicitly requested, as this action cannot be undone.
Instructions
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.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| noteId | Yes | ID of the note to delete |
Implementation Reference
- src/modules/noteManager.ts:846-862 (handler)Core handler function that executes the delete_note tool logic by calling the Trilium API DELETE /notes/{noteId} endpoint.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-specific request handler for delete_note that performs permission checks, prepares arguments, 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)); }
- Input schema and description definition for the delete_note tool.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 handler in the main MCP server request router.case "delete_note": return await handleDeleteNoteRequest(request.params.arguments, this.axiosInstance, this);