Skip to content

feat(core,mcp): source-targeted search via SearchInput.sources#23

Merged
MyPrototypeWhat merged 1 commit into
mainfrom
feat/search-sources
Jul 24, 2026
Merged

feat(core,mcp): source-targeted search via SearchInput.sources#23
MyPrototypeWhat merged 1 commit into
mainfrom
feat/search-sources

Conversation

@MyPrototypeWhat

Copy link
Copy Markdown
Collaborator

What

Adds SearchInput.sources?: string[] — restrict a search's fan-out to the named provider ids (intersected with modality matching). Lets a caller scope search-engine operators (e.g. site: queries on a web-discovery source) without polluting every other provider's shared query text.

Semantics

  • sources omitted → fan out to all configured providers (unchanged).
  • Named ids ∩ registered providers = ∅ → throws a self-explaining error (a typo must not silently become "no results").
  • Individually unknown ids (others still match) → meta.warnings entry.
  • Unselected providers appear in meta as skipped with a dedicated reason, parallel to unsupported-modality.
  • Cursor round-trips with sources unchanged (page/seen semantics are global).

MCP

search_references tool schema gains sources?: string[]; unknown-source errors are rewrapped listing the enabled source ids.

Verification (post-rebase onto d27619d)

  • pnpm typecheck exit 0 · pnpm vitest run 386 passed / 22 skipped / 0 failed · lint clean
  • New tests: selection, empty-intersection throw, unknown-id warning, skipped reason, modality interaction, sources+cursor round-trip.

Note: touches the same mcp files as the provider-nailbook PR; whichever lands second needs a trivial rebase.

Add `SearchInput.sources?: string[]` to @refkit/core: restrict a search to
specific provider ids (intersected with modality matching), so a caller can
scope a search-engine operator (e.g. `site:xiaohongshu.com` on Brave) to one
web-discovery source without polluting the other providers' queries. Omit it
to fan out to every configured source, unchanged.

Selection stays fail-loud: a `sources` list matching no provider for the
requested modalities throws (a typo must not read as "no results"); an id that
resolves to nothing while others still match goes to `meta.warnings`. Providers
excluded by an explicit `sources` filter report `reason: 'not-selected'` in
`meta.providers`, distinct from `'unsupported-modality'`.

@refkit/mcp `search_references` gains a `sources` param (its description
enumerates the server's enabled source ids) and turns a source-selection miss
into an agent-friendly tool error listing the valid ids.
@MyPrototypeWhat
MyPrototypeWhat merged commit 5099ce4 into main Jul 24, 2026
1 check passed
@MyPrototypeWhat
MyPrototypeWhat deleted the feat/search-sources branch July 24, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant