Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion superset/mcp_service/chart/tool/get_chart_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,10 @@ async def get_chart_data( # noqa: C901
if not chart:
await ctx.warning("Chart not found: identifier=%s" % (request.identifier,))
return ChartError(
error=f"No chart found with identifier: {request.identifier}",
error=(
f"No chart found with identifier: {request.identifier}."
" Use list_charts to get valid chart IDs."
),
error_type="NotFound",
)

Expand Down
5 changes: 4 additions & 1 deletion superset/mcp_service/chart/tool/get_chart_preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -1193,7 +1193,10 @@ def __init__(self, form_data: Dict[str, Any]):
if not chart:
await ctx.warning("Chart not found: identifier=%s" % (request.identifier,))
return ChartError(
error=f"No chart found with identifier: {request.identifier}",
error=(
f"No chart found with identifier: {request.identifier}."
" Use list_charts to get valid chart IDs."
),
error_type="NotFound",
)

Expand Down
6 changes: 4 additions & 2 deletions superset/mcp_service/chart/tool/update_chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,10 +343,12 @@ async def update_chart( # noqa: C901
"error": {
"error_type": "NotFound",
"message": (
f"No chart found with identifier: {request.identifier}"
f"No chart found with identifier: {request.identifier}."
" Use list_charts to get valid chart IDs."
),
"details": (
f"No chart found with identifier: {request.identifier}"
f"No chart found with identifier: {request.identifier}."
" Use list_charts to get valid chart IDs."
),
},
"success": False,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,10 @@ def _find_and_authorize_dashboard(
dashboard=None,
dashboard_url=None,
position=None,
error=f"Dashboard with ID {dashboard_id} not found",
error=(
f"Dashboard with ID {dashboard_id} not found."
" Use list_dashboards to get valid dashboard IDs."
),
)

try:
Expand Down Expand Up @@ -392,7 +395,10 @@ def add_chart_to_existing_dashboard(
dashboard=None,
dashboard_url=None,
position=None,
error=f"Chart with ID {request.chart_id} not found",
error=(
f"Chart with ID {request.chart_id} not found."
" Use list_charts to get valid chart IDs."
),
)

# Validate dataset access for the chart.
Expand Down
5 changes: 4 additions & 1 deletion superset/mcp_service/dashboard/tool/generate_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,10 @@ def generate_dashboard( # noqa: C901
return GenerateDashboardResponse(
dashboard=None,
dashboard_url=None,
error=f"Charts not found: {list(missing_chart_ids)}",
error=(
f"Charts not found: {list(missing_chart_ids)}."
" Use list_charts to get valid chart IDs."
),
)

# Validate dataset access for each chart.
Expand Down
5 changes: 4 additions & 1 deletion superset/mcp_service/dataset/tool/query_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,10 @@ async def query_dataset( # noqa: C901
if dataset is None:
await ctx.error("Dataset not found: identifier=%s" % (request.dataset_id,))
return DatasetError.create(
error=f"No dataset found with identifier: {request.dataset_id}",
error=(
f"No dataset found with identifier: {request.dataset_id}."
" Use list_datasets to get valid dataset IDs."
),
error_type="NotFound",
)

Expand Down
5 changes: 4 additions & 1 deletion superset/mcp_service/sql_lab/tool/execute_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,10 @@ async def execute_sql(request: ExecuteSqlRequest, ctx: Context) -> ExecuteSqlRes
)
return ExecuteSqlResponse(
success=False,
error=f"Database with ID {request.database_id} not found",
error=(
f"Database with ID {request.database_id} not found."
" Use list_databases to get valid database IDs."
),
error_type=SupersetErrorType.DATABASE_NOT_FOUND_ERROR.value,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ def open_sql_lab_with_context(
database = DatabaseDAO.find_by_id(request.database_connection_id)
if not database:
error_message = (
f"Database with ID {request.database_connection_id} not found"
f"Database with ID {request.database_connection_id} not found."
" Use list_databases to get valid database IDs."
)
return _sanitize_sql_lab_response_for_llm_context(
SqlLabResponse(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,8 @@ def test_sanitizes_error_and_keeps_empty_url_for_missing_database(self) -> None:
field_path=("title",),
)
assert response.error == sanitize_for_llm_context(
"Database with ID 404 not found",
"Database with ID 404 not found."
" Use list_databases to get valid database IDs.",
field_path=("error",),
)
finally:
Expand Down
Loading