Skip to main content
Glama

get_metrika_custom_query

Универсальный запрос к API отчётов Яндекс.Метрики (/stat/v1/data). Используйте, когда ни один из специализированных инструментов get_metrika_* не покрывает задачу: сами подберите нужные метрики, измерения, фильтры и сортировку.

Метрики (metrics) — до 20, примеры: ym:s:visits, ym:s:users, ym:s:newUsers, ym:s:pageviews, ym:s:bounceRate, ym:s:pageDepth, ym:s:avgVisitDurationSeconds, ym:s:goal<GOAL_ID>reaches, ym:s:goal<GOAL_ID>conversionRate, ym:s:ecommercePurchases, ym:s:ecommerceRevenue. Измерения (dimensions) — до 10, примеры: ym:s:date, ym:s:trafficSource, ym:s:lastTrafficSource, ym:s:searchEngine, ym:s:searchPhrase, ym:s:referer, ym:s:startURL, ym:s:URLPath, ym:s:landingPage, ym:s:deviceCategory, ym:s:browser, ym:s:operatingSystem, ym:s:regionCountry, ym:s:regionCity, ym:s:ageInterval, ym:s:gender, ym:s:UTMSource, ym:s:UTMMedium, ym:s:UTMCampaign. Фильтры (filters) — синтаксис API Метрики, например: "ym:s:trafficSource=='organic' AND ym:s:isRobot=='No'", "ym:s:regionCityName=='Москва'", "ym:s:pageViews>3", "EXISTS(ym:s:paramsLevel1=='ключ')". Операторы: ==, !=, >, <, >=, <=, =@ (содержит), !@, =~ (regexp), !~; условия объединяются AND/OR, скобки допустимы. Сортировка (sort) — имена запрошенных метрик или измерений, префикс "-" для убывания, например: ["-ym:s:visits"]. Если даты не указаны, возвращаются данные за последние 7 дней. Полный справочник метрик и измерений: https://yandex.ru/dev/metrika/ru/stat/attrandmetr/dim_all

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "project_id": "<project_id>",
      "metrics": "<metrics>"
    },
    "name": "get_metrika_custom_query"
  }
}

Input Schema

NameRequiredDescriptionDefault
sortNoСортировка по запрошенным метрикам или измерениям, префикс "-" для убывания.
limitNoКоличество результатов для возврата (максимум 1000).
offsetNoНомер первой строки выборки, начиная с 1.
date_toNoДата окончания периода в формате YYYY-MM-DD или значения: today, yesterday, ndaysAgo.
filtersNoФильтры в синтаксисе API Метрики (сырая строка).
metricsYesСписок метрик (максимум 20), например: ym:s:visits, ym:s:users.
date_fromNoДата начала периода в формате YYYY-MM-DD или значения: today, yesterday, ndaysAgo.
dimensionsNoСписок измерений (максимум 10), например: ym:s:trafficSource, ym:s:date.
project_idYesИдентификатор проекта.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

A4.5/5.0
Behavior4/5

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

No annotations are provided, so the description carries the burden, and it does most of it: it discloses the upstream endpoint, the default 7-day window when dates are omitted, and documents filter operators and sort syntax. It stops short of quotas, rate limits, error behavior and result shape, which matter for a raw API pass-through.

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?

Purpose and routing guidance are front-loaded, then parameter semantics are grouped in labeled blocks — an effective structure for a dense tool. The metric/dimension example lists are long, but since there are no enums in the schema they are largely justified.

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?

For a 9-parameter raw-query tool with no annotations, the description covers the hard parts: valid metric/dimension identifiers, filter grammar, sort format and the default date window. Output schema exists so return values need not be explained; paging and project scoping are left entirely to the schema, which is acceptable.

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 100%, so the baseline is 3, but the description goes beyond it with concrete metric/dimension names and filter expression examples with the full operator set (==, =@, =~, EXISTS). That is real added meaning for fields whose valid values are otherwise unknowable without reading external docs.

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 names a specific verb and resource — a universal query to the Yandex.Metrika reports API (/stat/v1/data) — and immediately scopes it against the get_metrika_* family. An agent can tell this is the escape hatch rather than one of the fixed reports.

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?

Explicitly states the selection rule: use only when no specialized get_metrika_* tool covers the task, and that the caller must choose metrics, dimensions, filters and sorting themselves. That is a clear when-to-use plus a named exclusion condition.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources