# update_event_mappings

Correct custom Shopify delivery handles while preserving registered event definitions and funnel pins.

## Purpose

Correct the optional custom Shopify monitoring handles on a registered plan without changing its event meanings, immutable catalog versions or default funnel pins.

## Access and effects

Workspace owner credential only. This is a confirmed write. Read [get_instrumentation_plan](/docs/mcp/get-instrumentation-plan) first and review all handles. Member, partner and app-bound affiliate credentials cannot use this tool.

## Example request

All identifiers and the revision below are fictional. Use the actual registered plan ID and `mappingRevision` returned by `get_instrumentation_plan`. Supply every registered event name once. Use a null handle for HeyCrust-only events.

```json
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "tools/call",
  "params": {
    "name": "update_event_mappings",
    "arguments": {
      "appId": "11111111-1111-4111-8111-111111111111",
      "planId": "22222222-2222-4222-8222-222222222222",
      "expectedRevision": "0000000000000000000000000000000000000000000000000000000000000000",
      "mappings": [
        {
          "name": "setup_started",
          "analyticsHandle": "crust.analytics.setup_started"
        },
        {
          "name": "setup_completed",
          "analyticsHandle": "crust.analytics.setup_completed"
        },
        {
          "name": "first_value",
          "analyticsHandle": "crust.analytics.first_value"
        },
        {
          "name": "feature_used",
          "analyticsHandle": "crust.analytics.feature_used"
        },
        {
          "name": "feature_failed",
          "analyticsHandle": "crust.analytics.feature_failed"
        }
      ],
      "confirm": true
    }
  }
}
```

POST to `https://heycrust.com/api/mcp` with `Content-Type: application/json` and `Authorization: Bearer <YOUR_CREDENTIAL>`. Check JSON-RPC errors and `result.isError`, then parse JSON text in `result.content`.

## Result and interpretation

Returns the same `registered` plan with corrected handles and its new `mappingRevision`. Explicit `confirm: true` is required. An identical retry returns the saved mappings. A stale conflicting edit returns a conflict; reload the plan and review before saving. Event names, definitions, categories, definition versions and the funnel remain unchanged. Only distinct `crust.analytics.*` handles or null are accepted. Never use a Shopify pricing meter.

Regenerate the server configuration with [generate_tracking_code](/docs/mcp/generate-tracking-code), review and deploy it through your normal process, then perform a real app action and [verify_events](/docs/mcp/verify-events). Changing a mapping does not deploy code, send events, rewrite already queued deliveries, activate a flow or declare coverage. Queued deliveries retain their original handles.

**Shopify Analytics remains unavailable.** These mappings support custom monitoring and developer Logs only. App-reported API acceptance does not prove Analytics processing or Logs visibility.

Recognized PostgreSQL timeouts return `status: unavailable` with `reasons: [query_timeout]`; reload the plan before deciding whether an uncertain mutation completed.
