Skip to main content
Glama

create_document_type

Define custom document types in Paperless-NGX by specifying a name, matching criteria, and algorithm for document classification. Streamline organization and retrieval.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
matchNo
matching_algorithmNo
nameYes

Implementation Reference

  • Executes the tool logic: checks API, calls createDocumentType on API, enhances response, returns as text content.
    withErrorHandling(async (args, extra) => {
      if (!api) throw new Error("Please configure API connection first");
      const response = await api.createDocumentType(args);
      const enhancedDocumentType = enhanceMatchingAlgorithm(response);
      return {
        content: [{ type: "text", text: JSON.stringify(enhancedDocumentType) }],
      };
    })
  • Zod input schema: name (required string), match (optional string), matching_algorithm (optional int 0-6 with desc).
    {
      name: z.string(),
      match: z.string().optional(),
      matching_algorithm: z
        .number()
        .int()
        .min(0)
        .max(6)
        .optional()
        .describe(MATCHING_ALGORITHM_DESCRIPTION),
    },
  • Full server.tool registration of the create_document_type tool, including name, schema, and handler.
    server.tool(
      "create_document_type",
      {
        name: z.string(),
        match: z.string().optional(),
        matching_algorithm: z
          .number()
          .int()
          .min(0)
          .max(6)
          .optional()
          .describe(MATCHING_ALGORITHM_DESCRIPTION),
      },
      withErrorHandling(async (args, extra) => {
        if (!api) throw new Error("Please configure API connection first");
        const response = await api.createDocumentType(args);
        const enhancedDocumentType = enhanceMatchingAlgorithm(response);
        return {
          content: [{ type: "text", text: JSON.stringify(enhancedDocumentType) }],
        };
      })
    );
  • API client method that POSTs to /document_types/ endpoint to create the document type.
    async createDocumentType(data: Partial<DocumentType>): Promise<DocumentType> {
      return this.request<DocumentType>("/document_types/", {
        method: "POST",
        body: JSON.stringify(data),
      });
    }
  • src/index.ts:72-72 (registration)
    Top-level call to register all document type tools, including create_document_type.
    registerDocumentTypeTools(server, api);

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