Skip to main content
Glama
CW-Codewalnut

Metabase MCP Server

create_metabase_dashboard

Create a new dashboard in Metabase to visualize and organize data insights with customizable parameters, tabs, and collection settings.

Instructions

Create a new dashboard in Metabase.

Args: name (str): Name of the dashboard. description (str, optional): Dashboard description. collection_id (int, optional): Collection ID. parameters (list, optional): Parameters for the dashboard. tabs (list, optional): Tabs for the dashboard (list of {"name": "Tab Name"}). cache_ttl (int, optional): Cache time to live in seconds. collection_position (int, optional): Position in the collection.

Returns: Dict[str, Any]: Created dashboard metadata.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYes
descriptionNo
collection_idNo
parametersNo
tabsNo
cache_ttlNo
collection_positionNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The create_metabase_dashboard tool handler function that creates a new dashboard in Metabase. Accepts parameters for name, description, collection_id, parameters, tabs, cache_ttl, and collection_position. Constructs a payload and makes a POST request to /api/dashboard endpoint.
    async def create_metabase_dashboard(
        name: str,
        description: Optional[str] = None,
        collection_id: Optional[int] = None,
        parameters: Optional[List] = None,
        tabs: Optional[List[Dict[str, str]]] = None,
        cache_ttl: Optional[int] = None,
        collection_position: Optional[int] = None
    ) -> Dict[str, Any]:
        """
        Create a new dashboard in Metabase.
    
        Args:
            name (str): Name of the dashboard.
            description (str, optional): Dashboard description.
            collection_id (int, optional): Collection ID.
            parameters (list, optional): Parameters for the dashboard.
            tabs (list, optional): Tabs for the dashboard (list of {"name": "Tab Name"}).
            cache_ttl (int, optional): Cache time to live in seconds.
            collection_position (int, optional): Position in the collection.
    
        Returns:
            Dict[str, Any]: Created dashboard metadata.
        """
        payload = {
            "name": name,
        }
        if description is not None:
            payload["description"] = description
        if collection_id is not None:
            payload["collection_id"] = collection_id
        if parameters is not None:
            payload["parameters"] = parameters
        if tabs is not None:
            payload["tabs"] = tabs
        if cache_ttl is not None:
            payload["cache_ttl"] = cache_ttl
        if collection_position is not None:
            payload["collection_position"] = collection_position
    
        logger.info(f"Creating dashboard '{name}'")
        return await make_metabase_request(RequestMethod.POST, "/api/dashboard", json=payload)
  • The @mcp.tool() decorator registers the create_metabase_dashboard function as an MCP tool, making it available for invocation through the Model Context Protocol.
    @mcp.tool()
  • The make_metabase_request helper function that handles all HTTP requests to the Metabase API. Used by create_metabase_dashboard to make the actual POST request to /api/dashboard endpoint.
    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}")
            
            # Log request payload for debugging (omit sensitive info)
            if json and logger.level <= logging.DEBUG:
                sanitized_json = {**json}
                if 'password' in sanitized_json:
                    sanitized_json['password'] = '********'
                logger.debug(f"Request payload: {sanitized_json}")
                
            response = await session.request(
                method=method.name,
                url=endpoint,
  • DashboardTab dataclass model that represents a tab within a Metabase dashboard. Contains id (optional) and name fields. Referenced in the create_metabase_dashboard function signature for the tabs parameter.
    @dataclass
    class DashboardTab:
        """
        Represents a tab within a Metabase dashboard.
        
        Attributes:
            id (Optional[int]): The tab ID, optional for new tabs
            name (str): The name of the tab
        """
        id: Optional[int] = None
        name: str = "" 
Behavior2/5

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

With no annotations provided, the description carries full burden but provides minimal behavioral context. It mentions the tool creates something and returns metadata, but doesn't disclose permission requirements, whether this is a write operation (implied but not stated), error conditions, rate limits, or what happens if a dashboard with the same name exists. The 'Returns' section adds some value but is basic.

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?

Well-structured with clear sections (Args, Returns). The main description is a single clear sentence, and parameter explanations are efficient. Some minor verbosity in repeating 'optional' for each optional parameter, but overall very efficient.

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 creation tool with 7 parameters and no annotations, the description provides good parameter documentation and mentions the return type. However, it lacks important context about permissions, error handling, and behavioral constraints. The existence of an output schema helps, but the description should do more for a mutation tool with no safety annotations.

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?

With 0% schema description coverage and 7 parameters, the description provides excellent parameter semantics. It clearly explains what each parameter represents (e.g., 'Name of the dashboard', 'Dashboard description', 'Collection ID', etc.) and indicates which are optional. This significantly compensates for the schema's lack of descriptions.

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 'Create a new dashboard in Metabase' which is a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'copy_metabase_dashboard' or 'update_metabase_dashboard' - the agent must infer that 'create' means new vs 'copy' or 'update'.

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?

No guidance on when to use this tool versus alternatives like 'copy_metabase_dashboard' or 'update_metabase_dashboard'. The description provides no context about prerequisites, permissions needed, or when this creation operation is appropriate versus other dashboard-related operations.

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