Skip to main content
Glama

tailtest_scenario_plan

Generates structured scaffolding that an agent uses to write a SCENARIO PLAN, detailing language, framework, depth, adversarial count, baseline scenarios, and test file path for automated test creation.

Instructions

Return structured scaffolding the agent uses to write its SCENARIO PLAN: language, framework, depth, R15 adversarial count requirement, language and framework baseline scenarios, test file path, and prose instructions. The agent uses this scaffolding to compose the actual SCENARIO PLAN scenario lines.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
file_pathYesRelative or absolute path to the source file under test.
project_rootNoProject root directory. Defaults to the current working directory.

Implementation Reference

  • The main handler function `scenario_plan()` that executes the tool logic. It reads depth from config, detects language/framework, computes scenario counts and adversarial requirements, and returns structured scaffolding for the agent's SCENARIO PLAN.
    def scenario_plan(file_path: str, project_root: str | None = None) -> dict[str, Any]:
        """Return structured scaffolding the agent uses to write its SCENARIO PLAN.
    
        Args:
            file_path: relative or absolute path to the source file.
            project_root: project root for reading config.json. Defaults to cwd.
    
        Returns:
            Dict with: file_path, language, framework, depth, scenario_count_target,
            adversarial_count_required, adversarial_categories, language_baseline,
            framework_baseline, test_file_path, instructions.
        """
        project_root = project_root or os.getcwd()
    
        language = detect_language(file_path) or "unknown"
        framework = _detect_framework(language, file_path, project_root)
        depth = _read_depth(project_root)
        count_min, count_max = SCENARIO_COUNT_BY_DEPTH[depth]
        adv_required = ADVERSARIAL_BY_DEPTH[depth]
        test_path = _test_file_path(file_path, language, framework)
    
        instructions = (
            f"Generate a SCENARIO PLAN for {file_path}. "
            f"Depth is {depth}: produce {count_min} to {count_max} scenarios total. "
            f"R15 requires at least {adv_required} adversarial scenarios labeled "
            f"[adversarial: <category>]. Pick categories from the 8-category list "
            f"that genuinely apply to this file; document any skipped category with "
            f"a reason. Include the language baseline scenarios. "
        )
        if framework:
            instructions += (
                f"Include the {framework} framework baseline scenarios on top of the "
                f"language baseline. "
            )
        if depth == "simple":
            instructions += (
                "Note: at depth: simple, R15 does not apply -- generate happy-path "
                "scenarios only. "
            )
    
        return {
            "file_path": file_path,
            "language": language,
            "framework": framework,
            "depth": depth,
            "scenario_count_target": [count_min, count_max],
            "adversarial_count_required": adv_required,
            "adversarial_categories": ADVERSARIAL_CATEGORIES,
            "language_baseline": LANGUAGE_BASELINE.get(language, []),
            "framework_baseline": _framework_baseline(framework),
            "test_file_path": test_path,
            "instructions": instructions,
        }
  • Registration of 'tailtest_scenario_plan' as a Tool in the MCP server's list_tools() with input schema (file_path required, project_root optional).
    Tool(
        name="tailtest_scenario_plan",
        description=(
            "Return structured scaffolding the agent uses to write its SCENARIO PLAN: "
            "language, framework, depth, R15 adversarial count requirement, language and "
            "framework baseline scenarios, test file path, and prose instructions. The agent "
            "uses this scaffolding to compose the actual SCENARIO PLAN scenario lines."
        ),
        inputSchema={
            "type": "object",
            "properties": {
                "file_path": {
                    "type": "string",
                    "description": "Relative or absolute path to the source file under test.",
                },
                "project_root": {
                    "type": "string",
                    "description": "Project root directory. Defaults to the current working directory.",
                },
            },
            "required": ["file_path"],
            "additionalProperties": False,
        },
    ),
  • Dispatch/call handler in server.py that imports and invokes scenario_plan() when the tool name is 'tailtest_scenario_plan'.
    if name == "tailtest_scenario_plan":
        from .tools.scenario_plan import scenario_plan
        import json as _json
    
        result = scenario_plan(
            file_path=arguments["file_path"],
            project_root=arguments.get("project_root"),
        )
        return [TextContent(type="text", text=_json.dumps(result, indent=2))]
  • Helper _read_depth() reads the .tailtest/config.json depth setting.
    def _read_depth(project_root: str) -> str:
        """Read depth from .tailtest/config.json. Defaults to 'standard'."""
        config_path = os.path.join(project_root, ".tailtest", "config.json")
        if os.path.exists(config_path):
            try:
                with open(config_path) as f:
                    cfg = json.load(f)
                value = cfg.get("depth")
                if value in ADVERSARIAL_BY_DEPTH:
                    return value
            except (json.JSONDecodeError, OSError):
                pass
        return "standard"
  • Helper _framework_baseline() returns framework-specific baseline scenarios (flask, fastapi, django).
    def _framework_baseline(framework: str | None) -> list[str]:
        """Framework baseline scenarios from R2 templates."""
        if framework is None:
            return []
        if framework == "flask":
            return [
                "Route returns 200 on valid path",
                "404 on unknown route",
                "Blueprint registration binds the correct prefix",
                "test_client fixture used within app context",
                "Validation rejects bad input",
            ]
        if framework == "fastapi":
            return [
                "Valid request body returns expected response",
                "Missing required field returns 422",
                "Wrong field type returns 422",
                "Dependency override works in test (app.dependency_overrides)",
            ]
        if framework == "django":
            return [
                "Request with valid auth",
                "Request without auth (expect 403/redirect)",
                "Model field validation rejects invalid data",
                "URL routes to the correct view",
            ]
        return []
Behavior2/5

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

No annotations are provided, so the description must disclose behavioral traits. It says 'Return structured scaffolding' implying a read operation, but does not explicitly state it is non-destructive, lacks side effects, or requires authentication. This leaves ambiguity.

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?

Two sentences, front-loaded with purpose and components. No extraneous words; efficient and focused.

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 no output schema, the description lists the return components (language, framework, depth, etc.) which provides substantial context. Missing explicit structure format (e.g., JSON fields), but depth is adequate for an agent generating a plan.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% (both parameters described). The tool description adds no additional semantic meaning beyond what the schema provides (file_path and project_root roles are clear from schema). Baseline 3 is appropriate.

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 tool returns structured scaffolding for writing a SCENARIO PLAN, listing specific components (language, framework, depth, etc.). This distinguishes it from sibling tools like tailtest_classify_failures and tailtest_ping, which have different purposes.

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?

No explicit guidance on when to use this tool versus alternatives. It merely states the agent uses the scaffolding to compose the plan, but does not provide context for selection or exclusion.

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/avansaber/tailtest-cline'

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