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

## 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`
  * `award_ceiling`
  * `award_floor`
  * `funding_instruments`
  * `applicant_types`
  * `funding_activity_categories`
  * `posted_date`
  * `due_date`
  * `forecast_posting_date`
  * `forecast_due_date`
  * `description`
  * `updated_at`
  * `federal_agency`
  * `place_of_performance`
  * `government_files`
  * `federal_grant_programs`
  * `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_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`, `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`

## 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
{
  "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
{
  "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
}
```


---

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