delete_correspondent
Remove correspondents from your Paperless-NGX instance by specifying their unique ID. This tool simplifies document management by enabling precise control over correspondent data.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes |
Implementation Reference
- src/tools/correspondents.ts:124-137 (handler)The handler function for the delete_correspondent tool. It validates confirmation, calls the API to delete the correspondent, and returns a success status.withErrorHandling(async (args, extra) => { if (!api) throw new Error("Please configure API connection first"); if (!args.confirm) { throw new Error( "Confirmation required for destructive operation. Set confirm: true to proceed." ); } await api.deleteCorrespondent(args.id); return { content: [ { type: "text", text: JSON.stringify({ status: "deleted" }) }, ], }; })
- src/tools/correspondents.ts:116-123 (schema)Input schema and description for the delete_correspondent tool, requiring id and confirm flag."delete_correspondent", "⚠️ DESTRUCTIVE: Permanently delete a correspondent from the entire system. This will affect ALL documents that use this correspondent.", { id: z.number(), confirm: z .boolean() .describe("Must be true to confirm this destructive operation"), },
- src/tools/correspondents.ts:115-138 (registration)Registration of the delete_correspondent tool using server.tool, including schema and handler.server.tool( "delete_correspondent", "⚠️ DESTRUCTIVE: Permanently delete a correspondent from the entire system. This will affect ALL documents that use this correspondent.", { id: z.number(), confirm: z .boolean() .describe("Must be true to confirm this destructive operation"), }, withErrorHandling(async (args, extra) => { if (!api) throw new Error("Please configure API connection first"); if (!args.confirm) { throw new Error( "Confirmation required for destructive operation. Set confirm: true to proceed." ); } await api.deleteCorrespondent(args.id); return { content: [ { type: "text", text: JSON.stringify({ status: "deleted" }) }, ], }; }) );
- src/api/PaperlessAPI.ts:237-241 (helper)Supporting API method that sends DELETE request to the Paperless server to remove the correspondent.async deleteCorrespondent(id: number): Promise<void> { return this.request<void>(`/correspondents/${id}/`, { method: "DELETE", }); }