Overview
MongoDB tool allows you to query and manage MongoDB NoSQL databases directly from your AI agents.Installation
Environment Variables
Quick Start
1
Simple Usage
2
With Configuration
Use the same tool with an agent — see Usage with Agent below, or pass env vars and options from the sections above.
How It Works
Usage with Agent
Available Methods
find(collection, query, limit=10)
Find documents matching a query.insert(collection, document)
Insert a document.update(collection, query, update)
Update documents.delete(collection, query)
Delete documents.list_collections()
List all collections.Docker Setup
Common Errors
Best Practices
Load the connection URI from the environment
Load the connection URI from the environment
Read
MONGODB_URI from the environment instead of hard-coding credentials in the connection string.Cap query results
Cap query results
find(collection, query, limit=10) defaults to 10 documents. Keep the limit low so large collections do not flood the agent’s context.Scope agent access
Scope agent access
Give the agent a database user with only the permissions it needs. Read-only credentials prevent accidental writes from generated queries.
Related Tools
PostgreSQL
SQL database
Redis
Key-value store
DynamoDB
AWS NoSQL

