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(mcp): group prompt management tools under experiments (#108342)

Radu Raiceaaed8efdbb413
diff --git a/docs/published/handbook/engineering/ai/implementing-mcp-tools.md b/docs/published/handbook/engineering/ai/implementing-mcp-tools.md
index 43647003c1b9..06487c405c6c 100644
--- a/docs/published/handbook/engineering/ai/implementing-mcp-tools.md
+++ b/docs/published/handbook/engineering/ai/implementing-mcp-tools.md
@@ -313,6 +313,7 @@ Product teams own their definitions and control which operations are exposed as
Human-friendly description for the LLM.
list: true # marks as a list endpoint
enrich_url: '{id}' # appended to url_prefix for result URLs
+ category: Other product # overrides the file-level category, e.g. for $mcp_tool_category in MCP analytics
exclude_params: [field] # hide params from tool input
include_params: [field] # whitelist params (excludes all others)
response: # filter response fields (applied per-item on list endpoints)
diff --git a/products/ai_observability/mcp/tools.yaml b/products/ai_observability/mcp/tools.yaml
index 34a41688edac..354a52b32697 100644
--- a/products/ai_observability/mcp/tools.yaml
+++ b/products/ai_observability/mcp/tools.yaml
@@ -924,6 +924,7 @@ tools:
Create a new LLM prompt for the current team. Requires a unique name and prompt content (string or JSON
object). Optionally pass 'config', a JSON object with model parameters or any agent configuration (e.g.
model, temperature, tools) — it is versioned with the prompt and returned as-is when fetching it.
+ category: Experiments
include_params:
- name
- prompt
@@ -943,6 +944,7 @@ tools:
Duplicate an existing LLM prompt under a new name. Copies the latest version's content to create a new
prompt at version 1. Useful for forking a prompt or as a way to rename since names are immutable after
creation.
+ category: Experiments
llma-prompt-get:
operation: llm_prompts_name_retrieve
enabled: true
@@ -973,6 +975,7 @@ tools:
with the tags intact — always do this before editing the prompt (see llma-prompt-update).
References are rolling out gradually: when not enabled for the team, responses return the raw tags
and no `resolved_references`, so treat content containing `@@@prompt:` as unresolved.
+ category: Experiments
param_overrides:
prompt_name:
aliases:
@@ -994,6 +997,7 @@ tools:
description: >
Remove a label from an LLM prompt. The label stops pointing at any version; recreate it with the set-label
tool if needed. Confirm nothing depends on the label before removing it.
+ category: Experiments
llma-prompt-label-set:
operation: llm_prompts_name_labels_update
enabled: true
@@ -1010,6 +1014,7 @@ tools:
there. Use labels to mark a version as released ('production', 'staging') or roll back by pointing the label
at an earlier version. Label names use lowercase letters, numbers, dots, hyphens and underscores; 'latest'
is reserved and numbers-only names are not allowed. Each prompt can have at most 50 labels.
+ category: Experiments
llma-prompt-list:
operation: llm_prompts_list
enabled: true
@@ -1035,6 +1040,7 @@ tools:
`resolved_references` listing the spliced versions; unlabeled listings return raw content with any reference
tags intact. Reference resolution is rolling out gradually and returns raw tags when not enabled for the
team.
+ category: Experiments
llma-prompt-resolve:
operation: llm_prompts_resolve_name_retrieve
enabled: false
@@ -1064,6 +1070,7 @@ tools:
that raw text: the default llma-prompt-get response inlines the referenced prompts, so republishing
it replaces the references with flattened copies that stop following label moves. 'edits' written
against resolved content also fail to match, because the stored content keeps the tags.
+ category: Experiments
include_params:
- prompt
- edits
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index 7200a350fa7c..c0a2657fa81c 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -7663,7 +7663,7 @@
},
"llma-prompt-create": {
"description": "Create a new LLM prompt for the current team. Requires a unique name and prompt content (string or JSON object). Optionally pass 'config', a JSON object with model parameters or any agent configuration (e.g. model, temperature, tools) — it is versioned with the prompt and returned as-is when fetching it.",
- "category": "AI observability",
+ "category": "Experiments",
"feature": "llm_analytics",
"summary": "Create prompt",
"title": "Create prompt",
@@ -7677,7 +7677,7 @@
},
"llma-prompt-duplicate": {
"description": "Duplicate an existing LLM prompt under a new name. Copies the latest version's content to create a new prompt at version 1. Useful for forking a prompt or as a way to rename since names are immutable after creation.",
- "category": "AI observability",
+ "category": "Experiments",
"feature": "llm_analytics",
"summary": "Duplicate prompt",
"title": "Duplicate prompt",
@@ -7691,7 +7691,7 @@
},
"llma-prompt-get": {
"description": "Get a specific LLM prompt by name. Requires `prompt_name`, which takes either the prompt's exact name or\nthe `id` UUID from any llma-prompt-list or llma-prompt-get response. Call llma-prompt-list to discover\nvalid names; a guessed name that matches nothing returns a 404.\nAn id identifies the prompt, not the version it came from, so passing a specific version's id still\nreturns the latest version. Pass `version` or `label` to pin one.\nUses the cached endpoint for fast retrieval.\nPass `label` (e.g. 'production') to fetch the version that label currently points to, or `version` for an\nexact version number — not both. With neither, the latest version is returned.\nThe response always includes `outline`, a flat list of markdown headings parsed from the prompt — useful\nas a lightweight table of contents. Pass `content=none` to get the outline without the prompt payload,\nor `content=preview` for a short `prompt_preview` snippet instead of the full prompt.\nWith full content the response also includes `config`, the JSON object of model parameters or agent\nconfiguration stored with the version (null when the version has none).\nPrompt content can contain `@@@prompt:...@@@` references to other prompts. By default the response is\nthe assembled content with each reference replaced by the referenced prompt's content, and\n`resolved_references` lists the exact versions spliced in. Pass `resolve=false` to get the raw text\nwith the tags intact — always do this before editing the prompt (see llma-prompt-update).\nReferences are rolling out gradually: when not enabled for the team, responses return the raw tags\nand no `resolved_references`, so treat content containing `@@@prompt:` as unresolved.",
- "category": "AI observability",
+ "category": "Experiments",
"feature": "llm_analytics",
"summary": "Get prompt",
"title": "Get prompt",
@@ -7705,7 +7705,7 @@
},
"llma-prompt-label-delete": {
"description": "Remove a label from an LLM prompt. The label stops pointing at any version; recreate it with the set-label tool if needed. Confirm nothing depends on the label before removing it.",
- "category": "AI observability",
+ "category": "Experiments",
"feature": "llm_analytics",
"summary": "Delete prompt label",
"title": "Delete prompt label",
@@ -7719,7 +7719,7 @@
},
"llma-prompt-label-set": {
"description": "Point a label (for example 'production') at a specific version of an LLM prompt. A label is a movable pointer to exactly one version: if the label already exists on another version of this prompt, it is moved there. Use labels to mark a version as released ('production', 'staging') or roll back by pointing the label at an earlier version. Label names use lowercase letters, numbers, dots, hyphens and underscores; 'latest' is reserved and numbers-only names are not allowed. Each prompt can have at most 50 labels.",
- "category": "AI observability",
+ "category": "Experiments",
"feature": "llm_analytics",
"summary": "Set prompt label",
"title": "Set prompt label",
@@ -7733,7 +7733,7 @@
},
"llma-prompt-list": {
"description": "List all LLM prompts stored for the current team. Optionally filter by name. Pass `label` (e.g. 'production') to get each prompt at the version that label currently points to; prompts without that label are omitted. Returns paginated prompt summaries. By default, only prompt metadata is returned, not full prompt content. Every result also includes `outline`, a flat list of markdown headings parsed from the prompt — use it as a lightweight table of contents, and pair with `content=none` to keep responses small. With `label` and `content=full`, prompt content is returned with `@@@prompt:...@@@` references resolved and `resolved_references` listing the spliced versions; unlabeled listings return raw content with any reference tags intact. Reference resolution is rolling out gradually and returns raw tags when not enabled for the team.",
- "category": "AI observability",
+ "category": "Experiments",
"feature": "llm_analytics",
"summary": "List prompts",
"title": "List prompts",
@@ -7747,7 +7747,7 @@
},
"llma-prompt-update": {
"description": "Publish a new version of an existing LLM prompt by name. Name is immutable after creation.\nYou can either provide the full prompt content via 'prompt', or use 'edits' for incremental\nfind/replace updates. Each edit must have 'old' (text to find, must match exactly once) and\n'new' (replacement text). Edits are applied sequentially. Only one of 'prompt' or 'edits'\nmay be provided. 'base_version' is required — call llma-prompt-get first and pass its current\nversion number as 'base_version'; a stale base_version fails with a 409 conflict. Pass\n'version_description' with a short note on what changed and why — it is shown in the prompt's\nversion history.\nPass 'config' (a JSON object) to set model parameters or agent configuration on the new version.\nIf 'config' is omitted the current version's config is carried forward; pass null to clear it.\nA config-only publish (no 'prompt' or 'edits') keeps the prompt content unchanged.\nIf the prompt contains `@@@prompt:...@@@` references, fetch it with `resolve=false` first and edit\nthat raw text: the default llma-prompt-get response inlines the referenced prompts, so republishing\nit replaces the references with flattened copies that stop following label moves. 'edits' written\nagainst resolved content also fail to match, because the stored content keeps the tags.",
- "category": "AI observability",
+ "category": "Experiments",
"feature": "llm_analytics",
"summary": "Update prompt",
"title": "Update prompt",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 793729aa26f5..a57a4c491ecc 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -7902,7 +7902,7 @@
},
"llma-prompt-create": {
"description": "Create a new LLM prompt for the current team. Requires a unique name and prompt content (string or JSON object). Optionally pass 'config', a JSON object with model parameters or any agent configuration (e.g. model, temperature, tools) — it is versioned with the prompt and returned as-is when fetching it.",
- "category": "AI observability",
+ "category": "Experiments",
"feature": "llm_analytics",
"summary": "Create prompt",
"title": "Create prompt",
@@ -7916,7 +7916,7 @@
},
"llma-prompt-duplicate": {
"description": "Duplicate an existing LLM prompt under a new name. Copies the latest version's content to create a new prompt at version 1. Useful for forking a prompt or as a way to rename since names are immutable after creation.",
- "category": "AI observability",
+ "category": "Experiments",
"feature": "llm_analytics",
"summary": "Duplicate prompt",
"title": "Duplicate prompt",
@@ -7930,7 +7930,7 @@
},
"llma-prompt-get": {
"description": "Get a specific LLM prompt by name. Requires `prompt_name`, which takes either the prompt's exact name or\nthe `id` UUID from any llma-prompt-list or llma-prompt-get response. Call llma-prompt-list to discover\nvalid names; a guessed name that matches nothing returns a 404.\nAn id identifies the prompt, not the version it came from, so passing a specific version's id still\nreturns the latest version. Pass `version` or `label` to pin one.\nUses the cached endpoint for fast retrieval.\nPass `label` (e.g. 'production') to fetch the version that label currently points to, or `version` for an\nexact version number — not both. With neither, the latest version is returned.\nThe response always includes `outline`, a flat list of markdown headings parsed from the prompt — useful\nas a lightweight table of contents. Pass `content=none` to get the outline without the prompt payload,\nor `content=preview` for a short `prompt_preview` snippet instead of the full prompt.\nWith full content the response also includes `config`, the JSON object of model parameters or agent\nconfiguration stored with the version (null when the version has none).\nPrompt content can contain `@@@prompt:...@@@` references to other prompts. By default the response is\nthe assembled content with each reference replaced by the referenced prompt's content, and\n`resolved_references` lists the exact versions spliced in. Pass `resolve=false` to get the raw text\nwith the tags intact — always do this before editing the prompt (see llma-prompt-update).\nReferences are rolling out gradually: when not enabled for the team, responses return the raw tags\nand no `resolved_references`, so treat content containing `@@@prompt:` as unresolved.",
- "category": "AI observability",
+ "category": "Experiments",
"feature": "llm_analytics",
"summary": "Get prompt",
"title": "Get prompt",
@@ -7944,7 +7944,7 @@
},
"llma-prompt-label-delete": {
"description": "Remove a label from an LLM prompt. The label stops pointing at any version; recreate it with the set-label tool if needed. Confirm nothing depends on the label before removing it.",
- "category": "AI observability",
+ "category": "Experiments",
"feature": "llm_analytics",
"summary": "Delete prompt label",
"title": "Delete prompt label",
@@ -7958,7 +7958,7 @@
},
"llma-prompt-label-set": {
"description": "Point a label (for example 'production') at a specific version of an LLM prompt. A label is a movable pointer to exactly one version: if the label already exists on another version of this prompt, it is moved there. Use labels to mark a version as released ('production', 'staging') or roll back by pointing the label at an earlier version. Label names use lowercase letters, numbers, dots, hyphens and underscores; 'latest' is reserved and numbers-only names are not allowed. Each prompt can have at most 50 labels.",
- "category": "AI observability",
+ "category": "Experiments",
"feature": "llm_analytics",
"summary": "Set prompt label",
"title": "Set prompt label",
@@ -7972,7 +7972,7 @@
},
"llma-prompt-list": {
"description": "List all LLM prompts stored for the current team. Optionally filter by name. Pass `label` (e.g. 'production') to get each prompt at the version that label currently points to; prompts without that label are omitted. Returns paginated prompt summaries. By default, only prompt metadata is returned, not full prompt content. Every result also includes `outline`, a flat list of markdown headings parsed from the prompt — use it as a lightweight table of contents, and pair with `content=none` to keep responses small. With `label` and `content=full`, prompt content is returned with `@@@prompt:...@@@` references resolved and `resolved_references` listing the spliced versions; unlabeled listings return raw content with any reference tags intact. Reference resolution is rolling out gradually and returns raw tags when not enabled for the team.",
- "category": "AI observability",
+ "category": "Experiments",
"feature": "llm_analytics",
"summary": "List prompts",
"title": "List prompts",
@@ -7986,7 +7986,7 @@
},
"llma-prompt-update": {
"description": "Publish a new version of an existing LLM prompt by name. Name is immutable after creation.\nYou can either provide the full prompt content via 'prompt', or use 'edits' for incremental\nfind/replace updates. Each edit must have 'old' (text to find, must match exactly once) and\n'new' (replacement text). Edits are applied sequentially. Only one of 'prompt' or 'edits'\nmay be provided. 'base_version' is required — call llma-prompt-get first and pass its current\nversion number as 'base_version'; a stale base_version fails with a 409 conflict. Pass\n'version_description' with a short note on what changed and why — it is shown in the prompt's\nversion history.\nPass 'config' (a JSON object) to set model parameters or agent configuration on the new version.\nIf 'config' is omitted the current version's config is carried forward; pass null to clear it.\nA config-only publish (no 'prompt' or 'edits') keeps the prompt content unchanged.\nIf the prompt contains `@@@prompt:...@@@` references, fetch it with `resolve=false` first and edit\nthat raw text: the default llma-prompt-get response inlines the referenced prompts, so republishing\nit replaces the references with flattened copies that stop following label moves. 'edits' written\nagainst resolved content also fail to match, because the stored content keeps the tags.",
- "category": "AI observability",
+ "category": "Experiments",
"feature": "llm_analytics",
"summary": "Update prompt",
"title": "Update prompt",
diff --git a/services/mcp/scripts/generate-tools.ts b/services/mcp/scripts/generate-tools.ts
index f286cb0100b3..0455780f0041 100644
--- a/services/mcp/scripts/generate-tools.ts
+++ b/services/mcp/scripts/generate-tools.ts
@@ -2015,6 +2015,7 @@ function generateDefinitionsJson(
const baseDescription = resolveDescription(toolConfig, yamlDir, opDescription)
const baseTitle = toolConfig.title || resolved.operation.summary || name
const baseSummary = toolConfig.title || opDescription.split('.')[0] || name
+ const toolCategory = toolConfig.category ?? category.category
// Per-tool feature_flag wins; otherwise inherit the category-level
// gate (lets one line gate a whole not-yet-GA product).
const featureFlag = toolConfig.feature_flag ?? category.feature_flag
@@ -2037,7 +2038,7 @@ function generateDefinitionsJson(
`Validates the arguments and returns a signed confirmation_hash plus a message to surface to the user. ` +
`The user must reply with the literal word "confirm" before you call the matching -execute tool with the hash. ` +
`Original action: ${baseDescription}`,
- category: category.category,
+ category: toolCategory,
feature: category.feature,
summary: `${baseSummary} (prepare)`,
title: `${baseTitle} (prepare)`,
@@ -2064,7 +2065,7 @@ function generateDefinitionsJson(
`Verifies the confirmation_hash from -prepare and the literal "confirm" string typed by the user, then performs the action. ` +
`ONLY call this after the user has explicitly typed "confirm" in chat. ` +
`Original action: ${baseDescription}`,
- category: category.category,
+ category: toolCategory,
feature: category.feature,
summary: `${baseSummary} (execute)`,
title: `${baseTitle} (execute)`,
@@ -2088,7 +2089,7 @@ function generateDefinitionsJson(
} else {
definitions[name] = {
description: baseDescription,
- category: category.category,
+ category: toolCategory,
feature: category.feature,
summary: baseSummary,
title: baseTitle,
diff --git a/services/mcp/scripts/yaml-config-schema.ts b/services/mcp/scripts/yaml-config-schema.ts
index 16e77f186e4b..db3cb63c99e4 100644
--- a/services/mcp/scripts/yaml-config-schema.ts
+++ b/services/mcp/scripts/yaml-config-schema.ts
@@ -29,6 +29,11 @@ export const ToolConfigSchema = z
description: z.string().optional(),
/** Path to a file containing the tool description (resolved relative to the YAML file). Mutually exclusive with `description`. */
description_file: z.string().optional(),
+ /**
+ * Override the file-level `category` for this tool. Use it when a tool belongs to another
+ * product than the file, so `$mcp_tool_category` groups it under that product.
+ */
+ category: z.string().trim().min(1).optional(),
/**
* One-line selection hint injected into the system prompt catalog.
* Describes *when to pick this tool*, not what it does. Currently only
diff --git a/services/mcp/tests/unit/generate-tools.test.ts b/services/mcp/tests/unit/generate-tools.test.ts
index 2f52a3017d70..1833814334c1 100644
--- a/services/mcp/tests/unit/generate-tools.test.ts
+++ b/services/mcp/tests/unit/generate-tools.test.ts
@@ -1366,6 +1366,35 @@ describe('system_prompt_hint flows into tool definitions', () => {
})
})
+describe('per-tool category in tool definitions', () => {
+ it.each([
+ { toolCategory: undefined, expected: 'AI observability' },
+ { toolCategory: 'Experiments', expected: 'Experiments' },
+ ])('uses $expected when the tool category is $toolCategory', ({ toolCategory, expected }) => {
+ const toolConfig: EnabledToolConfig = {
+ operation: 'llm_prompts_list',
+ enabled: true,
+ scopes: ['llm_prompt:read'],
+ annotations: { readOnly: true, destructive: false, idempotent: true },
+ ...(toolCategory ? { category: toolCategory } : {}),
+ }
+ const resolved: ResolvedOperation = {
+ method: 'GET',
+ path: '/api/environments/{project_id}/llm_prompts/',
+ operation: { operationId: 'llm_prompts_list', description: 'List prompts' },
+ }
+ const definitions = generateDefinitionsJson([
+ {
+ config: { category: 'AI observability', feature: 'llm_analytics', url_prefix: '/ai-observability', tools: {} },
+ enabledTools: [['llma-prompt-list', toolConfig, resolved]],
+ enabledWrappers: [],
+ yamlDir: '/tmp',
+ },
+ ]) as Record<string, { category?: string; feature?: string }>
+ expect(definitions['llma-prompt-list']).toMatchObject({ category: expected, feature: 'llm_analytics' })
+ })
+})
+
describe('generateQueryWrapperFile with use_optimized_output', () => {
const minimalQuerySchema = {
definitions: {