: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(signals): persist per-scout mcp tool grants (#108530)
posthog[bot]1e2574d78b9e
diff --git a/docs/published/handbook/engineering/ai/sandboxed-agents.md b/docs/published/handbook/engineering/ai/sandboxed-agents.mdindex 91b8f7a8ee4d..2ce8b047b0d7 100644--- a/docs/published/handbook/engineering/ai/sandboxed-agents.md+++ b/docs/published/handbook/engineering/ai/sandboxed-agents.md@@ -216,6 +216,24 @@ See `posthog/temporal/oauth.py` for the full list.> **Principle of least privilege**: default to `"read_only"` unless your agent genuinely needs to create or modify resources.> This limits blast radius if the agent misbehaves.+### Scout tool selections++Scout configs can store an exact `allowed_mcp_tools` list beside their scope grants.+`null` preserves unrestricted tool selection within the scout's scopes; `[]` selects no additional tools.+The `read_only` and `support_notes` tool presets expand into a snapshot when saved, so later preset changes do not change existing grants.+A preset containing a non-holdable tool is rejected, as is an explicit selection containing unknown, superseded, non-holdable, or built-in run-context tools.++For an explicit list, the API derives `write_scopes` from selected write tools and refuses direct scope edits.+Adding a write tool requires the scout's acting user or a project admin, and a credential carrying its required scopes, even if the scout already holds those scopes.+Removing tools or narrowing an unrestricted selection without adding scopes needs ordinary scout configuration access.+Clearing the list restores unrestricted tool selection and requires grant authorization; it preserves the last derived scopes, which can then be edited separately.+Sandbox-bound tokens cannot change either tool-selection field.+Both fields and their initial values are activity-logged.++The write path is gated by `scouts-tool-access` and fails closed when the flag is absent or unavailable.+Keep the flag disabled until tool enforcement ships: storing a list alone does not restrict tools at runtime.+The tool picker and runtime enforcement are separate changes.+### Activity attributionA sandboxed agent authenticates as a person, so the activity log names that person as the actor.diff --git a/posthog/models/activity_logging/activity_log.py b/posthog/models/activity_logging/activity_log.pyindex f563c8cbd18d..7827ab8eb85a 100644--- a/posthog/models/activity_logging/activity_log.py+++ b/posthog/models/activity_logging/activity_log.py@@ -474,6 +474,8 @@ field_name_overrides: dict[AuditableScope, dict[str, str]] = {"managed_by": "managed by","auto_pause_exempt": "never pause for inactivity","write_scopes": "write access",+ "allowed_mcp_tools": "allowed MCP tools",+ "tool_preset": "tool preset",},# Match the labels the inbox settings show, so an entry reads the way the setting was flipped."SignalTeamConfig": {diff --git a/products/conversations/mcp/tools.yaml b/products/conversations/mcp/tools.yamlindex b7fa663e9e95..cd05128fbf2c 100644--- a/products/conversations/mcp/tools.yaml+++ b/products/conversations/mcp/tools.yaml@@ -63,8 +63,7 @@ tools:set to true. Never describe an internal_note or an ai_draft as sent to the customer.conversations-tickets-notes-create:operation: conversations_tickets_notes_create- enabled: false- disabled_reason: Enable in a follow-up after the notes route deploys, so clients never call a missing route+ enabled: truescopes:- ticket:writeannotations:@@ -78,6 +77,7 @@ tools:reply to the customer, use conversations-tickets-reply-create instead. To change a note later, useconversations-tickets-notes-partial-update. An identical note posted again within a short window returns theoriginal note instead of adding a second one. Returns the note as it appears in the thread.+ feature_flag: scouts-tool-accessconversations-tickets-notes-destroy:operation: conversations_tickets_notes_destroyenabled: truediff --git a/products/replay_vision/frontend/generated/api.schemas.ts b/products/replay_vision/frontend/generated/api.schemas.tsindex d6346940adb2..ef114896ebf1 100644--- a/products/replay_vision/frontend/generated/api.schemas.ts+++ b/products/replay_vision/frontend/generated/api.schemas.ts@@ -1815,6 +1815,17 @@ export interface ScoutReportApi {charts: ReportChartApi[]}+/**+ * * `read_only` - Read only+ * * `support_notes` - Support notes+ */+export type ToolPresetEnumApi = (typeof ToolPresetEnumApi)[keyof typeof ToolPresetEnumApi]++export const ToolPresetEnumApi = {+ ReadOnly: 'read_only',+ SupportNotes: 'support_notes',+} as const+export interface SignalScoutSlackDestinationApi {/*** ID of the Slack integration whose bot posts this scout's findings and reports.@@ -1906,6 +1917,16 @@ export interface SignalScoutConfigOptionsApi {* @maxItems 10*/write_scopes?: string[]+ /**+ * Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.+ * @nullable+ */+ allowed_mcp_tools?: string[] | null+ /** Expand this named preset into a saved tool list. Later preset changes do not alter the saved list. Send this field or allowed_mcp_tools, never both. Requires the scouts-tool-access feature flag.+ *+ * * `read_only` - Read only+ * * `support_notes` - Support notes */+ tool_preset?: ToolPresetEnumApi/** Whether this scout runs on its schedule. Defaults to true. */enabled?: boolean/** Whether the scout writes findings to the inbox. False = dry-run: it runs and logs but emits nothing. Defaults to true. */@@ -2159,6 +2180,16 @@ export interface SignalScoutConfigApi {* @maxItems 10*/readonly write_scopes: readonly string[]+ /**+ * Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.+ * @nullable+ */+ readonly allowed_mcp_tools: readonly string[] | null+ /**+ * Preset used to select the saved tool list, custom for an explicit list, or null when unrestricted.+ * @nullable+ */+ readonly tool_preset: string | null/*** When the coordinator last dispatched this scout. Null if it has never run.* @nullablediff --git a/products/replay_vision/frontend/generated/api.zod.ts b/products/replay_vision/frontend/generated/api.zod.tsindex 2ecab96ad64a..0e52fa144b37 100644--- a/products/replay_vision/frontend/generated/api.zod.ts+++ b/products/replay_vision/frontend/generated/api.zod.ts@@ -1032,6 +1032,19 @@ export const VisionScannersScoutsCreateBody = /* @__PURE__ */ zod.describe("Extra write access granted to this one scout, as scope strings. The grantable set is `alert:write`, `annotation:write`, `customer_task:write`, `dashboard:write`, `hog_flow_proposal:write`, `insight:write`, `llm_skill:write`, `replay_scanner:write`, `warehouse_table:write`, `warehouse_view:write`. Empty (the default) means the scout reads the project and writes only what every scout may write: notebooks, its findings, and its own memory. Each scope is project-wide and object-level, so a scout holding `dashboard:write` can update or delete any dashboard in the project, not only ones it made. Grant only what this scout maintains. Only the person the scout's runs act as (whoever authored it) or a project admin can set it, and a scoped API key must itself carry each scope it grants. A dry run (`emit=false`) never holds the grant. Applies from the scout's next run."),+ allowed_mcp_tools: zod+ .array(zod.string())+ .nullish()+ .describe(+ 'Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.'+ ),+ tool_preset: zod+ .enum(['read_only', 'support_notes'])+ .describe('\* `read_only` - Read only\n\* `support_notes` - Support notes')+ .optional()+ .describe(+ 'Expand this named preset into a saved tool list. Later preset changes do not alter the saved list. Send this field or allowed_mcp_tools, never both. Requires the scouts-tool-access feature flag.\n\n\* `read_only` - Read only\n\* `support_notes` - Support notes'+ ),enabled: zod.boolean().optional()diff --git a/products/signals/backend/activity_logging.py b/products/signals/backend/activity_logging.pyindex 14b7901af9ae..6c948ccce424 100644--- a/products/signals/backend/activity_logging.py+++ b/products/signals/backend/activity_logging.py@@ -50,6 +50,24 @@ def handle_signal_scout_config_change(returnchanges = changes_between(scope, previous=before_update, current=after_update)+ if (+ before_update is not None+ and after_update is not None+ and before_update.allowed_mcp_tools != after_update.allowed_mcp_tools+ and not any(+ change.field == field_name_overrides["SignalScoutConfig"]["allowed_mcp_tools"] for change in changes+ )+ ):+ # The generic diff treats null and [] as empty, but these select different permissions.+ changes.append(+ Change(+ type=scope,+ field=field_name_overrides["SignalScoutConfig"]["allowed_mcp_tools"],+ action="changed",+ before=before_update.allowed_mcp_tools,+ after=after_update.allowed_mcp_tools,+ )+ )if before_update is None and after_update is not None and after_update.write_scopes:# `changes_between` records no fields for a creation, so a scout created with a grant# would leave the log unable to say what it held before the first edit. Write access@@ -63,6 +81,17 @@ def handle_signal_scout_config_change())+ if before_update is None and after_update is not None and after_update.allowed_mcp_tools is not None:+ for field in ("allowed_mcp_tools", "tool_preset"):+ changes.append(+ Change(+ type=scope,+ field=field_name_overrides["SignalScoutConfig"][field],+ action="created",+ after=getattr(after_update, field),+ )+ )+log_activity(organization_id=None,team_id=instance.team_id,diff --git a/products/signals/backend/enums.py b/products/signals/backend/enums.pyindex c12899698cd5..2ff05070d4ac 100644--- a/products/signals/backend/enums.py+++ b/products/signals/backend/enums.py@@ -32,6 +32,13 @@ class ReportLinkKind(LabeledStrEnum):RECURRENCE_OF = "recurrence_of", "Recurrence of"+class ToolPreset(LabeledStrEnum):+ # Named tool selections a scout config can expand into a saved `allowed_mcp_tools` list.+ # `tool_catalogue.get_scout_tool_catalogue` defines the tools behind each name.+ READ_ONLY = "read_only", "Read only"+ SUPPORT_NOTES = "support_notes", "Support notes"++class SuggestedSourceProduct(LabeledStrEnum):# Products a report can suggest the team turn on because the report would have had better# evidence with them. Each value must equal a `ProductKey` whose data freshness spec saysdiff --git a/products/signals/backend/migrations/0168_signalscoutconfig_mcp_tool_grants.py b/products/signals/backend/migrations/0168_signalscoutconfig_mcp_tool_grants.pynew file mode 100644index 000000000000..d6e07371c3fd--- /dev/null+++ b/products/signals/backend/migrations/0168_signalscoutconfig_mcp_tool_grants.py@@ -0,0 +1,22 @@+# Generated by Django 5.2.17 on 2026-09-29 16:37++from django.db import migrations, models+++class Migration(migrations.Migration):+ dependencies = [+ ("signals", "0167_signalscoutrun_team_new_idx"),+ ]++ operations = [+ migrations.AddField(+ model_name="signalscoutconfig",+ name="allowed_mcp_tools",+ field=models.JSONField(blank=True, null=True),+ ),+ migrations.AddField(+ model_name="signalscoutconfig",+ name="tool_preset",+ field=models.CharField(blank=True, max_length=64, null=True),+ ),+ ]diff --git a/products/signals/backend/migrations/max_migration.txt b/products/signals/backend/migrations/max_migration.txtindex 99db99139fef..d79256cd3327 100644--- a/products/signals/backend/migrations/max_migration.txt+++ b/products/signals/backend/migrations/max_migration.txt@@ -1 +1 @@-0167_signalscoutrun_team_new_idx+0168_signalscoutconfig_mcp_tool_grantsdiff --git a/products/signals/backend/models.py b/products/signals/backend/models.pyindex b1fa6faa7dfc..7f4b28c79377 100644--- a/products/signals/backend/models.py+++ b/products/signals/backend/models.py@@ -2723,6 +2723,8 @@ class SignalScoutConfig(ModelActivityMixin, TeamScopedRootMixin, UUIDModel):# scout's acting user and project admins: this field decides what an unattended agent may change# in the project. A dry run (`emit=False`) ignores it, so a preview never mutates the project.write_scopes = models.JSONField(default=list, db_default=[])+ allowed_mcp_tools = models.JSONField(null=True, blank=True)+ tool_preset = models.CharField(max_length=64, null=True, blank=True)# Optional five-field cron expression anchoring runs to wall-clock slots (e.g. "30 9 * * *",# "0 9,17 * * *", "0 9 * * 1-5"). Takes precedence over the rolling `run_interval_minutes`# when set. The coordinator evaluates it in `team.timezone`, so scheduled times followdiff --git a/products/signals/backend/scout_harness/serializers.py b/products/signals/backend/scout_harness/serializers.pyindex a8da9f40e3a3..2f8bbb04e26f 100644--- a/products/signals/backend/scout_harness/serializers.py+++ b/products/signals/backend/scout_harness/serializers.py@@ -41,7 +41,7 @@ from products.signals.backend.artefact_schemas import (Priority,)from products.signals.backend.background_pilot import OPT_OUT_DISABLED, capture_background_scout_opted_out-from products.signals.backend.enums import ReportLinkKind+from products.signals.backend.enums import ReportLinkKind, ToolPresetfrom products.signals.backend.models import SignalReportCheck, SignalScoutConfig, SignalScoutEmissionfrom products.signals.backend.report_charts import MAX_REPORT_CHARTSfrom products.signals.backend.report_metrics import MAX_REPORT_METRICS@@ -60,6 +60,7 @@ from products.signals.backend.scout_harness.scout_costs import SCOUT_COST_WINDOWfrom products.signals.backend.scout_harness.skill_loader import reserved_scout_name_errorfrom products.signals.backend.scout_harness.slack_delivery import MAX_SCOUT_SLACK_DM_TARGETSfrom products.signals.backend.scout_harness.tags import slugify_tag+from products.signals.backend.scout_harness.tool_catalogue import SCOUT_RUN_CONTEXT_TOOLS, get_scout_tool_cataloguefrom products.signals.backend.scout_harness.tools.checks import MAX_CHECK_EXPLANATION_LENGTHfrom products.signals.backend.scout_harness.tools.emit import (MAX_FINDING_ID_LENGTH,@@ -3284,6 +3285,38 @@ def _validate_write_scopes(value: list[str]) -> list[str]:return sorted(set(value))+def _allowed_mcp_tools_field(*, read_only: bool = False) -> serializers.ListField:+ return serializers.ListField(+ child=serializers.CharField(),+ required=False,+ read_only=read_only,+ allow_null=True,+ help_text=(+ "Exact MCP tool names selected for this scout, excluding its built-in run context tools. "+ "Null means no tool restriction; an empty list selects no additional tools. "+ "Write access is derived from selected write tools. Clearing to null preserves the last write scopes. "+ "Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag."+ ),+ )+++def validate_allowed_mcp_tools(value: list[str] | None) -> list[str] | None:+ if value is None:+ return None+ holdable = {+ entry.definition.name+ for entry in get_scout_tool_catalogue().tools+ if entry.holdable and entry.definition.name not in SCOUT_RUN_CONTEXT_TOOLS+ }+ rejected = sorted(set(value) - holdable)+ if rejected:+ raise serializers.ValidationError(+ f"Cannot select these scout tools: {', '.join(rejected)}. "+ "Choose holdable tools from the catalogue, excluding built-in run context tools."+ )+ return sorted(set(value))++class ScoutOrigin(models.TextChoices):CANONICAL = "canonical", "canonical"CUSTOM = "custom", "custom"@@ -3535,6 +3568,12 @@ class SignalScoutConfigSerializer(serializers.ModelSerializer):# `readonly string[]`, which a client cannot hand straight back to the patch call.repositories = _scout_repositories_field()write_scopes = _write_scopes_field(read_only=True)+ allowed_mcp_tools = _allowed_mcp_tools_field(read_only=True)+ tool_preset = serializers.CharField(+ read_only=True,+ allow_null=True,+ help_text="Preset used to select the saved tool list, custom for an explicit list, or null when unrestricted.",+ )@extend_schema_field(OpenApiTypes.STR)def get_description(self, obj: SignalScoutConfig) -> str:@@ -3607,6 +3646,8 @@ class SignalScoutConfigSerializer(serializers.ModelSerializer):"mcp_gateway_server_ids","repositories","write_scopes",+ "allowed_mcp_tools",+ "tool_preset","last_run_at","consecutive_failure_count","status_changed_at",@@ -3689,6 +3730,28 @@ class _ScoutConfigCapabilityFieldsMixin(serializers.Serializer):mcp_gateway_server_ids = _mcp_gateway_server_ids_field()repositories = _scout_repositories_field()write_scopes = _write_scopes_field()+ allowed_mcp_tools = _allowed_mcp_tools_field()+ tool_preset = serializers.ChoiceField(+ choices=ToolPreset.choices,+ required=False,+ help_text=(+ "Expand this named preset into a saved tool list. Later preset changes do not alter the saved list. "+ "Send this field or allowed_mcp_tools, never both. Requires the scouts-tool-access feature flag."+ ),+ )++ def validate_allowed_mcp_tools(self, value: list[str] | None) -> list[str] | None:+ return validate_allowed_mcp_tools(value)++ def validate_tool_preset(self, value: str) -> str:+ preset = next(preset for preset in get_scout_tool_catalogue().tool_presets if preset.name == value)+ validate_allowed_mcp_tools(list(preset.tools))+ return value++ def validate(self, attrs: dict) -> dict:+ if "allowed_mcp_tools" in attrs and "tool_preset" in attrs:+ raise serializers.ValidationError("Send either tool_preset or allowed_mcp_tools, not both.")+ return super().validate(attrs)def validate_run_cron_schedule(self, value: str | None) -> str | None:return _validate_run_cron_schedule(value) if value is not None else None@@ -3910,6 +3973,8 @@ class SignalScoutConfigUpdateSerializer(_ScoutConfigCapabilityFieldsMixin, seria"repositories","write_scopes","suggestion_id",+ "allowed_mcp_tools",+ "tool_preset",]@@ -4297,6 +4362,15 @@ class ScoutScopePresetSerializer(serializers.Serializer):)+class ScoutToolPresetSerializer(serializers.Serializer):+ name = serializers.CharField(help_text="Preset identifier accepted when saving a scout config.")+ label = serializers.CharField(help_text="Human-readable preset name.") # type: ignore[assignment]+ tools = serializers.ListField(+ child=serializers.CharField(),+ help_text="Exact tool names expanded on save. A preset with non-holdable tools cannot be saved.",+ )++class ScoutToolCatalogueSerializer(serializers.Serializer):"""The MCP tool catalogue, with the scout scope postures to read it against."""@@ -4304,6 +4378,7 @@ class ScoutToolCatalogueSerializer(serializers.Serializer):many=True,help_text=("Every catalogued MCP tool, ordered by name. Tools that a successor has replaced are left out."),)+ tool_presets = ScoutToolPresetSerializer(many=True, help_text="Tool selections expanded and validated on save.")presets = ScoutScopePresetSerializer(many=True,help_text="The scope presets a scout run can be dispatched with, and the scopes each one resolves to.",diff --git a/products/signals/backend/scout_harness/tool_catalogue.py b/products/signals/backend/scout_harness/tool_catalogue.pyindex 518d93b91f14..90aa7044d3f7 100644--- a/products/signals/backend/scout_harness/tool_catalogue.py+++ b/products/signals/backend/scout_harness/tool_catalogue.py@@ -9,8 +9,12 @@ before any of it can be configured.from __future__ import annotationsfrom functools import lru_cache+from typing import TYPE_CHECKING++import posthoganalyticsfrom posthog.dataclasses import frozen+from posthog.exceptions_capture import capture_exceptionfrom posthog.mcp_tool_definitions import McpToolDefinition, get_mcp_tool_definitionsfrom posthog.temporal.oauth import (SCOUT_GRANTABLE_WRITE_SCOPES,@@ -20,6 +24,52 @@ from posthog.temporal.oauth import (scout_scope_posture,)+from products.signals.backend.enums import ToolPreset++if TYPE_CHECKING:+ from posthog.models.team.team import Team+++def scout_tool_access_enabled(team: Team) -> bool:+ try:+ return (+ posthoganalytics.feature_enabled(+ "scouts-tool-access",+ str(team.uuid),+ groups={"project": str(team.uuid)},+ group_properties={"project": {"id": team.parent_team_id or team.id, "uuid": str(team.uuid)}},+ send_feature_flag_events=False,+ )+ is True+ )+ except Exception as error:+ capture_exception(error)+ return False+++SCOUT_RUN_CONTEXT_TOOLS = frozenset(+ {+ "scout-emit-report",+ "scout-edit-report",+ "scout-emit-signal",+ "scout-scratchpad-search",+ "scout-scratchpad-remember",+ "scout-scratchpad-forget",+ "scout-notes-list",+ "scout-metadata-get",+ "scout-project-profile-get",+ "scout-record-output",+ "scout-check-record-result",+ }+)+++@frozen+class ScoutToolPresetEntry:+ name: ToolPreset+ label: str+ tools: tuple[str, ...]+@frozenclass ScoutToolEntry:@@ -44,6 +94,7 @@ class ScoutToolCatalogue:tools: tuple[ScoutToolEntry, ...]presets: tuple[ScoutScopePresetEntry, ...]grantable_write_scopes: tuple[str, ...]+ tool_presets: tuple[ScoutToolPresetEntry, ...]def _preset_scopes(preset: ScoutScopePreset, *, extra_write_scopes: list[str] | None = None) -> frozenset[str]:@@ -85,6 +136,13 @@ def get_scout_tool_catalogue() -> ScoutToolCatalogue:))+ read_tools = tuple(+ sorted(+ entry.definition.name+ for entry in tools+ if entry.holdable and entry.definition.read_only and entry.definition.name not in SCOUT_RUN_CONTEXT_TOOLS+ )+ )return ScoutToolCatalogue(tools=tuple(sorted(tools, key=lambda entry: entry.definition.name)),presets=tuple(@@ -92,4 +150,12 @@ def get_scout_tool_catalogue() -> ScoutToolCatalogue:for preset in SCOUT_SCOPE_PRESETS),grantable_write_scopes=tuple(sorted(SCOUT_GRANTABLE_WRITE_SCOPES)),+ tool_presets=(+ ScoutToolPresetEntry(name=ToolPreset.READ_ONLY, label=ToolPreset.READ_ONLY.label, tools=read_tools),+ ScoutToolPresetEntry(+ name=ToolPreset.SUPPORT_NOTES,+ label=ToolPreset.SUPPORT_NOTES.label,+ tools=tuple(sorted((*read_tools, "conversations-tickets-notes-create"))),+ ),+ ),)diff --git a/products/signals/backend/scout_harness/views.py b/products/signals/backend/scout_harness/views.pyindex 590f042c7ed7..4fd839c37889 100644--- a/products/signals/backend/scout_harness/views.py+++ b/products/signals/backend/scout_harness/views.py@@ -60,6 +60,7 @@ from posthog.models.user import Userfrom posthog.permissions import AccessControlPermission, APIScopePermission, get_authenticator_scopesfrom posthog.rate_limit import AIBurstRateThrottle, AISustainedRateThrottlefrom posthog.temporal.common.client import sync_connect+from posthog.temporal.oauth import SCOUT_GRANTABLE_WRITE_SCOPESfrom posthog.user_permissions import UserPermissionsfrom products.access_control.backend.facade.user_access_control import UserAccessControl@@ -167,7 +168,7 @@ from products.signals.backend.scout_harness.team_limits import (resolve_team_metadata,withheld_skills_for_team,)-from products.signals.backend.scout_harness.tool_catalogue import get_scout_tool_catalogue+from products.signals.backend.scout_harness.tool_catalogue import get_scout_tool_catalogue, scout_tool_access_enabledfrom products.signals.backend.scout_harness.tools.checks import (InvalidCheckResultError,InvalidCheckWriteError,@@ -2607,7 +2608,15 @@ def _upsert_scout_config(# The per-team cap only gates net-new enables: creating an enabled row or# flipping a disabled row on. Reasserting an already-enabled scout stays exempt.- existing = SignalScoutConfig.objects.for_team(team_id).filter(skill_name=skill_name).first()+ existing = SignalScoutConfig.objects.for_team(team_id).select_for_update().filter(skill_name=skill_name).first()+ team = Team.objects.get(id=team_id)+ defaults = _resolve_scout_config_grants(+ request=request,+ team=team,+ skill_name=skill_name,+ config=existing,+ data=tunables,+ )will_enable = (tunables.get("enabled", True)if existing is None@@ -2622,7 +2631,7 @@ def _upsert_scout_config(team_id=team_id,skill_name=skill_name,defaults={- **tunables,+ **defaults,"created_by": request.user,"enabled_by": request.user if tunables.get("enabled", True) else None,},@@ -2657,6 +2666,7 @@ def _upsert_scout_config(},}+ config = SignalScoutConfig.objects.for_team(team_id).select_for_update().get(id=config.id)# The coordinator or another caller may have won the create race. Apply only# fields supplied by this request so omitted settings remain untouched.update = SignalScoutConfigUpdateSerializer(@@ -2666,6 +2676,15 @@ def _upsert_scout_config(context=serializer_context,)update.is_valid(raise_exception=True)+ update.validated_data.update(+ _resolve_scout_config_grants(+ request=request,+ team=team,+ skill_name=skill_name,+ config=config,+ data=update.validated_data,+ )+ )save_kwargs: dict[str, Any] = {}if not config.enabled and update.validated_data.get("enabled"):save_kwargs["enabled_by"] = request.user@@ -2724,6 +2743,7 @@ def create_scout_for_source(# Resolved before the transaction: it reads the `signals-scout` flag, and the block below# holds row locks on the skill and its config.max_enabled_scouts = max_enabled_scouts_for_team(team.id)+ _assert_scout_tool_selection_access(request=request, team=team, data=config_options)with transaction.atomic():try:@@ -2758,25 +2778,6 @@ def create_scout_for_source(# Only when one was given: the upsert applies every tunable to a row that already# exists, and a blank would clear a label the existing scout was renamed to.tunables["display_name"] = display_name- if "write_scopes" in tunables:- # Creating the scout in this request makes the requester its author, which is who its- # runs act as. Reusing an existing name adopts someone else's scout and its config, so- # that path asks for the same claim a config edit does. Compared against the stored- # grant, because the create form sends an empty list by default and applying that to an- # existing scout is a revocation, not a no-op.- existing_config = (- SignalScoutConfig.objects.for_team(team.id).select_for_update().filter(skill_name=name).first()- )- current_scopes = _stored_write_scopes(existing_config.write_scopes) if existing_config else []- if sorted(set(tunables["write_scopes"])) != sorted(current_scopes):- assert_can_grant_scout_write_scopes(- request=request,- team=team,- skill_name=name,- config=existing_config,- added_scopes=_added_write_scopes(tunables["write_scopes"], current=current_scopes),- authored_by_requester=skill_created,- )if source_product and source_id:# Reusing a name adopts the existing config, and the source pair is what the owning# product's report route trusts — so adopting an unowned scout would expose everything it@@ -2986,31 +2987,6 @@ def _stored_write_scopes(raw: object) -> list[str]:return [scope for scope in raw if isinstance(scope, str)]-def _requested_write_scopes_change(request: Request, *, current: list[str] | None) -> bool:- """Whether this request asks to change a scout's granted write scopes.-- Read off the raw body rather than validated data, because the answer decides whether the- authorization gate runs and that has to be decided before anything is applied. Comparing- against the stored grant keeps a client that resends a whole config object — MCP callers do —- from needing the gate for an edit that changes nothing.- """- data = request.data- if not isinstance(data, dict) or "write_scopes" not in data:- return False- requested = data["write_scopes"]- if not isinstance(requested, list):- # Malformed input still counts as an attempt to change the field; the serializer rejects it.- return True- return sorted({scope for scope in requested if isinstance(scope, str)}) != sorted(current or [])---def _added_write_scopes(requested: object, *, current: list[str] | None) -> set[str]:- """The scopes a request would add to a scout's grant. Tolerates a raw, unvalidated body."""- if not isinstance(requested, list):- return set()- return {scope for scope in requested if isinstance(scope, str)} - set(current or [])--def assert_can_grant_scout_write_scopes(*,request: Request,@@ -3018,7 +2994,6 @@ def assert_can_grant_scout_write_scopes(skill_name: str,config: SignalScoutConfig | None,added_scopes: set[str],- authored_by_requester: bool = False,) -> None:"""Gate on changing what one scout may write in the project.@@ -3029,8 +3004,6 @@ def assert_can_grant_scout_write_scopes(reads identity sources the person set themselves (the version-history creator, then whoenabled or created the config). `LLMSkillOwner` is deliberately not consulted: any skill editorcan rewrite the owner list, so it would let an editor appoint themselves and pass this gate.- `authored_by_requester` covers the same person creating the scout and its grant in one request,- before a version row exists to resolve.A scoped credential must also carry each scope it adds. A personal API key or OAuth token mintedwith only `signal_scout:write` is a deliberate narrowing, and letting it configure a run that@@ -3050,8 +3023,6 @@ def assert_can_grant_scout_write_scopes(level = UserPermissions(user=user, team=team).current_team.effective_membership_levelif level is not None and level >= OrganizationMembership.Level.ADMIN:return- if authored_by_requester:- returnif resolve_scout_acting_user_id(team, skill_name, config) == user.pk:returnraise exceptions.PermissionDenied(@@ -3059,6 +3030,90 @@ def assert_can_grant_scout_write_scopes()+def _assert_scout_tool_selection_access(*, request: Request, team: Team, data: Mapping[str, Any]) -> None:+ if "allowed_mcp_tools" not in data and "tool_preset" not in data:+ return+ if _sandbox_bound_task_id(request) is not None:+ raise exceptions.PermissionDenied("Sandbox tokens cannot change a scout's tool selection.")+ if not scout_tool_access_enabled(team):+ raise exceptions.ValidationError({"allowed_mcp_tools": "Scout tool access is not enabled for this project."})+++def _resolve_scout_config_grants(+ *,+ request: Request,+ team: Team,+ skill_name: str,+ config: SignalScoutConfig | None,+ data: dict[str, Any],+) -> dict[str, Any]:+ current_scopes = set(_stored_write_scopes(config.write_scopes)) if config else set()+ current_tools = config.allowed_mcp_tools if config else None+ selects_tools = "allowed_mcp_tools" in data or "tool_preset" in data+ resolved = dict(data)+ if selects_tools:+ if "tool_preset" in data:+ preset = next(+ preset for preset in get_scout_tool_catalogue().tool_presets if preset.name == data["tool_preset"]+ )+ resolved["allowed_mcp_tools"] = list(preset.tools)+ else:+ resolved["tool_preset"] = "custom" if data["allowed_mcp_tools"] is not None else None++ selected_tools = resolved.get("allowed_mcp_tools", current_tools)+ # A whole-config resend echoes the saved scopes back; only a change contradicts the tool list.+ resends_saved_scopes = not selects_tools and set(data.get("write_scopes", [])) == current_scopes+ if (+ "write_scopes" in data+ and (current_tools is not None or selected_tools is not None)+ and not resends_saved_scopes+ ):+ raise exceptions.ValidationError(+ {"write_scopes": "Write access comes from the tool list. Edit allowed_mcp_tools instead."}+ )++ if selects_tools and selected_tools is not None:+ write_tools = {+ entry.definition.name: entry.definition+ for entry in get_scout_tool_catalogue().tools+ if not entry.definition.read_only+ }+ derived = {+ scope for name in selected_tools if name in write_tools for scope in write_tools[name].required_scopes+ } & SCOUT_GRANTABLE_WRITE_SCOPES+ resolved["write_scopes"] = sorted(derived)+ # Null already permits every tool within the existing scopes; narrowing it adds no tool grant.+ added_tools = set(selected_tools) - set(current_tools) if current_tools is not None else set()+ added_write_tools = added_tools & write_tools.keys()+ required = {scope for name in added_write_tools for scope in write_tools[name].required_scopes}+ if added_write_tools or derived - current_scopes:+ assert_can_grant_scout_write_scopes(+ request=request,+ team=team,+ skill_name=skill_name,+ config=config,+ added_scopes=required | (derived - current_scopes),+ )+ elif selects_tools and current_tools is not None:+ # Clearing an explicit list restores every operation allowed by the retained scopes.+ assert_can_grant_scout_write_scopes(+ request=request,+ team=team,+ skill_name=skill_name,+ config=config,+ added_scopes=current_scopes,+ )+ elif "write_scopes" in data and set(data["write_scopes"]) != current_scopes:+ assert_can_grant_scout_write_scopes(+ request=request,+ team=team,+ skill_name=skill_name,+ config=config,+ added_scopes=set(data["write_scopes"]) - current_scopes,+ )+ return resolved++def scout_config_context(team: Team, skill_names: list[str], request: Request) -> dict[str, Any]:"""Serializer context for `SignalScoutConfigSerializer`: skill metadata plus skill owners.@@ -3389,27 +3444,13 @@ class SignalScoutConfigViewSet(ScoutTrialConfigMixin, TeamAndOrgViewSetMixin, vi)serializer.is_valid(raise_exception=True)skill_name = serializer.validated_data["skill_name"]+ _assert_scout_tool_selection_access(request=request, team=team, data=serializer.validated_data)max_enabled_scouts = max_enabled_scouts_for_team(team_id)# Upsert, so the grant is compared against whatever row already exists — registering a# config for an existing scout is the same widening as patching one. The row stays locked# from the comparison to the save, so a grant revoked in between cannot be written back by# a request that compared against the old value.with transaction.atomic():- existing = (- SignalScoutConfig.objects.unscoped()- .select_for_update()- .filter(team_id=team_id, skill_name=skill_name)- .first()- )- current_scopes = _stored_write_scopes(existing.write_scopes) if existing else []- if _requested_write_scopes_change(request, current=current_scopes):- assert_can_grant_scout_write_scopes(- request=request,- team=team,- skill_name=skill_name,- config=existing,- added_scopes=_added_write_scopes(request.data.get("write_scopes"), current=current_scopes),- )if not LLMSkill.objects.filter(team_id=team_id, name=skill_name, is_latest=True, deleted=False).exists():raise exceptions.ValidationError({"skill_name": "No skill with this name exists on this project. Author the skill first."}@@ -3454,6 +3495,7 @@ class SignalScoutConfigViewSet(ScoutTrialConfigMixin, TeamAndOrgViewSetMixin, videf partial_update(self, request: Request, *args, **kwargs) -> Response:team = _canonical_team(self)team_id = team.id+ _assert_scout_tool_selection_access(request=request, team=team, data=request.data)if self._sets_structured_output_schema(request):self._assert_can_author_structured_output_schema()config_id = _parse_run_id_or_404(kwargs)@@ -3468,15 +3510,6 @@ class SignalScoutConfigViewSet(ScoutTrialConfigMixin, TeamAndOrgViewSetMixin, vi)if config is None:raise exceptions.NotFound()- current_scopes = _stored_write_scopes(config.write_scopes)- if _requested_write_scopes_change(request, current=current_scopes):- assert_can_grant_scout_write_scopes(- request=request,- team=team,- skill_name=config.skill_name,- config=config,- added_scopes=_added_write_scopes(request.data.get("write_scopes"), current=current_scopes),- )serializer = SignalScoutConfigUpdateSerializer(config,data=request.data,@@ -3490,6 +3523,15 @@ class SignalScoutConfigViewSet(ScoutTrialConfigMixin, TeamAndOrgViewSetMixin, viserializer.is_valid(raise_exception=True)# Attribution only, not a config field, so it must not count as an edit of the config.suggestion_id = serializer.validated_data.pop("suggestion_id", None)+ serializer.validated_data.update(+ _resolve_scout_config_grants(+ request=request,+ team=team,+ skill_name=config.skill_name,+ config=config,+ data=serializer.validated_data,+ )+ )enabling = not config.enabled and serializer.validated_data.get("enabled")if enabling:_reject_if_enabled_cap_reached(team_id, config.skill_name, cap=max_enabled_scouts)diff --git a/products/signals/backend/test/test_scout_create_api.py b/products/signals/backend/test/test_scout_create_api.pyindex 0678ab42e218..44f3f50906c7 100644--- a/products/signals/backend/test/test_scout_create_api.py+++ b/products/signals/backend/test/test_scout_create_api.py@@ -38,6 +38,46 @@ class TestSignalScoutCreateAPI(APIBaseTest):],}+ @parameterized.expand(+ [+ ("read", {"allowed_mcp_tools": ["insight-get"]}, ["insight-get"], [], "custom"),+ ("write", {"allowed_mcp_tools": ["dashboard-create"]}, ["dashboard-create"], ["dashboard:write"], "custom"),+ ("empty", {"allowed_mcp_tools": []}, [], [], "custom"),+ ]+ )+ def test_create_and_upsert_tool_grants(+ self, _name: str, options: dict, tools: list[str], scopes: list[str], preset: str+ ) -> None:+ payload = {**self._payload(), "config": {"enabled": False, **options}}+ with patch("posthoganalytics.feature_enabled", return_value=True):+ for expected in (201, 200):+ response = self.client.post(self._url(), payload, format="json")+ assert response.status_code == expected, response.json()+ config = response.json()["config"]+ assert config["allowed_mcp_tools"] == tools+ assert config["write_scopes"] == scopes+ assert config["tool_preset"] == preset++ def test_scout_create_upsert_cannot_add_tool_without_credential_scope(self) -> None:+ payload = {**self._payload(), "config": {"enabled": False, "allowed_mcp_tools": ["dashboard-create"]}}+ with patch("posthoganalytics.feature_enabled", return_value=True):+ response = self.client.post(self._url(), payload, format="json")+ assert response.status_code == 201, response.json()+ raw = generate_random_token_personal()+ PersonalAPIKey.objects.create(+ label="scout settings",+ user=self.user,+ secure_value=hash_key_value(raw),+ scopes=["signal_scout:write", "llm_skill:write"],+ )+ self.client.logout()+ payload["config"]["allowed_mcp_tools"] = ["dashboard-update"]+ with patch("posthoganalytics.feature_enabled", return_value=True):+ response = self.client.post(self._url(), payload, format="json", HTTP_AUTHORIZATION=f"Bearer {raw}")+ assert response.status_code == 403, response.json()+ config = SignalScoutConfig.objects.get(team=self.team, skill_name=payload["name"])+ assert config.allowed_mcp_tools == ["dashboard-create"]+def test_create_builds_runnable_scout_with_slack_destination(self) -> None:integration = Integration.objects.create(team=self.team, kind=Integration.IntegrationKind.SLACK)payload = {diff --git a/products/signals/backend/test/test_scout_harness_api.py b/products/signals/backend/test/test_scout_harness_api.pyindex 544607782dd3..7185653551bf 100644--- a/products/signals/backend/test/test_scout_harness_api.py+++ b/products/signals/backend/test/test_scout_harness_api.py@@ -1564,6 +1564,205 @@ class TestScoutHarnessConfigWriteScopesAPI(APIBaseTest):config.refresh_from_db()assert config.write_scopes == (requested if expected == status.HTTP_200_OK else current)+ @parameterized.expand(+ [+ ("read", ["insight-get"], []),+ ("write", ["dashboard-create"], ["dashboard:write"]),+ ("empty", [], []),+ ]+ )+ def test_tool_list_derives_scopes_and_audits(self, _name: str, tools: list[str], scopes: list[str]) -> None:+ self._authored_by(self.user)+ config = self._config(write_scopes=["insight:write"])+ with patch("posthoganalytics.feature_enabled", return_value=True):+ response = self.client.patch(self._detail_url(str(config.id)), {"allowed_mcp_tools": tools}, format="json")+ assert response.status_code == 200, response.json()+ config.refresh_from_db()+ assert config.allowed_mcp_tools == tools+ assert config.tool_preset == "custom"+ assert config.write_scopes == scopes+ assert response.json()["allowed_mcp_tools"] == tools+ log = ActivityLog.objects.filter(scope="SignalScoutConfig", item_id=str(config.id), activity="updated").latest(+ "created_at"+ )+ assert log.detail is not None+ fields = {change["field"] for change in log.detail["changes"]}+ assert {"allowed MCP tools", "tool preset", "write access"} <= fields++ @parameterized.expand(+ [+ ("add_scope", None, [], ["dashboard-create"], 403),+ ("same_scope_new_tool", ["dashboard-create"], ["dashboard:write"], ["dashboard-update"], 403),+ ("remove", ["dashboard-create"], ["dashboard:write"], [], 200),+ ("narrow_unrestricted", None, ["dashboard:write"], ["dashboard-create"], 200),+ ("clear", ["dashboard-create"], ["dashboard:write"], None, 403),+ ]+ )+ def test_tool_grant_actor_boundary(+ self, _name: str, current: list[str] | None, scopes: list[str], requested: list[str] | None, expected: int+ ) -> None:+ self._authored_by(self._other_member())+ config = self._config(allowed_mcp_tools=current, write_scopes=scopes)+ with patch("posthoganalytics.feature_enabled", return_value=True):+ response = self.client.patch(+ self._detail_url(str(config.id)), {"allowed_mcp_tools": requested}, format="json"+ )+ assert response.status_code == expected, response.json()+ config.refresh_from_db()+ assert config.allowed_mcp_tools == (requested if expected == 200 else current)+ if expected == 403:+ assert config.write_scopes == scopes++ @parameterized.expand(+ [+ ("missing", ["signal_scout:write"], 403),+ ("present", ["signal_scout:write", "dashboard:write"], 200),+ ]+ )+ def test_new_tool_requires_credential_scope_even_if_already_granted(+ self, _name: str, scopes: list[str], expected: int+ ) -> None:+ self._authored_by(self.user)+ config = self._config(allowed_mcp_tools=["dashboard-create"], write_scopes=["dashboard:write"])+ token = self._personal_api_key(scopes)+ with patch("posthoganalytics.feature_enabled", return_value=True):+ response = self.client.patch(+ self._detail_url(str(config.id)),+ {"allowed_mcp_tools": ["dashboard-update"]},+ format="json",+ HTTP_AUTHORIZATION=f"Bearer {token}",+ )+ assert response.status_code == expected, response.json()++ def test_clear_tool_list_preserves_scopes_then_allows_direct_edit(self) -> None:+ self._authored_by(self.user)+ config = self._config(+ allowed_mcp_tools=["dashboard-create"], tool_preset="custom", write_scopes=["dashboard:write"]+ )+ with patch("posthoganalytics.feature_enabled", return_value=True):+ response = self.client.patch(self._detail_url(str(config.id)), {"allowed_mcp_tools": None}, format="json")+ assert response.status_code == 200, response.json()+ assert response.json()["write_scopes"] == ["dashboard:write"]+ assert response.json()["tool_preset"] is None+ response = self.client.patch(self._detail_url(str(config.id)), {"write_scopes": []}, format="json")+ assert response.status_code == 200, response.json()+ config.refresh_from_db()+ assert config.allowed_mcp_tools is None+ assert config.write_scopes == []++ @parameterized.expand(+ [+ ("saved", {"write_scopes": []}),+ ("incoming", {"write_scopes": [], "allowed_mcp_tools": []}),+ ("clearing", {"write_scopes": [], "allowed_mcp_tools": None}),+ ]+ )+ def test_explicit_list_refuses_direct_scope_edits(self, _name: str, payload: dict) -> None:+ self._authored_by(self.user)+ config = self._config(allowed_mcp_tools=["dashboard-create"], write_scopes=["dashboard:write"])+ with patch("posthoganalytics.feature_enabled", return_value=True):+ response = self.client.patch(self._detail_url(str(config.id)), payload, format="json")+ assert response.status_code == 400, response.json()+ assert "Write access comes from the tool list" in str(response.json())++ @parameterized.expand(+ [+ ("derived_scopes", ["dashboard-create"], ["dashboard:write"]),+ ("no_write_tools", [], []),+ ]+ )+ def test_explicit_list_accepts_unchanged_scope_resend(+ self, _name: str, tools: list[str], scopes: list[str]+ ) -> None:+ self._authored_by(self.user)+ config = self._config(allowed_mcp_tools=tools, tool_preset="custom", write_scopes=scopes)+ with patch("posthoganalytics.feature_enabled", return_value=True):+ response = self.client.patch(+ self._detail_url(str(config.id)), {"write_scopes": scopes, "emit": False}, format="json"+ )+ assert response.status_code == 200, response.json()+ config.refresh_from_db()+ assert config.allowed_mcp_tools == tools+ assert config.write_scopes == scopes+ assert config.emit is False++ @parameterized.expand([(False,), (None,), (RuntimeError("Flag unavailable"),)])+ def test_tool_list_fails_closed_without_flag(self, result: object) -> None:+ config = self._config()+ with patch(+ "posthoganalytics.feature_enabled",+ **({"side_effect": result} if isinstance(result, Exception) else {"return_value": result}),+ ):+ response = self.client.patch(self._detail_url(str(config.id)), {"allowed_mcp_tools": []}, format="json")+ assert response.status_code == 400, response.json()+ config.refresh_from_db()+ assert config.allowed_mcp_tools is None+ assert response.json()["attr"] == "allowed_mcp_tools"++ @parameterized.expand([({"allowed_mcp_tools": []},), ({"tool_preset": "read_only"},)])+ def test_sandbox_token_cannot_select_tools(self, payload: dict) -> None:+ self._authored_by(self.user)+ config = self._config()+ run = _make_run(self.team, scout_config=config, skill_name=config.skill_name)+ _authenticate_as_scout(self, scopes=["signal_scout:write"], sandbox_task_id=run.task_run.task_id)+ with patch("posthoganalytics.feature_enabled", return_value=True):+ response = self.client.patch(self._detail_url(str(config.id)), payload, format="json")+ assert response.status_code == 403, response.json()+ config.refresh_from_db()+ assert config.allowed_mcp_tools is None++ def test_preset_is_snapshotted_and_reordered_list_does_not_log(self) -> None:+ config = self._config()+ with patch("posthoganalytics.feature_enabled", return_value=True):+ response = self.client.patch(self._detail_url(str(config.id)), {"tool_preset": "read_only"}, format="json")+ assert response.status_code == 200, response.json()+ config.refresh_from_db()+ assert config.tool_preset == "read_only"+ assert config.allowed_mcp_tools is not None+ assert "insight-get" in config.allowed_mcp_tools+ assert "scout-notes-list" not in config.allowed_mcp_tools+ assert config.write_scopes == []+ with patch("posthoganalytics.feature_enabled", return_value=True):+ response = self.client.patch(+ self._detail_url(str(config.id)),+ {"allowed_mcp_tools": ["insight-get", "dashboard-get"]},+ format="json",+ )+ assert response.status_code == 200, response.json()+ before = ActivityLog.objects.filter(scope="SignalScoutConfig", item_id=str(config.id)).count()+ response = self.client.patch(+ self._detail_url(str(config.id)),+ {"allowed_mcp_tools": ["dashboard-get", "insight-get", "insight-get"]},+ format="json",+ )+ assert response.status_code == 200, response.json()+ assert ActivityLog.objects.filter(scope="SignalScoutConfig", item_id=str(config.id)).count() == before++ def test_config_create_and_upsert_tool_grants(self) -> None:+ self._authored_by(self.user)+ url = f"/api/projects/{self.team.id}/signals/scout/configs/"+ payload = {"skill_name": "signals-scout-hygiene", "enabled": False, "allowed_mcp_tools": ["dashboard-create"]}+ with patch("posthoganalytics.feature_enabled", return_value=True):+ for expected in (201, 200):+ response = self.client.post(url, payload, format="json")+ assert response.status_code == expected, response.json()+ assert response.json()["write_scopes"] == ["dashboard:write"]+ config = SignalScoutConfig.objects.get(team=self.team, skill_name=payload["skill_name"])+ log = ActivityLog.objects.filter(scope="SignalScoutConfig", item_id=str(config.id), activity="created").latest(+ "created_at"+ )+ assert log.detail is not None+ fields = {change["field"]: change.get("after") for change in log.detail["changes"]}+ assert fields["allowed MCP tools"] == ["dashboard-create"]+ assert fields["tool preset"] == "custom"+ token = self._personal_api_key(["signal_scout:write", "llm_skill:write"])+ payload["allowed_mcp_tools"] = ["dashboard-update"]+ with patch("posthoganalytics.feature_enabled", return_value=True):+ response = self.client.post(url, payload, format="json", HTTP_AUTHORIZATION=f"Bearer {token}")+ assert response.status_code == 403, response.json()+ config.refresh_from_db()+ assert config.allowed_mcp_tools == ["dashboard-create"]+class TestWriteScopesValidation(SimpleTestCase):@parameterized.expand(@@ -1598,6 +1797,32 @@ class TestWriteScopesValidation(SimpleTestCase):else:assert "write_scopes" in serializer.errors+ @parameterized.expand(+ [+ ("unknown", ["invented-tool", "another-unknown"]),+ ("superseded", ["signals-scout-config-update"]),+ ("unholdable", ["create-feature-flag"]),+ ("context", ["scout-emit-report", "scout-notes-list"]),+ ]+ )+ def test_tool_validation_names_every_rejected_tool(self, _name: str, tools: list[str]) -> None:+ serializer = SignalScoutConfigUpdateSerializer(data={"allowed_mcp_tools": tools}, partial=True)+ assert not serializer.is_valid()+ for tool in tools:+ assert tool in str(serializer.errors["allowed_mcp_tools"])++ def test_tool_list_and_preset_are_mutually_exclusive(self) -> None:+ serializer = SignalScoutConfigUpdateSerializer(+ data={"allowed_mcp_tools": [], "tool_preset": "read_only"}, partial=True+ )+ assert not serializer.is_valid()+ assert "not both" in str(serializer.errors)++ def test_support_notes_preset_is_rejected_until_its_write_scope_is_grantable(self) -> None:+ serializer = SignalScoutConfigUpdateSerializer(data={"tool_preset": "support_notes"}, partial=True)+ assert not serializer.is_valid()+ assert "conversations-tickets-notes-create" in str(serializer.errors)+class TestScoutHarnessConfigModelAPI(APIBaseTest):_FLAG_PATH = "products.signals.backend.scout_harness.serializers.scout_model_config_enabled"@@ -4207,6 +4432,14 @@ class TestScoutHarnessToolCatalogueAPI(APIBaseTest):assert len(body["tools"]) > 500assert [preset["name"] for preset in body["presets"]] == list(SCOUT_SCOPE_PRESETS)assert set(body["grantable_write_scopes"]) == set(SCOUT_GRANTABLE_WRITE_SCOPES)+ presets = {preset["name"]: preset for preset in body["tool_presets"]}+ assert set(presets) == {"read_only", "support_notes"}+ assert set(presets["support_notes"]["tools"]) - set(presets["read_only"]["tools"]) == {+ "conversations-tickets-notes-create"+ }+ catalogue_names = {tool["name"] for tool in body["tools"]}+ for preset in presets.values():+ assert set(preset["tools"]) <= catalogue_namesdef test_leaves_out_the_tools_a_successor_replaced(self) -> None:# A picker that offered a superseded tool would configure a scout for a tool on its way out.diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.tsindex e492048008e6..52b60ba2d921 100644--- a/products/signals/frontend/generated/api.schemas.ts+++ b/products/signals/frontend/generated/api.schemas.ts@@ -3296,6 +3296,17 @@ export interface LLMSkillFileInputApi {content_type?: string}+/**+ * * `read_only` - Read only+ * * `support_notes` - Support notes+ */+export type ToolPresetEnumApi = (typeof ToolPresetEnumApi)[keyof typeof ToolPresetEnumApi]++export const ToolPresetEnumApi = {+ ReadOnly: 'read_only',+ SupportNotes: 'support_notes',+} as const+export interface SignalScoutSlackDestinationApi {/*** ID of the Slack integration whose bot posts this scout's findings and reports.@@ -3387,6 +3398,16 @@ export interface SignalScoutConfigOptionsApi {* @maxItems 10*/write_scopes?: string[]+ /**+ * Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.+ * @nullable+ */+ allowed_mcp_tools?: string[] | null+ /** Expand this named preset into a saved tool list. Later preset changes do not alter the saved list. Send this field or allowed_mcp_tools, never both. Requires the scouts-tool-access feature flag.+ *+ * * `read_only` - Read only+ * * `support_notes` - Support notes */+ tool_preset?: ToolPresetEnumApi/** Whether this scout runs on its schedule. Defaults to true. */enabled?: boolean/** Whether the scout writes findings to the inbox. False = dry-run: it runs and logs but emits nothing. Defaults to true. */@@ -3707,6 +3728,16 @@ export interface SignalScoutConfigApi {* @maxItems 10*/readonly write_scopes: readonly string[]+ /**+ * Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.+ * @nullable+ */+ readonly allowed_mcp_tools: readonly string[] | null+ /**+ * Preset used to select the saved tool list, custom for an explicit list, or null when unrestricted.+ * @nullable+ */+ readonly tool_preset: string | null/*** When the coordinator last dispatched this scout. Null if it has never run.* @nullable@@ -3829,6 +3860,16 @@ export interface SignalScoutConfigCreateApi {* @maxItems 10*/write_scopes?: string[]+ /**+ * Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.+ * @nullable+ */+ allowed_mcp_tools?: string[] | null+ /** Expand this named preset into a saved tool list. Later preset changes do not alter the saved list. Send this field or allowed_mcp_tools, never both. Requires the scouts-tool-access feature flag.+ *+ * * `read_only` - Read only+ * * `support_notes` - Support notes */+ tool_preset?: ToolPresetEnumApi/** Whether this scout runs on its schedule. Defaults to true. */enabled?: boolean/** Whether the scout writes findings to the inbox. False = dry-run: it runs and logs but emits nothing. Defaults to true. */@@ -3975,6 +4016,16 @@ export interface PatchedSignalScoutConfigUpdateApi {* @maxLength 64*/suggestion_id?: string+ /**+ * Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.+ * @nullable+ */+ allowed_mcp_tools?: string[] | null+ /** Expand this named preset into a saved tool list. Later preset changes do not alter the saved list. Send this field or allowed_mcp_tools, never both. Requires the scouts-tool-access feature flag.+ *+ * * `read_only` - Read only+ * * `support_notes` - Support notes */+ tool_preset?: ToolPresetEnumApi}/**@@ -4807,6 +4858,15 @@ export interface ScoutToolCatalogueEntryApi {feature_entitlement: string | null}+export interface ScoutToolPresetApi {+ /** Preset identifier accepted when saving a scout config. */+ name: string+ /** Human-readable preset name. */+ label: string+ /** Exact tool names expanded on save. A preset with non-holdable tools cannot be saved. */+ tools: string[]+}+/*** A scope preset a scout run can be dispatched with.*/@@ -4823,6 +4883,8 @@ export interface ScoutScopePresetApi {export interface ScoutToolCatalogueApi {/** Every catalogued MCP tool, ordered by name. Tools that a successor has replaced are left out. */tools: ScoutToolCatalogueEntryApi[]+ /** Tool selections expanded and validated on save. */+ tool_presets: ScoutToolPresetApi[]/** The scope presets a scout run can be dispatched with, and the scopes each one resolves to. */presets: ScoutScopePresetApi[]/** The write scopes a person can grant to one scout from its settings. A scope outside this set can never be added to a scout's token. */diff --git a/products/signals/frontend/generated/api.zod.ts b/products/signals/frontend/generated/api.zod.tsindex 24fe860509d1..391b0ae96572 100644--- a/products/signals/frontend/generated/api.zod.ts+++ b/products/signals/frontend/generated/api.zod.ts@@ -817,6 +817,19 @@ export const SignalsScoutCreateBody = /* @__PURE__ */ zod.describe("Extra write access granted to this one scout, as scope strings. The grantable set is `alert:write`, `annotation:write`, `customer_task:write`, `dashboard:write`, `hog_flow_proposal:write`, `insight:write`, `llm_skill:write`, `replay_scanner:write`, `warehouse_table:write`, `warehouse_view:write`. Empty (the default) means the scout reads the project and writes only what every scout may write: notebooks, its findings, and its own memory. Each scope is project-wide and object-level, so a scout holding `dashboard:write` can update or delete any dashboard in the project, not only ones it made. Grant only what this scout maintains. Only the person the scout's runs act as (whoever authored it) or a project admin can set it, and a scoped API key must itself carry each scope it grants. A dry run (`emit=false`) never holds the grant. Applies from the scout's next run."),+ allowed_mcp_tools: zod+ .array(zod.string())+ .nullish()+ .describe(+ 'Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.'+ ),+ tool_preset: zod+ .enum(['read_only', 'support_notes'])+ .describe('\* `read_only` - Read only\n\* `support_notes` - Support notes')+ .optional()+ .describe(+ 'Expand this named preset into a saved tool list. Later preset changes do not alter the saved list. Send this field or allowed_mcp_tools, never both. Requires the scouts-tool-access feature flag.\n\n\* `read_only` - Read only\n\* `support_notes` - Support notes'+ ),enabled: zod.boolean().optional()@@ -1048,6 +1061,19 @@ export const SignalsScoutConfigCreateBody = /* @__PURE__ */ zod.describe("Extra write access granted to this one scout, as scope strings. The grantable set is `alert:write`, `annotation:write`, `customer_task:write`, `dashboard:write`, `hog_flow_proposal:write`, `insight:write`, `llm_skill:write`, `replay_scanner:write`, `warehouse_table:write`, `warehouse_view:write`. Empty (the default) means the scout reads the project and writes only what every scout may write: notebooks, its findings, and its own memory. Each scope is project-wide and object-level, so a scout holding `dashboard:write` can update or delete any dashboard in the project, not only ones it made. Grant only what this scout maintains. Only the person the scout's runs act as (whoever authored it) or a project admin can set it, and a scoped API key must itself carry each scope it grants. A dry run (`emit=false`) never holds the grant. Applies from the scout's next run."),+ allowed_mcp_tools: zod+ .array(zod.string())+ .nullish()+ .describe(+ 'Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.'+ ),+ tool_preset: zod+ .enum(['read_only', 'support_notes'])+ .describe('\* `read_only` - Read only\n\* `support_notes` - Support notes')+ .optional()+ .describe(+ 'Expand this named preset into a saved tool list. Later preset changes do not alter the saved list. Send this field or allowed_mcp_tools, never both. Requires the scouts-tool-access feature flag.\n\n\* `read_only` - Read only\n\* `support_notes` - Support notes'+ ),enabled: zod.boolean().optional().describe('Whether this scout runs on its schedule. Defaults to true.'),emit: zod.boolean()@@ -1354,6 +1380,19 @@ export const SignalsScoutConfigUpdateBody = /* @__PURE__ */ zod.describe("Optional id of the canonical scout suggestion this request turns on. It records that the scout came from that suggestion. An id this project's batch does not hold is ignored."),+ allowed_mcp_tools: zod+ .array(zod.string())+ .nullish()+ .describe(+ 'Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.'+ ),+ tool_preset: zod+ .enum(['read_only', 'support_notes'])+ .describe('\* `read_only` - Read only\n\* `support_notes` - Support notes')+ .optional()+ .describe(+ 'Expand this named preset into a saved tool list. Later preset changes do not alter the saved list. Send this field or allowed_mcp_tools, never both. Requires the scouts-tool-access feature flag.\n\n\* `read_only` - Read only\n\* `support_notes` - Support notes'+ ),}).describe('Editable display name, schedule, enablement, and emit posture for one scout config.')diff --git a/products/signals/frontend/inbox/__mocks__/scoutConfigs.ts b/products/signals/frontend/inbox/__mocks__/scoutConfigs.tsindex 8020c0f69bd1..fc2bb97eee9b 100644--- a/products/signals/frontend/inbox/__mocks__/scoutConfigs.ts+++ b/products/signals/frontend/inbox/__mocks__/scoutConfigs.ts@@ -55,6 +55,8 @@ function makeMockScout(overrides: MockScoutOverrides): SignalScoutConfigApi {tags: [],mcp_gateway_server_ids: [],write_scopes: [],+ allowed_mcp_tools: null,+ tool_preset: null,source_product: null,source_id: null,created_at: '2026-06-11T09:00:00Z',diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutCadenceLabel.test.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutCadenceLabel.test.tsxindex 5fb3e1eb2162..c406e853490c 100644--- a/products/signals/frontend/inbox/components/config/scouts/ScoutCadenceLabel.test.tsx+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutCadenceLabel.test.tsx@@ -40,6 +40,8 @@ const config: SignalScoutConfigApi = {created_at: '2026-07-21T00:00:00Z',updated_at: '2026-07-21T00:00:00Z',write_scopes: [],+ allowed_mcp_tools: null,+ tool_preset: null,}describe('ScoutCadenceLabel', () => {diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutConfigControls.test.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutConfigControls.test.tsxindex dcab0a3d95a2..b33d85b46ba9 100644--- a/products/signals/frontend/inbox/components/config/scouts/ScoutConfigControls.test.tsx+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutConfigControls.test.tsx@@ -31,6 +31,8 @@ const config: SignalScoutConfigApi = {structured_output_schema: null,mcp_gateway_server_ids: [],write_scopes: [],+ allowed_mcp_tools: null,+ tool_preset: null,last_run_at: null,consecutive_failure_count: 0,status_changed_at: null,diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutNextRunLabel.test.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutNextRunLabel.test.tsxindex 621327d55579..9034ef22a50e 100644--- a/products/signals/frontend/inbox/components/config/scouts/ScoutNextRunLabel.test.tsx+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutNextRunLabel.test.tsx@@ -42,6 +42,8 @@ const config: SignalScoutConfigApi = {created_at: '2026-07-21T00:00:00Z',updated_at: '2026-07-21T00:00:00Z',write_scopes: [],+ allowed_mcp_tools: null,+ tool_preset: null,}describe('ScoutNextRunLabel', () => {diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutTags.stories.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutTags.stories.tsxindex f2dbe17d243a..f1091e3a648d 100644--- a/products/signals/frontend/inbox/components/config/scouts/ScoutTags.stories.tsx+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutTags.stories.tsx@@ -31,6 +31,8 @@ const config: SignalScoutConfigApi = {structured_output_schema: null,mcp_gateway_server_ids: [],write_scopes: [],+ allowed_mcp_tools: null,+ tool_preset: null,network_access: 'trusted',model: null,last_run_at: null,diff --git a/products/signals/frontend/inbox/components/config/scouts/ScoutWriteAccessSection.test.tsx b/products/signals/frontend/inbox/components/config/scouts/ScoutWriteAccessSection.test.tsxindex a5eb34e7e596..43907988f239 100644--- a/products/signals/frontend/inbox/components/config/scouts/ScoutWriteAccessSection.test.tsx+++ b/products/signals/frontend/inbox/components/config/scouts/ScoutWriteAccessSection.test.tsx@@ -27,6 +27,8 @@ const CONFIG: SignalScoutConfigApi = {structured_output_schema: null,mcp_gateway_server_ids: [],write_scopes: [],+ allowed_mcp_tools: null,+ tool_preset: null,last_run_at: null,consecutive_failure_count: 0,status_changed_at: null,diff --git a/products/signals/frontend/inbox/components/config/scouts/trials/scoutTrialsFixtures.ts b/products/signals/frontend/inbox/components/config/scouts/trials/scoutTrialsFixtures.tsindex 97f2a3008b8f..41e1b0720da9 100644--- a/products/signals/frontend/inbox/components/config/scouts/trials/scoutTrialsFixtures.ts+++ b/products/signals/frontend/inbox/components/config/scouts/trials/scoutTrialsFixtures.ts@@ -38,6 +38,8 @@ export const trialFixtureConfig: SignalScoutConfigApi = {tags: [],mcp_gateway_server_ids: [],write_scopes: [],+ allowed_mcp_tools: null,+ tool_preset: null,source_product: null,source_id: null,created_at: '2026-01-01T09:00:00Z',diff --git a/products/signals/frontend/inbox/logics/scoutCreateModalLogic.test.ts b/products/signals/frontend/inbox/logics/scoutCreateModalLogic.test.tsindex 289219d8dd1f..0eafc6f3bca2 100644--- a/products/signals/frontend/inbox/logics/scoutCreateModalLogic.test.ts+++ b/products/signals/frontend/inbox/logics/scoutCreateModalLogic.test.ts@@ -54,6 +54,8 @@ const CREATED_SCOUT: SignalScoutCreateResponseApi = {mcp_gateway_server_ids: [],repositories: [],write_scopes: [],+ allowed_mcp_tools: null,+ tool_preset: null,last_run_at: null,consecutive_failure_count: 0,status_changed_at: null,diff --git a/products/signals/frontend/inbox/logics/scoutFleetLogic.test.ts b/products/signals/frontend/inbox/logics/scoutFleetLogic.test.tsindex c84b104a3d76..2d1fe5e20000 100644--- a/products/signals/frontend/inbox/logics/scoutFleetLogic.test.ts+++ b/products/signals/frontend/inbox/logics/scoutFleetLogic.test.ts@@ -81,6 +81,8 @@ const BASE_CONFIG: SignalScoutConfigApi = {structured_output_schema: null,mcp_gateway_server_ids: [],write_scopes: [],+ allowed_mcp_tools: null,+ tool_preset: null,last_run_at: null,consecutive_failure_count: 0,status_changed_at: null,diff --git a/products/signals/frontend/inbox/logics/scoutSuggestionsLogic.test.ts b/products/signals/frontend/inbox/logics/scoutSuggestionsLogic.test.tsindex b2144b113469..654bb0301427 100644--- a/products/signals/frontend/inbox/logics/scoutSuggestionsLogic.test.ts+++ b/products/signals/frontend/inbox/logics/scoutSuggestionsLogic.test.ts@@ -110,6 +110,8 @@ const CONFIG: SignalScoutConfigApi = {structured_output_schema: null,mcp_gateway_server_ids: [],write_scopes: [],+ allowed_mcp_tools: null,+ tool_preset: null,last_run_at: null,consecutive_failure_count: 0,status_changed_at: null,diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex 1185823ba169..66ec2e3cfcd0 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -2830,6 +2830,21 @@"readOnlyHint": true}},+ "conversations-tickets-notes-create": {+ "description": "Add a private note to a support ticket. The note is visible to your team only and is never sent to the customer; this tool has no privacy option. Use it to leave findings where the support engineer works. To reply to the customer, use conversations-tickets-reply-create instead. To change a note later, use conversations-tickets-notes-partial-update. An identical note posted again within a short window returns the original note instead of adding a second one. Returns the note as it appears in the thread.",+ "category": "Conversations",+ "feature": "conversations",+ "summary": "Add private note to support ticket",+ "title": "Add private note to support ticket",+ "required_scopes": ["ticket:write"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": false,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "scouts-tool-access"+ },"conversations-tickets-notes-destroy": {"description": "Soft-delete a private note on a support ticket. Only private notes authored by the calling user can be deleted. Customer-facing replies cannot be deleted. Message IDs come from conversations-tickets-messages-retrieve. Deleting another user's note or an AI-authored note returns 403 with error_type not_note_author. Deleting a public reply returns 400 with error_type not_private_note. A missing or already-deleted note returns 404 with error_type note_not_found.","category": "Conversations",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex 28d341f3aa7e..1cc1a43af03a 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -2845,6 +2845,21 @@"readOnlyHint": true}},+ "conversations-tickets-notes-create": {+ "description": "Add a private note to a support ticket. The note is visible to your team only and is never sent to the customer; this tool has no privacy option. Use it to leave findings where the support engineer works. To reply to the customer, use conversations-tickets-reply-create instead. To change a note later, use conversations-tickets-notes-partial-update. An identical note posted again within a short window returns the original note instead of adding a second one. Returns the note as it appears in the thread.",+ "category": "Conversations",+ "feature": "conversations",+ "summary": "Add private note to support ticket",+ "title": "Add private note to support ticket",+ "required_scopes": ["ticket:write"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": false,+ "openWorldHint": true,+ "readOnlyHint": false+ },+ "feature_flag": "scouts-tool-access"+ },"conversations-tickets-notes-destroy": {"description": "Soft-delete a private note on a support ticket. Only private notes authored by the calling user can be deleted. Customer-facing replies cannot be deleted. Message IDs come from conversations-tickets-messages-retrieve. Deleting another user's note or an AI-authored note returns 403 with error_type not_note_author. Deleting a public reply returns 400 with error_type not_private_note. A missing or already-deleted note returns 404 with error_type note_not_found.","category": "Conversations",diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 094a3e0e8af9..c40c3f1443e0 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -83545,6 +83545,18 @@ export namespace Schemas {Full: 'full',} as const;+ /**+ * * `read_only` - Read only+ * * `support_notes` - Support notes+ */+ export type ToolPresetEnum = typeof ToolPresetEnum[keyof typeof ToolPresetEnum];+++ export const ToolPresetEnum = {+ ReadOnly: 'read_only',+ SupportNotes: 'support_notes',+ } as const;+/*** Editable display name, schedule, enablement, and emit posture for one scout config.*/@@ -83616,6 +83628,16 @@ export namespace Schemas {* @maxLength 64*/suggestion_id?: string;+ /**+ * Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.+ * @nullable+ */+ allowed_mcp_tools?: string[] | null;+ /** Expand this named preset into a saved tool list. Later preset changes do not alter the saved list. Send this field or allowed_mcp_tools, never both. Requires the scouts-tool-access feature flag.+ *+ * * `read_only` - Read only+ * * `support_notes` - Support notes */+ tool_preset?: ToolPresetEnum;}/**@@ -96677,6 +96699,16 @@ export namespace Schemas {* @maxItems 10*/write_scopes?: string[];+ /**+ * Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.+ * @nullable+ */+ allowed_mcp_tools?: string[] | null;+ /** Expand this named preset into a saved tool list. Later preset changes do not alter the saved list. Send this field or allowed_mcp_tools, never both. Requires the scouts-tool-access feature flag.+ *+ * * `read_only` - Read only+ * * `support_notes` - Support notes */+ tool_preset?: ToolPresetEnum;/** Whether this scout runs on its schedule. Defaults to true. */enabled?: boolean;/** Whether the scout writes findings to the inbox. False = dry-run: it runs and logs but emits nothing. Defaults to true. */@@ -96932,6 +96964,16 @@ export namespace Schemas {* @maxItems 10*/readonly write_scopes: readonly string[];+ /**+ * Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.+ * @nullable+ */+ readonly allowed_mcp_tools: readonly string[] | null;+ /**+ * Preset used to select the saved tool list, custom for an explicit list, or null when unrestricted.+ * @nullable+ */+ readonly tool_preset: string | null;/*** When the coordinator last dispatched this scout. Null if it has never run.* @nullable@@ -97993,12 +98035,23 @@ export namespace Schemas {feature_entitlement: string | null;}+ export interface ScoutToolPreset {+ /** Preset identifier accepted when saving a scout config. */+ name: string;+ /** Human-readable preset name. */+ label: string;+ /** Exact tool names expanded on save. A preset with non-holdable tools cannot be saved. */+ tools: string[];+ }+/*** The MCP tool catalogue, with the scout scope postures to read it against.*/export interface ScoutToolCatalogue {/** Every catalogued MCP tool, ordered by name. Tools that a successor has replaced are left out. */tools: ScoutToolCatalogueEntry[];+ /** Tool selections expanded and validated on save. */+ tool_presets: ScoutToolPreset[];/** The scope presets a scout run can be dispatched with, and the scopes each one resolves to. */presets: ScoutScopePreset[];/** The write scopes a person can grant to one scout from its settings. A scope outside this set can never be added to a scout's token. */@@ -99780,6 +99833,16 @@ export namespace Schemas {* @maxItems 10*/write_scopes?: string[];+ /**+ * Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.+ * @nullable+ */+ allowed_mcp_tools?: string[] | null;+ /** Expand this named preset into a saved tool list. Later preset changes do not alter the saved list. Send this field or allowed_mcp_tools, never both. Requires the scouts-tool-access feature flag.+ *+ * * `read_only` - Read only+ * * `support_notes` - Support notes */+ tool_preset?: ToolPresetEnum;/** Whether this scout runs on its schedule. Defaults to true. */enabled?: boolean;/** Whether the scout writes findings to the inbox. False = dry-run: it runs and logs but emits nothing. Defaults to true. */diff --git a/services/mcp/src/generated/conversations/api.ts b/services/mcp/src/generated/conversations/api.tsindex 744d7a7b36a0..375f12da2ab7 100644--- a/services/mcp/src/generated/conversations/api.ts+++ b/services/mcp/src/generated/conversations/api.ts@@ -3,7 +3,7 @@* MCP service uses these Zod schemas for generated tool handlers.* To regenerate: hogli build:openapi*- * PostHog API - MCP 11 enabled ops+ * PostHog API - MCP 12 enabled ops* OpenAPI spec version: 1.0.0*/import * as zod from 'zod'@@ -215,6 +215,38 @@ export const ConversationsTicketsMessagesListQueryParams = () => zod.object({offset: zod.number().optional().describe('The initial index from which to return the results.'),})+/**+ * Add a private note to a ticket.+ *+ * The note is visible to your team only. The request has no privacy field, so this+ * endpoint never sends anything to the customer.+ */+export const ConversationsTicketsNotesCreateParams = () => zod.object({+ id: zod.string().describe("The ticket's UUID or its numeric ticket number."),+ 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 conversationsTicketsNotesCreateBodyMessageMax = 5000++export const ConversationsTicketsNotesCreateBody = () => zod+ .object({+ message: zod+ .string()+ .max(conversationsTicketsNotesCreateBodyMessageMax)+ .describe(+ 'Note content in markdown. The note is visible to your team only and is never sent to the customer.'+ ),+ rich_content: zod+ .unknown()+ .optional()+ .describe('Optional TipTap rich content JSON for the note. Omit it to show the markdown message.'),+ })+ .describe('Payload for adding a private note to a ticket. It has no privacy field: the note is always private.')+/*** Update a private note on a ticket.*diff --git a/services/mcp/src/generated/replay_vision/api.ts b/services/mcp/src/generated/replay_vision/api.tsindex da096e7eb207..dfe55b09d3c5 100644--- a/services/mcp/src/generated/replay_vision/api.ts+++ b/services/mcp/src/generated/replay_vision/api.ts@@ -1748,6 +1748,19 @@ export const VisionScannersScoutsCreateBody = () => zod.describe("Extra write access granted to this one scout, as scope strings. The grantable set is `alert:write`, `annotation:write`, `customer_task:write`, `dashboard:write`, `hog_flow_proposal:write`, `insight:write`, `llm_skill:write`, `replay_scanner:write`, `warehouse_table:write`, `warehouse_view:write`. Empty (the default) means the scout reads the project and writes only what every scout may write: notebooks, its findings, and its own memory. Each scope is project-wide and object-level, so a scout holding `dashboard:write` can update or delete any dashboard in the project, not only ones it made. Grant only what this scout maintains. Only the person the scout's runs act as (whoever authored it) or a project admin can set it, and a scoped API key must itself carry each scope it grants. A dry run (`emit=false`) never holds the grant. Applies from the scout's next run."),+ allowed_mcp_tools: zod+ .array(zod.string())+ .nullish()+ .describe(+ 'Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.'+ ),+ tool_preset: zod+ .enum(['read_only', 'support_notes'])+ .describe('\* `read_only` - Read only\n\* `support_notes` - Support notes')+ .optional()+ .describe(+ 'Expand this named preset into a saved tool list. Later preset changes do not alter the saved list. Send this field or allowed_mcp_tools, never both. Requires the scouts-tool-access feature flag.\n\n\* `read_only` - Read only\n\* `support_notes` - Support notes'+ ),enabled: zod.boolean().optional()diff --git a/services/mcp/src/generated/signals/api.ts b/services/mcp/src/generated/signals/api.tsindex 13b7c478c2c9..09d0f9ad3307 100644--- a/services/mcp/src/generated/signals/api.ts+++ b/services/mcp/src/generated/signals/api.ts@@ -878,6 +878,19 @@ export const SignalsScoutCreateBody = () => zod.describe("Extra write access granted to this one scout, as scope strings. The grantable set is `alert:write`, `annotation:write`, `customer_task:write`, `dashboard:write`, `hog_flow_proposal:write`, `insight:write`, `llm_skill:write`, `replay_scanner:write`, `warehouse_table:write`, `warehouse_view:write`. Empty (the default) means the scout reads the project and writes only what every scout may write: notebooks, its findings, and its own memory. Each scope is project-wide and object-level, so a scout holding `dashboard:write` can update or delete any dashboard in the project, not only ones it made. Grant only what this scout maintains. Only the person the scout's runs act as (whoever authored it) or a project admin can set it, and a scoped API key must itself carry each scope it grants. A dry run (`emit=false`) never holds the grant. Applies from the scout's next run."),+ allowed_mcp_tools: zod+ .array(zod.string())+ .nullish()+ .describe(+ 'Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.'+ ),+ tool_preset: zod+ .enum(['read_only', 'support_notes'])+ .describe('\* `read_only` - Read only\n\* `support_notes` - Support notes')+ .optional()+ .describe(+ 'Expand this named preset into a saved tool list. Later preset changes do not alter the saved list. Send this field or allowed_mcp_tools, never both. Requires the scouts-tool-access feature flag.\n\n\* `read_only` - Read only\n\* `support_notes` - Support notes'+ ),enabled: zod.boolean().optional()@@ -1106,6 +1119,19 @@ export const SignalsScoutConfigCreateBody = () => zod.describe("Extra write access granted to this one scout, as scope strings. The grantable set is `alert:write`, `annotation:write`, `customer_task:write`, `dashboard:write`, `hog_flow_proposal:write`, `insight:write`, `llm_skill:write`, `replay_scanner:write`, `warehouse_table:write`, `warehouse_view:write`. Empty (the default) means the scout reads the project and writes only what every scout may write: notebooks, its findings, and its own memory. Each scope is project-wide and object-level, so a scout holding `dashboard:write` can update or delete any dashboard in the project, not only ones it made. Grant only what this scout maintains. Only the person the scout's runs act as (whoever authored it) or a project admin can set it, and a scoped API key must itself carry each scope it grants. A dry run (`emit=false`) never holds the grant. Applies from the scout's next run."),+ allowed_mcp_tools: zod+ .array(zod.string())+ .nullish()+ .describe(+ 'Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.'+ ),+ tool_preset: zod+ .enum(['read_only', 'support_notes'])+ .describe('\* `read_only` - Read only\n\* `support_notes` - Support notes')+ .optional()+ .describe(+ 'Expand this named preset into a saved tool list. Later preset changes do not alter the saved list. Send this field or allowed_mcp_tools, never both. Requires the scouts-tool-access feature flag.\n\n\* `read_only` - Read only\n\* `support_notes` - Support notes'+ ),enabled: zod.boolean().optional().describe('Whether this scout runs on its schedule. Defaults to true.'),emit: zod.boolean()@@ -1421,6 +1447,19 @@ export const SignalsScoutConfigUpdateBody = () => zod.describe("Optional id of the canonical scout suggestion this request turns on. It records that the scout came from that suggestion. An id this project's batch does not hold is ignored."),+ allowed_mcp_tools: zod+ .array(zod.string())+ .nullish()+ .describe(+ 'Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag.'+ ),+ tool_preset: zod+ .enum(['read_only', 'support_notes'])+ .describe('\* `read_only` - Read only\n\* `support_notes` - Support notes')+ .optional()+ .describe(+ 'Expand this named preset into a saved tool list. Later preset changes do not alter the saved list. Send this field or allowed_mcp_tools, never both. Requires the scouts-tool-access feature flag.\n\n\* `read_only` - Read only\n\* `support_notes` - Support notes'+ ),}).describe('Editable display name, schedule, enablement, and emit posture for one scout config.')diff --git a/services/mcp/src/tools/generated/conversations.ts b/services/mcp/src/tools/generated/conversations.tsindex 0b077456b78e..66e11748e6dd 100644--- a/services/mcp/src/tools/generated/conversations.ts+++ b/services/mcp/src/tools/generated/conversations.ts@@ -104,6 +104,38 @@ const conversationsTicketsMessagesRetrieve = (): ToolBase<},})+const ConversationsTicketsNotesCreateSchema = () => {+ const ConversationsTicketsNotesCreateBody = orvalSchemas.ConversationsTicketsNotesCreateBody()+ const ConversationsTicketsNotesCreateParams = orvalSchemas.ConversationsTicketsNotesCreateParams()+ return ConversationsTicketsNotesCreateParams.omit({ project_id: true }).extend(+ ConversationsTicketsNotesCreateBody.shape+ )+}++const conversationsTicketsNotesCreate = (): ToolBase<+ ReturnType<typeof ConversationsTicketsNotesCreateSchema>,+ Schemas.TicketMessage+> => ({+ name: 'conversations-tickets-notes-create',+ schema: ConversationsTicketsNotesCreateSchema(),+ handler: async (context: Context, params: z.infer<ReturnType<typeof ConversationsTicketsNotesCreateSchema>>) => {+ const projectId = await context.stateManager.getProjectId()+ const body: Record<string, unknown> = {}+ if (params.message !== undefined) {+ body['message'] = params.message+ }+ if (params.rich_content !== undefined) {+ body['rich_content'] = params.rich_content+ }+ const result = await context.api.request<Schemas.TicketMessage>({+ method: 'POST',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/conversations/tickets/${encodeURIComponent(String(params.id))}/notes/`,+ body,+ })+ return result+ },+})+const ConversationsTicketsNotesDestroySchema = () => {const ConversationsTicketsNotesDestroyParams = orvalSchemas.ConversationsTicketsNotesDestroyParams()return ConversationsTicketsNotesDestroyParams.omit({ project_id: true })@@ -437,6 +469,7 @@ const conversationsViewsUpdate = (): ToolBase<export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {'conversations-tickets-list': conversationsTicketsList,'conversations-tickets-messages-retrieve': conversationsTicketsMessagesRetrieve,+ 'conversations-tickets-notes-create': conversationsTicketsNotesCreate,'conversations-tickets-notes-destroy': conversationsTicketsNotesDestroy,'conversations-tickets-notes-partial-update': conversationsTicketsNotesPartialUpdate,'conversations-tickets-reply-create': conversationsTicketsReplyCreate,diff --git a/services/mcp/src/tools/generated/signals.ts b/services/mcp/src/tools/generated/signals.tsindex c826442f6ba8..3422fe8228e3 100644--- a/services/mcp/src/tools/generated/signals.ts+++ b/services/mcp/src/tools/generated/signals.ts@@ -852,6 +852,12 @@ const scoutConfigCreate = (): ToolBase<ReturnType<typeof ScoutConfigCreateSchemaif (params.write_scopes !== undefined) {body['write_scopes'] = params.write_scopes}+ if (params.allowed_mcp_tools !== undefined) {+ body['allowed_mcp_tools'] = params.allowed_mcp_tools+ }+ if (params.tool_preset !== undefined) {+ body['tool_preset'] = params.tool_preset+ }if (params.enabled !== undefined) {body['enabled'] = params.enabled}@@ -1015,6 +1021,12 @@ const scoutConfigUpdate = (): ToolBase<if (params.suggestion_id !== undefined) {body['suggestion_id'] = params.suggestion_id}+ if (params.allowed_mcp_tools !== undefined) {+ body['allowed_mcp_tools'] = params.allowed_mcp_tools+ }+ if (params.tool_preset !== undefined) {+ body['tool_preset'] = params.tool_preset+ }const result = await context.api.request<Schemas.SignalScoutConfig>({method: 'PATCH',path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/scout/configs/${encodeURIComponent(String(params.id))}/`,@@ -1916,6 +1928,12 @@ const signalsScoutConfigCreate = (): ToolBase<if (params.write_scopes !== undefined) {body['write_scopes'] = params.write_scopes}+ if (params.allowed_mcp_tools !== undefined) {+ body['allowed_mcp_tools'] = params.allowed_mcp_tools+ }+ if (params.tool_preset !== undefined) {+ body['tool_preset'] = params.tool_preset+ }if (params.enabled !== undefined) {body['enabled'] = params.enabled}@@ -2079,6 +2097,12 @@ const signalsScoutConfigUpdate = (): ToolBase<if (params.suggestion_id !== undefined) {body['suggestion_id'] = params.suggestion_id}+ if (params.allowed_mcp_tools !== undefined) {+ body['allowed_mcp_tools'] = params.allowed_mcp_tools+ }+ if (params.tool_preset !== undefined) {+ body['tool_preset'] = params.tool_preset+ }const result = await context.api.request<Schemas.SignalScoutConfig>({method: 'PATCH',path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/scout/configs/${encodeURIComponent(String(params.id))}/`,diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/conversations-tickets-notes-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/conversations-tickets-notes-create.jsonnew file mode 100644index 000000000000..f4cc28a4e694--- /dev/null+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/conversations-tickets-notes-create.json@@ -0,0 +1,19 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "properties": {+ "id": {+ "description": "The ticket's UUID or its numeric ticket number.",+ "type": "string"+ },+ "message": {+ "description": "Note content in markdown. The note is visible to your team only and is never sent to the customer.",+ "maxLength": 5000,+ "type": "string"+ },+ "rich_content": {+ "description": "Optional TipTap rich content JSON for the note. Omit it to show the markdown message."+ }+ },+ "required": ["id", "message"],+ "type": "object"+}diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-create.jsonindex 40b237adfaee..b08dd13a54ba 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-create.json@@ -2,6 +2,20 @@"$schema": "https://json-schema.org/draft/2020-12/schema","description": "Request body for registering a scout config without waiting for the coordinator tick.\n\nUpsert keyed on `skill_name`: if the coordinator (or a concurrent caller) already\nregistered the row, the provided tunables are applied to it instead.","properties": {+ "allowed_mcp_tools": {+ "anyOf": [+ {+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ {+ "type": "null"+ }+ ],+ "description": "Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag."+ },"auto_pause_exempt": {"description": "Exempt this scout from the inactivity pause, which otherwise switches off a scout that goes a fortnight without surfacing anything anyone engages with. Set it on watchdog scouts whose value is staying quiet. Defaults to false.","type": "boolean"@@ -177,6 +191,11 @@"maxItems": 10,"type": "array"},+ "tool_preset": {+ "description": "Expand this named preset into a saved tool list. Later preset changes do not alter the saved list. Send this field or allowed_mcp_tools, never both. Requires the scouts-tool-access feature flag.\n\n* `read_only` - Read only\n* `support_notes` - Support notes",+ "enum": ["read_only", "support_notes"],+ "type": "string"+ },"write_scopes": {"description": "Extra write access granted to this one scout, as scope strings. The grantable set is `alert:write`, `annotation:write`, `customer_task:write`, `dashboard:write`, `hog_flow_proposal:write`, `insight:write`, `llm_skill:write`, `replay_scanner:write`, `warehouse_table:write`, `warehouse_view:write`. Empty (the default) means the scout reads the project and writes only what every scout may write: notebooks, its findings, and its own memory. Each scope is project-wide and object-level, so a scout holding `dashboard:write` can update or delete any dashboard in the project, not only ones it made. Grant only what this scout maintains. Only the person the scout's runs act as (whoever authored it) or a project admin can set it, and a scoped API key must itself carry each scope it grants. A dry run (`emit=false`) never holds the grant. Applies from the scout's next run.","items": {diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-update.jsonindex ff9811416593..2458ccd49c8a 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-config-update.json@@ -1,6 +1,20 @@{"$schema": "https://json-schema.org/draft/2020-12/schema","properties": {+ "allowed_mcp_tools": {+ "anyOf": [+ {+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ {+ "type": "null"+ }+ ],+ "description": "Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag."+ },"auto_pause_exempt": {"description": "Exempt this scout from the inactivity sweep, meaning both the `ignored` pause and the `no_output` quiet warning. Set it on watchdog scouts whose value is staying quiet.","type": "boolean"@@ -179,6 +193,11 @@"maxItems": 10,"type": "array"},+ "tool_preset": {+ "description": "Expand this named preset into a saved tool list. Later preset changes do not alter the saved list. Send this field or allowed_mcp_tools, never both. Requires the scouts-tool-access feature flag.\n\n* `read_only` - Read only\n* `support_notes` - Support notes",+ "enum": ["read_only", "support_notes"],+ "type": "string"+ },"write_scopes": {"description": "Extra write access granted to this one scout, as scope strings. The grantable set is `alert:write`, `annotation:write`, `customer_task:write`, `dashboard:write`, `hog_flow_proposal:write`, `insight:write`, `llm_skill:write`, `replay_scanner:write`, `warehouse_table:write`, `warehouse_view:write`. Empty (the default) means the scout reads the project and writes only what every scout may write: notebooks, its findings, and its own memory. Each scope is project-wide and object-level, so a scout holding `dashboard:write` can update or delete any dashboard in the project, not only ones it made. Grant only what this scout maintains. Only the person the scout's runs act as (whoever authored it) or a project admin can set it, and a scoped API key must itself carry each scope it grants. A dry run (`emit=false`) never holds the grant. Applies from the scout's next run.","items": {diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-create.jsonindex 92a3105a88a8..5dfaeb72a4c9 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/scout-create.json@@ -9,6 +9,20 @@"config": {"description": "Optional schedule, enablement, dry-run posture, and delivery settings. Defaults to an enabled, emitting scout on the daily interval with no external destination.","properties": {+ "allowed_mcp_tools": {+ "anyOf": [+ {+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ {+ "type": "null"+ }+ ],+ "description": "Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag."+ },"auto_pause_exempt": {"description": "Exempt this scout from the inactivity pause, which otherwise switches off a scout that goes a fortnight without surfacing anything anyone engages with. Set it on watchdog scouts whose value is staying quiet. Defaults to false.","type": "boolean"@@ -174,6 +188,11 @@"maxItems": 10,"type": "array"},+ "tool_preset": {+ "description": "Expand this named preset into a saved tool list. Later preset changes do not alter the saved list. Send this field or allowed_mcp_tools, never both. Requires the scouts-tool-access feature flag.\n\n* `read_only` - Read only\n* `support_notes` - Support notes",+ "enum": ["read_only", "support_notes"],+ "type": "string"+ },"write_scopes": {"description": "Extra write access granted to this one scout, as scope strings. The grantable set is `alert:write`, `annotation:write`, `customer_task:write`, `dashboard:write`, `hog_flow_proposal:write`, `insight:write`, `llm_skill:write`, `replay_scanner:write`, `warehouse_table:write`, `warehouse_view:write`. Empty (the default) means the scout reads the project and writes only what every scout may write: notebooks, its findings, and its own memory. Each scope is project-wide and object-level, so a scout holding `dashboard:write` can update or delete any dashboard in the project, not only ones it made. Grant only what this scout maintains. Only the person the scout's runs act as (whoever authored it) or a project admin can set it, and a scoped API key must itself carry each scope it grants. A dry run (`emit=false`) never holds the grant. Applies from the scout's next run.","items": {diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-create.jsonindex 40b237adfaee..b08dd13a54ba 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-create.json@@ -2,6 +2,20 @@"$schema": "https://json-schema.org/draft/2020-12/schema","description": "Request body for registering a scout config without waiting for the coordinator tick.\n\nUpsert keyed on `skill_name`: if the coordinator (or a concurrent caller) already\nregistered the row, the provided tunables are applied to it instead.","properties": {+ "allowed_mcp_tools": {+ "anyOf": [+ {+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ {+ "type": "null"+ }+ ],+ "description": "Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag."+ },"auto_pause_exempt": {"description": "Exempt this scout from the inactivity pause, which otherwise switches off a scout that goes a fortnight without surfacing anything anyone engages with. Set it on watchdog scouts whose value is staying quiet. Defaults to false.","type": "boolean"@@ -177,6 +191,11 @@"maxItems": 10,"type": "array"},+ "tool_preset": {+ "description": "Expand this named preset into a saved tool list. Later preset changes do not alter the saved list. Send this field or allowed_mcp_tools, never both. Requires the scouts-tool-access feature flag.\n\n* `read_only` - Read only\n* `support_notes` - Support notes",+ "enum": ["read_only", "support_notes"],+ "type": "string"+ },"write_scopes": {"description": "Extra write access granted to this one scout, as scope strings. The grantable set is `alert:write`, `annotation:write`, `customer_task:write`, `dashboard:write`, `hog_flow_proposal:write`, `insight:write`, `llm_skill:write`, `replay_scanner:write`, `warehouse_table:write`, `warehouse_view:write`. Empty (the default) means the scout reads the project and writes only what every scout may write: notebooks, its findings, and its own memory. Each scope is project-wide and object-level, so a scout holding `dashboard:write` can update or delete any dashboard in the project, not only ones it made. Grant only what this scout maintains. Only the person the scout's runs act as (whoever authored it) or a project admin can set it, and a scoped API key must itself carry each scope it grants. A dry run (`emit=false`) never holds the grant. Applies from the scout's next run.","items": {diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-update.jsonindex ff9811416593..2458ccd49c8a 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-config-update.json@@ -1,6 +1,20 @@{"$schema": "https://json-schema.org/draft/2020-12/schema","properties": {+ "allowed_mcp_tools": {+ "anyOf": [+ {+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ {+ "type": "null"+ }+ ],+ "description": "Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag."+ },"auto_pause_exempt": {"description": "Exempt this scout from the inactivity sweep, meaning both the `ignored` pause and the `no_output` quiet warning. Set it on watchdog scouts whose value is staying quiet.","type": "boolean"@@ -179,6 +193,11 @@"maxItems": 10,"type": "array"},+ "tool_preset": {+ "description": "Expand this named preset into a saved tool list. Later preset changes do not alter the saved list. Send this field or allowed_mcp_tools, never both. Requires the scouts-tool-access feature flag.\n\n* `read_only` - Read only\n* `support_notes` - Support notes",+ "enum": ["read_only", "support_notes"],+ "type": "string"+ },"write_scopes": {"description": "Extra write access granted to this one scout, as scope strings. The grantable set is `alert:write`, `annotation:write`, `customer_task:write`, `dashboard:write`, `hog_flow_proposal:write`, `insight:write`, `llm_skill:write`, `replay_scanner:write`, `warehouse_table:write`, `warehouse_view:write`. Empty (the default) means the scout reads the project and writes only what every scout may write: notebooks, its findings, and its own memory. Each scope is project-wide and object-level, so a scout holding `dashboard:write` can update or delete any dashboard in the project, not only ones it made. Grant only what this scout maintains. Only the person the scout's runs act as (whoever authored it) or a project admin can set it, and a scoped API key must itself carry each scope it grants. A dry run (`emit=false`) never holds the grant. Applies from the scout's next run.","items": {diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-scouts-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-scouts-create.jsonindex 52bae99b0866..d2d17039775a 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-scouts-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/vision-scanners-scouts-create.json@@ -8,6 +8,20 @@"config": {"description": "Optional schedule, enablement, dry-run posture, and delivery settings. Defaults to an enabled, emitting scout on the daily interval with no external destination.","properties": {+ "allowed_mcp_tools": {+ "anyOf": [+ {+ "items": {+ "type": "string"+ },+ "type": "array"+ },+ {+ "type": "null"+ }+ ],+ "description": "Exact MCP tool names selected for this scout, excluding its built-in run context tools. Null means no tool restriction; an empty list selects no additional tools. Write access is derived from selected write tools. Clearing to null preserves the last write scopes. Send this field or tool_preset, never both. Requires the scouts-tool-access feature flag."+ },"auto_pause_exempt": {"description": "Exempt this scout from the inactivity pause, which otherwise switches off a scout that goes a fortnight without surfacing anything anyone engages with. Set it on watchdog scouts whose value is staying quiet. Defaults to false.","type": "boolean"@@ -173,6 +187,11 @@"maxItems": 10,"type": "array"},+ "tool_preset": {+ "description": "Expand this named preset into a saved tool list. Later preset changes do not alter the saved list. Send this field or allowed_mcp_tools, never both. Requires the scouts-tool-access feature flag.\n\n* `read_only` - Read only\n* `support_notes` - Support notes",+ "enum": ["read_only", "support_notes"],+ "type": "string"+ },"write_scopes": {"description": "Extra write access granted to this one scout, as scope strings. The grantable set is `alert:write`, `annotation:write`, `customer_task:write`, `dashboard:write`, `hog_flow_proposal:write`, `insight:write`, `llm_skill:write`, `replay_scanner:write`, `warehouse_table:write`, `warehouse_view:write`. Empty (the default) means the scout reads the project and writes only what every scout may write: notebooks, its findings, and its own memory. Each scope is project-wide and object-level, so a scout holding `dashboard:write` can update or delete any dashboard in the project, not only ones it made. Grant only what this scout maintains. Only the person the scout's runs act as (whoever authored it) or a project admin can set it, and a scoped API key must itself carry each scope it grants. A dry run (`emit=false`) never holds the grant. Applies from the scout's next run.","items": {diff --git a/services/mcp/tests/unit/tool-filtering.test.ts b/services/mcp/tests/unit/tool-filtering.test.tsindex 4194696e7f80..ab60d6d08225 100644--- a/services/mcp/tests/unit/tool-filtering.test.ts+++ b/services/mcp/tests/unit/tool-filtering.test.ts@@ -1053,6 +1053,7 @@ describe('Tool Filtering - Feature Flags', () => {'signals-report-checks-replace','cross-project-dashboards','warehouse-suggestions',+ 'scouts-tool-access',]expect(allFlags).toEqual(expect.arrayContaining(branchFlags))// The flags branches add are asserted on the line above and held out of the list anddiff --git a/services/mcp/tests/unit/tool-schema-snapshots.test.ts b/services/mcp/tests/unit/tool-schema-snapshots.test.tsindex 1f38ca6d0991..affd908e5722 100644--- a/services/mcp/tests/unit/tool-schema-snapshots.test.ts+++ b/services/mcp/tests/unit/tool-schema-snapshots.test.ts@@ -101,6 +101,7 @@ async function loadSnapshotTools(): Promise<Tool<ZodObjectAny>[]> {'signals-report-checks-replace': true,'ai-observability-offline-evaluations': true,'warehouse-suggestions': true,+ 'scouts-tool-access': true,}return [...(await getToolsFromContext(createMockContext(), { featureFlags }))].sort((a, b) =>a.name.localeCompare(b.name)