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): tailor hint prompts by role and derive from action (#60939)

Joe Martin4ad0cceb450d
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 2dba0701db4b..a4cb3b425418 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -920,10 +920,10 @@ snapshots:
hash: v1.k794b7964.8b37ccbeb85b12cfa67ef291ac4f12ba43d3747165830b3233a553d0870a92a0.5yP0xhlATu5GwaVkyJIaPb12z3sVmlOY1qouwzlWlZM
components-mcp-hint-toast--feature-flags-create--light:
hash: v1.k794b7964.1bdef4d6355dd47d53ffba9b290b9e8b8f2113f7009f6f405a94cfe78552db09.wM6amMYVPD_2Y7HYP5U5ZLiFqzYKZqjj0uVNMzk0CI0
- components-mcp-hint-toast--feature-flags-update-with-name--dark:
- hash: v1.k794b7964.629d7c5a0f26509fa1ab9d86c3eb2fe156a2f1a4cc13b943f1eb90cc8d8743ea.xKMX1j50i6T5B7JPA91AzMLz2J8BB8X8lImO38ZAXgg
- components-mcp-hint-toast--feature-flags-update-with-name--light:
- hash: v1.k794b7964.c89945024132bfc29737a2472813aed61aabdf0d6deda6d08ece434b994061c6.UHRdedgGeswIxNH1A8Mkt9lzH-5nlrDbIjsktZfI1-g
+ components-mcp-hint-toast--feature-flags-update-with-derived-prompt--dark:
+ hash: v1.k794b7964.afa10000da33ecba2eb81ecfd5457f982dd9208a1fc7ca584c3df54b04ae7840.pErutyojno5jAV375aa_tzS17NjikicipUwViNh4zCY
+ components-mcp-hint-toast--feature-flags-update-with-derived-prompt--light:
+ hash: v1.k794b7964.818874da3f17f0acc398e7283597be0240aeb92a0ba55069640c1256c1b7bc22.cwNbr1sj1OYMiduM501aiz7xRW3RGe8J6mimkwJ5dUc
components-mcp-hint-toast--sql-execute--dark:
hash: v1.k794b7964.d91a099335481ad3bac73d2a4d7ad6ea8eeecb9d75c1f7ff2f84294754c01c0a.imR4sDFg8sH31qkL8fc3qsYQVjWn98kIQ7H2-61-JOc
components-mcp-hint-toast--sql-execute--light:
diff --git a/frontend/src/lib/components/Alerts/alertFormLogic.ts b/frontend/src/lib/components/Alerts/alertFormLogic.ts
index 5c325fe88ffe..1b10276ead12 100644
--- a/frontend/src/lib/components/Alerts/alertFormLogic.ts
+++ b/frontend/src/lib/components/Alerts/alertFormLogic.ts
@@ -333,7 +333,9 @@ export const alertFormLogic = kea<alertFormLogicType>([
lemonToast.success(alert.id === undefined ? 'Alert created.' : 'Alert saved.')
if (alert.id === undefined) {
- tryShowMCPHint('alerts.create')
+ tryShowMCPHint('alerts.create', {
+ derivedPrompt: alert.name ? `Create an alert called ${alert.name}` : undefined,
+ })
}
return alertToFormType(updatedAlert, props.insightId)
diff --git a/frontend/src/lib/components/MCPHint/AgentBadgeRotator.tsx b/frontend/src/lib/components/MCPHint/AgentBadgeRotator.tsx
index eb5665809e5a..cef7520c6ca9 100644
--- a/frontend/src/lib/components/MCPHint/AgentBadgeRotator.tsx
+++ b/frontend/src/lib/components/MCPHint/AgentBadgeRotator.tsx
@@ -7,11 +7,13 @@ import { cn } from 'lib/utils/css-classes'
// Show PostHog Code more often to increase engagement
const AGENTS = ['PostHog Code', 'Claude', 'Cursor', 'PostHog Code', 'Codex', 'Gemini'] as const
-const ROTATE_INTERVAL_MS = 2000
+const ROTATE_INTERVAL_MS = 3000
+const POSTHOG_CODE_URL = 'https://posthog.com/code'
export function AgentBadgeRotator({ className }: { className?: string }): JSX.Element {
// Pin to "PostHog Code" inside Storybook so visual snapshots don't flake on rotation.
const isStorybook = inStorybook() || inStorybookTestRunner()
+
const [index, setIndex] = useState(() => (isStorybook ? 0 : Math.floor(Math.random() * AGENTS.length)))
useInterval(() => {
@@ -22,16 +24,23 @@ export function AgentBadgeRotator({ className }: { className?: string }): JSX.El
setIndex((current) => (current + 1) % AGENTS.length)
}, ROTATE_INTERVAL_MS)
+ const agent = AGENTS[index]
+ const classes = cn('font-semibold rainbow-text-fading', {
+ 'rainbow-text-animating': !isStorybook,
+ })
+
return (
<span className={cn('inline-flex relative', className)} aria-live="polite">
- <span
- key={index}
- className={cn('font-semibold rainbow-text-fading', {
- 'rainbow-text-animating': !isStorybook,
- })}
- >
- {AGENTS[index]}
- </span>
+ {agent === 'PostHog Code' ? (
+ /* oxlint-disable-next-line forbid-elements */
+ <a href={POSTHOG_CODE_URL} target="_blank" rel="noopener noreferrer" key={agent} className={classes}>
+ {agent}
+ </a>
+ ) : (
+ <span key={agent} className={classes}>
+ {agent}
+ </span>
+ )}
</span>
)
}
diff --git a/frontend/src/lib/components/MCPHint/MCPHintToast.stories.tsx b/frontend/src/lib/components/MCPHint/MCPHintToast.stories.tsx
index d28d821fcf04..b74323b3ac5b 100644
--- a/frontend/src/lib/components/MCPHint/MCPHintToast.stories.tsx
+++ b/frontend/src/lib/components/MCPHint/MCPHintToast.stories.tsx
@@ -26,8 +26,8 @@ export const FeatureFlagsCreate: Story = {
args: { surfaceKey: 'feature_flags.create' },
}
-export const FeatureFlagsUpdateWithName: Story = {
- args: { surfaceKey: 'feature_flags.update', context: { entityName: 'jovan-test-flag' } },
+export const FeatureFlagsUpdateWithDerivedPrompt: Story = {
+ args: { surfaceKey: 'feature_flags.update', derivedPrompt: '"Bump rollout for new-checkout to 50%"' },
}
export const DashboardsCreate: Story = {
diff --git a/frontend/src/lib/components/MCPHint/MCPHintToast.tsx b/frontend/src/lib/components/MCPHint/MCPHintToast.tsx
index 4fe7d9a7c164..e60ed4d7148a 100644
--- a/frontend/src/lib/components/MCPHint/MCPHintToast.tsx
+++ b/frontend/src/lib/components/MCPHint/MCPHintToast.tsx
@@ -1,17 +1,24 @@
+import { useValues } from 'kea'
+
import { IconSparkles } from '@posthog/icons'
import { AgentBadgeRotator } from './AgentBadgeRotator'
+import { mcpHintLogic } from './mcpHintLogic'
import { MCPInstallCommand } from './MCPInstallCommand'
-import { SURFACE_PROMPTS, type SurfaceKey, type SurfacePromptContext } from './prompts'
+import { type SurfaceKey, formatDerivedToastPrompt, getSurfacePrompts } from './prompts'
export function MCPHintToast({
surfaceKey,
- context,
+ derivedPrompt,
}: {
surfaceKey: SurfaceKey
- context?: SurfacePromptContext
+ /** If provided, replaces the per-surface default toast prompt with this action-derived string. */
+ derivedPrompt?: string
}): JSX.Element {
- const prompt = SURFACE_PROMPTS[surfaceKey].toast(context)
+ const { userRole } = useValues(mcpHintLogic)
+ const prompt = derivedPrompt
+ ? formatDerivedToastPrompt(derivedPrompt)
+ : getSurfacePrompts(surfaceKey, { role: userRole }).toast
return (
<div className="flex flex-col gap-1 py-1 pr-1 text-default min-w-0 items-start">
diff --git a/frontend/src/lib/components/MCPHint/MCPUseCaseCard.tsx b/frontend/src/lib/components/MCPHint/MCPUseCaseCard.tsx
index 245e016cd4b0..7be24d8acbf7 100644
--- a/frontend/src/lib/components/MCPHint/MCPUseCaseCard.tsx
+++ b/frontend/src/lib/components/MCPHint/MCPUseCaseCard.tsx
@@ -1,15 +1,14 @@
-import { useValues } from 'kea'
-import { useState } from 'react'
+import { useActions, useValues } from 'kea'
+import { useEffect, useRef, useState } from 'react'
import { IconSparkles } from '@posthog/icons'
-import { inStorybook, inStorybookTestRunner } from 'lib/utils'
import { cn } from 'lib/utils/css-classes'
import { AgentBadgeRotator } from './AgentBadgeRotator'
import { mcpHintLogic } from './mcpHintLogic'
import { MCPInstallCommand } from './MCPInstallCommand'
-import { SURFACE_PROMPTS, type SurfaceKey } from './prompts'
+import { getSurfacePrompts, type SurfaceKey } from './prompts'
const FIRST_SEEN_KEY_PREFIX = 'mcp-use-case-card-first-seen:'
@@ -42,16 +41,27 @@ export function MCPUseCaseCard({
expiresAfterMs?: number
forceDisplay?: boolean
}): JSX.Element | null {
- const { effectiveOptOut, featureEnabled } = useValues(mcpHintLogic)
+ const { effectiveOptOut, featureEnabled, userRole, topEvents } = useValues(mcpHintLogic)
+ const { loadTopEvents } = useActions(mcpHintLogic)
const [expired] = useState(() => (expiresAfterMs ? getExpiryState(surfaceKey, expiresAfterMs).expired : false))
+ const triedLoadingEvents = useRef(false)
- if (forceDisplay == false && (!featureEnabled || effectiveOptOut || expired)) {
+ const willRender = forceDisplay || (featureEnabled && !effectiveOptOut && !expired)
+
+ useEffect(() => {
+ // Only the SQL editor surface benefits from the team's real event names — keep the call narrow.
+ // Fetch at most once per mount; a failed call returns [] and must not retry on re-render.
+ if (willRender && surfaceKey === 'sql.execute' && !triedLoadingEvents.current) {
+ triedLoadingEvents.current = true
+ loadTopEvents()
+ }
+ }, [willRender, surfaceKey, loadTopEvents])
+
+ if (!willRender) {
return null
}
- const { examples } = SURFACE_PROMPTS[surfaceKey]
-
- const isStorybook = inStorybook() || inStorybookTestRunner()
+ const { examples } = getSurfacePrompts(surfaceKey, { role: userRole, topEvents })
return (
<div
@@ -62,11 +72,7 @@ export function MCPUseCaseCard({
>
<div className="flex items-center gap-2">
<IconSparkles className="size-4 shrink-0" />
- <h4
- className={cn('m-0 text-sm font-semibold rainbow-text', { 'rainbow-text-animating': !isStorybook })}
- >
- Or do it from your agent
- </h4>
+ <h4 className="m-0 text-sm font-semibold">Or do it from your agent</h4>
</div>
<div className="text-sm text-default">
Ask <AgentBadgeRotator />:
diff --git a/frontend/src/lib/components/MCPHint/mcpHintLogic.tsx b/frontend/src/lib/components/MCPHint/mcpHintLogic.tsx
index c9b09c2b9075..be3a8e41d13b 100644
--- a/frontend/src/lib/components/MCPHint/mcpHintLogic.tsx
+++ b/frontend/src/lib/components/MCPHint/mcpHintLogic.tsx
@@ -1,8 +1,10 @@
import { actions, connect, kea, listeners, path, reducers, selectors } from 'kea'
+import { loaders } from 'kea-loaders'
import { toast } from 'react-toastify'
import { IconX } from '@posthog/icons'
+import api from 'lib/api'
import { FEATURE_FLAGS } from 'lib/constants'
import { LemonButton } from 'lib/lemon-ui/LemonButton'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
@@ -13,7 +15,7 @@ import { UserType } from '~/types'
import type { mcpHintLogicType } from './mcpHintLogicType'
import { MCPHintToast } from './MCPHintToast'
-import type { SurfaceKey, SurfacePromptContext } from './prompts'
+import type { SurfaceKey } from './prompts'
// In production the toast auto-dismisses after a few seconds so it doesn't linger;
// in development we keep it open so it's easier to inspect.
@@ -23,14 +25,22 @@ const AUTO_DISMISS_MS = process.env.NODE_ENV === 'development' ? false : 15000
// so we err heavily on the side of not overloading people.
const COOLDOWN_MS = 7 * 24 * 60 * 60 * 1000
-export function tryShowMCPHint(surfaceKey: SurfaceKey, context?: SurfacePromptContext): void {
+export interface TryShowMCPHintOptions {
+ /**
+ * Replaces the generic per-surface toast prompt with one derived from the action the user just took
+ * (e.g. the actual feature flag they created). Plain string; quoting is handled by the toast component.
+ */
+ derivedPrompt?: string
+}
+
+export function tryShowMCPHint(surfaceKey: SurfaceKey, options: TryShowMCPHintOptions = {}): void {
try {
const mounted = mcpHintLogic.findMounted()
if (!mounted?.values.featureEnabled) {
return
}
- mounted.actions.tryShowHint(surfaceKey, context)
+ mounted.actions.tryShowHint(surfaceKey, options.derivedPrompt)
} catch (error) {
console.warn('[mcpHint] dispatch failed; host listener will continue', { surfaceKey, error })
}
@@ -43,7 +53,7 @@ export const mcpHintLogic = kea<mcpHintLogicType>([
actions: [userLogic, ['updateUser'], eventUsageLogic, ['reportMCPHintShown', 'reportMCPHintDismissed']],
})),
actions({
- tryShowHint: (surfaceKey: SurfaceKey, context?: SurfacePromptContext) => ({ surfaceKey, context }),
+ tryShowHint: (surfaceKey: SurfaceKey, derivedPrompt?: string) => ({ surfaceKey, derivedPrompt }),
recordShown: (now: number) => ({ now }),
dismissSurface: (surfaceKey: SurfaceKey) => ({ surfaceKey }),
dismissAll: true,
@@ -75,6 +85,30 @@ export const mcpHintLogic = kea<mcpHintLogicType>([
},
],
}),
+ loaders({
+ topEvents: [
+ [] as string[],
+ {
+ // Used to weave the team's real event names into the SQL editor's example prompts.
+ // One-shot per logic mount; if the call fails we silently fall back to default examples.
+ loadTopEvents: async () => {
+ try {
+ // Over-fetch: `buildSqlExamplesFromEvents` drops PostHog-internal (`$`-prefixed)
+ // events, so a team whose most-recent events are mostly internal could otherwise
+ // be left with nothing to surface.
+ const response = await api.eventDefinitions.list({
+ limit: 30,
+ ordering: '-last_seen_at',
+ })
+ const names = (response.results ?? []).map((d) => d.name).filter((n): n is string => Boolean(n))
+ return names
+ } catch {
+ return []
+ }
+ },
+ },
+ ],
+ }),
selectors({
featureEnabled: [
(s) => [s.featureFlags],
@@ -85,9 +119,10 @@ export const mcpHintLogic = kea<mcpHintLogicType>([
(s) => [s.localGlobalOptOut, s.user],
(localOptOut: boolean, user: UserType | null): boolean => Boolean(localOptOut || user?.hide_mcp_hints),
],
+ userRole: [(s) => [s.user], (user: UserType | null): string | null => user?.role_at_organization ?? null],
}),
listeners(({ values, actions }) => ({
- tryShowHint: ({ surfaceKey, context }) => {
+ tryShowHint: ({ surfaceKey, derivedPrompt }) => {
const now = Date.now()
const sinceLast = values.lastShownAt ? now - values.lastShownAt : Infinity
const cooldownActive = values.lastShownAt !== null && sinceLast < COOLDOWN_MS
@@ -97,7 +132,7 @@ export const mcpHintLogic = kea<mcpHintLogicType>([
}
try {
- toast.info(<MCPHintToast surfaceKey={surfaceKey} context={context} />, {
+ toast.info(<MCPHintToast surfaceKey={surfaceKey} derivedPrompt={derivedPrompt} />, {
toastId: `mcp-hint-${surfaceKey}-${now}`,
autoClose: AUTO_DISMISS_MS,
closeOnClick: false,
diff --git a/frontend/src/lib/components/MCPHint/prompts.test.ts b/frontend/src/lib/components/MCPHint/prompts.test.ts
new file mode 100644
index 000000000000..8ffddf33be8e
--- /dev/null
+++ b/frontend/src/lib/components/MCPHint/prompts.test.ts
@@ -0,0 +1,54 @@
+import { UserRole } from '~/types'
+
+import { FALLBACK_PROMPTS, formatDerivedToastPrompt, getSurfacePrompts } from './prompts'
+
+describe('prompts', () => {
+ describe('getSurfacePrompts', () => {
+ it('applies a tailored role override', () => {
+ const tailored = getSurfacePrompts('sql.execute', { role: UserRole.Engineering })
+ expect(tailored.toast).toBe('"How many users hit a 500 in the last hour?"')
+ expect(tailored.toast).not.toBe(FALLBACK_PROMPTS['sql.execute'].toast)
+ })
+
+ it('falls back to defaults for non-tailored and missing roles', () => {
+ expect(getSurfacePrompts('sql.execute', { role: UserRole.Sales })).toEqual(FALLBACK_PROMPTS['sql.execute'])
+ expect(getSurfacePrompts('sql.execute', { role: null })).toEqual(FALLBACK_PROMPTS['sql.execute'])
+ expect(getSurfacePrompts('sql.execute')).toEqual(FALLBACK_PROMPTS['sql.execute'])
+ })
+
+ it('weaves real event names into SQL examples, dropping internal ones', () => {
+ const { examples } = getSurfacePrompts('sql.execute', {
+ topEvents: ['$pageview', 'signup_completed', 'checkout_started', 'purchase'],
+ })
+ expect(examples).toEqual([
+ '"How many users triggered signup_completed yesterday?"',
+ '"What\'s the trend of checkout_started over the last 30 days?"',
+ '"Funnel: signup_completed → checkout_started → purchase"',
+ ])
+ })
+
+ it('keeps static SQL examples when every event is internal', () => {
+ const { examples } = getSurfacePrompts('sql.execute', {
+ topEvents: ['$pageview', '$identify', '$autocapture'],
+ })
+ expect(examples).toEqual(FALLBACK_PROMPTS['sql.execute'].examples)
+ })
+
+ it('ignores topEvents for non-SQL surfaces', () => {
+ const { examples } = getSurfacePrompts('insights.create', { topEvents: ['signup_completed'] })
+ expect(examples).toEqual(FALLBACK_PROMPTS['insights.create'].examples)
+ })
+ })
+
+ describe('formatDerivedToastPrompt', () => {
+ it('wraps bare and pre-quoted prompts identically in straight double quotes', () => {
+ expect(formatDerivedToastPrompt('foo')).toBe('"foo"')
+ expect(formatDerivedToastPrompt('"foo"')).toBe('"foo"')
+ expect(formatDerivedToastPrompt("'foo'")).toBe('"foo"')
+ })
+
+ it('trims surrounding whitespace before quoting', () => {
+ expect(formatDerivedToastPrompt(' foo ')).toBe('"foo"')
+ })
+ })
+})
diff --git a/frontend/src/lib/components/MCPHint/prompts.ts b/frontend/src/lib/components/MCPHint/prompts.ts
index 9a09607bebb5..443df2def2d9 100644
--- a/frontend/src/lib/components/MCPHint/prompts.ts
+++ b/frontend/src/lib/components/MCPHint/prompts.ts
@@ -1,3 +1,5 @@
+import { UserRole } from '~/types'
+
export const SURFACE_KEYS = [
'feature_flags.create',
'feature_flags.update',
@@ -18,22 +20,14 @@ export const SURFACE_KEYS = [
export type SurfaceKey = (typeof SURFACE_KEYS)[number]
-export type SurfacePromptContext = {
- /** Human-readable name/key of the entity the user just acted on (e.g. a feature flag key). */
- entityName?: string
-}
-
export type SurfacePrompts = {
- toast: (ctx?: SurfacePromptContext) => string
+ toast: string
examples: string[]
}
-const quote = (name: string | undefined, fallback: string): string => name?.trim() || fallback
-
-export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {
+export const FALLBACK_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {
'feature_flags.create': {
- toast: (ctx) =>
- `"Create a feature flag called ${quote(ctx?.entityName, 'new-checkout')} rolled out to 20% of users"`,
+ toast: '"Create a feature flag called new-checkout rolled out to 20% of users"',
examples: [
'"Create a feature flag for the new pricing page"',
'"Roll out checkout-v2 to 25% of EU users"',
@@ -41,7 +35,7 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {
],
},
'feature_flags.update': {
- toast: (ctx) => `"Bump rollout for ${quote(ctx?.entityName, 'new-checkout')} to 50%"`,
+ toast: '"Bump rollout for new-checkout to 50%"',
examples: [
'"Bump rollout for new-checkout to 50%"',
'"Disable beta-banner flag"',
@@ -49,7 +43,7 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {
],
},
'experiments.create': {
- toast: () => '"Create an A/B experiment for the new pricing page"',
+ toast: '"Create an A/B experiment for the new pricing page"',
examples: [
'"Create an A/B experiment for the new pricing page"',
'"Launch a multivariate test on the signup CTA"',
@@ -57,7 +51,7 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {
],
},
'experiments.launch': {
- toast: (ctx) => `"Launch experiment ${quote(ctx?.entityName, 'pricing-test')}"`,
+ toast: '"Launch experiment pricing-test"',
examples: [
'"Launch experiment pricing-test"',
'"Archive the old signup-cta experiment"',
@@ -65,7 +59,7 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {
],
},
'dashboards.create': {
- toast: () => '"Build a retention dashboard for signups last 30 days"',
+ toast: '"Build a retention dashboard for signups last 30 days"',
examples: [
'"Build a retention dashboard for signups last 30 days"',
'"Make me a dashboard tracking checkout funnel drop-off"',
@@ -73,7 +67,7 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {
],
},
'insights.create': {
- toast: () => '"Run a trends query for signup_completed last 30 days"',
+ toast: '"Run a trends query for signup_completed last 30 days"',
examples: [
'"Show me sign-up trends for the last 30 days"',
'"Build a funnel for the onboarding flow"',
@@ -81,7 +75,7 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {
],
},
'surveys.create': {
- toast: () => '"Create an NPS survey targeted at paid users"',
+ toast: '"Create an NPS survey targeted at paid users"',
examples: [
'"Create an NPS survey targeted at paid users"',
'"Ask churned users why they left"',
@@ -89,7 +83,7 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {
],
},
'alerts.create': {
- toast: () => '"Alert me if signups drop more than 20% week over week"',
+ toast: '"Alert me if signups drop more than 20% week over week"',
examples: [
'"Alert me if signups drop more than 20% week over week"',
'"Notify the team when checkout errors spike"',
@@ -97,7 +91,7 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {
],
},
'cohorts.create': {
- toast: () => '"Build a cohort of users who signed up last week and never returned"',
+ toast: '"Build a cohort of users who signed up last week and never returned"',
examples: [
'"Build a cohort of users who signed up last week and never returned"',
'"Make a cohort of EU paid customers"',
@@ -105,7 +99,7 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {
],
},
'actions.create': {
- toast: () => '"Create an action for clicks on the upgrade button"',
+ toast: '"Create an action for clicks on the upgrade button"',
examples: [
'"Create an action for clicks on the upgrade button"',
'"Define a pageview action for the pricing page"',
@@ -113,7 +107,7 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {
],
},
'annotations.create': {
- toast: () => '"Annotate today as the launch of v2 checkout"',
+ toast: '"Annotate today as the launch of v2 checkout"',
examples: [
'"Annotate today as the launch of v2 checkout"',
'"Mark the deploy on the conversion dashboard"',
@@ -121,7 +115,7 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {
],
},
'error_tracking.assign': {
- toast: () => '"Assign all TypeError issues to the frontend team"',
+ toast: '"Assign all TypeError issues to the frontend team"',
examples: [
'"Assign all TypeError issues to the frontend team"',
'"Show me the top 10 unresolved errors this week"',
@@ -129,7 +123,7 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {
],
},
'early_access_features.create': {
- toast: () => '"Create an early-access feature for the new editor"',
+ toast: '"Create an early-access feature for the new editor"',
examples: [
'"Create an early-access feature for the new editor"',
'"Promote ai-suggestions to general availability"',
@@ -137,7 +131,7 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {
],
},
'sql.execute': {
- toast: () => '"Run this SQL: select count() from events where event = $pageview"',
+ toast: '"Run this SQL: select count() from events where event = $pageview"',
examples: [
'"How many users viewed the pricing page yesterday?"',
'"What\'s our DAU trend for the last 90 days?"',
@@ -145,7 +139,7 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {
],
},
'workflows.create': {
- toast: () => '"Build a workflow that emails new signups a welcome message after 1 day"',
+ toast: '"Build a workflow that emails new signups a welcome message after 1 day"',
examples: [
'"Build a workflow that emails new signups a welcome message after 1 day"',
'"Send a Slack alert when a paid user hits the error_rate threshold"',
@@ -153,3 +147,312 @@ export const SURFACE_PROMPTS: Record<SurfaceKey, SurfacePrompts> = {
],
},
}
+
+// Roles we tailor prompts for. Not every role is catered to; fallback to defaults for `sales`, `other`, and null.
+export const TAILORED_ROLES = [
+ UserRole.Founder,
+ UserRole.Product,
+ UserRole.Leadership,
+ UserRole.Marketing,
+ UserRole.Engineering,
+ UserRole.Data,
+] as const satisfies UserRole[]
+export type TailoredRole = (typeof TAILORED_ROLES)[number]
+
+function isTailoredRole(role: string | null | undefined): role is TailoredRole {
+ return typeof role === 'string' && (TAILORED_ROLES as readonly string[]).includes(role)
+}
+
+const PROMPT_OVERRIDES: Record<TailoredRole, Partial<Record<SurfaceKey, SurfacePrompts>>> = {
+ founder: {
+ 'dashboards.create': {
+ toast: '"Build me an exec dashboard: MRR, MAU, churn, and the top events this month"',
+ examples: [
+ '"Build an exec dashboard: MRR, MAU, churn, top events"',
+ '"Show me everything I need to know before the next board call"',
+ '"Compare this month\'s funnel against last month"',
+ ],
+ },
+ 'insights.create': {
+ toast: '"Show me weekly active users for the last 90 days"',
+ examples: [
+ '"Weekly active users for the last 90 days"',
+ '"Funnel: signup → activated → paid for the last quarter"',
+ '"Revenue trend by plan since launch"',
+ ],
+ },
+ 'alerts.create': {
+ toast: '"Alert me if MAU drops more than 10% week over week"',
+ examples: [
+ '"Alert me if MAU drops more than 10% week over week"',
+ '"Notify me when a customer over $1k MRR churns"',
+ '"Tell me if daily signups dip below the 7-day rolling average"',
+ ],
+ },
+ 'surveys.create': {
+ toast: '"Run an NPS survey on all paid customers"',
+ examples: [
+ '"Run an NPS survey on all paid customers"',
+ '"Ask churned users in one question why they left"',
+ '"Survey: would you recommend us to another founder?"',
+ ],
+ },
+ },
+ product: {
+ 'feature_flags.create': {
+ toast: '"Create a flag for the new pricing page rolled out to 25% of users"',
+ examples: [
+ '"Create a flag for the new pricing page, 25% of users"',
+ '"Multivariate flag for the upgrade CTA copy"',
+ '"Roll out the new editor to internal users only"',
+ ],
+ },
+ 'experiments.create': {
+ toast: '"A/B test the redesigned onboarding flow"',
+ examples: [
+ '"A/B test the redesigned onboarding flow"',
+ '"Multivariate test the upgrade CTA copy"',
+ '"Run an experiment on the new empty state"',
+ ],
+ },
+ 'insights.create': {
+ toast: '"Build a funnel for the new onboarding flow"',
+ examples: [
+ '"Build a funnel for the new onboarding flow"',
+ '"Week-1 retention split by acquisition channel"',
+ '"Trend signups by referrer for the last 30 days"',
+ ],
+ },
+ 'surveys.create': {
+ toast: '"Run a PMF survey on activated users"',
+ examples: [
+ '"Run a PMF survey on activated users"',
+ '"Ask power users which feature they\'d hate to lose"',
+ '"Launch a feedback survey on the new editor"',
+ ],
+ },
+ 'early_access_features.create': {
+ toast: '"Open the new editor as an early-access feature"',
+ examples: [
+ '"Open the new editor as an early-access feature"',
+ '"Promote ai-suggestions to GA and show me who\'s opted in"',
+ '"Pull the list of people in the v2 beta"',
+ ],
+ },
+ },
+ leadership: {
+ 'dashboards.create': {
+ toast: '"One-glance dashboard: revenue, MAU, churn, support backlog"',
+ examples: [
+ '"One-glance dashboard: revenue, MAU, churn, support backlog"',
+ '"Build me a board-meeting dashboard for this quarter"',
+ '"Add a revenue tile to the executive dashboard"',
+ ],
+ },
+ 'alerts.create': {
+ toast: '"Alert me when revenue dips below the 4-week rolling average"',
+ examples: [
+ '"Alert me when revenue dips below the 4-week rolling average"',
+ '"Notify the leadership channel when churn doubles week over week"',
+ '"Daily threshold alert on net new paid customers"',
+ ],
+ },
+ 'insights.create': {
+ toast: '"Show MAU growth over the last 4 quarters"',
+ examples: [
+ '"MAU growth over the last 4 quarters"',
+ '"Where is our funnel leaking the most volume?"',
+ '"Which features drive the most upgrades?"',
+ ],
+ },
+ },
+ marketing: {
+ 'surveys.create': {
+ toast: '"NPS survey for users who clicked our last newsletter"',
+ examples: [
+ '"NPS survey for users who clicked our last newsletter"',
+ '"Ask churned users why, in one short question"',
+ '"Feedback survey on the new landing page"',
+ ],
+ },
+ 'cohorts.create': {
+ toast: '"Build a cohort of paid users in Germany who NPS\'d 6 or lower"',
+ examples: [
+ '"Cohort of users who saw pricing but didn\'t sign up"',
+ '"Cohort of paid users in Germany who NPS\'d 6 or lower"',
+ '"Tag everyone who signed up from the LinkedIn campaign"',
+ ],
+ },
+ 'experiments.create': {
+ toast: '"A/B test the landing page hero copy"',
+ examples: [
+ '"A/B test the landing page hero copy"',
+ '"Run an experiment on the upgrade CTA color"',
+ '"Multivariate test the email subject line"',
+ ],
+ },
+ 'annotations.create': {
+ toast: '"Annotate today as the launch of the new landing page"',
+ examples: [
+ '"Annotate today as the launch of the new landing page"',
+ '"Mark when the spring email blast went out"',
+ '"Add a release note: paid search budget doubled"',
+ ],
+ },
+ 'dashboards.create': {
+ toast: '"Marketing dashboard: signups by source, CAC by channel, top campaigns"',
+ examples: [
+ '"Signups by source, CAC by channel, top-performing campaigns"',
+ '"Build a content funnel: visit → trial → paid by referrer"',
+ '"Track LinkedIn-sourced users from signup to activation"',
+ ],
+ },
+ },
+ engineering: {
+ 'feature_flags.create': {
+ toast: '"Add a kill-switch flag for the checkout v2 release"',
+ examples: [
+ '"Add a kill-switch flag for the checkout v2 release"',
+ '"Flag eu-rollout for users in DE, FR, IT"',
+ '"Multivariate flag for the new editor UI"',
+ ],
+ },
+ 'feature_flags.update': {
+ toast: '"List flags rolled out to 100% — they\'re probably dead code"',
+ examples: [
+ '"List flags rolled out to 100% (probably safe to delete)"',
+ '"Disable experiment-checkout — the experiment is over"',
+ '"Bump beta-feature flag from 10% to 25%"',
+ ],
+ },
+ 'actions.create': {
+ toast: '"Define an action for clicks on the upgrade CTA"',
+ examples: [
+ '"Action for clicks on the upgrade CTA"',
+ '"Pageview action for /pricing"',
+ '"Action that fires on $autocapture for the signup form"',
+ ],
+ },
+ 'error_tracking.assign': {
+ toast: '"Assign all TypeError issues to the frontend team"',
+ examples: [
+ '"Assign every billing-related error to the payments team"',
+ '"Show unresolved errors that fired more than 100 times this week"',
+ '"Auto-assign anything matching auth.* to the platform team"',
+ ],
+ },
+ 'sql.execute': {
+ toast: '"How many users hit a 500 in the last hour?"',
+ examples: [
+ '"How many users hit a 500 in the last hour?"',
+ '"Find the 10 slowest queries from the last 7 days"',
+ '"Which events haven\'t fired in 30 days? Probably dead instrumentation."',
+ ],
+ },
+ 'alerts.create': {
+ toast: '"Page me if 5xx error rate exceeds 1% over 5 minutes"',
+ examples: [
+ '"Page me if 5xx error rate exceeds 1% over 5 minutes"',
+ '"Alert when checkout failure rate spikes 3x baseline"',
+ '"Notify Slack when ingestion lag exceeds 30 seconds"',
+ ],
+ },
+ 'workflows.create': {
+ toast: '"Send a Slack alert when a paid user hits the error_rate threshold"',
+ examples: [
+ '"Send a Slack alert when a paid user hits the error_rate threshold"',
+ '"Trigger a PagerDuty page when ingestion lag exceeds 60s"',
+ '"Auto-create a Jira ticket when a new critical error appears"',
+ ],
+ },
+ },
+ data: {
+ 'sql.execute': {
+ toast: '"Retention curve for paid users by signup month"',
+ examples: [
+ '"Retention curve for paid users by signup month"',
+ '"Top 20 events by volume in the last 24 hours"',
+ '"DAU split by primary plan tier over the last 90 days"',
+ ],
+ },
+ 'insights.create': {
+ toast: '"Compute retention by week for paid users on the new plan"',
+ examples: [
+ '"Retention by week for paid users on the new plan"',
+ '"Funnel: signup → activated → first power feature → paid"',
+ '"Trend $pageview broken down by referring domain"',
+ ],
+ },
+ 'cohorts.create': {
+ toast: '"Build a cohort of power users — 5+ sessions a week over the last month"',
+ examples: [
+ '"Cohort of power users (5+ sessions per week, last 4 weeks)"',
+ '"Cohort of users who signed up but never returned"',
+ '"Cohort of users who hit a 500 error in the last 7 days"',
+ ],
+ },
+ 'dashboards.create': {
+ toast: '"Data quality dashboard: events per hour, ingestion lag, error rate"',
+ examples: [
+ '"Data quality dashboard: events/hour, ingestion lag, error rate"',
+ '"Retention curves by signup-month cohort"',
+ '"Churn-prediction dashboard for paid plans"',
+ ],
+ },
+ },
+}
+
+export interface ResolveOptions {
+ /** From `user.role_at_organization`. Unknown / `sales` / `other` falls back to defaults. */
+ role?: string | null
+ /**
+ * For `sql.execute` only: the team's most-recent or most-popular event names. When present,
+ * examples are rewritten to reference real event names so the user recognizes them.
+ */
+ topEvents?: string[]
+}
+
+function buildSqlExamplesFromEvents(topEvents: string[]): string[] {
+ // Filter out PostHog-internal events (lead with `$`) so we surface the user's own product events,
+ // also be conservative to avoid surface events that look like SQL injection vectors.
+ const owned = topEvents
+ .filter((name) => name && !name.startsWith('$') && /^[A-Za-z0-9_.:-]{1,80}$/.test(name))
+ .slice(0, 3)
+ if (owned.length === 0) {
+ return []
+ }
+
+ const [first, second] = owned
+ const funnelSteps = owned.join(' → ')
+
+ return [
+ `"How many users triggered ${first} yesterday?"`,
+ second && `"What's the trend of ${second} over the last 30 days?"`,
+ owned.length >= 2 && `"Funnel: ${funnelSteps}"`,
+ ].filter(Boolean) as string[]
+}
+
+export function getSurfacePrompts(surfaceKey: SurfaceKey, options: ResolveOptions = {}): SurfacePrompts {
+ const defaults = FALLBACK_PROMPTS[surfaceKey]
+ const role = options.role
+ const roleOverride = isTailoredRole(role) ? (PROMPT_OVERRIDES[role]?.[surfaceKey] ?? {}) : {}
+ const merged: SurfacePrompts = { ...defaults, ...roleOverride }
+
+ if (surfaceKey === 'sql.execute' && options.topEvents && options.topEvents.length > 0) {
+ const dynamicExamples = buildSqlExamplesFromEvents(options.topEvents)
+ if (dynamicExamples.length > 0) {
+ merged.examples = dynamicExamples
+ }
+ }
+
+ return merged
+}
+
+/**
+ * Wraps a caller-supplied dynamic toast prompt in straight double quotes to match the static defaults.
+ * Strips existing wrapping quotes first so passing `"foo"` or `foo` both render as `"foo"`.
+ */
+export function formatDerivedToastPrompt(prompt: string): string {
+ const trimmed = prompt.trim().replace(/^["']|["']$/g, '')
+ return `"${trimmed}"`
+}
diff --git a/frontend/src/lib/components/Superpowers/Superpowers.tsx b/frontend/src/lib/components/Superpowers/Superpowers.tsx
index 6a648b41d40d..8f8dc576fbce 100644
--- a/frontend/src/lib/components/Superpowers/Superpowers.tsx
+++ b/frontend/src/lib/components/Superpowers/Superpowers.tsx
@@ -44,8 +44,9 @@ function SuperpowersContent(): JSX.Element {
const { currentTeam } = useValues(teamLogic)
const { updateCurrentTeam } = useActions(teamLogic)
const { user } = useValues(userLogic)
- const { fakeStatusOverride, fakeBillingAlert } = useValues(superpowersLogic)
- const { closeSuperpowers, setFakeStatusOverride, setFakeBillingAlert } = useActions(superpowersLogic)
+ const { fakeStatusOverride, fakeBillingAlert, mcpHintsDismissed } = useValues(superpowersLogic)
+ const { closeSuperpowers, setFakeStatusOverride, setFakeBillingAlert, reenableMCPHints } =
+ useActions(superpowersLogic)
const { dataProcessingAccepted } = useValues(maxGlobalLogic)
const { updateOrganization } = useActions(organizationLogic)
const { isDev } = useValues(preflightLogic)
@@ -172,6 +173,30 @@ function SuperpowersContent(): JSX.Element {
<LemonDivider />
+ <div>
+ <h3 className="font-semibold mb-2">MCP hints</h3>
+ <div className="space-y-2">
+ <div className="flex items-center justify-between p-2 border rounded">
+ <div>
+ <div className="font-medium">Re-enable MCP hints</div>
+ <div className="text-sm text-secondary">
+ Clear all dismissed surfaces, the global opt-out, and the cooldown so hints show again
+ </div>
+ </div>
+ <LemonButton
+ type="secondary"
+ size="small"
+ onClick={reenableMCPHints}
+ disabledReason={mcpHintsDismissed ? undefined : 'No MCP hints are currently dismissed'}
+ >
+ Re-enable
+ </LemonButton>
+ </div>
+ </div>
+ </div>
+
+ <LemonDivider />
+
<div>
<h3 className="font-semibold mb-2">Debug tools</h3>
<div className="space-y-2">
diff --git a/frontend/src/lib/components/Superpowers/superpowersLogic.ts b/frontend/src/lib/components/Superpowers/superpowersLogic.ts
index c39b29b2b701..299213bc02c7 100644
--- a/frontend/src/lib/components/Superpowers/superpowersLogic.ts
+++ b/frontend/src/lib/components/Superpowers/superpowersLogic.ts
@@ -1,5 +1,6 @@
import { actions, connect, kea, path, reducers, selectors } from 'kea'
+import { mcpHintLogic } from 'lib/components/MCPHint/mcpHintLogic'
import { preflightLogic } from 'scenes/PreflightCheck/preflightLogic'
// eslint-disable-next-line import/no-cycle
import { userLogic } from 'scenes/userLogic'
@@ -12,7 +13,15 @@ export type FakeBillingAlert = 'none' | 'info' | 'warning' | 'error'
export const superpowersLogic = kea<superpowersLogicType>([
path(['lib', 'components', 'Superpowers', 'superpowersLogic']),
connect(() => ({
- values: [userLogic, ['user'], preflightLogic, ['preflight']],
+ values: [
+ userLogic,
+ ['user'],
+ preflightLogic,
+ ['preflight'],
+ mcpHintLogic,
+ ['dismissedSurfaces', 'effectiveOptOut'],
+ ],
+ actions: [mcpHintLogic, ['reenable as reenableMCPHints']],
})),
actions({
openSuperpowers: true,
@@ -53,5 +62,10 @@ export const superpowersLogic = kea<superpowersLogicType>([
)
},
],
+ mcpHintsDismissed: [
+ (s) => [s.dismissedSurfaces, s.effectiveOptOut],
+ (dismissedSurfaces: Record<string, true>, effectiveOptOut: boolean): boolean =>
+ effectiveOptOut || Object.keys(dismissedSurfaces).length > 0,
+ ],
}),
])
diff --git a/frontend/src/scenes/annotations/annotationModalLogic.ts b/frontend/src/scenes/annotations/annotationModalLogic.ts
index d0ab271844e5..0181eaa0877d 100644
--- a/frontend/src/scenes/annotations/annotationModalLogic.ts
+++ b/frontend/src/scenes/annotations/annotationModalLogic.ts
@@ -178,7 +178,12 @@ export const annotationModalLogic = kea<annotationModalLogicType>([
dashboard_id: dashboardId,
})
actions.appendAnnotations([createdAnnotation])
- tryShowMCPHint('annotations.create')
+ const trimmedContent = content?.trim() ?? ''
+ const snippet = trimmedContent.length > 60 ? trimmedContent.slice(0, 57) + '…' : trimmedContent
+ const date = dateMarker.format('YYYY-MM-DD')
+ tryShowMCPHint('annotations.create', {
+ derivedPrompt: snippet ? `Annotate ${date}: ${snippet}` : undefined,
+ })
}
actions.closeModal()
},
diff --git a/frontend/src/scenes/cohorts/cohortEditLogic.ts b/frontend/src/scenes/cohorts/cohortEditLogic.ts
index a7474c18ec7d..82159483dc3e 100644
--- a/frontend/src/scenes/cohorts/cohortEditLogic.ts
+++ b/frontend/src/scenes/cohorts/cohortEditLogic.ts
@@ -476,7 +476,9 @@ export const cohortEditLogic = kea<cohortEditLogicType>([
})
actions.checkIfFinishedCalculating(cohort)
if (existingCohort.id === 'new') {
- tryShowMCPHint('cohorts.create')
+ tryShowMCPHint('cohorts.create', {
+ derivedPrompt: cohort.name ? `Build a cohort called ${cohort.name}` : undefined,
+ })
}
if (cohort.id !== 'new') {
actions.refreshPersonsData()
diff --git a/frontend/src/scenes/dashboard/newDashboardLogic.ts b/frontend/src/scenes/dashboard/newDashboardLogic.ts
index bd69a86bed68..faab4f88e902 100644
--- a/frontend/src/scenes/dashboard/newDashboardLogic.ts
+++ b/frontend/src/scenes/dashboard/newDashboardLogic.ts
@@ -209,7 +209,9 @@ export const newDashboardLogic = kea<newDashboardLogicType>([
const queryBasedDashboard = getQueryBasedDashboard(result)
queryBasedDashboard && dashboardsModel.actions.addDashboardSuccess(queryBasedDashboard)
actions.submitNewDashboardSuccessWithResult(result)
- tryShowMCPHint('dashboards.create')
+ tryShowMCPHint('dashboards.create', {
+ derivedPrompt: result.name ? `Build a dashboard called ${result.name}` : undefined,
+ })
if (show && values.redirectAfterCreation) {
breakpoint()
router.actions.push(urls.dashboard(result.id))
diff --git a/frontend/src/scenes/data-warehouse/editor/sqlEditorLogic.tsx b/frontend/src/scenes/data-warehouse/editor/sqlEditorLogic.tsx
index 39fba464da4d..9aa0cc6ec380 100644
--- a/frontend/src/scenes/data-warehouse/editor/sqlEditorLogic.tsx
+++ b/frontend/src/scenes/data-warehouse/editor/sqlEditorLogic.tsx
@@ -1193,7 +1193,9 @@ export const sqlEditorLogic = kea<sqlEditorLogicType>([
// Mark the first query task as complete when the query is run
globalSetupLogic.findMounted()?.actions.markTaskAsCompleted(SetupTaskId.RunFirstQuery)
- tryShowMCPHint('sql.execute')
+ const compactQuery = query.replace(/\s+/g, ' ').trim()
+ const truncated = compactQuery.length > 80 ? compactQuery.slice(0, 77) + '…' : compactQuery
+ tryShowMCPHint('sql.execute', truncated ? { derivedPrompt: `Run this SQL: ${truncated}` } : undefined)
},
saveAsView: async ({ fromDraft, materializeAfterSave = false }) => {
const multiDagEnabled = !!values.featureFlags[FEATURE_FLAGS.DATA_MODELING_MULTI_DAG]
diff --git a/frontend/src/scenes/experiments/ExperimentForm/createExperimentLogic.ts b/frontend/src/scenes/experiments/ExperimentForm/createExperimentLogic.ts
index cb542fddc0a4..f91f0de0021c 100644
--- a/frontend/src/scenes/experiments/ExperimentForm/createExperimentLogic.ts
+++ b/frontend/src/scenes/experiments/ExperimentForm/createExperimentLogic.ts
@@ -383,7 +383,9 @@ export const createExperimentLogic = kea<createExperimentLogicType>([
actions.createExperimentSuccess()
globalSetupLogic.findMounted()?.actions.markTaskAsCompleted(SetupTaskId.CreateExperiment)
lemonToast.success('Experiment created successfully!')
- tryShowMCPHint('experiments.create')
+ tryShowMCPHint('experiments.create', {
+ derivedPrompt: response.name ? `Create an A/B experiment called ${response.name}` : undefined,
+ })
// Don't reset - we just set the fresh data above
actions.saveExperimentSuccess()
diff --git a/frontend/src/scenes/experiments/experimentLogic.tsx b/frontend/src/scenes/experiments/experimentLogic.tsx
index e00899f25155..6a1394389d5d 100644
--- a/frontend/src/scenes/experiments/experimentLogic.tsx
+++ b/frontend/src/scenes/experiments/experimentLogic.tsx
@@ -1422,8 +1422,10 @@ export const experimentLogic = kea<experimentLogicType>([
actions.refreshExperimentResults(false, 'manual')
actions.setUnmodifiedExperiment(structuredClone(experimentWithMetricOrdering))
globalSetupLogic.findMounted()?.actions.markTaskAsCompleted(SetupTaskId.LaunchExperiment)
+ // Prefer the flag key — it's the shorter handle someone would actually type at an agent.
+ const experimentHandle = experiment.feature_flag_key || experiment.name
tryShowMCPHint('experiments.launch', {
- entityName: values.experiment?.feature_flag_key || values.experiment?.name,
+ derivedPrompt: experimentHandle ? `Launch experiment ${experimentHandle}` : undefined,
})
} catch (error: any) {
lemonToast.error(error.detail || 'Failed to launch experiment')
diff --git a/frontend/src/scenes/feature-flags/featureFlagLogic.ts b/frontend/src/scenes/feature-flags/featureFlagLogic.ts
index 0aa3641b7d18..11a2487a2b37 100644
--- a/frontend/src/scenes/feature-flags/featureFlagLogic.ts
+++ b/frontend/src/scenes/feature-flags/featureFlagLogic.ts
@@ -1862,14 +1862,23 @@ export const featureFlagLogic = kea<featureFlagLogicType>([
},
saveFeatureFlagSuccess: ({ featureFlag }) => {
lemonToast.success('Feature flag saved')
- tryShowMCPHint(props.id === 'new' ? 'feature_flags.create' : 'feature_flags.update', {
- entityName: featureFlag.key,
- })
actions.setFeatureFlag(featureFlag)
actions.updateFlag(featureFlag)
featureFlag.id && router.actions.replace(urls.featureFlag(featureFlag.id))
actions.editFeatureFlag(false)
+ const isCreate = props.id === 'new'
+ const rolloutPercent = featureFlag.filters?.groups?.[0]?.rollout_percentage ?? null
+ const flagKey = featureFlag.key || featureFlag.name || 'this-flag'
+ const derivedPrompt = isCreate
+ ? rolloutPercent != null
+ ? `Create a feature flag called ${flagKey} rolled out to ${rolloutPercent}% of users`
+ : `Create a feature flag called ${flagKey}`
+ : rolloutPercent != null
+ ? `Bump rollout for ${flagKey} to ${rolloutPercent}%`
+ : `Update the ${flagKey} flag`
+ tryShowMCPHint(isCreate ? 'feature_flags.create' : 'feature_flags.update', { derivedPrompt })
+
// Collect all completed setup tasks
const completedTasks: SetupTaskId[] = [SetupTaskId.CreateFeatureFlag]
diff --git a/frontend/src/scenes/insights/insightLogic.tsx b/frontend/src/scenes/insights/insightLogic.tsx
index 59b63bc7fd41..d8d28c61d003 100644
--- a/frontend/src/scenes/insights/insightLogic.tsx
+++ b/frontend/src/scenes/insights/insightLogic.tsx
@@ -621,7 +621,10 @@ export const insightLogic: LogicWrapper<insightLogicType> = kea<insightLogicType
action: () => router.actions.push(urls.savedInsights()),
},
})
- tryShowMCPHint('insights.create')
+ const insightName = savedInsight.name || savedInsight.derived_name
+ tryShowMCPHint('insights.create', {
+ derivedPrompt: insightName ? `Build an insight called ${insightName}` : undefined,
+ })
dashboardsModel.findMounted()?.actions.updateDashboardInsight(savedInsight)
diff --git a/frontend/src/scenes/surveys/surveyLogic.tsx b/frontend/src/scenes/surveys/surveyLogic.tsx
index 70c53a469bf2..a4d2ff7c76bc 100644
--- a/frontend/src/scenes/surveys/surveyLogic.tsx
+++ b/frontend/src/scenes/surveys/surveyLogic.tsx
@@ -1155,7 +1155,10 @@ export const surveyLogic = kea<surveyLogicType>([
router.actions.replace(urls.survey(survey.id))
actions.reportSurveyCreated(survey)
globalSetupLogic.findMounted()?.actions.markTaskAsCompleted(SetupTaskId.CreateSurvey)
- tryShowMCPHint('surveys.create')
+ const surveyType = survey.type ? `${survey.type} ` : ''
+ tryShowMCPHint('surveys.create', {
+ derivedPrompt: survey.name ? `Create a ${surveyType}survey called ${survey.name}` : undefined,
+ })
},
updateSurveySuccess: ({ survey }) => {
lemonToast.success(<>Survey {survey.name} updated</>)