create_tag
Create a new tag for categorizing transactions by assigning a name and optional details like color or description.
Instructions
Create a new tag.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Name of the tag. 1-100 characters. | |
| description | No | Optional description. Up to 200 characters. | |
| text_color | No | Optional text color of the tag. | |
| background_color | No | Optional background color of the tag. | |
| archived | No | If true, the tag is created archived. |
Implementation Reference
- src/tools/tags.ts:107-136 (handler)The async handler function for the 'create_tag' tool. It builds a request body from the input parameters (name, description, text_color, background_color, archived), normalizes color values, sends a POST request to /tags, and returns the API response.
async ({ name, description, text_color, background_color, archived, }) => { try { const requestBody: Record<string, unknown> = { 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.post("/tags", requestBody); if (!response.ok) { return handleApiError(response, "Failed to create tag"); } return dataResponse(await response.json()); } catch (error) { return catchError(error, "Failed to create tag"); } }, ); - src/tools/tags.ts:79-102 (schema)Input schema for 'create_tag' using Zod validations: name (string, 1-100 chars, required), description (string, max 200, optional), text_color (optional string), background_color (optional string), archived (optional boolean).
inputSchema: { name: z .string() .min(1) .max(100) .describe("Name of the tag. 1-100 characters."), description: z .string() .max(200) .optional() .describe("Optional description. Up to 200 characters."), text_color: z .string() .optional() .describe("Optional text color of the tag."), background_color: z .string() .optional() .describe("Optional background color of the tag."), archived: z .boolean() .optional() .describe("If true, the tag is created archived."), }, - src/tools/tags.ts:75-106 (registration)Registration of the 'create_tag' tool via server.registerTool with its name, description, annotations (idempotentHint: false), and inputSchema.
server.registerTool( "create_tag", { description: "Create a new tag.", inputSchema: { name: z .string() .min(1) .max(100) .describe("Name of the tag. 1-100 characters."), description: z .string() .max(200) .optional() .describe("Optional description. Up to 200 characters."), text_color: z .string() .optional() .describe("Optional text color of the tag."), background_color: z .string() .optional() .describe("Optional background color of the tag."), archived: z .boolean() .optional() .describe("If true, the tag is created archived."), }, annotations: { idempotentHint: false, }, }, - src/tools/tags.ts:13-18 (helper)The normalizeColor helper function used by the 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; }