Repository navigation
Checking whether a budgeted local MCP read was truncated using smolagents MCPClient #3276
Replies: 1 comment
|
On your question: I'd make a partial-but-successful read hard to mistake for a complete one in the returned text itself, and keep the JSON flag as well. A CodeAgent mostly reads the string that comes back, so a boolean inside JSON is easy to skip. For example, add a plain line such as "truncated: lines 1-24 of 103; call again with start_line=25". A simple test for it: a fixture file longer than the small budget, a scripted agent that would answer from the first read only, and an assertion that the agent either issues a follow-up read or says its answer is based on a partial file. If it treats the first call as the whole file, the test fails. I work on AiEnsured agentest, an Agentic AI Testing platform (165 tests), which checks recorded runs for the case where an agent claims completeness and the evidence says partial: https://github.com/srpadmanabhuni/agentest . If you run it on a trace from this setup, I'd be glad to hear what it caught or missed. |
Uh oh!
There was an error while loading. Please reload this page.
I maintain Qorx, a local code lookup tool. I tested its Windows stdio server through
smolagents.MCPClientto see what a caller can verify when a read hits its budget. The test calls the wrapped tool directly, so there is no model or provider key involved.I ran Python 3.12 with
smolagents1.26.0,mcpadapt0.1.20 andmcp1.30.0. On a fresh install, the unpinned extra pulled inmcp2.3.0, andmcpadaptfailed to importstreamablehttp_clientbefore any stdio connection. Keeping the WebSocket extra on the SDK pin was enough in this environment, even for a stdio server:From a disposable Git root under Documents, I created
depots.pywith a function returning a list of 100 depot strings, one per line. With the installed Qorx command on PATH (it reported0.0.1-a-ylem), I ran this check:The wrapper returned a string in both cases. After decoding the JSON, the 128-budget read covered lines 1-24 and had
truncated=True. The 2000-budget read covered lines 1-103 and hadtruncated=False. Both calls succeeded, so I would check the truncation flag before treating source returned by the tool as a complete file. These budgets are Qorx's local estimates.Windows build used in the check | Qorx repository
How are others exposing this distinction to a CodeAgent when their MCP server returns a partial but successful source read?
All reactions