Skip to main content
Glama

startMongoServer

Launch a local MongoDB server that generates realistic test data using statistical models instead of storing actual data, enabling development and testing without real databases.

Instructions

Start a local MongoDB-compatible server that generates data from statistical models

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
portNoPort to listen on (0 for auto)
databaseNoDefault database nametest

Implementation Reference

  • Core handler implementation: creates MongoDBServer instance with DataFlood storage, starts the server, tracks it in servers Map, returns port and connection string.
    async startMongoServer(args) {
        const { port = 0, database = 'test' } = args;
        
        const server = new MongoDBServer({
            port,
            storage: this.storage,
            database,
            logger: this.logger  // Pass the MCP logger
        });
        
        await server.start();
        const actualPort = server.server.address().port;
        
        this.servers.set(actualPort, server);
        
        return {
            success: true,
            port: actualPort,
            message: `MongoDB server started on port ${actualPort}`,
            connectionString: `mongodb://localhost:${actualPort}/${database}`
        };
    }
  • Tool schema definition including input parameters for port and database with descriptions and defaults.
    {
        name: 'startMongoServer',
        description: 'Start a MongoDB-compatible server with DataFlood backing',
        inputSchema: {
            type: 'object',
            properties: {
                port: { type: 'integer', description: 'Port to listen on (0 for auto)', default: 0 },
                database: { type: 'string', description: 'Default database name', default: 'test' }
            }
        }
    },
  • Tool registration in the this.tools array used for listing available tools via handleListTools.
    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']
            }
        },
        {
            name: 'startMongoServer',
            description: 'Start a MongoDB-compatible server with DataFlood backing',
            inputSchema: {
                type: 'object',
                properties: {
                    port: { type: 'integer', description: 'Port to listen on (0 for auto)', default: 0 },
                    database: { type: 'string', description: 'Default database name', default: 'test' }
                }
            }
        },
        {
            name: 'stopMongoServer',
            description: 'Stop a running MongoDB server',
            inputSchema: {
                type: 'object',
                properties: {
                    port: { type: 'integer', description: 'Port of the server to stop' }
                },
                required: ['port']
            }
        },
        {
            name: 'listActiveServers',
            description: 'List all active MongoDB servers',
            inputSchema: {
                type: 'object',
                properties: {}
            }
        },
        {
            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']
            }
        },
        {
            name: 'trainModel',
            description: 'Train or update a model with new data',
            inputSchema: {
                type: 'object',
                properties: {
                    model: { type: 'string', description: 'Model name' },
                    documents: { type: 'array', description: 'Documents to train with', items: { type: 'object' } }
                },
                required: ['model', 'documents']
            }
        },
        {
            name: 'listModels',
            description: 'List all available DataFlood models',
            inputSchema: {
                type: 'object',
                properties: {}
            }
        },
        {
            name: 'getModelInfo',
            description: 'Get detailed information about a model',
            inputSchema: {
                type: 'object',
                properties: {
                    model: { type: 'string', description: 'Model name' }
                },
                required: ['model']
            }
        }
    ];
  • Alternative handler implementation in SDK-based MCP server: similar logic to create and start MongoDBServer.
    case 'startMongoServer':
      const port = args.port !== undefined ? args.port : (config.server.defaultPort || 0);
      const database = args.database || config.storage.defaultDatabase || 'test';
      
      const mongoServer = new MongoDBServer({
        port: port,
        host: config.server.host || 'localhost',
        storage: storage,
        logger: logger
      });
      
      await mongoServer.start();
      const actualPort = mongoServer.port; // Get the actual port from the server
      servers.set(actualPort, { server: mongoServer, database, status: 'running', connections: 0 });
      
      return {
        content: [{
          type: 'text',
          text: `MongoDB server started successfully:\n- Port: ${actualPort}\n- Database: ${database}\n- Connection: mongodb://localhost:${actualPort}/${database}\n\nServer supports DataFlood generation with $seed and $entropy parameters.`
        }]
      };
  • Tool schema in SDK-based implementation.
    name: 'startMongoServer',
    description: 'Start a local MongoDB-compatible server that generates data from statistical models',
    inputSchema: {
      type: 'object',
      properties: {
        port: { type: 'integer', description: 'Port to listen on (0 for auto)', default: 0 },
        database: { type: 'string', description: 'Default database name', default: 'test' }
      }
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the server 'generates data from statistical models,' which hints at dynamic data generation, but fails to describe key behaviors: whether it runs in the background, requires authentication, has rate limits, or what happens on failure. For a server-start tool with zero annotation coverage, this leaves significant gaps in understanding its operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that front-loads the core action and unique feature. It wastes no words, clearly stating what the tool does without redundancy or unnecessary details, making it highly concise and well-structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of starting a server with data generation capabilities, no annotations, and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., server status, connection details), how to interact with the server post-start, or error handling. For a tool that likely has significant runtime implications, more context is needed to be fully helpful.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema fully documents the two parameters (port and database) with descriptions and defaults. The description adds no additional meaning about parameters beyond what the schema provides, such as how 'port' interacts with auto-assignment or what 'database' entails. With high schema coverage, the baseline score of 3 is appropriate as the description doesn't compensate but doesn't detract either.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'Start a local MongoDB-compatible server that generates data from statistical models.' It specifies the verb ('Start'), resource ('MongoDB-compatible server'), and unique capability ('generates data from statistical models'). However, it doesn't explicitly differentiate from sibling tools like 'listActiveServers' or 'stopMongoServer' beyond the action verb, which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a model first), when not to use it (e.g., if a server is already running), or direct alternatives among siblings like 'listActiveServers' for checking status. Usage is implied by the action but lacks explicit context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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

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