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(error-tracking): add recommendations MCP tool with action guidance (#63512)

Aleksander Błaszkiewiczbe1cbb1fe87f
diff --git a/products/error_tracking/backend/logic/recommendations/__init__.py b/products/error_tracking/backend/logic/recommendations/__init__.py
index 283bb4bf9179..8afe5fb43f3f 100644
--- a/products/error_tracking/backend/logic/recommendations/__init__.py
+++ b/products/error_tracking/backend/logic/recommendations/__init__.py
@@ -4,6 +4,8 @@ from .long_running_issues import LongRunningIssuesRecommendation
from .rate_limits import RateLimitsRecommendation
from .source_maps import SourceMapsRecommendation
+# Each type and its meta payload is documented for the MCP agent in
+# products/error_tracking/mcp/prompts/error-tracking-recommendations-list.md — keep it in sync when adding/changing a type.
RECOMMENDATIONS: list[Recommendation] = [
AlertsRecommendation(),
LongRunningIssuesRecommendation(),
diff --git a/products/error_tracking/mcp/prompts/error-tracking-recommendations-list.md b/products/error_tracking/mcp/prompts/error-tracking-recommendations-list.md
new file mode 100644
index 000000000000..7dceba54c0bc
--- /dev/null
+++ b/products/error_tracking/mcp/prompts/error-tracking-recommendations-list.md
@@ -0,0 +1,28 @@
+List error tracking recommendations for the current project. Each row is a server-computed suggestion with a fixed `type` and a type-specific `meta` payload.
+
+Use this when the user asks how to improve their error tracking setup, what they should fix, or wants to act on their recommendations.
+
+Surface only the few recommendations that matter — don't dump every row. Skip ones that are already done or dismissed.
+
+# Response envelope (every recommendation)
+
+- `type`: one of `alerts`, `rate_limits`, `source_maps`, `long_running_issues`.
+- `meta`: type-specific payload — see the per-type sections below.
+- `completed`: `true` means the recommended action is already satisfied. Nothing to do — skip it.
+- `dismissed_at`: set if the user dismissed this recommendation. Skip dismissed ones unless the user explicitly asks.
+
+Only act on recommendations that are not `completed` and not dismissed.
+
+# Recommendation types
+
+- `alerts` — `meta.alerts` is a list of `{ key, enabled }` for the `issue-created`/`issue-reopened`/`issue-spiking` triggers; `enabled: false` means no alert is wired. To act, use the `authoring-error-tracking-alerts` skill (or the `error-tracking-alerts-create` tool).
+- `rate_limits` — `meta.rate_limits` is a list of `{ key, enabled }` for the `project` and `per_issue` ingestion limits; `enabled: false` means it isn't set. To act, check and set them via `error-tracking-settings-get` / `error-tracking-settings-update`.
+- `source_maps` — `meta` carries frame-resolution stats (`unresolved_pct` vs `threshold_pct` over a sample); a high unresolved share means stack traces aren't symbolicated. The fix is uploading source maps from the build via the setup wizard (append `--region eu` for EU projects):
+
+ ```sh
+ npx -y @posthog/wizard@latest upload-source-maps
+ ```
+
+ If frames still don't resolve after uploading, use the `diagnosing-stacktrace-symbolication` skill.
+
+- `long_running_issues` — `meta.issues` lists stale active issues (first seen over a week ago, still recurring). To act, use the `triaging-error-issues` skill to work through them, or `investigating-error-issue` to root-cause one.
diff --git a/products/error_tracking/mcp/tools.yaml b/products/error_tracking/mcp/tools.yaml
index 9101d52636fb..6836023ceec8 100644
--- a/products/error_tracking/mcp/tools.yaml
+++ b/products/error_tracking/mcp/tools.yaml
@@ -255,7 +255,16 @@ tools:
enabled: false
error-tracking-recommendations-list:
operation: error_tracking_recommendations_list
- enabled: false
+ enabled: true
+ scopes:
+ - error_tracking:read
+ annotations:
+ readOnly: true
+ destructive: false
+ idempotent: true
+ title: List error tracking recommendations
+ description_file: ./prompts/error-tracking-recommendations-list.md
+ system_prompt_hint: Error tracking setup recommendations and how to act on each (error-tracking category)
error-tracking-recommendations-refresh-create:
operation: error_tracking_recommendations_refresh_create
enabled: false
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index 06ddd1240c59..2aedef519ed1 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -2470,6 +2470,21 @@
"readOnlyHint": false
}
},
+ "error-tracking-recommendations-list": {
+ "description": "List error tracking recommendations for the current project. Each row is a server-computed suggestion with a fixed `type` and a type-specific `meta` payload.\n\nUse this when the user asks how to improve their error tracking setup, what they should fix, or wants to act on their recommendations.\n\nSurface only the few recommendations that matter — don't dump every row. Skip ones that are already done or dismissed.\n\n# Response envelope (every recommendation)\n\n- `type`: one of `alerts`, `rate_limits`, `source_maps`, `long_running_issues`.\n- `meta`: type-specific payload — see the per-type sections below.\n- `completed`: `true` means the recommended action is already satisfied. Nothing to do — skip it.\n- `dismissed_at`: set if the user dismissed this recommendation. Skip dismissed ones unless the user explicitly asks.\n\nOnly act on recommendations that are not `completed` and not dismissed.\n\n# Recommendation types\n\n- `alerts` — `meta.alerts` is a list of `{ key, enabled }` for the `issue-created`/`issue-reopened`/`issue-spiking` triggers; `enabled: false` means no alert is wired. To act, use the `authoring-error-tracking-alerts` skill (or the `error-tracking-alerts-create` tool).\n- `rate_limits` — `meta.rate_limits` is a list of `{ key, enabled }` for the `project` and `per_issue` ingestion limits; `enabled: false` means it isn't set. To act, check and set them via `error-tracking-settings-get` / `error-tracking-settings-update`.\n- `source_maps` — `meta` carries frame-resolution stats (`unresolved_pct` vs `threshold_pct` over a sample); a high unresolved share means stack traces aren't symbolicated. The fix is uploading source maps from the build via the setup wizard (append `--region eu` for EU projects):\n\n ```sh\n npx -y @posthog/wizard@latest upload-source-maps\n ```\n\n If frames still don't resolve after uploading, use the `diagnosing-stacktrace-symbolication` skill.\n\n- `long_running_issues` — `meta.issues` lists stale active issues (first seen over a week ago, still recurring). To act, use the `triaging-error-issues` skill to work through them, or `investigating-error-issue` to root-cause one.",
+ "category": "Error tracking",
+ "feature": "error_tracking",
+ "summary": "List error tracking recommendations",
+ "title": "List error tracking recommendations",
+ "required_scopes": ["error_tracking:read"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ },
+ "system_prompt_hint": "Error tracking setup recommendations and how to act on each (error-tracking category)"
+ },
"error-tracking-settings-get": {
"description": "Get the error tracking ingestion settings for the current project. Returns the project-wide and per-issue exception rate limits, where each `*_rate_limit_value` is the maximum events ingested per bucket and each `*_rate_limit_bucket_size_minutes` is the bucket window. A null `*_rate_limit_value` means no limit is set. Read these before updating so you can preserve the fields you don't intend to change.",
"category": "Error tracking",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index 861b22976182..8d7fecfeb2fb 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -2514,6 +2514,21 @@
"readOnlyHint": false
}
},
+ "error-tracking-recommendations-list": {
+ "description": "List error tracking recommendations for the current project. Each row is a server-computed suggestion with a fixed `type` and a type-specific `meta` payload.\n\nUse this when the user asks how to improve their error tracking setup, what they should fix, or wants to act on their recommendations.\n\nSurface only the few recommendations that matter — don't dump every row. Skip ones that are already done or dismissed.\n\n# Response envelope (every recommendation)\n\n- `type`: one of `alerts`, `rate_limits`, `source_maps`, `long_running_issues`.\n- `meta`: type-specific payload — see the per-type sections below.\n- `completed`: `true` means the recommended action is already satisfied. Nothing to do — skip it.\n- `dismissed_at`: set if the user dismissed this recommendation. Skip dismissed ones unless the user explicitly asks.\n\nOnly act on recommendations that are not `completed` and not dismissed.\n\n# Recommendation types\n\n- `alerts` — `meta.alerts` is a list of `{ key, enabled }` for the `issue-created`/`issue-reopened`/`issue-spiking` triggers; `enabled: false` means no alert is wired. To act, use the `authoring-error-tracking-alerts` skill (or the `error-tracking-alerts-create` tool).\n- `rate_limits` — `meta.rate_limits` is a list of `{ key, enabled }` for the `project` and `per_issue` ingestion limits; `enabled: false` means it isn't set. To act, check and set them via `error-tracking-settings-get` / `error-tracking-settings-update`.\n- `source_maps` — `meta` carries frame-resolution stats (`unresolved_pct` vs `threshold_pct` over a sample); a high unresolved share means stack traces aren't symbolicated. The fix is uploading source maps from the build via the setup wizard (append `--region eu` for EU projects):\n\n ```sh\n npx -y @posthog/wizard@latest upload-source-maps\n ```\n\n If frames still don't resolve after uploading, use the `diagnosing-stacktrace-symbolication` skill.\n\n- `long_running_issues` — `meta.issues` lists stale active issues (first seen over a week ago, still recurring). To act, use the `triaging-error-issues` skill to work through them, or `investigating-error-issue` to root-cause one.",
+ "category": "Error tracking",
+ "feature": "error_tracking",
+ "summary": "List error tracking recommendations",
+ "title": "List error tracking recommendations",
+ "required_scopes": ["error_tracking:read"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ },
+ "system_prompt_hint": "Error tracking setup recommendations and how to act on each (error-tracking category)"
+ },
"error-tracking-settings-get": {
"description": "Get the error tracking ingestion settings for the current project. Returns the project-wide and per-issue exception rate limits, where each `*_rate_limit_value` is the maximum events ingested per bucket and each `*_rate_limit_bucket_size_minutes` is the bucket window. A null `*_rate_limit_value` means no limit is set. Read these before updating so you can preserve the fields you don't intend to change.",
"category": "Error tracking",
diff --git a/services/mcp/src/generated/error_tracking/api.ts b/services/mcp/src/generated/error_tracking/api.ts
index 67b51435b73a..779f4d0a8e65 100644
--- a/services/mcp/src/generated/error_tracking/api.ts
+++ b/services/mcp/src/generated/error_tracking/api.ts
@@ -3,7 +3,7 @@
* MCP service uses these Zod schemas for generated tool handlers.
* To regenerate: hogli build:openapi
*
- * PostHog API - MCP 19 enabled ops
+ * PostHog API - MCP 20 enabled ops
* OpenAPI spec version: 1.0.0
*/
import * as zod from 'zod'
@@ -3496,6 +3496,19 @@ export const ErrorTrackingQueryIssuesListCreateBody = /* @__PURE__ */ zod.object
.describe('Search stack-frame source/file path text.'),
})
+export const ErrorTrackingRecommendationsListParams = /* @__PURE__ */ zod.object({
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."
+ ),
+})
+
+export const ErrorTrackingRecommendationsListQueryParams = /* @__PURE__ */ zod.object({
+ limit: zod.number().optional().describe('Number of results to return per page.'),
+ offset: zod.number().optional().describe('The initial index from which to return the results.'),
+})
+
export const ErrorTrackingSettingsRetrieveSettingsRetrieveParams = /* @__PURE__ */ zod.object({
project_id: zod
.string()
diff --git a/services/mcp/src/tools/generated/error_tracking.ts b/services/mcp/src/tools/generated/error_tracking.ts
index 2f5b507f5300..581007392d11 100644
--- a/services/mcp/src/tools/generated/error_tracking.ts
+++ b/services/mcp/src/tools/generated/error_tracking.ts
@@ -17,6 +17,7 @@ import {
ErrorTrackingQueryIssueCreateBody,
ErrorTrackingQueryIssueEventsCreateBody,
ErrorTrackingQueryIssuesListCreateBody,
+ ErrorTrackingRecommendationsListQueryParams,
ErrorTrackingSettingsUpdateSettingsPartialUpdateBody,
ErrorTrackingSuppressionRulesCreateBody,
ErrorTrackingSuppressionRulesListQueryParams,
@@ -230,6 +231,28 @@ const errorTrackingIssuesSplitCreate = (): ToolBase<
},
})
+const ErrorTrackingRecommendationsListSchema = ErrorTrackingRecommendationsListQueryParams
+
+const errorTrackingRecommendationsList = (): ToolBase<
+ typeof ErrorTrackingRecommendationsListSchema,
+ Schemas.PaginatedErrorTrackingRecommendationList
+> => ({
+ name: 'error-tracking-recommendations-list',
+ schema: ErrorTrackingRecommendationsListSchema,
+ handler: async (context: Context, params: z.infer<typeof ErrorTrackingRecommendationsListSchema>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const result = await context.api.request<Schemas.PaginatedErrorTrackingRecommendationList>({
+ method: 'GET',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/error_tracking/recommendations/`,
+ query: {
+ limit: params.limit,
+ offset: params.offset,
+ },
+ })
+ return result
+ },
+})
+
const ErrorTrackingSettingsGetSchema = z.object({})
const errorTrackingSettingsGet = (): ToolBase<
@@ -643,6 +666,7 @@ export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {
'error-tracking-issues-merge-create': errorTrackingIssuesMergeCreate,
'error-tracking-issues-partial-update': errorTrackingIssuesPartialUpdate,
'error-tracking-issues-split-create': errorTrackingIssuesSplitCreate,
+ 'error-tracking-recommendations-list': errorTrackingRecommendationsList,
'error-tracking-settings-get': errorTrackingSettingsGet,
'error-tracking-settings-update': errorTrackingSettingsUpdate,
'error-tracking-suppression-rules-create': errorTrackingSuppressionRulesCreate,
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-recommendations-list.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-recommendations-list.json
new file mode 100644
index 000000000000..8331b796ac73
--- /dev/null
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/error-tracking-recommendations-list.json
@@ -0,0 +1,14 @@
+{
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
+ "properties": {
+ "limit": {
+ "description": "Number of results to return per page.",
+ "type": "number"
+ },
+ "offset": {
+ "description": "The initial index from which to return the results.",
+ "type": "number"
+ }
+ },
+ "type": "object"
+}