Skip to content

Commit b6fa245

Browse files
betegonclaude
andcommitted
chore(search-events): tidy env-grounding changes
- Drop the unused `OrganizationEnvironment` type (only the list type is used). - Type `searchEventsAgent`'s `toolCalls` as `ToolCall[]` instead of `any[]`. - Trim the `buildSystemPromptWithEnvironments` doc comment. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 8f270d4 commit b6fa245

2 files changed

Lines changed: 9 additions & 11 deletions

File tree

‎packages/mcp-core/src/api-client/types.ts‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ import type {
9191
MonitorStatSchema,
9292
MonitorStatsSchema,
9393
OrganizationEnvironmentListSchema,
94-
OrganizationEnvironmentSchema,
9594
OrganizationListSchema,
9695
OrganizationSchema,
9796
ProfileChunkResponseSchema,
@@ -204,9 +203,6 @@ export type MonitorStats = z.infer<typeof MonitorStatsSchema>;
204203
export type UptimeMonitorList = z.infer<typeof UptimeMonitorListSchema>;
205204
export type UptimeCheckList = z.infer<typeof UptimeCheckListSchema>;
206205
export type EventAttachmentList = z.infer<typeof EventAttachmentListSchema>;
207-
export type OrganizationEnvironment = z.infer<
208-
typeof OrganizationEnvironmentSchema
209-
>;
210206
export type OrganizationEnvironmentList = z.infer<
211207
typeof OrganizationEnvironmentListSchema
212208
>;

‎packages/mcp-core/src/tools/support/search-events/agent.ts‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { z } from "zod";
22
import type { SentryApiService } from "../../../api-client";
3-
import { callEmbeddedAgent } from "../../../internal/agents/callEmbeddedAgent";
3+
import {
4+
callEmbeddedAgent,
5+
type ToolCall,
6+
} from "../../../internal/agents/callEmbeddedAgent";
47
import { createDatasetFieldsTool } from "../../../internal/agents/tools/dataset-fields";
58
import { createOtelLookupTool } from "../../../internal/agents/tools/otel-semantics";
69
import { createWhoamiTool } from "../../../internal/agents/tools/whoami";
@@ -100,11 +103,10 @@ const MAX_INLINE_ENVIRONMENTS = 100;
100103
/**
101104
* Append the organization's real environment names to the system prompt.
102105
*
103-
* Without this the model invents `environment` values (`":null"`, `".*"`,
104-
* `["production","staging","development"]`, `" "` …) that Sentry's validation
105-
* rejects, burning the step budget and producing no output — the single biggest
106-
* source of search_events failures. Grounding it in the real names lets it pick
107-
* a valid one or omit the field.
106+
* Without this the model invents `environment` values (e.g. `":null"`, `".*"`)
107+
* that Sentry rejects, burning the step budget and producing no output — the top
108+
* source of search_events failures. Grounding it lets the model pick a real one
109+
* or omit the field.
108110
*/
109111
export function buildSystemPromptWithEnvironments(
110112
base: string,
@@ -152,7 +154,7 @@ export async function searchEventsAgent(
152154
options: SearchEventsAgentOptions,
153155
): Promise<{
154156
result: z.output<typeof searchEventsAgentOutputSchema>;
155-
toolCalls: any[];
157+
toolCalls: ToolCall[];
156158
}> {
157159
// Provider check happens in callEmbeddedAgent via getAgentProvider()
158160
// Create tools pre-bound with the provided API service and organization

0 commit comments

Comments
 (0)