mssql_manage_rls
Create, edit, enable, disable, or drop SQL Server row-level security policies using predicate functions to restrict data access.
Instructions
Manage SQL Server Row-Level Security - security policies with generated predicate functions. Examples: operation="create_policy" with tableName, policyName, predicateColumns=["TenantId"], using="@TenantId = CAST(SESSION_CONTEXT(N'TenantId') AS int)"
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| role | No | Not supported: SQL Server policies apply to all principals | |
| check | No | BLOCK predicate expression over @Column parameters (optional) | |
| roles | No | Not supported: SQL Server policies apply to all principals | |
| using | No | FILTER predicate expression over @Column parameters (required for create_policy unless command is INSERT/UPDATE/DELETE) | |
| schema | No | Schema name (defaults to dbo) | |
| command | No | Which block operations the check predicate applies to (SELECT = filter only) | ALL |
| replace | No | Drop and recreate the policy if it exists (for create_policy) | |
| ifExists | No | Include IF EXISTS clause (for drop_policy) | |
| operation | Yes | Operation: enable/disable policies on a table, create_policy, edit_policy, drop_policy, get_policies | |
| tableName | No | Table name (required for enable/disable/create_policy/edit_policy, optional filter for get_policies) | |
| policyName | No | Policy name (required for create_policy/edit_policy/drop_policy) | |
| connectionString | No | SQL Server connection string (optional; requires --allow-tool-connection-string) | |
| predicateColumns | No | Columns passed to the predicate functions; reference them as @Column in using/check |