Skip to main content
Glama
jankowtf

MCP Server Template for Cursor IDE

by jankowtf

apply_prompt_unit_tests

Generate unit test prompts for code by providing code snippets and optional instructions to create comprehensive test cases in Cursor IDE.

Instructions

Provides a prompt for generating unit tests for code

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
code_to_testYesThe code that needs unit tests
specific_instructionsNoOptional specific instructions to include in the prompt
versionNoThe version of the prompt template to use (e.g., '1.0.0', '1.1.0', or 'latest')

Implementation Reference

  • The core handler function for the 'apply_prompt_unit_tests' tool. It renders a prompt template named 'test' using the provided code_to_test, specific_instructions, and version, then returns the result as TextContent.
    async def apply_prompt_unit_tests(
        code_to_test: str,
        specific_instructions: str = "",
        version: str = "latest",
    ) -> list[types.TextContent]:
        """
        Provides a prompt for generating unit tests for code.
    
        Args:
            code_to_test: The code that needs unit tests.
            specific_instructions: Optional specific instructions to include in the prompt.
            version: The version of the prompt template to use. Defaults to "latest".
    
        Returns:
            A list containing a TextContent object with the prompt.
        """
        # Render the prompt template with the code to test and specific instructions
        response_text = render_prompt_template(
            "test",
            version_str=version,
            code_to_test=code_to_test,
            specific_instructions=specific_instructions,
        )
        return [types.TextContent(type="text", text=response_text)]
  • The input schema definition for the tool, specifying required 'code_to_test' parameter and optional 'specific_instructions' and 'version'.
    types.Tool(
        name="apply_prompt_unit_tests",
        description="Provides a prompt for generating unit tests for code",
        inputSchema={
            "type": "object",
            "required": ["code_to_test"],
            "properties": {
                "code_to_test": {
                    "type": "string",
                    "description": "The code that needs unit tests",
                },
                "specific_instructions": {
                    "type": "string",
                    "description": "Optional specific instructions to include in the prompt",
                },
                "version": {
                    "type": "string",
                    "description": "The version of the prompt template to use (e.g., '1.0.0', '1.1.0', or 'latest')",
                },
            },
        },
    ),
  • The dispatch logic in the call_tool handler that routes requests for 'apply_prompt_unit_tests' to the corresponding function, including input validation.
    elif name == "apply_prompt_unit_tests":
        if "code_to_test" not in arguments:
            return [
                types.TextContent(
                    type="text",
                    text="Error: Missing required argument 'code_to_test'",
                )
            ]
        version = arguments.get("version", "latest")
        specific_instructions = arguments.get("specific_instructions", "")
        return await apply_prompt_unit_tests(
            code_to_test=arguments["code_to_test"],
            specific_instructions=specific_instructions,
            version=version,
        )
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 'provides a prompt,' implying a read-only or generation operation, but doesn't clarify if it's a simple lookup, requires external resources, has rate limits, or what the output format might be. For a tool with no annotations, this is a significant gap in behavioral context.

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 a single, efficient sentence: 'Provides a prompt for generating unit tests for code.' It's front-loaded with the core purpose, has zero wasted words, and is appropriately sized for the tool's complexity. Every part of the sentence 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.

Completeness2/5

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

Given the tool's moderate complexity (3 parameters, no output schema, no annotations), the description is incomplete. It lacks behavioral details (e.g., output format, error handling), usage guidelines compared to siblings, and doesn't compensate for the absence of annotations. While concise, it fails to provide sufficient context for effective agent use.

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?

The description adds no parameter-specific information beyond what the input schema provides. Since schema description coverage is 100%, the schema already documents all three parameters (code_to_test, specific_instructions, version) with clear descriptions. The description doesn't elaborate on semantics, usage examples, or constraints, so it meets the baseline for high schema coverage.

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: 'Provides a prompt for generating unit tests for code.' It specifies the verb ('provides a prompt') and resource ('for generating unit tests for code'), making it understandable. However, it doesn't differentiate from sibling tools like 'apply_prompt_change' or 'apply_prompt_fix', which also provide prompts but for different purposes, so it lacks explicit sibling distinction.

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 offers no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools or contexts where unit test generation is preferred over other prompt types (e.g., 'apply_prompt_fix' for code fixes). There's no indication of prerequisites, exclusions, or comparative scenarios, leaving usage ambiguous.

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/jankowtf/mcp-hitchcode'

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