Skip to main content
Glama

generate_test_data_tool

Generate fixed-length test data records with customizable field specifications for software testing and development. Create realistic datasets with string, enum, integer, date, and filler field types.

Instructions

Generate fixed-length test data based on a field specification

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fieldsYes
num_recordsYes

Implementation Reference

  • main.py:51-54 (handler)
    The `generate_test_data_tool` function is registered as an MCP tool and acts as the handler to call `generate_test_data`.
    @mcp.tool()
    def generate_test_data_tool(fields: List[FieldSpec], num_records: int) -> str:
        """Generate fixed-length test data based on a field specification"""
        return generate_test_data(fields, num_records)
  • main.py:8-15 (schema)
    Pydantic schema definition for `FieldSpec` which defines the input format for the tool.
    class FieldSpec(BaseModel):
        name: str
        type: Literal["string", "enum", "integer", "date", "filler"]
        length: int
        values: Optional[list[str]] = None
        format: Optional[str] = "%Y%m%d"
        min: Optional[int] = 0
        max: Optional[int] = 9999
  • main.py:44-49 (helper)
    Helper function that generates the actual test data based on the provided field specifications.
    def generate_test_data(fields, num_records):
        lines = []
        for _ in range(num_records):
            line = "".join(generate_field(field) for field in fields)
            lines.append(line)
        return "\n".join(lines)
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/cdelashmutt-pivotal/sample-data-mcp'

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