Skip to main content
Glama

f0_make_randomvalues MCP Server

prompts.py6.79 kB
""" MCP Prompt implementations Provides interactive prompt templates for common workflows """ from mcp.server.fastmcp import FastMCP def register_prompts(mcp: FastMCP): """Register all prompt implementations with the MCP server""" @mcp.prompt(title="Generate Test Dataset") def generate_test_dataset( purpose: str = "testing", size: str = "small" ) -> str: """ Interactive prompt for generating test datasets. Args: purpose: Purpose of the dataset (e.g., "testing", "analysis", "demo") size: Dataset size - "small" (10), "medium" (100), or "large" (1000) Returns: Formatted prompt string with instructions """ sizes = { "small": 10, "medium": 100, "large": 1000 } count = sizes.get(size.lower(), 10) return f"""# Generate Random Dataset **Purpose**: {purpose} **Size**: {size} ({count} numbers) ## Instructions 1. Use the `generate_random_numbers` tool to create the dataset: - count: {count} - min_value: 0 - max_value: 999 2. Save the generated data using `save_random_data` tool: - filename: {purpose}_data_{size}.csv 3. Analyze the data using `analyze_random_data` tool to verify statistical properties. 4. Display a summary of: - Number of values generated - Statistical measures (mean, median, std_dev) - File location This will create a reproducible dataset for {purpose} purposes. """ @mcp.prompt(title="Analyze Random Data") def analyze_data_prompt( data_source: str = "current" ) -> str: """ Interactive prompt for analyzing random data. Args: data_source: Data source - "current" for latest data or filename for saved data Returns: Formatted prompt string with analysis instructions """ if data_source == "current": source_instruction = "Access the current data using the `random://current` resource." else: source_instruction = f"Load data from file using `load_data_from_csv` with filename: {data_source}" return f"""# Analyze Random Data **Data Source**: {data_source} ## Analysis Steps 1. **Load Data** {source_instruction} 2. **Statistical Analysis** Use the `analyze_random_data` tool to compute: - Mean and median - Standard deviation and variance - Min, max, and range 3. **Distribution Check** Verify if the data follows expected uniform distribution: - Check if mean is close to (min + max) / 2 - Verify reasonable standard deviation - Look for outliers (if any) 4. **Report Findings** Generate a summary report including: - Sample size - Key statistical measures - Distribution characteristics - Any anomalies detected This analysis will help validate the randomness and distribution of generated data. """ @mcp.prompt(title="Create Reproducible Dataset") def create_reproducible_dataset( seed: int = 42, count: int = 100 ) -> str: """ Prompt for creating reproducible datasets using seeds. Args: seed: Random seed for reproducibility count: Number of values to generate Returns: Formatted prompt with reproducibility instructions """ return f"""# Create Reproducible Random Dataset **Seed**: {seed} **Count**: {count} values ## Reproducibility Workflow 1. **Generate with Seed** Use `generate_random_numbers` with these exact parameters: - count: {count} - min_value: 0 - max_value: 999 - seed: {seed} 2. **Save the Dataset** Save to file: `reproducible_seed{seed}_n{count}.csv` 3. **Verification** To verify reproducibility, you can: - Re-run with the same seed - Compare results (should be identical) - Document the seed in your workflow ## Use Cases Reproducible datasets are essential for: - Unit testing - Research experiments - Benchmark comparisons - Debugging **Note**: Using the same seed will always produce the same sequence of random numbers. """ @mcp.prompt(title="Batch Data Generation") def batch_generation_prompt( num_batches: int = 5, batch_size: int = 20 ) -> str: """ Prompt for generating multiple batches of random data. Args: num_batches: Number of batches to generate batch_size: Size of each batch Returns: Formatted prompt for batch generation workflow """ total = num_batches * batch_size return f"""# Batch Random Data Generation **Number of Batches**: {num_batches} **Batch Size**: {batch_size} **Total Values**: {total} ## Batch Generation Workflow For each batch (i = 1 to {num_batches}): 1. **Generate Batch Data** ``` generate_random_numbers(count={batch_size}) ``` 2. **Save Batch** ``` save_random_data(numbers=<generated>, filename=batch_{{i}}_data.csv) ``` 3. **Track Progress** Log completion status and basic statistics for each batch ## Post-Generation Tasks After all batches are complete: 1. Use `meta://files` resource to list all generated files 2. Optionally combine batches if needed 3. Generate summary statistics across all batches This approach is useful for: - Large-scale data generation - Parallel processing workflows - Incremental dataset building """ @mcp.prompt(title="Data Quality Check") def data_quality_check( filename: str = "data.csv" ) -> str: """ Prompt for performing data quality checks. Args: filename: CSV file to check Returns: Formatted prompt with quality check instructions """ return f"""# Data Quality Check **File**: {filename} ## Quality Verification Steps 1. **Load and Validate** - Use `load_data_from_csv` to load: {filename} - Verify data loaded successfully - Check for missing or invalid values 2. **Statistical Validation** - Run `analyze_random_data` on loaded data - Verify all values are in expected range [0, 999] - Check for suspicious patterns 3. **Distribution Check** For uniform random distribution, expect: - Mean ≈ 499.5 (midpoint of range) - Standard deviation ≈ 288 (theoretical: √(1000²/12) ≈ 288.7) - Min and Max within [0, 999] 4. **Quality Report** Document findings: - Sample size - Range compliance - Distribution characteristics - Pass/fail status ## Quality Criteria ✓ All values within [0, 999] ✓ Mean within ±10% of expected (449.5 - 549.5) ✓ No missing or corrupted data ✓ Standard deviation > 200 (indicates good spread) This ensures the data meets quality standards for downstream use. """

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/sengokusal2025/f0_20251002'

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