Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions packages/mcp-core/src/api-client/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5401,12 +5401,10 @@ export class SentryApiService {
{
organizationSlug,
issueId,
eventId,
instruction = "",
instruction,
}: {
organizationSlug: string;
issueId: string;
eventId?: string;
instruction?: string;
},
opts?: RequestOptions,
Expand All @@ -5416,8 +5414,7 @@ export class SentryApiService {
{
method: "POST",
body: JSON.stringify({
event_id: eventId,
instruction,
user_context: instruction || undefined,
}),
},
opts,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,9 @@ describe("analyze_issue_with_seer", () => {
);
});

it("handles start autofix with instruction", async () => {
async function startNewAnalysis(instruction: string | undefined) {
let getCallCount = 0;
let requestBody: unknown;

mswServer.use(
http.get(
Expand All @@ -387,11 +388,7 @@ describe("analyze_issue_with_seer", () => {
http.post(
"https://sentry.io/api/0/organizations/sentry-mcp-evals/issues/CLOUDFLARE-MCP-NEW/autofix/",
async ({ request }) => {
const body = await request.json();
expect(body).toEqual({
event_id: undefined,
instruction: "Focus on memory leaks",
});
requestBody = await request.json();
return HttpResponse.json({
run_id: 123,
});
Expand All @@ -404,7 +401,7 @@ describe("analyze_issue_with_seer", () => {
organizationSlug: "sentry-mcp-evals",
regionUrl: null,
issueId: "CLOUDFLARE-MCP-NEW",
instruction: "Focus on memory leaks",
instruction,
},
{
constraints: {
Expand All @@ -419,12 +416,29 @@ describe("analyze_issue_with_seer", () => {
await vi.runAllTimersAsync();

const result = await promise;
return { result, requestBody };
}

it("sends the instruction to Seer as user_context", async () => {
const { result, requestBody } = await startNewAnalysis(
"Focus on memory leaks",
);

expect(requestBody).toEqual({ user_context: "Focus on memory leaks" });
expect(result).toContain("Starting new analysis...");
expect(result).toContain("Analysis started with Run ID: 123");
expect(result).toContain("## Analysis Complete");
});

it.each([undefined, ""])(
"omits user_context when the instruction is %j",
async (instruction) => {
const { requestBody } = await startNewAnalysis(instruction);

expect(requestBody).toEqual({});
},
);

it("returns unsupported message for metric issues without calling Seer", async () => {
let autofixRequests = 0;

Expand Down
Loading