# Search Federal Contract Opportunities

`Search_Federal_Contract_Opportunities` is the GovTribe MCP search surface for federal solicitations and related pre-award notices.

## When To Use

Typical questions this tool answers well:

* Which open or recently posted federal opportunities match a topic, code, agency, geography, or deadline window?
* Which opportunities are `Solicitation` versus `Pre-Solicitation`, and which set-aside designations dominate a market slice?
* Which opportunities are tied to a known solicitation number or GovTribe opportunity ID?
* Which points of contact and government files are attached to matching opportunities?
* Which opportunities look similar to a known contract award, IDV, vehicle, vendor, or prior opportunity?

## 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.
3. [Date\_Filtering\_Guide](https://docs.govtribe.com/user-guide/mcp/guides/date_filtering_guide): Required before setting date window filters.
4. [Location\_Filtering\_Guide](https://docs.govtribe.com/user-guide/mcp/guides/location_filtering_guide): Required before setting location filters.

## Input Contract

* `query`: Free-text query string. See Required Reading: [Search\_Query\_Guide](https://docs.govtribe.com/user-guide/mcp/guides/search_query_guide).l
  * `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`
* `due_date_range`: Set the `from` value to a future date if the user wants to see `open` items or those they can bid on. See Required Reading: [Date\_Filtering\_Guide](https://docs.govtribe.com/user-guide/mcp/guides/date_filtering_guide).
  * `type`: `object`
  * `required`: `no`
  * `default`: `n/a`
  * `shape`: `{ from?: null|string, to?: null|string }`
* `posted_date`: Filter by posted date. See Required Reading: [Date\_Filtering\_Guide](https://docs.govtribe.com/user-guide/mcp/guides/date_filtering_guide).
  * `type`: `object`
  * `required`: `no`
  * `default`: `n/a`
  * `shape`: `{ from?: null|string, to?: null|string }`
* `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`
* `naics_category_ids`: Filter by NAICS categories. Use GovTribe IDs or NAICS codes.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
* `naics_category_ids_operator`: Choose whether to include or exclude values for NAICS Category IDs (GovTribe or NAICS code).
  * `type`: `null|string`
  * `required`: `no`
  * `default`: `in`
  * `options`: `in`, `not_in`
* `psc_category_ids`: Filter by PSC categories. Use GovTribe IDs or PSC codes.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
* `psc_category_ids_operator`: Choose whether to include or exclude values for PSC Category IDs (GovTribe or PSC code).
  * `type`: `null|string`
  * `required`: `no`
  * `default`: `in`
  * `options`: `in`, `not_in`
* `place_of_performance_ids`: Filter by place of performance. Use GovTribe location IDs or location text for countries, cities/localities, ZIP or postal codes, states/territories, or counties; matching is US-biased for ambiguous names. See Required Reading: [Location\_Filtering\_Guide](https://docs.govtribe.com/user-guide/mcp/guides/location_filtering_guide).
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
* `place_of_performance_ids_operator`: Choose whether to include or exclude values for Place of Performance IDs or Locations.
  * `type`: `null|string`
  * `required`: `no`
  * `default`: `in`
  * `options`: `in`, `not_in`
* `contact_ids`: Filter by points of contact. Use GovTribe IDs.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
* `contact_ids_operator`: Choose whether to include or exclude values for Contact GovTribe IDs.
  * `type`: `null|string`
  * `required`: `no`
  * `default`: `in`
  * `options`: `in`, `not_in`
* `federal_meta_opportunity_ids`: Filter by federal meta opportunity IDs. These are GovTribe-derived linking IDs from federal contract opportunities.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
* `federal_meta_opportunity_ids_operator`: Choose whether to include or exclude values for Federal Meta Opportunity GovTribe IDs.
  * `type`: `null|string`
  * `required`: `no`
  * `default`: `in`
  * `options`: `in`, `not_in`
* `opportunity_types`: Filter by the type of federal contract opportunity.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
  * `options`: `Solicitation`, `Pre-Solicitation`, `Special Notice`, `Limited / Sole Source Justification`, `Award Notice`, `Sale of Surplus Property`, `Foreign Government Standard`, `Cancellation`
* `opportunity_types_operator`: Choose whether to include or exclude values for Opportunity Types.
  * `type`: `null|string`
  * `required`: `no`
  * `default`: `in`
  * `options`: `in`, `not_in`
* `set_aside_types`: Filter by the set-aside designations for small businesses.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
  * `options`: `No Set-Aside Used`, `Partial Small Business`, `Total Small Business`, `8(a) Sole Source`, `Competitive 8(a)`, `Buy Indian`, `Indian Small Business Economic Enterprise`, `HUBZone Sole Source`, `HUBZone`, `Service-Disabled Veteran-Owned Small Business Sole Source`, `Service-Disabled Veteran-Owned Small Business`, `Veteran Sole Source`, `Veteran-Owned Small Business`, `Economically Disadvantaged Woman-Owned Small Business`, `Woman-Owned Small Business Sole Source`, `Woman-Owned Small Business`
* `set_aside_types_operator`: Choose whether to include or exclude values for Set-Aside Types.
  * `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 }`
* `federal_contract_opportunity_ids`: Include or exclude results by GovTribe IDs.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
* `federal_contract_opportunity_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_set_aside_types_by_doc_count`, `top_locations_by_doc_count`, `top_naics_codes_by_doc_count`, `top_psc_codes_by_doc_count`, `top_contacts_by_doc_count`
* `sort`: Sort configuration.
  * `type`: `object`
  * `required`: `no`
  * `default`: `n/a`
  * `shape`: `{ key?: null|string, direction?: null|string }`
  * `options`: `key`: `postedDate`, `dueDate`, `awardDate`, `_score`; `direction`: `asc`, `desc`
* `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`, `solicitation_number`, `name`, `opportunity_type`, `set_aside_type`, `posted_date`, `due_date`, `award_date`, `descriptions`, `federal_meta_opportunity_id`, `updated_at`, `federal_contract_vehicle`, `federal_agency`, `place_of_performance`, `naics_category`, `psc_category`, `government_files`, `federal_contract_awards`, `federal_contract_idvs`, `points_of_contact`

## 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.
* Row keys:
  * `govtribe_id`
  * `govtribe_ai_summary`
  * `govtribe_type`
  * `govtribe_url`
  * `solicitation_number`
  * `name`
  * `opportunity_type`
  * `set_aside_type`
  * `posted_date`
  * `due_date`
  * `award_date`
  * `descriptions`
  * `federal_meta_opportunity_id`
  * `updated_at`
  * `federal_contract_vehicle`
  * `federal_agency`
  * `place_of_performance`
  * `naics_category`
  * `psc_category`
  * `government_files`
  * `federal_contract_awards`
  * `federal_contract_idvs`
  * `points_of_contact`
* Relationship retrieval map:
  * `federal_agency`
    * `resource_type`: `federal_agency`
    * `tool`: `Search_Federal_Agencies`
    * `filter`: `federal_agency_ids`
    * `nested_keys`: `govtribe_id`, `govtribe_type`, `govtribe_url`, `name`
  * `federal_contract_awards`
    * `resource_type`: `federal_contract_award`
    * `tool`: `Search_Federal_Contract_Awards`
    * `filter`: `federal_contract_award_ids`
    * `nested_keys`: `govtribe_id`, `govtribe_type`, `govtribe_url`, `name`
  * `federal_contract_idvs`
    * `resource_type`: `federal_contract_idv`
    * `tool`: `Search_Federal_Contract_IDVs`
    * `filter`: `federal_contract_i_d_v_ids`
    * `nested_keys`: `govtribe_id`, `govtribe_type`, `govtribe_url`, `name`
  * `federal_contract_vehicle`
    * `resource_type`: `federal_contract_vehicle`
    * `tool`: `Search_Federal_Contract_Vehicles`
    * `filter`: `federal_contract_vehicle_ids`
    * `nested_keys`: `govtribe_id`, `govtribe_type`, `govtribe_url`, `name`
  * `government_files`
    * `resource_type`: `government_file`
    * `tool`: `Search_Government_Files`
    * `filter`: `government_file_ids`
    * `nested_keys`: `govtribe_id`, `govtribe_type`, `govtribe_url`, `name`
  * `naics_category`
    * `resource_type`: `naics_category`
    * `tool`: `Search_Naics_Categories`
    * `filter`: `naics_category_ids`
    * `nested_keys`: `govtribe_id`, `govtribe_type`, `govtribe_url`, `name`
  * `place_of_performance`
    * `resource_type`: `location`
    * `tool`: `n/a`
    * `filter`: `n/a`
    * `fallback`: No direct Search\_\* tool returns this resource class; use parent dataset filters and parent IDs.
    * `nested_keys`: `govtribe_id`, `govtribe_type`, `govtribe_url`, `name`
  * `points_of_contact`
    * `resource_type`: `contact`
    * `tool`: `Search_Contacts`
    * `filter`: `contact_ids`
    * `nested_keys`: `govtribe_id`, `govtribe_type`, `name`, `email`, `govtribe_url`
  * `psc_category`
    * `resource_type`: `psc_category`
    * `tool`: `Search_Psc_Categories`
    * `filter`: `psc_category_ids`
    * `nested_keys`: `govtribe_id`, `govtribe_type`, `govtribe_url`, `name`

## Usage Patterns

Pattern A: Open solicitations for target NAICS codes. Tool: `Search_Federal_Contract_Opportunities`

```json
{
  "query": "",
  "search_mode": "keyword",
  "fields_to_return": [
    "govtribe_id"
  ],
  "naics_category_ids": [
    "<NAICS_OR_GOVTRIBE_ID_1>",
    "<NAICS_OR_GOVTRIBE_ID_2>"
  ],
  "naics_category_ids_operator": "in",
  "opportunity_types": [
    "Solicitation"
  ],
  "opportunity_types_operator": "in",
  "due_date_range": {
    "from": "now/d",
    "to": null
  },
  "sort": {
    "key": "dueDate",
    "direction": "asc"
  },
  "page": 1,
  "per_page": 25
}
```

Pattern B: Topic + set-aside + due within the next 30 days. Tool: `Search_Federal_Contract_Opportunities`

```json
{
  "query": "cloud modernization",
  "search_mode": "semantic",
  "fields_to_return": [
    "govtribe_id"
  ],
  "set_aside_types": [
    "Service-Disabled Veteran-Owned Small Business"
  ],
  "set_aside_types_operator": "in",
  "due_date_range": {
    "from": "now/d",
    "to": "now+30d/d"
  },
  "sort": {
    "key": "dueDate",
    "direction": "asc"
  },
  "page": 1,
  "per_page": 20
}
```

Pattern C: Exact solicitation lookup by solicitation number. Tool: `Search_Federal_Contract_Opportunities`

```json
{
  "query": "\"W912HQ-24-R-0123\"",
  "search_mode": "keyword",
  "fields_to_return": [
    "govtribe_id"
  ],
  "sort": {
    "key": "postedDate",
    "direction": "desc"
  },
  "page": 1,
  "per_page": 10
}
```

Pattern D: Aggregation-only market scan by agency and set-aside mix. Tool: `Search_Federal_Contract_Opportunities`

```json
{
  "query": "",
  "search_mode": "keyword",
  "federal_agency_ids": [
    "<FEDERAL_AGENCY_ID>"
  ],
  "federal_agency_ids_operator": "in",
  "aggregations": [
    "top_set_aside_types_by_doc_count",
    "top_naics_codes_by_doc_count",
    "top_contacts_by_doc_count"
  ],
  "sort": {
    "key": "_score",
    "direction": "desc"
  },
  "per_page": 0
}
```

Then rerun with `per_page > 0` and the same filters if the user asks for row-level examples behind the rollups.

Pattern E: Find opportunities similar to a known award or IDV. Tool: `Search_Federal_Contract_Opportunities`

```json
{
  "query": "",
  "search_mode": "semantic",
  "fields_to_return": [
    "govtribe_id"
  ],
  "similar_filter": {
    "govtribe_type": "federal_contract_award",
    "govtribe_id": "<FEDERAL_CONTRACT_AWARD_ID>"
  },
  "sort": {
    "key": "_score",
    "direction": "desc"
  },
  "page": 1,
  "per_page": 15
}
```

Pattern F: Incumbent discovery workflow for a known opportunity thread. Tool: `Search_Federal_Contract_Opportunities`

```json
{
  "query": "",
  "search_mode": "keyword",
  "fields_to_return": [
    "govtribe_id"
  ],
  "federal_meta_opportunity_ids": [
    "<FEDERAL_META_OPPORTUNITY_ID>"
  ],
  "federal_meta_opportunity_ids_operator": "in",
  "sort": {
    "key": "_score",
    "direction": "desc"
  },
  "page": 1,
  "per_page": 25
}
```
