Repository navigation
feat(tools): Add outputSchema to get_profile_details - #2024
Merged
Merged
Conversation
Return one profile as structured content under `profile`, discriminated by `profileType`: `transaction` (sample-format), `legacy` (speedscope summary only), or `continuous` (profile chunk). Transaction and continuous profiles share one `samples` shape with frame/sample/stack counts, per-thread sample counts, and the top frames by occurrence. The continuous shape no longer repeats chunk metadata the way the old "Raw Sample Analysis" section did. Follow-up guidance from the old markdown (open profile/trace URLs, use search_profiles, call get_profile for legacy profiles) moves into the tool hints. The now-unused profile details markdown formatters and their tests are removed; their behavior tests move to the structured builders. Co-Authored-By: David Cramer <[email protected]>
Suggest a get_profile call for legacy profiles that name a transaction when get_profile is callable in the session, so the follow-up survives dispatch through get_sentry_resource. Adds the shared suggested-actions builder, copied unchanged from the get_replay_details branch. Move sample analysis out of the profile union into a top-level `samples` field (null for legacy profiles), which shrinks the output schema. Map empty or missing continuous release and environment to null, dropping the "unknown" release default from ProfileChunkSchema, and add a no-leak test for legacy speedscope profiles. Co-Authored-By: David Cramer <[email protected]>
… top frames Co-Authored-By: David Cramer <[email protected]>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
#2023 landed get_profile structured output, so the profile markdown formatter and its test have no callers left. Remove both and regenerate tool definitions.
7 tasks done
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
get_profile_detailsnow returns anoutputSchemaand schema-conformingstructuredContent. Errors still throw.The root object is
{ profile, samples, suggestedActions }:profileis a discriminated union onprofileType:transaction,legacyorcontinuous. It holds only the summary fields.samplesis shared by transaction and continuous profiles, and is null for legacy profiles.suggestedActionsholds concrete follow-up calls.The now-unused profile details markdown formatters are removed.
Fixes from review
get_profilesuggested action (organizationSlug,projectSlugOrId,transactionName, plus the resolvedregionUrl).get_profilecan be called in the session.execute_sentry_toolwhenget_profileis in the catalog but not a direct tool. That keeps the follow-up when the profile is reached throughget_sentry_resource.regionUrlpass-through and the catalog wrapping.release/environmentnow maps to null (ProfileChunkSchemano longer defaults release to"unknown"). ThetopFramesfunctionandlocationfields are now nullable instead of falling back to the literal"unknown".samplesmoved up: it's now a top-level sibling (sampleAnalysisSchema.nullable()) rather than part of each union branch.profiles,shared,framesandmetadatakeys and an injected raw value don't appear in the output.Tokens (o200k_base, JSON vs old markdown)
The legacy numbers include ~60 tokens for the suggestion. The outputSchema is 821 tokens, down from 912; about 77 of those are the
suggestedActionsschema. The description is 490 tokens.measure-tokensdoesn't count the outputSchema.(B) Shared helper:
packages/mcp-core/src/internal/tool-helpers/suggested-actions.tsis byte-identical to the canonical blobee84917fromfeat/structured-get-replay-details, so whichever lands second adds nothing for that file.Follow-up (A), known existing bug in
get_profile, not changed here: the flamegraph comparison compares absolutesumDurationacross windows of different length (7d vs 14d), so results lean toward "improvement".Merge note: this PR and the
get_profilePR both touch the profile formatter. Whichever merges second mustgit rmbothpackages/mcp-core/src/tools/support/profile/formatter.tsandformatter.test.ts, then regenerate. Keeping either side's formatter breaks tsc or leaves dead code.On rebase: regenerate
toolDefinitions.jsonwithpnpm run --filter @sentry/mcp-core generate-definitions.Note: on main, the test "copies profilerId from the request when the chunk payload omits it" mocks only
sentry.io, while the request goes tous.sentry.io, so it likely doesn't exercise the fallback. It's left unchanged here.Checks run with
SENTRY_AUTH_TOKENunset: generate-definitions (no diff), mcp-core tsc, full mcp-core vitest and root lint all pass. Root tsc, test and build were not run.via @dcramer.
--
View Session [Sentry]