`searchExternalContent` is the agent's MCP tool for searching content synced from the six external connectors (Slack, Gmail, Outlook, SharePoint, OneDrive, Google Drive). Returns ranked messages and documents with snippets and links back to the vendor.
## Search semantics
The tool combines two retrieval paths via Reciprocal Rank Fusion (k=60), mirroring how hybridSearch works over Kodori documents:
- **Postgres FTS** — `websearch_to_tsquery` + `ts_rank_cd` against weighted tsvector expressions over `(subject, body)` for messages or `(name, text)` for documents. GIN expression indexes (migration 0084) keep this sub-millisecond at scale. Snippets come from `ts_headline` so matched terms are wrapped in `<mark>` and the agent gets a legible preview. - **pgvector cosine similarity** — query embedded via OpenAI text-embedding-3-small (must match the embed-document model so query and indexed vectors live in the same embedding space). HNSW indexes from migration 0083 keep this fast at corpus size.
A row that appears in both lists wins over one that appears in only one — the canonical RRF property. Each hit returns `source: 'keyword' | 'semantic' | 'both'` so the agent knows which path matched.
## Inputs
- **query** (required) — natural-language string; quotes, OR keyword, minus signs all work via `websearch_to_tsquery` - **kind** (optional) — restrict to one of `slack`, `gmail`, `outlook`, `sharepoint`, `onedrive`, `google-drive` - **limit** (optional, default 20, max 100)
## Permission model
Tenant-scoped — only authorized connectors (`status='connected'`) contribute. Pause or revoke a connector and it falls out of search on the next call. v1 design: anyone in the tenant can search authorized connector content via the agent.
## Graceful fallback
When `OPENAI_API_KEY` is unset (e.g. BYO-Anthropic-via-Bedrock deployments), semantic ranking degrades cleanly to FTS-only. The agent still gets useful results, just keyword-matched rather than concept-matched. The response shape is identical (just `source: 'keyword'` for everything).