Yandex Metrica MCP
v0.2.3Yandex Metrica for AI agents: counters, goals, Reporting API and Logs API export over stdio.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
yandex_metrica_list_counters
List Yandex Metrica counters the configured token can access, with each counter id, name, and site. Use when the user needs a counter id before any other query. Do not use this to read one counter's settings; call yandex_metrica_get_counter once the id is known.
| Parameter | Type | Description |
|---|---|---|
page | integer | Page number (1-based) |
per_page | integer | Items per page (max 1000) |
search | string | Search by counter name or site URL |
sort | string | Sort order |
status | string | Filter by counter status |
type | string | Filter by counter type |
yandex_metrica_get_counter
Get one Yandex Metrica counter by id, including its settings, status, owner, timezone, and site. Use when the user already has a counter id and wants that counter's configuration. Do not use this to discover unknown ids; call yandex_metrica_list_counters instead.
| Parameter | Type | Description |
|---|---|---|
counter_id * | integer | Yandex Metrica counter (tag) ID |
yandex_metrica_list_goals
List conversion goals configured on one Yandex Metrica counter, including each goal id and type. Use when the user asks which goals exist on a counter before building a report. Do not use this for conversion counts or rates; call yandex_metrica_get_report with the goal metrics.
| Parameter | Type | Description |
|---|---|---|
counter_id * | integer | Yandex Metrica counter (tag) ID |
yandex_metrica_get_report
Run a Yandex Metrica Reporting API query and return aggregated statistics such as visits, users, bounce rate, and traffic sources. Use when the user wants a summary, a breakdown, or a comparison of two periods via date1_b and date2_b. Do not use this for row-level visits or pageviews; call yandex_metrica_evaluate_logs_request and the other Logs API tools. Metrics use the ym:s: prefix for visits and ym:pv: for hits.
| Parameter | Type | Description |
|---|---|---|
counter_ids * | array | One or more counter IDs to query |
metrics * | array | Metrics to include, e.g. ['ym:s:visits', 'ym:s:pageviews', 'ym:s:bounceRate']. Max 20. |
accuracy | string | Sampling accuracy (default: medium) |
attribution | string | Attribution model for traffic source metrics. 'lastsign' = last significant source; 'automatic' = auto-attribution. |
currency | string | Currency code (ISO 4217), e.g. 'RUB' |
date1 | string | Start date (YYYY-MM-DD or 'today', 'yesterday', '7daysAgo'). Default: 7daysAgo |
date1_b | string | Comparison segment B start date. When provided with date2_b, uses the comparison endpoint (/stat/v1/data/comparison). date1/date2 become segment A. Each row returns two sets of metrics. |
date2 | string | End date (YYYY-MM-DD or relative). Default: today |
date2_b | string | Comparison segment B end date. Must be provided together with date1_b. |
dimensions | array | Dimensions for grouping, e.g. ['ym:s:date', 'ym:s:regionCityName'] |
filters | string | Filter expression, e.g. "ym:s:trafficSourceName=='Organic Search'" |
filters_a | string | Segmentation filter for segment A only (comparison mode) |
filters_b | string | Segmentation filter for segment B only (comparison mode) |
include_undefined | boolean | Include rows with undefined dimension values |
lang | string | Language for dimension value names (default: ru) |
limit | integer | Rows to return (default 100) |
offset | integer | Row offset for pagination (1-based) |
preset | string | Preset report name (e.g. 'sources_summary'). Overrides metrics/dimensions. |
sort | array | Sort fields. Prefix with '-' for descending, e.g. ['-ym:s:visits', 'ym:s:date'] |
yandex_metrica_evaluate_logs_request
Check whether a Yandex Metrica Logs API export can be created for the given dates, source, and fields, without creating a request. Use when the user wants to know if a raw export is possible and how many days fit the quota. Do not use this to start the export; call yandex_metrica_create_logs_request after the check succeeds.
| Parameter | Type | Description |
|---|---|---|
counter_id * | integer | Yandex Metrica counter (tag) ID |
date1 * | string | Start date YYYY-MM-DD |
date2 * | string | End date YYYY-MM-DD (cannot be current day) |
fields * | array | Fields to export. For visits: ['ym:s:visitID','ym:s:date','ym:s:clientID',...]. For hits: ['ym:pv:watchID','ym:pv:date','ym:pv:URL',...] |
source * | string | 'hits' for pageview-level data, 'visits' for session-level data |
yandex_metrica_create_logs_request
Create an asynchronous Yandex Metrica Logs API export of raw visits or hits for one counter and date range. Use when the user wants row-level data and yandex_metrica_evaluate_logs_request has shown the export is possible. Do not use this only to test feasibility, and do not use it for aggregated totals; call yandex_metrica_get_report for those. Poll yandex_metrica_get_logs_request until the status is processed. date2 cannot be today. Fields use the ym:s: prefix for visits and ym:pv: for hits.
| Parameter | Type | Description |
|---|---|---|
counter_id * | integer | Yandex Metrica counter (tag) ID |
date1 * | string | Start date YYYY-MM-DD |
date2 * | string | End date YYYY-MM-DD (cannot be current day) |
fields * | array | Fields to export. See Yandex Metrica Logs API documentation for full field lists. |
source * | string | 'hits' for pageview-level data, 'visits' for session-level data |
attribution | string | Attribution model for traffic source fields. Default: lastsign. |
yandex_metrica_list_logs_requests
List every Logs API export request on a Yandex Metrica counter, in any status from created through cleaned. Use when the user wants to see existing exports or find a request id. Do not use this to poll a single request; call yandex_metrica_get_logs_request with that request id.
| Parameter | Type | Description |
|---|---|---|
counter_id * | integer | Yandex Metrica counter (tag) ID |
yandex_metrica_get_logs_request
Get the status and prepared parts of one Yandex Metrica Logs API export request. Use when the user is waiting for a created export to reach processed before downloading it. Do not use this to fetch the TSV rows; call yandex_metrica_download_logs_part once the status is processed. Do not use it to list every request; call yandex_metrica_list_logs_requests.
| Parameter | Type | Description |
|---|---|---|
counter_id * | integer | Yandex Metrica counter (tag) ID |
request_id * | integer | Logs API request ID |
yandex_metrica_download_logs_part
Download one processed part of a Yandex Metrica Logs API export as TSV text. Use when the user wants the rows of a request whose status is already processed. Do not use this to check whether the export is ready; call yandex_metrica_get_logs_request first. Preview mode returns about the first 50KB; full mode is only for small parts under 10MB. Part numbers come from the parts list returned by yandex_metrica_get_logs_request and start at 0.
| Parameter | Type | Description |
|---|---|---|
counter_id * | integer | Yandex Metrica counter (tag) ID |
part_number * | integer | Part number (0-based) |
request_id * | integer | Logs API request ID |
mode | string | Output mode. 'preview' returns first ~50KB with metadata (safe default). 'full' returns entire content — may be very large for big exports. |
yandex_metrica_cancel_logs_request
Cancel a Yandex Metrica Logs API export that is still pending, in status created or awaiting_retry. Use when the user wants to stop an export that has not been processed yet. Do not use this on a processed request; call yandex_metrica_clean_logs_request to delete the prepared files.
| Parameter | Type | Description |
|---|---|---|
counter_id * | integer | Yandex Metrica counter (tag) ID |
request_id * | integer | Logs API request ID |
yandex_metrica_clean_logs_request
Delete the prepared files of a processed Yandex Metrica Logs API export and free the export quota. Use when the user has finished downloading and the request status is processed. Do not use this to stop a request that is still pending; call yandex_metrica_cancel_logs_request instead.
| Parameter | Type | Description |
|---|---|---|
counter_id * | integer | Yandex Metrica counter (tag) ID |
request_id * | integer | Logs API request ID |
yandex_metrica_create_counter
Create a new Yandex Metrica counter for a site and return its id and tracking code. Use when the user asks to add a website or start tracking a new property. Do not use this to find a counter that already exists; call yandex_metrica_list_counters or yandex_metrica_get_counter.
| Parameter | Type | Description |
|---|---|---|
name * | string | Counter name |
site * | string | Site domain (e.g. "example.com") |
gdpr_agreement_accepted | boolean | GDPR agreement accepted (required for EU sites) |
mirrors | array | Mirror domains |
time_zone_name | string | Timezone (e.g. "Europe/Moscow") |
yandex_metrica_delete_counter
Delete one Yandex Metrica counter; it stops collecting data and its statistics are no longer available through the API. Use when the user explicitly asks to remove a counter and has confirmed the deletion. Do not use this to inspect a counter; call yandex_metrica_get_counter instead.
| Parameter | Type | Description |
|---|---|---|
counter_id * | integer | Yandex Metrica counter (tag) ID |