# Search State And Local Contract Opportunities

`Search_State_And_Local_Contract_Opportunities` is the GovTribe MCP search surface for state and local solicitations.

## When To Use

Typical questions this tool answers well:

* Which current or recent state and local opportunities match a topic, state, jurisdiction, or due-date window?
* Which opportunities are associated with specific NIGP or UNSPSC categories?
* Which opportunities are tied to known GovTribe IDs for contacts, jurisdictions, states, or opportunity records?
* Which opportunities should be monitored as a recurring market segment using saved-search capable results?
* Which related files, contacts, and category records are attached to matching opportunities?

## 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`
  * `posted_date`
  * `due_date`
  * `description`
  * `updated_at`
  * `state`
  * `jurisdictions`
  * `government_files`
  * `unspsc_categories`
  * `nigp_categories`
  * `points_of_contact`
* Relationship retrieval map:
  * `government_files`
    * `resource_type`: `government_file`
    * `tool`: `Search_Government_Files`
    * `filter`: `government_file_ids`
    * `nested_keys`: `govtribe_id`, `govtribe_type`, `govtribe_url`, `name`
  * `jurisdictions`
    * `resource_type`: `jurisdiction`
    * `tool`: `Search_Jurisdictions`
    * `filter`: `jurisdiction_ids`
    * `nested_keys`: `govtribe_id`, `govtribe_type`, `govtribe_url`, `name`
  * `nigp_categories`
    * `resource_type`: `nigp_category`
    * `tool`: `Search_Nigp_Categories`
    * `filter`: `nigp_category_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`
  * `state`
    * `resource_type`: `state`
    * `tool`: `Search_States`
    * `filter`: `state_ids`
    * `nested_keys`: `govtribe_id`, `govtribe_type`, `govtribe_url`, `name`
  * `unspsc_categories`
    * `resource_type`: `unspsc_category`
    * `tool`: `Search_Unspsc_Categories`
    * `filter`: `unspsc_category_ids`
    * `nested_keys`: `govtribe_id`, `govtribe_type`, `govtribe_url`, `name`

## Usage Patterns

Pattern A: Topic and state monitoring for active upcoming opportunities. Tool: `Search_State_And_Local_Contract_Opportunities`

```json
{
  "query": "cybersecurity managed services",
  "search_mode": "semantic",
  "fields_to_return": [
    "govtribe_id"
  ],
  "due_date_range": {
    "from": "now/d",
    "to": null
  },
  "posted_date": {
    "from": "now-90d/d",
    "to": "now/d"
  },
  "sort": {
    "key": "dueDate",
    "direction": "asc"
  },
  "state_ids": [
    "TX"
  ],
  "page": 1,
  "per_page": 25
}
```

Pattern B: Aggregation-only market sizing by state, jurisdiction, and taxonomy. Tool: `Search_State_And_Local_Contract_Opportunities`

```json
{
  "search_mode": "keyword",
  "aggregations": [
    "top_states_by_doc_count",
    "top_jurisdictions_by_doc_count",
    "top_unspsc_codes_by_doc_count",
    "top_nigp_codes_by_doc_count"
  ],
  "posted_date": {
    "from": "now-365d/d",
    "to": "now/d"
  },
  "sort": {
    "key": "_score",
    "direction": "desc"
  },
  "page": 1,
  "per_page": 0
}
```

Pattern C: Precise lookup for known jurisdiction and NIGP code with exclusion filters. Tool: `Search_State_And_Local_Contract_Opportunities`

```json
{
  "search_mode": "keyword",
  "fields_to_return": [
    "govtribe_id"
  ],
  "jurisdiction_ids": [
    "<JURISDICTION_ID_OR_FIPS>"
  ],
  "jurisdiction_ids_operator": "in",
  "nigp_category_ids": [
    "920"
  ],
  "nigp_category_ids_operator": "in",
  "posted_date": {
    "from": "now-180d/d",
    "to": "now/d"
  },
  "sort": {
    "key": "postedDate",
    "direction": "desc"
  },
  "state_ids": [
    "<EXCLUDED_STATE_ID_OR_USPS>"
  ],
  "state_ids_operator": "not_in",
  "page": 1,
  "per_page": 20
}
```

Pattern D: Similar-opportunity discovery from a known related record. Tool: `Search_State_And_Local_Contract_Opportunities`

```json
{
  "search_mode": "semantic",
  "fields_to_return": [
    "govtribe_id"
  ],
  "similar_filter": {
    "govtribe_type": "state_local_contract_opportunity",
    "govtribe_id": "<OPPORTUNITY_GOVTRIBE_ID>"
  },
  "sort": {
    "key": "_score",
    "direction": "desc"
  },
  "page": 1,
  "per_page": 10
}
```


---

# 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-state-and-local-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.
