Repository navigation
Description
Summary
SearchService exposes no way to enumerate the distinct values present in the registry for a given record field. Clients that build filter UIs (a paginated catalog, a TUI such as lazydir) therefore cannot populate filter panels — skills, domains, modules, authors, versions, schema-versions — without fetching every record and aggregating client-side, which is exactly what pagination is meant to avoid.
Motivation
There is already a distinct-values query on the catalog side — AIFinderService.ListTags → ListCatalogTags (server/database/gorm/catalog.go) — but it lives behind the AI-Catalog projection service, covers only skills/domains/annotations, and is shaped for the catalog UI. General clients that talk to SearchService (CLI, TUIs, scripts) have no equivalent. This is the same layering argument as CountRecords (#1939): a general concern belongs on the general API, not behind the catalog projection.
Putting it on SearchService also means it is callable by any client immediately, since SearchServiceClient is already embedded in client.Client.
Proposal
Add a distinct-values RPC to SearchService, reusing RecordQueryType as the field selector so no new field vocabulary is introduced:
rpc ListRecordValues(ListRecordValuesRequest) returns (ListRecordValuesResponse);
message ListRecordValuesRequest {
// Which fields to return distinct values for. Empty = all supported fields.
repeated RecordQueryType fields = 1;
}
message ListRecordValuesResponse {
message FieldValues {
RecordQueryType field = 1;
repeated string values = 2;
}
repeated FieldValues fields = 1;
}Supported fields: SKILL_NAME, DOMAIN_NAME, MODULE_NAME, AUTHOR, VERSION, SCHEMA_VERSION. The name variants are used (not the numeric *_ID types) so every value is a human-meaningful string. Values are returned registry-wide (global distinct), like ListTags today — no query/facet context (YAGNI; can be added later if contextual faceting is needed).
Implementation notes
- Reuse the existing
DISTINCTpluck approach already used byListCatalogTags(distinctnamefromskills/domains) and extend it tomodules,versions, andschema_versions. - Do not apply the catalog module restriction (
applyKnownCatalogModuleFilter). Return values across the whole registry, including records without an MCP/A2A/AgentSkills module.ListCatalogTagsalready omits the restriction, which is the desired behavior here too. - Authors are the one non-trivial field: they are stored as a JSON array on
records(seeRecordFilters.Authors, JSON-array search), so distinct authors requires unnesting/extracting from the JSON array rather than a plain columnDISTINCT. - Sort each field's values lexicographically (as
ListCatalogTagssorts by label). - Wire it the same way as
CountRecords: a controller method inserver/controller/search.goand a method on theSearchDatabaseAPIinterface (server/types/database.go) backed by the GORM layer.
Consolidation
The catalog UI's ListTags is a near-subset of this (skills/domains/annotations). Once this exists, ListCatalogTags could be reimplemented on top of it or share a DB helper, giving both the catalog UI and general clients one source of truth for distinct values. Left to maintainers' discretion.
References
proto/agntcy/dir/search/v1/search_service.proto(add RPC),record_query.proto(RecordQueryTypereused as field selector)server/database/gorm/catalog.go—ListCatalogTags(DISTINCTpluck precedent)server/controller/search.go—CountRecords(controller wiring precedent)server/types/database.go—SearchDatabaseAPIinterface
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
akijakya commentedon Aug 12, 2026
Part of the same set of general-purpose SearchService enhancements as #1939 (total count) and #1940 (filter negation). Together they let non-UI clients do server-side tri-state filtering + counted pagination + present-only filter panels — see the consumer, agntcy/lazydir#51.
akijakya commentedon Sep 8, 2026
The implementation in #2121 diverges from the proposal in a few places, all deliberate, so recording the reasoning here.
The RPC is named
ListFilterValuesNot
ListRecordValuesas proposed. That name described the mechanism; the operation exists to populate filter panels and its values are meant to be fed back asRecordQueryvalues, so the new name states the purpose and leaves room for contextual faceting later.Shipped field set
SKILL_NAME,MODULE_NAME,DOMAIN_NAME,AUTHOR,SCHEMA_VERSION— five fields rather than the six proposed. Response entries mirror the order the fields were requested in; an empty request returns every supported field ordered by ascendingRecordQueryTypenumber. Requesting an unsupported type fails withInvalidArgumentnaming the supported set, rather than silently omitting it from the response.VERSIONwas droppedA record's own version is per-record identity rather than a shared facet. A registry-wide distinct list of versions therefore grows roughly with the registry, and "show me every record at 1.6.3" is not a question a filter panel asks. It only becomes meaningful with a query context that scopes it to a single record — "which versions exist of this record" — and this RPC deliberately takes no query context, per the YAGNI call in the proposal.
Dropping it now is the cheap direction: removing a field after release breaks callers that wired it up, whereas adding one back is purely additive.
VERSIONcan return the day contextual faceting lands.SCHEMA_VERSIONis kept despite the surface similarity — both are scalar columns onrecords. Its cardinality is bounded by OASF releases rather than by record count, so it stays a handful of values no matter how large the registry gets, and "which records are still on OASF 0.7.0" is a real migration question.LOCATORwas left outLocator.Typeis a small enumerable set and would have been a one-line pluck, but the locator shape is about to change in agntcy/oasf#493. Not worth baking a distinct-values contract around it first.ANNOTATIONand the consolidationThe proposal suggested reimplementing
ListCatalogTagson top of this RPC, which would have meant addingANNOTATIONto makeListFilterValuesa superset ofListTags. It went the other way instead: annotations were removed fromListCatalogTags, makingListTagsa subset. Same single source of truth, less code, and annotations are free-form per-deployment metadata with unbounded cardinality — noise in a discovery panel.This is a user-visible change to
GET /v1/tags: it now returns skills and domains only. Annotations remain filterable — tag filters still parse annotation tags, andCatalogEntry.Tagsstill carries per-record annotations — so only the global discovery list is affected.Both surfaces now share the same distinct-values helper, so the catalog UI and general search clients cannot disagree about which values the registry holds.
Implementation note on authors
Authors needed no schema change. They are a JSON array on
recordsrather than a child table, so the array is unnested in Go instead of with SQL JSON functions, keeping one code path across the SQLite and Postgres backends.DISTINCTstill collapses records sharing an author list before the payloads reach Go.Normalizing
authorsinto a child table remains worthwhile on its own merits — it would fix theLIKE-against-raw-JSON author filter — but that is a separate change with its own migration and write-path cost, not a prerequisite for this one.fix(search): make author values round-trip into queries
fix(search): make author values round-trip into queries
feat(api): search service to list filter values (#2121)