Skip to main content
Glama

startNextTask

Find and begin the next executable task with completed dependencies to advance project plans by updating task status to in-progress.

Instructions

自动查找下一个可执行的任务(所有依赖均已完成)并开始执行。 这会将任务状态更新为 'in_progress'。这是推进计划的核心方法。

Returns: ToolResponse[TaskOutput]: 包含已启动任务的响应对象。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler function for 'startNextTask'. Registered via @mcp.tool() decorator and delegates execution to PlanManager.startNextTask().
    @mcp.tool()
    def startNextTask() -> ToolResponse[TaskOutput]:
        """
        自动查找下一个可执行的任务(所有依赖均已完成)并开始执行。
        这会将任务状态更新为 'in_progress'。这是推进计划的核心方法。
        
        Returns:
            ToolResponse[TaskOutput]: 包含已启动任务的响应对象。
        """
        return plan_manager.startNextTask()
  • Core logic implementation in PlanManager class. Finds the next pending task with satisfied dependencies, marks it as in_progress, updates plan state, and returns the task details.
    def startNextTask(self) -> Dict:
        """自动开始下一个可执行的任务"""
        # 查找可执行的任务
        executable_tasks = []
        for task in self.plan_data["tasks"]:
            if (task["status"] == "pending" and 
                self._check_dependencies_satisfied(task)):
                executable_tasks.append(task)
        
        if not executable_tasks:
            return {"success": False, "message": "No executable tasks available", "data": None}
        
        # 选择第一个可执行的任务
        next_task = executable_tasks[0]
        next_task["status"] = "in_progress"
        self.plan_data["state"]["current_task_id"] = next_task["id"]
        self.plan_data["state"]["status"] = "running"
        
        self._update_timestamp()
        
        return {
            "success": True,
            "data": next_task,
            "message": f"Started task {next_task['id']}: {next_task['name']}"
        }
  • Pydantic model for TaskOutput, which defines the structure of the data returned by the startNextTask tool inside ToolResponse.
    class TaskOutput(BaseModel):
        """
        用于工具函数返回任务信息时,定义单个任务输出的Pydantic模型。
        """
        id: int
        name: str
        status: str
        dependencies: List[int]
        reasoning: str
        result: Optional[str] = None
  • Generic Pydantic model for ToolResponse[T], used as the return type for startNextTask (with T=TaskOutput). Defines the standardized response structure.
    class ToolResponse(BaseModel, Generic[T]):
        """
        一个通用的工具响应模型,用于标准化所有工具的返回结构。
        """
        success: bool = Field(True, description="操作是否成功。")
        message: Optional[str] = Field(None, description="关于操作结果的可读消息。")
        data: Optional[T] = Field(None, description="操作返回的主要数据负载。")
Behavior3/5

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

With no annotations provided, the description carries the full burden. It discloses key behavioral traits: it mutates state (updates task status to 'in_progress'), finds tasks based on dependency completion, and returns a TaskOutput object. However, it lacks details on error conditions (e.g., if no executable tasks exist), side effects, or permissions needed. It adds value but is not comprehensive.

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 front-loaded with the core action in the first sentence, followed by state change and purpose context, ending with return value details. Every sentence adds value: the first explains what it does, the second clarifies the mutation, the third provides usage context, and the fourth specifies the output. No wasted words.

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 complexity (a state-mutating tool with no annotations and no output schema), the description is mostly complete. It covers purpose, usage, behavior, and output type. However, it lacks error handling or edge case details (e.g., what happens if no tasks are executable), which would be helpful for full contextual understanding.

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?

There are 0 parameters, and schema description coverage is 100%, so the baseline is 4. The description appropriately does not discuss parameters, as none exist, and focuses on the tool's action and output instead.

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

Purpose5/5

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

The description clearly states the specific action ('自动查找下一个可执行的任务并开始执行') and the resource ('任务'), distinguishing it from siblings like getExecutableTaskList (which only lists) or getCurrentTask (which retrieves without starting). It explicitly mentions updating task status to 'in_progress', which further clarifies its distinct purpose.

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

Usage Guidelines5/5

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

The description provides explicit guidance on when to use this tool: when dependencies are completed ('所有依赖均已完成') and to advance the plan ('推进计划的核心方法'). It implicitly distinguishes from alternatives like getExecutableTaskList (for listing only) or completeTask/failTask/skipTask (for ending tasks). The context is clear without exclusions.

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/donway19/MCPlanManager'

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