# Search and identity

## `whoami` {#whoami}


**Who am I.** The signed-in user, their workspace and what this connection is allowed to do.

| Access | Permission | Limit |
|---|---|---|
| Read | No single permission. Results cover what you've approved. | Reading |

This tool takes no arguments.

**Returns:** `id`, `name`, `nickname`, `permissions`, `username`, `workspace`.

`username` is the sign-in name. When a user has no full name, `name` falls back to it, so the two match.


## `search` {#search}


**Search.** Search people, companies and jobs by keyword. Returns IDs for fetch.

| Access | Permission | Limit |
|---|---|---|
| Read | No single permission. Results cover what you've approved. | Search |

| Argument | Type | Required | Description |
|---|---|---|---|
| `query` | string | yes |  |

**Returns:** `results`.


## `fetch` {#fetch}


**Fetch.** One record by the ID from search, as readable text. Contact details aren't included.

| Access | Permission | Limit |
|---|---|---|
| Read | `companies:read`, `jobs:read`, `people:read` or `records:read` | Reading |

| Argument | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes |  |

**Returns:** `id`, `metadata`, `text`, `title`, `url`.


## `count_records` {#count_records}


**Count records.** Counts records of one type, with the same query and filters as search_records. group_by splits the count by one attribute marked groupable in list_attributes. approximate is true when the number may lag recent permission changes.

| Access | Permission | Limit |
|---|---|---|
| Read | `companies:read`, `jobs:read`, `people:read` or `records:read` | Search |

| Argument | Type | Required | Description |
|---|---|---|---|
| `object` | string | yes | Plural slug from list_objects, such as people. |
| `document_query` | string | no | A keyword that must appear in the record's CV or main document. Not with group_by. |
| `filters` | array | no | Groups combine with AND. Field names and operators come from list_attributes. |
| `filters[].clauses` | array | yes |  |
| `filters[].clauses[].field` | string | yes | Attribute name from list_attributes. |
| `filters[].clauses[].op` | string | yes | Operator from the attribute's filter_ops. |
| `filters[].clauses[].value` | any | no | Left out for exists and not_exists. |
| `filters[].op` | string | yes | How the clauses combine: and, or, not. |
| `group_by` | string | no | One attribute marked groupable in list_attributes. The count is split by its values. |
| `near` | object | no | People, companies and jobs within a distance of a place. |
| `near.radius_km` | number | yes | 1 to 500. |
| `near.lat` | number | no | Latitude, with lng, in place of a city name. |
| `near.lng` | number | no | Longitude, with lat. |
| `near.place` | string | no | A city name. Resolved from this workspace's own addresses. |
| `query` | string | no | Keywords. Left out, filters alone decide. |

**Returns:** `approximate`, `document_matches_truncated`, `groups`, `none_count`, `overlapping`, with [paging fields](https://docs.searchsoftware.nl/mcp/working-with-records.md#paging).

`count_records` takes the same `query` and `filters` as `search_records` and returns numbers, never rows. `group_by` names one attribute that `list_attributes` marks `groupable`: status, select fields, yes/no fields, workflow phase, the assignee, sources and types. An attribute with more than 50 values is refused, so filter first. A grouped count can add up to more than the total when `overlapping` is true, because a record can have several values:

```json
{"object": "jobs", "filters": [{"op": "and", "clauses": [{"field": "status", "op": "eq", "value": "normal"}]}], "group_by": "assigned_to"}
```

Each group's `value` fits straight into a `search_records` filter to list the records behind the number. `approximate` is true for users who don't see every record, because the count can lag recent permission changes.

`count_records` also takes `near` and `document_query`, like `search_records`. `document_query` can't be combined with `group_by`. `city`, `state` and `country_code` filter on the primary address; `state` is its region (province or state).


### GDPR status {#gdpr-status}


People have three GDPR attributes: `gdpr_status`, which is `permok`, `permreq`, `permno` or `novalue` (no status set), `gdpr_status_changed_at`, and `gdpr_expires_at`. A status expires a number of days after its date. The workspace's GDPR retention settings set the days for each status (by default 360, 30, 14 and 360). `novalue` counts from the date the person was added. The expiry date is worked out when the record is indexed, so after a manager changes a retention time, the people index has to be re-synced before the new dates apply.

`count_records people group_by: gdpr_status` gives the overview. For "GDPR status expired at least 30 days ago", work out the date first. Asked on 2026-11-12:

```json
{"object": "people", "filters": [{"op": "and", "clauses": [{"field": "gdpr_expires_at", "op": "lte", "value": "2026-10-13T00:00:00Z"}]}]}
```
