> ## Documentation Index
> Fetch the complete documentation index at: https://develop.cotality.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Response envelope

> The response wrappers returned by Cotality MCP tools and REST APIs — which fields each one returns, and how to tell success from failure.

Cotality returns two different response shapes. Which one you get depends on what you call.

| You are calling | Envelope | Success signalled by |
| - | - | - |
| CLIP, property characteristics, risk, and market analytics **MCP tools** | `data` + `count` | The MCP error flag — see [MCP tool errors](https://develop.cotality.com/reference/mcp-errors.md) |
| **REST APIs**, and the valuation and credit MCP tools that wrap them | `success` + `count` + `data` + `messages` | The `success` field |

> [!WARNING]
>
> Do not test `response.success` against the CLIP, property, risk, or analytics MCP tools.
> Those tools never return a `success` field, so the check reads as missing on every call —
> including successful ones. Branch on the MCP error flag instead.

## MCP tool envelope

The CLIP, property characteristics, climate risk, and market analytics tools return a
two-field object on success.

```json theme={null}
{
  "count": 1,
  "data": [ /* tool-specific result objects */ ]
}
```

| Field | Type | Always present | Meaning |
| - | - | - | - |
| `count` | `integer` | Yes | Number of items in `data` |
| `data` | `array` | Yes | Tool-specific payload. Shape differs per tool. |

Failure is not expressed in this object at all. A failed call returns an MCP error whose
content is a `ToolError` payload with `code`, `message`, and `retryable`. See
[MCP tool errors](https://develop.cotality.com/reference/mcp-errors.md).

> [!NOTE]
>
> Fields with no value are omitted from the response rather than returned as `null`. Treat an
> absent field and a null field as the same thing — no data available for that property. Field
> reference tables on the tool pages list every field a tool *can* return, not every field it
> *will* return.

### Rules for consumers

**1. Check for an MCP error first**

Your MCP client surfaces tool failures as an error result. Handle that before reading
`data`. Read the `retryable` flag to decide whether a retry can help.

**2. Treat a count of 0 as a valid answer**

An unmatched CLIP, address, or geography is **not** an error on these tools. You get a
successful response with `count` of `0` and an empty `data` array. Report "no match" —
never fabricate a value.

**3. Respect count**

Iterate exactly `count` items from `data`. Do not assume a single result — parcels,
properties, and geographies can return multiple records.

### Example — property characteristics (abridged)

```json theme={null}
{
  "count": 1,
  "data": [{
    "clip": "123456789",
    "propertyCharacteristics": {
      "land": { "landUseCodeDescription": "Single Family Residence" },
      "structure": [{ "actualYearBuilt": 2012, "livingSquareFootage": 2450 }]
    }
  }]
}
```

## REST envelope

Cotality REST endpoints — and the valuation and credit MCP tools that wrap them — return a
four-field envelope. Parse all four before reading the payload.

```json theme={null}
{
  "success": true,
  "count": 1,
  "data": [ /* result objects */ ],
  "messages": []
}
```

| Field | Type | Always present | Meaning |
| - | - | - | - |
| `success` | `boolean` | Yes | Whether the call completed successfully. Gate all `data` reads on this. |
| `count` | `integer` | Yes | Number of items in `data` |
| `data` | `array` | Yes | Payload. Shape differs per endpoint. |
| `messages` | `array` | Yes | Warnings, deprecations, partial-match notices, and info. Always surface non-empty values. |

### Error envelope

When `success` is `false`, the error detail is in `messages`:

```json theme={null}
{
  "success": false,
  "count": 0,
  "data": [],
  "messages": [
    { "code": "ENTITLEMENT_DENIED", "message": "Asset not licensed for this token." }
  ]
}
```

See [Error handling](https://develop.cotality.com/reference/error-handling.md) for the full list of codes and agent actions.

> [!TIP]
>
> For AI agents: on REST responses, check `messages` before summarising results. Non-empty
> messages often explain why a result is partial, estimated, or about to change.

## Related

* [MCP tool errors](https://develop.cotality.com/reference/mcp-errors.md) — the `code`, `message`, and `retryable` contract
* [Error handling](https://develop.cotality.com/reference/error-handling.md) — REST status codes and message codes
