Skip to main content
Glama

analyze_task_complexity

Analyzes task descriptions to recommend efficient tools for execution, helping users select appropriate strategies for their specific needs.

Instructions

Analyzes a task to recommend the most efficient tool (The Router).

Args:
    task_description: The user's prompt or task.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
task_descriptionYes

Implementation Reference

  • The primary handler function for the 'analyze_task_complexity' tool. It is decorated with @mcp.tool() for automatic registration with the FastMCP server. The function validates input using TaskComplexityInput schema, analyzes keywords in the task description, and returns a recommendation for strategy, complexity, tool, and reasoning.
    @mcp.tool()
    def analyze_task_complexity(task_description: str) -> dict:
        """
        Analyzes a task to recommend the most efficient tool (The Router).
    
        Args:
            task_description: The user's prompt or task.
        """
        try:
            model = TaskComplexityInput(task_description=task_description)
        except ValidationError as e:
            return {"error": str(e)}
    
        task = model.task_description.lower()
    
        # Strategy: Constructor Mode (Build/Design)
        if any(
            w in task
            for w in [
                "build",
                "create",
                "design",
                "architect",
                "system",
                "bot",
                "assistant",
            ]
        ):
            return {
                "strategy": "constructor",
                "complexity": "Variable",
                "recommended_tool": "design_context_architecture",
                "reasoning": "User wants to build a system/agent. Use the Architect to design a blueprint.",
            }
    
        # Strategy: YOLO Mode (Direct Solve)
        if any(w in task for w in ["project", "repo", "codebase", "architecture"]):
            return {
                "strategy": "yolo",
                "complexity": "Medium",
                "recommended_tool": "project.explore",
                "reasoning": "Task involves project-level understanding.",
            }
        elif any(w in task for w in ["test", "tdd", "verify"]):
            return {
                "strategy": "yolo",
                "complexity": "High",
                "recommended_tool": "workflow.test_driven",
                "reasoning": "Task involves testing or verification workflows.",
            }
        elif any(w in task for w in ["analyze", "reason", "think", "solve", "complex"]):
            return {
                "strategy": "yolo",
                "complexity": "High",
                "recommended_tool": "reasoning.systematic",
                "reasoning": "Task requires structured reasoning.",
            }
        else:
            return {
                "strategy": "yolo",
                "complexity": "Low",
                "recommended_tool": "Standard Molecule",
                "reasoning": "Task appears simple. Use a basic prompt or few-shot molecule.",
            }
  • Pydantic BaseModel schema used for input validation in the analyze_task_complexity tool handler.
    class TaskComplexityInput(BaseModel):
        task_description: str = Field(
            ..., min_length=5, description="The user's prompt or task."
        )

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/4rgon4ut/sutra'

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