Skip to main content
Glama

todoist_label_create

Create custom labels in Todoist to organize tasks by adding names, colors, favorite status, and order positions.

Instructions

Create a new label in Todoist

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the label to create
colorNoColor of the label (optional) - can be a Todoist color name or hex code
is_favoriteNoWhether the label should be marked as favorite (optional)
orderNoOrder position of the label (optional)

Implementation Reference

  • The core handler function that executes the todoist_label_create tool: validates input using validateLabelData, calls Todoist API's addLabel method, clears relevant caches, and returns a formatted success message.
    export async function handleCreateLabel( todoistClient: TodoistApi, args: CreateLabelArgs ): Promise<string> { const validatedData = validateLabelData(args); try { const label = await todoistClient.addLabel({ name: validatedData.name, color: validatedData.color, order: validatedData.order, isFavorite: validatedData.is_favorite, }); labelCache.clear(); labelStatsCache.clear(); return `Label "${label.name}" created successfully (ID: ${label.id})`; } catch (error) { throw new TodoistAPIError( "Failed to create label", error instanceof Error ? error : undefined ); } }
  • Defines the Tool object for todoist_label_create, including name, description, and detailed inputSchema with properties (name required, others optional).
    export const CREATE_LABEL_TOOL: Tool = { name: "todoist_label_create", description: "Create a new label in Todoist", inputSchema: { type: "object", properties: { name: { type: "string", description: "Name of the label to create", }, color: { type: "string", description: "Color of the label (optional) - can be a Todoist color name or hex code", }, is_favorite: { type: "boolean", description: "Whether the label should be marked as favorite (optional)", }, order: { type: "number", description: "Order position of the label (optional)", }, }, required: ["name"], }, };
  • src/index.ts:261-266 (registration)
    Handler registration in the CallToolRequest switch statement: validates arguments using isCreateLabelArgs type guard and dispatches to handleCreateLabel.
    case "todoist_label_create": if (!isCreateLabelArgs(args)) { throw new Error("Invalid arguments for todoist_label_create"); } result = await handleCreateLabel(apiClient, args); break;
  • Registers the todoist_label_create tool (via LABEL_TOOLS array from label-tools.ts) in the complete ALL_TOOLS list returned by ListToolsRequest.
    export const ALL_TOOLS = [ ...TASK_TOOLS, ...PROJECT_TOOLS, ...COMMENT_TOOLS, ...LABEL_TOOLS, ...SUBTASK_TOOLS, ...TEST_TOOLS, ];

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/greirson/mcp-todoist'

If you have feedback or need assistance with the MCP directory API, please join our Discord server