: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(user-interviews): MCP tools to add, edit, remove, and inspect interviewees (#58637)
Paul D'Ambraf5d3d6e67deb
diff --git a/products/user_interviews/backend/api.py b/products/user_interviews/backend/api.pyindex c36e157b2bcf..eaaf4e60b32e 100644--- a/products/user_interviews/backend/api.py+++ b/products/user_interviews/backend/api.py@@ -5,8 +5,9 @@ from typing import Anyfrom uuid import uuid4from django.conf import settings+from django.core.exceptions import ValidationError as DjangoValidationErrorfrom django.core.files import File-from django.db import models+from django.db import models, transactionfrom django.db.models import QuerySetfrom django.utils import timezone@@ -519,6 +520,20 @@ class UserInterviewTopicSerializer(serializers.ModelSerializer):**validated_data,)+ def update(self, instance: UserInterviewTopic, validated_data: dict) -> UserInterviewTopic:+ old_emails = set(instance.interviewee_emails or [])+ old_distinct_ids = set(instance.interviewee_distinct_ids or [])+ # Atomic so the topic save and the share-revoke commit together. Without this,+ # a crash between the two writes would leave an interviewee removed from targeting+ # but still able to open their existing public interview link.+ with transaction.atomic():+ topic = super().update(instance, validated_data)+ new_emails = set(topic.interviewee_emails or [])+ new_distinct_ids = set(topic.interviewee_distinct_ids or [])+ removed = (old_emails - new_emails) | (old_distinct_ids - new_distinct_ids)+ _disable_shares_for_identifiers(topic=topic, identifiers=sorted(removed))+ return topic+def _parse_identifier(identifier: str) -> tuple[str, str | None]:"""Split an interviewee identifier into a display name and (optional) email.@@ -637,6 +652,55 @@ class InterviewInviteResultSerializer(serializers.Serializer):)+# Mirrors the column max_length on UserInterviewTopic.interviewee_emails — anything longer+# would pass request validation and then fail at INSERT time with a 500. Keep in sync.+EMAIL_IDENTIFIER_MAX_LENGTH = 254+DISTINCT_ID_IDENTIFIER_MAX_LENGTH = 400+++def _identifier_is_email(identifier: str) -> bool:+ try:+ EmailWithDisplayNameValidator()(identifier)+ except DjangoValidationError:+ return False+ return True+++class IntervieweeIdentifierRequestSerializer(serializers.Serializer):+ identifier = serializers.CharField(+ max_length=DISTINCT_ID_IDENTIFIER_MAX_LENGTH,+ help_text=(+ "Email address or PostHog distinct ID for the interviewee. Email-shaped values "+ "(including the `Display Name <email@host>` form) are routed to `interviewee_emails`; "+ "everything else lands in `interviewee_distinct_ids`."+ ),+ )++ def validate_identifier(self, value: str) -> str:+ if _identifier_is_email(value) and len(value) > EMAIL_IDENTIFIER_MAX_LENGTH:+ raise serializers.ValidationError(+ f"Email identifiers must be {EMAIL_IDENTIFIER_MAX_LENGTH} characters or fewer."+ )+ return value+++def _disable_shares_for_identifiers(*, topic: UserInterviewTopic, identifiers: list[str]) -> None:+ """Disable any active SharingConfiguration tied to the given identifiers on a topic.++ Used by remove_interviewee, and by topic partial_update when identifiers are dropped+ from the targeting arrays — so a person removed via either path can no longer open+ their existing public interview link.+ """+ if not identifiers:+ return+ SharingConfiguration.objects.filter(+ team_id=topic.team_id,+ interviewee_context__topic=topic,+ interviewee_context__interviewee_identifier__in=identifiers,+ enabled=True,+ ).update(enabled=False)++class SendInvitesRequestSerializer(serializers.Serializer):subject = serializers.CharField(required=False,@@ -671,6 +735,8 @@ class UserInterviewTopicViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSet):"destroy","generate_links","send_invites",+ "add_interviewee",+ "remove_interviewee",]queryset = UserInterviewTopic.objects.select_related("created_by").all()serializer_class = UserInterviewTopicSerializer@@ -793,6 +859,79 @@ class UserInterviewTopicViewSet(TeamAndOrgViewSetMixin, viewsets.ModelViewSet):return response.Response(InterviewInviteResultSerializer(results, many=True).data)+ @extend_schema(+ request=IntervieweeIdentifierRequestSerializer,+ responses={200: OpenApiResponse(response=UserInterviewTopicSerializer)},+ description=(+ "Add a single interviewee to this topic. Email-shaped identifiers (including the "+ "`Display Name <email@host>` form) are appended to `interviewee_emails`; everything "+ "else is appended to `interviewee_distinct_ids`. Idempotent — adding an identifier "+ "that's already present leaves the topic unchanged. Returns the updated topic."+ ),+ )+ @action(detail=True, methods=["post"], url_path="add_interviewee")+ def add_interviewee(self, request: Request, *args: Any, **kwargs: Any) -> response.Response:+ params = IntervieweeIdentifierRequestSerializer(data=request.data)+ params.is_valid(raise_exception=True)+ identifier = params.validated_data["identifier"]++ self.get_object()+ with transaction.atomic():+ topic = self.get_queryset().select_for_update(of=("self",)).get(pk=kwargs[self.lookup_field])+ emails = list(topic.interviewee_emails or [])+ distinct_ids = list(topic.interviewee_distinct_ids or [])+ changed = False+ if _identifier_is_email(identifier):+ if identifier not in emails:+ emails.append(identifier)+ changed = True+ elif identifier not in distinct_ids:+ distinct_ids.append(identifier)+ changed = True++ if changed:+ topic.interviewee_emails = emails+ topic.interviewee_distinct_ids = distinct_ids+ topic.save(update_fields=["interviewee_emails", "interviewee_distinct_ids"])++ serializer = UserInterviewTopicSerializer(topic, context=self.get_serializer_context())+ return response.Response(serializer.data)++ @extend_schema(+ request=IntervieweeIdentifierRequestSerializer,+ responses={200: OpenApiResponse(response=UserInterviewTopicSerializer)},+ description=(+ "Remove an interviewee from this topic. Drops the identifier from both "+ "`interviewee_emails` and `interviewee_distinct_ids`, and disables any active "+ "SharingConfiguration linked to an IntervieweeContext for that identifier on this "+ "topic so the removed person can no longer open their interview link. Idempotent — "+ "removing an identifier that isn't present is a no-op. Returns the updated topic."+ ),+ )+ @action(detail=True, methods=["post"], url_path="remove_interviewee")+ def remove_interviewee(self, request: Request, *args: Any, **kwargs: Any) -> response.Response:+ params = IntervieweeIdentifierRequestSerializer(data=request.data)+ params.is_valid(raise_exception=True)+ identifier = params.validated_data["identifier"]++ self.get_object()+ with transaction.atomic():+ topic = self.get_queryset().select_for_update(of=("self",)).get(pk=kwargs[self.lookup_field])+ new_emails = [e for e in (topic.interviewee_emails or []) if e != identifier]+ new_distinct_ids = [d for d in (topic.interviewee_distinct_ids or []) if d != identifier]++ if new_emails != list(topic.interviewee_emails or []) or new_distinct_ids != list(+ topic.interviewee_distinct_ids or []+ ):+ topic.interviewee_emails = new_emails+ topic.interviewee_distinct_ids = new_distinct_ids+ topic.save(update_fields=["interviewee_emails", "interviewee_distinct_ids"])++ _disable_shares_for_identifiers(topic=topic, identifiers=[identifier])++ serializer = UserInterviewTopicSerializer(topic, context=self.get_serializer_context())+ return response.Response(serializer.data)+class IntervieweeContextSerializer(serializers.ModelSerializer):created_by = UserBasicSerializer(read_only=True)diff --git a/products/user_interviews/backend/test_interview_sharing.py b/products/user_interviews/backend/test_interview_sharing.pyindex c410361fed94..6ac51a1de647 100644--- a/products/user_interviews/backend/test_interview_sharing.py+++ b/products/user_interviews/backend/test_interview_sharing.py@@ -135,6 +135,148 @@ class TestUserInterviewTopicCreate(_FeatureFlagEnabledMixin):self.assertEqual(response.status_code, status.HTTP_201_CREATED, response.content)+class TestUserInterviewTopicEdit(_FeatureFlagEnabledMixin):+ def _topic(self, **overrides) -> UserInterviewTopic:+ defaults: dict = {+ "team": self.team,+ "created_by": self.user,+ "interviewee_emails": ["[email protected]"],+ "interviewee_distinct_ids": ["distinct-abc"],+ "topic": "Adoption",+ "agent_context": "ctx",+ "questions": ["q1"],+ }+ defaults.update(overrides)+ return UserInterviewTopic.objects.create(**defaults)++ def _detail_url(self, topic_id: str) -> str:+ return f"/api/environments/{self.team.id}/user_interview_topics/{topic_id}/"++ def _add_url(self, topic_id: str) -> str:+ return f"{self._detail_url(topic_id)}add_interviewee/"++ def _remove_url(self, topic_id: str) -> str:+ return f"{self._detail_url(topic_id)}remove_interviewee/"++ @parameterized.expand(+ [+ ("plain_email", "[email protected]", "interviewee_emails"),+ ("display_name_email", "Jordan Doe <[email protected]>", "interviewee_emails"),+ ("distinct_id", "distinct-xyz", "interviewee_distinct_ids"),+ ]+ )+ def test_add_interviewee_routes_to_correct_array(self, _name: str, identifier: str, expected_field: str):+ topic = self._topic()+ response = self.client.post(self._add_url(str(topic.id)), data={"identifier": identifier}, format="json")+ self.assertEqual(response.status_code, status.HTTP_200_OK, response.content)+ topic.refresh_from_db()+ assert identifier in getattr(topic, expected_field), (identifier, expected_field, response.json())++ def test_add_interviewee_is_idempotent(self):+ topic = self._topic(interviewee_emails=[])+ first = self.client.post(self._add_url(str(topic.id)), data={"identifier": "[email protected]"}, format="json")+ second = self.client.post(self._add_url(str(topic.id)), data={"identifier": "[email protected]"}, format="json")+ self.assertEqual(first.status_code, status.HTTP_200_OK, first.content)+ self.assertEqual(second.status_code, status.HTTP_200_OK, second.content)+ topic.refresh_from_db()+ assert topic.interviewee_emails == ["[email protected]"], topic.interviewee_emails++ def test_remove_interviewee_drops_from_both_arrays(self):+ topic = self._topic(+ interviewee_emails=["[email protected]", "[email protected]"],+ interviewee_distinct_ids=["distinct-abc"],+ )+ response = self.client.post(+ self._remove_url(str(topic.id)), data={"identifier": "[email protected]"}, format="json"+ )+ self.assertEqual(response.status_code, status.HTTP_200_OK)+ topic.refresh_from_db()+ assert topic.interviewee_emails == ["[email protected]"], topic.interviewee_emails+ assert topic.interviewee_distinct_ids == ["distinct-abc"], topic.interviewee_distinct_ids++ def test_remove_interviewee_disables_active_sharing_configurations(self):+ topic = self._topic()+ ic = IntervieweeContext.objects.create(+ team=self.team,+ topic=topic,+ interviewee_identifier="[email protected]",+ agent_context="",+ created_by=self.user,+ )+ share = SharingConfiguration.objects.create(team=self.team, interviewee_context=ic, enabled=True)+ self.client.post(self._remove_url(str(topic.id)), data={"identifier": "[email protected]"}, format="json")+ share.refresh_from_db()+ assert share.enabled is False++ def test_remove_interviewee_is_noop_for_unknown_identifier(self):+ topic = self._topic()+ response = self.client.post(+ self._remove_url(str(topic.id)), data={"identifier": "[email protected]"}, format="json"+ )+ self.assertEqual(response.status_code, status.HTTP_200_OK)+ topic.refresh_from_db()+ assert topic.interviewee_emails == ["[email protected]"], topic.interviewee_emails++ def test_partial_update_changes_topic_text(self):+ topic = self._topic()+ response = self.client.patch(self._detail_url(str(topic.id)), data={"topic": "New angle"}, format="json")+ self.assertEqual(response.status_code, status.HTTP_200_OK, response.content)+ topic.refresh_from_db()+ assert topic.topic == "New angle"++ def test_partial_update_rejects_clearing_all_targeting(self):+ topic = self._topic()+ response = self.client.patch(+ self._detail_url(str(topic.id)),+ data={"interviewee_emails": [], "interviewee_distinct_ids": []},+ format="json",+ )+ self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)++ def test_partial_update_revokes_shares_for_removed_identifiers(self):+ topic = self._topic(interviewee_emails=["[email protected]", "[email protected]"])+ ic = IntervieweeContext.objects.create(+ team=self.team,+ topic=topic,+ interviewee_identifier="[email protected]",+ agent_context="",+ created_by=self.user,+ )+ share = SharingConfiguration.objects.create(team=self.team, interviewee_context=ic, enabled=True)+ response = self.client.patch(+ self._detail_url(str(topic.id)),+ data={"interviewee_emails": ["[email protected]"]},+ format="json",+ )+ self.assertEqual(response.status_code, status.HTTP_200_OK, response.content)+ share.refresh_from_db()+ assert share.enabled is False++ def test_remove_interviewee_revokes_shares_even_when_identifier_already_absent(self):+ topic = self._topic(interviewee_emails=["[email protected]"])+ ic = IntervieweeContext.objects.create(+ team=self.team,+ topic=topic,+ interviewee_identifier="[email protected]",+ agent_context="",+ created_by=self.user,+ )+ share = SharingConfiguration.objects.create(team=self.team, interviewee_context=ic, enabled=True)+ response = self.client.post(+ self._remove_url(str(topic.id)), data={"identifier": "[email protected]"}, format="json"+ )+ self.assertEqual(response.status_code, status.HTTP_200_OK)+ share.refresh_from_db()+ assert share.enabled is False++ def test_add_interviewee_rejects_overlong_email_identifier(self):+ topic = self._topic()+ long_email = "a" * 250 + "@example.com"+ assert len(long_email) > 254+ response = self.client.post(self._add_url(str(topic.id)), data={"identifier": long_email}, format="json")+ self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)++class TestInterviewPublicViewer(APIBaseTest):def _create_share(self) -> SharingConfiguration:topic = UserInterviewTopic.objects.create(diff --git a/products/user_interviews/frontend/generated/api.schemas.ts b/products/user_interviews/frontend/generated/api.schemas.tsindex 492138770ba9..056ca89c993d 100644--- a/products/user_interviews/frontend/generated/api.schemas.ts+++ b/products/user_interviews/frontend/generated/api.schemas.ts@@ -103,6 +103,14 @@ export interface PatchedUserInterviewTopicApi {questions?: string[]}+export interface IntervieweeIdentifierRequestApi {+ /**+ * Email address or PostHog distinct ID for the interviewee. Email-shaped values (including the `Display Name <email@host>` form) are routed to `interviewee_emails`; everything else lands in `interviewee_distinct_ids`.+ * @maxLength 400+ */+ identifier: string+}+export interface InterviewLinkApi {/*** The original identifier (email or distinct ID) from the topic targeting.diff --git a/products/user_interviews/frontend/generated/api.ts b/products/user_interviews/frontend/generated/api.tsindex ba037fa26e45..a746b9ea01ff 100644--- a/products/user_interviews/frontend/generated/api.ts+++ b/products/user_interviews/frontend/generated/api.ts@@ -10,6 +10,7 @@ import { apiMutator } from '../../../../frontend/src/lib/api-orval-mutator'*/import type {IntervieweeContextApi,+ IntervieweeIdentifierRequestApi,PaginatedInterviewInviteResultListApi,PaginatedInterviewLinkListApi,PaginatedIntervieweeContextListApi,@@ -173,6 +174,27 @@ export const userInterviewTopicsDestroy = async (})}+export const getUserInterviewTopicsAddIntervieweeCreateUrl = (projectId: string, id: string) => {+ return `/api/environments/${projectId}/user_interview_topics/${id}/add_interviewee/`+}++/**+ * Add a single interviewee to this topic. Email-shaped identifiers (including the `Display Name <email@host>` form) are appended to `interviewee_emails`; everything else is appended to `interviewee_distinct_ids`. Idempotent — adding an identifier that's already present leaves the topic unchanged. Returns the updated topic.+ */+export const userInterviewTopicsAddIntervieweeCreate = async (+ projectId: string,+ id: string,+ intervieweeIdentifierRequestApi: IntervieweeIdentifierRequestApi,+ options?: RequestInit+): Promise<UserInterviewTopicApi> => {+ return apiMutator<UserInterviewTopicApi>(getUserInterviewTopicsAddIntervieweeCreateUrl(projectId, id), {+ ...options,+ method: 'POST',+ headers: { 'Content-Type': 'application/json', ...options?.headers },+ body: JSON.stringify(intervieweeIdentifierRequestApi),+ })+}+export const getUserInterviewTopicsGenerateLinksCreateUrl = (projectId: string, id: string) => {return `/api/environments/${projectId}/user_interview_topics/${id}/generate_links/`}@@ -191,6 +213,27 @@ export const userInterviewTopicsGenerateLinksCreate = async (})}+export const getUserInterviewTopicsRemoveIntervieweeCreateUrl = (projectId: string, id: string) => {+ return `/api/environments/${projectId}/user_interview_topics/${id}/remove_interviewee/`+}++/**+ * Remove an interviewee from this topic. Drops the identifier from both `interviewee_emails` and `interviewee_distinct_ids`, and disables any active SharingConfiguration linked to an IntervieweeContext for that identifier on this topic so the removed person can no longer open their interview link. Idempotent — removing an identifier that isn't present is a no-op. Returns the updated topic.+ */+export const userInterviewTopicsRemoveIntervieweeCreate = async (+ projectId: string,+ id: string,+ intervieweeIdentifierRequestApi: IntervieweeIdentifierRequestApi,+ options?: RequestInit+): Promise<UserInterviewTopicApi> => {+ return apiMutator<UserInterviewTopicApi>(getUserInterviewTopicsRemoveIntervieweeCreateUrl(projectId, id), {+ ...options,+ method: 'POST',+ headers: { 'Content-Type': 'application/json', ...options?.headers },+ body: JSON.stringify(intervieweeIdentifierRequestApi),+ })+}+export const getUserInterviewTopicsSendInvitesCreateUrl = (projectId: string, id: string) => {return `/api/environments/${projectId}/user_interview_topics/${id}/send_invites/`}diff --git a/products/user_interviews/frontend/generated/api.zod.ts b/products/user_interviews/frontend/generated/api.zod.tsindex e53969e133e5..d59c9ad91ef6 100644--- a/products/user_interviews/frontend/generated/api.zod.ts+++ b/products/user_interviews/frontend/generated/api.zod.ts@@ -90,6 +90,34 @@ export const UserInterviewTopicsPartialUpdateBody = /* @__PURE__ */ zod.object({.describe('Ordered list of questions the voice agent should work through during the interview.'),})+/**+ * Add a single interviewee to this topic. Email-shaped identifiers (including the `Display Name <email@host>` form) are appended to `interviewee_emails`; everything else is appended to `interviewee_distinct_ids`. Idempotent — adding an identifier that's already present leaves the topic unchanged. Returns the updated topic.+ */+export const userInterviewTopicsAddIntervieweeCreateBodyIdentifierMax = 400++export const UserInterviewTopicsAddIntervieweeCreateBody = /* @__PURE__ */ zod.object({+ identifier: zod+ .string()+ .max(userInterviewTopicsAddIntervieweeCreateBodyIdentifierMax)+ .describe(+ 'Email address or PostHog distinct ID for the interviewee. Email-shaped values (including the `Display Name <email@host>` form) are routed to `interviewee_emails`; everything else lands in `interviewee_distinct_ids`.'+ ),+})++/**+ * Remove an interviewee from this topic. Drops the identifier from both `interviewee_emails` and `interviewee_distinct_ids`, and disables any active SharingConfiguration linked to an IntervieweeContext for that identifier on this topic so the removed person can no longer open their interview link. Idempotent — removing an identifier that isn't present is a no-op. Returns the updated topic.+ */+export const userInterviewTopicsRemoveIntervieweeCreateBodyIdentifierMax = 400++export const UserInterviewTopicsRemoveIntervieweeCreateBody = /* @__PURE__ */ zod.object({+ identifier: zod+ .string()+ .max(userInterviewTopicsRemoveIntervieweeCreateBodyIdentifierMax)+ .describe(+ 'Email address or PostHog distinct ID for the interviewee. Email-shaped values (including the `Display Name <email@host>` form) are routed to `interviewee_emails`; everything else lands in `interviewee_distinct_ids`.'+ ),+})+/*** Generate (if needed) and email a personalized public interview link to every targeted interviewee on this topic whose identifier is an email address. Distinct-ID-only interviewees are skipped and surfaced in the response. Each invite is keyed on the underlying SharingConfiguration so re-runs after token rotation produce a fresh send.*/diff --git a/products/user_interviews/mcp/tools.yaml b/products/user_interviews/mcp/tools.yamlindex 2629f96c6b17..e2bdb4bded70 100644--- a/products/user_interviews/mcp/tools.yaml+++ b/products/user_interviews/mcp/tools.yaml@@ -9,6 +9,24 @@ feature: user_interviewsurl_prefix: /user_interviewsui_apps: {}tools:+ user-interview-topics-add-interviewee:+ operation: user_interview_topics_add_interviewee_create+ enabled: true+ scopes:+ - user_interview:write+ annotations:+ readOnly: false+ destructive: false+ idempotent: true+ title: Add an interviewee to a topic+ description: >+ Append a single interviewee identifier to a user interview topic. Email-shaped identifiers (including the+ `Display Name <email@host>` form) go to `interviewee_emails`; everything else goes to+ `interviewee_distinct_ids`. Idempotent — adding an identifier that is already present leaves the topic+ unchanged. Returns the updated topic.+ include_params:+ - identifier+ feature_flag: user-interviewsuser-interview-topics-create:operation: user_interview_topics_createenabled: true@@ -77,7 +95,20 @@ tools:feature_flag: user-interviewsuser-interview-topics-interviewees-destroy:operation: user_interview_topics_interviewees_destroy- enabled: false+ enabled: true+ scopes:+ - user_interview:write+ annotations:+ readOnly: false+ destructive: true+ idempotent: true+ title: Delete a per-interviewee context row+ description: >+ Remove the extra context attached to a single interviewee on a user interview topic. Only deletes the+ `IntervieweeContext` row — does not change the topic's targeting (`interviewee_emails` /+ `interviewee_distinct_ids`). Use `user-interview-topics-remove-interviewee` if you want to drop the+ interviewee from targeting as well.+ feature_flag: user-interviewsuser-interview-topics-interviewees-list:operation: user_interview_topics_interviewees_listenabled: true@@ -95,7 +126,21 @@ tools:feature_flag: user-interviewsuser-interview-topics-interviewees-partial-update:operation: user_interview_topics_interviewees_partial_update- enabled: false+ enabled: true+ scopes:+ - user_interview:write+ annotations:+ readOnly: false+ destructive: false+ idempotent: true+ title: Update a per-interviewee context row+ description: >+ Update the `agent_context` field on a per-interviewee context row. Pass only the fields you want to change.+ Does not modify the topic's targeting; use `user-interview-topics-add-interviewee` /+ `user-interview-topics-remove-interviewee` for that.+ include_params:+ - agent_context+ feature_flag: user-interviewsuser-interview-topics-interviewees-retrieve:operation: user_interview_topics_interviewees_retrieveenabled: false@@ -120,10 +165,58 @@ tools:feature_flag: user-interviewsuser-interview-topics-partial-update:operation: user_interview_topics_partial_update- enabled: false+ enabled: true+ scopes:+ - user_interview:write+ annotations:+ readOnly: false+ destructive: false+ idempotent: true+ title: Update a user interview topic+ description: >+ Update fields on a user interview topic. Pass only the fields you want to change. For incremental edits to+ targeting, prefer `user-interview-topics-add-interviewee` and `user-interview-topics-remove-interviewee` —+ sending `interviewee_emails` or `interviewee_distinct_ids` here replaces the entire array.+ include_params:+ - topic+ - agent_context+ - questions+ - interviewee_emails+ - interviewee_distinct_ids+ feature_flag: user-interviews+ user-interview-topics-remove-interviewee:+ operation: user_interview_topics_remove_interviewee_create+ enabled: true+ scopes:+ - user_interview:write+ annotations:+ readOnly: false+ destructive: true+ idempotent: true+ title: Remove an interviewee from a topic+ description: >+ Remove an interviewee identifier from a topic's targeting. Drops the identifier from both+ `interviewee_emails` and `interviewee_distinct_ids`, and disables any active SharingConfiguration tied to+ that interviewee on this topic so the removed person can no longer open their interview link. Idempotent —+ removing an identifier that isn't present is a no-op. Returns the updated topic.+ include_params:+ - identifier+ feature_flag: user-interviewsuser-interview-topics-retrieve:operation: user_interview_topics_retrieve- enabled: false+ enabled: true+ scopes:+ - user_interview:read+ annotations:+ readOnly: true+ destructive: false+ idempotent: true+ title: Get user interview topic+ description: >+ Retrieve a single user interview topic by ID, including its full targeting (`interviewee_emails`,+ `interviewee_distinct_ids`), voice agent setup (`agent_context`, `questions`), and metadata. Use this to+ list the current interviewees on a topic before adding, editing, or removing them.+ feature_flag: user-interviewsuser-interview-topics-send-invites:operation: user_interview_topics_send_invites_createenabled: truediff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex 7f43d4fb83c5..5cc75c591535 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -4742,6 +4742,22 @@"readOnlyHint": false}},+ "user-interview-topics-add-interviewee": {+ "description": "Append a single interviewee identifier to a user interview topic. Email-shaped identifiers (including the `Display Name <email@host>` form) go to `interviewee_emails`; everything else goes to `interviewee_distinct_ids`. Idempotent — adding an identifier that is already present leaves the topic unchanged. Returns the updated topic.",+ "category": "User interview topics",+ "feature": "user_interviews",+ "summary": "Add an interviewee to a topic",+ "title": "Add an interviewee to a topic",+ "required_scopes": ["user_interview:write"],+ "new_mcp": true,+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "user-interviews"+ },"user-interview-topics-create": {"description": "Plan a user interview by recording who you want to target and what product or idea you want to ask them about. `topic` is the free-text description of the question or product area. Targets are specified as a combination of `interviewee_emails` (list of email addresses) and `interviewee_distinct_ids` (list of PostHog distinct IDs) — at least one of the two must be provided. To target a cohort, resolve cohort members to emails/distinct_ids in the calling agent first (see the planning-user-interviews skill) and pass them explicitly here — topics snapshot their audience at creation time. Pass `agent_context` (free text) to give the voice agent extra background or instructions, and `questions` (list of strings) for the ordered set of questions the agent should work through.","category": "User interview topics",@@ -4790,6 +4806,22 @@},"feature_flag": "user-interviews"},+ "user-interview-topics-interviewees-destroy": {+ "description": "Remove the extra context attached to a single interviewee on a user interview topic. Only deletes the `IntervieweeContext` row — does not change the topic's targeting (`interviewee_emails` / `interviewee_distinct_ids`). Use `user-interview-topics-remove-interviewee` if you want to drop the interviewee from targeting as well.",+ "category": "User interview topics",+ "feature": "user_interviews",+ "summary": "Delete a per-interviewee context row",+ "title": "Delete a per-interviewee context row",+ "required_scopes": ["user_interview:write"],+ "new_mcp": true,+ "annotations": {+ "destructiveHint": true,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "user-interviews"+ },"user-interview-topics-interviewees-list": {"description": "List the per-interviewee context rows attached to a single user interview topic. Each row is (interviewee_identifier, agent_context). Use this to see who has extra context attached before adding more.","category": "User interview topics",@@ -4806,6 +4838,22 @@},"feature_flag": "user-interviews"},+ "user-interview-topics-interviewees-partial-update": {+ "description": "Update the `agent_context` field on a per-interviewee context row. Pass only the fields you want to change. Does not modify the topic's targeting; use `user-interview-topics-add-interviewee` / `user-interview-topics-remove-interviewee` for that.",+ "category": "User interview topics",+ "feature": "user_interviews",+ "summary": "Update a per-interviewee context row",+ "title": "Update a per-interviewee context row",+ "required_scopes": ["user_interview:write"],+ "new_mcp": true,+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "user-interviews"+ },"user-interview-topics-list": {"description": "List planned user interview topics in the current project, newest first. Each result includes the topic, targeting (interviewee_emails, interviewee_distinct_ids), and the voice agent setup (agent_context, questions). Supports `search` for substring match against the topic, and `limit`/`offset` for pagination.","category": "User interview topics",@@ -4822,6 +4870,54 @@},"feature_flag": "user-interviews"},+ "user-interview-topics-partial-update": {+ "description": "Update fields on a user interview topic. Pass only the fields you want to change. For incremental edits to targeting, prefer `user-interview-topics-add-interviewee` and `user-interview-topics-remove-interviewee` — sending `interviewee_emails` or `interviewee_distinct_ids` here replaces the entire array.",+ "category": "User interview topics",+ "feature": "user_interviews",+ "summary": "Update a user interview topic",+ "title": "Update a user interview topic",+ "required_scopes": ["user_interview:write"],+ "new_mcp": true,+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "user-interviews"+ },+ "user-interview-topics-remove-interviewee": {+ "description": "Remove an interviewee identifier from a topic's targeting. Drops the identifier from both `interviewee_emails` and `interviewee_distinct_ids`, and disables any active SharingConfiguration tied to that interviewee on this topic so the removed person can no longer open their interview link. Idempotent — removing an identifier that isn't present is a no-op. Returns the updated topic.",+ "category": "User interview topics",+ "feature": "user_interviews",+ "summary": "Remove an interviewee from a topic",+ "title": "Remove an interviewee from a topic",+ "required_scopes": ["user_interview:write"],+ "new_mcp": true,+ "annotations": {+ "destructiveHint": true,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "user-interviews"+ },+ "user-interview-topics-retrieve": {+ "description": "Retrieve a single user interview topic by ID, including its full targeting (`interviewee_emails`, `interviewee_distinct_ids`), voice agent setup (`agent_context`, `questions`), and metadata. Use this to list the current interviewees on a topic before adding, editing, or removing them.",+ "category": "User interview topics",+ "feature": "user_interviews",+ "summary": "Get user interview topic",+ "title": "Get user interview topic",+ "required_scopes": ["user_interview:read"],+ "new_mcp": true,+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ },+ "feature_flag": "user-interviews"+ },"user-interview-topics-send-invites": {"description": "Generate (if not yet created) and email a personalized public interview link to every targeted interviewee on a user interview topic whose identifier is an email address. The email includes a friendly greeting and a button linking to the public voice-interview page. Distinct-ID-only interviewees are skipped and surfaced in the response. Use this once a topic is finalized; safe to call repeatedly — invites are deduplicated per share via the messaging system's idempotency record, and a token rotation produces a fresh send key.","category": "User interview topics",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex 31325ca0b9a5..d222660e9a92 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -5223,6 +5223,22 @@"readOnlyHint": false}},+ "user-interview-topics-add-interviewee": {+ "description": "Append a single interviewee identifier to a user interview topic. Email-shaped identifiers (including the `Display Name <email@host>` form) go to `interviewee_emails`; everything else goes to `interviewee_distinct_ids`. Idempotent — adding an identifier that is already present leaves the topic unchanged. Returns the updated topic.",+ "category": "User interview topics",+ "feature": "user_interviews",+ "summary": "Add an interviewee to a topic",+ "title": "Add an interviewee to a topic",+ "required_scopes": ["user_interview:write"],+ "new_mcp": true,+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "user-interviews"+ },"user-interview-topics-create": {"description": "Plan a user interview by recording who you want to target and what product or idea you want to ask them about. `topic` is the free-text description of the question or product area. Targets are specified as a combination of `interviewee_emails` (list of email addresses) and `interviewee_distinct_ids` (list of PostHog distinct IDs) — at least one of the two must be provided. To target a cohort, resolve cohort members to emails/distinct_ids in the calling agent first (see the planning-user-interviews skill) and pass them explicitly here — topics snapshot their audience at creation time. Pass `agent_context` (free text) to give the voice agent extra background or instructions, and `questions` (list of strings) for the ordered set of questions the agent should work through.","category": "User interview topics",@@ -5271,6 +5287,22 @@},"feature_flag": "user-interviews"},+ "user-interview-topics-interviewees-destroy": {+ "description": "Remove the extra context attached to a single interviewee on a user interview topic. Only deletes the `IntervieweeContext` row — does not change the topic's targeting (`interviewee_emails` / `interviewee_distinct_ids`). Use `user-interview-topics-remove-interviewee` if you want to drop the interviewee from targeting as well.",+ "category": "User interview topics",+ "feature": "user_interviews",+ "summary": "Delete a per-interviewee context row",+ "title": "Delete a per-interviewee context row",+ "required_scopes": ["user_interview:write"],+ "new_mcp": true,+ "annotations": {+ "destructiveHint": true,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "user-interviews"+ },"user-interview-topics-interviewees-list": {"description": "List the per-interviewee context rows attached to a single user interview topic. Each row is (interviewee_identifier, agent_context). Use this to see who has extra context attached before adding more.","category": "User interview topics",@@ -5287,6 +5319,22 @@},"feature_flag": "user-interviews"},+ "user-interview-topics-interviewees-partial-update": {+ "description": "Update the `agent_context` field on a per-interviewee context row. Pass only the fields you want to change. Does not modify the topic's targeting; use `user-interview-topics-add-interviewee` / `user-interview-topics-remove-interviewee` for that.",+ "category": "User interview topics",+ "feature": "user_interviews",+ "summary": "Update a per-interviewee context row",+ "title": "Update a per-interviewee context row",+ "required_scopes": ["user_interview:write"],+ "new_mcp": true,+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "user-interviews"+ },"user-interview-topics-list": {"description": "List planned user interview topics in the current project, newest first. Each result includes the topic, targeting (interviewee_emails, interviewee_distinct_ids), and the voice agent setup (agent_context, questions). Supports `search` for substring match against the topic, and `limit`/`offset` for pagination.","category": "User interview topics",@@ -5303,6 +5351,54 @@},"feature_flag": "user-interviews"},+ "user-interview-topics-partial-update": {+ "description": "Update fields on a user interview topic. Pass only the fields you want to change. For incremental edits to targeting, prefer `user-interview-topics-add-interviewee` and `user-interview-topics-remove-interviewee` — sending `interviewee_emails` or `interviewee_distinct_ids` here replaces the entire array.",+ "category": "User interview topics",+ "feature": "user_interviews",+ "summary": "Update a user interview topic",+ "title": "Update a user interview topic",+ "required_scopes": ["user_interview:write"],+ "new_mcp": true,+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "user-interviews"+ },+ "user-interview-topics-remove-interviewee": {+ "description": "Remove an interviewee identifier from a topic's targeting. Drops the identifier from both `interviewee_emails` and `interviewee_distinct_ids`, and disables any active SharingConfiguration tied to that interviewee on this topic so the removed person can no longer open their interview link. Idempotent — removing an identifier that isn't present is a no-op. Returns the updated topic.",+ "category": "User interview topics",+ "feature": "user_interviews",+ "summary": "Remove an interviewee from a topic",+ "title": "Remove an interviewee from a topic",+ "required_scopes": ["user_interview:write"],+ "new_mcp": true,+ "annotations": {+ "destructiveHint": true,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "user-interviews"+ },+ "user-interview-topics-retrieve": {+ "description": "Retrieve a single user interview topic by ID, including its full targeting (`interviewee_emails`, `interviewee_distinct_ids`), voice agent setup (`agent_context`, `questions`), and metadata. Use this to list the current interviewees on a topic before adding, editing, or removing them.",+ "category": "User interview topics",+ "feature": "user_interviews",+ "summary": "Get user interview topic",+ "title": "Get user interview topic",+ "required_scopes": ["user_interview:read"],+ "new_mcp": true,+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ },+ "feature_flag": "user-interviews"+ },"user-interview-topics-send-invites": {"description": "Generate (if not yet created) and email a personalized public interview link to every targeted interviewee on a user interview topic whose identifier is an email address. The email includes a friendly greeting and a button linking to the public voice-interview page. Distinct-ID-only interviewees are skipped and surfaced in the response. Use this once a topic is finalized; safe to call repeatedly — invites are deduplicated per share via the messaging system's idempotency record, and a token rotation produces a fresh send key.","category": "User interview topics",diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex b275139b459a..c461875313ab 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -19158,6 +19158,14 @@ export namespace Schemas {agent_context: string;}+ export interface IntervieweeIdentifierRequest {+ /**+ * Email address or PostHog distinct ID for the interviewee. Email-shaped values (including the `Display Name <email@host>` form) are routed to `interviewee_emails`; everything else lands in `interviewee_distinct_ids`.+ * @maxLength 400+ */+ identifier: string;+ }+/*** * `2.0` - 2.0*/diff --git a/services/mcp/src/generated/user_interviews/api.ts b/services/mcp/src/generated/user_interviews/api.tsindex a07c6b99e192..1c4f5caf9377 100644--- a/services/mcp/src/generated/user_interviews/api.ts+++ b/services/mcp/src/generated/user_interviews/api.ts@@ -3,7 +3,7 @@* MCP service uses these Zod schemas for generated tool handlers.* To regenerate: hogli build:openapi*- * PostHog API - MCP 9 enabled ops+ * PostHog API - MCP 15 enabled ops* OpenAPI spec version: 1.0.0*/import * as zod from 'zod'@@ -60,6 +60,77 @@ export const UserInterviewTopicsCreateBody = /* @__PURE__ */ zod.object({.describe('Ordered list of questions the voice agent should work through during the interview.'),})+/**+ * Planned user interview topics: who we want to target and what we want to ask about.+ */+export const UserInterviewTopicsRetrieveParams = /* @__PURE__ */ zod.object({+ id: zod.string().describe('A UUID string identifying this user interview topic.'),+ 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/."+ ),+})++/**+ * Planned user interview topics: who we want to target and what we want to ask about.+ */+export const UserInterviewTopicsPartialUpdateParams = /* @__PURE__ */ zod.object({+ id: zod.string().describe('A UUID string identifying this user interview topic.'),+ 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 userInterviewTopicsPartialUpdateBodyIntervieweeEmailsItemMax = 254++export const userInterviewTopicsPartialUpdateBodyIntervieweeDistinctIdsItemMax = 400++export const UserInterviewTopicsPartialUpdateBody = /* @__PURE__ */ zod.object({+ interviewee_emails: zod+ .array(zod.string().max(userInterviewTopicsPartialUpdateBodyIntervieweeEmailsItemMax))+ .optional()+ .describe('Email addresses of people to interview. May be combined with interviewee_distinct_ids.'),+ interviewee_distinct_ids: zod+ .array(zod.string().max(userInterviewTopicsPartialUpdateBodyIntervieweeDistinctIdsItemMax))+ .optional()+ .describe('PostHog distinct IDs of people to interview. May be combined with interviewee_emails.'),+ topic: zod.string().optional().describe('The product, feature, or idea you want to ask interviewees about.'),+ agent_context: zod+ .string()+ .optional()+ .describe('Optional additional system prompt for the voice agent — extra background, tone, or constraints.'),+ questions: zod+ .array(zod.string())+ .optional()+ .describe('Ordered list of questions the voice agent should work through during the interview.'),+})++/**+ * Add a single interviewee to this topic. Email-shaped identifiers (including the `Display Name <email@host>` form) are appended to `interviewee_emails`; everything else is appended to `interviewee_distinct_ids`. Idempotent — adding an identifier that's already present leaves the topic unchanged. Returns the updated topic.+ */+export const UserInterviewTopicsAddIntervieweeCreateParams = /* @__PURE__ */ zod.object({+ id: zod.string().describe('A UUID string identifying this user interview topic.'),+ 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 userInterviewTopicsAddIntervieweeCreateBodyIdentifierMax = 400++export const UserInterviewTopicsAddIntervieweeCreateBody = /* @__PURE__ */ zod.object({+ identifier: zod+ .string()+ .max(userInterviewTopicsAddIntervieweeCreateBodyIdentifierMax)+ .describe(+ 'Email address or PostHog distinct ID for the interviewee. Email-shaped values (including the `Display Name <email@host>` form) are routed to `interviewee_emails`; everything else lands in `interviewee_distinct_ids`.'+ ),+})+/*** Generate one public interview link per targeted interviewee. Materializes an IntervieweeContext row for every identifier on the topic (without overwriting existing per-person context), and an enabled SharingConfiguration with a unique access token. The URL resolves to the public interview viewer with no PostHog auth required.*/@@ -72,6 +143,29 @@ export const UserInterviewTopicsGenerateLinksCreateParams = /* @__PURE__ */ zod.),})+/**+ * Remove an interviewee from this topic. Drops the identifier from both `interviewee_emails` and `interviewee_distinct_ids`, and disables any active SharingConfiguration linked to an IntervieweeContext for that identifier on this topic so the removed person can no longer open their interview link. Idempotent — removing an identifier that isn't present is a no-op. Returns the updated topic.+ */+export const UserInterviewTopicsRemoveIntervieweeCreateParams = /* @__PURE__ */ zod.object({+ id: zod.string().describe('A UUID string identifying this user interview topic.'),+ 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 userInterviewTopicsRemoveIntervieweeCreateBodyIdentifierMax = 400++export const UserInterviewTopicsRemoveIntervieweeCreateBody = /* @__PURE__ */ zod.object({+ identifier: zod+ .string()+ .max(userInterviewTopicsRemoveIntervieweeCreateBodyIdentifierMax)+ .describe(+ 'Email address or PostHog distinct ID for the interviewee. Email-shaped values (including the `Display Name <email@host>` form) are routed to `interviewee_emails`; everything else lands in `interviewee_distinct_ids`.'+ ),+})+/*** Generate (if needed) and email a personalized public interview link to every targeted interviewee on this topic whose identifier is an email address. Distinct-ID-only interviewees are skipped and surfaced in the response. Each invite is keyed on the underlying SharingConfiguration so re-runs after token rotation produce a fresh send.*/@@ -154,6 +248,53 @@ export const UserInterviewTopicsIntervieweesCreateBody = /* @__PURE__ */ zod.obj),})+/**+ * Per-interviewee extra context for a user interview topic. At most one row per (topic, interviewee_identifier).+ */+export const UserInterviewTopicsIntervieweesPartialUpdateParams = /* @__PURE__ */ zod.object({+ id: zod.string().describe('A UUID string identifying this interviewee context.'),+ 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/."+ ),+ topic_id: zod.string(),+})++export const userInterviewTopicsIntervieweesPartialUpdateBodyIntervieweeIdentifierMax = 400++export const userInterviewTopicsIntervieweesPartialUpdateBodyAgentContextMax = 10000++export const UserInterviewTopicsIntervieweesPartialUpdateBody = /* @__PURE__ */ zod.object({+ interviewee_identifier: zod+ .string()+ .max(userInterviewTopicsIntervieweesPartialUpdateBodyIntervieweeIdentifierMax)+ .optional()+ .describe(+ "Identifier for the interviewee — typically an email address or PostHog distinct ID. Must match a value in the parent topic's interviewee_emails or interviewee_distinct_ids."+ ),+ agent_context: zod+ .string()+ .max(userInterviewTopicsIntervieweesPartialUpdateBodyAgentContextMax)+ .optional()+ .describe(+ "Extra context the voice agent should know about this specific interviewee — e.g. 'uses the replay product but has never used summarization'."+ ),+})++/**+ * Per-interviewee extra context for a user interview topic. At most one row per (topic, interviewee_identifier).+ */+export const UserInterviewTopicsIntervieweesDestroyParams = /* @__PURE__ */ zod.object({+ id: zod.string().describe('A UUID string identifying this interviewee context.'),+ 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/."+ ),+ topic_id: zod.string(),+})+export const UserInterviewsListParams = /* @__PURE__ */ zod.object({project_id: zod.string()diff --git a/services/mcp/src/tools/generated/user_interviews.ts b/services/mcp/src/tools/generated/user_interviews.tsindex f067bf38f693..742dac171290 100644--- a/services/mcp/src/tools/generated/user_interviews.ts+++ b/services/mcp/src/tools/generated/user_interviews.ts@@ -3,13 +3,23 @@ import { z } from 'zod'import type { Schemas } from '@/api/generated'import {+ UserInterviewTopicsAddIntervieweeCreateBody,+ UserInterviewTopicsAddIntervieweeCreateParams,UserInterviewTopicsCreateBody,UserInterviewTopicsGenerateLinksCreateParams,UserInterviewTopicsIntervieweesCreateBody,UserInterviewTopicsIntervieweesCreateParams,+ UserInterviewTopicsIntervieweesDestroyParams,UserInterviewTopicsIntervieweesListParams,UserInterviewTopicsIntervieweesListQueryParams,+ UserInterviewTopicsIntervieweesPartialUpdateBody,+ UserInterviewTopicsIntervieweesPartialUpdateParams,UserInterviewTopicsListQueryParams,+ UserInterviewTopicsPartialUpdateBody,+ UserInterviewTopicsPartialUpdateParams,+ UserInterviewTopicsRemoveIntervieweeCreateBody,+ UserInterviewTopicsRemoveIntervieweeCreateParams,+ UserInterviewTopicsRetrieveParams,UserInterviewTopicsSendInvitesCreateBody,UserInterviewTopicsSendInvitesCreateParams,UserInterviewsListQueryParams,@@ -19,6 +29,31 @@ import {import { withPostHogUrl, type WithPostHogUrl } from '@/tools/tool-utils'import type { Context, ToolBase, ZodObjectAny } from '@/tools/types'+const UserInterviewTopicsAddIntervieweeSchema = UserInterviewTopicsAddIntervieweeCreateParams.omit({+ project_id: true,+}).extend(UserInterviewTopicsAddIntervieweeCreateBody.shape)++const userInterviewTopicsAddInterviewee = (): ToolBase<+ typeof UserInterviewTopicsAddIntervieweeSchema,+ Schemas.UserInterviewTopic+> => ({+ name: 'user-interview-topics-add-interviewee',+ schema: UserInterviewTopicsAddIntervieweeSchema,+ handler: async (context: Context, params: z.infer<typeof UserInterviewTopicsAddIntervieweeSchema>) => {+ const projectId = await context.stateManager.getProjectId()+ const body: Record<string, unknown> = {}+ if (params.identifier !== undefined) {+ body['identifier'] = params.identifier+ }+ const result = await context.api.request<Schemas.UserInterviewTopic>({+ method: 'POST',+ path: `/api/environments/${encodeURIComponent(String(projectId))}/user_interview_topics/${encodeURIComponent(String(params.id))}/add_interviewee/`,+ body,+ })+ return result+ },+})+const UserInterviewTopicsCreateSchema = UserInterviewTopicsCreateBodyconst userInterviewTopicsCreate = (): ToolBase<typeof UserInterviewTopicsCreateSchema, Schemas.UserInterviewTopic> => ({@@ -97,6 +132,26 @@ const userInterviewTopicsIntervieweesCreate = (): ToolBase<},})+const UserInterviewTopicsIntervieweesDestroySchema = UserInterviewTopicsIntervieweesDestroyParams.omit({+ project_id: true,+})++const userInterviewTopicsIntervieweesDestroy = (): ToolBase<+ typeof UserInterviewTopicsIntervieweesDestroySchema,+ unknown+> => ({+ name: 'user-interview-topics-interviewees-destroy',+ schema: UserInterviewTopicsIntervieweesDestroySchema,+ handler: async (context: Context, params: z.infer<typeof UserInterviewTopicsIntervieweesDestroySchema>) => {+ const projectId = await context.stateManager.getProjectId()+ const result = await context.api.request<unknown>({+ method: 'DELETE',+ path: `/api/environments/${encodeURIComponent(String(projectId))}/user_interview_topics/${encodeURIComponent(String(params.topic_id))}/interviewees/${encodeURIComponent(String(params.id))}/`,+ })+ return result+ },+})+const UserInterviewTopicsIntervieweesListSchema = UserInterviewTopicsIntervieweesListParams.omit({project_id: true,}).extend(UserInterviewTopicsIntervieweesListQueryParams.shape)@@ -121,6 +176,31 @@ const userInterviewTopicsIntervieweesList = (): ToolBase<},})+const UserInterviewTopicsIntervieweesPartialUpdateSchema = UserInterviewTopicsIntervieweesPartialUpdateParams.omit({+ project_id: true,+}).extend(UserInterviewTopicsIntervieweesPartialUpdateBody.omit({ interviewee_identifier: true }).shape)++const userInterviewTopicsIntervieweesPartialUpdate = (): ToolBase<+ typeof UserInterviewTopicsIntervieweesPartialUpdateSchema,+ Schemas.IntervieweeContext+> => ({+ name: 'user-interview-topics-interviewees-partial-update',+ schema: UserInterviewTopicsIntervieweesPartialUpdateSchema,+ handler: async (context: Context, params: z.infer<typeof UserInterviewTopicsIntervieweesPartialUpdateSchema>) => {+ const projectId = await context.stateManager.getProjectId()+ const body: Record<string, unknown> = {}+ if (params.agent_context !== undefined) {+ body['agent_context'] = params.agent_context+ }+ const result = await context.api.request<Schemas.IntervieweeContext>({+ method: 'PATCH',+ path: `/api/environments/${encodeURIComponent(String(projectId))}/user_interview_topics/${encodeURIComponent(String(params.topic_id))}/interviewees/${encodeURIComponent(String(params.id))}/`,+ body,+ })+ return result+ },+})+const UserInterviewTopicsListSchema = UserInterviewTopicsListQueryParamsconst userInterviewTopicsList = (): ToolBase<@@ -144,6 +224,86 @@ const userInterviewTopicsList = (): ToolBase<},})+const UserInterviewTopicsPartialUpdateSchema = UserInterviewTopicsPartialUpdateParams.omit({ project_id: true }).extend(+ UserInterviewTopicsPartialUpdateBody.shape+)++const userInterviewTopicsPartialUpdate = (): ToolBase<+ typeof UserInterviewTopicsPartialUpdateSchema,+ Schemas.UserInterviewTopic+> => ({+ name: 'user-interview-topics-partial-update',+ schema: UserInterviewTopicsPartialUpdateSchema,+ handler: async (context: Context, params: z.infer<typeof UserInterviewTopicsPartialUpdateSchema>) => {+ const projectId = await context.stateManager.getProjectId()+ const body: Record<string, unknown> = {}+ if (params.interviewee_emails !== undefined) {+ body['interviewee_emails'] = params.interviewee_emails+ }+ if (params.interviewee_distinct_ids !== undefined) {+ body['interviewee_distinct_ids'] = params.interviewee_distinct_ids+ }+ if (params.topic !== undefined) {+ body['topic'] = params.topic+ }+ if (params.agent_context !== undefined) {+ body['agent_context'] = params.agent_context+ }+ if (params.questions !== undefined) {+ body['questions'] = params.questions+ }+ const result = await context.api.request<Schemas.UserInterviewTopic>({+ method: 'PATCH',+ path: `/api/environments/${encodeURIComponent(String(projectId))}/user_interview_topics/${encodeURIComponent(String(params.id))}/`,+ body,+ })+ return result+ },+})++const UserInterviewTopicsRemoveIntervieweeSchema = UserInterviewTopicsRemoveIntervieweeCreateParams.omit({+ project_id: true,+}).extend(UserInterviewTopicsRemoveIntervieweeCreateBody.shape)++const userInterviewTopicsRemoveInterviewee = (): ToolBase<+ typeof UserInterviewTopicsRemoveIntervieweeSchema,+ Schemas.UserInterviewTopic+> => ({+ name: 'user-interview-topics-remove-interviewee',+ schema: UserInterviewTopicsRemoveIntervieweeSchema,+ handler: async (context: Context, params: z.infer<typeof UserInterviewTopicsRemoveIntervieweeSchema>) => {+ const projectId = await context.stateManager.getProjectId()+ const body: Record<string, unknown> = {}+ if (params.identifier !== undefined) {+ body['identifier'] = params.identifier+ }+ const result = await context.api.request<Schemas.UserInterviewTopic>({+ method: 'POST',+ path: `/api/environments/${encodeURIComponent(String(projectId))}/user_interview_topics/${encodeURIComponent(String(params.id))}/remove_interviewee/`,+ body,+ })+ return result+ },+})++const UserInterviewTopicsRetrieveSchema = UserInterviewTopicsRetrieveParams.omit({ project_id: true })++const userInterviewTopicsRetrieve = (): ToolBase<+ typeof UserInterviewTopicsRetrieveSchema,+ Schemas.UserInterviewTopic+> => ({+ name: 'user-interview-topics-retrieve',+ schema: UserInterviewTopicsRetrieveSchema,+ handler: async (context: Context, params: z.infer<typeof UserInterviewTopicsRetrieveSchema>) => {+ const projectId = await context.stateManager.getProjectId()+ const result = await context.api.request<Schemas.UserInterviewTopic>({+ method: 'GET',+ path: `/api/environments/${encodeURIComponent(String(projectId))}/user_interview_topics/${encodeURIComponent(String(params.id))}/`,+ })+ return result+ },+})+const UserInterviewTopicsSendInvitesSchema = UserInterviewTopicsSendInvitesCreateParams.omit({project_id: true,}).extend(UserInterviewTopicsSendInvitesCreateBody.shape)@@ -243,11 +403,17 @@ const userInterviewsSearch = (): ToolBase<typeof UserInterviewsSearchSchema, Sch})export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {+ 'user-interview-topics-add-interviewee': userInterviewTopicsAddInterviewee,'user-interview-topics-create': userInterviewTopicsCreate,'user-interview-topics-generate-links': userInterviewTopicsGenerateLinks,'user-interview-topics-interviewees-create': userInterviewTopicsIntervieweesCreate,+ 'user-interview-topics-interviewees-destroy': userInterviewTopicsIntervieweesDestroy,'user-interview-topics-interviewees-list': userInterviewTopicsIntervieweesList,+ 'user-interview-topics-interviewees-partial-update': userInterviewTopicsIntervieweesPartialUpdate,'user-interview-topics-list': userInterviewTopicsList,+ 'user-interview-topics-partial-update': userInterviewTopicsPartialUpdate,+ 'user-interview-topics-remove-interviewee': userInterviewTopicsRemoveInterviewee,+ 'user-interview-topics-retrieve': userInterviewTopicsRetrieve,'user-interview-topics-send-invites': userInterviewTopicsSendInvites,'user-interviews-list': userInterviewsList,'user-interviews-retrieve': userInterviewsRetrieve,