aminghadersohi opened a new pull request, #38391:
URL: https://github.com/apache/superset/pull/38391
### SUMMARY
When LLM clients (e.g., Claude, GPT) connect to the Superset MCP server,
they sometimes
generate code artifacts (HTML pages, JavaScript snippets, plotting code)
instead of calling
the provided MCP tools directly. This defeats the purpose of the MCP
integration, which is
designed to handle all visualization, authentication, and data fetching
through its tool API.
This PR adds an explicit "Tool-Only Interaction" guardrail section to the
`DEFAULT_INSTRUCTIONS`
in the MCP service. The new instructions tell connected LLMs to:
- **Not** generate code artifacts, HTML pages, or JavaScript snippets
- Call the provided tools directly (e.g., `generate_chart` for
visualizations)
- Return tool-provided URLs to users instead of recreating visualizations in
code
- Use `generate_dashboard` / `add_chart_to_existing_dashboard` instead of
generating HTML dashboards
- Explain tool limitations rather than generating code workarounds
The guardrail text is placed between the "Query Examples" and "General usage
tips" sections
in the system instructions that all LLM clients receive on connection.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Not applicable -- this is a text change to MCP system instructions, not a UI
change.
### TESTING INSTRUCTIONS
1. All 650 existing MCP service unit tests continue to pass:
```
python -m pytest tests/unit_tests/mcp_service/ -x -q
```
2. Connect an LLM client to the MCP server and verify the new instructions
appear
in the system prompt
3. Ask the LLM to "create a chart showing sales by region" and verify it
calls
`generate_chart` rather than generating matplotlib/plotly code
### 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
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]