Repository navigation
Fixes #38450: Strip images from MCP article reads and fix the excerpt hint - #38489
Vishnuujain merged 11 commits into
Conversation
…include=["content"]) and update truncated-excerpt hint
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
There was a problem hiding this comment.
@iamkiayun Thanks for this! I tested it locally: images are removed and the new hint works. One thing blocks it, see the first comment.
Also, please fix the old tool name in aiContext.json (line 45). We'll fix the failing metadata check on our side.
|
@iamkiayun also check greptile comments please |
Reuse fullContentOf for full reads. Scope image handling to HTML and keep the ordinary fetch hint. PageBodyTextContributor places editor HTML in stored page passages, so clean those passages on read while returning indexed metric SQL verbatim.
UI browser testsRan: all test files (no impact map from main yet) Result: ✅ 1071 passed · 154 skipped |
Code Review ✅ Approved 🟡 Medium risk 3 closed / 3 findingsContent reads now decode text and strip image patterns from articles and passages, which could alter text returned to MCP callers. Strips inline images from ✅ 3 closed✅ Performance: MARKDOWN_DATA_IMAGE is quadratic on repeated unclosed
|
| Compact |
|
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source
|
🤖 Backport to |
|
🤖 Backport to |
|
🤖 Backport to |
|
🤖 Backport to |
Describe your changes :
Fixes #38450
get_entity_details(include=["content"])used to return an article's inline image as one big base64 blob. It now drops images: HTML<img>tags, images stored as encoded text, and Markdownimages.x >= 1,'a',a & band[email protected]come back as typed, not as>=. Metric SQL is returned untouched.get_entity_details(... include=["content"])instead of the removedget_knowledge_content. TheaiContext.jsondescription and the generated UI types say the same.Not in this PR: knowledge items in the
include=["context"]markdown bundle still come back HTML-escaped, the same as on main. That needs its own follow-up.Testing :
aicontexttests and 50GetEntityToolTesttests pass. One guards that the image patterns stay fast on crafted input with many unclosed image openings.AIContextMcpITchecks the image strip and the hint against a real server (runs in the merge queue).Type of change :
Checklist:
Fix the repeated regex scans and damaged metric SQL before merging.
Findings
Summary
The PR strips images from full content reads and retrieved passages, preserves full-body metric expressions, and updates truncated-content hints to use
get_entity_details.Reviews (1) · Last reviewed commit: "Fixes #38450: Strip inline images on get..." · Reviewed by Greptile