Repository navigation
Description
Follow-up to #6762. Two MCP tool-input gaps that the #6762 hardening did not actually close.
1. full_text_search has no upper bound on limit
mcp/src/main/java/com/arcadedb/mcp/tools/FullTextSearchTool.java:79-82 declares the property with only default and description - no minimum, no maximum - and :96-98 enforces only the lower bound:
final int limit = args.getInt("limit", DEFAULT_LIMIT);
if (limit < 1)
throw new IllegalArgumentException("'limit' must be at least 1, got " + limit);Compare the sibling that #6762 did fix, QueryTool.java:39-44, :82-83:
private static final int MAX_LIMIT = 100_000;
...
if (limit < 1 || limit > MAX_LIMIT)The value goes straight to FullTextSearch.search(typeIndex, queryText, limit) (:110), and LSMTreeFullTextIndex.buildScoredCursor bounds the per-bucket heap only when limit < scoreMap.size() (engine/src/main/java/com/arcadedb/index/fulltext/LSMTreeFullTextIndex.java:662), so a huge limit degenerates to "return every match". The result loop's only guard is if (results.length() >= limit) break; (:124), so every hit is loaded via database.lookupByRID, serialized, and accumulated into the reply's JSONArray.
Repro:
tools/call full_text_search {"database":"db","indexName":"Article[content]","queryText":"a","limit":2147483647}returns all N matching documents, fully serialized, in one MCP text block: O(N) record loads and O(N) documents held in heap at once, from a read-only non-root MCP caller.
Note that #6762's description listed the full-text tool among the tools that "all cap their windows". FullTextSearchTool:97-98 only rejects < 1, so that part was inaccurate and the gap is still open. MCPServerPluginTest.fullTextSearchRejectsNonPositiveLimit (:2455-2476) covers only the lower bound, and Issue6762ToolInputBoundsTest.theDeclaredSchemaMatchesTheEnforcedWindow (:117-125) asserts that invariant for query only - which full_text_search violates, since its schema declares no window at all.
Fix: add a MAX_LIMIT (the sibling hybrid tool already caps its full-text leg at HybridSearchTool.MAX_LEG_CANDIDATES = 1_000 via legLimit(k)), reject limit > MAX_LIMIT next to the existing check, and declare minimum/maximum on the property so a client can pre-validate. Extending Issue6762ToolInputBoundsTest to every tool with a window would prevent the next one.
2. set_server_setting declares value required, then defaults it to ""
mcp/src/main/java/com/arcadedb/mcp/tools/SetServerSettingTool.java:50 marks both members required:
.put("required", new JSONArray().put("key").put("value"))but :63-67 reads them with empty-string defaults and re-checks only the key:
final String key = args.getString("key", "");
final String value = args.getString("value", "");
if (key.isEmpty())
throw new IllegalArgumentException("Setting key is required");So an absent or empty value reaches server.getConfiguration().setValue(key, value) (:75), and ContextConfiguration.setValue stores it with no type validation (engine/src/main/java/com/arcadedb/ContextConfiguration.java:101-106).
Repro (as root):
tools/call set_server_setting {"key":"arcadedb.asyncWorkerThreads"}returns isError:false with {"newValue":"","message":"Setting 'arcadedb.asyncWorkerThreads' updated successfully."}, leaving "" in the ContextConfiguration for a numeric key. The next read via getValueAsInteger/getValueAsLong does Integer.parseInt(v.toString().trim()) (ContextConfiguration.java:191-203) and throws NumberFormatException inside whatever component performs it - a failure surfacing far from the call that caused it. And because the model gets a success envelope for a call its own schema says was malformed, it has no reason to retry with a value.
The HTTP twin does refuse the value-less form (PostServerCommandHandler.setServerSetting, :904-917, raises "Expected "), so this is not a deliberate parity choice.
Fix: mirror the key check (if (value.isEmpty()) throw new IllegalArgumentException("'value' is required");), or route both members through MCPToolUtils.requireString as the newer tools do. ProfilerStartTool:67-68 already documents the principle: "The declared schema range is advisory ... so re-check it here".
Also checked, clean
For the record, since it narrows where to look next: metrics/ and tracing/ are symmetric on plugin stop (registry removed and closed, the tracing handler wrapped in DeactivatableObservationHandler because ObservationRegistry has no remove API, the LogManager trace-context supplier cleared), hold no per-database meter registration, use no user-derived meter tag, and do no unconditional string formatting on a hot path. MCP protocol framing/lifecycle and per-caller authorization on every server-scoped tool are present and test-asserted.
Activity
docs(#6837): reword the release-note paragraph that opened with a bar…
test(#6837): say why the bound cases name indexes the fixture does no…
style(#6837): drop the manual column alignment on FullTextSearchTool.…
fix(#6837,#6838): bound the remaining MCP numeric tool inputs, and st…
robfrank commentedon Aug 28, 2026
Fixed in #6874 (merged).
You were right that #6762 did not close this.
full_text_searchstill accepted anylimit, and since every hit it returns is loaded and serialized into one reply, a huge limit meant "return every matching document in a single message" — it is now capped at 1,000, and the tool's schema declares that window so a client can reject the call before sending it. The same half-bounded shape turned up inefSearchonvector_searchandhybrid_search, which is now capped too.set_server_settingno longer treats a missingvalueas an empty string: an absent value is rejected, and an empty one is rejected for any setting that is not a string, so a numeric key can no longer be left holding""for some later reader to trip over. An empty string still works for string settings, which is how you clear one.The regression test generalises this rather than covering only the two tools: every numeric input across the whole tool surface must now declare both ends of its window, so the next tool that forgets one fails CI instead of shipping. One gap is deliberately left open and tracked in #6875 — a non-empty but unparseable value is still stored, and fixing that first requires settling a disagreement between two config read paths about what parses.
❤️ Thanks for helping make ArcadeDB better! ArcadeDB is free and open source, sustained by its community. If it's useful to you or your company, please consider becoming a sponsor to keep development going.