feat(mcp): add list and get tools for annotation layers and annotations#40303
Closed
aminghadersohi wants to merge 3 commits into
Closed
feat(mcp): add list and get tools for annotation layers and annotations#40303aminghadersohi wants to merge 3 commits into
aminghadersohi wants to merge 3 commits into
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #40303 +/- ##
==========================================
- Coverage 64.14% 63.83% -0.32%
==========================================
Files 2592 2598 +6
Lines 138846 140183 +1337
Branches 32201 32492 +291
==========================================
+ Hits 89069 89488 +419
- Misses 48245 49131 +886
- Partials 1532 1564 +32
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
32ffe2c to
7df5804
Compare
Co-Authored-By: kasiazjc <[email protected]>
- Use ModelGetInfoCore in get_annotation_layer_info (DRY, matches other get_info tools) - Expand search_columns to include descr and long_descr (align with docstrings) - Simplify layer_id assignment in list_layer_annotations (direct attribute set vs rebuild) - Fix AnnotationList.layer_id default to 0 (ModelListCore cannot inject domain fields) Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
- AnnotationList.filters_applied used list[AnnotationFilter] which only allows col="short_descr", but ModelListCore injects a col="layer_id" ColumnOperator that fails Pydantic validation, causing KeyError on layer_id in the JSON response. Changed to list[ColumnOperator]. - test_get_annotation_layer_info_found: ModelGetInfoCore._find_object calls find_by_id(id, query_options=None), not find_by_id(id); updated assertion to assert_called_once_with(5, query_options=None).
7df5804 to
6e71872
Compare
Contributor
Author
|
Superseded by #40342 (branch renamed to follow |
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
Adds 4 new MCP tools in a new
superset/mcp_service/annotation_layer/domain:list_annotation_layers— list annotation layers with filtering, search, and 1-based paginationget_annotation_layer_info— get annotation layer details by IDlist_layer_annotations— list annotations within a layer (requireslayer_idto scope results)get_layer_annotation_info— get a single annotation bylayer_id+annotation_id, with layer-membership verificationThe annotation tools mirror the pattern used by
database/,dashboard/, anddataset/domains: Pydantic request/response schemas,ModelListCorefor listings, DAO-based lookups,ToolAnnotations, andevent_loggerinstrumentation.For annotations,
layer_idis a required parameter that scopes all results to the parent layer — mirroring the Superset REST API structure (GET /annotation_layer/{layer_pk}/annotation/).BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A (backend-only MCP tool additions)
TESTING INSTRUCTIONS
list_annotation_layers({})— lists all annotation layersget_annotation_layer_info({"id": <id>})— retrieves a specific layerlist_layer_annotations({"layer_id": <id>})— lists annotations in a layerget_layer_annotation_info({"layer_id": <id>, "annotation_id": <id>})— retrieves a specific annotationADDITIONAL INFORMATION