gtm-mcp
Run a local MCP server that lets an AI assistant inspect, audit, and safely modify Google Tag Manager containers through 34 tools using your own Google account.
Discover containers: List accounts and containers, resolve
GTM-…,G-…, orAW-…IDs, search by name, and inspect container details and workspace status.Inspect configurations: Read tags, triggers, variables, built-in variables, folders, templates, versions, the live version, and environments; use a restricted raw GET for resources without dedicated tools.
Audit tracking: Run a container health check for issues such as UA leftovers, duplicate Google tags, unused triggers, undefined variables, placeholders, GA4 naming problems, paused tags, and unpublished changes.
Check GA4 ecommerce coverage: See which standard ecommerce events are active, paused, or missing and which custom-event triggers already exist.
Edit draft workspaces: Create workspaces, tags, GA4 event tags, triggers, and variables; update or pause tags, enable built-ins, revert workspace changes, and generate a GA4 ecommerce tag/trigger setup.
Version and publish: Snapshot a workspace into a version and optionally publish it live; publishing requires write/publish authorization,
dry_run=false, and explicitconfirm=true, and returns the previous live version for rollback.Work safely: Every write defaults to a dry-run preview, reads never modify anything, no delete or user-management tools exist, and local audit logging plus rate limiting, caching, pagination, and retries help protect quota.
gtm_auth_statusreports the signed-in profile and session usage.
Provides tools for interacting with the Google Tag Manager API v2 to inspect accounts, containers, workspaces, tags, triggers, variables, versions, and environments; audit container health and GA4 ecommerce coverage; and create or update draft workspace entities, create versions, and publish versions with safety controls.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gtm-mcp Find container GTM-XXXXXXX and run a container audit."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
GTM MCP Server (gtm-mcp)
MCP server for Google Tag Manager. Runs on your own computer, talks to the
Tag Manager API v2 with your own Google account.
34 tools: 23 🟢 read/audit tools, 10 🟡 workspace-write tools (every one previews with dry_run=true first) and exactly
one 🔴 tool, gtm_publish_version. No delete and no user-management tools exist.
Sister project: GA4-MCP-Server (Google Analytics 4). Both servers share
the small Python library marketing-mcp-common (Google OAuth desktop flow, httpx client with retry + rate limiter, error
mapping, redaction, audit log), which lives in that repo under common/ and is installed automatically from a pinned tag
(see pyproject.toml). You can use the same Google Cloud OAuth client for both servers.
Status, scope decisions and log of this server: PROJECT.md; programme-wide conventions (risk tiers,
auth rules, access roles): GA4-MCP-Server/PROJECT.md.
1. Setup (one time)
1a. Owner: Google Cloud project
Open the Cloud project that holds your OAuth client (the ga4-mcp one works) → APIs & Services → Library → enable Tag Manager API.
Google Auth Platform → Data Access (Scopes) → add
https://www.googleapis.com/auth/tagmanager.readonly. Only if people will use the write tools, also addtagmanager.edit.containers,tagmanager.edit.containerversions,tagmanager.publish.The existing Desktop app OAuth client id/secret is reused — share it with the team through a password manager, never through chat.
1b. Everyone: install uv, sign in
# Windows (PowerShell)
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
# macOS / Linux
curl -LsSf https://astral.sh/uv/install.sh | sh# read-only profile (default — enough for audits, listing, coverage checks)
uvx --from "git+https://github.com/Mezbaul-Hasan/GTM-MCP-Server" gtm-mcp auth
# read + write + publish profile (only for people who will change containers)
uvx --from "git+https://github.com/Mezbaul-Hasan/GTM-MCP-Server" gtm-mcp auth --with-writesThe browser opens → sign in → the refresh token is saved to ~/.gtm-mcp/config.json (readable only by you).
gtm-mcp status shows the profile (read-only / read+write+publish); gtm-mcp logout revokes and deletes it.
Your Google account also needs a GTM role on the container (Read for 🟢, Edit for workspace writes, Approve/Publish for versions/publish) — the OAuth scope alone is not enough.
1c. Add to Claude Desktop / Cursor
{
"mcpServers": {
"gtm": {
"command": "uvx",
"args": ["--from", "git+https://github.com/Mezbaul-Hasan/GTM-MCP-Server", "gtm-mcp"]
}
}
}First prompt to try: "Find container GTM-XXXXXXX and run a container audit."
Related MCP server: gtm-ga4-mcp
2. Tools
Tool | Tier | What it does |
| 🟢 | accounts visible to the signed-in user |
| 🟢 | containers of one account, or of all accounts (≤10) |
| 🟢 | resolve |
| 🟢 | container details (public id, usage context, domains, linked tag ids) |
| 🟢 | draft workspaces |
| 🟢 | unpublished changes + merge conflicts |
| 🟢 | tags with type labels, paused flag, key parameters, trigger ids; full flattened parameters on get |
| 🟢 | triggers with one-line condition summaries |
| 🟢 | user-defined variables with summaries |
| 🟢 | enabled built-ins |
| 🟢 | folders, custom/gallery templates (code not returned) |
| 🟢 | version headers, one version, the live version (counts, tags by type, optional entity lists) |
| 🟢 | environments and the version each serves (preview auth codes stripped) |
| 🟢 | one-shot health check: UA leftovers, duplicate Google tags, dangling/unused triggers, undefined |
| 🟢 | matrix of the 11 GA4 ecommerce events: covered live / paused only / missing / no ecommerce data, existing custom-event triggers |
| 🟢 | GET any |
| 🟢 | signed-in profile, requests used this session, rate-limiter state — no API call |
| 🟡 | new draft workspace |
| 🟡 | any tag type from a flat |
| 🟡 | typed GA4 event tag ( |
| 🟡 | pause/unpause, rename, swap triggers, merge parameters — shows a before/after diff, sends the fingerprint |
| 🟡 | Custom Event trigger (equals / regex) or other types with filters |
| 🟡 | Data Layer variable, constant, or raw parameters for other types |
| 🟡 | enable built-ins by API type ( |
| 🟡 | undo this workspace's change to one entity (live container untouched) |
| 🟡 | workspace → version (not live); refuses on merge conflicts; warns that the workspace is consumed |
| 🟡 | recipe: plan/apply triggers + GA4 event tags for the missing ecommerce events (optionally the Google tag) |
| 🔴 | makes a version live — needs |
Every 🟡/🔴 tool defaults to dry_run=true and returns the exact {method, path, body} it would send plus warnings; call it again with dry_run=false to apply. The read-only profile can run all dry-runs — applying fails with a clear "run gtm-mcp auth --with-writes" message.
3. Quota — why the server is deliberately slow
Google allows 25 requests per 100 seconds and 10,000 per day per Cloud project (shared by everyone using the same OAuth client). gtm-mcp therefore:
waits in a client-side token bucket (0.25 req/s, burst 20) before every request —
GTM_MCP_RATE_LIMIT_QPSto tune;caches container lookups and the default workspace per process;
offers audit/coverage tools that read the whole workspace in a handful of requests instead of many single calls;
follows
nextPageTokenon all lists and retries 429/5xx with back-off.gtm_auth_statusshows how many requests the current session used.
4. Environment variables
Variable | Purpose |
| use these instead of |
| folder for |
| turn off the local audit log |
| client-side rate (default |
|
|
5. Development
git clone https://github.com/Mezbaul-Hasan/GTM-MCP-Server && cd GTM-MCP-Server
pip install -e ".[dev]" # also installs marketing-mcp-common from its pinned git tag
pytest -q # 40 tests, Tag Manager API fully mocked (respx) — no network
python server.py # or: mcp dev server.pyFacts the code relies on (endpoints, list keys, type codes, scopes, quota): docs/platform-notes/gtm.md.
Reference review that shaped the tool set: docs/platform-notes/gtm-reference-was-gtm-mcp.md.
To work on the shared library at the same time: clone GA4-MCP-Server next to this repo and pip install -e ../GA4-MCP-Server/common
(pip keeps the editable copy); bump the common-vX.Y.Z tag in pyproject.toml when a new library version is needed.
6. Safety model
Reads never modify anything;
gtm_raw_getis GET-only and limited totagmanager.googleapis.com.Writes touch a workspace only; the website changes only after
gtm_create_version→gtm_publish_version.Publishing is the only 🔴 tool and needs an explicit
confirm=true; rollback = publish the previous version id (returned in the result).Scopes:
auth=tagmanager.readonly;auth --with-writesaddsedit.containers,edit.containerversions,publish.delete.containers,manage.users,manage.accountsare never requested.Audit log: one JSON line per tool call in
~/.gtm-mcp/audit.jsonl(tool, redacted args, duration, status).
License: MIT.
Available Tools
34 toolsgtm_auth_statusSign-in profile & quota usageARead-onlyIdempotent
Which scope profile is signed in (read-only vs read+write+publish), API requests made in this session and the client-side rate limiter state. Makes no API call.
Inputs: no named parameters. Returns: object
gtm_check_ga4_ecommerce_coverageGA4 ecommerce event coverageARead-onlyIdempotent
Which of the 11 GA4 ecommerce events (view_item_list … purchase, refund) have an active GA4 event tag with 'send ecommerce data', which are missing or paused, and which custom-event triggers already exist (3 requests). include_optional_events adds view_promotion, select_promotion, add_to_wishlist.
Inputs: container (required), workspace_id, include_optional_events. Returns: object
gtm_container_auditAudit a container workspaceARead-onlyIdempotent
One-shot health check of a workspace (4–6 requests total — prefer this over many single list calls): UA leftovers, duplicate Google tags, dangling/unused triggers, undefined {{variables}}, placeholder values, GA4 event naming, Custom HTML pixels, paused tags, unpublished changes. Container: GTM-XXXXXXX or accounts//containers/.
Inputs: container (required), workspace_id, include_workspace_status. Returns: object
gtm_create_ga4_event_tagCreate GA4 event tag (🟡 write)A
Typed helper for a GA4 event tag (type gaawe). measurement_id = G-XXXXXXXX or a variable reference like
{{GA4 Measurement ID}}. If firing_trigger_ids is omitted, a Custom Event trigger for event_name is reused when it
exists or created (dataLayer.push({event: '<event_name>'})). send_ecommerce_data defaults to true for the GA4
ecommerce events. dry_run=true (default) previews the request(s).
Inputs: container (required), event_name (required), measurement_id (required), name, +6 more. Returns: object
gtm_create_tagCreate tag (🟡 write)A
Create any tag type in the workspace. type is the GTM code (gaawe, googtag, html, awct, img, …; see gtm_list_tags
output of similar tags). parameters is a flat dict {key: value} — strings become template parameters, bools boolean,
ints integer, lists/dicts list/map (or pass raw GTM Parameter objects). Use trigger id 2147479553 for All Pages.
For GA4 event tags prefer gtm_create_ga4_event_tag. dry_run=true (default) previews only.
Inputs: name (required), type (required), container (required), parameters (required), +7 more. Returns: object
gtm_create_triggerCreate trigger (🟡 write)A
Create a trigger. type=customEvent needs custom_event_name (the dataLayer event; use_regex=true for 'a|b'). Other types (pageview, domReady, windowLoaded, click, linkClick, historyChange, scrollDepth…) take optional filters: [{"variable": "{{Page Path}}", "op": "equals|contains|startsWith|endsWith|matchRegex", "value": "/checkout", "negate": false}]. dry_run=true (default) previews only.
Inputs: name (required), container (required), type, dry_run, +4 more. Returns: object
gtm_create_variableCreate variable (🟡 write)A
Create a user-defined variable. type=dataLayer (code v) needs data_layer_name (e.g. ecommerce.items);
type=constant (code c) needs value; any other GTM type code (jsm, u, k, …) takes raw parameters.
dry_run=true (default) previews only.
Inputs: name (required), container (required), type, value, +5 more. Returns: object
gtm_create_versionCreate version from workspace (🟡 write)A
Snapshot the workspace into a container version (NOT published yet). GTM deletes the workspace afterwards and creates a fresh default one. Merge conflicts block it — dry_run=true (default) shows the pending changes/conflicts.
Inputs: name (required), container (required), notes, dry_run, +1 more. Returns: object
gtm_create_workspaceCreate workspace (🟡 write)A
Create a new empty workspace (a draft; nothing is published). Container: GTM-XXXXXXX or accounts//containers/. dry_run=true (default) only previews the request.
Inputs: name (required), container (required), dry_run, description. Returns: object
gtm_enable_built_in_variablesEnable built-in variables (🟡 write)A
Enable built-in variables by API type (pageUrl, pagePath, pageHostname, referrer, event, clickElement, clickClasses, clickId, clickUrl, clickText, formId, scrollDepthThreshold, …). Already-enabled types are harmless. dry_run=true previews.
Inputs: types (required), container (required), dry_run, workspace_id. Returns: object
gtm_find_containerFind container by GTM-/G-/AW- id or nameARead-onlyIdempotent
Resolve a public id (GTM-XXXXXXX from the website's source, or a linked G-/AW- destination id) to the account, container id and default workspace — 1–2 requests. Or search container names across all accounts (1 request per account).
Inputs: public_id, name_contains. Returns: object
gtm_get_containerGet GTM containerBRead-onlyIdempotent
Container details (name, public id, usage context, domains, linked tag ids). Container as public id (GTM-XXXXXXX, or a linked G-/AW- destination id) or API path accounts//containers/.
Inputs: container (required). Returns: object
gtm_get_live_versionGet live (published) versionARead-onlyIdempotent
The version currently published on the website — what visitors actually get. Container as public id (GTM-XXXXXXX, or a linked G-/AW- destination id) or API path accounts//containers/.
Inputs: container (required), include_entities. Returns: object
gtm_get_tagGet tagARead-onlyIdempotent
Full tag: flattened parameters, triggers, consent, notes, fingerprint and the variables it references. Container as public id (GTM-XXXXXXX, or a linked G-/AW- destination id) or API path accounts//containers/. Workspace id (numeric). Omit to use the 'Default Workspace' (looked up once and cached).
Inputs: tag_id (required), container (required), workspace_id. Returns: object
gtm_get_triggerGet triggerARead-onlyIdempotent
Full trigger with all filter conditions and fingerprint. Container as public id (GTM-XXXXXXX, or a linked G-/AW- destination id) or API path accounts//containers/. Workspace id (numeric). Omit to use the 'Default Workspace' (looked up once and cached).
Inputs: container (required), trigger_id (required), workspace_id. Returns: object
gtm_get_variableGet variableARead-onlyIdempotent
Full variable with flattened parameters (e.g. Data Layer name, JS code) and fingerprint. Container as public id (GTM-XXXXXXX, or a linked G-/AW- destination id) or API path accounts//containers/. Workspace id (numeric). Omit to use the 'Default Workspace' (looked up once and cached).
Inputs: container (required), variable_id (required), workspace_id. Returns: object
gtm_get_versionGet container versionARead-onlyIdempotent
One version: counts and tags-by-type; include_entities=true adds compact tag/trigger/variable lists. Container as public id (GTM-XXXXXXX, or a linked G-/AW- destination id) or API path accounts//containers/.
Inputs: container (required), version_id (required), include_entities. Returns: object
gtm_get_workspace_statusWorkspace status (changes & conflicts)ARead-onlyIdempotent
Unpublished changes and merge conflicts of a workspace — run before gtm_create_version. Container as public id (GTM-XXXXXXX, or a linked G-/AW- destination id) or API path accounts//containers/. Workspace id (numeric). Omit to use the 'Default Workspace' (looked up once and cached).
Inputs: container (required), workspace_id. Returns: object
gtm_list_accountsList GTM accountsARead-onlyIdempotent
List every Google Tag Manager account the signed-in Google user can see (1 request).
Inputs: no named parameters. Returns: object
gtm_list_built_in_variablesList enabled built-in variablesARead-onlyIdempotent
Built-in variables currently enabled in the workspace (type + display name, e.g. pageUrl → 'Page URL'). Container as public id (GTM-XXXXXXX, or a linked G-/AW- destination id) or API path accounts//containers/. Workspace id (numeric). Omit to use the 'Default Workspace' (looked up once and cached).
Inputs: container (required), workspace_id. Returns: object
gtm_list_containersList GTM containersARead-onlyIdempotent
List containers of one account (1 request), or of all accounts when account_id is omitted (1 request per account, capped at 10 accounts — quota is 25 requests / 100 s).
Inputs: account_id, name_contains. Returns: object
gtm_list_environmentsList environmentsARead-onlyIdempotent
Environments (Live, Latest, custom) with the version each one serves. Preview auth codes are never returned. Container as public id (GTM-XXXXXXX, or a linked G-/AW- destination id) or API path accounts//containers/.
Inputs: container (required). Returns: object
gtm_list_foldersList foldersBRead-onlyIdempotent
Folders of a workspace (tags/triggers/variables reference them via folder_id). Container as public id (GTM-XXXXXXX, or a linked G-/AW- destination id) or API path accounts//containers/. Workspace id (numeric). Omit to use the 'Default Workspace' (looked up once and cached).
Inputs: container (required), workspace_id. Returns: object
gtm_list_tagsList tagsARead-onlyIdempotent
Tags of a workspace with type label, paused flag, trigger ids and key parameters (all pages fetched once; filters/offset are applied locally). type examples: gaawe (GA4 event), googtag, html, awct, ua. Container as public id (GTM-XXXXXXX, or a linked G-/AW- destination id) or API path accounts//containers/. Workspace id (numeric). Omit to use the 'Default Workspace' (looked up once and cached).
Inputs: container (required), type, limit, offset, +3 more. Returns: object
gtm_list_templatesList custom templatesARead-onlyIdempotent
Custom / community-gallery templates installed in the workspace (template code is not returned). Container as public id (GTM-XXXXXXX, or a linked G-/AW- destination id) or API path accounts//containers/. Workspace id (numeric). Omit to use the 'Default Workspace' (looked up once and cached).
Inputs: container (required), workspace_id. Returns: object
gtm_list_triggersList triggersCRead-onlyIdempotent
Triggers with a one-line condition summary (e.g. 'Custom Event: {{_event}} equals purchase'). Container as public id (GTM-XXXXXXX, or a linked G-/AW- destination id) or API path accounts//containers/. Workspace id (numeric). Omit to use the 'Default Workspace' (looked up once and cached).
Inputs: container (required), type, limit, offset, +2 more. Returns: object
gtm_list_variablesList variablesARead-onlyIdempotent
User-defined variables with a summary (type codes: v = Data Layer, c = Constant, jsm = Custom JS, u = URL, k = Cookie). Container as public id (GTM-XXXXXXX, or a linked G-/AW- destination id) or API path accounts//containers/. Workspace id (numeric). Omit to use the 'Default Workspace' (looked up once and cached).
Inputs: container (required), type, limit, offset, +2 more. Returns: object
gtm_list_versionsList container versionsARead-onlyIdempotent
Version headers (id, name, entity counts), newest first, plus the latest version id. Container as public id (GTM-XXXXXXX, or a linked G-/AW- destination id) or API path accounts//containers/.
Inputs: container (required), limit, offset, include_deleted. Returns: object
gtm_list_workspacesList workspacesARead-onlyIdempotent
Workspaces of a container (unpublished drafts; free tier allows 3). Container as public id (GTM-XXXXXXX, or a linked G-/AW- destination id) or API path accounts//containers/.
Inputs: container (required). Returns: object
gtm_publish_versionPublish version (🔴 goes live)ADestructive
🔴 Make a container version LIVE for every visitor of the website. Requires gtm-mcp auth --with-writes, the
Publish role in GTM, dry_run=false AND confirm=true. dry_run (default) shows the version vs the current live
version. Rollback = publish the previous version id.
Inputs: container (required), version_id (required), confirm, dry_run. Returns: object
gtm_raw_getRaw GET (escape hatch)ARead-onlyIdempotent
GET any Tag Manager v2 resource path (starts with 'accounts/…', e.g. accounts/1/containers/2/workspaces/3/clients) for things no dedicated tool covers. Read-only; output is truncated at 50 KB.
Inputs: path (required), params. Returns: object
gtm_revert_entityRevert workspace changes to an entity (🟡 undo)A
Undo this workspace's changes to one tag / trigger / variable / folder: restores the live version's copy, or removes the entity from the workspace if it was created here (the live container is never touched). dry_run=true previews.
Inputs: container (required), entity_id (required), entity_type (required), dry_run, +1 more. Returns: object
gtm_setup_ga4_ecommerce_eventsSet up GA4 ecommerce event tags (🟡 recipe)A
Plan (dry_run=true, default) or apply (dry_run=false) the standard GA4 ecommerce set in a workspace: for every
missing event (view_item_list … purchase, refund; or the events you pass) one Custom Event trigger
(dataLayer.push({event: 'purchase', ecommerce: {...}})) + one GA4 event tag with 'send ecommerce data'.
Existing triggers/tags are reused, events that only have paused tags are reported (not duplicated).
measurement_id = G-XXXXXXXX or {{GA4 Measurement ID}}. Nothing goes live until gtm_create_version + gtm_publish_version.
Inputs: container (required), measurement_id (required), events, dry_run, +5 more. Returns: object
gtm_update_tagUpdate tag (🟡 write)A
Change selected fields of an existing tag (pause/unpause, rename, swap triggers, set parameters). parameters
merges by key — pass null for a key to remove it. The tag is read first and updated with its fingerprint (safe
against concurrent edits). dry_run=true (default) shows a before/after diff only.
Inputs: tag_id (required), container (required), name, notes, +6 more. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 34 tools
Each tool is scoped to a distinct resource plus action, and the descriptions actively steer between lookalikes (e.g. gtm_create_ga4_event_tag is called out as the preferred path over gtm_create_tag for GA4 events). The only genuine overlap is in the container-resolution trio (gtm_find_container / gtm_list_containers / gtm_get_container) and between the batch helpers (gtm_container_audit, gtm_setup_ga4_ecommerce_events) and their single-entity counterparts, but each description clarifies when to use which.
Uniform gtm_<verb>_<noun> pattern across all 34 tools, with a consistent split between list_/get_ for reads and create_/update_/publish_/revert_ for writes. No camelCase or ad-hoc verbs leak in.
34 tools is heavy for the interaction surface, driven by a list/get pair for every GTM resource type (tags, triggers, variables, folders, templates, versions, workspaces, environments). Most tools do earn their place, but the convenience wrappers (find_container, container_audit, setup_ga4_ecommerce_events, create_ga4_event_tag) add surface area that could arguably be folded into fewer tools.
Read coverage is excellent and create coverage spans workspaces, tags, triggers, variables, versions and publish. However, writes are asymmetric: only gtm_update_tag exists, with no update for triggers, variables, folders, or containers, and there are no delete operations at all — gtm_revert_entity is only a partial undo, and gtm_raw_get is read-only, so modifying an existing trigger or variable has no clean path.
Maintenance
Related MCP Connectors
Read and edit GA4, Search Console and Google Tag Manager from any MCP client. 29 tools.
Let AI manage your Google Tag Manager containers — tags, triggers, variables, and more.
Hosted MCP for Google Ads, Search Console, GA4, Merchant Center, Tag Manager: approve every change.
SEO & marketing toolkit for AI agents: GA4, Search Console, AdSense, GTM, PageSpeed, Trends.
Related MCP Servers
- AlicenseBqualityBmaintenanceProduction-grade MCP server for the Google Tag Manager API v2 with read-only GA4 (Admin + Data API) tooling. 107 tools covering the full GTM surface, including server-side containers. Ships read-only: writes, publishes, and deletes are each gated behind separate opt-in flags, every mutation requires per-call confirmation, and a dry-run mode simulates changes. Includes container audits203283 npm4MIT
- AlicenseAqualityCmaintenanceEnables managing Google Tag Manager and Google Analytics 4 through natural language, with tiered read/write/destructive safety controls including dry-run writes and two-phase confirmations for destructive actions.81MIT
- FlicenseNot gradedqualityCmaintenanceEnables reading, drafting, and publishing Google Tag Manager configurations (accounts, containers, tags, triggers, variables, versions) via the Tag Manager API v2, with isolated workspaces for safe edits and explicit publish for production changes.-
- AlicenseNot gradedqualityCmaintenanceEnables AI clients to manage Google Tag Manager accounts and containers through the Tag Manager API v2, covering account/container discovery, workspace creation and syncing, CRUD on tags, triggers, variables, and folders, built-in variable control, version snapshots, and guarded publishing. It authenticates with a user's own Google identity (or a service-account fallback), honors API quota limits, and writes a redacted SQLite debug log of every tool call and API request.1MIT