Skip to main content
Glama

create_project_label

Create project labels in Todoist that start with "PROJECT: " to organize and categorize tasks by project. The tool automatically assigns a charcoal color to each new project label.

Instructions

Create a new project label in Todoist. The label name must start with "PROJECT: " (with a space after the colon). The label will be created with charcoal color.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_nameYesThe name of the project label. Must start with "PROJECT: " (e.g., "PROJECT: Website Redesign")

Implementation Reference

  • The handler function for the 'create_project_label' tool. It extracts the project_name from args, calls the createProjectLabel service function, and returns the result as a formatted ToolResponse.
    handler: async (args: { project_name: string }) => { console.error('Executing create_project_label...'); const { project_name } = args; if (!project_name) { throw new Error('project_name is required'); } const result = await createProjectLabel(project_name); console.error('create_project_label completed successfully'); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; },
  • The schema definition for the 'create_project_label' tool, including name, description, and input schema requiring 'project_name'.
    schema: { name: 'create_project_label', description: 'Create a new project label in Todoist. The label name must start with "PROJECT: " (with a space after the colon). The label will be created with charcoal color.', inputSchema: { type: 'object', properties: { project_name: { type: 'string', description: 'The name of the project label. Must start with "PROJECT: " (e.g., "PROJECT: Website Redesign")', }, }, required: ['project_name'], }, },
  • The core helper function that performs the actual Todoist API call to create a new project label with the given name and charcoal color.
    export async function createProjectLabel(projectName: string): Promise<{ id: number; name: string; color: string; order: number; is_favorite: boolean; }> { const todoistClient = getTodoistClient(); try { // Validate that the project name starts with "PROJECT: " if (!projectName.startsWith('PROJECT: ')) { throw new Error('Project label name must start with "PROJECT: "'); } if (!todoistClient.post) { throw new Error('POST method not available on Todoist client'); } const response = await todoistClient.post<TodoistLabel>('/labels', { name: projectName, color: 'charcoal', }); return { id: parseInt(response.data.id), name: response.data.name, color: response.data.color, order: response.data.order, is_favorite: response.data.is_favorite, }; } catch (error) { throw new Error( `Failed to create project label: ${getErrorMessage(error)}` ); } }
  • Registration of the 'create_project_label' tool handler in the toolsWithArgs registry used by handleToolRequest.
    const toolsWithArgs: Record<string, (args: any) => Promise<ToolResponse>> = { get_task_comments: getTaskCommentsTool.handler, create_project_label: createProjectLabelTool.handler, create_task_comment: createTaskCommentTool.handler, update_task: updateTaskTool.handler, create_task: createTaskTool.handler, move_task: moveTaskTool.handler, get_tasks_with_label: getTasksWithLabelTool.handler, complete_task: completeTaskTool.handler, uncomplete_task: uncompleteTaskTool.handler, search_tasks: searchTasksTool.handler, search_tasks_using_and: searchTasksUsingAndTool.handler, search_tasks_using_or: searchTasksUsingOrTool.handler, complete_becky_task: completeBeckyTaskTool.handler, };
  • src/index.ts:91-91 (registration)
    The tool schema is included in the listTools response for MCP protocol.
    createProjectLabelTool.schema,

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

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