MongoDB MCP Server
by jonfreeland
sample_data
Get a random sample of documents from a collection.
Supports both JSON and CSV output formats:
- Use outputFormat="json" for standard JSON (default)
- Use outputFormat="csv" for comma-separated values export
Useful for:
- Exploratory data analysis
- Testing with representative data
- Understanding data distribution
- Performance testing with realistic data subsets
Example - JSON Sample: use_mcp_tool with server_name: "mongodb", tool_name: "sample_data", arguments: { "collection": "users", "size": 50 }
Example - CSV Export: use_mcp_tool with server_name: "mongodb", tool_name: "sample_data", arguments: { "collection": "users", "size": 100, "outputFormat": "csv", "formatOptions": { "includeHeaders": true, "delimiter": "," } }
Input Schema
Name | Required | Description | Default |
---|---|---|---|
collection | Yes | Collection name | |
database | No | Database name (optional if default database is configured) | |
formatOptions | No | Format-specific options | |
outputFormat | No | Output format for results (json or csv) | |
size | No | Number of random documents to sample (default: 10) |