Skip to main content
Glama

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
NameRequiredDescriptionDefault
idYes

Implementation Reference

  • 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" }) },
        ],
      };
    })
  • 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"),
    },
  • 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" }) },
          ],
        };
      })
    );
  • 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",
      });
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/baruchiro/paperless-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server