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
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | No |
Implementation Reference
- todoist_mcp/server.py:314-333 (handler)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)
- todoist_mcp/client.py:179-186 (helper)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]
- todoist_mcp/client.py:43-49 (schema)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
- todoist_mcp/server.py:314-314 (registration)The @mcp.tool() decorator registers the get_sections function as an MCP tool.@mcp.tool()