datarobot_genai.drmcpbase.routes.helpers
helpers
Shared query parsing and filtering helpers for paginated REST list routes.
parse_pagination
Read limit and offset from the query string.
Non-integer or negative values fall back to the defaults, so a malformed query never 500s the route.
Source code in datarobot_genai/drmcpbase/routes/helpers.py
parse_list_filters
Read optional name, provider and category filters from the query string.
name is a single exact match. provider and category are multi-valued,
mirroring the multi-select checkboxes in the gallery filter panel. Both forms are
accepted and combined:
- comma-separated: ?category=dr_connectors,dr_web_search
- repeated params: ?category=dr_connectors&category=dr_web_search
Blank tokens are dropped; a dimension with no non-blank values is treated as absent.
Source code in datarobot_genai/drmcpbase/routes/helpers.py
apply_list_filters
apply_list_filters(items: list[dict[str, Any]], name: str | None, providers: list[str] | None, categories: list[str] | None) -> list[dict[str, Any]]
Filter list items by name, provider and/or category.
provider and category are match-any within the dimension; dimensions combine
with AND. Unrecognised filter values simply match nothing.
Source code in datarobot_genai/drmcpbase/routes/helpers.py
enum_items
Serialise an ordered value -> label map into [{"value", "label"}] items.