Skip to main content
Glama
voducdan

metabase-mcp

by voducdan

execute_card

Execute a saved Metabase card by providing its ID and optional parameters to retrieve query results.

Instructions

Execute a saved Metabase question/card and retrieve results.

Args: card_id: The ID of the card to execute. parameters: Optional parameters for the card execution.

Returns: Card execution results.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
card_idYes
parametersNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The execute_card tool handler — executes a saved Metabase question/card by ID via POST /api/card/{card_id}/query. Accepts optional parameters dict.
    @mcp.tool
    async def execute_card(
        card_id: int,
        ctx: Context,
        parameters: dict[str, Any] | None = None
    ) -> dict[str, Any]:
        """
        Execute a saved Metabase question/card and retrieve results.
    
        Args:
            card_id: The ID of the card to execute.
            parameters: Optional parameters for the card execution.
    
        Returns:
            Card execution results.
        """
        try:
            await ctx.info(f"Executing card {card_id}")
            payload = {}
            if parameters:
                payload["parameters"] = parameters
                await ctx.debug(f"Card parameters: {parameters}")
    
            result = await metabase_client.request("POST", f"/card/{card_id}/query", json=payload)
    
            row_count = len(result.get("data", {}).get("rows", []))
            await ctx.info(f"Card {card_id} executed successfully, returned {row_count} rows")
    
            return result
        except Exception as e:
            error_msg = f"Error executing card {card_id}: {e}"
            await ctx.error(error_msg)
            raise ToolError(error_msg) from e
  • server.py:447-448 (registration)
    Registration via the @mcp.tool decorator on the execute_card function. This is how the tool is registered with the FastMCP server.
    @mcp.tool
    async def execute_card(
Behavior3/5

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

With no annotations, the description minimally indicates the tool executes a card and returns results, implying a read-like operation. However, it does not clarify whether the execution modifies state or has side effects, leaving some ambiguity.

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 concise, using two sentences plus an Args/Returns block. It is front-loaded with the core purpose. However, it could be slightly more compact by removing the redundant 'Args' and 'Returns' labels if not needed.

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?

While the description covers the basic purpose and parameters, it lacks context about error handling, authentication requirements, or when to prefer this tool over similar ones (e.g., execute_query). Given the complexity and sibling tools, it is minimally adequate.

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 explains both parameters: card_id as the ID of the card, and parameters as optional execution parameters. This adds meaning beyond the schema's bare types (integer, object), especially given the schema's 0% description coverage.

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's function: 'Execute a saved Metabase question/card and retrieve results.' It uses a specific verb ('execute') and resource ('card'), distinguishing it from siblings like create_card or list_cards.

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 is provided on when to use this tool over alternatives such as execute_query or execute_mongodb_query. The description does not mention when it is appropriate or when to avoid it.

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