update_card_display
Update a saved Metabase question or card's display type by specifying the card ID and a new display mode (e.g., table, bar, pie). Optionally include visualization settings for precise control.
Instructions
Update the display type of a saved question/card in Metabase.
Args: card_id: The ID of the card to update. display: The display type (e.g. "table", "bar", "line", "pie", "scalar", "row", "area", "combo", "pivot", "smartscalar", "funnel", "waterfall", "map"). visualization_settings: Optional visualization settings to apply with the display change.
Returns: The updated card object.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| card_id | Yes | ||
| display | Yes | ||
| visualization_settings | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- server.py:843-877 (handler)Handler function for the 'update_card_display' tool. Updates a card's display type and optionally visualization settings via a PUT request to Metabase's /api/card/{card_id} endpoint.
@mcp.tool async def update_card_display( card_id: int, display: str, ctx: Context, visualization_settings: dict[str, Any] | None = None, ) -> dict[str, Any]: """ Update the display type of a saved question/card in Metabase. Args: card_id: The ID of the card to update. display: The display type (e.g. "table", "bar", "line", "pie", "scalar", "row", "area", "combo", "pivot", "smartscalar", "funnel", "waterfall", "map"). visualization_settings: Optional visualization settings to apply with the display change. Returns: The updated card object. """ try: await ctx.info(f"Updating card {card_id} display to '{display}'") payload: dict[str, Any] = {"display": display} if visualization_settings is not None: payload["visualization_settings"] = visualization_settings await ctx.debug(f"Applying visualization settings: {visualization_settings}") result = await metabase_client.request("PUT", f"/card/{card_id}", json=payload) await ctx.info(f"Successfully updated card {card_id} display to '{display}'") return result except Exception as e: error_msg = f"Error updating card {card_id} display: {e}" await ctx.error(error_msg) raise ToolError(error_msg) from e - server.py:843-843 (registration)Registration of 'update_card_display' as a FastMCP tool using the @mcp.tool decorator. This registers the tool name and makes it available to MCP clients.
@mcp.tool