Repository navigation
MCP budget: add get_collection_log per-server response budget and error_message preview (#4198) - #4265
Merged
Conversation
Measures a default per-server call's UTF-8 bytes on both target kinds against a seeded store: 90,514 bytes (SQL Server target), 89,593 bytes (PostgreSQL target) at the old 200-row default, both well over the 32 KB McpResponseBudget.DefaultBytes target. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TszxYhJJbTEh4LrZ56NYo3
…age (#4198) Sizes get_collection_log's one-server form (both products) so a default call stays under the shared 32 KB MCP response budget: - Lowers the per-server default row limit from 200 to McpResponseBudget.CollectionLogPerServerDefaultLimit (58), sized against the wider of the two target-kind row shapes (SQL Server targets add plan_fetch/text_fetch, PostgreSQL targets never do). - Previews error_message to 500 characters by default (error_message_truncated marks a cut), with a new full_text opt-in — the same shape get_store_query_stats already uses. - Web viewer's /api/read row for get_collection_log keeps today's behavior explicitly (limit 200, full_text: true), pinned by a no-rig source-text test. - Adds FieldPreviewCutKeys to McpPayloadContractCensusTests, since no other merged PR had added it yet. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TszxYhJJbTEh4LrZ56NYo3
…g-default # Conflicts: # Darling/Darling.Tests/McpPayloadContractCensusTests.cs # Darling/Darling.Tests/McpToolsListBudgetTests.cs # Lite.Tests/McpToolsListBudgetTests.cs
erikdarlingdata
marked this pull request as ready for review
September 25, 2026 09:03
erikdarlingdata
enabled auto-merge (squash)
September 25, 2026 09:03
Darling: HEAD=172,347 (collection_log +127) + dev=172,367 -> 172,494 Lite: HEAD=90,387 (collection_log +116) + dev=90,418 -> 90,534 Census: keep error_message_truncated (HEAD) + add top_query_text_truncated (dev) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FVjn4PBJN71NQXdFo6ZxNQ
erikdarlingdata
added a commit
that referenced
this pull request
Sep 25, 2026
Measured with McpToolsListBudgetTests after merging origin/dev (#4261, #4258, #4265, #4267, #4264, #4266 and #4268) plus this PR's catalog changes. Budget, census and tool-guide classes: 219/219. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FVjn4PBJN71NQXdFo6ZxNQ
erikdarlingdata
added a commit
that referenced
this pull request
Sep 25, 2026
…nder the response budget (#4198) (#4272) * MCP budget: describe_custom_view_catalog default groups measures by source (#4198) Default default-argument call was 98,173 bytes (#4198's own measurement), three times the tool's 32 KB budget. It is pure static reference data (no server/store read), so the cut groups the 179 measures by source and keeps only key/displayName/kind/unitFamily/validAggregates per measure; source=<name> drills into one source's full detail, full_detail=true returns the original shape unfiltered. /api/catalog (the web Custom Views editor) calls the underlying builder directly, never this MCP method, so it is unaffected - pinned in DarlingComposeTests. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TszxYhJJbTEh4LrZ56NYo3 * Trigger CI (draft PR skipped the Build workflow) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FVjn4PBJN71NQXdFo6ZxNQ * Add comment to DarlingMcpCustomViewCatalogSizeTests.cs to trigger Build CI GitHub did not fire pull_request events for this draft-opened PR. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FVjn4PBJN71NQXdFo6ZxNQ * fix(#4272): reword validAggregates description - compact drops allowedDimensions, source=<name> returns it Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TszxYhJJbTEh4LrZ56NYo3 * #4272: set TotalCeilingBytes to the measured 174,236 after merging dev Measured with McpToolsListBudgetTests after merging origin/dev (#4261, #4258, #4265, #4267, #4264, #4266 and #4268) plus this PR's catalog changes. Budget, census and tool-guide classes: 219/219. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FVjn4PBJN71NQXdFo6ZxNQ --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
erikdarlingdata
added a commit
that referenced
this pull request
Sep 25, 2026
…as merged After merging dev, the per-tool fixes for get_blocking (#4267), get_collection_log (#4265), get_query_store_regressions (#4264), get_collection_health (#4268), describe_custom_view_catalog (#4272) and get_query_store_top (#4273) are all in, and get_fleet_overview already fit (CI's stale-exemption message). Every row goes; CI's live run decides. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FVjn4PBJN71NQXdFo6ZxNQ
3 tasks done
erikdarlingdata
added a commit
that referenced
this pull request
Sep 25, 2026
* Add the #4198 MCP read-tool budget pin (part of #4198) McpReadToolBudgetLiveTests reflects over every [McpServerTool] method on every [McpServerToolType] class in the Darling service assembly, excludes write tools/analyze_*/compare_*/audit_config, binds each tool's DI services and server_name generically, and asserts the reply stays under McpResponseBudget.DefaultBytes unless the tool is named in an explicit, byte-stamped exemption roster. A fix lands by deleting its row. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TszxYhJJbTEh4LrZ56NYo3 * MCP budget pin: empty ExemptOffenders now every #4198 per-tool lane has merged After merging dev, the per-tool fixes for get_blocking (#4267), get_collection_log (#4265), get_query_store_regressions (#4264), get_collection_health (#4268), describe_custom_view_catalog (#4272) and get_query_store_top (#4273) are all in, and get_fleet_overview already fit (CI's stale-exemption message). Every row goes; CI's live run decides. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FVjn4PBJN71NQXdFo6ZxNQ * MCP budget pin: get_collection_health is still over on this fixture CI on 08e6e81 measured get_collection_health at 35,145 B, over the 32 KB default. #4268 compacts only healthy collectors with nothing to report, and this fixture's collectors are not healthy, so nothing compacts. The row goes back, under #4198, which stays open for it. Every other exempt tool fits. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FVjn4PBJN71NQXdFo6ZxNQ --------- Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
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.
Part of #4198.
Why
get_collection_log's one-server form had no response-size budget. At the old 200-rowdefault it measured 90,514 bytes on a seeded SQL Server-target store and 89,593 bytes on
a seeded PostgreSQL-target store. Both are about 2.7x the shared 32 KB
McpResponseBudget.DefaultBytestarget #4198 set. The fleet-wide form (server_nameomitted) was already sized in #4205. This is the per-server form's own pass.
What changes
McpResponseBudget.CollectionLogPerServerDefaultLimit(58), shared by Darling andLite. Sized against the wider of the two target-kind row shapes. A SQL Server target's
query_storerows carry theplan_fetch/text_fetchdeferred-fetch split that aPostgreSQL target's collectors never populate. That makes the SQL Server shape
consistently the heavier one.
error_messageis the tool's one unbounded text field. It is capped at 4000 charactersat write time but was never previewed at read time. It is now a 500-character preview by
default, with a new
error_message_truncatedflag marking a cut. Passfull_text(thesame shape
get_store_query_statsalready uses) to get the whole field back. Thisguards cases a lower row limit alone does not. An unhealthy server's default
(unfiltered) page is mostly
ERRORrows near the 4000-character ceiling.(
Lite/Mcp/McpHealthTools.cs), including the tool-guide prose./api/readrow forget_collection_log(DarlingWebEndpoints.cs)keeps today's behavior. It already passed
limit: 200(unaffected by the new lower MCPdefault) and now also passes
full_text: true. An operator reading the Collection Loggrid still gets the whole
error_message, not a preview. The twowwwroot/js/pages/server-tabs.jspanels (Collection Logtables) call this row withtheir own explicit
limit: 200and need no change. Pinned by a new no-rig source-texttest (
CollectionLogWebRowPreservesFullTextPinTests) so a future edit to that rowcannot drop either argument silently.
FieldPreviewCutKeystoMcpPayloadContractCensusTests(origin/dev did not haveit when this lane started) and rostered
error_message_truncatedthere. Merged withthe two entries MCP read tools have no default response-size budget: at default arguments 12 tools return >50 KB and 3 return >100 KB for one server, more than an agent client's per-result cap #4198 lanes TB and the
get_plan_correctionslane added concurrently.McpToolsListBudgetpins andTotalCeilingBytesupdated on both products for the newfull_textparameter. Merged with the concurrent deltas from the same wave (see thechange-log comments above each constant).
The fleet-wide form (
server_nameomitted) is untouched, as #4205 already sized it.Test plan
Darling, against a rig seeded on both target kinds (200 rows/server, mixing server-scoped
and enumerated collectors, 10% carrying a moderate
error_message):McpCollectionLogPerServerResponseBudgetLivePostgresTests: before the fix, SQLServer target measured 90,514 bytes and PostgreSQL target 89,593 bytes (both over
budget). After the fix: 28,340 bytes and 28,057 bytes (both under the 32,768-byte
budget).
origin/dev, these all passed:McpPayloadContractCensusTests,McpToolsListBudgetTests,PgCappedReadSurfaceTests,CollectionLogWebRowPreservesFullTextPinTests(new),DarlingCollectionLogReadTests,McpFleetResponseBudgetLivePostgresTests,McpFilterSemanticsLivePostgresTests,AsOfWindowAnchorTests. 73 tests in the first group's run, 15 in the second.Lite (no rig, local DuckDB):
New
CollectionLogPerServerResponseBudgetToolTests: default call on 200 seeded rowsstays under budget.
McpToolsListBudgetTests,CollectionLogFleetFormToolTests,CollectionLogToolTests:all green.
Full
Darling.Testssuite (targeted classes above were run individually. The fullsuite was not run in this lane due to context budget).
Full
Lite.Testssuite (same reason).Both builds are
0 Warning(s),0 Error(s).CHANGELOG entry
SECTION: Fixed
ENTRY:
At the old default, a per-server call returned close to 90 KB. That exceeds the shared
32 KB budget other read tools already honor. The default row limit is now sized to the
tool's own row shape. The error message field is a 500-character preview by default
(pass full_text to get it whole). The web viewer keeps its existing behavior.
REF:
[MCP read tools have no default response-size budget: at default arguments 12 tools return >50 KB and 3 return >100 KB for one server, more than an agent client's per-result cap #4198]: MCP read tools have no default response-size budget: at default arguments 12 tools return >50 KB and 3 return >100 KB for one server, more than an agent client's per-result cap #4198
Generated with Claude Code
https://claude.ai/code/session_01FVjn4PBJN71NQXdFo6ZxNQ