Skip to main content
Glama
books-as-data
by kintopp

sgbr_facet_values

sgbr_facet_values
Read-onlyIdempotent

Break a query down by one dimension to list each facet value with its record count, helping you discover valid filter values and build cross-tab slices.

Instructions

Read sgbr_guide before your first search. Break a query down by one dimension, returning each value with its count. Dimensions include library, language, publication year, author, genre, and topic. Counts are scoped to the query (and any filters / ranges) so they agree with sgbr_search. The year facet is an overlapping density profile; if warnings appear, verify exact totals with sgbr_search. Facet one dimension while filtering on another to build a cross-tab slice. Some dimensions (notably object_type) store "no value" as an empty bucket: those records are reported as absent_records, excluded from coverage_pct, and cannot be reached by a filter on that dimension — so read a value's absence as evidence only across matching_records.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "facet": "<facet>"
    },
    "name": "sgbr_facet_values"
  }
}

Input Schema

NameRequiredDescriptionDefault
sizeNoMax number of values to return, the most frequent first (max 200). Ignored for "year", which always returns the full per-year distribution in chronological order.
facetYesWhich dimension to break down. One of: library (holding library), language (language), resource_type (type of the original resource), genre (genre), publication_place (place of publication), subject_heading (catalogued subject heading; OR the German and English forms, which barely overlap (only the German carry a GND id)), subject_area (rule-based subject classification derived from the call number (enrichment)), topic (broad subject auto-derived from the call number (enrichment)), availability (type of data available in the portal (full text / metadata-only / external scans / single foldout page)), scan_source (platform or institution providing the scans (a record may list several)), object_type (object type: monograph (work/Werk), multivolume work (multivolume/Mehrbändig), volume (Band), or single foldout page (foldout/Einzelseite)), foldout_type (foldout content category — ~50 German terms (Karten, Tabellen, …) adapted from the Library of Congress Thesaurus for Graphic Materials (AI enrichment)), genre_ai (genre predicted by the ZB-Lab AI model (18 labels, high-confidence predictions only); ~4x the coverage of the catalogued `genre` (enrichment)), content_flags (~15 pipeline flags (IMAGE_ON_PAGE, CHAPTER_START, …) plus thousands of German volume-designation strings — not a controlled vocabulary (enrichment)), volume_info (volume designation within a multivolume work), parent_record (id of the parent record, gathering one work's volumes; filter the facet's BARE digits, never the id991… form), author (author), year (publication year).
queryNoFree-text query the facet is computed over (same symbolic-Lucene rules as sgbr_search; empty = whole corpus). Counts match what sgbr_search would return for the same query/scope.
scopeNoRestrict the query to one field group (same as sgbr_search).all
excludeNoDrop records carrying ANY of these values, per dimension (same keys and exact values as `filters`). Unlike a filter it keeps records with no value for that dimension, e.g. the untyped records filters.object_type can never reach. A misspelled value silently excludes nothing — take values from sgbr_facet_values.
filtersNoNarrow the population the facet counts over, by dimension (same keys/values as sgbr_search). Values within one dimension are OR-ed; different dimensions AND. Dimension values are exact facet values — discover them with sgbr_facet_values facet=<dim> — except object_type, whose enum lists friendly keys. Note: subject_area, topic, foldout_type, genre_ai, content_flags are machine-derived enrichments, not catalogued data.
year_toNoOnly records published in or before this year (inclusive publication-date range).
pages_maxNoOnly records with at most this many page images (see pages_min).
pages_minNoOnly records with at least this many page images (a multivolume work counts all its volumes'); records without scans are excluded.
year_fromNoOnly records published in or after this year (inclusive publication-date range). With facet="year" the buckets are trimmed to the range.
full_text_onlyNoIf true, count only digitised items that have machine-readable full text.
ocr_quality_minNoOnly records whose OCR quality score (0–100, mostly 90–95) is at least this; records without their own scan (multivolume parent works, metadata-only records) are excluded.

Output Schema

NameRequiredDescriptionDefault
facetYes
queryYes
scopeYes
valuesYes
returnedYes
warningsNo
query_totalYes
coverage_pctYes
multi_valuedYes
others_countYes
absent_recordsYesRecords indexed with an empty value for this dimension: excluded from matching_records and coverage_pct, and unreachable by any filter on it. null = no such bucket among the returned values — if others_count is high, raise `size` before trusting a 100% coverage_pct.
full_text_onlyYes
applied_filtersNo
distinct_valuesYes
matching_recordsYes
same_dimension_filterYesTrue when the SAME dimension being faceted is also narrowed by `filters`. RDV excludes a dimension's own filter from its own aggregation, so values[], matching_records, distinct_values and others_count are then counted as if that filter were unset: your query still scopes them, this dimension no longer does, so they are not the intersection you asked for. coverage_pct is null for this reason. query_total, and every other dimension's narrowing, remain correct; to intersect two values of one dimension use inclusion-exclusion over sgbr_search (A + B - union).

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.30.2

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare readOnly/idempotent/non-destructive, and the description adds substantial behavior the agent could not otherwise know: the year facet is an overlapping density profile rather than a partition, counts are scoped to query+filters so they reconcile with sgbr_search, and empty-bucket dimensions surface records as absent_records excluded from coverage_pct. That is exactly the non-obvious behavior an agent needs before trusting counts.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Seven sentences, all load-bearing, with the prerequisite and the core purpose front-loaded. Some sentences are long and pack multiple caveats (the absent_records/coverage_pct sentence in particular), which slightly hurts scannability but nothing is redundant.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a 12-parameter tool with an output schema, the description covers the parts structured fields cannot: count scoping, year-facet caveats, warning handling, and the empty-bucket semantics that determine how a value's absence should be read. Nothing needed to invoke or interpret it correctly is missing.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so the baseline is 3, but the description still adds meaning: it explains how `filters`/ranges scope the facet counts, and that a filter on an empty-bucket dimension can never reach the absent records. It does not restate size/exclude mechanics, which the schema already covers.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The first substantive sentence states a precise verb and result shape: 'Break a query down by one dimension, returning each value with its count.' The phrase 'one dimension' implicitly separates it from a multi-dimension breakdown, and the enumerated dimensions plus the sgbr_search comparison make scope unambiguous.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives a clear prerequisite ('Read sgbr_guide before your first search'), a concrete use case ('Facet one dimension while filtering on another to build a cross-tab slice'), and an escape hatch ('verify exact totals with sgbr_search' when warnings appear). It stops short of explicit when-not guidance against siblings like sgbr_facet_breakdown.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.