: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): expose recent scout emissions as an MCP tool (#66830)
Andrew Maguireb5b024bf00bc
diff --git a/products/signals/backend/scout_harness/serializers.py b/products/signals/backend/scout_harness/serializers.pyindex c66aa2f95368..f7a8d6202dd5 100644--- a/products/signals/backend/scout_harness/serializers.py+++ b/products/signals/backend/scout_harness/serializers.py@@ -243,6 +243,41 @@ class ScoutRunIdsBatchRequestSerializer(serializers.Serializer):)+class RecentEmissionsQuerySerializer(serializers.Serializer):+ """Query parameters for `recent-emissions` — recent findings across every run on the team.++ The cross-run counterpart to the per-run `emissions` action: instead of resolving a list of+ run ids first, ask for the team's recent emitted findings directly, newest-first, optionally+ scoped to one scout or a time window. Pure Postgres — no ClickHouse round-trip.+ """++ date_from = serializers.DateTimeField(+ required=False,+ help_text="ISO-8601 inclusive lower bound on `emitted_at`. Omit to skip the lower bound.",+ )+ date_to = serializers.DateTimeField(+ required=False,+ help_text=(+ "ISO-8601 exclusive upper bound on `emitted_at`. Pass to walk back past the result "+ "cap on subsequent calls (cursor-style: set to the `emitted_at` of the oldest emission "+ "from the prior page)."+ ),+ )+ skill_name = serializers.CharField(+ required=False,+ help_text=(+ "Exact-match filter on the emitting scout's skill (e.g. `signals-scout-errors`). Narrows "+ "to findings one specialist surfaced; omit to span every scout on the team."+ ),+ )+ limit = serializers.IntegerField(+ required=False,+ min_value=1,+ max_value=200,+ help_text="Max rows to return (default 50, hard cap 200).",+ )++class SearchRecentRunsQuerySerializer(serializers.Serializer):"""Query parameters for `search-recent-runs`."""diff --git a/products/signals/backend/scout_harness/views.py b/products/signals/backend/scout_harness/views.pyindex d7843a52e6a3..65eb2163bb06 100644--- a/products/signals/backend/scout_harness/views.py+++ b/products/signals/backend/scout_harness/views.py@@ -73,6 +73,7 @@ from products.signals.backend.scout_harness.serializers import (ForgetResponseSerializer,ProjectProfileQuerySerializer,ProjectProfileSerializer,+ RecentEmissionsQuerySerializer,RememberRequestSerializer,ScoutEmissionReportLinkSerializer,ScoutMetadataSerializer,@@ -118,6 +119,12 @@ MAX_EMISSIONS_PER_RUN = 1000# payload, mirroring `MAX_EMISSIONS_PER_RUN` for the single-run path.MAX_EMISSIONS_PER_BATCH = 5000+# Page size for the cross-run `recent-emissions` action: the default when the caller omits `limit`,+# and the hard ceiling it's clamped to. Bounded so an agent asking "what has the fleet surfaced+# lately?" gets a useful window in one call without an unbounded scan; walk back via `date_to`.+DEFAULT_RECENT_EMISSIONS_LIMIT = 50+MAX_RECENT_EMISSIONS_LIMIT = 200+# `SignalScoutRunViewSet.lookup_field` is `run_id`, but the model's PK field is `id`, so# drf-spectacular can't derive the path-param type from the model and warns (fatal under# `--fail-on-warn`). Declare the param explicitly on every detail action instead.@@ -360,6 +367,49 @@ class SignalScoutRunViewSet(TeamAndOrgViewSetMixin, viewsets.GenericViewSet):)[:MAX_EMISSIONS_PER_RUN]return Response(SignalScoutEmissionSerializer(emissions, many=True).data)+ @validated_request(+ query_serializer=RecentEmissionsQuerySerializer,+ responses={+ 200: OpenApiResponse(+ response=SignalScoutEmissionSerializer(many=True),+ description="Recent emitted findings across every run on the team, newest first.",+ ),+ },+ summary="List recent emitted findings across all runs",+ description=(+ "Return the team's recently emitted scout findings across *every* run, newest first — the "+ "cross-run counterpart to the per-run `emissions` action. Each row carries its `run_id`, so "+ "you can regroup by run without first listing runs and fanning out one `emissions` call each. "+ "Pass `skill_name` to scope to a single scout, and `date_from` / `date_to` (a half-open window "+ "on `emitted_at`) to bound or paginate — set `date_to` to the oldest emission's `emitted_at` to "+ "walk back past the limit. Pure Postgres, no ClickHouse round-trip. Capped at "+ f"{MAX_RECENT_EMISSIONS_LIMIT} rows (default {DEFAULT_RECENT_EMISSIONS_LIMIT})."+ ),+ operation_id="signals_scout_runs_recent_emissions",+ )+ @action(+ detail=False,+ methods=["get"],+ url_path="emissions/recent",+ required_scopes=["signal_scout:read"],+ pagination_class=None,+ )+ def recent_emissions(self, request: Request, **kwargs) -> Response:+ validated = getattr(request, "validated_query_data", {}) or {}+ team_id = _canonical_team_id(self)+ limit = validated.get("limit") or DEFAULT_RECENT_EMISSIONS_LIMIT++ qs = SignalScoutEmission.objects.filter(team_id=team_id)+ if validated.get("date_from"):+ qs = qs.filter(emitted_at__gte=validated["date_from"])+ if validated.get("date_to"):+ qs = qs.filter(emitted_at__lt=validated["date_to"])+ if validated.get("skill_name"):+ qs = qs.filter(scout_run__skill_name=validated["skill_name"])++ emissions = qs.order_by("-emitted_at", "-id")[:limit]+ return Response(SignalScoutEmissionSerializer(emissions, many=True).data)+@extend_schema(parameters=[_RUN_ID_PATH_PARAMETER],responses={diff --git a/products/signals/backend/test/test_scout_harness_api.py b/products/signals/backend/test/test_scout_harness_api.pyindex 4fa675cf3a69..5f538d7e5267 100644--- a/products/signals/backend/test/test_scout_harness_api.py+++ b/products/signals/backend/test/test_scout_harness_api.py@@ -459,6 +459,71 @@ class TestScoutHarnessEmissionReportsBatchAPI(APIBaseTest):assert [row["finding_id"] for row in response.json()] == ["mine"]+class TestScoutHarnessRecentEmissionsAPI(APIBaseTest):+ def _url(self) -> str:+ return f"/api/projects/{self.team.id}/signals/scout/runs/emissions/recent/"++ def test_flattens_emissions_across_runs_newest_first_without_run_ids(self) -> None:+ # The cross-run reader: unlike the per-run `emissions` action (one run) and the batch action+ # (caller supplies run_ids), this returns the team's recent findings across every run in one+ # call, each row tagged with its own run_id. Guards that an agent can ask "what has the fleet+ # surfaced lately?" without first listing runs and fanning out.+ run_a = _make_run(self.team)+ run_b = _make_run(self.team)+ _make_emission(self.team, run_a, finding_id="a-old")+ _make_emission(self.team, run_b, finding_id="b-mid")+ _make_emission(self.team, run_a, finding_id="a-new")+ response = self.client.get(self._url())+ assert response.status_code == status.HTTP_200_OK+ body = response.json()+ assert [row["finding_id"] for row in body] == ["a-new", "b-mid", "a-old"]+ run_by_finding = {row["finding_id"]: row["run_id"] for row in body}+ assert run_by_finding["a-new"] == str(run_a.id)+ assert run_by_finding["b-mid"] == str(run_b.id)++ def test_does_not_leak_emissions_from_another_team(self) -> None:+ own_run = _make_run(self.team)+ _make_emission(self.team, own_run, finding_id="mine")+ other = Team.objects.create(organization=self.organization, name="Other")+ other_run = _make_run(other)+ _make_emission(other, other_run, finding_id="theirs")+ response = self.client.get(self._url())+ assert response.status_code == status.HTTP_200_OK+ assert [row["finding_id"] for row in response.json()] == ["mine"]++ def test_skill_name_filter_scopes_to_the_emitting_scout(self) -> None:+ # The filter walks the FK to the emitting run's skill (`scout_run__skill_name`) — a distinct+ # join path from the run-list's own-column filter, easy to break independently.+ errors_run = _make_run(self.team, skill_name="signals-scout-errors")+ llm_run = _make_run(self.team, skill_name="signals-scout-llm")+ _make_emission(self.team, errors_run, finding_id="err")+ _make_emission(self.team, llm_run, finding_id="llm")+ response = self.client.get(self._url(), data={"skill_name": "signals-scout-errors"})+ assert response.status_code == status.HTTP_200_OK+ assert [row["finding_id"] for row in response.json()] == ["err"]++ def test_limit_caps_the_page(self) -> None:+ run = _make_run(self.team)+ for i in range(3):+ _make_emission(self.team, run, finding_id=f"f-{i}")+ response = self.client.get(self._url(), data={"limit": 2})+ assert response.status_code == status.HTTP_200_OK+ assert len(response.json()) == 2++ def test_date_to_excludes_emissions_at_or_after_the_bound(self) -> None:+ # `date_to` is the exclusive upper bound that backs cursor pagination; guard the half-open+ # window so a caller can walk back without re-seeing the boundary row.+ run = _make_run(self.team)+ older = _make_emission(self.team, run, finding_id="older")+ newer = _make_emission(self.team, run, finding_id="newer")+ # emitted_at is auto_now_add, so pin distinct timestamps after the fact.+ SignalScoutEmission.objects.filter(id=older.id).update(emitted_at="2026-01-01T00:00:00Z")+ SignalScoutEmission.objects.filter(id=newer.id).update(emitted_at="2026-01-02T00:00:00Z")+ response = self.client.get(self._url(), data={"date_to": "2026-01-02T00:00:00Z"})+ assert response.status_code == status.HTTP_200_OK+ assert [row["finding_id"] for row in response.json()] == ["older"]++class TestScoutHarnessEmitFindingAPI(APIBaseTest):def setUp(self) -> None:super().setUp()diff --git a/products/signals/frontend/generated/api.schemas.ts b/products/signals/frontend/generated/api.schemas.tsindex 8cf09dab3cb8..e32a90d9efc2 100644--- a/products/signals/frontend/generated/api.schemas.ts+++ b/products/signals/frontend/generated/api.schemas.ts@@ -1814,6 +1814,28 @@ export type SignalsScoutRunsListParams = {text?: string}+export type SignalsScoutRunsRecentEmissionsParams = {+ /**+ * ISO-8601 inclusive lower bound on `emitted_at`. Omit to skip the lower bound.+ */+ date_from?: string+ /**+ * ISO-8601 exclusive upper bound on `emitted_at`. Pass to walk back past the result cap on subsequent calls (cursor-style: set to the `emitted_at` of the oldest emission from the prior page).+ */+ date_to?: string+ /**+ * Max rows to return (default 50, hard cap 200).+ * @minimum 1+ * @maximum 200+ */+ limit?: number+ /**+ * Exact-match filter on the emitting scout's skill (e.g. `signals-scout-errors`). Narrows to findings one specialist surfaced; omit to span every scout on the team.+ * @minLength 1+ */+ skill_name?: string+}+export type SignalsScoutScratchpadSearchParams = {/*** Truncate each entry's `content` to the first N characters (a preview). Omit for the full body. Ignored when `keys_only=true`.diff --git a/products/signals/frontend/generated/api.ts b/products/signals/frontend/generated/api.tsindex f260f48c51ad..135308e59fc2 100644--- a/products/signals/frontend/generated/api.ts+++ b/products/signals/frontend/generated/api.ts@@ -52,6 +52,7 @@ import type {SignalsReportsListParams,SignalsScoutProjectProfileGetParams,SignalsScoutRunsListParams,+ SignalsScoutRunsRecentEmissionsParams,SignalsScoutScratchpadSearchParams,SignalsSourceConfigsListParams,} from './api.schemas'@@ -693,6 +694,40 @@ export const signalsScoutRunsEmissionsBatch = async (})}+export const getSignalsScoutRunsRecentEmissionsUrl = (+ projectId: string,+ params?: SignalsScoutRunsRecentEmissionsParams+) => {+ const normalizedParams = new URLSearchParams()++ Object.entries(params || {}).forEach(([key, value]) => {+ if (value !== undefined) {+ normalizedParams.append(key, value === null ? 'null' : String(value))+ }+ })++ const stringifiedParams = normalizedParams.toString()++ return stringifiedParams.length > 0+ ? `/api/projects/${projectId}/signals/scout/runs/emissions/recent/?${stringifiedParams}`+ : `/api/projects/${projectId}/signals/scout/runs/emissions/recent/`+}++/**+ * Return the team's recently emitted scout findings across *every* run, newest first — the cross-run counterpart to the per-run `emissions` action. Each row carries its `run_id`, so you can regroup by run without first listing runs and fanning out one `emissions` call each. Pass `skill_name` to scope to a single scout, and `date_from` / `date_to` (a half-open window on `emitted_at`) to bound or paginate — set `date_to` to the oldest emission's `emitted_at` to walk back past the limit. Pure Postgres, no ClickHouse round-trip. Capped at 200 rows (default 50).+ * @summary List recent emitted findings across all runs+ */+export const signalsScoutRunsRecentEmissions = async (+ projectId: string,+ params?: SignalsScoutRunsRecentEmissionsParams,+ options?: RequestInit+): Promise<SignalScoutEmissionApi[]> => {+ return apiMutator<SignalScoutEmissionApi[]>(getSignalsScoutRunsRecentEmissionsUrl(projectId, params), {+ ...options,+ method: 'GET',+ })+}+export const getSignalsScoutRunsEmissionReportsBatchUrl = (projectId: string) => {return `/api/projects/${projectId}/signals/scout/runs/emissions/reports/batch/`}diff --git a/products/signals/mcp/tools.yaml b/products/signals/mcp/tools.yamlindex ec7760ea3dbf..e920a9d9e979 100644--- a/products/signals/mcp/tools.yaml+++ b/products/signals/mcp/tools.yaml@@ -532,6 +532,26 @@ tools:the run's `summary` (the primary dedupe key for runs that didn't emit findings). Pass `date_from` /`date_to` (ISO-8601, inclusive lower / exclusive upper bound on `created_at`) to scope to a window. Resultscapped at 100.+ signals-scout-runs-recent-emissions:+ operation: signals_scout_runs_recent_emissions+ enabled: true+ scopes:+ - signal_scout:read+ annotations:+ readOnly: true+ destructive: false+ idempotent: true+ list: true+ title: List recent emitted findings across all scout runs+ description: >+ Return the team's recently emitted scout findings across *every* `SignalScoutRun`, newest first — the+ cross-run counterpart to `signals-scout-runs-emissions-list` (which is scoped to one run). Each row carries+ its `run_id`, `description` (the finding text as surfaced), `weight`, `confidence`, `severity`, `tags`, and+ the deterministic `source_id` (`run:<run_id>:finding:<finding_id>`). Use this to answer "what has the fleet+ surfaced lately?" in one call instead of listing runs and fanning out an emissions request per run. Pass+ `skill_name` to scope to a single scout, and `date_from` / `date_to` (ISO-8601, inclusive lower / exclusive+ upper bound on `emitted_at`) to bound or paginate — set `date_to` to the oldest emission's `emitted_at` to+ walk back past the cap. Capped at 200 rows (default 50). Strictly team-scoped.signals-scout-runs-retrieve:operation: signals_scout_runs_retrieveenabled: truediff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex 3363c4dd2762..f1b453636687 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -6681,6 +6681,20 @@"readOnlyHint": true}},+ "signals-scout-runs-recent-emissions": {+ "description": "Return the team's recently emitted scout findings across *every* `SignalScoutRun`, newest first — the cross-run counterpart to `signals-scout-runs-emissions-list` (which is scoped to one run). Each row carries its `run_id`, `description` (the finding text as surfaced), `weight`, `confidence`, `severity`, `tags`, and the deterministic `source_id` (`run:<run_id>:finding:<finding_id>`). Use this to answer \"what has the fleet surfaced lately?\" in one call instead of listing runs and fanning out an emissions request per run. Pass `skill_name` to scope to a single scout, and `date_from` / `date_to` (ISO-8601, inclusive lower / exclusive upper bound on `emitted_at`) to bound or paginate — set `date_to` to the oldest emission's `emitted_at` to walk back past the cap. Capped at 200 rows (default 50). Strictly team-scoped.",+ "category": "Signals",+ "feature": "signals",+ "summary": "List recent emitted findings across all scout runs",+ "title": "List recent emitted findings across all scout runs",+ "required_scopes": ["signal_scout:read"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ }+ },"signals-scout-runs-retrieve": {"description": "Return the full `SignalScoutRun` row for the given `run_id`, including the agent's end-of-run `summary`, `emitted_count`, and `emitted_finding_ids`. Status, timestamps, `error` (full TaskRun error message), and the derived `failure_reason` flow from the linked `tasks.TaskRun`; emitted findings live as `Signal` rows queryable by `source_id = run:<run_id>:finding:<finding_id>` (one per id in `emitted_finding_ids`). Strictly team-scoped — a UUID belonging to another team returns 404.","category": "Signals",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex 4e9c19ec7408..d2809d2e36ff 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -7192,6 +7192,20 @@"readOnlyHint": true}},+ "signals-scout-runs-recent-emissions": {+ "description": "Return the team's recently emitted scout findings across *every* `SignalScoutRun`, newest first — the cross-run counterpart to `signals-scout-runs-emissions-list` (which is scoped to one run). Each row carries its `run_id`, `description` (the finding text as surfaced), `weight`, `confidence`, `severity`, `tags`, and the deterministic `source_id` (`run:<run_id>:finding:<finding_id>`). Use this to answer \"what has the fleet surfaced lately?\" in one call instead of listing runs and fanning out an emissions request per run. Pass `skill_name` to scope to a single scout, and `date_from` / `date_to` (ISO-8601, inclusive lower / exclusive upper bound on `emitted_at`) to bound or paginate — set `date_to` to the oldest emission's `emitted_at` to walk back past the cap. Capped at 200 rows (default 50). Strictly team-scoped.",+ "category": "Signals",+ "feature": "signals",+ "summary": "List recent emitted findings across all scout runs",+ "title": "List recent emitted findings across all scout runs",+ "required_scopes": ["signal_scout:read"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ }+ },"signals-scout-runs-retrieve": {"description": "Return the full `SignalScoutRun` row for the given `run_id`, including the agent's end-of-run `summary`, `emitted_count`, and `emitted_finding_ids`. Status, timestamps, `error` (full TaskRun error message), and the derived `failure_reason` flow from the linked `tasks.TaskRun`; emitted findings live as `Signal` rows queryable by `source_id = run:<run_id>:finding:<finding_id>` (one per id in `emitted_finding_ids`). Strictly team-scoped — a UUID belonging to another team returns 404.","category": "Signals",diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.tsindex 762f414d7691..a30edb6d473e 100644--- a/services/mcp/src/api/generated.ts+++ b/services/mcp/src/api/generated.ts@@ -65418,6 +65418,28 @@ export namespace Schemas {text?: string;};+ export type SignalsScoutRunsRecentEmissionsParams = {+ /**+ * ISO-8601 inclusive lower bound on `emitted_at`. Omit to skip the lower bound.+ */+ date_from?: string;+ /**+ * ISO-8601 exclusive upper bound on `emitted_at`. Pass to walk back past the result cap on subsequent calls (cursor-style: set to the `emitted_at` of the oldest emission from the prior page).+ */+ date_to?: string;+ /**+ * Max rows to return (default 50, hard cap 200).+ * @minimum 1+ * @maximum 200+ */+ limit?: number;+ /**+ * Exact-match filter on the emitting scout's skill (e.g. `signals-scout-errors`). Narrows to findings one specialist surfaced; omit to span every scout on the team.+ * @minLength 1+ */+ skill_name?: string;+ };+export type SignalsScoutScratchpadSearchParams = {/*** Truncate each entry's `content` to the first N characters (a preview). Omit for the full body. Ignored when `keys_only=true`.diff --git a/services/mcp/src/generated/signals/api.ts b/services/mcp/src/generated/signals/api.tsindex 5fca86db2dee..8462f96198c3 100644--- a/services/mcp/src/generated/signals/api.ts+++ b/services/mcp/src/generated/signals/api.ts@@ -3,7 +3,7 @@* MCP service uses these Zod schemas for generated tool handlers.* To regenerate: hogli build:openapi*- * PostHog API - MCP 29 enabled ops+ * PostHog API - MCP 30 enabled ops* OpenAPI spec version: 1.0.0*/import * as zod from 'zod'@@ -785,6 +785,46 @@ export const SignalsScoutEmitSignalBody = /* @__PURE__ */ zod}).describe('Request body for `emit-finding`. Run attribution is taken from the URL path.')+/**+ * Return the team's recently emitted scout findings across *every* run, newest first — the cross-run counterpart to the per-run `emissions` action. Each row carries its `run_id`, so you can regroup by run without first listing runs and fanning out one `emissions` call each. Pass `skill_name` to scope to a single scout, and `date_from` / `date_to` (a half-open window on `emitted_at`) to bound or paginate — set `date_to` to the oldest emission's `emitted_at` to walk back past the limit. Pure Postgres, no ClickHouse round-trip. Capped at 200 rows (default 50).+ * @summary List recent emitted findings across all runs+ */+export const SignalsScoutRunsRecentEmissionsParams = /* @__PURE__ */ zod.object({+ project_id: zod+ .string()+ .describe(+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."+ ),+})++export const signalsScoutRunsRecentEmissionsQueryLimitMax = 200++export const SignalsScoutRunsRecentEmissionsQueryParams = /* @__PURE__ */ zod.object({+ date_from: zod.iso+ .datetime({ offset: true })+ .optional()+ .describe('ISO-8601 inclusive lower bound on `emitted_at`. Omit to skip the lower bound.'),+ date_to: zod.iso+ .datetime({ offset: true })+ .optional()+ .describe(+ 'ISO-8601 exclusive upper bound on `emitted_at`. Pass to walk back past the result cap on subsequent calls (cursor-style: set to the `emitted_at` of the oldest emission from the prior page).'+ ),+ limit: zod+ .number()+ .min(1)+ .max(signalsScoutRunsRecentEmissionsQueryLimitMax)+ .optional()+ .describe('Max rows to return (default 50, hard cap 200).'),+ skill_name: zod+ .string()+ .min(1)+ .optional()+ .describe(+ "Exact-match filter on the emitting scout's skill (e.g. `signals-scout-errors`). Narrows to findings one specialist surfaced; omit to span every scout on the team."+ ),+})+/*** Return `SignalScratchpad` entries for this project, newest-first. ILIKE matches on `content` and `key`. `date_from` / `date_to` are a half-open window on `updated_at` (`>= date_from`, `< date_to`); pass `date_to` (the `updated_at` of the oldest entry seen) on subsequent calls to walk past the cap. Pass `keys_only=true` to scan keys without pulling entry bodies, or `content_max_chars` to cap each `content` to a preview — both keep a wide orientation scan from returning every entry's full prose. Results capped at 500.* @summary Search the scout scratchpaddiff --git a/services/mcp/src/tools/generated/signals.ts b/services/mcp/src/tools/generated/signals.tsindex 3c79929a462e..ea29d9a019b4 100644--- a/services/mcp/src/tools/generated/signals.ts+++ b/services/mcp/src/tools/generated/signals.ts@@ -29,6 +29,7 @@ import {SignalsScoutRunsEmissionReportsParams,SignalsScoutRunsEmissionsParams,SignalsScoutRunsListQueryParams,+ SignalsScoutRunsRecentEmissionsQueryParams,SignalsScoutRunsRetrieveParams,SignalsScoutScratchpadForgetBody,SignalsScoutScratchpadRememberBody,@@ -771,6 +772,30 @@ const signalsScoutRunsList = (): ToolBase<},})+const SignalsScoutRunsRecentEmissionsSchema = SignalsScoutRunsRecentEmissionsQueryParams++const signalsScoutRunsRecentEmissions = (): ToolBase<+ typeof SignalsScoutRunsRecentEmissionsSchema,+ WithPostHogUrl<Schemas.SignalScoutEmission[]>+> => ({+ name: 'signals-scout-runs-recent-emissions',+ schema: SignalsScoutRunsRecentEmissionsSchema,+ handler: async (context: Context, params: z.infer<typeof SignalsScoutRunsRecentEmissionsSchema>) => {+ const projectId = await context.stateManager.getProjectId()+ const result = await context.api.request<Schemas.SignalScoutEmission[]>({+ method: 'GET',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/signals/scout/runs/emissions/recent/`,+ query: {+ date_from: params.date_from,+ date_to: params.date_to,+ limit: params.limit,+ skill_name: params.skill_name,+ },+ })+ return await withPostHogUrl(context, result, '/inbox')+ },+})+const SignalsScoutRunsRetrieveSchema = SignalsScoutRunsRetrieveParams.omit({ project_id: true })const signalsScoutRunsRetrieve = (): ToolBase<typeof SignalsScoutRunsRetrieveSchema, Schemas.SignalScoutRunDetail> => ({@@ -890,6 +915,7 @@ export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {'signals-scout-runs-emission-reports': signalsScoutRunsEmissionReports,'signals-scout-runs-emissions-list': signalsScoutRunsEmissionsList,'signals-scout-runs-list': signalsScoutRunsList,+ 'signals-scout-runs-recent-emissions': signalsScoutRunsRecentEmissions,'signals-scout-runs-retrieve': signalsScoutRunsRetrieve,'signals-scout-scratchpad-forget': signalsScoutScratchpadForget,'signals-scout-scratchpad-remember': signalsScoutScratchpadRemember,diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-runs-recent-emissions.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-runs-recent-emissions.jsonnew file mode 100644index 000000000000..a1afd5de3ce3--- /dev/null+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/signals-scout-runs-recent-emissions.json@@ -0,0 +1,29 @@+{+ "$schema": "https://json-schema.org/draft/2020-12/schema",+ "properties": {+ "date_from": {+ "description": "ISO-8601 inclusive lower bound on `emitted_at`. Omit to skip the lower bound.",+ "format": "date-time",+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",+ "type": "string"+ },+ "date_to": {+ "description": "ISO-8601 exclusive upper bound on `emitted_at`. Pass to walk back past the result cap on subsequent calls (cursor-style: set to the `emitted_at` of the oldest emission from the prior page).",+ "format": "date-time",+ "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$",+ "type": "string"+ },+ "limit": {+ "description": "Max rows to return (default 50, hard cap 200).",+ "maximum": 200,+ "minimum": 1,+ "type": "number"+ },+ "skill_name": {+ "description": "Exact-match filter on the emitting scout's skill (e.g. `signals-scout-errors`). Narrows to findings one specialist surfaced; omit to span every scout on the team.",+ "minLength": 1,+ "type": "string"+ }+ },+ "type": "object"+}