Skip to content
Draft
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: 7 additions & 0 deletions packages/mcp-core/src/tools/support/issue-linking/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,13 @@ describe("linkAppIssue", () => {
expect(searches).toBe(1);
});

it("says the App must be installed when the organization has no installation", async () => {
mockDiscovery({ slug: "other" });
await expect(linkAppIssue(api, params)).rejects.toThrow(
"The 'linear' Sentry App is not installed in organization 'example'",
);
});

it("requires a valid installed callback even for an existing association", async () => {
mockDiscovery({
links: [association],
Expand Down
6 changes: 5 additions & 1 deletion packages/mcp-core/src/tools/support/issue-linking/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,11 @@ export async function linkAppIssue(
(installation) =>
installation.app.slug === appSlug && installation.status === "installed",
);
if (installed.length !== 1)
if (installed.length === 0)
throw new UserInputError(
`The '${appSlug}' Sentry App is not installed in organization '${params.organizationSlug}', so Sentry cannot link this issue to it. Someone who can manage integrations must install it under Settings > Integrations in Sentry, then retry.`,
);
if (installed.length > 1)
throw new UserInputError(`Expected one installed Sentry App '${appSlug}'.`);
const installation = installed[0]!;
const matchingComponents = components.filter(
Expand Down
Loading