Skip to main content
Glama
greirson

Todoist MCP Server

todoist_section_create

Organize tasks by creating new sections within Todoist projects to structure and categorize your workflow.

Instructions

Create a new section within a project in Todoist

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the section
project_idYesProject ID where the section will be created

Implementation Reference

  • The core handler function that implements the logic to create a new section in Todoist by calling the Todoist API's addSection method.
    export async function handleCreateSection(
      todoistClient: TodoistApi,
      args: CreateSectionArgs
    ): Promise<string> {
      const section = await todoistClient.addSection({
        name: args.name,
        projectId: args.project_id,
      });
    
      return `Section created:\nName: ${section.name}\nID: ${section.id}\nProject ID: ${section.projectId}`;
    }
  • Defines the tool metadata, description, and input schema (JSON Schema) for validating arguments to todoist_section_create.
    export const CREATE_SECTION_TOOL: Tool = {
      name: "todoist_section_create",
      description: "Create a new section within a project in Todoist",
      inputSchema: {
        type: "object",
        properties: {
          name: {
            type: "string",
            description: "Name of the section",
          },
          project_id: {
            type: "string",
            description: "Project ID where the section will be created",
          },
        },
        required: ["name", "project_id"],
      },
    };
  • src/index.ts:205-210 (registration)
    Registers the tool handling in the main switch dispatcher: validates args with type guard and calls the handler function.
    case "todoist_section_create":
      if (!isCreateSectionArgs(args)) {
        throw new Error("Invalid arguments for todoist_section_create");
      }
      result = await handleCreateSection(apiClient, args);
      break;
  • Runtime type guard (schema validation) ensuring arguments have required 'name' and 'project_id' string properties.
    export function isCreateSectionArgs(args: unknown): args is CreateSectionArgs {
      return (
        typeof args === "object" &&
        args !== null &&
        "name" in args &&
        "project_id" in args &&
        typeof (args as { name: string }).name === "string" &&
        typeof (args as { project_id: string }).project_id === "string"
      );
    }
  • Includes the CREATE_SECTION_TOOL in the PROJECT_TOOLS array, which is aggregated into ALL_TOOLS for tool listing.
    export const PROJECT_TOOLS = [
      GET_PROJECTS_TOOL,
      GET_SECTIONS_TOOL,
      CREATE_PROJECT_TOOL,
      CREATE_SECTION_TOOL,
    ];

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