# Search Contacts

`Search_Contacts` returns GovTribe contact profiles with communication fields, organizational context, and contact-reference signals derived from opportunities, awards, and files.

## When To Use

Typical questions this tool answers well:

* Which GovTribe contacts match a specific person, email fragment, or topical role?
* Which contacts are associated with a known federal agency or vendor?
* Which contacts were referenced from specific opportunities, awards, or files?
* Which contact reference types (opportunity POC, award POC, in-description, in-government-file) are present in a result set?
* Where are contact records concentrated by top agencies, states, jurisdictions, or vendors?

## Required Reading

1. [Search\_Query\_Guide](https://docs.govtribe.com/user-guide/mcp/guides/search_query_guide): Required before setting free-text query strings when search\_mode is used.
2. [Search\_Mode\_Guide](https://docs.govtribe.com/user-guide/mcp/guides/search_mode_guide): Required before choosing keyword vs semantic retrieval.

## Input Contract

* `query`: Free-text query string. See Required Reading: [Search\_Query\_Guide](https://docs.govtribe.com/user-guide/mcp/guides/search_query_guide).
  * `type`: `string`
  * `required`: `no`
  * `default`: `n/a`
* `page`: 1-based page index.
  * `type`: `null|number`
  * `required`: `no`
  * `default`: `1`
* `per_page`: Rows per page.
  * `type`: `null|number`
  * `required`: `no`
  * `default`: `10`
* `search_mode`: Query interpretation mode. See Required Reading: [Search\_Mode\_Guide](https://docs.govtribe.com/user-guide/mcp/guides/search_mode_guide).
  * `type`: `string`
  * `required`: `no`
  * `default`: `keyword`
  * `options`: `keyword`, `semantic`
* `federal_agency_ids`: Filter by federal agencies. Use GovTribe IDs.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
* `federal_agency_ids_operator`: Choose whether to include or exclude values for Federal Agency GovTribe IDs.
  * `type`: `null|string`
  * `required`: `no`
  * `default`: `in`
  * `options`: `in`, `not_in`
* `reference_types`: Filter contacts by how they were referenced (for example opportunity POC, award POC, seen in description, or government file).
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
  * `options`: `externalFile`, `description`, `transactionContact`, `pointOfContact`
* `reference_types_operator`: Choose whether to include or exclude values for Reference Types.
  * `type`: `null|string`
  * `required`: `no`
  * `default`: `in`
  * `options`: `in`, `not_in`
* `vendor_ids`: Filter by vendors. Use GovTribe IDs or vendor UEIs.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
* `vendor_ids_operator`: Choose whether to include or exclude values for Vendor IDs (GovTribe or UEI).
  * `type`: `null|string`
  * `required`: `no`
  * `default`: `in`
  * `options`: `in`, `not_in`
* `referenced_govtribe_ids`: Filter contacts by referencing records. Use GovTribe IDs of the referencing records.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
* `referenced_govtribe_ids_operator`: Choose whether to include or exclude values for Referenced Record GovTribe IDs.
  * `type`: `null|string`
  * `required`: `no`
  * `default`: `in`
  * `options`: `in`, `not_in`
* `similar_filter`: Find similar to the provided govtribe\_type + govtribe\_id.
  * `type`: `null|object`
  * `required`: `no`
  * `default`: `n/a`
  * `shape`: `{ govtribe_type: string, govtribe_id: string }`
* `contact_ids`: Include or exclude results by GovTribe IDs.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
* `contact_ids_operator`: Choose whether to include or exclude values for GovTribe IDs.
  * `type`: `null|string`
  * `required`: `no`
  * `default`: `in`
  * `options`: `in`, `not_in`
* `aggregations`: Aggregation keys to compute.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
  * `options`: `top_federal_agencies_by_doc_count`, `top_jurisdictions_by_doc_count`, `top_states_by_doc_count`, `top_vendors_by_doc_count`
* `fields_to_return`: Optional field list for row payloads. If omitted and `per_page > 0`, rows default to `govtribe_id`. For `per_page: 0` aggregation/meta calls, this field may be omitted. Specify `fields_to_return` whenever the user asks for fields beyond `govtribe_id`, and prefer omitting it in pure aggregation workflows.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
  * `options`: `govtribe_id`, `govtribe_ai_summary`, `govtribe_type`, `govtribe_url`, `types`, `name`, `email`, `phone`, `title`, `role`, `organization`, `updated_at`, `parent_organization_details`

## Output Contract

* Top-level keys:
  * `current_page`: Current page number when `per_page > 0`.
  * `data`: Array of result rows when `per_page > 0`.
  * `from`: First row position in the current page.
  * `last_page`: Last page number for current filters.
  * `path`: GovTribe search URL for this result set.
  * `per_page`: Applied page size.
  * `to`: Last row position in the current page.
  * `total`: Total matched row count for current query filters.
  * `contains`: Dataset label for the returned result set.
  * `search_results_id_can_generate_saved_search`: Saved-search eligibility flag.
  * `search_results_id`: Server-side search result identifier.
  * `view_search_results_url`: URL to open this exact result set.
  * `aggregations`: Aggregation payload keyed by requested aggregation names when requested.
  * `per_page: 0` behavior: response omits row pagination keys and returns metadata keys above plus `aggregations` when requested.
* Row keys:
  * `govtribe_id`
  * `govtribe_ai_summary`
  * `govtribe_type`
  * `govtribe_url`
  * `types`
  * `name`
  * `email`
  * `phone`
  * `title`
  * `role`
  * `organization`
  * `updated_at`
  * `parent_organization_details`
* Relationship retrieval map:
  * `parent_organization_details`
    * `resource_type`: `federal_agency`
    * `tool`: `Search_Federal_Agencies`
    * `filter`: `federal_agency_ids`
    * `nested_keys`: `govtribe_id`, `govtribe_type`, `govtribe_url`, `name`
    * `resource_type`: `jurisdiction`
    * `tool`: `Search_Jurisdictions`
    * `filter`: `jurisdiction_ids`
    * `nested_keys`: `govtribe_id`, `govtribe_type`, `govtribe_url`, `name`
    * `resource_type`: `state`
    * `tool`: `Search_States`
    * `filter`: `state_ids`
    * `nested_keys`: `govtribe_id`, `govtribe_type`, `govtribe_url`, `name`
    * `resource_type`: `vendor`
    * `tool`: `Search_Vendors`
    * `filter`: `vendor_ids`
    * `nested_keys`: `govtribe_id`, `govtribe_type`, `name`, `uei`, `govtribe_url`

## Usage Patterns

Pattern A: Resolve contacts for a known federal agency (after resolving the agency ID with `Search_Federal_Agencies`). Tool: `Search_Contacts`

```json
{
  "federal_agency_ids": [
    "9700|1700-A"
  ],
  "query": "",
  "search_mode": "keyword",
  "fields_to_return": [
    "govtribe_id"
  ],
  "page": 1,
  "per_page": 25
}
```

Pattern B: Find contacts referenced in known records and limit to public POC-type signals. Tool: `Search_Contacts`

```json
{
  "query": "",
  "reference_types": [
    "pointOfContact",
    "transactionContact"
  ],
  "referenced_govtribe_ids": [
    "<RECORD_GOVTRIBE_ID>"
  ],
  "search_mode": "keyword",
  "fields_to_return": [
    "govtribe_id"
  ],
  "page": 1,
  "per_page": 20
}
```

Pattern C: Run conceptual contact discovery while excluding known contacts. Tool: `Search_Contacts`

```json
{
  "query": "engineering and cybersecurity acquisition contacts",
  "search_mode": "semantic",
  "fields_to_return": [
    "govtribe_id"
  ],
  "page": 1,
  "per_page": 20,
  "contact_ids": [
    "<CONTACT_ID_TO_EXCLUDE_1>",
    "<CONTACT_ID_TO_EXCLUDE_2>"
  ],
  "contact_ids_operator": "not_in"
}
```

Pattern D: Aggregation-only concentration view by agency, state, jurisdiction, and vendor. Tool: `Search_Contacts`

```json
{
  "aggregations": [
    "top_federal_agencies_by_doc_count",
    "top_states_by_doc_count",
    "top_jurisdictions_by_doc_count",
    "top_vendors_by_doc_count"
  ],
  "query": "",
  "search_mode": "keyword",
  "per_page": 0
}
```

Pattern E: Find contacts similar to an existing anchor record. Tool: `Search_Contacts`

```json
{
  "query": "",
  "search_mode": "semantic",
  "fields_to_return": [
    "govtribe_id"
  ],
  "similar_filter": {
    "govtribe_type": "contact",
    "govtribe_id": "<CONTACT_ID>"
  },
  "page": 1,
  "per_page": 20
}
```
