Skip to main content
Glama

get_context_labels

Retrieve context labels from Todoist to organize tasks by location or situation, such as home, office, or mobile contexts.

Instructions

Get all context labels from Todoist. Context labels are labels that start with "context:" and are used to organize tasks by context (e.g., context:home, context:office, context:mobile).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function for the 'get_context_labels' tool. It executes the tool logic by calling getContextLabels() from the service and returns the result as MCP-formatted content.
      handler: async () => {
        console.error('Executing get_context_labels...');
        const result = await getContextLabels();
        console.error('get_context_labels completed successfully');
        return {
          content: [
            {
              type: 'text',
              text: JSON.stringify(result, null, 2),
            },
          ],
        };
      },
    };
  • Core helper function that fetches all Todoist labels, filters those starting with 'context:', and returns structured LabelsResponse.
    export async function getContextLabels(): Promise<LabelsResponse> {
      const todoistClient = getTodoistClient();
    
      try {
        const response = await todoistClient.get<TodoistLabel[]>('/labels');
        const contextLabels = response.data
          .filter((label) => label.name.startsWith('context:'))
          .map((label) => ({
            id: parseInt(label.id),
            name: label.name,
            color: label.color,
            order: label.order,
            is_favorite: label.is_favorite,
          }));
    
        return {
          labels: contextLabels,
          total_count: contextLabels.length,
        };
      } catch (error) {
        throw new Error(`Failed to get context labels: ${getErrorMessage(error)}`);
      }
    }
  • Schema definition for the 'get_context_labels' tool, specifying name, description, and empty input schema (no parameters required).
    schema: {
      name: 'get_context_labels',
      description:
        'Get all context labels from Todoist. Context labels are labels that start with "context:" and are used to organize tasks by context (e.g., context:home, context:office, context:mobile).',
      inputSchema: {
        type: 'object',
        properties: {},
        required: [],
      },
    },
  • Registration of the get_context_labels tool handler in the toolsWithoutArgs registry used by handleToolRequest to dispatch tool calls.
    const toolsWithoutArgs: Record<string, () => Promise<ToolResponse>> = {
      list_personal_inbox_tasks: listPersonalInboxTasksTool.handler,
      list_brian_inbox_per_becky_tasks: listBrianInboxPerBeckyTasksTool.handler,
      list_becky_inbox_per_brian_tasks: listBeckyInboxPerBrianTasksTool.handler,
      list_next_actions: listNextActionsTool.handler,
      get_brian_only_projects: getBrianOnlyProjectsTool.handler,
      get_brian_shared_projects: getBrianSharedProjectsTool.handler,
      get_becky_shared_projects: getBeckySharedProjectsTool.handler,
      get_inbox_projects: getInboxProjectsTool.handler,
      get_context_labels: getContextLabelsTool.handler,
      get_chores_due_today: getChoresDueTodayTool.handler,
      get_tasks_due_tomorrow: getTasksDueTomorrowTool.handler,
      get_tasks_due_this_week: getTasksDueThisWeekTool.handler,
      get_tickler_tasks: getTicklerTasksTool.handler,
      list_gtd_projects: listGtdProjectsTool.handler,
      get_waiting_tasks: getWaitingTasksTool.handler,
      get_recent_media: getRecentMediaTool.handler,
      get_areas_of_focus: getAreasOfFocusTool.handler,
      get_shopping_list: getShoppingListTool.handler,
      list_brian_time_sensitive_tasks: listBrianTimeSensitiveTasksTool.handler,
      list_becky_time_sensitive_tasks: listBeckyTimeSensitiveTasksTool.handler,
    };
  • src/index.ts:96-96 (registration)
    Registration of the tool schema in the MCP server's listTools response.
    getContextLabelsTool.schema,
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It describes what the tool returns (context labels with specific naming convention) but doesn't disclose behavioral aspects like authentication requirements, rate limits, error conditions, or whether this is a read-only operation. The description is accurate but lacks operational context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is perfectly sized with two sentences that each earn their place. The first sentence states the core functionality, and the second provides essential clarifying information about what context labels are. No wasted words or redundancy.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple read operation with no parameters and no output schema, the description provides adequate context about what's returned. However, it doesn't specify the return format (e.g., list of label objects with properties) or mention any limitations (e.g., only returns labels with the 'context:' prefix). Given the tool's simplicity, this is mostly complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has 0 parameters with 100% schema description coverage, so the baseline is 4. The description correctly indicates no parameters are needed by not mentioning any, which aligns perfectly with the empty input schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb ('Get') and resource ('all context labels from Todoist'), and defines what context labels are (labels starting with 'context:' used to organize tasks). It distinguishes from sibling tools by focusing specifically on context labels rather than tasks, projects, or other Todoist entities.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides clear context about when to use this tool (to retrieve context labels for organizing tasks), but doesn't explicitly mention when not to use it or name alternatives. It implies usage for getting label metadata rather than tasks themselves, which helps differentiate from task-focused siblings.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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

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