You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "aminghadersohi (via GitHub)" <gi...@apache.org> on 2026/02/18 16:35:04 UTC
[PR] feat(mcp): add LIKE, ILIKE, IN, NOT IN filter operators to MCP chart tools [superset]
aminghadersohi opened a new pull request, #38071:
URL: https://github.com/apache/superset/pull/38071
### SUMMARY
The MCP service's `FilterConfig` schema only supported basic comparison operators (`=`, `>`, `<`, `>=`, `<=`, `!=`). This meant that when creating or updating charts via MCP tools (`generate_chart`, `generate_explore_link`, `update_chart`), users could not:
- Filter with **pattern matching** (e.g., find games where name contains "Mario")
- Filter with **set membership** (e.g., platforms in ["Wii", "PS3", "Xbox360"])
These operators are already fully supported by Superset's native `adhoc_filters` system and the frontend UI — they were just missing from the MCP schema layer.
This PR adds support for **5 new filter operators**:
| Operator | Type | Example |
|----------|------|---------|
| `LIKE` | Pattern matching (case-sensitive) | `name LIKE '%mario%'` |
| `ILIKE` | Pattern matching (case-insensitive) | `name ILIKE '%mario%'` |
| `NOT LIKE` | Negated pattern matching | `name NOT LIKE '%test%'` |
| `IN` | Set membership | `platform IN ['Wii', 'PS3']` |
| `NOT IN` | Negated set membership | `status NOT IN ['archived']` |
**Key design decisions:**
- `IN`/`NOT IN` operators require the `value` field to be a **list** (validated at schema level)
- All other operators require a **scalar** value (string, number, or boolean)
- List values are individually sanitized through the existing `sanitize_filter_value` function
- No changes needed in the `adhoc_filters` conversion — Superset handles list comparators natively for `IN`/`NOT IN`
```mermaid
flowchart LR
A[MCP Client] -->|FilterConfig| B[Schema Validation]
B -->|"op: ILIKE<br>value: '%mario%'"| C[map_filter_operator]
B -->|"op: IN<br>value: ['Wii','PS3']"| C
C --> D[adhoc_filters]
D -->|"operator: ILIKE<br>comparator: '%mario%'"| E[Superset Query Engine]
D -->|"operator: IN<br>comparator: ['Wii','PS3']"| E
E --> F[SQL WHERE clause]
```
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — Backend-only change to the MCP schema layer. No UI changes.
**Before:** Only 6 operators available: `=`, `>`, `<`, `>=`, `<=`, `!=`
**After:** 11 operators available, adding: `LIKE`, `ILIKE`, `NOT LIKE`, `IN`, `NOT IN`
### TESTING INSTRUCTIONS
1. Run the MCP chart utils unit tests:
```bash
pytest tests/unit_tests/mcp_service/chart/test_chart_utils.py -v
```
2. Verify new filter operators work via MCP tools:
```json
{
"filters": [
{"column": "name", "op": "ILIKE", "value": "%mario%"},
{"column": "platform", "op": "IN", "value": ["Wii", "PS3"]}
]
}
```
3. Verify validation rejects invalid combinations:
- `IN` with scalar value → error
- `=` with list value → error
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [x] Introduces new feature or API
- [ ] Removes existing feature or API
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(mcp): add LIKE, ILIKE, IN, NOT IN filter operators to MCP chart tools [superset]
Posted by "Antonio-RiveroMartnez (via GitHub)" <gi...@apache.org>.
Antonio-RiveroMartnez merged PR #38071:
URL: https://github.com/apache/superset/pull/38071
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(mcp): add LIKE, ILIKE, IN, NOT IN filter operators to MCP chart tools [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #38071:
URL: https://github.com/apache/superset/pull/38071#issuecomment-3921904948
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/38071?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 65.80%. Comparing base ([`76d897e`](https://app.codecov.io/gh/apache/superset/commit/76d897eaa2f9e137102bc194c2e3109c29d0348f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`5251973`](https://app.codecov.io/gh/apache/superset/commit/5251973ed2e60d51324501b6e54b940a311e874c?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 3784 commits behind head on master.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #38071 +/- ##
==========================================
+ Coverage 60.48% 65.80% +5.31%
==========================================
Files 1931 668 -1263
Lines 76236 51376 -24860
Branches 8568 5791 -2777
==========================================
- Hits 46114 33809 -12305
+ Misses 28017 16170 -11847
+ Partials 2105 1397 -708
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/38071/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [hive](https://app.codecov.io/gh/apache/superset/pull/38071/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `41.44% <ø> (-7.71%)` | :arrow_down: |
| [javascript](https://app.codecov.io/gh/apache/superset/pull/38071/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [presto](https://app.codecov.io/gh/apache/superset/pull/38071/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [python](https://app.codecov.io/gh/apache/superset/pull/38071/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `65.79% <ø> (+2.28%)` | :arrow_up: |
| [sqlite](https://app.codecov.io/gh/apache/superset/pull/38071/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `64.20% <ø> (?)` | |
| [unit](https://app.codecov.io/gh/apache/superset/pull/38071/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `100.00% <ø> (+42.36%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/superset/pull/38071?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] feat(mcp): add LIKE, ILIKE, IN, NOT IN filter operators to MCP chart tools [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #38071:
URL: https://github.com/apache/superset/pull/38071#issuecomment-3921850167
<div>
<h3>Code Review Agent Run #08beaa</h3>
<div>
<details>
<summary>
<b>Actionable Suggestions - 0</b>
</summary>
</details>
</div>
<div>
<details>
<summary>
<b>Review Details</b>
</summary>
<ul>
<li>
<div id="file_reviewed">
Files reviewed - <b>3</b> · Commit Range: <code>5251973..5251973</code>
<ul>
<li>superset/mcp_service/chart/chart_utils.py</li><li>superset/mcp_service/chart/schemas.py</li><li>tests/unit_tests/mcp_service/chart/test_chart_utils.py</li>
</ul>
</div>
</li>
<li>
<div id="file_skipped">
Files skipped - <b>0</b>
<ul>
</ul>
</div>
</li>
<li>
<div id="tools">
Tools
<ul>
<li><b>Whispers</b> (Secret Scanner) - ✔︎ Successful</li><li><b>Detect-secrets</b> (Secret Scanner) - ✔︎ Successful</li><li><b>MyPy</b> (Static Code Analysis) - ✔︎ Successful</li><li><b>Astral Ruff</b> (Static Code Analysis) - ✔︎ Successful</li>
</ul>
</div>
</li>
</ul>
</details>
</div>
<hr>
<details>
<summary>
<b>Bito Usage Guide</b>
</summary>
**Commands**
Type the following command in the pull request comment and save the comment.
- `/review` - Manually triggers a full AI review.
- `/pause` - Pauses automatic reviews on this pull request.
- `/resume` - Resumes automatic reviews.
- `/resolve` - Marks all Bito-posted review comments as resolved.
- `/abort` - Cancels all in-progress reviews.
Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
<span><i>AI Code Review powered by</i> <sub><sub><a href="https://bito.ai/" target="_blank"><img src="https://bito.ai/wp-content/uploads/2023/10/Logo-Bito-Black-cropped.svg" alt="Bito Logo" width="50" height="20" /></a></sub></sub></span>
</div>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org