# Search Federal Forecasts

`Search_Federal_Forecasts` retrieves GovTribe federal forecast records for planned federal requirements, including timing, estimated value range, set-aside posture, and point-of-contact context.

## When To Use

* Which forecasted requirements match a topic, agency, NAICS, geography, or time window?
* Which forecasts are expected to release soon (`estimated_solicitation_release_date`)?
* Which recompetes or new requirements exist for a target agency portfolio?
* Which forecast set-asides are most common in the current filtered market?
* Which forecast records are similar to a known forecast/opportunity/award entity?

## 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).
  * `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`
* `anticipated_award_start_date_range`: Filter by the anticipated award start 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 }`
* `estimated_solicitation_release_date_range`: Filter by the estimated solicitation release 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`
* `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`
* `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`
* `forecast_type`: Filter by the type of federal forecast.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
  * `options`: `New Requirement`, `Recompete`, `Exercise of Option`
* `forecast_type_operator`: Choose whether to include or exclude values for Forecast Type.
  * `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_forecast_ids`: Include or exclude results by GovTribe IDs.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
* `federal_forecast_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_naics_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`: `anticipated_award_start_date`, `anticipated_award_end_date`, `estimated_solicitation_release_date`, `timestamp`, `_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`, `name`, `forecast_type`, `set_aside`, `estimated_solicitation_release_date`, `estimated_award_start_date`, `estimated_award_value`, `descriptions`, `updated_at`, `federal_agency`, `place_of_performance`, `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`
  * `name`
  * `forecast_type`
  * `set_aside`
  * `estimated_solicitation_release_date`
  * `estimated_award_start_date`
  * `estimated_award_value`
  * `descriptions`
  * `updated_at`
  * `federal_agency`
  * `place_of_performance`
  * `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`
  * `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`

## Usage Patterns

Pattern A: Aggregations-only market shape for a forecast segment. Tool: `Search_Federal_Forecasts`

```json
{
  "query": "",
  "search_mode": "keyword",
  "aggregations": [
    "top_federal_agencies_by_doc_count",
    "top_set_aside_types_by_doc_count",
    "top_naics_codes_by_doc_count"
  ],
  "anticipated_award_start_date_range": {
    "from": "now/d",
    "to": "now+365d/d"
  },
  "estimated_solicitation_release_date_range": {
    "from": "now-90d/d",
    "to": "now+365d/d"
  },
  "sort": {
    "key": "_score",
    "direction": "desc"
  },
  "per_page": 0
}
```

Pattern B: Upcoming releases for a specific agency and NAICS area. Tool: `Search_Federal_Forecasts`

```json
{
  "query": "",
  "search_mode": "keyword",
  "fields_to_return": [
    "govtribe_id"
  ],
  "estimated_solicitation_release_date_range": {
    "from": "now/d",
    "to": "now+180d/d"
  },
  "federal_agency_ids": [
    "<FEDERAL_AGENCY_ID>"
  ],
  "forecast_type": [
    "Recompete",
    "New Requirement"
  ],
  "naics_category_ids": [
    "<NAICS_ID_OR_CODE>"
  ],
  "sort": {
    "key": "estimated_solicitation_release_date",
    "direction": "asc"
  },
  "per_page": 25
}
```

Pattern C: Semantic mission discovery seeded by a known entity. Tool: `Search_Federal_Forecasts`

```json
{
  "query": "zero trust network modernization for civilian agencies",
  "search_mode": "semantic",
  "fields_to_return": [
    "govtribe_id"
  ],
  "similar_filter": {
    "govtribe_type": "federal_forecast",
    "govtribe_id": "<FORECAST_ID>"
  },
  "sort": {
    "key": "_score",
    "direction": "desc"
  },
  "per_page": 10
}
```

Pattern D: Exclude known forecasts while monitoring new recompetes. Tool: `Search_Federal_Forecasts`

```json
{
  "query": "",
  "search_mode": "keyword",
  "fields_to_return": [
    "govtribe_id"
  ],
  "estimated_solicitation_release_date_range": {
    "from": "now/d",
    "to": "now+365d/d"
  },
  "federal_agency_ids": [
    "<FEDERAL_AGENCY_ID>"
  ],
  "forecast_type": [
    "Recompete"
  ],
  "sort": {
    "key": "anticipated_award_start_date",
    "direction": "asc"
  },
  "per_page": 20,
  "federal_forecast_ids": [
    "<KNOWN_FORECAST_ID_1>",
    "<KNOWN_FORECAST_ID_2>"
  ],
  "federal_forecast_ids_operator": "not_in"
}
```
