Skip to content

feat(mcp): add list and get tools for row level security and plugins#13

Open
hbrooks wants to merge 9 commits into
masterfrom
demo/pr-40347
Open

feat(mcp): add list and get tools for row level security and plugins#13
hbrooks wants to merge 9 commits into
masterfrom
demo/pr-40347

Conversation

@hbrooks

@hbrooks hbrooks commented May 28, 2026

Copy link
Copy Markdown

aminghadersohi and others added 9 commits May 21, 2026 20:10
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…er roles to be returned

RLS filter `roles` (which roles a filter applies to) are core RLS data,
not user-directory metadata. Including 'roles' in USER_DIRECTORY_FIELDS
caused filter_user_directory_columns() to strip it from any requested
select_columns list, making it impossible to retrieve via list_rls_filters.

No dashboard/chart/dataset schema defines a 'roles' field, so removing it
from the block set has no privacy impact on other tools.

Fixes test_list_rls_filters_returns_tables_and_roles.
…in RLS list tool

'roles' on a dashboard/chart exposes who has access to the resource and
should be stripped by the USER_DIRECTORY_FIELDS privacy filter.

'roles' in an RLS filter is which roles the filter applies to — it is
core filter data, not user-directory metadata. The RLS list tool now
derives its column selection directly from ALL_RLS_COLUMNS (bypassing
ModelListCore's USER_DIRECTORY_FIELDS filtering) so that RLS roles are
selectable while dashboard roles remain hidden.

Fixes three failing unit tests:
- test_list_dashboards_omits_requested_user_directory_fields
- test_get_allowed_fields_always_denies_user_directory_fields
- test_filter_sensitive_data_strips_user_directory_fields_even_if_allowed

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Fix _serialize cols parameter type from list[str] | None to list[str]
  in both list_plugins.py and list_rls_filters.py to match ModelListCore
  Callable[[T, List[str]], S | None] callback signature
- Update filter_user_directory_fields docstring to mention roles

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…IRECTORY_FIELDS in list_rls_filters

When the caller passes select_columns that consists entirely of USER_DIRECTORY_FIELDS
columns (e.g. ["roles"]), ModelListCore raises ValueError because its privacy filter
strips all columns, leaving an empty list.

Strip USER_DIRECTORY_FIELDS from select_columns before passing to run_tool (falling
back to None/defaults when the filtered list is empty). The existing bypass mechanism
already restores these fields in the final serialized output using ALL_RLS_COLUMNS.

Adds a regression test for the ["roles"]-only select_columns edge case.
…plugin for consistency

Align with the naming convention used by all other list tools
(list_charts, list_dashboards, list_databases, list_datasets), which
use _serialize_<resource> for the item serializer closure.

Addresses bito additional suggestion: serializer naming inconsistency.
…umnFilter to RlsFilter

- Add `description` field to `RlsFilterInfo`, `ALL_RLS_COLUMNS`, and
  `serialize_rls_filter_object` (maps to `RowLevelSecurityFilter.description`)
- Add `created_on` field alongside existing `changed_on` for consistency
  with all sibling schemas in the MCP service suite
- Rename `RlsColumnFilter` → `RlsFilter` to follow the `<Resource>Filter`
  naming convention used by every other filter class in the suite
- Update test mock and test class name accordingly
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.

2 participants