Expose MaxCharacterCount as a WolframLanguageEvaluator tool option#208
Open
basnijholt wants to merge 1 commit into
Open
Expose MaxCharacterCount as a WolframLanguageEvaluator tool option#208basnijholt wants to merge 1 commit into
basnijholt wants to merge 1 commit into
Conversation
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.
Problem
WolframLanguageEvaluatorhard-codes"MaxCharacterCount" -> 10000at bothWolframLanguageToolEvaluatecall sites, so every tool result is truncated at ~10 kB with no way to configure it. (There's an adjacentFIXME: Expose this as an optionin the file.)This particularly hurts image/plot workflows in headless MCP deployments: a rasterized plot returned as base64 blows through 10 kB immediately, forcing agents into awkward workarounds (chunking base64 across many evaluations and reassembling client-side). Most modern agent harnesses already handle large tool outputs themselves (spilling to files, summarizing, or capping in the client), so a hard server-side 10k limit mostly gets in the way.
Change
Wire
MaxCharacterCountthrough the existing tool-options mechanism, following the same pattern asMethod/TimeConstraint/MaxSessionCount:$maxCharacterCount := toolOptionValue[ "WolframLanguageEvaluator", "MaxCharacterCount" ]"MaxCharacterCount" -> 10000added to$defaultToolOptions[ "WolframLanguageEvaluator" ]— default behavior is unchanged$maxCharacterCountUsers can then raise (or lower) the cap via the standard
"ToolOptions"plumbing, e.g.:Tests
DefaultToolOptions-WolframLanguageEvaluatorwith the new default.ToolOptionValue-FallbackToDefault-MaxCharacterCountandToolOptionValue-UserOverride-MaxCharacterCount, following the existing Method/TimeConstraint tests. (TestID location suffixes left toScripts/FormatFiles.wlsper docs/testing.md.)Manually verified against a licensed Wolfram Engine via
PacletDirectoryLoad: default unchanged (10000); with$toolOptionsoverriding to 50000,StringRepeat["a", 60000]returns ~50k characters instead of truncating at 10k.