Skip to main content
Glama
shibbirweb

mcp-db-read-only

by shibbirweb

Run Aggregation Pipeline

aggregate
Read-onlyIdempotent

Run read-only MongoDB aggregation pipelines to analyze and transform data without modifying the database.

Instructions

Run a read-only MongoDB aggregation pipeline on a collection ($out and $merge are not allowed)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
databaseNoOptional database to read from for this call only, without changing the active connection
pipelineYesPipeline stages as Extended JSON, e.g. [{"$match": {"status": "active"}}, {"$group": {"_id": "$type", "n": {"$sum": 1}}}]
collectionYesCollection name

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true, idempotentHint=true, and destructiveHint=false. The description adds value by explicitly forbidding $out and $merge, which are the two aggregation stages that would violate the read-only contract. This is meaningful behavioral context beyond the annotations. It doesn't mention performance implications or result size limits, but the core safety-relevant behavior is well covered.

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?

A single sentence that front-loads the core purpose ('read-only MongoDB aggregation pipeline') and immediately states the critical constraint. Every word earns its place; no filler or repetition of schema details.

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?

For a read-only tool with full schema coverage and strong annotations, the description is nearly complete. The main gap is that it doesn't mention what the return value looks like (e.g., array of documents) or any limits on result size, but since there's no output schema and the tool is read-only, these are minor omissions. The $out/$merge exclusion is the most important contextual detail and it's present.

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 already documents all three parameters. The description adds the read-only constraint and the $out/$merge exclusion, which helps the agent understand what pipeline stages are acceptable, but it doesn't add parameter-level detail beyond what the schema provides. Baseline 3 is appropriate.

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 states a specific verb ('Run'), a specific resource ('a read-only MongoDB aggregation pipeline on a collection'), and explicitly excludes $out and $merge stages. This clearly distinguishes it from sibling tools like find_documents, run_query, and count_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?

The description clearly indicates this is for aggregation pipelines, and the read-only constraint plus the $out/$merge exclusion gives implicit guidance on when not to use it. However, it doesn't explicitly name alternative tools for non-aggregation operations or for write operations, so it falls just short of full explicit routing.

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