> ## Documentation Index
> Fetch the complete documentation index at: https://docs.golf.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Test generation

> Automatically generate comprehensive test suites for your MCP servers

Automatic test generation uses AI to **research your MCP server** and **automatically create test suites**. Instead of manually writing dozens of test cases, you can generate them in minutes with a simple interactive wizard.

## How It Works

**Stage 1: MCP Introspection** (Always executed)

* Connects to your MCP server
* Discovers all available tools, resources, and prompts
* Analyzes tool schemas and capabilities

**Stage 2: User Resources** (Optional)

* Processes documentation URLs you provide
* Incorporates usage examples and best practices
* Learns from your specific server context

**Stage 3: Web Research** (Optional)

* Uses AI model to search for domain-specific knowledge about the MCP's operational area

## Quick Start

<Steps>
  <Step title="Ensure you have a configured server">
    Before generating tests, make sure you have at least one MCP server configured:

    ```bash theme={null}
    # List your servers
    mcp-t list servers

    # Or create a new server if needed
    mcp-t create server
    ```
  </Step>

  <Step title="Run the generation wizard">
    Start the interactive test generation wizard:

    ```bash theme={null}
    mcp-t generate
    ```
  </Step>

  <Step title="Follow the interactive prompts">
    The wizard will guide you through:

    * Selecting which server to test
    * Optionally specifying a testing focus
    * Optionally providing documentation URLs
    * Choosing whether to enable web research
  </Step>

  <Step title="Run your generated tests">
    Once generation completes, run your new test suite:

    ```bash theme={null}
    mcp-t run <generated-suite-id> <server-id>
    ```

    The suite ID will be displayed after generation completes.
  </Step>
</Steps>

### Test Metadata

Each generated test includes metadata for tracking:

```json theme={null}
{
  "test_id": "fetch_url_happy_path",
  "user_message": "Can you fetch the content from https://example.com for me?",
  "success_criteria": "Agent successfully uses fetch_url tool and returns the content",
  "max_turns": 5,
  "context_persistence": true,
  "metadata": {
    "tool_name": "fetch_url",
    "test_type": "happy_path"
  }
}
```

## Next Steps

After generating your test suite:

1. **Run the tests** - Execute with `mcp-t run <suite-id> <server-id>`
2. **Review results** - Check which tests pass and which fail
3. **Customize** - Edit the generated suite to add specific test cases
4. **Iterate** - Regenerate tests as your server evolves

Learn more:

* [Running Tests](/mcp-testing/getting-started/first-test)
* [Conversational Testing](/mcp-testing/test-types/conversational)
* [CLI Reference](/mcp-testing/cli-reference)
