Skip to main content
Glama

get_subtasks

Extract subtasks from Notion task pages to manage project workflows. Parses task body content to retrieve subtask names, status, and priority for organized tracking.

Instructions

获取任务的子目标列表(解析任务页面 body 中的子目标 Markdown)。

Args: task_id: 任务的 Notion 页面 ID

Returns: 子目标列表 [{name, status, priority}],status: todo | doing | done

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The workflow tool handler that calls the Notion client to retrieve subtasks.
    def get_subtasks(task_id: str) -> list[dict]:
        """
        获取任务的子目标列表(解析任务页面 body 中的子目标 Markdown)。
    
        Args:
            task_id: 任务的 Notion 页面 ID
    
        Returns:
            子目标列表 [{name, status, priority}],status: todo | doing | done
        """
        subtasks = get_client().get_subtasks(task_id)
        return [s.model_dump() for s in subtasks]
  • server.py:44-44 (registration)
    Registration of the get_subtasks function as an MCP tool.
    mcp.tool(get_subtasks)
  • The actual implementation of parsing subtasks from Notion page blocks.
    def get_subtasks(self, task_id: str) -> list[Subtask]:
        """Parse subtasks from the ## 子目标 section in a task page body."""
        blocks = self._get_all_child_blocks(task_id)
        start, end = self._find_subtask_section(blocks)
        if start is None:
            return []
    
        section = blocks[start + 1 : end]  # skip heading itself
        subtasks: list[Subtask] = []
        for block in section:
            if block.get("type") != "paragraph":
                continue
            rich_text = block.get("paragraph", {}).get("rich_text", [])
            text = "".join(t["plain_text"] for t in rich_text)
            m = self._SUBTASK_RE.match(text)
            if m:
                status_char, name, priority_str = m.group(1), m.group(2), m.group(3)
                status = self._SUBTASK_STATUS_MAP.get(status_char, SubtaskStatus.TODO)
                priority = TaskPriority(priority_str) if priority_str else TaskPriority.NORMAL
                subtasks.append(Subtask(name=name, status=status, priority=priority))
        return subtasks
    
    def update_subtasks(self, task_id: str, subtasks: list[Subtask]) -> list[Subtask]:
        """Rewrite the ## 子目标 section in the task page body."""
        blocks = self._get_all_child_blocks(task_id)
        start, end = self._find_subtask_section(blocks)
    
        # Delete old section blocks (heading + content within boundaries)
        if start is not None:
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions parsing Markdown from a task page body, which implies read-only behavior, but doesn't state whether this requires specific permissions, what happens if the task ID is invalid, or if there are rate limits. For a tool with zero annotation coverage, this lacks critical behavioral 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 appropriately sized and front-loaded. The first sentence states the core purpose, followed by clear sections for 'Args' and 'Returns' that provide essential details without redundancy. Every sentence earns its place, making it efficient and easy to parse.

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?

Given the tool's moderate complexity (parsing Markdown), no annotations, and an output schema (implied by the 'Returns' section detailing the list structure), the description is mostly complete. It covers the purpose, parameter semantics, and return values. However, it lacks behavioral details (e.g., error handling, permissions), which holds it back from a 5.

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 description adds significant meaning beyond the input schema. The schema has 0% description coverage (only a 'task_id' parameter with no details), but the description specifies that 'task_id' is a 'Notion 页面 ID' (Notion page ID), clarifying the expected format and source. This compensates well for the low schema coverage, though it doesn't cover all potential edge cases (e.g., ID format validation).

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

Purpose4/5

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

The description clearly states the tool's purpose: '获取任务的子目标列表(解析任务页面 body 中的子目标 Markdown)' which translates to 'Get the subtask list of a task (parse subtask Markdown in the task page body).' It specifies the verb ('get/parse'), resource ('subtasks'), and scope ('from a task page body'). However, it doesn't explicitly distinguish itself from sibling tools like 'get_task' or 'update_subtasks', which would require a 5.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a valid task ID), exclusions, or comparisons to siblings like 'get_task' (which might return task details without subtasks) or 'update_subtasks' (for modifying subtasks). Usage is implied but not explicitly stated.

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/wauwaya/notion-workflow-mcp'

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