Skip to main content
Glama

update_document_type

Modify document type settings in Paperless-NGX by updating metadata such as name and matching algorithm to improve document organization and retrieval.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
matchNo
matching_algorithmNo
nameYes

Implementation Reference

  • The handler function wrapped in withErrorHandling that implements the core logic of the update_document_type tool: validates API, destructures args, calls updateDocumentType API helper, enhances the response with matching algorithm info, and returns JSON as text content.
    withErrorHandling(async (args, extra) => { if (!api) throw new Error("Please configure API connection first"); const { id, ...payloadWithoutId } = args; const response = await api.updateDocumentType(id, payloadWithoutId); const enhancedDocumentType = enhanceMatchingAlgorithm(response); return { content: [{ type: "text", text: JSON.stringify(enhancedDocumentType) }], }; })
  • Zod input schema defining required 'id' and 'name', optional 'match' and 'matching_algorithm' (0-6) for the tool.
    { id: z.number(), name: z.string(), match: z.string().optional(), matching_algorithm: z .number() .int() .min(0) .max(6) .optional() .describe(MATCHING_ALGORITHM_DESCRIPTION), },
  • Registration of the 'update_document_type' MCP tool using server.tool(), including schema and handler inline within registerDocumentTypeTools function.
    server.tool( "update_document_type", { id: z.number(), 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 { id, ...payloadWithoutId } = args; const response = await api.updateDocumentType(id, payloadWithoutId); const enhancedDocumentType = enhanceMatchingAlgorithm(response); return { content: [{ type: "text", text: JSON.stringify(enhancedDocumentType) }], }; }) );
  • API wrapper helper method that sends PUT request to /document_types/{id}/ with the update data.
    async updateDocumentType( id: number, data: Partial<DocumentType> ): Promise<DocumentType> { return this.request<DocumentType>(`/document_types/${id}/`, { method: "PUT", body: JSON.stringify(data), }); }

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