Repository navigation
Reuse decoded MCP request params in the parser - #7475
Open
ningsiyuan1024 wants to merge 1 commit into
Open
ningsiyuan1024 wants to merge 1 commit into
ningsiyuan1024 wants to merge 1 commit into
Conversation
Collaborator
|
@ningsiyuan1024 Got some conflicts, but this should be good to approve and merge once fixed |
Signed-off-by: ningsiyuan1024 <255516746+ningsiyuan1024@users.noreply.github.com>
ningsiyuan1024
force-pushed
the
perf/7224-reuse-parsed-params
branch
from
December 4, 2026 01:59
a5fe997 to
8f9605f
Compare
This branch has not been 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.
Summary
The request parser used to build the same params map twice. Admission decoded the params to check that authorization could consume their numeric values, then discarded the map. Parsing built it again to extract the resource and arguments. The middleware and replacement-body path now each reuse the decoded map from their own admission step.
DecodeMessagekeeps its public signature, andParsedMCPRequest.Paramskeeps its original JSON bytes.Fixes #7224.
Type of change
Test plan
go test -count=1 ./pkg/mcp/...). All four packages passed on4b9f678and again after integrating the patch onto8ecced5.Seven alternating before/after runs on Windows amd64, Intel Core i9-13900H, one benchmark CPU. Medians on
4b9f678:The behavior tests cover replacement bodies, omitted and empty initialization params, response handling, and admission errors. The replacement-body path derives its arguments from the replacement itself.
AI assistance
Codex handled execution.