Skip to content

Aggregate and product drilldown

Query a category scope, then rank products under the same filters.

Authenticated runtime tools and each query response are authoritative for tenant scope and current data coverage.

This is an MCP query composition, not a complete business report; see Research Methods in the Agent Docs for complete workflows.

Required inputs

scopeRequired · search_values

Exact category value

category_l3
timeRequired · user_required

Analysis time range

ranking_metricOptional · user_required

Product ranking metric

Default: gmv · Allowed values: gmv, units
top_nOptional · user_required

Number of products

Default: 20

Execution steps

  1. 1
    resolve_scope · search_values

    Resolve the category value.

    Request contract
    category_l3 ← $scope
  2. 2
    query_scope · query_metrics

    Query aggregate sales and units.

    Request contract
    metrics: gmv, unitsfilter: category_l3 eq $scopetime: $time
  3. 3
    query_products · query_metrics

    Query products under the same scope.

    Request contract
    metrics: gmv, unitsgroup_by: product_id, title, product_urlfilter: category_l3 eq $scopetime: $timeorder_by: $ranking_metric desclimit: $top_n

Call example

Replace example values with exact user inputs or platform values returned by search_values.

search_values
{
  "dataset": "douyin",
  "field": "category_l3",
  "kw": "示例品类",
  "limit": 10,
  "task_query": "使用 douyin 数据执行汇总与商品下钻;scope=示例品类,time={\"last_complete_months\":3},ranking_metric=gmv,top_n=10"
}
query_metrics
{
  "additional_queries": [
    {
      "filters": [
        {
          "field": "category_l3",
          "op": "eq",
          "value": "示例品类"
        }
      ],
      "group_by": [
        "product_id",
        "title",
        "product_url"
      ],
      "limit": 10,
      "metrics": [
        "gmv",
        "units"
      ],
      "name": "query_products",
      "order_by": [
        {
          "dir": "desc",
          "field": "gmv"
        }
      ],
      "time": {
        "last_complete_months": 3
      }
    }
  ],
  "dataset": "douyin",
  "filters": [
    {
      "field": "category_l3",
      "op": "eq",
      "value": "示例品类"
    }
  ],
  "main_query_name": "query_scope",
  "metrics": [
    "gmv",
    "units"
  ],
  "task_query": "使用 douyin 数据执行汇总与商品下钻;scope=示例品类,time={\"last_complete_months\":3},ranking_metric=gmv,top_n=10",
  "time": {
    "last_complete_months": 3
  }
}

Agent computation

rank_products · rank

Rank products by the selected metric.

source_steps: query_products

Output policy

  • Show the aggregate before the product ranking.

Stop conditions

  • Stop if the scope cannot be resolved exactly.

Limitations

  • Keep aggregate and drilldown filters identical.