Skip to content

Commit 8975cb2

Browse files
dcramerclaude
andcommitted
fix: apply 25 result limit after combining multi-region organizations
In multi-region SaaS, listOrganizations was fetching 25 results per region and concatenating them, which could return more than 25 total organizations. This broke the limit detection logic in find_organizations tool. Now applies slice(0, 25) after concatenating all regional results to ensure exactly 25 organizations are returned maximum. Co-Authored-By: Claude Code <noreply@anthropic.com>
1 parent 7d42708 commit 8975cb2

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎packages/mcp-server/src/api-client/client.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -842,7 +842,7 @@ export class SentryApiService {
842842
);
843843
const regionData = UserRegionsSchema.parse(regionsBody);
844844

845-
return (
845+
const allOrganizations = (
846846
await Promise.all(
847847
regionData.regions.map(async (region) =>
848848
this.requestJSON(path, undefined, {
@@ -854,6 +854,9 @@ export class SentryApiService {
854854
)
855855
.map((data) => OrganizationListSchema.parse(data))
856856
.reduce((acc, curr) => acc.concat(curr), []);
857+
858+
// Apply the limit after combining results from all regions
859+
return allOrganizations.slice(0, 25);
857860
} catch (error) {
858861
// If regions endpoint fails (e.g., older self-hosted versions identifying as sentry.io),
859862
// fall back to direct organizations endpoint

0 commit comments

Comments
 (0)