Skip to content

Commit f1c2cd0

Browse files
fix(api): Support stage-specific onboarding metadata (#1266)
Sentry onboarding runs now store project slugs and verification issue IDs in stage-specific `extra` objects. This updates the API schemas, outgoing status payloads, response parsing, and mocks to follow the contract introduced by getsentry/sentry#122076. The `onboarding_status_update` tool now accepts a nested `update` object whose schema discriminates on `stage`. Callers must move `stage`, `status`, `runStatus`, and `eventNote` under `update`, and send `projectSlugs` or `issueIds` through that stage's `extra` object.
1 parent 84e7f0d commit f1c2cd0

5 files changed

Lines changed: 345 additions & 125 deletions

File tree

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

Lines changed: 58 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2098,12 +2098,44 @@ export const AgenticOnboardingStageStatusUpdateSchema = z.enum([
20982098
"failed",
20992099
]);
21002100

2101-
export const AgenticOnboardingStageStateSchema = z.object({
2102-
stage: AgenticOnboardingStageSchema,
2101+
const AgenticOnboardingCreateProjectExtraSchema = z
2102+
.object({
2103+
projectSlugs: z.array(z.string().trim().min(1)),
2104+
})
2105+
.strict();
2106+
2107+
const AgenticOnboardingVerificationErrorExtraSchema = z
2108+
.object({
2109+
issueIds: z.array(z.string().trim().min(1)),
2110+
})
2111+
.strict();
2112+
2113+
const AgenticOnboardingStageWithoutExtraSchema =
2114+
AgenticOnboardingStageSchema.exclude([
2115+
"create_project",
2116+
"receive_verification_error",
2117+
]);
2118+
2119+
const AgenticOnboardingStageStateBaseSchema = z.object({
21032120
status: AgenticOnboardingStageStatusSchema.nullable(),
21042121
eventNote: z.string().nullable(),
21052122
});
21062123

2124+
export const AgenticOnboardingStageStateSchema = z.discriminatedUnion("stage", [
2125+
AgenticOnboardingStageStateBaseSchema.extend({
2126+
stage: z.literal("create_project"),
2127+
extra: AgenticOnboardingCreateProjectExtraSchema.nullable(),
2128+
}),
2129+
AgenticOnboardingStageStateBaseSchema.extend({
2130+
stage: z.literal("receive_verification_error"),
2131+
extra: AgenticOnboardingVerificationErrorExtraSchema.nullable(),
2132+
}),
2133+
AgenticOnboardingStageStateBaseSchema.extend({
2134+
stage: AgenticOnboardingStageWithoutExtraSchema,
2135+
extra: z.null(),
2136+
}),
2137+
]);
2138+
21072139
export const AgenticOnboardingRunStatusSchema = z.enum([
21082140
"active",
21092141
"completed",
@@ -2116,17 +2148,36 @@ export const AgenticOnboardingRunStatusUpdateSchema = z.enum([
21162148
"failed",
21172149
]);
21182150

2119-
export const AgenticOnboardingStatusUpdateSchema = z.object({
2151+
export const AgenticOnboardingRunTokenSchema = z
2152+
.string()
2153+
.regex(/^[A-Za-z0-9]{10}$/);
2154+
2155+
const AgenticOnboardingStatusUpdateBaseSchema = z.object({
21202156
schemaVersion: z.literal(1),
2121-
runToken: z.string().regex(/^[A-Za-z0-9]{10}$/),
2122-
stage: AgenticOnboardingStageSchema,
2157+
runToken: AgenticOnboardingRunTokenSchema,
21232158
status: AgenticOnboardingStageStatusUpdateSchema,
21242159
runStatus: AgenticOnboardingRunStatusUpdateSchema.optional(),
21252160
eventNote: z.string().trim().min(1).max(256).optional(),
2126-
projectSlugs: z.array(z.string().trim().min(1)).min(1).max(100).optional(),
2127-
issueIds: z.array(z.string().trim().min(1)).min(1).max(100).optional(),
21282161
});
21292162

2163+
export const AgenticOnboardingStatusUpdateSchema = z.discriminatedUnion(
2164+
"stage",
2165+
[
2166+
AgenticOnboardingStatusUpdateBaseSchema.extend({
2167+
stage: z.literal("create_project"),
2168+
extra: AgenticOnboardingCreateProjectExtraSchema.optional(),
2169+
}),
2170+
AgenticOnboardingStatusUpdateBaseSchema.extend({
2171+
stage: z.literal("receive_verification_error"),
2172+
extra: AgenticOnboardingVerificationErrorExtraSchema.optional(),
2173+
}),
2174+
AgenticOnboardingStatusUpdateBaseSchema.extend({
2175+
stage: AgenticOnboardingStageWithoutExtraSchema,
2176+
extra: z.never().optional(),
2177+
}),
2178+
],
2179+
);
2180+
21302181
export const AgenticOnboardingRunSchema = z.object({
21312182
schemaVersion: z.literal(1),
21322183
runId: z.string(),
@@ -2138,13 +2189,5 @@ export const AgenticOnboardingRunSchema = z.object({
21382189
expiresAt: z.string(),
21392190
continueUpdates: z.boolean(),
21402191
runStatus: AgenticOnboardingRunStatusSchema,
2141-
projectSlugs: z
2142-
.array(z.string())
2143-
.nullable()
2144-
.transform((projectSlugs) => projectSlugs ?? []),
2145-
issueIds: z
2146-
.array(z.string())
2147-
.nullable()
2148-
.transform((issueIds) => issueIds ?? []),
21492192
stages: z.array(AgenticOnboardingStageStateSchema),
21502193
});

‎packages/mcp-core/src/toolDefinitions.json‎

Lines changed: 150 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -4292,59 +4292,159 @@
42924292
"pattern": "^[A-Za-z0-9]{10}$",
42934293
"description": "The 10-character onboarding run token supplied by Sentry."
42944294
},
4295-
"stage": {
4296-
"type": "string",
4297-
"enum": [
4298-
"connect_mcp",
4299-
"analyze_project",
4300-
"create_project",
4301-
"instrument_app",
4302-
"plan_test_error",
4303-
"send_verification_error",
4304-
"receive_verification_error",
4305-
"prepare_production",
4306-
"check_stack_trace_quality"
4295+
"update": {
4296+
"oneOf": [
4297+
{
4298+
"type": "object",
4299+
"properties": {
4300+
"status": {
4301+
"type": "string",
4302+
"enum": [
4303+
"active",
4304+
"waiting",
4305+
"completed",
4306+
"skipped",
4307+
"failed"
4308+
],
4309+
"description": "The stage's current status."
4310+
},
4311+
"runStatus": {
4312+
"description": "Set only when the entire onboarding run has completed or failed.",
4313+
"type": "string",
4314+
"enum": ["completed", "failed"]
4315+
},
4316+
"eventNote": {
4317+
"description": "Short context to display with this progress event. Required when status is failed.",
4318+
"type": "string",
4319+
"minLength": 1,
4320+
"maxLength": 256
4321+
},
4322+
"stage": {
4323+
"type": "string",
4324+
"const": "create_project",
4325+
"description": "Report progress while creating or selecting Sentry projects."
4326+
},
4327+
"extra": {
4328+
"description": "Project metadata accepted only by the create_project stage.",
4329+
"type": "object",
4330+
"properties": {
4331+
"projectSlugs": {
4332+
"minItems": 1,
4333+
"maxItems": 100,
4334+
"type": "array",
4335+
"items": {
4336+
"type": "string",
4337+
"minLength": 1
4338+
},
4339+
"description": "Sentry project slugs created or selected during onboarding. Values accumulate across updates; include each project as it becomes usable while active, then all known projects when completed."
4340+
}
4341+
},
4342+
"required": ["projectSlugs"],
4343+
"additionalProperties": false
4344+
}
4345+
},
4346+
"required": ["status", "stage"],
4347+
"additionalProperties": false
4348+
},
4349+
{
4350+
"type": "object",
4351+
"properties": {
4352+
"status": {
4353+
"type": "string",
4354+
"enum": [
4355+
"active",
4356+
"waiting",
4357+
"completed",
4358+
"skipped",
4359+
"failed"
4360+
],
4361+
"description": "The stage's current status."
4362+
},
4363+
"runStatus": {
4364+
"description": "Set only when the entire onboarding run has completed or failed.",
4365+
"type": "string",
4366+
"enum": ["completed", "failed"]
4367+
},
4368+
"eventNote": {
4369+
"description": "Short context to display with this progress event. Required when status is failed.",
4370+
"type": "string",
4371+
"minLength": 1,
4372+
"maxLength": 256
4373+
},
4374+
"stage": {
4375+
"type": "string",
4376+
"const": "receive_verification_error",
4377+
"description": "Report progress while receiving the verification error in Sentry."
4378+
},
4379+
"extra": {
4380+
"description": "Issue metadata accepted only by the receive_verification_error stage.",
4381+
"type": "object",
4382+
"properties": {
4383+
"issueIds": {
4384+
"minItems": 1,
4385+
"maxItems": 100,
4386+
"type": "array",
4387+
"items": {
4388+
"type": "string",
4389+
"minLength": 1
4390+
},
4391+
"description": "Sentry issue IDs observed after sending the verification error. Values accumulate across updates; include each matching issue as it is confirmed, then all known issues when completed."
4392+
}
4393+
},
4394+
"required": ["issueIds"],
4395+
"additionalProperties": false
4396+
}
4397+
},
4398+
"required": ["status", "stage"],
4399+
"additionalProperties": false
4400+
},
4401+
{
4402+
"type": "object",
4403+
"properties": {
4404+
"status": {
4405+
"type": "string",
4406+
"enum": [
4407+
"active",
4408+
"waiting",
4409+
"completed",
4410+
"skipped",
4411+
"failed"
4412+
],
4413+
"description": "The stage's current status."
4414+
},
4415+
"runStatus": {
4416+
"description": "Set only when the entire onboarding run has completed or failed.",
4417+
"type": "string",
4418+
"enum": ["completed", "failed"]
4419+
},
4420+
"eventNote": {
4421+
"description": "Short context to display with this progress event. Required when status is failed.",
4422+
"type": "string",
4423+
"minLength": 1,
4424+
"maxLength": 256
4425+
},
4426+
"stage": {
4427+
"type": "string",
4428+
"enum": [
4429+
"connect_mcp",
4430+
"analyze_project",
4431+
"instrument_app",
4432+
"plan_test_error",
4433+
"send_verification_error",
4434+
"prepare_production",
4435+
"check_stack_trace_quality"
4436+
],
4437+
"description": "Report progress for a stage that does not accept extra metadata."
4438+
}
4439+
},
4440+
"required": ["status", "stage"],
4441+
"additionalProperties": false
4442+
}
43074443
],
4308-
"description": "The onboarding stage being updated."
4309-
},
4310-
"status": {
4311-
"type": "string",
4312-
"enum": ["active", "waiting", "completed", "skipped", "failed"],
4313-
"description": "The stage's current status."
4314-
},
4315-
"runStatus": {
4316-
"description": "Set only when the entire onboarding run has completed or failed.",
4317-
"type": "string",
4318-
"enum": ["completed", "failed"]
4319-
},
4320-
"eventNote": {
4321-
"description": "Short context to display with this progress event. Required when status is failed.",
4322-
"type": "string",
4323-
"minLength": 1,
4324-
"maxLength": 256
4325-
},
4326-
"projectSlugs": {
4327-
"description": "Validated Sentry project slugs. Send only for create_project. Values accumulate across updates; include each project as it becomes usable while active, then all known projects when completed.",
4328-
"minItems": 1,
4329-
"maxItems": 100,
4330-
"type": "array",
4331-
"items": {
4332-
"type": "string",
4333-
"minLength": 1
4334-
}
4335-
},
4336-
"issueIds": {
4337-
"description": "Validated Sentry issue IDs returned by MCP. Send only for receive_verification_error. Values accumulate across updates; include each matching issue as it is confirmed, then all known issues when completed.",
4338-
"minItems": 1,
4339-
"maxItems": 100,
4340-
"type": "array",
4341-
"items": {
4342-
"type": "string",
4343-
"minLength": 1
4344-
}
4444+
"description": "The stage-specific onboarding progress update."
43454445
}
43464446
},
4347-
"required": ["organizationSlug", "runToken", "stage", "status"]
4447+
"required": ["organizationSlug", "runToken", "update"]
43484448
},
43494449
"requiredScopes": ["org:read"],
43504450
"skills": ["inspect", "seer", "docs", "triage", "project-management"],

0 commit comments

Comments
 (0)