Skip to main content
Glama
aptro

Superset MCP Integration

by aptro

superset_chart_list

Retrieve a paginated list of charts accessible to the current user from Apache Superset, including details like chart names, visualization types, and data sources.

Instructions

Get a list of charts from Superset

Makes a request to the /api/v1/chart/ endpoint to retrieve all charts the current user has access to view. Results are paginated.

Returns: A dictionary containing chart data including id, slice_name, viz_type, and datasource info

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • main.py:624-638 (handler)
    The handler function implementing the 'superset_chart_list' MCP tool. It is decorated with @mcp.tool() for registration, @requires_auth for authentication check, and @handle_api_errors for error handling. The function makes a GET request to Superset's /api/v1/chart/ endpoint to list all accessible charts.
    @mcp.tool()
    @requires_auth
    @handle_api_errors
    async def superset_chart_list(ctx: Context) -> Dict[str, Any]:
        """
        Get a list of charts from Superset
    
        Makes a request to the /api/v1/chart/ endpoint to retrieve all charts
        the current user has access to view. Results are paginated.
    
        Returns:
            A dictionary containing chart data including id, slice_name, viz_type, and datasource info
        """
        return await make_api_request(ctx, "get", "/api/v1/chart/")
  • main.py:624-624 (registration)
    The @mcp.tool() decorator registers the superset_chart_list function as an MCP tool.
    @mcp.tool()
  • The make_api_request helper function used by superset_chart_list to perform authenticated API requests to Superset with automatic token refresh and CSRF handling.
    async def make_api_request(
        ctx: Context,
        method: str,
        endpoint: str,
        data: Dict[str, Any] = None,
        params: Dict[str, Any] = None,
        auto_refresh: bool = True,
    ) -> Dict[str, Any]:
        """
        Helper function to make API requests to Superset
    
        Args:
            ctx: MCP context
            method: HTTP method (get, post, put, delete)
            endpoint: API endpoint (without base URL)
            data: Optional JSON payload for POST/PUT requests
            params: Optional query parameters
            auto_refresh: Whether to auto-refresh token on 401
        """
        superset_ctx: SupersetContext = ctx.request_context.lifespan_context
        client = superset_ctx.client
    
        # For non-GET requests, make sure we have a CSRF token
        if method.lower() != "get" and not superset_ctx.csrf_token:
            await get_csrf_token(ctx)
    
        async def make_request() -> httpx.Response:
            headers = {}
    
            # Add CSRF token for non-GET requests
            if method.lower() != "get" and superset_ctx.csrf_token:
                headers["X-CSRFToken"] = superset_ctx.csrf_token
    
            if method.lower() == "get":
                return await client.get(endpoint, params=params)
            elif method.lower() == "post":
                return await client.post(
                    endpoint, json=data, params=params, headers=headers
                )
            elif method.lower() == "put":
                return await client.put(endpoint, json=data, headers=headers)
            elif method.lower() == "delete":
                return await client.delete(endpoint, headers=headers)
            else:
                raise ValueError(f"Unsupported HTTP method: {method}")
    
        # Use auto_refresh if requested
        response = (
            await with_auto_refresh(ctx, make_request)
            if auto_refresh
            else await make_request()
        )
    
        if response.status_code not in [200, 201]:
            return {
                "error": f"API request failed: {response.status_code} - {response.text}"
            }
    
        return response.json()
  • The requires_auth decorator ensuring the user is authenticated before executing the tool.
    def requires_auth(
        func: Callable[..., Awaitable[Dict[str, Any]]],
    ) -> Callable[..., Awaitable[Dict[str, Any]]]:
        """Decorator to check authentication before executing a function"""
    
        @wraps(func)
        async def wrapper(ctx: Context, *args, **kwargs) -> Dict[str, Any]:
            superset_ctx: SupersetContext = ctx.request_context.lifespan_context
    
            if not superset_ctx.access_token:
                return {"error": "Not authenticated. Please authenticate first."}
    
            return await func(ctx, *args, **kwargs)
    
        return wrapper
  • The handle_api_errors decorator providing consistent error handling for API calls.
    def handle_api_errors(
        func: Callable[..., Awaitable[Dict[str, Any]]],
    ) -> Callable[..., Awaitable[Dict[str, Any]]]:
        """Decorator to handle API errors in a consistent way"""
    
        @wraps(func)
        async def wrapper(ctx: Context, *args, **kwargs) -> Dict[str, Any]:
            try:
                return await func(ctx, *args, **kwargs)
            except Exception as e:
                # Extract function name for better error context
                function_name = func.__name__
                return {"error": f"Error in {function_name}: {str(e)}"}
    
        return wrapper
Behavior4/5

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

With no annotations provided, the description carries the full burden and adds valuable behavioral context: it specifies the API endpoint ('/api/v1/chart/'), access control ('current user has access to view'), and pagination behavior. It also implies a read-only operation (consistent with 'Get'), though it doesn't detail error handling or rate limits. This compensates well for the lack of annotations.

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

Conciseness5/5

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

The description is efficiently structured in four sentences: purpose, endpoint/access details, pagination note, and return value summary. Each sentence adds essential information without redundancy, making it front-loaded and easy to parse. There's no wasted text.

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

Completeness4/5

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

Given 0 parameters, no annotations, and no output schema, the description provides good completeness: it covers purpose, endpoint, access scope, pagination, and return data structure (including key fields like id, slice_name). However, it doesn't specify the exact format of the 'dictionary' (e.g., keys, nested objects) or error cases, leaving minor gaps for a tool with no structured output documentation.

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 input schema has 0 parameters with 100% coverage, so no parameter documentation is needed. The description appropriately doesn't discuss parameters, earning a baseline of 4. It focuses on the tool's behavior and output instead, which is correct for a parameterless tool.

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 tool's purpose: 'Get a list of charts from Superset' with the verb 'Get' and resource 'charts'. It distinguishes from siblings like superset_chart_get_by_id (retrieves a single chart) and superset_chart_create/update/delete (mutations). However, it doesn't explicitly contrast with superset_dashboard_list or other list tools, keeping it at 4 rather than 5.

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

Usage Guidelines3/5

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

The description implies usage context by mentioning 'the current user has access to view' and 'Results are paginated,' suggesting when to use it for retrieving accessible, paginated chart lists. However, it lacks explicit guidance on when to choose this over alternatives like superset_dashboard_list or superset_dataset_list, and doesn't specify prerequisites (e.g., authentication).

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/aptro/superset-mcp'

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