Skip to main content
Glama
artgas1

yandex-metrika-mcp-server

Сравнение сегментов

metrika_stat_comparison
Read-onlyIdempotent

Compare two Yandex Metrica data segments in a table. Define separate date ranges and segmentation filters for segment A and segment B to see side-by-side metrics.

Instructions

Сравнение сегментов. Позволяет сравнить два сегмента данных, указанные в запросе. Сегменты идентифицируются как сегмент А и сегмент B. Для каждого сегмента можно задать разные диапазоны дат и фильтры сегментации. Данные будут представлены в виде таблицы. [GET https://api-metrika.yandex.net/stat/v1/data/comparison] Документация: https://yandex.ru/dev/metrika/ru/stat/openapi/comparison_1.md

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idsYesИдентификаторы счетчиков, через запятую. Пример: 44147844,2215573.
langNoЯзык.
sortNoСписок группировок и метрик, разделенных запятой, по которым осуществляется сортировка. По умолчанию сортировка производится по убыванию (указан знак `-` перед группировкой или метрикой). Чтобы отсортировать данные по возрастанию, удалите знак `-`.
limitNoКоличество элементов на странице выдачи. По умолчанию: 100.
offsetNoИндекс первой строки выборки, начиная с 1. По умолчанию: 1.
presetNo[Шаблон отчета](https://yandex.ru/dev/metrika/ru/stat/presets.md). Пример: sources_summary.
prettyNoЗадает форматирование результата. Чтобы использовать форматирование, укажите значение `true`. По умолчанию: false.
date1_aNoДата начала периода выборки для сегмента A в формате YYYY-MM-DD. Также поддерживаются значения: `today`, `yesterday`, `ndaysAgo`. По умолчанию: 6daysAgo.
date1_bNoДата начала периода выборки для сегмента B в формате YYYY-MM-DD. Также поддерживаются значения: `today`, `yesterday`, `ndaysAgo`. По умолчанию: 6daysAgo.
date2_aNoДата окончания периода выборки для сегмента A в формате YYYY-MM-DD. Также поддерживаются значения: `today`, `yesterday`, `ndaysAgo`. По умолчанию: today.
date2_bNoДата окончания периода выборки для сегмента B в формате YYYY-MM-DD. Также поддерживаются значения: `today`, `yesterday`, `ndaysAgo`. По умолчанию: today.
filtersNoФильтр [сегментации](https://yandex.ru/dev/metrika/ru/stat/segmentation.md).
metricsYesСписок метрик, разделенных запятой. Пример: ym:s:pageviews.
accuracyNoРазмер выборки, используемой для отчета. Позволяет управлять [семплированием](https://yandex.ru/dev/metrika/ru/stat/sampling.md) (количеством визитов, использованных при расчете итогового значения).
callbackNoФункция обратного вызова, которая обрабатывает ответ API.
timezoneNoЧасовой пояс в формате ±hh:mm в диапазоне [-23:59; +23:59] (знак плюса нужно передавать как `%2B`), Пример: +03:00.
filters_aNoФильтр сегментации для сегмента A.
filters_bNoФильтр сегментации для сегмента A.
dimensionsNoСписок группировок, разделенных запятой. Пример: ym:s:trafficSource.
include_undefinedNoВключает в ответ строки, для которых значения группировок не определены. Влияет только на первую группировку. По умолчанию выключено.
proposed_accuracyNoЕсли параметр выставлен в `true`, API имеет право автоматически увеличивать accuracy до рекомендованного значения.Когда идет запрос в маленькую таблицу с очень маленьким семплингом, параметр поможет получить осмысленные результаты.
human_traffic_onlyNoРезать роботов. По умолчанию true. Добавляет к filters: ym:s:isRobot=='no'. Не применяется к метрикам и измерениям ym:ad: и ym:ev: — Метрика отвечает на них 400.
direct_client_loginsNoЛогины клиентов Яндекс Директа, через запятую. Могут использоваться для формирования отчета [Директ-расходы](https://yandex.ru/dev/metrika/ru/stat/direct-clicks.md). Пример: login1,login2.

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv3.3.1

TDQS

A3.5/5.0
Behavior3/5

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

Annotations already establish the safety profile (readOnlyHint=true, idempotentHint=true, destructiveHint=false), so the bar for the description is lower. It adds the HTTP GET endpoint and states the response arrives as a table. It does not go deeper — nothing about pagination, sampling behavior, or limits — but nothing contradicts the annotations.

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 compact — four sentences conveying the core concept, endpoint, and documentation link. The first sentence slightly restates the title, but the content is otherwise front-loaded and free of filler.

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 read-only tool with 23 fully documented parameters and no output schema, the description gives the essential conceptual model (A/B segments, per-segment dates and filters, table output) plus an endpoint and a full documentation link. It could add return-value or pagination details since no output schema exists, but the annotations and 100% schema coverage keep this adequate.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so each of the 23 parameters is already documented and the baseline is 3. The description adds a mild semantic layer by explaining the A/B pairing, which helps the agent understand date1_a/date1_b/date2_a/date2_b and filters/filters_a/filters_b as per-segment groups. It lists no parameter syntax or examples beyond what the schema provides.

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 names a specific operation — comparing two data segments (сегмент А и сегмент B) — with a clear verb, resource, and the ability to set distinct date ranges and filters per segment. This distinguishes it from sibling stat tools like metrika_stat_data or metrika_stat_pivot. However, it doesn't explicitly call out the closest sibling, metrika_stat_comparison_drilldown, leaving some differentiation to inference.

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?

Usage context is only implied: the tool is for comparing two segments with different date ranges and filters, which the description states. There is no explicit when-to-use vs. alternatives guidance, no exclusions, and no mention of when metrika_stat_data or metrika_stat_comparison_drilldown would be more appropriate. The docs link is provided, but the description itself leaves routing decisions to the agent.

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