query_collection
Run read-only SQL SELECT against a local Discogs collection cache to answer questions without API calls.
Instructions
Run a read-only SQL SELECT against the local collection cache (max 500 rows). Use it to answer any question across the whole collection without API calls.
Tables and views (SQLite):
collection (view): instance_id, folder_id, folder, rating, date_added, fields, release_id, master_id, artist, title, year, labels, catnos, format, formats, genres, styles, country
wants (view): release_id, rating, notes, date_added, master_id, artist, title, year, labels, catnos, format, formats, genres, styles, country
releases: id, master_id, artist, title, year, labels, catnos, format, formats, genres, styles, country, details_fetched_at
release_labels: release_id, label_id, name, catno (one row per label on a release)
collection_items: instance_id, release_id, folder_id, rating, date_added, fields
item_fields: instance_id, field_id, name, value (e.g. name='Media Condition')
folders: id, name, count
tracks: release_id, position, title, artists, duration, seq (needs sync_release_details)
sync_meta: key, value labels, catnos, genres and styles are JSON arrays: use json_each, e.g. SELECT s.value AS style, COUNT(*) FROM collection, json_each(collection.styles) s GROUP BY 1 fields is a JSON object: json_extract(fields, '$."Media Condition"'). country and tracks are only populated after sync_release_details.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sql | Yes |