delete_document_type
Remove a document type by its ID from the Paperless-NGX instance using this tool, ensuring clean and efficient document type management.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes |
Implementation Reference
- src/tools/documentTypes.ts:121-134 (handler)The handler function for the 'delete_document_type' MCP tool. It checks if API is configured, requires confirmation via args.confirm, calls api.deleteDocumentType(args.id), and returns a success message.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.deleteDocumentType(args.id); return { content: [ { type: "text", text: JSON.stringify({ status: "deleted" }) }, ], }; })
- src/tools/documentTypes.ts:115-120 (schema)Input schema for the 'delete_document_type' tool using Zod: requires id (number) and confirm (boolean).{ id: z.number(), confirm: z .boolean() .describe("Must be true to confirm this destructive operation"), },
- src/tools/documentTypes.ts:112-135 (registration)Registration of the 'delete_document_type' tool on the MCP server within registerDocumentTypeTools function.server.tool( "delete_document_type", "⚠️ DESTRUCTIVE: Permanently delete a document type from the entire system. This will affect ALL documents that use this type.", { 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.deleteDocumentType(args.id); return { content: [ { type: "text", text: JSON.stringify({ status: "deleted" }) }, ], }; }) );
- src/api/PaperlessAPI.ts:265-269 (helper)Helper method in PaperlessAPI class that sends a DELETE request to the /document_types/{id}/ endpoint to delete the document type.async deleteDocumentType(id: number): Promise<void> { return this.request<void>(`/document_types/${id}/`, { method: "DELETE", }); }