# Search Nigp Categories

`Search_Nigp_Categories` retrieves GovTribe NIGP category records used to classify goods and services in state and local procurement workflows.

## When To Use

* Which GovTribe NIGP category matches a user-provided code or known identifier?
* Which NIGP categories should be included or excluded before state/local market analysis?
* Which category IDs should be passed into downstream `nigp_category_ids` filters?
* Which NIGP categories are semantically related to a service area when exact wording is unknown?
* How many NIGP categories match a filter set when you only need metadata and a result-set identifier?

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

## 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.
  * Metadata-only calls with `per_page: 0` return summary/search-result keys and omit pagination row fields.
* Row keys:
  * `govtribe_id`
  * `govtribe_type`
  * `govtribe_url`
  * `name`
  * `code`
  * `updated_at`
  * `state_local_contract_opportunities`
* Relationship retrieval map:
  * `state_local_contract_opportunities`
    * `resource_type`: `state_local_contract_opportunity`
    * `tool`: `Search_State_And_Local_Contract_Opportunities`
    * `filter`: `state_and_local_contract_opportunity_ids`
    * `nested_keys`: `govtribe_id`, `govtribe_type`, `govtribe_url`, `name`

## Usage Patterns

Pattern A: Resolve a known NIGP code directly for downstream filter reuse. Tool: `Search_Nigp_Categories`

```json
{
  "search_mode": "keyword",
  "fields_to_return": [
    "govtribe_id"
  ],
  "page": 1,
  "per_page": 1,
  "nigp_category_ids": [
    "920"
  ],
  "nigp_category_ids_operator": "in"
}
```

Pattern B: Keyword lookup by category title keywords with no direct ID list. Tool: `Search_Nigp_Categories`

```json
{
  "query": "\"data processing\" | \"database software\"",
  "search_mode": "keyword",
  "fields_to_return": [
    "govtribe_id"
  ],
  "page": 1,
  "per_page": 10
}
```

Pattern C: Semantic discovery when users describe needs conceptually. Tool: `Search_Nigp_Categories`

```json
{
  "query": "software services for data integration and analytics",
  "search_mode": "semantic",
  "fields_to_return": [
    "govtribe_id"
  ],
  "page": 1,
  "per_page": 10
}
```

Pattern D: Exclude a known category set while exploring alternatives. Tool: `Search_Nigp_Categories`

```json
{
  "search_mode": "keyword",
  "fields_to_return": [
    "govtribe_id"
  ],
  "page": 1,
  "per_page": 25,
  "nigp_category_ids": [
    "920",
    "20837"
  ],
  "nigp_category_ids_operator": "not_in"
}
```

Pattern E: Metadata-only response for workflow orchestration. Tool: `Search_Nigp_Categories`

```json
{
  "search_mode": "keyword",
  "page": 1,
  "per_page": 0
}
```


---

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