# 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\_Mode\_And\_Query\_Guide](/user-guide/mcp/guides/search_mode_and_query_guide.md): Required before setting free-text query strings and choosing keyword vs semantic retrieval.
2. [Date\_Filtering\_Guide](/user-guide/mcp/guides/date_filtering_guide.md): Required before setting date window filters.
3. [Location\_Filtering\_Guide](/user-guide/mcp/guides/location_filtering_guide.md): Required before setting location filters.

## 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`
  * `opportunity_state`
  * `part_of_mas`
  * `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`
* `place_of_performance` returns a nested location object with `govtribe_id`, `govtribe_type`, `name`, `lat`, and `lng` when the place-of-performance relation is loaded.
* 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`, `name`, `lat`, `lng`
  * `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
{
  "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
{
  "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
{
  "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
{
  "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
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.govtribe.com/user-guide/mcp/tools/search-federal-contract-opportunities.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
