diff options
| author | t <t@tjp.lol> | 2026-12-03 18:03:21 -0700 |
|---|---|---|
| committer | t <t@tjp.lol> | 2026-12-04 13:53:47 -0700 |
| commit | 34d347ffb9ced22f6004af320958f9d1a0ae22d2 (patch) | |
| tree | a1fd83ef45d806b5ad448b2b5927d7a19c4accef /tests/fake-agy.lua | |
| parent | 8c167c49f18c76f1f867778341ac821591d9d990 (diff) | |
Page oversized MCP tool results to stay under agy's capv0.1.0
agy truncates any MCP tool result above about 10 KB before the model sees
it, and splitting the text into several blocks does not avoid the cap.
Results over 10,000 bytes now go out as parts of at most 9,600 bytes; the
first part carries a notice and the model fetches the rest through a
relay-only result_part tool. Panto still runs the tool once.
Removes BUGS.md; the evidence moves to docs/findings.md.
Diffstat (limited to 'tests/fake-agy.lua')
| -rw-r--r-- | tests/fake-agy.lua | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/tests/fake-agy.lua b/tests/fake-agy.lua index 904f3bf..3f1643a 100644 --- a/tests/fake-agy.lua +++ b/tests/fake-agy.lua @@ -58,7 +58,7 @@ local function load_catalog(server) assert(rpc(1, 'initialize').result.serverInfo.name == 'pantograph') local tools = rpc(2, 'tools/list').result.tools local schemas={}; for _,t in ipairs(tools) do assert(t._meta['antigravity/alwaysLoad']==true); schemas[t.name]=t.inputSchema end - assert(schemas.std__read and schemas.std__edit and schemas.fixture__echo.properties.rows.items.required[1]=='value') + assert(schemas.std__read and schemas.std__edit and schemas.result_part and schemas.fixture__echo.properties.rows.items.required[1]=='value') return function(late_prompt) if late_prompt then write(7,'tools/call',{name='fixture__echo',arguments={rows={{value=43}}}}) @@ -78,10 +78,22 @@ local function load_catalog(server) local r = rpc(4, 'tools/call', {name='std__read', arguments={path=uv.cwd() .. '/.panto/SYSTEM.md'}}).result assert(r.isError == false and r.content[1].text:find('Short answers', 1, true)) -- Push later transcript reseeds past one agy message (acp.message_bytes). + -- Each result is over agy's MCP result cap, so it arrives in parts. for i=1,4 do - local f=rpc(20+i,'tools/call',{name='std__read',arguments={path=uv.cwd()..'/.panto/history-filler.txt'}}).result - assert(f.isError==false and #f.content[1].text>40000) + local f=rpc(i*20,'tools/call',{name='std__read',arguments={path=uv.cwd()..'/.panto/history-filler.txt'}}).result + assert(f.isError==false and #f.content==1 and #f.content[1].text<=10000,'large result over the agy cap') + local text,parts,n=f.content[1].text:match('^(.*)\n\n%[pantograph: this is part 1 of (%d+) of result (%d+) ') + assert(parts,'large result not sent in parts') + for part=2,tonumber(parts) do + local more=rpc(i*20+part,'tools/call',{name='result_part',arguments={result=tonumber(n),part=part}}).result + assert(more.isError==false and #more.content[1].text<=10000) + text=text..assert(more.content[1].text:match('^%[pantograph: part '..part..' of '..parts..' of result '..n..'%]\n(.*)$')) + end + local last=0; for line in text:gmatch('filler line (%d%d%d%d) abcdefghij') do assert(tonumber(line)==last+1,'parts lost or reordered text'); last=last+1 end + assert(#text>40000 and last>1400) end + assert(rpc(10,'tools/call',{name='result_part',arguments={result=999,part=2}}).result.isError==true) + assert(rpc(11,'tools/call',{name='result_part',arguments={result='1',part=2}}).error.code==-32602) -- Keep the peer connected for subsequent turns. end end |
