update_tag
Update the name, description, colors, or archive status of an existing tag.
Instructions
Update properties for an existing tag.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| tagId | Yes | Id of the tag to update. | |
| name | No | ||
| description | No | ||
| text_color | No | ||
| background_color | No | ||
| archived | No |
Implementation Reference
- src/tools/tags.ts:154-185 (handler)The handler function for the 'update_tag' tool. It accepts tagId, name, description, text_color, background_color, and archived, builds a request body, and calls PUT /tags/{tagId}.
async ({ tagId, name, description, text_color, background_color, archived, }) => { try { const requestBody: Record<string, unknown> = {}; if (name !== undefined) requestBody.name = name; if (description !== undefined) requestBody.description = description; if (text_color !== undefined) requestBody.text_color = normalizeColor(text_color); if (background_color !== undefined) requestBody.background_color = normalizeColor(background_color); if (archived !== undefined) requestBody.archived = archived; const response = await api.put(`/tags/${tagId}`, requestBody); if (!response.ok) { return handleApiError(response, "Failed to update tag"); } return dataResponse(await response.json()); } catch (error) { return catchError(error, "Failed to update tag"); } }, ); - src/tools/tags.ts:142-149 (schema)Input schema for 'update_tag' using zod. Defines tagId (required, coerced number), name, description, text_color, background_color (nullable), and archived (boolean).
inputSchema: { tagId: z.coerce.number().describe("Id of the tag to update."), name: z.string().min(1).max(100).optional(), description: z.string().max(200).nullable().optional(), text_color: z.string().nullable().optional(), background_color: z.string().nullable().optional(), archived: z.boolean().optional(), }, - src/tools/tags.ts:138-185 (registration)Registration of 'update_tag' via server.registerTool() within the registerTagTools function, including schema, description, annotations (idempotentHint: true), and the handler.
server.registerTool( "update_tag", { description: "Update properties for an existing tag.", inputSchema: { tagId: z.coerce.number().describe("Id of the tag to update."), name: z.string().min(1).max(100).optional(), description: z.string().max(200).nullable().optional(), text_color: z.string().nullable().optional(), background_color: z.string().nullable().optional(), archived: z.boolean().optional(), }, annotations: { idempotentHint: true, }, }, async ({ tagId, name, description, text_color, background_color, archived, }) => { try { const requestBody: Record<string, unknown> = {}; if (name !== undefined) requestBody.name = name; if (description !== undefined) requestBody.description = description; if (text_color !== undefined) requestBody.text_color = normalizeColor(text_color); if (background_color !== undefined) requestBody.background_color = normalizeColor(background_color); if (archived !== undefined) requestBody.archived = archived; const response = await api.put(`/tags/${tagId}`, requestBody); if (!response.ok) { return handleApiError(response, "Failed to update tag"); } return dataResponse(await response.json()); } catch (error) { return catchError(error, "Failed to update tag"); } }, ); - src/index.ts:27-27 (registration)Call to registerTagTools(server) which registers all tag tools including 'update_tag'.
registerTagTools(server); - src/tools/tags.ts:13-18 (helper)Helper function normalizeColor used by the update_tag handler to strip leading '#' from color values before sending to the API.
function normalizeColor( value: string | null | undefined, ): string | null | undefined { if (value === undefined || value === null) return value; return value.startsWith("#") ? value.slice(1) : value; }