Skip to main content
Glama
mikemc

Todoist MCP Server

by mikemc

todoist_get_section

Retrieve details of a specific section from Todoist using the section ID, enabling efficient task organization and management through the Todoist MCP Server.

Instructions

Get a single section from Todoist

Args: section_id: ID of the section to retrieve

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
section_idYes

Implementation Reference

  • The handler function that executes the core logic of the todoist_get_section tool. It retrieves a specific Todoist section by its ID using the Todoist API client from the context and returns the section data as JSON.
    def todoist_get_section(ctx: Context, section_id: str) -> str:
        """Get a single section from Todoist
    
        Args:
            section_id: ID of the section to retrieve
        """
        todoist_client = ctx.request_context.lifespan_context.todoist_client
    
        try:
            logger.info(f"Getting section with ID: {section_id}")
    
            section = todoist_client.get_section(section_id=section_id)
    
            if not section:
                logger.info(f"No section found with ID: {section_id}")
                return f"No section found with ID: {section_id}"
    
            logger.info(f"Retrieved section: {section.id}")
            return json.dumps(section.to_dict(), indent=2, default=str)
        except Exception as error:
            logger.error(f"Error getting section: {error}")
            return f"Error getting section: {str(error)}"
  • src/main.py:79-79 (registration)
    The registration of the todoist_get_section tool using the FastMCP decorator, which automatically generates the tool schema from the function signature and docstring.
    mcp.tool()(todoist_get_section)
  • src/main.py:19-25 (registration)
    Import statement that brings the todoist_get_section handler into the main.py scope for registration.
    from .sections import (
        todoist_get_sections,
        todoist_get_section,
        todoist_add_section,
        todoist_update_section,
        todoist_delete_section,
    )

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

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