Repository navigation
ref(mcp): Remove unused _extract_tool_result_content helper - #8422
Merged
sentrivana merged 1 commit intoNov 30, 2026
Merged
Conversation
The only caller was the low-level server handler patching that #7508 removed when dropping support for mcp < 2.0. The middleware-based _instrument_tool_call reads structuredContent/content from the result dict directly, so the helper has been unreachable since then.
Contributor
PR risk: mediumFor commit Main concerns: data sent to Sentry, reach. This label is a hint for reviewers, not an approval. |
Contributor
Coverage Results 📊✅ 59457 passed | ⏭️ 3119 skipped | Total: 62576 | Pass Rate: 95.02% | Execution Time: 158m 2s 📊 Comparison with Base Branch
✨ Test counts unchanged from base. All tests are passing successfully. ✅ Patch coverage is 100.00% (no changed executable lines found; target 80%). Files with missing lines (1)
Coverage diff@@ Coverage Diff @@
## master #8422 +/-##
==========================================
+ Coverage 90.11% 90.17% +0.06%
==========================================
Files 201 201 —
Tracked lines 22199 22184 -15
Branches 7784 7772 -12
==========================================
- Hits 20004 20003 -1
+ Misses 2195 2181 -14
Partials 1283 1283 —Generated by Coverage Action |
sentrivana
marked this pull request as ready for review
November 30, 2026 08:14
alexander-alderman-webb
approved these changes
Nov 30, 2026
sentrivana
deleted the
ref/mcp-remove-unused-extract-tool-result-content
branch
November 30, 2026 12:15
6 tasks done
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.
Description
Removes
_extract_tool_result_content()fromsentry_sdk/integrations/mcp.py(39 lines). Nothing calls it.Why it's dead
CallToolResult, a(unstructured, structured)tuple, a dict, or a list of content blocks) into the value for the tool result span attribute.chore(mcp): Drop support for < 2.0) replaced that handler patching with the server middleware and deleted the only call (extracted = _extract_tool_result_content(result)). The definition stayed behind._instrument_tool_callgets the result as a dict and readsstructuredContentorcontentfrom it inline. It calls_extract_text_from_content_blocksdirectly, and this PR keeps that function.git grep _extract_tool_result_contentonmasterfinds only the definition.git log -S "_extract_tool_result_content("finds only the two PRs above. The helper is private and isn't exported or documented.Why it's safe
Nothing reaches the function, so no behavior changes. Public API, supported mcp versions, and dependencies stay the same. No open PR or issue mentions it. The only open PR that touches
mcp.py, #8404, edits other lines, so it shouldn't conflict.Why it's better gone
A reader of
mcp.pytoday sees two ways tool results get extracted, and only the inline one runs. The dead helper also documents result shapes (tuple,CallToolResultobject) that the middleware path never receives.Issues
None.
via automation
sched_65eed06cc199036c2b13411096f412d4· Run IDsched_65eed06cc199036c2b13411096f412d4:1796025600000.--
View Session [Sentry]