Repository navigation
feat(mcp): Add a fresh input to read tools that bypasses cached reads - #1832
Merged
Merged
Conversation
Every catalog tool with readOnlyHint and openWorldHint, except the docs tools, gets the shared ParamFresh input. A call with fresh: true runs the handler in an AsyncLocalStorage scope, and SentryApiService's transport reads that scope through its fresh() callback (#1720). Task 6.3 of #1669. Co-Authored-By: Claude <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
BYK
approved these changes
Nov 3, 2026
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.
Task 6.3 of #1669, on top of the transport's
fresh()callback from #1720.What changes
ParamFreshinmcp-core/src/schema.ts:fresh?: boolean, described as "Bypass cached reads." The description is kept short because every read tool's schema carries it.internal/fresh-reads.ts:withFreshReadInput(tool)adds the input and wraps the handler. Withfresh: true, the handler runs inside anAsyncLocalStoragescope, and it never seesfreshin its params.isFreshRead()reads that scope.tools/catalog/index.tsapplies the wrapper to every catalog tool that hasreadOnlyHint: trueandopenWorldHint: true, exceptsearch_docsandget_doc, which read docs.sentry.io rather than the Sentry API. The wrapper sits on the tool itself, so direct calls andexecute_sentry_toolboth get it. No tool file orexecute_sentry_toolchanges.SentryApiService's transport passesfresh: isFreshRead, so the shared client sees the scope only through the callback. Shared code still has noAsyncLocalStorage.docs/contributing/adding-tools.mdexplains the rule. Tool definitions are regenerated.Behavior today: none visible. The MCP transport has no cache store yet (that's 7.x), so
freshhas nothing to bypass until one is wired in. This PR makes the input and the scope ready for that.Token cost (
pnpm run measure-tokens): 9,014 → 9,144 (+130, +1.4%). Of the 14 direct tools, 10 gain the input at 13 tokens each:find_organizations,find_projects,search_issues,get_sentry_resource, and the sixsearch_*tools.Checks (all run with
SENTRY_AUTH_TOKENunset)pnpm run tsc,pnpm run lintanddocs:checkpass.fresh-reads.test.tscovers the scope being set only whenfresh: true, the scope surviving anawait,freshbeing stripped from handler params, a non-boolean being rejected, and which catalog tools get the input.server.test.tsaddsfreshto theget_replay_detailsschema keys it expects.Other in-flight work on
execute_sentry_tool,get_sentry_resource,find_dropped_eventsandget_alert_ruledoesn't touch these files. Expect only atoolDefinitions.jsonregeneration on rebase.via @BYK.
--
View Session [Sentry]