# Search State And Local Contract Vehicles

`Search_State_And_Local_Contract_Vehicles` returns state and local contract vehicle records with scope context, timeline fields, and nested related IDVs.

## When To Use

Typical questions this tool answers well:

* Which state and local contract vehicles match a known vehicle name, issuing organization, or contract identifier phrase?
* Which states have the largest concentration of vehicle records under a category or date window?
* Which vehicles align to specific NIGP or UNSPSC categories for a product or service area?
* Which points of contact and child state/local IDVs are attached to a selected vehicle?
* Which vehicles look similar to a known state/local award, IDV, opportunity, or other GovTribe record?
* Which vehicle segments should be monitored with saved searches after initial market rollup?

## 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`
* `award_date_range`: Filter by the date the award was issued. 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 }`
* `state_ids`: Filter by states. Use GovTribe IDs or USPS state codes. 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`
* `state_ids_operator`: Choose whether to include or exclude values for State IDs (GovTribe or USPS code).
  * `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`
* `nigp_category_ids`: Filter by NIGP categories. Use GovTribe IDs or NIGP codes.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
* `nigp_category_ids_operator`: Choose whether to include or exclude values for NIGP Category IDs (GovTribe or NIGP code).
  * `type`: `null|string`
  * `required`: `no`
  * `default`: `in`
  * `options`: `in`, `not_in`
* `unspsc_category_ids`: Filter by UNSPSC categories. Use GovTribe IDs or UNSPSC codes.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
* `unspsc_category_ids_operator`: Choose whether to include or exclude values for UNSPSC Category IDs (GovTribe or UNSPSC code).
  * `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 }`
* `state_and_local_contract_vehicle_ids`: Include or exclude results by GovTribe IDs.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
* `state_and_local_contract_vehicle_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`: `dollars_obligated_stats`, `top_nigp_codes_by_dollars_obligated`, `top_unspsc_codes_by_dollars_obligated`, `top_states_by_dollars_obligated`, `top_contract_entities_by_dollars_obligated`, `top_states_by_doc_count`, `top_unspsc_codes_by_doc_count`, `top_nigp_codes_by_doc_count`
* `sort`: Sort configuration.
  * `type`: `object`
  * `required`: `no`
  * `default`: `n/a`
  * `shape`: `{ key?: null|string, direction?: null|string }`
  * `options`: `key`: `awardDate`, `_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`, `description`, `contracting_organization`, `award_date`, `potential_completion_date`, `contract_type`, `state`, `unspsc_categories`, `nigp_categories`, `government_files`, `state_local_contract_idvs`, `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`
  * `description`
  * `contracting_organization`
  * `award_date`
  * `potential_completion_date`
  * `contract_type`
  * `state`
  * `unspsc_categories`
  * `nigp_categories`
  * `government_files`
  * `state_local_contract_idvs`
  * `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`
  * `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`
  * `state_local_contract_idvs`
    * `resource_type`: `state_local_contract_idv`
    * `tool`: `Search_State_And_Local_Contract_IDVs`
    * `filter`: `state_and_local_contract_i_d_v_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: Exact vehicle lookup by known title or identifier phrase. Tool: `Search_State_And_Local_Contract_Vehicles`

```json
{
  "query": "\"380-M1_FY26\"",
  "search_mode": "keyword",
  "fields_to_return": [
    "govtribe_id"
  ],
  "page": 1,
  "per_page": 10,
  "sort": {
    "key": "awardDate",
    "direction": "desc"
  }
}
```

Pattern B: Filter vehicles by state and procurement categories. Tool: `Search_State_And_Local_Contract_Vehicles`

```json
{
  "query": "",
  "search_mode": "keyword",
  "fields_to_return": [
    "govtribe_id"
  ],
  "page": 1,
  "per_page": 25,
  "sort": {
    "key": "_score",
    "direction": "desc"
  },
  "award_date_range": {
    "from": "now-5y/d",
    "to": "now/d"
  },
  "state_ids": [
    "TX",
    "CA"
  ],
  "state_ids_operator": "in",
  "nigp_category_ids": [
    "92040"
  ],
  "nigp_category_ids_operator": "in",
  "unspsc_category_ids": [
    "43231500"
  ],
  "unspsc_category_ids_operator": "in"
}
```

Pattern C: Exclude already-reviewed vehicles while continuing a market scan. Tool: `Search_State_And_Local_Contract_Vehicles`

```json
{
  "query": "cloud hosting services",
  "search_mode": "keyword",
  "fields_to_return": [
    "govtribe_id"
  ],
  "page": 1,
  "per_page": 20,
  "sort": {
    "key": "_score",
    "direction": "desc"
  },
  "state_and_local_contract_vehicle_ids": [
    "<VEHICLE_ID_1>",
    "<VEHICLE_ID_2>"
  ],
  "state_and_local_contract_vehicle_ids_operator": "not_in"
}
```

Pattern D: Aggregation-first market profile by state and category concentration. Tool: `Search_State_And_Local_Contract_Vehicles`

```json
{
  "query": "",
  "search_mode": "keyword",
  "per_page": 0,
  "aggregations": [
    "dollars_obligated_stats",
    "top_states_by_doc_count",
    "top_nigp_codes_by_doc_count",
    "top_unspsc_codes_by_doc_count"
  ],
  "sort": {
    "key": "_score",
    "direction": "desc"
  },
  "award_date_range": {
    "from": "now-3y/d",
    "to": "now/d"
  }
}
```

After rollups, rerun with `per_page > 0` and the same filters to retrieve row-level entities.

Pattern E: Semantic similarity search from a known state/local opportunity. Tool: `Search_State_And_Local_Contract_Vehicles`

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