Skip to main content
Glama
CW-Codewalnut

Metabase MCP Server

get_dashboard_items

Retrieve all items from a Metabase dashboard using its ID to access charts, cards, and visualizations for data analysis and reporting.

Instructions

Get all items in a dashboard.

Args: dashboard_id (int): ID of the dashboard.

Returns: Dict[str, Any]: All items in the dashboard.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dashboard_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The get_dashboard_items tool implementation - an async function decorated with @mcp.tool() that takes a dashboard_id parameter and returns all items in the dashboard by making a GET request to the Metabase API endpoint /api/dashboard/{dashboard_id}/items
    @mcp.tool()
    async def get_dashboard_items(dashboard_id: int) -> Dict[str, Any]:
        """
        Get all items in a dashboard.
    
        Args:
            dashboard_id (int): ID of the dashboard.
    
        Returns:
            Dict[str, Any]: All items in the dashboard.
        """
        logger.info(f"Getting items for dashboard {dashboard_id}")
        return await make_metabase_request(RequestMethod.GET, f"/api/dashboard/{dashboard_id}/items")
  • Helper function make_metabase_request that handles HTTP requests to the Metabase API, used by get_dashboard_items to fetch dashboard items
    async def make_metabase_request(
        method: RequestMethod,
        endpoint: str,
        data: Optional[Dict[str, Any] | bytes] = None,
        params: Optional[Dict[str, Any]] = None,
        json: Any = None,
        headers: Optional[Dict[str, str]] = None,
    ) -> Dict[str, Any]:
        """
        Make a request to the Metabase API.
        
        Args:
            method: HTTP method to use (GET, POST, PUT, DELETE)
            endpoint: API endpoint path
            data: Request data (for form data)
            params: URL parameters
            json: JSON request body
            headers: Additional headers
            
        Returns:
            Dict[str, Any]: Response data
            
        Raises:
            MetabaseConnectionError: When the Metabase server is unreachable
            MetabaseResponseError: When Metabase returns a non-2xx status code
            RuntimeError: For other errors
        """
        
        if not METABASE_URL or not METABASE_API_KEY:
            raise RuntimeError("METABASE_URL or METABASE_API_KEY environment variable is not set. Metabase API requests will fail.")
    
        if session is None:
            raise RuntimeError("HTTP session is not initialized. Ensure app_lifespan was called.")
    
        try:
            request_headers = headers or {}
            
            logger.debug(f"Making {method.name} request to {METABASE_URL}{endpoint}")
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. While 'Get' implies a read operation, it doesn't specify whether this requires authentication, has rate limits, returns paginated results, or what happens with invalid dashboard IDs. The description mentions the return type but doesn't explain the structure or content of the returned items.

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

Conciseness4/5

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

The description is efficiently structured with a clear purpose statement followed by Args and Returns sections. Every sentence serves a purpose, though the 'Returns' section could be slightly more informative about what 'All items' encompasses.

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

Completeness3/5

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

For a simple read operation with one parameter and an output schema, the description is minimally adequate. However, with no annotations and multiple similar sibling tools, it should provide more context about differentiation, authentication requirements, and error handling to be truly complete.

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

Parameters3/5

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

The description explicitly documents the single parameter 'dashboard_id' and its purpose ('ID of the dashboard'), which adds meaningful context beyond the schema's 0% description coverage. However, it doesn't provide format details (e.g., where to find this ID, valid ranges) or examples, leaving some gaps in parameter understanding.

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

Purpose4/5

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

The description clearly states the verb ('Get') and resource ('all items in a dashboard'), making the purpose immediately understandable. However, it doesn't distinguish this tool from sibling tools like 'get_dashboard_by_id' or 'get_dashboard_cards', which appear to have overlapping functionality in the same domain.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'get_dashboard_by_id' or 'get_dashboard_cards'. It doesn't mention prerequisites, exclusions, or specific contexts where this tool is preferred over similar sibling tools.

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/CW-Codewalnut/metabase-mcp-server'

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