Skip to main content
Glama

generateContextPrompt

Creates detailed prompts summarizing plan status, including goals and actionable tasks, to provide context for AI decision-making in task management systems.

Instructions

生成一个详细的文本提示,总结计划的当前状态。 这个提示可以作为上下文提供给AI模型,以帮助其决定下一步行动。 内容包括:总体目标、当前任务、可执行任务列表等。

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler and registration for 'generateContextPrompt'. Instantiates DependencyPromptGenerator with the global plan_manager and delegates to its generate_context_prompt() method to produce the prompt string.
    @mcp.tool()
    def generateContextPrompt() -> str:
        """
        生成一个详细的文本提示,总结计划的当前状态。
        这个提示可以作为上下文提供给AI模型,以帮助其决定下一步行动。
        内容包括:总体目标、当前任务、可执行任务列表等。
        """
        from .dependency_tools import DependencyPromptGenerator
        generator = DependencyPromptGenerator(plan_manager)
        prompt = generator.generate_context_prompt()
        return prompt
  • Core implementation of the context prompt generation within DependencyPromptGenerator class. Gathers plan status, current task, executable tasks, dependencies, and suggestions to build a comprehensive markdown-formatted prompt string.
    def generate_context_prompt(self) -> str:
        """生成上下文感知的提示词"""
        plan_status = self.pm.getPlanStatus()
        if not plan_status["success"]:
            return "Error: Could not get plan status"
        
        dump_result = self.pm.dumpPlan()
        if not dump_result.get("success"):
            return "Error: Could not dump plan data"
        plan_data = dump_result["data"]
        
        goal = plan_data["meta"]["goal"]
        tasks = plan_data["tasks"]
        state = plan_data["state"]
        
        prompt_parts = [
            "# 任务执行上下文",
            f"## 总体目标\n{goal}",
            "",
            "## 当前状态"
        ]
        
        # 当前任务信息
        current_task_response = self.pm.getCurrentTask()
        if current_task_response["success"]:
            task = current_task_response["data"]
            prompt_parts.extend([
                f"- 当前执行任务: [{task['id']}] {task['name']}",
                f"- 任务状态: {task['status']}",
                f"- 执行理由: {task['reasoning']}"
            ])
        else:
            prompt_parts.append("- 当前没有活动任务")
        
        # 可执行任务
        executable = self.pm.getExecutableTaskList()
        if executable["success"] and len(executable["data"]) > 0:
            prompt_parts.append("\n## 可执行任务")
            for task in executable["data"]:
                prompt_parts.append(f"- [{task['id']}] {task['name']}")
        
        # 任务依赖关系
        prompt_parts.extend([
            "",
            "## 任务依赖关系",
            self._generate_dependency_text(tasks)
        ])
        
        # 执行建议
        prompt_parts.extend([
            "",
            "## 执行建议",
            self._generate_execution_suggestions(tasks, state)
        ])
        
        return "\n".join(prompt_parts)
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 states the tool generates a text prompt, but doesn't describe behavioral traits like whether it's read-only or mutating (though 'generate' suggests creation), what format the prompt takes, whether it has side effects, or any performance considerations. For a tool with zero annotation coverage, this leaves significant gaps in understanding how it behaves.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and well-structured in three sentences: first states the purpose, second explains usage context, third lists content components. Each sentence adds value without redundancy. It could be slightly more front-loaded by emphasizing the core action earlier, but overall it's efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 0 parameters (simple complexity) and no output schema, the description is moderately complete. It covers the purpose and output content but lacks details on behavioral traits (e.g., side effects, format) and usage guidelines relative to siblings. For a tool in a server with many plan-related siblings, more contextual differentiation would improve completeness.

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 input schema has 0 parameters with 100% schema description coverage, so no parameters need documentation. The description doesn't mention any parameters, which is appropriate. It adds value by explaining the output's purpose and content (e.g., includes overall goals, current tasks, executable task lists), compensating for the lack of output schema.

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: '生成一个详细的文本提示,总结计划的当前状态' (generate a detailed text prompt summarizing the current state of the plan). It specifies the verb '生成' (generate) and resource '文本提示' (text prompt), and mentions the content includes overall goals, current tasks, and executable task lists. However, it doesn't explicitly differentiate from siblings like 'dumpPlan' or 'getPlanStatus' which might provide similar plan state information.

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 minimal usage guidance: '这个提示可以作为上下文提供给AI模型,以帮助其决定下一步行动' (this prompt can be provided as context to an AI model to help it decide next actions). It implies usage when AI needs context for decision-making, but offers no explicit when-to-use vs. when-not-to-use rules, no prerequisites, and no alternatives among the many sibling tools (e.g., vs. 'dumpPlan' or 'getPlanStatus').

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