Skip to content

[2.0] Fixes #39713: Cap large entity text and fit get_entity_details batches to the response limit (#39814) - #39861

Merged
fmcardoso merged 1 commit into
2.0from
backport/2.0/pr-39814
Dec 4, 2026
Merged

fmcardoso merged 1 commit into
2.0from
backport/2.0/pr-39814

Conversation

@fmcardoso

Copy link
Copy Markdown
Member

Describe your changes

Backport of #39814 to 2.0.

Fixes #39713

A customer's Looker data models hold whole LookML files, so get_entity_details returned nothing (truncated, no data) once a batch or a single model went over the MCP response limit. Now long SQL or code is cut and flagged (e.g. sqlTruncated), and an oversized batch returns the entities that fit in full while marking the rest as omitted so the caller can request them separately.

2.0 adaptation

2.0 has no configurable MCP response limit (maxResponseChars), so the change uses the fixed McpResponseTrim.MAX_RESPONSE_CHARS (100k). The text caps come out at the same 30k per field / 60k per entity as on main and 2.1.

  • GetEntityTool.java: identical to Fixes 39713: cap large entity text and fit get_entity_details batches to the response limit #39814 except the two maxResponseChars() calls read the fixed limit, and one comment says so.
  • tools.json: the new text is merged into 2.0's description, without the metric-variants sentence (that feature is not on 2.0).
  • GetEntityToolTest.java: two tests are not carried over because the feature they test is not on 2.0 (a configured limit, metric variants). Three tests that set a configured limit are rewritten against the fixed 100k limit: exactly at the limit vs one character over, the content section measured before keeping an entity, and long error references. The other new tests are unchanged.
  • McpIntegrationIT.java: the LookML test is unchanged; one import added.
  • The decision record is unchanged: docs/decisions/2026-12-04-get-entity-details-batches-fit-the-response-limit.md.

Type of change

  • Bug fix

Tests

Run on this branch (2.0):

mvn -pl openmetadata-mcp test -Dtest=GetEntityToolTest,DefaultToolContextTest,ResponseBudgetTest,McpResponseTrimTest

Tests run: 114, Failures: 0, Errors: 0, Skipped: 0

mvn -B verify -pl :openmetadata-integration-tests -am -DskipBootJar=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel '-Dit.test=McpIntegrationIT#testGetEntityDetailsFitsLookMlBatchAndCapsLargeModelSql' -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false

Tests run: 1, Failures: 0, Errors: 0, Skipped: 0

Spotless applied; no UI, schema or migration changes.

🤖 Generated with Claude Code

… to the response limit (#39814)

* Fixes 39713: cap large entity text and fit get_entity_details batches to the response limit

Cap LookML and other unpageable entity text using its JSON-escaped length and the configured response limit. Keep the entries that fit in a batch and mark skipped positions so callers can retry them separately.

* Fixes 39713: record the get_entity_details batch and text-budget decision
(cherry picked from commit 705750e)

2.0 adaptation: 2.0 has no configurable MCP response limit, so the caps and batch fitting use the fixed McpResponseTrim.MAX_RESPONSE_CHARS (100k). The configured-limit and metric-variant tests are dropped (neither feature exists on 2.0); the exact-limit, content and long-reference tests are rewritten against the fixed limit.
@gitar-bot

gitar-bot Bot commented Dec 4, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved 🟡 Medium risk

Capping entity text and omitting oversized batch entries could leave callers without full metadata unless they retry or use REST.

Caps oversized SQL and code text in get_entity_details responses and fits entity batches within the fixed 100k MCP response limit, marking omitted entities so callers can request them separately. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@fmcardoso fmcardoso added the skip-pr-checks Bypass PR metadata validation check label Dec 4, 2026
@fmcardoso
fmcardoso marked this pull request as ready for review December 4, 2026 16:24
@fmcardoso
fmcardoso merged commit fa13164 into 2.0 Dec 4, 2026
82 of 83 checks passed
@fmcardoso
fmcardoso deleted the backport/2.0/pr-39814 branch December 4, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip-pr-checks Bypass PR metadata validation check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant