Skip to main content
Glama

MongoDB MCP Server

by jonfreeland

get_distinct_values

Retrieve unique values from a specified field in a MongoDB collection to analyze data distribution, identify categories, check quality, or detect anomalies within filtered datasets.

Instructions

Get distinct values for a field in a collection.

Useful for:

  • Understanding data distribution

  • Finding unique categories

  • Data quality checks

  • Identifying outliers

Example: use_mcp_tool with server_name: "mongodb", tool_name: "get_distinct_values", arguments: { "collection": "users", "field": "role", "filter": { "active": true } }

Input Schema

NameRequiredDescriptionDefault
collectionYesCollection name
databaseNoDatabase name (optional if default database is configured)
fieldYesField name to get distinct values for
filterNoMongoDB query filter to apply before getting distinct values (optional)

Input Schema (JSON Schema)

{ "properties": { "collection": { "description": "Collection name", "type": "string" }, "database": { "description": "Database name (optional if default database is configured)", "type": "string" }, "field": { "description": "Field name to get distinct values for", "type": "string" }, "filter": { "description": "MongoDB query filter to apply before getting distinct values (optional)", "type": "object" } }, "required": [ "collection", "field" ], "type": "object" }

Other Tools from MongoDB MCP Server

Related Tools

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/jonfreeland/mongodb-mcp'

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