Skip to main content
Glama
PiwikPRO

Piwik PRO MCP Server

Official
by PiwikPRO

analytics_metrics_details_list

Read-only

List details for specified metrics to identify all metrics available as columns in analytics queries.

Instructions

    List details of provided metrics.

    Returns all metrics that can be used as columns in analytics_query_execute.

    Args:
        website_id: UUID of the website/app to get metrics for
        metrics: list of metric names

    Returns:
        The list of all available metrics with details
    

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
website_idYes
metricsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
metricsYes
calculated_metricsYes

Implementation Reference

  • The analytics_metrics_details_list function is the core handler for this MCP tool. It is decorated with @mcp.tool and accepts a website_id (UUID) and list of metric names, then fetches metric details from the Piwik PRO API and returns a MetricsDetailsList model with regular_metrics and calculated_metrics.
    @mcp.tool(annotations=ToolAnnotations(title="Piwik PRO: List Metrics Details", readOnlyHint=True))
    def analytics_metrics_details_list(website_id: str, metrics: list[str]) -> MetricsDetailsList:
        """
        List details of provided metrics.
    
        Returns all metrics that can be used as columns in analytics_query_execute.
    
        Args:
            website_id: UUID of the website/app to get metrics for
            metrics: list of metric names
    
        Returns:
            The list of all available metrics with details
        """
        client = create_piwik_client()
        regular_metrics, calculated_metrics = [], []
        for metric in client.analytics.list_metrics(website_id).root:
            if metric.column_id == "calculated_metric" and metric.calculated_metric_id in metrics:
                calculated_metrics.append(metric)
            elif metric.column_id in metrics:
                regular_metrics.append(metric)
    
        return MetricsDetailsList(metrics=regular_metrics, calculated_metrics=calculated_metrics).model_dump(
            exclude_none=True
        )  # type: ignore
  • The MetricsDetailsList Pydantic model is the response schema for the tool. It contains two fields: 'metrics' (list of ColumnDefinition) and 'calculated_metrics' (list of ColumnDefinition).
    class MetricsDetailsList(BaseModel):
        """Response for analytics_list_details_metrics tool."""
    
        metrics: list[ColumnDefinition]
        calculated_metrics: list[ColumnDefinition]
  • The register_analytics_tools function in __init__.py calls register_query_tools(mcp), which is the function that registers the analytics_metrics_details_list tool via the @mcp.tool decorator.
    def register_analytics_tools(mcp: FastMCP) -> None:
        """
        Register all Analytics tools with the MCP server.
    
        This includes:
        - User annotations tools
        - Goals tools
        - Query tools
        - Custom dimensions tools (unified standard and product dimensions)
    
        Args:
            mcp: FastMCP server instance
        """
        register_annotations_tools(mcp)
        register_goals_tools(mcp)
        register_query_tools(mcp)
        register_custom_dimensions_tools(mcp)
  • The create_piwik_client helper is imported from piwik_pro_mcp.common.utils and used within the tool handler to instantiate the Piwik PRO API client for fetching metric data.
    from piwik_pro_mcp.common.utils import create_piwik_client, fetch_json_from_url
    
    from .models import DimensionsDetailsList, DimensionsList, MetricsDetailsList, MetricsList, QueryExecuteResponse
Behavior4/5

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

Annotations already indicate readOnlyHint=true, so the description's job is light. It adds context that the returned metrics are 'all available metrics with details' and usable as columns, which is valuable beyond the annotation. No contradictions.

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 structured with an Args section and is clear, though slightly verbose with the 'Returns:' line. It is front-loaded with the main purpose and uses minimal words.

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 the output schema exists and parameters are explained, the description covers what the tool does, its inputs, and output. It could mention differentiation from analytics_metrics_list, but overall sufficient.

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?

Schema coverage is 0%, so description must explain parameters. It does so by defining website_id as 'UUID of the website/app' and metrics as 'list of metric names', adding meaning beyond the schema's titles.

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 verb 'List details' and the resource 'provided metrics', and distinguishes from sibling tools like analytics_metrics_list by specifying it returns all metrics usable as columns in analytics_query_execute.

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

Usage Guidelines4/5

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

The description explains the tool returns metrics that can be used as columns for query execution, implying when to use it. However, it does not explicitly mention when not to use or provide alternative tools, such as analytics_metrics_list for just names.

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/PiwikPRO/mcp'

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