cfg_commit
Replace a full config record with drift-guarded, versioned commits: read the live record first, edit it, then pass its oid to prevent overwriting newer changes; use dry_run to preview.
Instructions
Replace a record with a full document (drift-guarded, versioned). Read it first with cfg_show ref="=live", edit that doc, and pass its oid as expected_live_oid. dry_run=true returns state="would_commit" with the field-level delta (on a branch: against the branch's current draft), the records and code that reference this record, and writes nothing.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"record": "<record>",
"doc_json": "<doc_json>",
"message": "<message>",
"expected_live_oid": "<expected_live_oid>"
},
"name": "cfg_commit"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| env | No | Environment name from .cfg.toml (e.g. dev, prod). Selects the target database. | dev |
| author | No | Author attribution hint. Ignored/rejected in authenticated/enforced identity modes where a verified identity is required. | |
| branch | No | Commit to this branch instead of main (branch commit; does not mutate runtime). | |
| record | Yes | Record address as collection:id, e.g. agent_configs:refund_resolution. | |
| dry_run | No | Preview the change and return the would-be result without writing anything. | |
| message | Yes | Why you are making this change (stored in history). | |
| doc_json | Yes | The FULL document (object or JSON string): commit replaces the whole record. Start from cfg_show ref="=live" (Extended JSON) and edit that. For a partial edit use cfg_set. | |
| config_file | No | Omit: the server uses the .cfg.toml it started with. A different path is refused unless the server runs with CFGIT_MCP_ALLOW_CONFIG_OVERRIDE=1. | |
| no_validate | No | Skip the collection validator for an emergency write (recorded in history). Off by default. | |
| allow_secret | No | Allow committing values that match secret-deny rules (logged). Off by default. | |
| allow_type_change | No | Allow replacing a live datetime/decimal/ObjectId with a different type, e.g. an ISO string (logged). Off by default; send dates as {"$date": ...} instead. | |
| expected_live_oid | Yes | `oid` from the cfg_show ref="=live" you edited. If live changed since, the commit refuses with stale_base instead of overwriting the newer change. Required; pass null only when you deliberately overwrite without reading. | |
| allow_remove_fields | No | Allow the commit to delete top-level fields live has but doc_json leaves out. Off by default: a partial doc is refused with state fields_removed. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||