Skip to main content
Glama

create_tag

Add new tags to your Paperless-NGX instance by specifying a name, color, match string, and matching algorithm for automated document tagging.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
colorNo
matchNo
matching_algorithmNo
nameYes

Implementation Reference

  • Handler function for the create_tag tool: validates API connection, calls api.createTag(args), enhances the tag with matching algorithm info, and returns JSON text content.
    withErrorHandling(async (args, extra) => {
      if (!api) throw new Error("Please configure API connection first");
      const tag = await api.createTag(args);
      const enhancedTag = enhanceMatchingAlgorithm(tag);
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(enhancedTag),
          },
        ],
      };
    })
  • Zod input schema for create_tag tool: requires name, optional color (hex), match, and matching_algorithm (0-6).
    {
      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),
    },
  • MCP tool registration for create_tag using server.tool with schema and wrapped handler.
    server.tool(
      "create_tag",
      {
        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.createTag(args);
        const enhancedTag = enhanceMatchingAlgorithm(tag);
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(enhancedTag),
            },
          ],
        };
      })
    );
  • PaperlessAPI.createTag method: POST request to /tags/ with JSON data, called by the tool handler.
    async createTag(data: Partial<Tag>): Promise<Tag> {
      return this.request<Tag>("/tags/", {
        method: "POST",
        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