Skip to main content
Glama

update_tag

Modify existing tags in Paperless-NGX by updating their name, color, matching pattern, or algorithm to organize and categorize documents effectively.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
colorNo
idYes
matchNo
matching_algorithmNo
nameYes

Implementation Reference

  • MCP tool handler for 'update_tag': checks API, calls api.updateTag, enhances with matching_algorithm, returns JSON content.
    withErrorHandling(async (args, extra) => {
      if (!api) throw new Error("Please configure API connection first");
      const tag = await api.updateTag(args.id, args);
      const enhancedTag = enhanceMatchingAlgorithm(tag);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(enhancedTag),
          },
        ],
      };
    })
  • Zod input schema defining parameters for update_tag: id (required), name (required), color, match, matching_algorithm (optional).
    {
      id: z.number(),
      name: z.string(),
      color: z
        .string()
        .regex(/^#[0-9A-Fa-f]{6}$/)
        .optional(),
      match: z.string().optional(),
      matching_algorithm: z
        .number()
        .int()
        .min(0)
        .max(6)
        .optional()
        .describe(MATCHING_ALGORITHM_DESCRIPTION),
    },
  • Registration of the 'update_tag' tool on the McpServer instance, including schema and wrapped handler.
    server.tool(
      "update_tag",
      {
        id: z.number(),
        name: z.string(),
        color: z
          .string()
          .regex(/^#[0-9A-Fa-f]{6}$/)
          .optional(),
        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 tag = await api.updateTag(args.id, args);
        const enhancedTag = enhanceMatchingAlgorithm(tag);
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(enhancedTag),
            },
          ],
        };
      })
    );
  • PaperlessAPI.updateTag method: performs HTTP PUT to /api/tags/{id}/ with JSON data; called by tool handler.
    async updateTag(id: number, data: Partial<Tag>): Promise<Tag> {
      return this.request<Tag>(`/tags/${id}/`, {
        method: "PUT",
        body: JSON.stringify(data),
      });
    }
  • src/index.ts:70-70 (registration)
    Invocation of registerTagTools which registers the update_tag tool (among others) on the MCP server.
    registerTagTools(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