Skip to main content
Glama

queryModel

Generate realistic MongoDB-style documents from statistical models with control over randomness and reproducibility using seed values and entropy parameters.

Instructions

Generate documents from a statistical model with optional query filters and generation control ($seed for reproducibility, $entropy for randomness)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countNoNumber of documents to generate
modelYesModel name
queryNoMongoDB-style query. Special parameters: $seed (number) for reproducible generation, $entropy (0-1) to control randomness level

Implementation Reference

  • Input schema and description for the 'queryModel' tool, defining parameters model, query, and count.
    { name: 'queryModel', description: 'Query a DataFlood model directly. Supports generation control via $seed and $entropy parameters in the query.', inputSchema: { type: 'object', properties: { model: { type: 'string', description: 'Model name' }, query: { type: 'object', description: 'MongoDB-style query. Special parameters: $seed (number) for reproducible generation, $entropy (0-1) to control randomness level' }, count: { type: 'integer', description: 'Number of documents to generate', default: 10 } }, required: ['model'] } },
  • Tool dispatch/registration in handleToolCall switch statement, calling the queryModel handler.
    case 'queryModel': result = await this.queryModel(args); break;
  • Core handler function that loads the model schema and generates documents using DocumentGenerator.
    async queryModel(args) { const { model, query = {}, count = 10 } = args; if (!this.models.has(model)) { const loaded = await this.storage.getModel(config.storage.defaultDatabase, model); if (!loaded) { throw new Error(`Model '${model}' not found`); } this.models.set(model, loaded); } const schema = this.models.get(model); const documents = this.generator.generateDocuments(schema, count); return { model, count: documents.length, documents }; }
  • Alternative input schema definition for 'queryModel' tool in the TOOLS array.
    { name: 'queryModel', description: 'Generate documents from a statistical model with optional query filters and generation control ($seed for reproducibility, $entropy for randomness)', inputSchema: { type: 'object', properties: { model: { type: 'string', description: 'Model name' }, query: { type: 'object', description: 'MongoDB-style query. Special parameters: $seed (number) for reproducible generation, $entropy (0-1) to control randomness level' }, count: { type: 'integer', description: 'Number of documents to generate', default: 10 } }, required: ['model'] }
  • Inline handler implementation in the tool call switch case for the SDK-based server.
    case 'queryModel': // Check filesystem first let model = models.get(args.model); if (!model) { try { model = await storage.getModel(config.storage.defaultDatabase, args.model); if (model) { models.set(args.model, model); } } catch (error) { throw new Error(`Model '${args.model}' not found`); } } if (!model) { throw new Error(`Model '${args.model}' not found`); } const count = args.count || 10; const query = args.query || {}; const seed = query.$seed; const entropy = query.$entropy || 0.5; // Generate documents using DataFlood - model is already the schema const documents = documentGenerator.generateDocuments(model, count); return { content: [{ type: 'text', text: `Generated ${documents.length} documents from model '${args.model}'\n\nGeneration parameters:\n- Seed: ${seed || 'random'}\n- Entropy: ${entropy}\n- Query filters: ${JSON.stringify(query, null, 2)}\n\nSample documents:\n${documents.slice(0, 3).map(d => JSON.stringify(d, null, 2)).join('\n\n')}` }] };

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