Skip to content

fix(mcp-core): Allow null for externalSlug/externalId in RepositorySchema - #1297

Open
sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/mcp-core-external-slug-id-null
Open

sentry[bot] wants to merge 1 commit into
mainfrom
seer/fix/mcp-core-external-slug-id-null

Conversation

@sentry

@sentry sentry Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

The SentryApiService.listRepos() method was throwing a ZodError when parsing responses from the Sentry API. This occurred because the RepositorySchema in packages/mcp-core/src/api-client/schema.ts defined externalSlug and externalId as z.string().optional(). While .optional() allows undefined, it rejects null.

The Sentry /organizations/{org}/repos/ endpoint, however, returns null for these fields when a repository is not linked to an external SCM, leading to validation failures.

This fix updates externalSlug and externalId in RepositorySchema to z.string().nullish(), which correctly accepts string | null | undefined. This aligns with the handling of integrationId in the same schema.

A regression test has been added to packages/mcp-core/src/api-client/client.test.ts to ensure that repositories with null values for these fields are parsed successfully.

Fixes MCP-SERVER-G2P

@sentry <feedback>: Autofix iterates on these changes
@sentry stop iterating: Autofix stops iterating on this run

This PR was automatically generated by Sentry. You can adjust this setting at any time.

@sentry
sentry Bot marked this pull request as ready for review September 8, 2026 22:50
@sentry
sentry Bot requested a review from dcramer September 8, 2026 22:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants