# Search Federal Grant Opportunities

`Search_Federal_Grant_Opportunities` is the GovTribe MCP search tool for pre-award federal grant opportunity records, including eligibility framing, submission deadlines, issuing agencies, funding programs, and attached government files.

## When To Use

* Which federal grant opportunities are open now or due within a specific time window?
* Which opportunities match a mission topic, funding instrument, agency, or federal grant program?
* Which opportunities are `Posted` versus `Forecasted`?
* Which points of contact and government files are attached to matching opportunities?
* Which agencies or grant programs appear most often in a filtered grant-opportunity market slice?

## 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.

## 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`
* `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`
* `federal_grant_program_ids`: Filter by federal grant programs. Use GovTribe IDs.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
* `federal_grant_program_ids_operator`: Choose whether to include or exclude values for Federal Grant Program GovTribe IDs.
  * `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`
* `funding_activity_categories`: Filter by funding activity category.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
  * `options`: `Agriculture`, `Arts`, `Business and Commerce`, `Community Development`, `Consumer Protection`, `Disaster Prevention and Relief`, `Education`, `Employment, Labor and Training`, `Energy`, `Environment`, `Food and Nutrition`, `Health`, `Housing`, `Humanities`, `Income Security and Social Services`, `Information and Statistics`, `Law, Justice and Legal Services`, `Natural Resources`, `Other`, `Recovery Act`, `Regional Development`, `Science and Technology and other Research and Development`, `Transportation`
* `funding_activity_categories_operator`: Choose whether to include or exclude values for Funding Activity Categories.
  * `type`: `null|string`
  * `required`: `no`
  * `default`: `in`
  * `options`: `in`, `not_in`
* `funding_instrument_types`: Filter by funding instrument type.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
  * `options`: `Cooperative Agreement`, `Grant`, `Other`, `Procurement Contract`
* `funding_instrument_types_operator`: Choose whether to include or exclude values for Funding Instrument Types.
  * `type`: `null|string`
  * `required`: `no`
  * `default`: `in`
  * `options`: `in`, `not_in`
* `opportunity_types`: Filter by opportunity type.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
  * `options`: `Forecasted`, `Posted`
* `opportunity_types_operator`: Choose whether to include or exclude values for Opportunity 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_grant_opportunity_ids`: Include or exclude results by GovTribe IDs.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
* `federal_grant_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_points_of_contact_by_doc_count`, `top_federal_grant_programs_by_doc_count`
* `sort`: Sort configuration.
  * `type`: `object`
  * `required`: `no`
  * `default`: `n/a`
  * `shape`: `{ key?: null|string, direction?: null|string }`
  * `options`: `key`: `dueDate`, `postedDate`, `_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`, `assistance_type`, `funding_instruments`, `applicant_types`, `funding_activity_categories`, `posted_date`, `due_date`, `description`, `updated_at`, `federal_agency`, `place_of_performance`, `government_files`, `federal_grant_programs`, `points_of_contact`

## Output Contract

* Top-level keys:
  * `data`: Array of result rows when `per_page > 0`.
  * `current_page`, `from`, `to`, `last_page`, `per_page`: pagination metadata when rows are requested.
  * `path`: GovTribe search URL for this result set.
  * `total`: Total matched row count for current query filters.
  * `contains`: Dataset label for the returned result set.
  * `search_results_id`, `search_results_id_can_generate_saved_search`, `view_search_results_url`: search-session metadata for saved-search and UI flows.
  * `aggregations`: Aggregation payload keyed by requested aggregation names when requested.
* Row keys:
  * `govtribe_id`
  * `govtribe_ai_summary`
  * `govtribe_type`
  * `govtribe_url`
  * `solicitation_number`
  * `name`
  * `assistance_type`
  * `funding_instruments`
  * `applicant_types`
  * `funding_activity_categories`
  * `posted_date`
  * `due_date`
  * `description`
  * `updated_at`
  * `federal_agency`
  * `place_of_performance`
  * `government_files`
  * `federal_grant_programs`
  * `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_grant_programs`
    * `resource_type`: `federal_grant_program`
    * `tool`: `Search_Federal_Grant_Programs`
    * `filter`: `federal_grant_program_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`
  * `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: Open posted opportunities due in the next 30 days for a topic. Tool: `Search_Federal_Grant_Opportunities`

```json
{
  "query": "community mental health",
  "search_mode": "semantic",
  "fields_to_return": [
    "govtribe_id"
  ],
  "due_date_range": {
    "from": "now/d",
    "to": "now+30d/d"
  },
  "opportunity_types": [
    "Posted"
  ],
  "sort": {
    "key": "dueDate",
    "direction": "asc"
  },
  "page": 1,
  "per_page": 20
}
```

Pattern B: Aggregation-only view of top agencies, contacts, and grant programs for current opportunities. Tool: `Search_Federal_Grant_Opportunities`

```json
{
  "query": "",
  "search_mode": "keyword",
  "aggregations": [
    "top_federal_agencies_by_doc_count",
    "top_points_of_contact_by_doc_count"
  ],
  "due_date_range": {
    "from": "now-180d/d",
    "to": "now/d"
  },
  "sort": {
    "key": "_score",
    "direction": "desc"
  },
  "per_page": 0
}
```

Pattern C: Program-targeted opportunity retrieval after resolving program IDs. Tool: `Search_Federal_Grant_Opportunities`

```json
{
  "query": "",
  "search_mode": "keyword",
  "fields_to_return": [
    "govtribe_id"
  ],
  "federal_grant_program_ids": [
    "<FEDERAL_GRANT_PROGRAM_ID>"
  ],
  "federal_grant_program_ids_operator": "in",
  "opportunity_types": [
    "Posted"
  ],
  "posted_date": {
    "from": "2025-01-01",
    "to": null
  },
  "sort": {
    "key": "postedDate",
    "direction": "desc"
  },
  "page": 1,
  "per_page": 25
}
```

Pattern D: Forecasted opportunities for pipeline planning. Tool: `Search_Federal_Grant_Opportunities`

```json
{
  "query": "water infrastructure resilience",
  "search_mode": "semantic",
  "fields_to_return": [
    "govtribe_id"
  ],
  "opportunity_types": [
    "Forecasted"
  ],
  "sort": {
    "key": "postedDate",
    "direction": "desc"
  },
  "page": 1,
  "per_page": 20
}
```
