Skip to main content
Glama
mongodb-js

MongoDB MCP Server

Official
by mongodb-js

connect

Read-only

Establish a connection to a MongoDB cluster by providing a valid connection string in mongodb:// or mongodb+srv:// format.

Instructions

Connect to a MongoDB instance. The config resource captures if the server is already connected to a MongoDB cluster. If the user has configured a connection string or has previously called the connect tool, a connection is already established and there's no need to call this tool unless the user has explicitly requested to switch to a new MongoDB cluster.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
connectionStringYesMongoDB connection string (in the mongodb:// or mongodb+srv:// format)

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
connectedYes
Behavior1/5

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

Description indicates a mutation (connect), but annotations set readOnlyHint=true. This is a direct contradiction. Description does not resolve the inconsistency or disclose behavioral traits beyond the contradictory annotation.

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?

Two sentences, front-loaded with main action, no wasted words. Each sentence adds value.

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

Completeness3/5

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

Given one parameter and output schema, the description explains when to call well. However, the contradictory annotation undermines completeness, and the description omits what happens if called when already connected (e.g., error or switch). Not fully complete.

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 has 100% coverage with clear description of the parameter. The description adds no additional meaning to the parameter beyond what the schema provides, so 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 clearly states 'Connect to a MongoDB instance' with a specific verb and resource. It distinguishes from siblings like 'atlas-connect-cluster' by explaining when a connection is already established.

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

Usage Guidelines5/5

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

Explicitly states when not to call the tool (if already connected via config or previous call) and when to use (user explicitly requests new cluster). Provides clear context for usage.

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