> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.doc-detective.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.doc-detective.com/_mcp/server.

# closeSurface

> Reference for the `closeSurface` schema.

## Referenced In

* [Markup definition](/reference/schemas/markup-definition)
* [test](/reference/schemas/test)
* [Resolved context](/reference/schemas/resolved-context)

## Fields

| Field        | Type                                                                                                                                                                                                                                                                                                                                                                                                                              | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | Default |
| :----------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :------ |
| closeSurface | one of: - one of: - string - object([Process surface](/reference/schemas/process-surface)) - object([Browser surface](/reference/schemas/browser-surface)) - object([App surface](/reference/schemas/app-surface)) - array of one of: string, object([Process surface](/reference/schemas/process-surface)), object([Browser surface](/reference/schemas/browser-surface)), object([App surface](/reference/schemas/app-surface)) | Required. Close one or more surfaces: background processes, browser windows/tabs or whole browser sessions, and native app surfaces. A browser reference with a `tab` selector closes that tab; with a `window` selector it closes the window and its tabs; with neither it closes the whole browser session. An app reference (\{ "app": … }) closes the app surface, terminating the app when Doc Detective launched it. Closing a surface that is not open is a no-op (PASS). Renames `stopProcess`. | —       |

## Examples

```json
{
  "closeSurface": "web"
}
```

```json
{
  "closeSurface": {
    "process": "web"
  }
}
```

```json
{
  "closeSurface": [
    "web",
    "api"
  ]
}
```

```json
{
  "closeSurface": {
    "browser": "chrome",
    "tab": "cart"
  }
}
```

```json
{
  "closeSurface": {
    "browser": "chrome",
    "window": "admin"
  }
}
```

```json
{
  "closeSurface": {
    "browser": "chrome",
    "tab": -1
  }
}
```

```json
{
  "closeSurface": "chrome"
}
```

```json
{
  "closeSurface": {
    "app": "charmap"
  }
}
```

```json
{
  "closeSurface": {
    "app": "notepad",
    "window": -1
  }
}
```

```json
{
  "closeSurface": {
    "app": "TextEdit",
    "window": {
      "title": "Untitled 2"
    }
  }
}
```