# search_buildings

Search for buildings with powerful filtering, sorting, and pagination capabilities. Supports workspace filtering to
scope results to a specific workspace, and geo-distance filtering to find buildings near a specific location.

Reading a building's `address` needs a workspace admin role. Callers without it still get the buildings, with
`address: null` and a `warnings` entry explaining why.

<!-- INPUT_BLOCK_START -->

## Input

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `first` | `number` | No | Number of results to return (forward pagination). Maximum 25. Use with "after" for paging. |
| `after` | `string` | No | Cursor for forward pagination. Pass the "endCursor" from previous page's pageInfo. |
| `last` | `number` | No | Number of results to return (backward pagination). Maximum 25. Use with "before" for reverse paging. |
| `before` | `string` | No | Cursor for backward pagination. Pass the "startCursor" from previous page's pageInfo. |
| `filters` | `BuildingsFiltersInput` | No | Filter criteria for the building search. Supports complex queries with AND/OR logic. - [BuildingsFiltersInput](#buildingsfiltersinput) |
| `sort` | `BuildingsSortInput` | No | Sort order for results. Defaults to newest first if not specified. - [BuildingsSortInput](#buildingssortinput) |

### BuildingsFiltersInput

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `StringFilter` | No | [StringFilter](#stringfilter) |
| `name` | `StringFilter` | No | [StringFilter](#stringfilter) |
| `workspace` | `BuildingsWorkspaceFilter` | No | [BuildingsWorkspaceFilter](#buildingsworkspacefilter) |
| `createdAt` | `DateTimeFilter` | No | [DateTimeFilter](#datetimefilter) |
| `updatedAt` | `DateTimeFilter` | No | [DateTimeFilter](#datetimefilter) |
| `address` | `BuildingsAddressFilter` | No | [BuildingsAddressFilter](#buildingsaddressfilter) |

### BuildingsSortInput

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `SortDirection` | No | Sort by building ID - [SortDirection](#sortdirection) |
| `name` | `SortDirection` | No | Sort by building name (use ASC for A–Z) - [SortDirection](#sortdirection) |
| `createdAt` | `SortDirection` | No | Sort by creation date (use DESC for newest first) - [SortDirection](#sortdirection) |
| `updatedAt` | `SortDirection` | No | Sort by last update date (use DESC for recently modified first) - [SortDirection](#sortdirection) |

### StringFilter

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `eq` | `string` | No | Equals: exact match |
| `neq` | `string` | No | Not equals: exclude exact match |
| `in` | `string[]` | No | In: match any value in the array |
| `nin` | `string[]` | No | Not in: exclude values in the array |
| `search` | `string` | No | Full-text search: partial/fuzzy match |

### BuildingsWorkspaceFilter

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `StringFilter` | No | Filter by workspace ID (eq for a single workspace, in for multiple) |

### DateTimeFilter

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `eq` | `string` | No | Equals: exact datetime match (ISO8601 format, e.g., "2025-01-15T14:30:00Z") |
| `neq` | `string` | No | Not equals: exclude exact datetime |
| `in` | `string[]` | No | In: match any datetime in the array |
| `nin` | `string[]` | No | Not in: exclude datetimes in the array |
| `lt` | `string` | No | Less than: before this datetime (exclusive) |
| `lte` | `string` | No | Less than or equal: before or at this datetime (inclusive) |
| `gt` | `string` | No | Greater than: after this datetime (exclusive) |
| `gte` | `string` | No | Greater than or equal: after or at this datetime (inclusive) |

### BuildingsAddressFilter

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `geoDistance` | `GeoDistanceFilter` | No | Filter buildings by distance from a geographic point - [GeoDistanceFilter](#geodistancefilter) |

### GeoDistanceFilter

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `units` | `DistanceUnit` | Yes | The unit of distance (KM or MI) - [DistanceUnit](#distanceunit) |
| `distance` | `number` | Yes | The distance value |
| `lat` | `number` | Yes | Latitude coordinate |
| `lon` | `number` | Yes | Longitude coordinate |

### SortDirection

| Value | Description |
| --- | --- |
| `ASC` | Ascending: oldest first |
| `DESC` | Descending: newest first |

### DistanceUnit

| Value | Description |
| --- | --- |
| `KM` | Kilometres |
| `MI` | Miles |

<!-- INPUT_BLOCK_END -->

<!-- OUTPUT_BLOCK_START -->

## Output

| Field | Type | Description |
| --- | --- | --- |
| `content` | `ContentItem[]` | Array of content items returned by the tool - [ContentItem](#contentitem) |
| `isError` | `boolean` | Whether the tool execution resulted in an error |

### ContentItem

| Field | Type | Description |
| --- | --- | --- |
| `type` | `'text'` | Content type (currently only 'text' is supported) |
| `text` | `string` | The text content to display |

<!-- OUTPUT_BLOCK_END -->
