# RevCent MCP Guide: `AddTrackingDomainToSite`

Brief MCP-focused guide for RevCent MCP clients and agents using the `AddTrackingDomainToSite` operation.

---

## Operation Summary

Operation:

```text
AddTrackingDomainToSite
```

Purpose:

```text
Attach a Tracking Domain to a RevCent Site so the custom domain can route to the main/live Site deployment.
```

Use this operation only after the user has confirmed both the Site and the Tracking Domain.

---

## When to Use

Good uses:

- attach a custom domain to a Site,
- route a Tracking Domain to the Site's live/main branch,
- prepare the user to point DNS at the returned A record IP,
- replace a "not configured" live routing state with a configured custom domain flow.

Do not use this operation to create a Tracking Domain, configure Tracking Domain SSL/DNS, retrieve Site status, or route the dev branch.

---

## Required Preparation

Before calling `AddTrackingDomainToSite`:

1. Identify the exact Site ID.
2. Identify the exact Tracking Domain ID.
3. Verify the Tracking Domain is ready to be used.
4. Confirm the Tracking Domain is not already in use by another Site.
5. Confirm with the user that this domain should route to the Site's live/main deployment.

Use `GetTrackingDomains` or `GetTrackingDomain` when the Tracking Domain ID is not known.

---

## Input Schema

`AddTrackingDomainToSite` requires a path parameter and a JSON request body.

```json
{
  "site_id": "XXXXXXXXXXXXXXXXXXXX",
  "tracking_domain": "YYYYYYYYYYYYYYYYYYYY"
}
```

### Required Fields

| Field | Location | Type | Required | Description |
|---|---|---:|---:|---|
| `site_id` | Path | `string` | Yes | A 20-character Site ID. |
| `tracking_domain` | Body | `string` | Yes | A 20-character Tracking Domain ID. |

### Important Schema Rules

- Do not include unknown body properties.
- The Tracking Domain must have SSL and DNS successfully configured before it can be added to a Site.
- The Tracking Domain cannot be in use by another Site.
- The Tracking Domain ID can be retrieved with `GetTrackingDomains`.

---

## Output Schema

A successful response returns the Site ID.

```json
{
  "api_call_id": "XXXXXXXXXXXXXXXXXXXX",
  "api_call_unix": 1710000000,
  "code": 1,
  "site_id": "XXXXXXXXXXXXXXXXXXXX",
  "result": "string"
}
```

---

## Example Request

```json
{
  "site_id": "XXXXXXXXXXXXXXXXXXXX",
  "tracking_domain": "YYYYYYYYYYYYYYYYYYYY"
}
```

---

## Recommended Follow-Up

After a successful call:

1. Call `GetSite`.
2. Inspect `tracking_domain`.
3. Inspect `deployment.branches.main.routing.status`.
4. Inspect `deployment.branches.main.routing.a_record_ip`.
5. Tell the user the A record IP if DNS still needs to be pointed.
6. Avoid saying the domain is live until routing and DNS are ready.

---

## Best Practices

1. Confirm the Site and domain before calling this operation.
2. Use exact IDs from prior MCP results.
3. Explain that the Tracking Domain affects the main/live Site, not the dev branch.
4. Keep the user informed that DNS may still need to be updated.
5. Use `GetSiteEvents` if the user wants to see routing-related activity.

---

## Final MCP Instruction

Use `AddTrackingDomainToSite` only for confirmed custom domain routing to a RevCent Site's main/live deployment, and always follow up with `GetSite` to verify returned routing details.



---
Document Parent Directory
* [Operations](https://revcent.com/documentation/markdown/mcp/operation/index.md) - AI/MCP details and overviews for operations available within the RevCent MCP.