list_dashboard_tabs
Get all tabs configured on a dashboard by providing its ID. Returns a list of tab objects with id, name, and position.
Instructions
List all tabs configured on a dashboard.
Args: dashboard_id: The ID of the dashboard.
Returns: A list of tab objects with id, name, and position. Empty list if the dashboard has no tabs.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dashboard_id | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- server.py:1480-1512 (handler)The async function `list_dashboard_tabs` is the tool handler implementation. It fetches dashboard data from Metabase API (GET /dashboard/{dashboard_id}), extracts the 'tabs' list, and returns a list of dicts with tab_id, name, and position for each tab.
@mcp.tool async def list_dashboard_tabs(dashboard_id: int, ctx: Context) -> list[dict[str, Any]]: """ List all tabs configured on a dashboard. Args: dashboard_id: The ID of the dashboard. Returns: A list of tab objects with id, name, and position. Empty list if the dashboard has no tabs. """ try: await ctx.info(f"Fetching tabs for dashboard {dashboard_id}") result = await metabase_client.request("GET", f"/dashboard/{dashboard_id}") tabs = result.get("tabs") or [] await ctx.info( f"Successfully retrieved {len(tabs)} tabs from dashboard {dashboard_id}" ) return [ { "tab_id": tab.get("id"), "name": tab.get("name"), "position": tab.get("position"), } for tab in tabs ] except Exception as e: error_msg = f"Error fetching tabs for dashboard {dashboard_id}: {e}" await ctx.error(error_msg) raise ToolError(error_msg) from e - server.py:1480-1481 (registration)The `@mcp.tool` decorator on line 1480 registers the `list_dashboard_tabs` function as a FastMCP tool.
@mcp.tool async def list_dashboard_tabs(dashboard_id: int, ctx: Context) -> list[dict[str, Any]]: - server.py:1482-1491 (schema)The docstring serves as the tool's schema/definition, describing the input parameter (dashboard_id: int) and return type (list of tab objects with id, name, position).
""" List all tabs configured on a dashboard. Args: dashboard_id: The ID of the dashboard. Returns: A list of tab objects with id, name, and position. Empty list if the dashboard has no tabs. """