Skip to main content
Glama

get_sections

Retrieve project sections from Todoist to organize and categorize tasks within specific projects for better task management.

Instructions

Get sections from a project.

Args: project_id: Project ID to get sections from (optional)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idNo

Implementation Reference

  • MCP tool handler for 'get_sections' that fetches sections using the TodoistClient and returns a formatted string list.
    @mcp.tool() async def get_sections(project_id: Optional[str] = None) -> str: """Get sections from a project. Args: project_id: Project ID to get sections from (optional) """ _check_client() sections = await todoist_client.get_sections(project_id=project_id) if not sections: return "No sections found." section_list = [] for section in sections: section_list.append(f"• [{section.id}] {section.name} (Project: {section.project_id})") return f"Found {len(sections)} sections:\n" + "\n".join(section_list)
  • Underlying client method that performs the actual API call to retrieve Todoist sections.
    async def get_sections(self, project_id: Optional[str] = None) -> List[TodoistSection]: """Get sections, optionally filtered by project.""" params = {} if project_id: params["project_id"] = project_id data = await self._request("GET", "/sections", params=params) return [TodoistSection(**section) for section in data]
  • Pydantic model defining the structure of a Todoist section used in the get_sections response.
    class TodoistSection(BaseModel): """Represents a Todoist section.""" id: str project_id: str order: int name: str
  • The @mcp.tool() decorator registers the get_sections function as an MCP tool.
    @mcp.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/dan-bailey/todoist-mcp'

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