Skip to main content
Glama

tailtest_pick_template

Returns a testing template tailored to the source file's framework, including baseline scenarios and test file path patterns. Falls back to language baseline if framework is unrecognized.

Instructions

Return the full framework R2 template for a given source file: language baseline scenarios, framework baseline scenarios, framework-specific test pattern (e.g., NestJS Test.createTestingModule, Spring @WebMvcTest, Flask test_client), and test file path pattern. Returns just language baseline when no framework matches.

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 pick_template() function is the core handler that returns the full framework R2 template for a given source file. It detects language via filter.detect_language, detects framework via _detect_framework, then returns language baseline scenarios, framework template (if matched), test file path pattern, and prose instructions.
    def pick_template(file_path: str, project_root: str | None = None) -> dict[str, Any]:
        """Return the full framework R2 template for the given source file.
    
        Args:
            file_path: relative or absolute path to the source file.
            project_root: project root for framework detection. Defaults to cwd.
    
        Returns:
            Dict with: language, framework (or None), language_baseline,
            framework_template (or None), test_file_path_pattern, instructions.
    
        If no framework matches, returns just the language baseline.
        """
        project_root = project_root or os.getcwd()
    
        language = detect_language(file_path) or "unknown"
        framework = _detect_framework(language, project_root)
    
        language_baseline = LANGUAGE_BASELINES.get(language, [])
        framework_template = FRAMEWORK_TEMPLATES.get(framework) if framework else None
    
        instructions = (
            f"Use the language baseline scenarios for {language}: "
            f"{', '.join(language_baseline) or 'none specified'}. "
        )
        if framework_template:
            instructions += (
                f"Add framework-specific scenarios for {framework} on top: "
                f"{'; '.join(framework_template['baseline_scenarios'])}. "
                f"Follow the test pattern: {framework_template['test_pattern']} "
            )
        else:
            instructions += "No framework template matched; use language baseline only. "
    
        return {
            "file_path": file_path,
            "language": language,
            "framework": framework,
            "language_baseline": language_baseline,
            "framework_template": framework_template,
            "test_file_path_pattern": (
                framework_template["test_file_path"] if framework_template else None
            ),
            "instructions": instructions,
        }
  • Input schema registration for tailtest_pick_template. Defines the tool's MCP input schema with required 'file_path' (string) and optional 'project_root' (string) properties.
    Tool(
        name="tailtest_pick_template",
        description=(
            "Return the full framework R2 template for a given source file: language "
            "baseline scenarios, framework baseline scenarios, framework-specific test "
            "pattern (e.g., NestJS Test.createTestingModule, Spring @WebMvcTest, Flask "
            "test_client), and test file path pattern. Returns just language baseline "
            "when no framework matches."
        ),
        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,
        },
    ),
  • Tool registration entry in the list_tools() function. Registers 'tailtest_pick_template' as an MCP Tool with description and inputSchema.
    Tool(
        name="tailtest_pick_template",
        description=(
            "Return the full framework R2 template for a given source file: language "
            "baseline scenarios, framework baseline scenarios, framework-specific test "
            "pattern (e.g., NestJS Test.createTestingModule, Spring @WebMvcTest, Flask "
            "test_client), and test file path pattern. Returns just language baseline "
            "when no framework matches."
        ),
        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,
        },
    ),
  • Helper _detect_framework() function that examines project files (requirements.txt, pyproject.toml, setup.py, package.json, pom.xml, build.gradle, .csproj) to detect which framework (flask, fastapi, django, nestjs, spring, kotlin, csharp) is used by a given project.
    def _detect_framework(language: str, project_root: str) -> str | None:
        """Detect framework from project files. V14.2 lightweight version."""
        if language == "python":
            for f in ("requirements.txt", "pyproject.toml", "setup.py"):
                path = os.path.join(project_root, f)
                if os.path.exists(path):
                    try:
                        with open(path) as fh:
                            text = fh.read().lower()
                        if "fastapi" in text:
                            return "fastapi"
                        if "flask" in text:
                            return "flask"
                        if "django" in text:
                            return "django"
                    except OSError:
                        pass
        elif language == "typescript":
            pkg = os.path.join(project_root, "package.json")
            if os.path.exists(pkg):
                try:
                    with open(pkg) as fh:
                        text = fh.read().lower()
                    if "@nestjs/" in text:
                        return "nestjs"
                except OSError:
                    pass
        elif language == "java":
            pom = os.path.join(project_root, "pom.xml")
            gradle = os.path.join(project_root, "build.gradle")
            for path in (pom, gradle):
                if os.path.exists(path):
                    try:
                        with open(path) as fh:
                            text = fh.read().lower()
                        if "spring-boot" in text or "springframework" in text:
                            return "spring"
                    except OSError:
                        pass
        elif language == "kotlin":
            gradle = os.path.join(project_root, "build.gradle.kts")
            if os.path.exists(gradle):
                return "kotlin"
        elif language == "csharp":
            # Any .csproj triggers the C# template
            for f in os.listdir(project_root) if os.path.isdir(project_root) else []:
                if f.endswith(".csproj"):
                    return "csharp"
        return None
  • Dispatch handler in call_tool() that imports pick_template from .tools.pick_template and invokes it with the arguments, returning JSON-serialized result.
    if name == "tailtest_pick_template":
        from .tools.pick_template import pick_template
        import json as _json
    
        result = pick_template(
            file_path=arguments["file_path"],
            project_root=arguments.get("project_root"),
        )
        return [TextContent(type="text", text=_json.dumps(result, indent=2))]
Behavior4/5

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

With no annotations, the description carries full responsibility. It discloses the fallback behavior ('Returns just language baseline when no framework matches') and describes the output components. However, it does not mention error conditions or side effects, but given the read-only nature, this is acceptable.

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 two sentences, starts with the verb 'Return', and contains zero redundant information. Every phrase contributes to understanding the tool's function.

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 two parameters and no output schema, the description adequately explains the return value and the fallback. It lacks mention of error cases or supported languages, but is otherwise complete for a straightforward read tool.

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?

Schema description coverage is 100%, but the parameter descriptions are minimal. The tool description adds value by explaining that the output is determined by the file_path and project_root, and contextually connects parameters to the template resolution. This goes beyond the schema.

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 it returns a framework R2 template for a given source file, listing specific components (language baseline scenarios, framework baseline scenarios, etc.). This is a specific verb+resource and differentiates from sibling tools like tailtest_classify_failures.

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

Usage Guidelines3/5

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

The description implies usage for picking a template for a source file but does not explicitly state when to use this tool versus alternatives. It lacks guidance on when not to use or naming sibling tools for comparison.

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