Skip to main content
Glama

analyze_task_complexity

Analyzes task descriptions to recommend the most efficient tool for execution, optimizing workflow routing and strategy selection.

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 core handler function decorated with @mcp.tool(), implementing the logic to analyze task complexity and recommend tools based on keyword matching.
    @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 input schema used for validating the task_description parameter in the analyze_task_complexity tool.
    class TaskComplexityInput(BaseModel): task_description: str = Field( ..., min_length=5, description="The user's prompt or task." )
  • The @mcp.tool() decorator registers the analyze_task_complexity function as an MCP tool.
    @mcp.tool()

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