feat(mcp): add typed Pydantic response schemas to generate_explore_link tool#39900
Open
gkneighb wants to merge 1 commit intoapache:masterfrom
Open
feat(mcp): add typed Pydantic response schemas to generate_explore_link tool#39900gkneighb wants to merge 1 commit intoapache:masterfrom
gkneighb wants to merge 1 commit intoapache:masterfrom
Conversation
…nk tool Introduces `superset/mcp_service/explore/schemas.py` with two new schemas: - `GenerateExploreLinkResponse` — replaces the raw `Dict[str, Any]` return, adding an explicit `success` field alongside `url`, `form_data`, `form_data_key`, and `error`. - `ExploreLinkError` — structured error model with a machine-readable `error_type` discriminant (`dataset_not_found`, `generation_failed`, `permission_denied`) so callers can branch on failure mode without parsing free-text messages. Updates `generate_explore_link.py` to return `GenerateExploreLinkResponse` and updates tests to use `result.structured_content` (the correct accessor when FastMCP tools return Pydantic models instead of plain dicts). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Contributor
Code Review Agent Run #c692a3Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SUMMARY
Replaces the untyped
Dict[str, Any]return value of the MCPgenerate_explore_linktool with typed Pydantic response schemas, introducing two new models insuperset/mcp_service/explore/schemas.py:GenerateExploreLinkResponse— adds an explicitsuccessfield alongsideurl,form_data,form_data_key, anderror, so callers no longer have to infer success from the absence of an error.ExploreLinkError— structured error model with a machine-readableerror_typediscriminant (dataset_not_found,generation_failed,permission_denied), letting callers branch on failure mode without parsing free-text error messages.The tool itself (
generate_explore_link.py) now returnsGenerateExploreLinkResponse. Tests were updated to useresult.structured_content, which is the correct accessor when FastMCP tools return Pydantic models instead of plain dicts.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — backend/MCP-only change, no UI surface.
TESTING INSTRUCTIONS
generate_explore_linktool against a valid dataset and confirm the response is a structured object withsuccess: trueand a populatedurl.success: falseand anExploreLinkErrorwitherror_type: "dataset_not_found".ADDITIONAL INFORMATION