Skip to main content
Glama

get_correspondent

Retrieves correspondent details from a Paperless-NGX instance using a document ID, enabling efficient management of document correspondents.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes

Implementation Reference

  • Primary registration of the 'get_correspondent' MCP tool, including input schema validation with Zod ({ id: z.number() }) and the handler function that fetches and enhances the correspondent data.
    server.tool(
      "get_correspondent",
      { id: z.number() },
      withErrorHandling(async (args, extra) => {
        if (!api) throw new Error("Please configure API connection first");
        const response = await api.getCorrespondent(args.id);
        const enhancedCorrespondent = enhanceMatchingAlgorithm(response);
        return {
          content: [
            { type: "text", text: JSON.stringify(enhancedCorrespondent) },
          ],
        };
      })
    );
  • The core handler function for the 'get_correspondent' tool. Validates API availability, retrieves the correspondent by ID via PaperlessAPI, enhances it with matching algorithm details, and returns formatted JSON content.
    withErrorHandling(async (args, extra) => {
      if (!api) throw new Error("Please configure API connection first");
      const response = await api.getCorrespondent(args.id);
      const enhancedCorrespondent = enhanceMatchingAlgorithm(response);
      return {
        content: [
          { type: "text", text: JSON.stringify(enhancedCorrespondent) },
        ],
      };
    })
  • Helper method in PaperlessAPI class that performs the HTTP request to fetch a single correspondent by ID from the Paperless-ngx API.
    async getCorrespondent(id: number): Promise<Correspondent> {
      return this.request<Correspondent>(`/correspondents/${id}/`);
    }
  • src/index.ts:71-71 (registration)
    Top-level call to register all correspondent-related tools, including 'get_correspondent', on the MCP server.
    registerCorrespondentTools(server, api);
  • Zod input schema for the 'get_correspondent' tool, requiring a numeric 'id' parameter.
    { id: z.number() },

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