Skip to main content
Glama
chzkyy

mcp-mongodb

by chzkyy

update_one

Update the first MongoDB document matching a filter using operators like $set or $inc. Specify collection, optional database, and upsert to insert if no match.

Instructions

Perbarui DOKUMEN PERTAMA yang cocok dengan filter menggunakan operator update.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
filterNoQuery filter MongoDB. Contoh: {"status": "aktif", "umur": {"$gt": 25}}. Kirim sebagai objek atau string JSON. Gunakan {} untuk semua dokumen.
updateNoDokumen update MongoDB. Gunakan operator seperti {"$set": {"umur": 31}} atau {"$inc": {"counter": 1}}. Tanpa operator akan otomatis dibungkus "$set".
upsertNoJika true, dokumen baru dibuat bila tidak ada yang cocok dengan filter (default false).
databaseNoNama database tujuan. Opsional jika MONGODB_DB sudah diatur.
collectionYesNama koleksi.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

A3.9/5.0
Behavior3/5

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

No annotations are provided, so the description carries the full burden. It discloses the key side effect (updates one document, not all) and the operator-based mutation style. However, it does not describe behavior when no document matches, upsert implications, or the return value.

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, front-loaded sentence with no filler. Every word contributes the operation, cardinality, and update mode. Unnecessary repetition is absent.

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?

For a 5-parameter mutation tool with no annotations and no output schema, the description conveys the core operation economically, and the schema fills in parameter details. The missing return-value and no-match context is a moderate gap, but an agent still has enough to call it correctly.

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?

The input schema already has 100% description coverage, including detailed examples for filter and update, upsert defaults, and database fallback. The description itself adds no parameter-level meaning, so the baseline of 3 applies.

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?

States clearly that it updates the FIRST document matching the filter, using an update operator. The word 'PERTAMA' distinguishes it from update_many, and 'menggunakan operator update' separates it from replace_one.

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 phrase 'DOKUMEN PERTAMA yang cocok dengan filter' gives clear context: use when only the first matching document should be changed. It does not explicitly mention when to prefer update_many or replace_one, so it lacks explicit exclusions.

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