Skip to main content
Glama
voducdan

metabase-mcp

by voducdan

list_dashboard_tab_cards

Get the list of dashcards from a specific dashboard tab, including layout and card metadata, by providing dashboard ID and tab ID.

Instructions

List the cards belonging to a specific tab on a dashboard.

Args: dashboard_id: The ID of the dashboard. tab_id: The ID of the tab (from list_dashboard_tabs).

Returns: A list of dashcards on the given tab with layout and card metadata.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dashboard_idYes
tab_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function for the list_dashboard_tab_cards tool. It fetches dashboard data via GET /api/dashboard/{dashboard_id}, validates the tab exists, filters dashcards by dashboard_tab_id, and returns layout/card metadata for cards on that tab.
    @mcp.tool
    async def list_dashboard_tab_cards(
        dashboard_id: int, tab_id: int, ctx: Context
    ) -> list[dict[str, Any]]:
        """
        List the cards belonging to a specific tab on a dashboard.
    
        Args:
            dashboard_id: The ID of the dashboard.
            tab_id: The ID of the tab (from list_dashboard_tabs).
    
        Returns:
            A list of dashcards on the given tab with layout and card metadata.
        """
        try:
            await ctx.info(
                f"Fetching cards for tab {tab_id} on dashboard {dashboard_id}"
            )
            result = await metabase_client.request("GET", f"/dashboard/{dashboard_id}")
    
            tab_ids = {tab.get("id") for tab in (result.get("tabs") or [])}
            if tab_ids and tab_id not in tab_ids:
                raise ToolError(
                    f"Tab {tab_id} not found on dashboard {dashboard_id}. "
                    f"Available tab ids: {sorted(tid for tid in tab_ids if tid is not None)}"
                )
    
            dashcards = result.get("dashcards", result.get("ordered_cards", []))
            tab_dashcards = [
                dc for dc in dashcards if dc.get("dashboard_tab_id") == tab_id
            ]
            await ctx.info(
                f"Found {len(tab_dashcards)} cards on tab {tab_id} of dashboard {dashboard_id}"
            )
    
            cards_layout = []
            for dashcard in tab_dashcards:
                card_info: dict[str, Any] = {
                    "dashcard_id": dashcard.get("id"),
                    "card_id": dashcard.get("card_id"),
                    "dashboard_tab_id": dashcard.get("dashboard_tab_id"),
                    "col": dashcard.get("col"),
                    "row": dashcard.get("row"),
                    "size_x": dashcard.get("size_x"),
                    "size_y": dashcard.get("size_y"),
                    "inline_parameters": dashcard.get("inline_parameters") or [],
                }
    
                card = dashcard.get("card")
                if card:
                    card_info["card_name"] = card.get("name")
                    card_info["card_display"] = card.get("display")
                    card_info["card_description"] = card.get("description")
    
                cards_layout.append(card_info)
    
            return cards_layout
        except ToolError:
            raise
        except Exception as e:
            error_msg = (
                f"Error fetching cards for tab {tab_id} on dashboard {dashboard_id}: {e}"
            )
            await ctx.error(error_msg)
            raise ToolError(error_msg) from e
  • server.py:1515-1517 (registration)
    The tool is registered via the @mcp.tool decorator on the handler function itself, using the FastMCP framework's decorator pattern.
    @mcp.tool
    async def list_dashboard_tab_cards(
        dashboard_id: int, tab_id: int, ctx: Context
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full behavioral disclosure. It states the return type (list of dashcards with layout and metadata), which is sufficient for a read operation. It does not mention error behavior or side effects, but for a simple list tool this is acceptable.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise, front-loading the purpose and then detailing args and returns with no extraneous words.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple two-parameter list tool with an output schema, the description provides all necessary information: what the tool does, input parameters with context, and return content. No gaps are apparent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds meaning to both parameters: dashboard_id is identified as the dashboard's ID, and tab_id is linked to 'list_dashboard_tabs' output. This goes beyond the bare schema which only shows type and requirement.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool lists cards belonging to a specific tab on a dashboard, using specific verb 'list' and resource 'cards'. It distinguishes from siblings like 'get_dashboard_cards' which likely lists all cards on a dashboard without tab filtering.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies when to use this tool by specifying the tab_id should come from 'list_dashboard_tabs', providing a clear context. However, it does not explicitly mention when not to use it or directly compare with alternatives like 'get_dashboard_cards'.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/voducdan/matebase-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server