Skip to main content
Glama
Sanjeev4523

MongoDB MCP Server

by Sanjeev4523

run_aggregation_to_file

Run MongoDB aggregation pipelines and store results in a JSON file, returning only metadata (count, path, size) to avoid loading large datasets into the context.

Instructions

Run an aggregation pipeline on a collection and write results to a JSON file on disk. Returns only metadata (document count, file path, file size) instead of the actual documents, which avoids loading large result sets into the context window. Use CLI tools like jq, head, or the Read tool to selectively inspect the output file.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseYesThe database name
pipelineYesThe aggregation pipeline stages
collectionYesThe collection name
output_pathYesAbsolute file path where JSON results will be written
Behavior4/5

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

With no annotations provided, the description carries the full burden. It discloses that only metadata is returned, the reason for this, and suggests how to handle the output file. A minor gap is not mentioning whether an existing file at output_path is overwritten or appended.

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 three sentences, each earning its place: purpose, return metadata/benefit, and usage guidance. It is front-loaded and contains no filler.

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 no output schema and no annotations, the description covers the essential context: purpose, return value, and post-processing. It is slightly incomplete regarding file overwrite behavior, but otherwise adequate.

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 baseline is 3. The description adds no extra parameter-level detail beyond what the schema already states; it does not clarify pipeline format or output_path handling.

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 clearly states the action: running an aggregation pipeline and writing results to a JSON file. It distinguishes from the likely sibling tool run_aggregation by specifying that only metadata is returned, not the documents.

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

Usage Guidelines4/5

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

It strongly implies when to use this tool (to avoid loading large result sets into context) and recommends CLI tools for inspecting the output. However, it does not explicitly name the alternative run_aggregation or state when not to use this tool.

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/Sanjeev4523/mongo-mcp'

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