Skip to main content
Glama
kydycode

Enhanced Todoist MCP Server Extended

todoist_get_label

Retrieve a specific Todoist label by its ID to manage and organize tasks more effectively within the Enhanced Todoist MCP Server Extended.

Instructions

Get a specific label by its ID.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
labelIdYesThe ID of the label to retrieve.

Implementation Reference

  • The main execution handler for the 'todoist_get_label' tool. It validates the input arguments using the isLabelIdArgs type guard, fetches the label using todoistClient.getLabel(labelId), formats the output with formatLabel, and returns a formatted response or error message.
    if (name === "todoist_get_label") { if (!isLabelIdArgs(args)) { return { content: [{ type: "text", text: "Invalid arguments for get_label" }], isError: true }; } try { const label = await todoistClient.getLabel(args.labelId); return { content: [{ type: "text", text: `Label details:\n${formatLabel(label)}` }], isError: false }; } catch (error: any) { return { content: [{ type: "text", text: `Error getting label: ${error.message}` }], isError: true }; } }
  • Defines the Tool object for 'todoist_get_label', including name, description, and input schema that requires a 'labelId' string.
    const GET_LABEL_TOOL: Tool = { name: "todoist_get_label", description: "Get a specific label by its ID.", inputSchema: { type: "object", properties: { labelId: { type: "string", description: "The ID of the label to retrieve." } }, required: ["labelId"] } };
  • src/index.ts:1108-1113 (registration)
    Registers the GET_LABEL_TOOL (todoist_get_label) in the array of tools returned by the ListToolsRequestSchema handler.
    // Label tools CREATE_LABEL_TOOL, GET_LABEL_TOOL, GET_LABELS_TOOL, UPDATE_LABEL_TOOL, DELETE_LABEL_TOOL,
  • Helper function to format a Todoist label object into a human-readable string for the tool's response.
    function formatLabel(label: any): string { return `- ${label.name} (ID: ${label.id})${label.color ? `\n Color: ${label.color}` : ''}${label.isFavorite ? `\n Favorite: Yes` : ''}${label.order ? `\n Order: ${label.order}`: ''}`; }
  • Type guard helper to validate that the tool arguments contain a valid 'labelId' string property.
    function isLabelIdArgs(args: unknown): args is { labelId: string; } { return ( typeof args === "object" && args !== null && "labelId" in args && typeof (args as { labelId: string }).labelId === "string" ); }

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/kydycode/todoist-mcp-server-ext'

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