# Search Federal Transactions

`Search_Federal_Transactions` returns federal contract transaction rows sourced from FPDS transaction-level activity, including obligation amounts, modification context, agencies, and awardee linkage.

## When To Use

Typical questions this tool answers well:

* Which transaction lines are associated with a known award, IDV, or vehicle?
* What are the latest modifications for a contract lineage, sorted by transaction date?
* How much was obligated in a filtered slice, and who are the top awardees/agencies/categories by obligated dollars?
* Which transactions match a set-aside, NAICS, PSC, vendor, or agency constraint?
* How do funding agencies differ from contracting agencies for a given transaction cohort?

## Required Reading

1. [Search\_Query\_Guide](https://docs.govtribe.com/user-guide/mcp/guides/search_query_guide): Required before setting free-text query strings.

## 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`
* `federal_contract_award_ids`: Filter by federal contract awards. Use GovTribe IDs.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
* `federal_contract_award_ids_operator`: Choose whether to include or exclude values for Federal Contract Award GovTribe IDs.
  * `type`: `null|string`
  * `required`: `no`
  * `default`: `in`
  * `options`: `in`, `not_in`
* `federal_contract_idv_ids`: Filter by federal contract IDVs. Use GovTribe IDs.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
* `federal_contract_idv_ids_operator`: Choose whether to include or exclude values for Federal Contract IDV GovTribe IDs.
  * `type`: `null|string`
  * `required`: `no`
  * `default`: `in`
  * `options`: `in`, `not_in`
* `contracting_federal_agency_ids`: Filter by contracting federal agencies (who signed the contract). Use GovTribe IDs.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
* `contracting_federal_agency_ids_operator`: Choose whether to include or exclude values for Contracting Federal Agency GovTribe IDs.
  * `type`: `null|string`
  * `required`: `no`
  * `default`: `in`
  * `options`: `in`, `not_in`
* `funding_federal_agency_ids`: Filter by funding federal agencies (who own the money). Use GovTribe IDs.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
* `funding_federal_agency_ids_operator`: Choose whether to include or exclude values for Funding Federal Agency GovTribe IDs.
  * `type`: `null|string`
  * `required`: `no`
  * `default`: `in`
  * `options`: `in`, `not_in`
* `federal_contract_vehicle_ids`: Filter by federal contract vehicles. Use GovTribe IDs.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
* `federal_contract_vehicle_ids_operator`: Choose whether to include or exclude values for Federal Contract Vehicle GovTribe IDs.
  * `type`: `null|string`
  * `required`: `no`
  * `default`: `in`
  * `options`: `in`, `not_in`
* `naics_category_ids`: Filter by NAICS categories. Use GovTribe IDs or NAICS codes.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
* `naics_category_ids_operator`: Choose whether to include or exclude values for NAICS Category IDs (GovTribe or NAICS code).
  * `type`: `null|string`
  * `required`: `no`
  * `default`: `in`
  * `options`: `in`, `not_in`
* `psc_category_ids`: Filter by PSC categories. Use GovTribe IDs or PSC codes.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
* `psc_category_ids_operator`: Choose whether to include or exclude values for PSC Category IDs (GovTribe or PSC code).
  * `type`: `null|string`
  * `required`: `no`
  * `default`: `in`
  * `options`: `in`, `not_in`
* `vendor_ids`: Filter by vendors. Use GovTribe IDs or vendor UEIs.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
* `vendor_ids_operator`: Choose whether to include or exclude values for Vendor IDs (GovTribe or UEI).
  * `type`: `null|string`
  * `required`: `no`
  * `default`: `in`
  * `options`: `in`, `not_in`
* `set_aside_types`: Filter by the set-aside designations for small businesses.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
  * `options`: `No Set-Aside Used`, `Partial Small Business`, `Total Small Business`, `8(a) Sole Source`, `Competitive 8(a)`, `Buy Indian`, `Indian Small Business Economic Enterprise`, `HUBZone Sole Source`, `HUBZone`, `Service-Disabled Veteran-Owned Small Business Sole Source`, `Service-Disabled Veteran-Owned Small Business`, `Veteran Sole Source`, `Veteran-Owned Small Business`, `Economically Disadvantaged Woman-Owned Small Business`, `Woman-Owned Small Business Sole Source`, `Woman-Owned Small Business`
* `set_aside_types_operator`: Choose whether to include or exclude values for Set-Aside Types.
  * `type`: `null|string`
  * `required`: `no`
  * `default`: `in`
  * `options`: `in`, `not_in`
* `federal_transaction_ids`: Include or exclude results by GovTribe IDs.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
* `federal_transaction_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_set_aside_types_by_dollars_obligated`, `top_awardees_by_dollars_obligated`, `top_funding_federal_agencies_by_dollars_obligated`, `top_contracting_federal_agencies_by_dollars_obligated`, `top_locations_by_dollars_obligated`, `top_idvs_by_dollars_obligated`, `top_federal_contract_vehicles_by_dollars_obligated`, `top_naics_codes_by_dollars_obligated`, `top_psc_codes_by_dollars_obligated`
* `sort`: Sort configuration.
  * `type`: `object`
  * `required`: `no`
  * `default`: `n/a`
  * `shape`: `{ key?: null|string, direction?: null|string }`
  * `options`: `key`: `transactionDate`, `federalValue`; `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_type`, `date`, `last_mod_number`, `reason_for_modification`, `total_value`, `federal_value`, `non_federal_value`, `updated_at`, `awardee`, `funding_federal_agency`, `contracting_federal_agency`

## 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_type`
  * `date`
  * `last_mod_number`
  * `reason_for_modification`
  * `total_value`
  * `federal_value`
  * `non_federal_value`
  * `updated_at`
  * `awardee`
  * `funding_federal_agency`
  * `contracting_federal_agency`
* Relationship retrieval map:
  * `awardee`
    * `resource_type`: `vendor`
    * `tool`: `Search_Vendors`
    * `filter`: `vendor_ids`
    * `nested_keys`: `govtribe_id`, `govtribe_type`, `name`, `uei`, `govtribe_url`
  * `contracting_federal_agency`
    * `resource_type`: `federal_agency`
    * `tool`: `Search_Federal_Agencies`
    * `filter`: `federal_agency_ids`
    * `nested_keys`: `govtribe_id`, `govtribe_type`, `govtribe_url`, `name`
  * `funding_federal_agency`
    * `resource_type`: `federal_agency`
    * `tool`: `Search_Federal_Agencies`
    * `filter`: `federal_agency_ids`
    * `nested_keys`: `govtribe_id`, `govtribe_type`, `govtribe_url`, `name`

## Usage Patterns

Pattern A: Aggregation-only obligated-dollar profile for a funding agency. Tool: `Search_Federal_Transactions`

```json
{
  "query": "",
  "aggregations": [
    "dollars_obligated_stats",
    "top_awardees_by_dollars_obligated",
    "top_contracting_federal_agencies_by_dollars_obligated"
  ],
  "funding_federal_agency_ids": [
    "<FEDERAL_AGENCY_ID>"
  ],
  "funding_federal_agency_ids_operator": "in",
  "per_page": 0
}
```

Pattern B: Latest transaction lines for a known award ID. Tool: `Search_Federal_Transactions`

```json
{
  "query": "",
  "fields_to_return": [
    "govtribe_id"
  ],
  "federal_contract_award_ids": [
    "<AWARD_GOVTRIBE_ID>"
  ],
  "federal_contract_award_ids_operator": "in",
  "sort": {
    "key": "transactionDate",
    "direction": "desc"
  },
  "page": 1,
  "per_page": 25
}
```

Pattern C: Set-aside plus category slice with top vendors and vehicles. Tool: `Search_Federal_Transactions`

```json
{
  "query": "",
  "fields_to_return": [
    "govtribe_id"
  ],
  "aggregations": [
    "top_awardees_by_dollars_obligated",
    "top_federal_contract_vehicles_by_dollars_obligated",
    "top_naics_codes_by_dollars_obligated",
    "top_psc_codes_by_dollars_obligated"
  ],
  "naics_category_ids": [
    "<NAICS_ID_OR_CODE>"
  ],
  "naics_category_ids_operator": "in",
  "psc_category_ids": [
    "<PSC_ID_OR_CODE>"
  ],
  "psc_category_ids_operator": "in",
  "set_aside_types": [
    "Total Small Business"
  ],
  "set_aside_types_operator": "in",
  "per_page": 0
}
```

Pattern D: Exclusion workflow to remove known noisy entities while reviewing rows. Tool: `Search_Federal_Transactions`

```json
{
  "query": "",
  "fields_to_return": [
    "govtribe_id"
  ],
  "contracting_federal_agency_ids": [
    "<EXCLUDED_CONTRACTING_AGENCY_ID>"
  ],
  "contracting_federal_agency_ids_operator": "not_in",
  "sort": {
    "key": "transactionDate",
    "direction": "desc"
  },
  "vendor_ids": [
    "<EXCLUDED_VENDOR_ID_OR_UEI>"
  ],
  "vendor_ids_operator": "not_in",
  "page": 1,
  "per_page": 50
}
```
