# MongoDB Connector

## Links

- Product page URL: https://www.agentpmt.com/marketplace/mongodb-connector
- Product markdown URL: https://www.agentpmt.com/marketplace/mongodb-connector?format=agent-md
- Product JSON URL: https://www.agentpmt.com/marketplace/mongodb-connector?format=agent-json

## Overview

- Product ID: 69c56fd1fd4227d57ee069c6
- Type: connector
- Unit type: request
- Price: 500 credits
- Categories: Data Science, Developer Tools, Data Storage & Persistence, Vector Search & Embeddings, Data Processing, Data Validation & Verification, Data Formatting & Conversion
- Generated at: 2026-06-25T09:36:14.549Z

### Page Description

Connect your own MongoDB database and query, insert, update, delete, and aggregate documents without leaving your workflow. Browse databases and collections, inspect indexes, and run full aggregation pipelines including joins, grouping, and windowed analytics. Create and manage Atlas Search indexes for full-text search and Atlas Vector Search indexes for semantic similarity and RAG applications. Export query results as downloadable CSV or JSON files for use in spreadsheets, dashboards, or data pipelines. Execute atomic find-and-modify operations and batch mixed writes in a single round trip with bulk_write. Manage collection lifecycles with create, drop, and schema validation. Access is fully permission-gated with four levels — read, write, delete, and admin — so you stay in control of what agents can do with your data. Works with MongoDB Atlas and any cloud-hosted or publicly accessible MongoDB instance.

### Agent Description

Connect to a user's cloud-hosted MongoDB instance and run 24 permission-gated database operations. Read: find with filter/projection/sort/pagination, count, estimated_count, list databases and collections, aggregation pipelines (including $search, $vectorSearch, $geoNear, $lookup, $graphLookup), distinct values, list indexes, list search indexes. Write: insert (single and bulk), update (one or many with upsert), replace, find_one_and_update (atomic), bulk_write (mixed batch operations). Delete: delete (one or many), find_one_and_delete (atomic). Admin: create/drop standard indexes (single, compound, text, geospatial, hashed, wildcard), create/update/drop Atlas Search and Vector Search indexes, create/drop collections with schema validation, run arbitrary database commands (dbStats, collStats, serverStatus). Query results from find and aggregate can be exported as CSV or JSON files. Permissions array controls access: read (default), write, delete, admin.

## Details

### Details

Connect your own MongoDB database and query, insert, update, delete, and aggregate documents without leaving your workflow. Browse databases and collections, inspect indexes, and run full aggregation pipelines including joins, grouping, and windowed analytics. Create and manage Atlas Search indexes for full-text search and Atlas Vector Search indexes for semantic similarity and RAG applications. Export query results as downloadable CSV or JSON files for use in spreadsheets, dashboards, or data pipelines. Execute atomic find-and-modify operations and batch mixed writes in a single round trip with bulk_write. Manage collection lifecycles with create, drop, and schema validation. Access is fully permission-gated with four levels — read, write, delete, and admin — so you stay in control of what agents can do with your data. Works with MongoDB Atlas and any cloud-hosted or publicly accessible MongoDB instance.

### Actions

- `find_documents` (5 credits): Query documents with filter, projection, sort, and pagination. Supports CSV/JSON export.
- `count_documents` (5 credits): Count documents matching a filter
- `estimated_count` (5 credits): Fast approximate document count using collection metadata
- `list_databases` (5 credits): List all accessible databases
- `list_collections` (5 credits): List collections in a database
- `aggregate` (5 credits): Run an aggregation pipeline. Supports $search, $vectorSearch, $geoNear, $lookup, CSV/JSON export.
- `distinct` (5 credits): Get distinct values for a field
- `list_indexes` (5 credits): List all indexes on a collection
- `list_search_indexes` (5 credits): List Atlas Search and Vector Search indexes
- `insert_documents` (5 credits): Insert one or more documents
- `update_documents` (5 credits): Update one or many documents
- `replace_document` (5 credits): Replace a single document
- `find_one_and_update` (5 credits): Atomically find and update a document, returning it
- `find_one_and_delete` (5 credits): Atomically find and delete a document, returning it
- `bulk_write` (5 credits): Execute mixed batch of insert, update, replace, and delete operations
- `delete_documents` (5 credits): Delete one or many documents
- `create_index` (5 credits): Create an index (single, compound, text, geospatial, hashed, wildcard)
- `drop_index` (5 credits): Drop an index from a collection
- `create_search_index` (5 credits): Create an Atlas Search or Vector Search index
- `update_search_index` (5 credits): Update an Atlas Search or Vector Search index definition
- `drop_search_index` (5 credits): Drop an Atlas Search or Vector Search index
- `create_collection` (5 credits): Create a collection with optional schema validation, capping, or time series config
- `drop_collection` (5 credits): Drop a collection
- `run_command` (5 credits): Run any MongoDB database command (dbStats, collStats, serverStatus, etc.)

