# Search State And Local Contract IDVs

`Search_State_And_Local_Contract_IDVs` returns state and local IDV records that capture parent contract structure, term windows, direct parent vehicle links when available, and linked award activity.

## When To Use

Typical questions this tool answers well:

* Which state/local contract IDVs match a contract name, topic, issuing entity, or state?
* Which IDVs are active in specific NIGP or UNSPSC categories?
* Which states or category codes dominate a filtered IDV market segment?
* Which points of contact, parent vehicles, or related awards are attached to a target IDV?
* Which IDVs are similar to a known state/local award, IDV, opportunity, vehicle, vendor, or file?

## 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`
  * `name`
  * `description`
  * `awardee_name`
  * `contracting_organization`
  * `award_date`
  * `potential_completion_date`
  * `contract_number`
  * `contract_type`
  * `state`
  * `state_local_contract_vehicle`
  * `line_items`
  * `unspsc_categories`
  * `nigp_categories`
  * `government_files`
  * `state_local_contract_awards`
  * `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`
  * `line_items`
    * `resource_type`: `line_item`
    * `tool`: `Search_Line_Items`
    * `filter`: `line_item_ids`
    * `nested_keys`: `govtribe_id`, `govtribe_type`, `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_vehicle`
    * `resource_type`: `state_local_contract_vehicle`
    * `tool`: `Search_State_And_Local_Contract_Vehicles`
    * `filter`: `state_local_contract_vehicle_ids`
    * `nested_keys`: `govtribe_id`, `govtribe_type`, `govtribe_url`, `name`
  * `state_local_contract_awards`
    * `resource_type`: `state_local_contract_award`
    * `tool`: `Search_State_And_Local_Contract_Awards`
    * `filter`: `state_and_local_contract_award_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 IDV lookup by known identifier or phrase. Tool: `Search_State_And_Local_Contract_IDVs`

```json
{
  "query": "\"SLP-25-70-0184H\"",
  "search_mode": "keyword",
  "fields_to_return": [
    "govtribe_id"
  ],
  "page": 1,
  "per_page": 10,
  "sort": {
    "key": "awardDate",
    "direction": "desc"
  }
}
```

Pattern B: Filter IDVs by state and category codes. Tool: `Search_State_And_Local_Contract_IDVs`

```json
{
  "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": [
    "CA",
    "TX"
  ],
  "state_ids_operator": "in",
  "nigp_category_ids": [
    "92040",
    "92045"
  ],
  "nigp_category_ids_operator": "in",
  "unspsc_category_ids": [
    "43231500"
  ],
  "unspsc_category_ids_operator": "in"
}
```

Pattern C: Similarity search from a known state/local award or opportunity. Tool: `Search_State_And_Local_Contract_IDVs`

```json
{
  "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_award",
    "govtribe_id": "<STATE_LOCAL_CONTRACT_AWARD_ID>"
  }
}
```

Pattern D: Aggregation-only market profile for state/entity/category concentration. Tool: `Search_State_And_Local_Contract_IDVs`

```json
{
  "search_mode": "keyword",
  "per_page": 0,
  "aggregations": [
    "dollars_obligated_stats",
    "top_states_by_doc_count",
    "top_contract_entities_by_dollars_obligated",
    "top_nigp_codes_by_dollars_obligated",
    "top_unspsc_codes_by_dollars_obligated"
  ],
  "sort": {
    "key": "_score",
    "direction": "desc"
  },
  "award_date_range": {
    "from": "now-3y/d",
    "to": "now/d"
  },
  "state_ids": [
    "OH",
    "FL"
  ]
}
```

Then rerun with `per_page > 0` and the same filters when you need row-level entities after reviewing rollups.

Pattern E: Pull rows plus aggregations for a single request. Tool: `Search_State_And_Local_Contract_IDVs`

```json
{
  "query": "software license program",
  "search_mode": "keyword",
  "fields_to_return": [
    "govtribe_id"
  ],
  "page": 1,
  "per_page": 15,
  "aggregations": [
    "top_states_by_doc_count",
    "top_nigp_codes_by_doc_count"
  ],
  "sort": {
    "direction": "desc",
    "key": "_score"
  }
}
```


---

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