fix(mcp): keep read-tool responses under the size cap by paging items, not truncating content#29732
fix(mcp): keep read-tool responses under the size cap by paging items, not truncating content#29732Vishnuujain wants to merge 6 commits into
Conversation
…ub nuke by fitting results exactly to budget Signed-off-by: Vishnu Jain <vishnujtimes@gmail.com>
…ed graphs to a partial graph instead of bare counts Signed-off-by: Vishnu Jain <vishnujtimes@gmail.com>
…t edges to budget instead of dropping to a hint Signed-off-by: Vishnu Jain <vishnujtimes@gmail.com>
… an empty stub Signed-off-by: Vishnu Jain <vishnujtimes@gmail.com>
…st_definitions so neither nukes to an empty stub
…m RCA edge Map with budget rebalance, document single-item residual
Code Review ✅ Approved 3 resolved / 3 findingsReplaces silent empty-stub nukes and field truncation with a shared ✅ 3 resolved✅ Bug: search_metadata trim message gives wrong 'from' offset for paged calls
✅ Edge Case: RCA edge fitting never rebalances unused budget between directions
✅ Edge Case: Single oversized item still exceeds cap and re-triggers empty-stub nuke
OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Gitar |
🔴 Playwright Results — 3 failure(s), 26 flaky✅ 4474 passed · ❌ 3 failed · 🟡 26 flaky · ⏭️ 38 skipped
Genuine Failures (failed on all attempts)❌
|
Following this work: https://github.com/open-metadata/openmetadata-collate/issues/4825
Problem
When an MCP read tool's response was too large (over the ~100k dispatch cap), the whole payload was thrown away and replaced with an empty stub. The agent got nothing back. Some tools also cut descriptions / SQL / DDL at a fixed length, silently losing the exact content the call was for.
Follow-up to #29713 (same bug for
get_entity_details/ wide tables). Together they close #29707.Fix
One shared helper,
ResponseBudget, measures each item's real size and keeps as many whole items as fit. Size is now controlled by returning fewer items, never by trimming an item's content.search_metadata,semantic_search,search_company_contexthasMore+ next-page hint. Item content untouched.get_entity_lineageReturned/Totalmarkers, not bare counts.root_cause_analysisget_test_definitionslimit; if a page still overflows, shrinks and refetches. Native cursor stays consistent, so no row is skipped.get_company_contextand single-entityget_entity_detailsare left full on purpose: no list to page, and their big fields are the point of the call.Guarantee: no crucial metadata is truncated to save space.