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(surveys): let posthog ai set the survey schedule (#114621)

posthog[bot]07cad4a646bf
diff --git a/ee/hogai/context/survey/context.py b/ee/hogai/context/survey/context.py
index f78311d9d08f..79b7bbf8ee36 100644
--- a/ee/hogai/context/survey/context.py
+++ b/ee/hogai/context/survey/context.py
@@ -133,6 +133,15 @@ class SurveyContext:
return "\n".join(lines)
+ def format_schedule(self, survey: Survey) -> str:
+ if survey.schedule == Survey.Schedule.ALWAYS:
+ return "always (every time the display conditions are met)"
+ if survey.schedule == Survey.Schedule.RECURRING:
+ if survey.iteration_count and survey.iteration_frequency_days:
+ return f"recurring (up to {survey.iteration_count} times, every {survey.iteration_frequency_days} days)"
+ return "recurring"
+ return "once"
+
def _get_status(self, survey: Survey) -> str:
"""Determine the survey status."""
if survey.archived:
@@ -161,6 +170,7 @@ class SurveyContext:
survey_name=survey_name,
survey_type=survey.type,
survey_status=status,
+ survey_schedule=self.format_schedule(survey),
survey_description=survey.description or "No description provided.",
questions=self.format_questions(survey),
targeting=self.format_targeting(survey),
diff --git a/ee/hogai/context/survey/prompts.py b/ee/hogai/context/survey/prompts.py
index 5a4be41ea846..bd7f4d387866 100644
--- a/ee/hogai/context/survey/prompts.py
+++ b/ee/hogai/context/survey/prompts.py
@@ -4,6 +4,7 @@ SURVEY_CONTEXT_TEMPLATE = """
**Survey ID:** {survey_id}
**Type:** {survey_type}
**Status:** {survey_status}
+**Schedule:** {survey_schedule}
**Description:** {survey_description}
### Questions
diff --git a/ee/hogai/context/survey/test/test_context.py b/ee/hogai/context/survey/test/test_context.py
index e6e397d78ea9..94a9a947b51a 100644
--- a/ee/hogai/context/survey/test/test_context.py
+++ b/ee/hogai/context/survey/test/test_context.py
@@ -2,6 +2,8 @@ import pytest
from posthog.test.base import BaseTest
from unittest.mock import AsyncMock, patch
+from parameterized import parameterized
+
from products.surveys.backend.models import Survey
from ee.hogai.context.survey.context import SurveyContext
@@ -84,6 +86,22 @@ class TestSurveyContext(BaseTest):
assert formatted == "No specific targeting configured (shows to all users)."
+ @parameterized.expand(
+ [
+ ("once_with_stale_iterations", "once", 3, 30, "once"),
+ ("recurring", "recurring", 3, 30, "recurring (up to 3 times, every 30 days)"),
+ ("recurring_without_iterations", "recurring", None, None, "recurring"),
+ ("always", "always", None, None, "always (every time the display conditions are met)"),
+ ]
+ )
+ def test_format_schedule(self, _name, schedule, iteration_count, iteration_frequency_days, expected):
+ self.survey.schedule = schedule
+ self.survey.iteration_count = iteration_count
+ self.survey.iteration_frequency_days = iteration_frequency_days
+ context = SurveyContext(team=self.team, user=self.user, survey_id=str(self.survey.id))
+
+ assert context.format_schedule(self.survey) == expected
+
def test_get_status_draft(self):
context = SurveyContext(team=self.team, user=self.user, survey_id=str(self.survey.id))
status = context._get_status(self.survey)
diff --git a/products/surveys/backend/api/survey.py b/products/surveys/backend/api/survey.py
index 8df1f59174a7..061ff59190b7 100644
--- a/products/surveys/backend/api/survey.py
+++ b/products/surveys/backend/api/survey.py
@@ -82,7 +82,13 @@ from products.feature_flags.backend.facade.config import ConfigFormatError
from products.feature_flags.backend.models.feature_flag import FeatureFlag
from products.feature_flags.backend.ownership import FLAG_OWNER_SURVEY, assert_flag_available_for
from products.product_analytics.backend.facade.models import Insight
-from products.surveys.backend.models import MAX_ITERATION_COUNT, Survey, SurveyResponseArchive, ensure_question_ids
+from products.surveys.backend.models import (
+ MAX_ITERATION_COUNT,
+ MAX_ITERATION_FREQUENCY_DAYS,
+ Survey,
+ SurveyResponseArchive,
+ ensure_question_ids,
+)
from products.surveys.backend.responses import (
SurveyRates,
SurveyStats,
@@ -2291,7 +2297,7 @@ class SurveySerializerCreateUpdateOnlySchema(SurveySerializerCreateUpdateOnly):
required=False,
allow_null=True,
min_value=1,
- max_value=365,
+ max_value=MAX_ITERATION_FREQUENCY_DAYS,
help_text="For a recurring schedule, this field specifies the interval in days between each survey instance shown to the user, used alongside iteration_count for precise scheduling.",
)
enable_partial_responses = serializers.BooleanField(
diff --git a/products/surveys/backend/max_tools.py b/products/surveys/backend/max_tools.py
index ee29b634c12b..5e106bbf5446 100644
--- a/products/surveys/backend/max_tools.py
+++ b/products/surveys/backend/max_tools.py
@@ -20,7 +20,7 @@ from posthog.models import Team
from products.feature_flags.backend.models.feature_flag import FeatureFlag
from products.surveys.backend.api.survey import SurveySerializerCreateUpdateOnly
-from products.surveys.backend.models import Survey
+from products.surveys.backend.models import MAX_ITERATION_COUNT, MAX_ITERATION_FREQUENCY_DAYS, Survey
from products.surveys.backend.summarization.fetch import fetch_responses
from ee.hogai.tool import MaxTool
@@ -227,7 +227,95 @@ def _build_targeting_conditions(
return conditions
-SURVEY_CREATION_TOOL_DESCRIPTION = dedent("""
+SCHEDULE_OPTION = Literal["once", "recurring", "always"]
+
+# Same defaults the survey editor applies when a user picks "Repeat on a schedule"
+DEFAULT_ITERATION_COUNT = 2
+DEFAULT_ITERATION_FREQUENCY_DAYS = 90
+
+SCHEDULE_DESCRIPTION = (
+ "How often a person can see the survey. "
+ "'once' (default): show it one time per person. "
+ "'recurring': show it again on a fixed schedule, set with iteration_count and iteration_frequency_days. "
+ "'always': show it every time the display conditions are met, also after the person responds or dismisses it. "
+ "In the survey editor, 'always' is the 'Every time the display conditions are met' option "
+ "in the 'Completion conditions' section. For a widget survey it is also the "
+ "'Allow survey to be displayed every time the button is clicked' checkbox in the 'Presentation' section."
+)
+
+SCHEDULE_PROMPT = """
+ # Schedule (how often a person sees the survey)
+ Use the schedule field. The survey editor shows it in the "Completion conditions" section as
+ "How often should we show this survey to a person?". These are the only options:
+ - "once" (default) -> "Once": a person sees the survey one time
+ - "recurring" -> "Repeat on a schedule": the survey shows up to iteration_count times, once every
+ iteration_frequency_days days (defaults: 2 times, every 90 days)
+ - "always" -> "Every time the display conditions are met": the survey shows again each time the
+ display conditions match, also after the person responds or dismisses it
+ For a widget (feedback button) survey, the editor also shows "always" as the checkbox
+ "Allow survey to be displayed every time the button is clicked" in the "Presentation" section.
+ When you tell a user where to find this for a widget survey, name that checkbox first.
+ Do not invent other options or labels. When a user asks to show a survey every time or keep showing it,
+ use "always". An "always" popover with no display conditions (URL, wait period) appears again and again,
+ so suggest a URL target or wait_period_days.
+
+"""
+
+
+def _build_schedule_fields(
+ schedule: str | None,
+ iteration_count: int | None,
+ iteration_frequency_days: int | None,
+ current_iteration_count: int | None = None,
+ current_iteration_frequency_days: int | None = None,
+) -> dict[str, Any]:
+ # Iteration values alone configure repeats, the same as in the survey API serializer
+ if schedule is None and (iteration_count is not None or iteration_frequency_days is not None):
+ schedule = Survey.Schedule.RECURRING
+ if schedule is None:
+ return {}
+ if schedule == Survey.Schedule.RECURRING:
+ iteration_count = iteration_count or current_iteration_count or DEFAULT_ITERATION_COUNT
+ iteration_frequency_days = (
+ iteration_frequency_days or current_iteration_frequency_days or DEFAULT_ITERATION_FREQUENCY_DAYS
+ )
+ return {
+ "schedule": schedule,
+ "iteration_count": min(iteration_count, MAX_ITERATION_COUNT),
+ "iteration_frequency_days": iteration_frequency_days,
+ }
+ # The iteration columns drive repeats on their own, so clear them for non-recurring schedules
+ return {"schedule": schedule, "iteration_count": None, "iteration_frequency_days": None}
+
+
+def _always_schedule_warning(survey_type: str, schedule: str | None, conditions: dict[str, Any] | None) -> str:
+ if schedule != Survey.Schedule.ALWAYS or survey_type != Survey.SurveyType.POPOVER:
+ return ""
+ conditions = conditions or {}
+ wait_period_days = conditions.get("seenSurveyWaitPeriodInDays") or 0
+ if wait_period_days > 0:
+ return (
+ f" Note: this popover shows again every {wait_period_days} days, "
+ "as long as its other display conditions are met."
+ )
+ has_display_conditions = bool(
+ conditions.get("url")
+ or conditions.get("selector")
+ or (conditions.get("events") or {}).get("values")
+ or conditions.get("deviceTypes")
+ )
+ if has_display_conditions:
+ return (
+ " Note: this popover shows again every time its display conditions are met, "
+ "so people can see it very often. Add a wait period to limit this."
+ )
+ return (
+ " Warning: this popover has no display conditions, so it shows again and again. "
+ "Add a URL target or a wait period to limit this."
+ )
+
+
+SURVEY_CREATION_TOOL_DESCRIPTION = dedent(f"""
Create and optionally launch a survey.
# When to use
@@ -258,7 +346,7 @@ SURVEY_CREATION_TOOL_DESCRIPTION = dedent("""
- "single_choice": pick one from choices
- "multiple_choice": pick many from choices
- "link": call-to-action link
-
+ {SCHEDULE_PROMPT}
# After creation
Always share the survey link with the user so they can view and configure it.
The link is included in the tool response.
@@ -285,6 +373,19 @@ class CreateSurveyToolArgs(BaseModel):
default=None, description="Days to wait after user has seen any survey before showing this one"
)
responses_limit: int | None = Field(default=None, description="Maximum number of responses to collect")
+ schedule: SCHEDULE_OPTION | None = Field(default=None, description=SCHEDULE_DESCRIPTION)
+ iteration_count: int | None = Field(
+ default=None,
+ ge=1,
+ le=MAX_ITERATION_COUNT,
+ description="With schedule='recurring': how many times in total to show the survey (default 2, max 500)",
+ )
+ iteration_frequency_days: int | None = Field(
+ default=None,
+ ge=1,
+ le=MAX_ITERATION_FREQUENCY_DAYS,
+ description="With schedule='recurring': days between repeats (default 90)",
+ )
class CreateSurveyTool(MaxTool):
@@ -317,6 +418,9 @@ class CreateSurveyTool(MaxTool):
linked_flag_variant: str | None,
wait_period_days: int | None,
responses_limit: int | None,
+ schedule: str | None = None,
+ iteration_count: int | None = None,
+ iteration_frequency_days: int | None = None,
) -> dict[str, Any]:
survey_data: dict[str, Any] = {
"name": name,
@@ -343,6 +447,8 @@ class CreateSurveyTool(MaxTool):
if conditions:
survey_data["conditions"] = conditions
+ survey_data.update(_build_schedule_fields(schedule, iteration_count, iteration_frequency_days))
+
if self.context.get("insight_id"):
survey_data["linked_insight_id"] = self.context["insight_id"]
@@ -361,6 +467,9 @@ class CreateSurveyTool(MaxTool):
linked_flag_variant: str | None = None,
wait_period_days: int | None = None,
responses_limit: int | None = None,
+ schedule: str | None = None,
+ iteration_count: int | None = None,
+ iteration_frequency_days: int | None = None,
) -> tuple[str, dict[str, Any]]:
try:
if not questions:
@@ -383,6 +492,9 @@ class CreateSurveyTool(MaxTool):
linked_flag_variant=linked_flag_variant,
wait_period_days=wait_period_days,
responses_limit=responses_limit,
+ schedule=schedule,
+ iteration_count=iteration_count,
+ iteration_frequency_days=iteration_frequency_days,
)
survey_data["questions"] = _validate_and_sanitize_questions(survey_data["questions"])
@@ -407,6 +519,7 @@ class CreateSurveyTool(MaxTool):
else "Launch it to activate its public shareable link, which you'll find on the survey page."
)
message = f"{message} {share_hint}"
+ message += _always_schedule_warning(survey_type, survey_data.get("schedule"), survey_data.get("conditions"))
return message, {
"survey_id": created_survey.id,
@@ -425,7 +538,7 @@ class CreateSurveyTool(MaxTool):
return f"Failed to create survey: {str(e)}", {"error": "creation_failed", "details": str(e)}
-SURVEY_EDIT_TOOL_DESCRIPTION = dedent("""
+SURVEY_EDIT_TOOL_DESCRIPTION = dedent(f"""
Edit an existing survey.
# When to use
@@ -446,7 +559,7 @@ SURVEY_EDIT_TOOL_DESCRIPTION = dedent("""
- Set remove_linked_flag=true to remove linked feature flag targeting
- Set remove_linked_flag_variant=true to remove only feature flag variant targeting
- Set remove_wait_period=true to remove the survey wait period
-
+ {SCHEDULE_PROMPT}
# Question identity
- When updating questions, use read_data(kind="survey") first to see the current questions
- Each question is shown with a number (1, 2, 3, ...) — pass that number (or the question's real UUID) as the question's `id` to preserve its identity and historical response data
@@ -483,6 +596,19 @@ class EditSurveyToolArgs(BaseModel):
)
remove_wait_period: bool = Field(default=False, description="Remove the survey wait period")
responses_limit: int | None = Field(default=None, description="Maximum number of responses")
+ schedule: SCHEDULE_OPTION | None = Field(default=None, description=SCHEDULE_DESCRIPTION)
+ iteration_count: int | None = Field(
+ default=None,
+ ge=1,
+ le=MAX_ITERATION_COUNT,
+ description="With schedule='recurring': how many times in total to show the survey (max 500)",
+ )
+ iteration_frequency_days: int | None = Field(
+ default=None,
+ ge=1,
+ le=MAX_ITERATION_FREQUENCY_DAYS,
+ description="With schedule='recurring': days between repeats",
+ )
launch: bool | None = Field(default=None, description="Set to true to launch the survey")
stop: bool | None = Field(default=None, description="Set to true to stop the survey")
archive: bool | None = Field(default=None, description="Set to true to archive the survey")
@@ -575,6 +701,9 @@ class EditSurveyTool(MaxTool):
remove_linked_flag_variant: bool = False,
remove_wait_period: bool = False,
responses_limit: int | None = None,
+ schedule: str | None = None,
+ iteration_count: int | None = None,
+ iteration_frequency_days: int | None = None,
launch: bool | None = None,
stop: bool | None = None,
archive: bool | None = None,
@@ -626,6 +755,20 @@ class EditSurveyTool(MaxTool):
if updated_conditions != existing_conditions:
update_data["conditions"] = updated_conditions
+ schedule_fields = _build_schedule_fields(
+ schedule,
+ iteration_count,
+ iteration_frequency_days,
+ current_iteration_count=survey.iteration_count,
+ current_iteration_frequency_days=survey.iteration_frequency_days,
+ )
+ new_iteration_count = schedule_fields.get("iteration_count")
+ if survey.current_iteration and new_iteration_count and survey.current_iteration > new_iteration_count:
+ raise serializers.ValidationError(
+ f"Cannot change survey recurrence to {new_iteration_count}, should be at least {survey.current_iteration}"
+ )
+ update_data.update(schedule_fields)
+
# Lifecycle bools
lifecycle_actions = []
if launch is True:
@@ -655,6 +798,8 @@ class EditSurveyTool(MaxTool):
else:
fields_str = ", ".join(update_data.keys())
message = f"Survey '{survey.name}' updated successfully! Modified fields: {fields_str}"
+ if schedule is not None:
+ message += _always_schedule_warning(survey.type, survey.schedule, survey.conditions)
return message, {
"survey_id": str(survey.id),
diff --git a/products/surveys/backend/models.py b/products/surveys/backend/models.py
index 423ec0777270..8b4d079ae3c6 100644
--- a/products/surveys/backend/models.py
+++ b/products/surveys/backend/models.py
@@ -25,6 +25,7 @@ from products.actions.backend.models.action import Action
# and cause performance issues, so we are extra careful with this value
# NB this is enforced in the UI too
MAX_ITERATION_COUNT = 500
+MAX_ITERATION_FREQUENCY_DAYS = 365
if TYPE_CHECKING:
from posthog.models.team import Team
diff --git a/products/surveys/backend/test_max_tools.py b/products/surveys/backend/test_max_tools.py
index f21d21fa14b4..4a671516f5af 100644
--- a/products/surveys/backend/test_max_tools.py
+++ b/products/surveys/backend/test_max_tools.py
@@ -374,6 +374,67 @@ class TestSurveyCreatorTool(BaseTest):
assert survey.conditions["url"] == "/pricing"
assert survey.conditions["urlMatchType"] == "icontains"
+ @parameterized.expand(
+ [
+ ("always_without_conditions", {"schedule": "always"}, "always", None, None, "no display conditions"),
+ (
+ "always_with_url",
+ {"schedule": "always", "target_url": "/pricing"},
+ "always",
+ None,
+ None,
+ "every time its display conditions are met",
+ ),
+ ("recurring_defaults", {"schedule": "recurring"}, "recurring", 2, 90, None),
+ (
+ "recurring_custom",
+ {"schedule": "recurring", "iteration_count": 4, "iteration_frequency_days": 30},
+ "recurring",
+ 4,
+ 30,
+ None,
+ ),
+ ("unset", {}, "once", None, None, None),
+ (
+ "iteration_values_without_schedule",
+ {"iteration_count": 4, "iteration_frequency_days": 30},
+ "recurring",
+ 4,
+ 30,
+ None,
+ ),
+ (
+ "always_with_wait_period",
+ {"schedule": "always", "wait_period_days": 7},
+ "always",
+ None,
+ None,
+ "shows again every 7 days",
+ ),
+ ]
+ )
+ @pytest.mark.django_db
+ @pytest.mark.asyncio
+ async def test_create_survey_schedule(
+ self, _name, kwargs, expected_schedule, expected_count, expected_frequency, expected_warning
+ ):
+ tool = self._setup_tool()
+
+ content, artifact = await tool._arun_impl(
+ name="Feedback", questions=[SimpleSurveyQuestion(type="open", question="Any feedback?")], **kwargs
+ )
+
+ survey = await sync_to_async(Survey.objects.get)(id=artifact["survey_id"])
+ assert survey.schedule == expected_schedule
+ assert survey.iteration_count == expected_count
+ assert survey.iteration_frequency_days == expected_frequency
+ if expected_warning:
+ assert expected_warning in content
+ else:
+ assert "display conditions" not in content
+ if kwargs.get("wait_period_days"):
+ assert "Add a wait period" not in content
+
@pytest.mark.django_db
@pytest.mark.asyncio
async def test_create_external_survey(self):
@@ -985,6 +1046,29 @@ class TestEditSurveyTool(BaseTest):
assert "Remove URL targeting" in preview
assert "Remove linked feature flag targeting" in preview
+ @parameterized.expand(
+ [
+ ("recurring_to_always", {"schedule": "always"}, "always", None, None),
+ ("recurring_to_once", {"schedule": "once"}, "once", None, None),
+ ("change_count_only", {"iteration_count": 5}, "recurring", 5, 30),
+ ("count_below_current_iteration", {"iteration_count": 1}, "recurring", 3, 30),
+ ]
+ )
+ @pytest.mark.django_db
+ @pytest.mark.asyncio
+ async def test_edit_survey_schedule(self, _name, kwargs, expected_schedule, expected_count, expected_frequency):
+ tool = self._setup_tool()
+ survey = await self._create_test_survey(
+ schedule="recurring", iteration_count=3, iteration_frequency_days=30, current_iteration=2
+ )
+
+ await tool._arun_impl(survey_id=str(survey.id), **kwargs)
+
+ updated_survey = await sync_to_async(Survey.objects.get)(id=survey.id)
+ assert updated_survey.schedule == expected_schedule
+ assert updated_survey.iteration_count == expected_count
+ assert updated_survey.iteration_frequency_days == expected_frequency
+
@pytest.mark.django_db
@pytest.mark.asyncio
async def test_edit_survey_launch(self):
diff --git a/products/surveys/mcp/tools.yaml b/products/surveys/mcp/tools.yaml
index 17ae9323d1d2..730dcd0f23a3 100644
--- a/products/surveys/mcp/tools.yaml
+++ b/products/surveys/mcp/tools.yaml
@@ -73,8 +73,12 @@ tools:
implementations.
schedule:
description: >
- Survey scheduling behavior. Omit this to use the default once behavior. Use recurring only when the
- user explicitly asks for a repeated schedule.
+ How often a person can see the survey. Omit this to use the default once behavior. Use recurring
+ only when the user explicitly asks for a repeated schedule, and set iteration_count and
+ iteration_frequency_days with it. Use always when the user wants the survey to show every time its
+ display conditions are met, also after the person responds or dismisses it. The survey editor calls
+ this "Every time the display conditions are met". An always popover without display conditions or a
+ wait period shows again and again, so suggest a URL condition or seenSurveyWaitPeriodInDays.
questions:
description: >
Complete survey question list. Prefer 1-3 questions unless the user explicitly asks for a longer
@@ -242,6 +246,15 @@ tools:
the survey first and preserve existing appearance fields. whiteLabel=true requires the organization
to have the white-labelling entitlement (Enterprise); leave it unset unless requested and available.
surveyPopupDelaySeconds must be non-negative.
+ schedule:
+ description: >
+ How often a person can see the survey: once, recurring, or always. Omit this to keep the current
+ schedule. When setting recurring, also set iteration_count and iteration_frequency_days. Use always
+ when the user wants the survey to show every time its display conditions are met, also after the
+ person responds or dismisses it. The survey editor calls this "Every time the display conditions are
+ met". When you change away from recurring, the iteration fields are cleared. An always popover
+ without display conditions or a wait period shows again and again, so suggest a URL condition or
+ seenSurveyWaitPeriodInDays.
questions:
description: >
Complete replacement question list. Existing question IDs are tied to response data and must be
diff --git a/services/mcp/src/tools/generated/surveys.ts b/services/mcp/src/tools/generated/surveys.ts
index 59ba10e97290..8b148f71bd45 100644
--- a/services/mcp/src/tools/generated/surveys.ts
+++ b/services/mcp/src/tools/generated/surveys.ts
@@ -33,7 +33,7 @@ const SurveyCreateSchema = () => {
'Survey type. Use popover for most in-app surveys, widget for always-available feedback entrypoints, external_survey for hosted forms with a shareable public URL, and api only for headless custom implementations.'
),
schedule: SurveysCreateBody.shape['schedule'].describe(
- 'Survey scheduling behavior. Omit this to use the default once behavior. Use recurring only when the user explicitly asks for a repeated schedule.'
+ 'How often a person can see the survey. Omit this to use the default once behavior. Use recurring only when the user explicitly asks for a repeated schedule, and set iteration_count and iteration_frequency_days with it. Use always when the user wants the survey to show every time its display conditions are met, also after the person responds or dismisses it. The survey editor calls this "Every time the display conditions are met". An always popover without display conditions or a wait period shows again and again, so suggest a URL condition or seenSurveyWaitPeriodInDays.'
),
questions: SurveysCreateBody.shape['questions'].describe(
'Complete survey question list. Prefer 1-3 questions unless the user explicitly asks for a longer survey. Use rating questions for NPS/CSAT, open for freeform feedback, and choice questions when the user wants structured answers. Questions can include inline translations on each question.'
@@ -256,6 +256,9 @@ const SurveyUpdateSchema = () => {
appearance: SurveysPartialUpdateBody.shape['appearance'].describe(
'Optional appearance customization. Omit this to preserve current styling. When changing it, fetch the survey first and preserve existing appearance fields. whiteLabel=true requires the organization to have the white-labelling entitlement (Enterprise); leave it unset unless requested and available. surveyPopupDelaySeconds must be non-negative.'
),
+ schedule: SurveysPartialUpdateBody.shape['schedule'].describe(
+ 'How often a person can see the survey: once, recurring, or always. Omit this to keep the current schedule. When setting recurring, also set iteration_count and iteration_frequency_days. Use always when the user wants the survey to show every time its display conditions are met, also after the person responds or dismisses it. The survey editor calls this "Every time the display conditions are met". When you change away from recurring, the iteration fields are cleared. An always popover without display conditions or a wait period shows again and again, so suggest a URL condition or seenSurveyWaitPeriodInDays.'
+ ),
questions: SurveysPartialUpdateBody.shape['questions'].describe(
"Complete replacement question list. Existing question IDs are tied to response data and must be preserved. Before sending this field, fetch the survey first, modify the existing question objects in place, keep every unchanged or edited question's id, and include the complete intended ordered question list. New questions should omit id. Do not regenerate existing questions from scratch."
),
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/survey-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/survey-create.json
index 8eef80e41ca7..000a4028e6e3 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/survey-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/survey-create.json
@@ -756,7 +756,7 @@
"type": "null"
}
],
- "description": "Survey scheduling behavior. Omit this to use the default once behavior. Use recurring only when the user explicitly asks for a repeated schedule."
+ "description": "How often a person can see the survey. Omit this to use the default once behavior. Use recurring only when the user explicitly asks for a repeated schedule, and set iteration_count and iteration_frequency_days with it. Use always when the user wants the survey to show every time its display conditions are met, also after the person responds or dismisses it. The survey editor calls this \"Every time the display conditions are met\". An always popover without display conditions or a wait period shows again and again, so suggest a URL condition or seenSurveyWaitPeriodInDays."
},
"start_date": {
"anyOf": [
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/survey-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/survey-update.json
index a37620060c16..942ab70b37fc 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/survey-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/survey-update.json
@@ -787,7 +787,7 @@
"type": "null"
}
],
- "description": "Survey scheduling behavior: 'once' = show once per user (default), 'recurring' = repeat based on iteration_count and iteration_frequency_days settings, 'always' = show every time conditions are met (mainly for widget surveys)\n\n* `once` - once\n* `recurring` - recurring\n* `always` - always"
+ "description": "How often a person can see the survey: once, recurring, or always. Omit this to keep the current schedule. When setting recurring, also set iteration_count and iteration_frequency_days. Use always when the user wants the survey to show every time its display conditions are met, also after the person responds or dismisses it. The survey editor calls this \"Every time the display conditions are met\". When you change away from recurring, the iteration fields are cleared. An always popover without display conditions or a wait period shows again and again, so suggest a URL condition or seenSurveyWaitPeriodInDays."
},
"start_date": {
"anyOf": [