Skip to main content
Glama
voducdan

metabase-mcp

by voducdan

set_dashcard_inline_parameters

Moves dashboard filter widgets from the header to render inline on specific dashcards, preserving existing inline parameters unless replace is set to true.

Instructions

Attach dashboard filters inline to specific dashcards.

By default, dashboard parameters render as filter widgets at the top of the dashboard. Setting inline_parameters on a dashcard moves those filter widgets to appear attached to that specific card instead of the header.

Each entry in inline_parameters must include:

  • dashcard_id: the dashcard to target (from get_dashboard_cards)

  • parameter_ids: list of dashboard parameter ids (strings) to render inline on this dashcard. The parameters must already exist on the dashboard (see update_dashboard).

Existing inline_parameters on each touched dashcard are preserved and extended, unless replace=True (in which case the list on each touched dashcard is fully replaced by the ids provided here). Dashcards not referenced in inline_parameters are left untouched.

Note: the dashboard parameter should still be mapped to the card's template tag via set_dashcard_parameter_mappings — inline placement only affects where the widget renders, not how values are wired into the card's query.

Args: dashboard_id: The ID of the dashboard. inline_parameters: List of entries as described above. replace: If True, replace inline_parameters on touched dashcards instead of appending.

Returns: The updated dashboard object.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dashboard_idYes
inline_parametersYes
replaceNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The main handler function for set_dashcard_inline_parameters tool. Attaches dashboard filter widgets inline to specific dashcards by updating the inline_parameters field on dashcards, with support for merge or replace mode.
    @mcp.tool
    async def set_dashcard_inline_parameters(
        dashboard_id: int,
        inline_parameters: list[dict[str, Any]],
        ctx: Context,
        replace: bool = False,
    ) -> dict[str, Any]:
        """
        Attach dashboard filters inline to specific dashcards.
    
        By default, dashboard parameters render as filter widgets at the top of the
        dashboard. Setting `inline_parameters` on a dashcard moves those filter
        widgets to appear attached to that specific card instead of the header.
    
        Each entry in `inline_parameters` must include:
          - dashcard_id: the dashcard to target (from get_dashboard_cards)
          - parameter_ids: list of dashboard parameter ids (strings) to render
            inline on this dashcard. The parameters must already exist on the
            dashboard (see update_dashboard).
    
        Existing inline_parameters on each touched dashcard are preserved and
        extended, unless `replace=True` (in which case the list on each touched
        dashcard is fully replaced by the ids provided here). Dashcards not
        referenced in `inline_parameters` are left untouched.
    
        Note: the dashboard parameter should still be mapped to the card's
        template tag via `set_dashcard_parameter_mappings` — inline placement
        only affects where the widget renders, not how values are wired into the
        card's query.
    
        Args:
            dashboard_id: The ID of the dashboard.
            inline_parameters: List of entries as described above.
            replace: If True, replace inline_parameters on touched dashcards
                instead of appending.
    
        Returns:
            The updated dashboard object.
        """
        if not inline_parameters:
            raise ToolError("`inline_parameters` must contain at least one entry.")
    
        grouped: dict[int, list[str]] = {}
        for idx, entry in enumerate(inline_parameters):
            dc_id = entry.get("dashcard_id")
            param_ids = entry.get("parameter_ids")
            if dc_id is None:
                raise ToolError(f"inline_parameters[{idx}] must include 'dashcard_id'.")
            if not isinstance(param_ids, list) or not param_ids:
                raise ToolError(
                    f"inline_parameters[{idx}] must include non-empty 'parameter_ids' list."
                )
            if not all(isinstance(p, str) for p in param_ids):
                raise ToolError(
                    f"inline_parameters[{idx}].parameter_ids must contain only string ids."
                )
            grouped.setdefault(int(dc_id), []).extend(param_ids)
    
        try:
            await ctx.info(
                f"Setting inline parameters on {len(grouped)} dashcard(s) of dashboard {dashboard_id}"
            )
            dashboard = await metabase_client.request("GET", f"/dashboard/{dashboard_id}")
            existing_dashcards = dashboard.get("dashcards", dashboard.get("ordered_cards", []))
    
            existing_ids = {dc.get("id") for dc in existing_dashcards}
            unknown = [dc_id for dc_id in grouped if dc_id not in existing_ids]
            if unknown:
                raise ToolError(
                    f"Dashcard(s) {unknown} not found on dashboard {dashboard_id}."
                )
    
            dashboard_param_ids = {
                p.get("id") for p in (dashboard.get("parameters") or []) if p.get("id")
            }
            for dc_id, param_ids in grouped.items():
                missing = [p for p in param_ids if p not in dashboard_param_ids]
                if missing:
                    raise ToolError(
                        f"Parameter id(s) {missing} are not defined on dashboard "
                        f"{dashboard_id}. Add them via update_dashboard first."
                    )
    
            dashcards = []
            for dc in existing_dashcards:
                entry = {
                    "id": dc["id"],
                    "card_id": dc.get("card_id"),
                    "row": dc.get("row"),
                    "col": dc.get("col"),
                    "size_x": dc.get("size_x"),
                    "size_y": dc.get("size_y"),
                    "parameter_mappings": list(dc.get("parameter_mappings") or []),
                    "visualization_settings": dc.get("visualization_settings") or {},
                    "inline_parameters": list(dc.get("inline_parameters") or []),
                }
                new_for_dc = grouped.get(dc.get("id"))
                if new_for_dc is not None:
                    if replace:
                        entry["inline_parameters"] = list(new_for_dc)
                    else:
                        existing_inline = entry["inline_parameters"]
                        for pid in new_for_dc:
                            if pid not in existing_inline:
                                existing_inline.append(pid)
                dashcards.append(entry)
    
            result = await metabase_client.request(
                "PUT", f"/dashboard/{dashboard_id}", json={"dashcards": dashcards}
            )
            await ctx.info(
                f"Successfully updated inline parameters on dashboard {dashboard_id}"
            )
            return result
        except ToolError:
            raise
        except Exception as e:
            error_msg = f"Error setting inline parameters on dashboard {dashboard_id}: {e}"
            await ctx.error(error_msg)
            raise ToolError(error_msg) from e
  • server.py:1308-1314 (registration)
    Registration of set_dashcard_inline_parameters as an MCP tool via the @mcp.tool decorator.
    @mcp.tool
    async def set_dashcard_inline_parameters(
        dashboard_id: int,
        inline_parameters: list[dict[str, Any]],
        ctx: Context,
        replace: bool = False,
    ) -> dict[str, Any]:
  • Docstring/input schema for set_dashcard_inline_parameters defining parameters: dashboard_id (int), inline_parameters (list of dicts with dashcard_id and parameter_ids), ctx, and replace (bool).
    """
    Attach dashboard filters inline to specific dashcards.
    
    By default, dashboard parameters render as filter widgets at the top of the
    dashboard. Setting `inline_parameters` on a dashcard moves those filter
    widgets to appear attached to that specific card instead of the header.
    
    Each entry in `inline_parameters` must include:
      - dashcard_id: the dashcard to target (from get_dashboard_cards)
      - parameter_ids: list of dashboard parameter ids (strings) to render
        inline on this dashcard. The parameters must already exist on the
        dashboard (see update_dashboard).
    
    Existing inline_parameters on each touched dashcard are preserved and
    extended, unless `replace=True` (in which case the list on each touched
    dashcard is fully replaced by the ids provided here). Dashcards not
    referenced in `inline_parameters` are left untouched.
    
    Note: the dashboard parameter should still be mapped to the card's
    template tag via `set_dashcard_parameter_mappings` — inline placement
    only affects where the widget renders, not how values are wired into the
    card's query.
    
    Args:
        dashboard_id: The ID of the dashboard.
        inline_parameters: List of entries as described above.
        replace: If True, replace inline_parameters on touched dashcards
            instead of appending.
    
    Returns:
        The updated dashboard object.
    """
Behavior5/5

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

No annotations exist, so description fully covers behavior. States preservation of existing inline_parameters unless replace=True, unaffected dashcards, and no effect on value mappings. Clearly non-destructive and scoped.

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 bullet points and clear sections. Slightly verbose but each sentence adds necessary detail. Could be trimmed slightly but remains efficient for the complexity.

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?

Given output schema exists (not shown but referenced), description handles return value expectation. References sibling tools for related operations, ensuring agent understands full workflow. Complete for effective use.

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

Parameters5/5

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

Schema has 0% description coverage, but description fully explains all three parameters: dashboard_id, inline_parameters structure (dashcard_id, parameter_ids), and replace default/replacement behavior. Adds meaning beyond schema types.

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?

Description clearly states action: 'Attach dashboard filters inline to specific dashcards.' It distinguishes from sibling tools like set_dashcard_parameter_mappings by explaining that inline placement only affects widget rendering, not value wiring.

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

Usage Guidelines5/5

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

Provides explicit when-to-use context: moving filter widgets from header to specific cards. References prerequisites (get_dashboard_cards, update_dashboard) and complementary tool (set_dashcard_parameter_mappings). Explains behavior with replace flag.

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