### Use Cases

Query MongoDB collections, Export data as CSV or JSON, Run aggregation pipelines, Atlas Vector Search for RAG, Full-text search with Atlas Search, Insert and update documents, Bulk write operations, Manage indexes, Create vector search indexes, Geospatial queries, Schema validation, Database administration

### Workflows Using This Tool

No public workflows currently reference this product.

### Related Content

#### MongoDB Connector: AI Infrastructure for Database Agents

- Type: article
- Page URL: https://www.agentpmt.com/articles/mongodb-connector-ai-infrastructure-for-database-agents
- Markdown URL: https://www.agentpmt.com/articles/mongodb-connector-ai-infrastructure-for-database-agents?format=agent-md
AgentPMT launches the MongoDB Connector, a 25-action tool that gives autonomous AI agents direct, authenticated access to MongoDB databases -- including queries, aggregations, vector search, index management, and bulk operations -- at 5 credits per call.

## Integration Details

### DynamicMCP

- Setup page URL: https://www.agentpmt.com/dynamic-mcp
- Claude setup guide: https://www.agentpmt.com/dynamic-mcp#platform=claude
- ChatGPT setup guide: https://www.agentpmt.com/dynamic-mcp#platform=chatgpt
- Cursor setup guide: https://www.agentpmt.com/dynamic-mcp#platform=cursor
- Windsurf setup guide: https://www.agentpmt.com/dynamic-mcp#platform=windsurf

Use the local router for command-based MCP clients. It forwards requests to `https://api.agentpmt.com/mcp` and does not execute tools locally.

```bash
npm install -g @agentpmt/mcp-router
agentpmt-setup
```

### REST API

The live page renders cURL, Python, JavaScript, and Node.js examples. Logged-in users see those examples prefilled with their own API and budget credentials.

- Purchase endpoint: https://api.agentpmt.com/products/purchase
- Authorization format: `Bearer <base64(apiKey:budgetKey)>`

```bash
curl -X POST "https://api.agentpmt.com/products/purchase" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer eW91ci1hcGkta2V5LWhlcmU6eW91ci1idWRnZXQta2V5LWhlcmU=" \
  -d '{
    "product_id": "69c56fd1fd4227d57ee069c6",
    "parameters": {
      "action": "find_documents",
      "database": "example_database",
      "collection": "example_collection"
    }
  }'
```

### Autonomous Agents

Autonomous agents can access this tool through AgentAddress credit balances or direct x402 payments. Use the Autonomous Agent API reference for endpoint shapes after choosing the access pattern below.

- Autonomous Agent API reference URL: https://www.agentpmt.com/docs/api-reference/autonomous-agents
- Autonomous Agent API reference markdown URL: https://www.agentpmt.com/docs/api-reference/autonomous-agents?format=agent-md
- Credit-Based Access Using AgentAddress: https://www.agentpmt.com/docs/autonomous-agents/credit-based-tool-usage-with-agentaddress
- AgentAddress is preferred for persistent file access, stored platform state, and maximum tool use ability across repeated calls.
- Direct x402 is for independent one-off tool calls that do not require shared files or stored platform state.
- Direct x402 public payments: USDC on Base, Arbitrum, Optimism, Polygon, and Avalanche.

#### Product Skill Package

This product has a published Agent Skill package for product-specific operating instructions.

