# Search User Files

`Search_User_Files` is the GovTribe MCP dataset tool for searching team-uploaded files in workspace capture workflows; if content beyond `content_snippet` is needed, call `Documentation` with `article_name="Vector_Store_Content_Retrieval_Guide"`, then use `Add_To_Vector_Store` and `Search_Vector_Store`.

## When To Use

Typical questions this tool answers well:

* Which internal file in our workspace matches this exact GovTribe file ID?
* What uploaded files mention a specific topic or phrase across file content?
* Which team files are tied to a specific opportunity, IDV, jurisdiction, or state context?
* How can I pull a compact file set first, then run deeper content retrieval in a vector store?
* How can I return metadata-only search result identifiers before requesting row payloads?

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

## 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`
* `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 }`
* `user_file_ids`: Include or exclude results by GovTribe IDs.
  * `type`: `array<string>`
  * `required`: `no`
  * `default`: `n/a`
* `user_file_ids_operator`: Choose whether to include or exclude values for GovTribe IDs.
  * `type`: `null|string`
  * `required`: `no`
  * `default`: `in`
  * `options`: `in`, `not_in`
* `sort`: Sort configuration.
  * `type`: `object`
  * `required`: `no`
  * `default`: `n/a`
  * `shape`: `{ key?: null|string, direction?: null|string }`
  * `options`: `key`: `updated_at`, `created_at`, `_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`, `content`, `created_at`, `description`, `download_url`, `content_snippet`, `name`, `size`, `updated_at`

## 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.
  * `per_page: 0 behavior`: returns metadata keys above without `data` and page-window keys.
* Row keys:
  * `govtribe_id`
  * `govtribe_ai_summary`
  * `govtribe_type`
  * `govtribe_url`
  * `content`
  * `created_at`
  * `description`
  * `download_url`
  * `content_snippet`
  * `name`
  * `size`
  * `updated_at`
* Relationship retrieval map:
  * `none`: This resource has no relationship fields.

## Usage Patterns

Pattern A: Resolve one known user file by GovTribe file ID. Tool: `Search_User_Files`

```json
{
  "query": "",
  "search_mode": "keyword",
  "fields_to_return": [
    "govtribe_id"
  ],
  "page": 1,
  "per_page": 1,
  "user_file_ids": [
    "<USER_FILE_ID>"
  ],
  "user_file_ids_operator": "in"
}
```

Pattern B: Semantic exploration for concept-level internal file discovery. Tool: `Search_User_Files`

```json
{
  "query": "intelligence analyst support statement of work",
  "search_mode": "semantic",
  "fields_to_return": [
    "govtribe_id"
  ],
  "page": 1,
  "per_page": 5
}
```

Pattern C: Find files similar to a known file-like entity. Tool: `Search_User_Files`

```json
{
  "query": "",
  "search_mode": "semantic",
  "fields_to_return": [
    "govtribe_id"
  ],
  "similar_filter": {
    "govtribe_type": "user_file",
    "govtribe_id": "<USER_FILE_ID>"
  },
  "page": 1,
  "per_page": 10
}
```

Pattern D: Metadata-only call to get totals and result-set identifiers. Tool: `Search_User_Files`

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