Skip to main content
Glama
mongodb-js

MongoDB MCP Server

Official
by mongodb-js

collection-schema

Read-only

Infer and describe the schema of a MongoDB collection by sampling documents. Get field names, types, and structure to understand data shape.

Instructions

Describe the schema for a collection

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseYesDatabase name
collectionYesCollection name
sampleSizeNoNumber of documents to sample for schema inference
responseBytesLimitNoThe maximum number of bytes to return in the response. This value is capped by the server's configured maxBytesPerQuery and cannot be exceeded.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
schemaYes
fieldsCountYes
Behavior3/5

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

The annotations already declare readOnlyHint=true and destructiveHint=false, so the description's one-liner adds no further behavioral context. While no contradiction exists, the description misses an opportunity to clarify that the tool samples documents for schema inference, which is a key behavioral trait beyond what annotations convey.

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

Conciseness4/5

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

The description is extremely concise with a single sentence, which is efficient and front-loaded. However, it could slightly expand to mention key aspects like document sampling without becoming verbose, so it's slightly under-informative for its brevity.

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

Completeness4/5

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

Given the presence of a well-detailed input schema and an output schema (though not shown), the description is fairly complete for a read-only metadata tool. It covers the core purpose but could benefit from noting that schema inference is based on document sampling.

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 input schema already documents all four parameters with descriptions. The tool description does not add any additional meaning or clarification beyond what the schema provides, meeting the baseline expectation but not exceeding it.

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

Purpose5/5

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

The description 'Describe the schema for a collection' clearly states the tool's purpose with a specific verb and resource. It effectively distinguishes from sibling tools like find and aggregate, which focus on data retrieval and manipulation, making it easy for an AI agent to select the correct tool for schema exploration.

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?

No usage guidelines are provided. The description does not specify when to use this tool versus alternatives like collection-indexes or find, nor does it mention any prerequisites or context for its use. This lack of guidance may lead to suboptimal tool selection.

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

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