A few days ago I fixed update_article, one of the tools in this repo's MCP server, because it had a nasty shape: it took a bare integer article_id, PUT whatever fields you gave it straight to the DEV.to API, and if the id was wrong or hallucinated, it would silently overwrite a live published post with nothing left behind to show it had happened. The fix added a fetch-before-write diff and a JSONL audit log:

_ARTICLE_UPDATE_LOG = "logs/article_updates.jsonl"

def _log_article_update(article_id, before, fields_changed, after):

os.makedirs(os.path.dirname(_ARTICLE_UPDATE_LOG), exist_ok=True)

entry = {"article_id": article_id, "fields_changed": sorted(fields_changed), "url": after.get("url")}