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
| Name | Required | Description | Default |
|---|---|---|---|
| color | No | ||
| id | Yes | ||
| match | No | ||
| matching_algorithm | No | ||
| name | Yes |
Implementation Reference
- src/tools/tags.ts:98-110 (handler)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), }, ], }; })
- src/tools/tags.ts:82-97 (schema)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), },
- src/tools/tags.ts:80-111 (registration)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), }, ], }; }) );
- src/api/PaperlessAPI.ts:191-196 (helper)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);