Skip to main content
Glama

get_document_type

Identify and retrieve document type details by ID from a Paperless-NGX instance using the specified MCP server.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes

Implementation Reference

  • Registers the 'get_document_type' MCP tool with input schema {id: z.number()} and handler that fetches the document type via API and enhances the matching algorithm field.
    server.tool( "get_document_type", { id: z.number() }, withErrorHandling(async (args, extra) => { if (!api) throw new Error("Please configure API connection first"); const response = await api.request(`/document_types/${args.id}/`); const enhancedDocumentType = enhanceMatchingAlgorithm(response); return { content: [{ type: "text", text: JSON.stringify(enhancedDocumentType) }], }; }) );
  • The handler function for get_document_type tool: checks API, requests /document_types/{id}/, enhances response, returns JSON text content.
    withErrorHandling(async (args, extra) => { if (!api) throw new Error("Please configure API connection first"); const response = await api.request(`/document_types/${args.id}/`); const enhancedDocumentType = enhanceMatchingAlgorithm(response); return { content: [{ type: "text", text: JSON.stringify(enhancedDocumentType) }], }; })
  • Input schema for get_document_type: requires 'id' as number.
    { id: z.number() },
  • Helper function used in the handler to enrich the document type's matching_algorithm field with a human-readable name.
    export function enhanceMatchingAlgorithm< T extends { matching_algorithm: MatchingAlgorithm } >(obj: T): T & { matching_algorithm: NamedItem } { return { ...obj, matching_algorithm: { id: obj.matching_algorithm, name: MATCHING_ALGORITHM_OPTIONS[obj.matching_algorithm] || String(obj.matching_algorithm), }, }; }
  • TypeScript interface defining the structure of a DocumentType object, used in responses.
    export interface DocumentType { id: number; slug: string; name: string; match: string; matching_algorithm: MatchingAlgorithm; is_insensitive: boolean; document_count: number; last_correspondence: string; owner: number | null; permissions: Record<string, unknown>; user_can_change: boolean; }

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