create_tag
Create a new tag in Habitica to organize tasks and habits by grouping them under custom labels.
Instructions
Create a tag.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes |
Implementation Reference
- index.js:233-241 (schema)Tool schema definition for 'create_tag' — defines inputSchema requiring a 'name' string property.
{ name: "create_tag", description: "Create a tag.", inputSchema: { type: "object", properties: { name: { type: "string" } }, required: ["name"], }, }, - index.js:426-429 (handler)Handler function for 'create_tag' — POSTs to /tags with { name } and returns success message with the created tag's name and id.
create_tag: async ({ name }) => { const t = (await api("POST", "/tags", { name })).data; return ok(`Created tag "${t.name}" (id: ${t.id})`); }, - index.js:480-492 (registration)Tool registration via ListToolsRequestSchema (line 480) and CallToolRequestSchema (line 482) which dispatches to handlers['create_tag'] by name.
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools })); server.setRequestHandler(CallToolRequestSchema, async (req) => { const { name, arguments: args = {} } = req.params; const fn = handlers[name]; if (!fn) throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`); try { return await fn(args); } catch (err) { if (err instanceof McpError) throw err; throw new McpError(ErrorCode.InternalError, err?.message ?? String(err)); } });