- Skill slug: mongodb-connector
- Version: 1.0.0
- Download SKILL.md: https://raw.githubusercontent.com/AgentPMT/agent-skills/main/skills/mongodb-connector/SKILL.md
- Package source: https://github.com/AgentPMT/agent-skills/tree/main/skills/mongodb-connector
- OpenClaw listing: https://clawhub.ai/agentpmt/mongodb-connector
- OpenClaw install: `openclaw skills install mongodb-connector`
- skills.sh install: `npx skills add AgentPMT/agent-skills --skill mongodb-connector`
- Last published: 2026-06-09T21:25:45.837Z

### Schema

#### Credentials

These runtime credentials should be provided under `parameters._credentials` when required.

- MongoDB Connection String (`mongodb_connection_string`, connection_string, required)
  Help: Your MongoDB connection string (e.g. mongodb+srv://user:pass@cluster.mongodb.net/)
  Connection ID: 69c574e682b13902b7e4c261
- MongoDB permission scopes (`permissions`, other, required)
  Help: Select every scope the agent should have. If none selected, agent gets read-only access.
  Connection ID: 69c574e682b13902b7e4c261
- Allowed Database Names (`allowed_databases`, other, required)
  Help: Comma-separated list of database names the agent can access (e.g. mydb, analytics, staging). If left blank, all databases are accessible.
  Connection ID: 69c574e682b13902b7e4c261

#### Parameters

- Schema type: actions

```json
{
  "actions": {
    "find_documents": {
      "description": "Query documents with filter, projection, sort, and pagination. Supports CSV/JSON export.",
      "properties": {
        "database": {
          "type": "string",
          "description": "Database name",
          "required": true
        },
        "collection": {
          "type": "string",
          "description": "Collection name",
          "required": true
        },
        "filter": {
          "type": "object",
          "description": "MongoDB query filter",
          "required": false
        },
        "projection": {
          "type": "object",
          "description": "Fields to include/exclude",
          "required": false
        },
        "sort": {
          "type": "array",
          "description": "Sort as [[field, direction]] (1=asc, -1=desc)",
          "required": false,
          "items": {
            "type": "array"
          }
        },
        "limit": {
          "type": "integer",
          "description": "Max documents (1-1000, default 20)",
          "required": false
        },
        "skip": {
          "type": "integer",
          "description": "Documents to skip",
          "required": false
        },
        "output": {
          "type": "array",
          "description": "Output modes: inline, export, or both",
          "required": false,
          "items": {
            "type": "string",
            "enum": [
              "inline",
              "export"
            ]
          }
        },
        "export_format": {
          "type": "string",
          "description": "Export file format",
          "required": false,
          "enum": [
            "json",
            "csv"
          ]
        }
      }
    },
    "count_documents": {
      "description": "Count documents matching a filter",
      "properties": {
        "database": {
          "type": "string",
          "description": "Database name",
          "required": true
        },
        "collection": {
          "type": "string",
          "description": "Collection name",
          "required": true
        },
        "filter": {
          "type": "object",
          "description": "MongoDB query filter",
          "required": false
        }
      }
    },
    "estimated_count": {
      "description": "Fast approximate document count using collection metadata",
      "properties": {
        "database": {
          "type": "string",
          "description": "Database name",
          "required": true
        },
        "collection": {
          "type": "string",
          "description": "Collection name",
          "required": true
        }
      }
    },
    "list_databases": {
      "description": "List all accessible databases"
    },
    "list_collections": {
      "description": "List collections in a database",
      "properties": {
        "database": {
          "type": "string",
          "description": "Database name",
          "required": true
        }
      }
    },
    "aggregate": {
      "description": "Run an aggregation pipeline. Supports $search, $vectorSearch, $geoNear, $lookup, CSV/JSON export.",
      "properties": {
        "database": {
          "type": "string",
          "description": "Database name",
          "required": true
        },
        "collection": {
          "type": "string",
          "description": "Collection name",
          "required": true
        },
        "pipeline": {
          "type": "array",
          "description": "Aggregation pipeline stages",
          "required": true,
          "items": {
            "type": "object"
          }
        },
        "output": {
          "type": "array",
          "description": "Output modes",
          "required": false,
          "items": {
            "type": "string",
            "enum": [
              "inline",
              "export"
            ]
          }
        },
        "export_format": {
          "type": "string",
          "description": "Export file format",
          "required": false,
          "enum": [
            "json",
            "csv"
          ]
        }
      }
    },
    "distinct": {
      "description": "Get distinct values for a field",
      "properties": {
        "database": {
          "type": "string",
          "description": "Database name",
          "required": true
        },
        "collection": {
          "type": "string",
          "description": "Collection name",
          "required": true
        },
        "field_name": {
          "type": "string",
          "description": "Field name",
          "required": true
        },
        "filter": {
          "type": "object",
          "description": "MongoDB query filter",
          "required": false
        }
      }
    },
    "list_indexes": {
      "description": "List all indexes on a collection",
      "properties": {
        "database": {
          "type": "string",
          "description": "Database name",
          "required": true
        },
        "collection": {
          "type": "string",
          "description": "Collection name",
          "required": true
        }
      }
    },
    "list_search_indexes": {
      "description": "List Atlas Search and Vector Search indexes",
      "properties": {
        "database": {
          "type": "string",
          "description": "Database name",
          "required": true
        },
        "collection": {
          "type": "string",
          "description": "Collection name",
          "required": true
        }
      }
    },
    "insert_documents": {
      "description": "Insert one or more documents",
      "properties": {
        "database": {
          "type": "string",
          "description": "Database name",
          "required": true
        },
        "collection": {
          "type": "string",
          "description": "Collection name",
          "required": true
        },
        "document": {
          "type": "object",
          "description": "Single document to insert",
          "required": false
        },
        "documents": {
          "type": "array",
          "description": "Multiple documents to insert",
          "required": false,
          "items": {
            "type": "object"
          }
        }
      }
    },
    "update_documents": {
      "description": "Update one or many documents",
      "properties": {
        "database": {
          "type": "string",
          "description": "Database name",
          "required": true
        },
        "collection": {
          "type": "string",
          "description": "Collection name",
          "required": true
        },
        "filter": {
          "type": "object",
          "description": "Match filter",
          "required": false
        },
        "update": {
          "type": "object",
          "description": "Update operations ($set, $inc, etc.)",
          "required": true
        },
        "upsert": {
          "type": "boolean",
          "description": "Create if no match",
          "required": false
        },
        "many": {
          "type": "boolean",
          "description": "Update all matches (default: false)",
          "required": false
        }
      }
    },
    "replace_document": {
      "description": "Replace a single document",
      "properties": {
        "database": {
          "type": "string",
          "description": "Database name",
          "required": true
        },
        "collection": {
          "type": "string",
          "description": "Collection name",
          "required": true
        },
        "filter": {
          "type": "object",
          "description": "Match filter",
          "required": false
        },
        "document": {
          "type": "object",
          "description": "Replacement document",
          "required": true
        },
        "upsert": {
          "type": "boolean",
          "description": "Create if no match",
          "required": false
        }
      }
    },
    "find_one_and_update": {
      "description": "Atomically find and update a document, returning it",
      "properties": {
        "database": {
          "type": "string",
          "description": "Database name",
          "required": true
        },
        "collection": {
          "type": "string",
          "description": "Collection name",
          "required": true
        },
        "filter": {
          "type": "object",
          "description": "Match filter",
          "required": false
        },
        "update": {
          "type": "object",
          "description": "Update operations",
          "required": true
        },
        "projection": {
          "type": "object",
          "description": "Fields to return",
          "required": false
        },
        "sort": {
          "type": "array",
          "description": "Sort to determine which doc",
          "required": false,
          "items": {
            "type": "array"
          }
        },
        "upsert": {
          "type": "boolean",
          "description": "Create if no match",
          "required": false
        },
        "return_document": {
          "type": "string",
          "description": "Return doc before or after update",
          "required": false,
          "enum": [
            "before",
            "after"
          ]
        }
      }
    },
    "find_one_and_delete": {
      "description": "Atomically find and delete a document, returning it",
      "properties": {
        "database": {
          "type": "string",
          "description": "Database name",
          "required": true
        },
        "collection": {
          "type": "string",
          "description": "Collection name",
          "required": true
        },
        "filter": {
          "type": "object",
          "description": "Match filter",
          "required": false
        },
        "projection": {
          "type": "object",
          "description": "Fields to return",
          "required": false
        },
        "sort": {
          "type": "array",
          "description": "Sort to determine which doc",
          "required": false,
          "items": {
            "type": "array"
          }
        }
      }
    },
    "bulk_write": {
      "description": "Execute mixed batch of insert, update, replace, and delete operations",
      "properties": {
        "database": {
          "type": "string",
          "description": "Database name",
          "required": true
        },
        "collection": {
          "type": "string",
          "description": "Collection name",
          "required": true
        },
        "operations": {
          "type": "array",
          "description": "Operations: [{operation: insert_one|update_one|update_many|replace_one|delete_one|delete_many, ...params}]",
          "required": true,
          "items": {
            "type": "object"
          }
        }
      }
    },
    "delete_documents": {
      "description": "Delete one or many documents",
      "properties": {
        "database": {
          "type": "string",
          "description": "Database name",
          "required": true
        },
        "collection": {
          "type": "string",
          "description": "Collection name",
          "required": true
        },
        "filter": {
          "type": "object",
          "description": "Match filter",
          "required": false
        },
        "many": {
          "type": "boolean",
          "description": "Delete all matches (default: false)",
          "required": false
        }
      }
    },
    "create_index": {
      "description": "Create an index (single, compound, text, geospatial, hashed, wildcard)",
      "properties": {
        "database": {
          "type": "string",
          "description": "Database name",
          "required": true
        },
        "collection": {
          "type": "string",
          "description": "Collection name",
          "required": true
        },
        "index_keys": {
          "type": "array",
          "description": "Index keys [[field, 1/-1]]",
          "required": true,
          "items": {
            "type": "array"
          }
        },
        "index_name": {
          "type": "string",
          "description": "Index name",
          "required": false
        },
        "index_options": {
          "type": "object",
          "description": "Options (unique, sparse, TTL, partial, etc.)",
          "required": false
        }
      }
    },
    "drop_index": {
      "description": "Drop an index from a collection",
      "properties": {
        "database": {
          "type": "string",
          "description": "Database name",
          "required": true
        },
        "collection": {
          "type": "string",
          "description": "Collection name",
          "required": true
        },
        "index_name": {
          "type": "string",
          "description": "Index name to drop",
          "required": true
        }
      }
    },
    "create_search_index": {
      "description": "Create an Atlas Search or Vector Search index",
      "properties": {
        "database": {
          "type": "string",
          "description": "Database name",
          "required": true
        },
        "collection": {
          "type": "string",
          "description": "Collection name",
          "required": true
        },
        "search_index_definition": {
          "type": "object",
          "description": "Search index definition (mappings or vector fields)",
          "required": true
        },
        "index_name": {
          "type": "string",
          "description": "Index name",
          "required": false
        },
        "search_index_type": {
          "type": "string",
          "description": "Index type (default: search)",
          "required": false,
          "enum": [
            "search",
            "vectorSearch"
          ]
        }
      }
    },
    "update_search_index": {
      "description": "Update an Atlas Search or Vector Search index definition",
      "properties": {
        "database": {
          "type": "string",
          "description": "Database name",
          "required": true
        },
        "collection": {
          "type": "string",
          "description": "Collection name",
          "required": true
        },
        "index_name": {
          "type": "string",
          "description": "Index name to update",
          "required": true
        },
        "search_index_definition": {
          "type": "object",
          "description": "New index definition",
          "required": true
        }
      }
    },
    "drop_search_index": {
      "description": "Drop an Atlas Search or Vector Search index",
      "properties": {
        "database": {
          "type": "string",
          "description": "Database name",
          "required": true
        },
        "collection": {
          "type": "string",
          "description": "Collection name",
          "required": true
        },
        "index_name": {
          "type": "string",
          "description": "Index name to drop",
          "required": true
        }
      }
    },
    "create_collection": {
      "description": "Create a collection with optional schema validation, capping, or time series config",
      "properties": {
        "database": {
          "type": "string",
          "description": "Database name",
          "required": true
        },
        "collection": {
          "type": "string",
          "description": "Collection name",
          "required": true
        },
        "collection_options": {
          "type": "object",
          "description": "Options: validator, capped, timeseries, collation, etc.",
          "required": false
        }
      }
    },
    "drop_collection": {
      "description": "Drop a collection",
      "properties": {
        "database": {
          "type": "string",
          "description": "Database name",
          "required": true
        },
        "collection": {
          "type": "string",
          "description": "Collection name",
          "required": true
        }
      }
    },
    "run_command": {
      "description": "Run any MongoDB database command (dbStats, collStats, serverStatus, etc.)",
      "properties": {
        "database": {
          "type": "string",
          "description": "Database name",
          "required": true
        },
        "command": {
          "type": "object",
          "description": "MongoDB command document",
          "required": true
        }
      }
    }
  }
}
```

### Usage Instructions

# MongoDB

Connect to a cloud-hosted MongoDB database and run queries, inserts, updates, deletes, aggregations, index management, Atlas Search, and Vector Search. Export results as CSV or JSON files. Supports MongoDB Atlas and any publicly accessible MongoDB instance.

## Permissions

Access is controlled by a `permissions` array injected by the platform:
- `read` (default if omitted): find, count, list, aggregate, distinct
- `write`: insert, update, replace, find_one_and_update, bulk_write
- `delete`: delete documents, find_one_and_delete
- `admin`: indexes, search indexes, create/drop collection, run_command

## Output Modes

`find_documents` and `aggregate` support an `output` array:
- `["inline"]` (default): return documents in the response
- `["export"]`: save results as a file (CSV or JSON)
- `["inline", "export"]`: both

Use `export_format` to choose `csv` or `json` (default: `json`).

## Read Actions

### `find_documents`
Required: `database`, `collection`
Optional: `filter`, `projection`, `sort` ([[field, 1/-1]]), `limit` (1-1000, default 20), `skip`, `output`, `export_format`

Example: `{"action":"find_documents","database":"mydb","collection":"users","filter":{"status":"active"},"limit":10}`

### `count_documents`
Required: `database`, `collection`
Optional: `filter`

### `estimated_count`
Required: `database`, `collection`
Fast approximate count using collection metadata (no filter support).

### `list_databases`
No required params.

### `list_collections`
Required: `database`

### `aggregate`
Required: `database`, `collection`, `pipeline`
Optional: `output`, `export_format`

Supports all pipeline stages including `$search`, `$vectorSearch`, `$geoNear`, `$lookup`, `$graphLookup`, `$sample`.

Example: `{"action":"aggregate","database":"mydb","collection":"orders","pipeline":[{"$group":{"_id":"$status","count":{"$sum":1}}}]}`

Vector search example: `{"action":"aggregate","database":"mydb","collection":"docs","pipeline":[{"$vectorSearch":{"index":"vector_idx","path":"embedding","queryVector":[0.1,0.2,...],"numCandidates":100,"limit":10}}]}`

### `distinct`
Required: `database`, `collection`, `field_name`
Optional: `filter`

### `list_indexes`
Required: `database`, `collection`
Returns all indexes on a collection with key specs, options, and names.

### `list_search_indexes`
Required: `database`, `collection`
Returns Atlas Search and Vector Search indexes.

## Write Actions

### `insert_documents`
Required: `database`, `collection`, `document` (single) or `documents` (array)

### `update_documents`
Required: `database`, `collection`, `update`
Optional: `filter`, `upsert`, `many` (default false)

### `replace_document`
Required: `database`, `collection`, `document`
Optional: `filter`, `upsert`

### `find_one_and_update`
Atomically find and update a document, returning it.
Required: `database`, `collection`, `update`
Optional: `filter`, `projection`, `sort`, `upsert`, `return_document` ("before" or "after", default "before")

### `find_one_and_delete`
Atomically find and delete a document, returning it.
Required: `database`, `collection`
Optional: `filter`, `projection`, `sort`

### `bulk_write`
Execute mixed batch operations in a single round trip.
Required: `database`, `collection`, `operations`

Each operation: `{"operation": "insert_one|update_one|update_many|replace_one|delete_one|delete_many", ...params}`

Example: `{"action":"bulk_write","database":"mydb","collection":"users","operations":[{"operation":"insert_one","document":{"name":"Alice"}},{"operation":"update_one","filter":{"name":"Bob"},"update":{"$set":{"active":true}}}]}`

## Delete Actions

### `delete_documents`
Required: `database`, `collection`
Optional: `filter`, `many` (default false)

## Admin Actions

### `create_index`
Required: `database`, `collection`, `index_keys`
Optional: `index_name`, `index_options`

Supports all index types: single field, compound, text (`[["field","text"]]`), geospatial (`[["location","2dsphere"]]`), hashed, wildcard.

### `drop_index`
Required: `database`, `collection`, `index_name`

### `create_search_index`
Create an Atlas Search or Vector Search index.
Required: `database`, `collection`, `search_index_definition`
Optional: `index_name`, `search_index_type` ("search" or "vectorSearch")

Vector index example: `{"action":"create_search_index","database":"mydb","collection":"docs","search_index_type":"vectorSearch","index_name":"vec_idx","search_index_definition":{"fields":[{"type":"vector","path":"embedding","numDimensions":1536,"similarity":"cosine"}]}}`

### `update_search_index`
Required: `database`, `collection`, `index_name`, `search_index_definition`

### `drop_search_index`
Required: `database`, `collection`, `index_name`

### `create_collection`
Required: `database`, `collection`
Optional: `collection_options` (validator, capped, timeseries, clusteredIndex, collation, expireAfterSeconds)

### `drop_collection`
Required: `database`, `collection`

### `run_command`
Run any MongoDB database command.
Required: `database`, `command`

Example: `{"action":"run_command","database":"mydb","command":{"dbStats":1}}`
Example: `{"action":"run_command","database":"mydb","command":{"collStats":"users"}}`

## Notes
- Filters use standard MongoDB query syntax: $eq, $gt, $lt, $in, $regex, $near, $geoWithin, etc.
- Updates use $set, $unset, $inc, $push, $pull, etc.
- Sort uses 1 for ascending, -1 for descending
- Aggregation pipelines with $out or $merge require write permission
- Max 1000 documents returned per find or aggregate call
- Atlas Search and Vector Search require search indexes (use create_search_index)
- Geospatial queries require 2dsphere or 2d indexes (use create_index)

### Frequently Asked Questions

#### How do I connect this tool to an external agent?

- Page URL: https://www.agentpmt.com/faq
- Markdown URL: https://www.agentpmt.com/faq?format=agent-md

You can install the local MCP server by opening a terminal and running:

```
npm install -g @agentpmt/mcp-router
agentpmt-setup
```

This will connect you to local agents like Claude Code, Windsurf, Grok Build, Cursor, etc.

Alternatively you can connect to the hosted version with this config block, no installation required:

```
{
  "mcpServers": {
    "agentpmt": {
      "type": "streamable-http",
      "url": "https://api.agentpmt.com/mcp",
      "headers": {
        "Authorization": "Bearer <AGENTPMT_BEARER_TOKEN>",
        "x-instance-metadata": "{\"client\":\"generic-mcp\",\"platform\":\"remote\"}"
      }
    }
  }
}
```

[View MCP Connection Instructions](/docs/mcp-reference/connection) for more details.

#### How does an external agent use this tool?

- Page URL: https://www.agentpmt.com/faq
- Markdown URL: https://www.agentpmt.com/faq?format=agent-md

After the external agent is connected to an Agent Group that can use this tool, paste this prompt into the agent:

> Use the AgentPMT-Tool-Search-and-Execution tool. First call action 'get\_instructions' so you know how to use the tool search interface. Then call action 'get\_schema' with tool\_id 69c56fd1fd4227d57ee069c6 ("MongoDB Connector"). After reading the schema and any returned instructions, tell me what this tool can do, we are going to be using it

The agent should fetch the tool schema first, collect the required parameters for your request, and then call the tool through AgentPMT.

### Dependencies

This product has no public dependency products.