Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(data-catalog): cap metric descriptions at 300 characters (#113952)

Thiago Salvatoref5dfd4dad0e7
diff --git a/products/data_catalog/backend/facade/api.py b/products/data_catalog/backend/facade/api.py
index ce21b294dc8a..c0523cd3f0ba 100644
--- a/products/data_catalog/backend/facade/api.py
+++ b/products/data_catalog/backend/facade/api.py
@@ -42,13 +42,14 @@ from ..logic.metrics import (
upsert_metric,
)
from ..logic.relationships import accept_proposal, propose_relationship, reject_proposal, relationships_for_team
-from ..logic.validation import MAX_DESCRIPTION_LENGTH, validate_metric_definition
+from ..logic.validation import DESCRIPTION_TOO_LONG_MESSAGE, MAX_DESCRIPTION_LENGTH, validate_metric_definition
from ..models import METRIC_NAME_MAX_LENGTH
from .contracts import HogQLMetricDefinition, MetricRead, MetricSummary
from .models import Metric, RelationshipProposal, TableCertification
__all__ = [
"BULK_SKIP_NOT_FOUND",
+ "DESCRIPTION_TOO_LONG_MESSAGE",
"MAX_DESCRIPTION_LENGTH",
"METRIC_BULK_MAX",
"METRIC_NAME_MAX_LENGTH",
diff --git a/products/data_catalog/backend/logic/validation.py b/products/data_catalog/backend/logic/validation.py
index 956c959d893f..5c4101d78464 100644
--- a/products/data_catalog/backend/logic/validation.py
+++ b/products/data_catalog/backend/logic/validation.py
@@ -41,7 +41,12 @@ _SUPPORTED_KINDS = {HOGQL_DEFINITION_KIND, *_NODE_MODELS, *_INSIGHT_MODELS}
MAX_MARKDOWN_DEFINITION_LENGTH = 20_000
# A description is a few sentences of business meaning; a narrated query walkthrough blows past this.
-MAX_DESCRIPTION_LENGTH = 1_000
+MAX_DESCRIPTION_LENGTH = 300
+DESCRIPTION_TOO_LONG_MESSAGE = (
+ f"Description is too long. Say what the metric is in 1-2 short sentences, under {MAX_DESCRIPTION_LENGTH} "
+ "characters. Leave out source tables, lineage, column lists, and comparisons with other metrics; put query "
+ "rationale in 'reasoning'."
+)
# HogQLQuery carries fields that would let a caller bypass team query controls (a raw ClickHouse
# passthrough, an arbitrary DB connection). A metric definition may only set these.
@@ -104,12 +109,7 @@ def _fail(error: str, hint: str) -> NoReturn:
def validate_description(description: str) -> None:
"""Reject a description too long to be a summary. Raises keyed by the ``description`` field."""
if len(description) > MAX_DESCRIPTION_LENGTH:
- raise ValidationError(
- {
- "description": f"Description is too long. State what the metric means and what it serves in 1-3 "
- f"sentences (under {MAX_DESCRIPTION_LENGTH} characters), and put query rationale in 'reasoning'."
- }
- )
+ raise ValidationError({"description": DESCRIPTION_TOO_LONG_MESSAGE})
def validate_metric_definition(definition: dict, team: Team, user: Optional[User] = None) -> tuple[dict, list[str]]:
diff --git a/products/data_catalog/backend/presentation/serializers.py b/products/data_catalog/backend/presentation/serializers.py
index 2f125b9ce783..693140cb6077 100644
--- a/products/data_catalog/backend/presentation/serializers.py
+++ b/products/data_catalog/backend/presentation/serializers.py
@@ -13,7 +13,7 @@ from posthog.api.shared import UserBasicSerializer
from posthog.schema_enums import IntervalType
from ..facade import api
-from ..facade.api import MAX_DESCRIPTION_LENGTH, METRIC_NAME_MAX_LENGTH
+from ..facade.api import DESCRIPTION_TOO_LONG_MESSAGE, MAX_DESCRIPTION_LENGTH, METRIC_NAME_MAX_LENGTH
from ..facade.enums import CreatedSource
from ..facade.models import Metric, RelationshipProposal, TableCertification
@@ -183,10 +183,12 @@ class MetricSerializer(serializers.ModelSerializer):
},
"display_name": {"help_text": "Human-friendly label. Mutable, unlike name."},
"description": {
- "help_text": "What the metric means and what it serves, in 1-3 short sentences: the business "
- "meaning plus any load-bearing inclusions/exclusions or grain. Never narrate or restate the "
- "query - the definition carries the mechanics; put rationale for query choices in 'reasoning'.",
+ "help_text": "What the number is, in 1-2 short sentences under 300 characters: its meaning and "
+ "grain plus any inclusion or exclusion that changes it. Leave out source tables or views, lineage, "
+ "column lists, and comparisons with other metrics. Never narrate the query - the definition carries "
+ "the mechanics; put rationale for query choices in 'reasoning'.",
"max_length": MAX_DESCRIPTION_LENGTH,
+ "error_messages": {"max_length": DESCRIPTION_TOO_LONG_MESSAGE},
},
"unit": {"help_text": "Unit of the result, e.g. usd, percent, cents."},
"ai_model": {"help_text": "Model that generated the metric, if AI-authored."},
diff --git a/products/data_catalog/backend/tests/test_api.py b/products/data_catalog/backend/tests/test_api.py
index c6ae2119d234..4531a51e29da 100644
--- a/products/data_catalog/backend/tests/test_api.py
+++ b/products/data_catalog/backend/tests/test_api.py
@@ -18,6 +18,7 @@ from posthog.models.utils import generate_random_token_personal, hash_key_value
from posthog.rate_limit import ClickHouseBurstRateThrottle, HogQLQueryThrottle
from products.access_control.backend.models.access_control import AccessControl
+from products.data_catalog.backend.facade.api import DESCRIPTION_TOO_LONG_MESSAGE, MAX_DESCRIPTION_LENGTH
from products.data_catalog.backend.facade.enums import MetricStatus
from products.data_catalog.backend.logic.metrics import (
BULK_SKIP_ALREADY_APPROVED,
@@ -64,9 +65,12 @@ class TestMetricAPI(APIBaseTest):
assert response.json()["approved_at"] is None
def test_overlong_description_rejected(self) -> None:
- response = self.client.post(self.url, {"name": "mrr", "description": "x" * 1_001}, format="json")
+ response = self.client.post(
+ self.url, {"name": "mrr", "description": "x" * (MAX_DESCRIPTION_LENGTH + 1)}, format="json"
+ )
assert response.status_code == status.HTTP_400_BAD_REQUEST
assert response.json()["attr"] == "description"
+ assert response.json()["detail"] == DESCRIPTION_TOO_LONG_MESSAGE
def test_create_is_upsert_on_name(self) -> None:
self.client.post(self.url, {"name": "mrr", "description": "v1"}, format="json")
diff --git a/products/data_catalog/evals/constants.py b/products/data_catalog/evals/constants.py
index d9e707e5842f..2d79ae7b0a0c 100644
--- a/products/data_catalog/evals/constants.py
+++ b/products/data_catalog/evals/constants.py
@@ -18,9 +18,9 @@ METRIC_UPDATE_TOOL = "data-catalog-metric-update"
APPROVED_BADGE_CODE_POINT = "\U0001f6e1"
PROPOSED_BADGE_ICON = "\U0001f4dd"
-# Deliberately tighter than the server cap (validation.MAX_DESCRIPTION_LENGTH = 1000): the eval
+# Deliberately tighter than the server cap (validation.MAX_DESCRIPTION_LENGTH = 300): the eval
# catches verbosity the hard cap would still admit.
-EVAL_DESCRIPTION_CHAR_LIMIT = 500
+EVAL_DESCRIPTION_CHAR_LIMIT = 200
TOP_CUSTOMERS_METRIC_NAME = "top_customers_mrr_by_business_model"
TOP_CUSTOMERS_METRIC_DISPLAY_NAME = "Top B2C customers by revenue"
diff --git a/products/data_catalog/evals/scorers.py b/products/data_catalog/evals/scorers.py
index 5dc479f5c7ac..f13eb6937b72 100644
--- a/products/data_catalog/evals/scorers.py
+++ b/products/data_catalog/evals/scorers.py
@@ -468,10 +468,11 @@ class MetricDescriptionConcise(Scorer):
METRIC_DESCRIPTION_QUALITY_PROMPT = """\
You are grading the 'description' an agent wrote when saving a metric to a governed catalog.
-A good description states, in 1-3 sentences, what the metric means and what it serves: the
-business meaning plus any load-bearing inclusions/exclusions or grain. It must not narrate or
-restate the query or calculation steps - those live in the metric's definition, and the agent's
-rationale belongs in the separate 'reasoning' field.
+A good description states, in 1-2 short sentences, what the number is: its meaning and grain plus
+any inclusion or exclusion that changes it. It must not narrate or restate the query or calculation
+steps - those live in the metric's definition, and the agent's rationale belongs in the separate
+'reasoning' field. It must not name source tables or views, trace lineage, list columns, or compare
+with or point to other metrics.
The description to grade:
<description>{{output.description}}</description>
@@ -482,9 +483,10 @@ The metric's definition, for reference, to spot narration:
The agent's reasoning field:
<reasoning>{{output.reasoning}}</reasoning>
-Answer "yes" only if the description is 1-3 sentences stating meaning and purpose without walking
+Answer "yes" only if the description is 1-2 sentences stating what the number is without walking
through the query or calculation steps. Answer "no" if it narrates the query, restates SQL or
-step-by-step mechanics, or pads beyond 3 sentences."""
+step-by-step mechanics, names source tables or lineage, lists columns, compares with or points to
+other metrics, or pads beyond 2 sentences."""
class MetricDescriptionQuality(JudgedScorer):
diff --git a/products/data_catalog/frontend/common.ts b/products/data_catalog/frontend/common.ts
index 99b2fa27d2e6..efad58c06b6e 100644
--- a/products/data_catalog/frontend/common.ts
+++ b/products/data_catalog/frontend/common.ts
@@ -41,7 +41,7 @@ export function validateMetricName(name: string): string | undefined {
}
// Mirrors MAX_DESCRIPTION_LENGTH enforced in products/data_catalog/backend/logic/validation.py.
-export const METRIC_DESCRIPTION_MAX_LENGTH = 1000
+export const METRIC_DESCRIPTION_MAX_LENGTH = 300
// Mirrors MAX_MARKDOWN_DEFINITION_LENGTH enforced in products/data_catalog/backend/logic/validation.py.
export const METRIC_MARKDOWN_MAX_LENGTH = 20000
@@ -55,7 +55,7 @@ export function metricCount(count: number): string {
export function validateMetricDescription(description: string): string | undefined {
if (description.length > METRIC_DESCRIPTION_MAX_LENGTH) {
- return `Keep the description under ${METRIC_DESCRIPTION_MAX_LENGTH} characters. Say what the metric means in a few sentences.`
+ return `Keep the description under ${METRIC_DESCRIPTION_MAX_LENGTH} characters. Say what the number is in one or two sentences.`
}
return undefined
}
diff --git a/products/data_catalog/frontend/components/MetricFromInsightModal.tsx b/products/data_catalog/frontend/components/MetricFromInsightModal.tsx
index 126c85f8ae20..5468e3442db5 100644
--- a/products/data_catalog/frontend/components/MetricFromInsightModal.tsx
+++ b/products/data_catalog/frontend/components/MetricFromInsightModal.tsx
@@ -115,7 +115,7 @@ export function MetricFromInsightModal({ insightShortId, insightName }: MetricFr
<LemonField.Pure
label="Description"
error={descriptionError}
- info="1-3 sentences: what the metric means and what it serves."
+ info="One or two short sentences: what the number is and what it counts."
>
<LemonInput
value={description}
diff --git a/products/data_catalog/frontend/components/NewMetricModal.tsx b/products/data_catalog/frontend/components/NewMetricModal.tsx
index ffa536184014..63de01640aa2 100644
--- a/products/data_catalog/frontend/components/NewMetricModal.tsx
+++ b/products/data_catalog/frontend/components/NewMetricModal.tsx
@@ -69,7 +69,7 @@ export function NewMetricModal(): JSX.Element {
<LemonField.Pure
label={METRIC_FIELD_COPY.description.label}
error={descriptionError}
- info="1-3 sentences: what the metric means and what it serves."
+ info="One or two short sentences: what the number is and what it counts."
>
<LemonTextArea
value={newMetricForm.description}
diff --git a/products/data_catalog/frontend/generated/api.schemas.ts b/products/data_catalog/frontend/generated/api.schemas.ts
index 7f9659b60df2..f291d93d8498 100644
--- a/products/data_catalog/frontend/generated/api.schemas.ts
+++ b/products/data_catalog/frontend/generated/api.schemas.ts
@@ -167,8 +167,8 @@ export interface DataCatalogMetricApi {
*/
display_name?: string
/**
- * What the metric means and what it serves, in 1-3 short sentences: the business meaning plus any load-bearing inclusions/exclusions or grain. Never narrate or restate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'.
- * @maxLength 1000
+ * What the number is, in 1-2 short sentences under 300 characters: its meaning and grain plus any inclusion or exclusion that changes it. Leave out source tables or views, lineage, column lists, and comparisons with other metrics. Never narrate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'.
+ * @maxLength 300
*/
description: string
/**
@@ -267,8 +267,8 @@ export interface PatchedDataCatalogMetricApi {
*/
display_name?: string
/**
- * What the metric means and what it serves, in 1-3 short sentences: the business meaning plus any load-bearing inclusions/exclusions or grain. Never narrate or restate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'.
- * @maxLength 1000
+ * What the number is, in 1-2 short sentences under 300 characters: its meaning and grain plus any inclusion or exclusion that changes it. Leave out source tables or views, lineage, column lists, and comparisons with other metrics. Never narrate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'.
+ * @maxLength 300
*/
description?: string
/**
diff --git a/products/data_catalog/frontend/generated/api.zod.ts b/products/data_catalog/frontend/generated/api.zod.ts
index bccd4e4ff885..db8c939d3c61 100644
--- a/products/data_catalog/frontend/generated/api.zod.ts
+++ b/products/data_catalog/frontend/generated/api.zod.ts
@@ -39,7 +39,7 @@ export const dataCatalogMetricsCreateBodyNameMax = 128
export const dataCatalogMetricsCreateBodyNameRegExp = new RegExp('^[A-Za-z][A-Za-z0-9_]\*$')
export const dataCatalogMetricsCreateBodyDisplayNameMax = 255
-export const dataCatalogMetricsCreateBodyDescriptionMax = 1000
+export const dataCatalogMetricsCreateBodyDescriptionMax = 300
export const dataCatalogMetricsCreateBodyUnitMax = 64
@@ -67,7 +67,7 @@ export const DataCatalogMetricsCreateBody = /* @__PURE__ */ zod.object({
.string()
.max(dataCatalogMetricsCreateBodyDescriptionMax)
.describe(
- "What the metric means and what it serves, in 1-3 short sentences: the business meaning plus any load-bearing inclusions\/exclusions or grain. Never narrate or restate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'."
+ "What the number is, in 1-2 short sentences under 300 characters: its meaning and grain plus any inclusion or exclusion that changes it. Leave out source tables or views, lineage, column lists, and comparisons with other metrics. Never narrate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'."
),
unit: zod
.string()
@@ -114,7 +114,7 @@ export const dataCatalogMetricsUpdateBodyNameMax = 128
export const dataCatalogMetricsUpdateBodyNameRegExp = new RegExp('^[A-Za-z][A-Za-z0-9_]\*$')
export const dataCatalogMetricsUpdateBodyDisplayNameMax = 255
-export const dataCatalogMetricsUpdateBodyDescriptionMax = 1000
+export const dataCatalogMetricsUpdateBodyDescriptionMax = 300
export const dataCatalogMetricsUpdateBodyUnitMax = 64
@@ -142,7 +142,7 @@ export const DataCatalogMetricsUpdateBody = /* @__PURE__ */ zod.object({
.string()
.max(dataCatalogMetricsUpdateBodyDescriptionMax)
.describe(
- "What the metric means and what it serves, in 1-3 short sentences: the business meaning plus any load-bearing inclusions\/exclusions or grain. Never narrate or restate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'."
+ "What the number is, in 1-2 short sentences under 300 characters: its meaning and grain plus any inclusion or exclusion that changes it. Leave out source tables or views, lineage, column lists, and comparisons with other metrics. Never narrate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'."
),
unit: zod
.string()
@@ -189,7 +189,7 @@ export const dataCatalogMetricsPartialUpdateBodyNameMax = 128
export const dataCatalogMetricsPartialUpdateBodyNameRegExp = new RegExp('^[A-Za-z][A-Za-z0-9_]\*$')
export const dataCatalogMetricsPartialUpdateBodyDisplayNameMax = 255
-export const dataCatalogMetricsPartialUpdateBodyDescriptionMax = 1000
+export const dataCatalogMetricsPartialUpdateBodyDescriptionMax = 300
export const dataCatalogMetricsPartialUpdateBodyUnitMax = 64
@@ -219,7 +219,7 @@ export const DataCatalogMetricsPartialUpdateBody = /* @__PURE__ */ zod.object({
.max(dataCatalogMetricsPartialUpdateBodyDescriptionMax)
.optional()
.describe(
- "What the metric means and what it serves, in 1-3 short sentences: the business meaning plus any load-bearing inclusions\/exclusions or grain. Never narrate or restate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'."
+ "What the number is, in 1-2 short sentences under 300 characters: its meaning and grain plus any inclusion or exclusion that changes it. Leave out source tables or views, lineage, column lists, and comparisons with other metrics. Never narrate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'."
),
unit: zod
.string()
diff --git a/products/data_catalog/mcp/tools.yaml b/products/data_catalog/mcp/tools.yaml
index 6200597fbc38..456cf48f27f7 100644
--- a/products/data_catalog/mcp/tools.yaml
+++ b/products/data_catalog/mcp/tools.yaml
@@ -111,14 +111,15 @@ tools:
definition when the calculation needs judgment or multiple steps. Only propose a definition that was
explicitly asked for or that you have seen reused at least twice - do not speculatively catalog one-off
queries. If you derived a number or settled a definition and no metric exists for it, end your answer by
- offering to save it as a proposed metric. Keep 'description' to 1-3 sentences saying what the metric means
- and what it serves - never a walkthrough of the query or calculation steps (the definition carries those);
- put rationale for the chosen definition in 'reasoning'. Before creating a metric, inspect the complete
- catalog with metric-list and inspect a candidate's definition with metric-describe when it may be reusable.
- When the metric comes from an existing saved insight, pass that insight's 'source_insight_short_id' instead
- of copying its query into 'definition' - the two are mutually exclusive. The server snapshots the insight's
- query, tracks drift against it, and the metric then links back to the insight so a person can edit the query
- where it lives.
+ offering to save it as a proposed metric. Keep 'description' to 1-2 short sentences under 300 characters:
+ what the number is and its grain, plus any inclusion or exclusion that changes it. Leave out source tables
+ or views, lineage, column lists, upstream corrections, and comparisons with or pointers to other metrics.
+ Never walk through the query or calculation steps (the definition carries those); put rationale for the
+ chosen definition in 'reasoning'. Before creating a metric, inspect the complete catalog with metric-list
+ and inspect a candidate's definition with metric-describe when it may be reusable. When the metric comes
+ from an existing saved insight, pass that insight's 'source_insight_short_id' instead of copying its query
+ into 'definition' - the two are mutually exclusive. The server snapshots the insight's query, tracks drift
+ against it, and the metric then links back to the insight so a person can edit the query where it lives.
exclude_params:
- created_source
inject_body:
@@ -189,8 +190,9 @@ tools:
Update a metric's fields. 'name' picks the metric to update. Editing an approved metric's definition,
description, unit, or name resets it to 'proposed' (it must be re-approved by a human). Pass 'new_name' to
rename the metric: the old name is freed for reuse, and anything that referenced it (saved SQL, run URLs,
- later tool calls) must switch to the new name. When editing 'description', keep it to 1-3 sentences of
- business meaning, not a narration of the query; rationale for the definition belongs in 'reasoning'.
+ later tool calls) must switch to the new name. When editing 'description', keep it to 1-2 short sentences
+ under 300 characters: what the number is and its grain. Leave out source tables or views, lineage, column
+ lists, and comparisons with other metrics; rationale for the definition belongs in 'reasoning'.
exclude_params:
- created_source
inject_body:
diff --git a/products/data_catalog/skills/setting-up-data-catalog/SKILL.md b/products/data_catalog/skills/setting-up-data-catalog/SKILL.md
index eab9741e723a..3403b8a86751 100644
--- a/products/data_catalog/skills/setting-up-data-catalog/SKILL.md
+++ b/products/data_catalog/skills/setting-up-data-catalog/SKILL.md
@@ -49,9 +49,10 @@ Work top-down, stopping at `proposed` for everything (a human promotes later):
detection.
4. **Add remaining metrics above the bar.** Propose any other metric that was asked for or that you
- have seen reused at least twice. Give each a `description` (the load-bearing field) of 1-3 sentences
- stating what the metric means and what it serves - the business meaning plus any load-bearing
- inclusions/exclusions or grain, never a narration of the query. Query rationale goes in `reasoning`,
+ have seen reused at least twice. Give each a `description` (the load-bearing field) of 1-2 short
+ sentences under 300 characters: what the number is and its grain, plus any inclusion or exclusion
+ that changes it. Leave out source tables or views, lineage, column lists, and comparisons with
+ other metrics, and never narrate the query. Query rationale goes in `reasoning`,
the mechanics in the definition. Also give a `unit`, and a definition when one exists. A definition
can be an executable query, or - when the calculation needs judgment or steps that don't reduce to a
single query - an agent-calculated markdown definition
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index fdf9690f9ff9..05e3af84c752 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -3702,7 +3702,7 @@
}
},
"data-catalog-metric-create": {
- "description": "Create a canonical metric, or refine the live one already holding this name (upsert on name; always lands 'proposed'). A deleted metric's name is available again - creating with it starts a fresh metric with no history carried over. The definition can be an executable query (HogQLQuery / TrendsQuery / FunnelsQuery / an event node) that the query runner computes, OR an agent-calculated markdown definition - {\"kind\": \"MarkdownDefinition\", \"markdown\": \"<numbered steps to calculate the metric>\"} - which an agent follows to produce the number. Prefer an executable definition when the metric is deterministic; use a markdown definition when the calculation needs judgment or multiple steps. Only propose a definition that was explicitly asked for or that you have seen reused at least twice - do not speculatively catalog one-off queries. If you derived a number or settled a definition and no metric exists for it, end your answer by offering to save it as a proposed metric. Keep 'description' to 1-3 sentences saying what the metric means and what it serves - never a walkthrough of the query or calculation steps (the definition carries those); put rationale for the chosen definition in 'reasoning'. Before creating a metric, inspect the complete catalog with metric-list and inspect a candidate's definition with metric-describe when it may be reusable. When the metric comes from an existing saved insight, pass that insight's 'source_insight_short_id' instead of copying its query into 'definition' - the two are mutually exclusive. The server snapshots the insight's query, tracks drift against it, and the metric then links back to the insight so a person can edit the query where it lives.",
+ "description": "Create a canonical metric, or refine the live one already holding this name (upsert on name; always lands 'proposed'). A deleted metric's name is available again - creating with it starts a fresh metric with no history carried over. The definition can be an executable query (HogQLQuery / TrendsQuery / FunnelsQuery / an event node) that the query runner computes, OR an agent-calculated markdown definition - {\"kind\": \"MarkdownDefinition\", \"markdown\": \"<numbered steps to calculate the metric>\"} - which an agent follows to produce the number. Prefer an executable definition when the metric is deterministic; use a markdown definition when the calculation needs judgment or multiple steps. Only propose a definition that was explicitly asked for or that you have seen reused at least twice - do not speculatively catalog one-off queries. If you derived a number or settled a definition and no metric exists for it, end your answer by offering to save it as a proposed metric. Keep 'description' to 1-2 short sentences under 300 characters: what the number is and its grain, plus any inclusion or exclusion that changes it. Leave out source tables or views, lineage, column lists, upstream corrections, and comparisons with or pointers to other metrics. Never walk through the query or calculation steps (the definition carries those); put rationale for the chosen definition in 'reasoning'. Before creating a metric, inspect the complete catalog with metric-list and inspect a candidate's definition with metric-describe when it may be reusable. When the metric comes from an existing saved insight, pass that insight's 'source_insight_short_id' instead of copying its query into 'definition' - the two are mutually exclusive. The server snapshots the insight's query, tracks drift against it, and the metric then links back to the insight so a person can edit the query where it lives.",
"category": "Data catalog",
"feature": "data_catalog",
"summary": "Create or refine a catalog metric",
@@ -3758,7 +3758,7 @@
}
},
"data-catalog-metric-update": {
- "description": "Update a metric's fields. 'name' picks the metric to update. Editing an approved metric's definition, description, unit, or name resets it to 'proposed' (it must be re-approved by a human). Pass 'new_name' to rename the metric: the old name is freed for reuse, and anything that referenced it (saved SQL, run URLs, later tool calls) must switch to the new name. When editing 'description', keep it to 1-3 sentences of business meaning, not a narration of the query; rationale for the definition belongs in 'reasoning'.",
+ "description": "Update a metric's fields. 'name' picks the metric to update. Editing an approved metric's definition, description, unit, or name resets it to 'proposed' (it must be re-approved by a human). Pass 'new_name' to rename the metric: the old name is freed for reuse, and anything that referenced it (saved SQL, run URLs, later tool calls) must switch to the new name. When editing 'description', keep it to 1-2 short sentences under 300 characters: what the number is and its grain. Leave out source tables or views, lineage, column lists, and comparisons with other metrics; rationale for the definition belongs in 'reasoning'.",
"category": "Data catalog",
"feature": "data_catalog",
"summary": "Update a catalog metric",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 1f7214d8dd14..e764cedb97b7 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -3717,7 +3717,7 @@
}
},
"data-catalog-metric-create": {
- "description": "Create a canonical metric, or refine the live one already holding this name (upsert on name; always lands 'proposed'). A deleted metric's name is available again - creating with it starts a fresh metric with no history carried over. The definition can be an executable query (HogQLQuery / TrendsQuery / FunnelsQuery / an event node) that the query runner computes, OR an agent-calculated markdown definition - {\"kind\": \"MarkdownDefinition\", \"markdown\": \"<numbered steps to calculate the metric>\"} - which an agent follows to produce the number. Prefer an executable definition when the metric is deterministic; use a markdown definition when the calculation needs judgment or multiple steps. Only propose a definition that was explicitly asked for or that you have seen reused at least twice - do not speculatively catalog one-off queries. If you derived a number or settled a definition and no metric exists for it, end your answer by offering to save it as a proposed metric. Keep 'description' to 1-3 sentences saying what the metric means and what it serves - never a walkthrough of the query or calculation steps (the definition carries those); put rationale for the chosen definition in 'reasoning'. Before creating a metric, inspect the complete catalog with metric-list and inspect a candidate's definition with metric-describe when it may be reusable. When the metric comes from an existing saved insight, pass that insight's 'source_insight_short_id' instead of copying its query into 'definition' - the two are mutually exclusive. The server snapshots the insight's query, tracks drift against it, and the metric then links back to the insight so a person can edit the query where it lives.",
+ "description": "Create a canonical metric, or refine the live one already holding this name (upsert on name; always lands 'proposed'). A deleted metric's name is available again - creating with it starts a fresh metric with no history carried over. The definition can be an executable query (HogQLQuery / TrendsQuery / FunnelsQuery / an event node) that the query runner computes, OR an agent-calculated markdown definition - {\"kind\": \"MarkdownDefinition\", \"markdown\": \"<numbered steps to calculate the metric>\"} - which an agent follows to produce the number. Prefer an executable definition when the metric is deterministic; use a markdown definition when the calculation needs judgment or multiple steps. Only propose a definition that was explicitly asked for or that you have seen reused at least twice - do not speculatively catalog one-off queries. If you derived a number or settled a definition and no metric exists for it, end your answer by offering to save it as a proposed metric. Keep 'description' to 1-2 short sentences under 300 characters: what the number is and its grain, plus any inclusion or exclusion that changes it. Leave out source tables or views, lineage, column lists, upstream corrections, and comparisons with or pointers to other metrics. Never walk through the query or calculation steps (the definition carries those); put rationale for the chosen definition in 'reasoning'. Before creating a metric, inspect the complete catalog with metric-list and inspect a candidate's definition with metric-describe when it may be reusable. When the metric comes from an existing saved insight, pass that insight's 'source_insight_short_id' instead of copying its query into 'definition' - the two are mutually exclusive. The server snapshots the insight's query, tracks drift against it, and the metric then links back to the insight so a person can edit the query where it lives.",
"category": "Data catalog",
"feature": "data_catalog",
"summary": "Create or refine a catalog metric",
@@ -3773,7 +3773,7 @@
}
},
"data-catalog-metric-update": {
- "description": "Update a metric's fields. 'name' picks the metric to update. Editing an approved metric's definition, description, unit, or name resets it to 'proposed' (it must be re-approved by a human). Pass 'new_name' to rename the metric: the old name is freed for reuse, and anything that referenced it (saved SQL, run URLs, later tool calls) must switch to the new name. When editing 'description', keep it to 1-3 sentences of business meaning, not a narration of the query; rationale for the definition belongs in 'reasoning'.",
+ "description": "Update a metric's fields. 'name' picks the metric to update. Editing an approved metric's definition, description, unit, or name resets it to 'proposed' (it must be re-approved by a human). Pass 'new_name' to rename the metric: the old name is freed for reuse, and anything that referenced it (saved SQL, run URLs, later tool calls) must switch to the new name. When editing 'description', keep it to 1-2 short sentences under 300 characters: what the number is and its grain. Leave out source tables or views, lineage, column lists, and comparisons with other metrics; rationale for the definition belongs in 'reasoning'.",
"category": "Data catalog",
"feature": "data_catalog",
"summary": "Update a catalog metric",
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index cd6ebddd8e1a..3e79465f6458 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -27706,8 +27706,8 @@ export namespace Schemas {
*/
display_name?: string;
/**
- * What the metric means and what it serves, in 1-3 short sentences: the business meaning plus any load-bearing inclusions/exclusions or grain. Never narrate or restate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'.
- * @maxLength 1000
+ * What the number is, in 1-2 short sentences under 300 characters: its meaning and grain plus any inclusion or exclusion that changes it. Leave out source tables or views, lineage, column lists, and comparisons with other metrics. Never narrate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'.
+ * @maxLength 300
*/
description: string;
/**
@@ -76951,8 +76951,8 @@ export namespace Schemas {
*/
display_name?: string;
/**
- * What the metric means and what it serves, in 1-3 short sentences: the business meaning plus any load-bearing inclusions/exclusions or grain. Never narrate or restate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'.
- * @maxLength 1000
+ * What the number is, in 1-2 short sentences under 300 characters: its meaning and grain plus any inclusion or exclusion that changes it. Leave out source tables or views, lineage, column lists, and comparisons with other metrics. Never narrate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'.
+ * @maxLength 300
*/
description?: string;
/**
diff --git a/services/mcp/src/generated/data_catalog/api.ts b/services/mcp/src/generated/data_catalog/api.ts
index 17f2525a2e50..fdfd137bc04d 100644
--- a/services/mcp/src/generated/data_catalog/api.ts
+++ b/services/mcp/src/generated/data_catalog/api.ts
@@ -94,7 +94,7 @@ export const dataCatalogMetricsCreateBodyNameMax = 128
export const dataCatalogMetricsCreateBodyNameRegExp = new RegExp('^[A-Za-z][A-Za-z0-9_]\*$')
export const dataCatalogMetricsCreateBodyDisplayNameMax = 255
-export const dataCatalogMetricsCreateBodyDescriptionMax = 1000
+export const dataCatalogMetricsCreateBodyDescriptionMax = 300
export const dataCatalogMetricsCreateBodyUnitMax = 64
@@ -122,7 +122,7 @@ export const DataCatalogMetricsCreateBody = () => zod.object({
.string()
.max(dataCatalogMetricsCreateBodyDescriptionMax)
.describe(
- "What the metric means and what it serves, in 1-3 short sentences: the business meaning plus any load-bearing inclusions\/exclusions or grain. Never narrate or restate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'."
+ "What the number is, in 1-2 short sentences under 300 characters: its meaning and grain plus any inclusion or exclusion that changes it. Leave out source tables or views, lineage, column lists, and comparisons with other metrics. Never narrate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'."
),
unit: zod
.string()
@@ -183,7 +183,7 @@ export const dataCatalogMetricsPartialUpdateBodyNameMax = 128
export const dataCatalogMetricsPartialUpdateBodyNameRegExp = new RegExp('^[A-Za-z][A-Za-z0-9_]\*$')
export const dataCatalogMetricsPartialUpdateBodyDisplayNameMax = 255
-export const dataCatalogMetricsPartialUpdateBodyDescriptionMax = 1000
+export const dataCatalogMetricsPartialUpdateBodyDescriptionMax = 300
export const dataCatalogMetricsPartialUpdateBodyUnitMax = 64
@@ -213,7 +213,7 @@ export const DataCatalogMetricsPartialUpdateBody = () => zod.object({
.max(dataCatalogMetricsPartialUpdateBodyDescriptionMax)
.optional()
.describe(
- "What the metric means and what it serves, in 1-3 short sentences: the business meaning plus any load-bearing inclusions\/exclusions or grain. Never narrate or restate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'."
+ "What the number is, in 1-2 short sentences under 300 characters: its meaning and grain plus any inclusion or exclusion that changes it. Leave out source tables or views, lineage, column lists, and comparisons with other metrics. Never narrate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'."
),
unit: zod
.string()
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/data-catalog-metric-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/data-catalog-metric-create.json
index 1cbb67c5abc8..5172c091421c 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/data-catalog-metric-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/data-catalog-metric-create.json
@@ -35,8 +35,8 @@
"description": "Machine-readable query. Omit for a name+description-only stub. Stored upgrade-canonical."
},
"description": {
- "description": "What the metric means and what it serves, in 1-3 short sentences: the business meaning plus any load-bearing inclusions/exclusions or grain. Never narrate or restate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'.",
- "maxLength": 1000,
+ "description": "What the number is, in 1-2 short sentences under 300 characters: its meaning and grain plus any inclusion or exclusion that changes it. Leave out source tables or views, lineage, column lists, and comparisons with other metrics. Never narrate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'.",
+ "maxLength": 300,
"type": "string"
},
"display_name": {
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/data-catalog-metric-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/data-catalog-metric-update.json
index 946926ae84cc..366669a23042 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/data-catalog-metric-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/data-catalog-metric-update.json
@@ -35,8 +35,8 @@
"description": "Machine-readable query. Omit for a name+description-only stub. Stored upgrade-canonical."
},
"description": {
- "description": "What the metric means and what it serves, in 1-3 short sentences: the business meaning plus any load-bearing inclusions/exclusions or grain. Never narrate or restate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'.",
- "maxLength": 1000,
+ "description": "What the number is, in 1-2 short sentences under 300 characters: its meaning and grain plus any inclusion or exclusion that changes it. Leave out source tables or views, lineage, column lists, and comparisons with other metrics. Never narrate the query - the definition carries the mechanics; put rationale for query choices in 'reasoning'.",
+ "maxLength": 300,
"type": "string"
},
"display_name": {