# undo_site_environment

Source: https://modulify.ai/docs/mcp/environment/undo-site-environment

Goes back to the last environment of a site that worked and starts a build of its lines. Needs a paid plan.

- Title: Undo the last environment change
- Scope: `config:write`
- Access: Makes changes

It does what **Undo** does in the **Environment** tab, and works out what to go back to the same way:

- When the newest save is not the build the machines use and did not work, because it failed, was canceled or is still queued or building, the site goes back to the environment its machines use now.
- Otherwise it goes back to the newest earlier build that worked with different lines, or to the standard environment when there is none.

When there is nothing to go back to, the call is refused with a `400` reading `There is no earlier environment to go back to!` and nothing changes. Otherwise it answers like `update_site_environment`, with the environment after the change.

Pass `linesHash`, the `LinesHash` that `get_site_environment` returned, and the call is refused with a `409` when the lines changed since you read them, in the **Environment** tab, from chat or from another client. The build counts as one of the site's saves for the day and runs like any other, so follow it with `get_site_environment`. See [Environment](https://modulify.ai/docs/editor/environment).

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | string | Yes | The site id. |
| `linesHash` | string | No | The `LinesHash` from `get_site_environment` for the lines you are going back from. When the saved lines changed since, nothing changes and the call is refused with a `409`. Leave it out to go back regardless. |