Skip to main content
Glama

generateDataModel

Create statistical models from sample documents or text descriptions to generate realistic synthetic data for MongoDB-compatible databases without actual storage.

Instructions

Create a statistical model from sample documents or a text description for data generation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
descriptionNoNatural language description of the data structure
nameYesName for the model
samplesNoSample documents to train the model

Implementation Reference

  • The primary handler function implementing the generateDataModel tool. It infers a JSON schema from provided samples using this.inferrer.inferSchema or generates from a description, saves the model to storage, caches it, and returns success info with properties.
    async generateDataModel(args) { const { name, description, samples } = args; if (samples && samples.length > 0) { const model = this.inferrer.inferSchema(samples); model.title = name; model.description = description || `DataFlood model: ${name}`; await this.storage.saveModel(config.storage.defaultDatabase, name, model); this.models.set(name, model); return { success: true, message: `Model '${name}' created from ${samples.length} samples`, properties: Object.keys(model.properties || {}) }; } else if (description) { const model = this.generateFromDescription(description); model.title = name; await this.storage.saveModel(config.storage.defaultDatabase, name, model); this.models.set(name, model); return { success: true, message: `Model '${name}' generated from description`, properties: Object.keys(model.properties || {}) }; } else { throw new Error('Either samples or description required'); } }
  • The input schema definition for the generateDataModel tool, specifying parameters: name (required), description, samples.
    name: 'generateDataModel', description: 'Generate a DataFlood model from sample data or description', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name for the model' }, description: { type: 'string', description: 'Natural language description of the data structure' }, samples: { type: 'array', description: 'Sample documents to train the model', items: { type: 'object' } } }, required: ['name'] }
  • Registration in the handleToolCall switch statement dispatching to the generateDataModel handler.
    case 'generateDataModel': result = await this.generateDataModel(args); break;
  • Helper method used by generateDataModel to generate schema from natural language description using promptAnalyzer.
    generateFromDescription(description) { const analysis = this.promptAnalyzer.analyze(description); return analysis.schema; }
  • Tool metadata registration in the this.tools array, including name, description, and schema.
    this.tools = [ { name: 'generateDataModel', description: 'Generate a DataFlood model from sample data or description', inputSchema: { type: 'object', properties: { name: { type: 'string', description: 'Name for the model' }, description: { type: 'string', description: 'Natural language description of the data structure' }, samples: { type: 'array', description: 'Sample documents to train the model', items: { type: 'object' } } }, required: ['name'] }

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/smallmindsco/MongTap'

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