aminghadersohi commented on code in PR #36553:
URL: https://github.com/apache/superset/pull/36553#discussion_r2895040710
##########
superset/core/mcp/core_mcp_injection.py:
##########
@@ -85,11 +89,18 @@ def decorator(func: F) -> F:
name=tool_name,
description=tool_description,
tags=tool_tags,
+ task=task,
)
mcp.add_tool(tool)
+ task_status = "background-task" if task else "sync"
Review Comment:
Good observation about the logging accuracy. The task_status computed from
the task object might not reflect the actual registration outcome if a fallback
changed the behavior. I'll fix the logging to use the actual registration
result. Thanks.
##########
superset/mcp_service/dashboard/tool/generate_dashboard.py:
##########
@@ -233,6 +247,7 @@ def generate_dashboard(
)
except Exception as e:
+ await ctx.error("Error creating dashboard: %s" % (str(e),))
logger.error("Error creating dashboard: %s", e)
Review Comment:
Good point — if ctx.error raises, the local logger.error and return won't
execute. I'll reorder to log locally first, then await ctx.error, so we at
least capture the error in our logs regardless. Thanks.
##########
superset-core/src/superset_core/mcp/__init__.py:
##########
@@ -62,13 +63,20 @@ def my_tool(): ...
@tool(name="custom_name", protect=False)
def my_tool(): ...
+ Or with background task support (requires async function):
+ @tool(task=True)
+ async def long_running_tool(): ...
Review Comment:
Ha, yes\! The MCP layer runs in its own async context via FastMCP/Starlette,
so we get to use async there without affecting the synchronous Flask request
handling. It's kind of a nice bridge — the MCP tools themselves use async
internally while calling back into Flask's sync DAOs when needed.
--
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]