agy-cli 0.1.19: every client tool is listed always loaded, so agy no longer hides large ones from the model (#989)
agy loads an MCP tool on demand, outside the model's function list,
unless the server's tools/list marks it with
_meta {"antigravity/alwaysLoad": true} (agy's changelog, 1.3.5; the key is
in the 1.5.5 binary next to SplitEnabledToolsByEagerLazy and
McpServerSpec.force_all_tools_eager). The bridge's agent has tools: [],
so the model had no working way to load them: on klarkxy's 72-tool
catalog, tools from ~691 tokens up (bash, grep, task, ask_user) were
never offered while read, glob and write were. listTools now adds the
key to every tool it hands agy; the stored catalog and its signature
are unchanged.
Ran: wsl-run (magpie-desktop) with HOME=$(mktemp -d): bun test
packages/agy-cli (13 pass), bun scripts/check.mjs (ok), root bun test
(8207 pass, 19 skip, 0 fail) at base 017cd73e; after the rebase onto
02fe223d, packages/agy-cli + packages/astudio (95 pass) and check again.
Broken by hand: listTools returning this.tools as before makes the new
smoke check red ("1 FAILURES (334 checks)", _meta null on all three).
Not tried: a real agy turn on Gemini 4 Carbon (no Google contact from
here), so that agy now puts the large tools in gen_metadata is from its
changelog and strings, not a run. The report gives sizes, not schemas;
the fixture is sized to them (bash ~7KB, read ~140B).
Reported-by: klarkxy
This commit is contained in:
@@ -57,6 +57,9 @@ MCP server. The control port listens on loopback only, with a token per process.
|
||||
and says to update.
|
||||
- The private `nc` applies only to the agy processes the plugin starts, but for
|
||||
those it stands in for every `nc` agy runs.
|
||||
- Every client tool is listed with `_meta: {"antigravity/alwaysLoad": true}`.
|
||||
Without it agy loads larger tools on demand, out of the model's function
|
||||
list, and the model cannot reach them (#989).
|
||||
|
||||
## Features
|
||||
|
||||
|
||||
@@ -43,6 +43,7 @@ agy 连接 `--ide-mcp-port` 时会运行 `nc 127.0.0.1 <端口>`。插件在 agy
|
||||
- 这依赖 agy 拨号的方式,不是 agy 公开承诺的接口,已在 1.4.12 和 1.5.0 上验证。agy 低于
|
||||
1.4.12 时,插件会直接报错并提示升级。
|
||||
- 这个 `nc` 只对插件启动的 agy 进程生效,但对这些进程来说,它替换了 agy 运行的所有 `nc`。
|
||||
- 客户端的每个工具都带 `_meta: {"antigravity/alwaysLoad": true}` 列出。不带的话,agy 会把较大的工具改为按需加载,不放进模型的函数列表,模型就用不到它们(#989)。
|
||||
|
||||
## 功能
|
||||
|
||||
|
||||
@@ -47,6 +47,8 @@ const AGENT_NAME = "magpie-bridge"
|
||||
const MCP_SERVER_PATH = fileURLToPath(new URL("./mcp-server.mjs", import.meta.url))
|
||||
// agy exposes tools from the --ide-mcp-port server as direct functions with this prefix.
|
||||
const IDE_TOOL_PREFIX = "mcp_ide-tools_"
|
||||
// agy 1.3.5+: a tools/list entry with this _meta key is never deferred.
|
||||
const ALWAYS_LOAD = "antigravity/alwaysLoad"
|
||||
const IDLE_MS = positiveTimeout(process.env.AGY_BRIDGE_IDLE_MS, 10 * 60 * 1000)
|
||||
// Read at call time so a host (or a test) can size the pool without a reload.
|
||||
function maxProcs() {
|
||||
@@ -1320,7 +1322,11 @@ class Proc {
|
||||
waiter.resolve()
|
||||
}
|
||||
this.listWaiters = this.listWaiters.filter((item) => item.version > this.listedVersion)
|
||||
return this.tools
|
||||
// agy loads an MCP tool on demand, out of the model's function list, unless
|
||||
// the server marks it always loaded; tools with larger schemas were left out
|
||||
// and the model could not reach them (#989). Every client-declared tool is
|
||||
// one the client means the model to see.
|
||||
return this.tools.map((tool) => ({ ...tool, _meta: { ...tool._meta, [ALWAYS_LOAD]: true } }))
|
||||
}
|
||||
|
||||
addWatcher(socket) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@magpie-community/opencode-agy-cli-auth",
|
||||
"version": "0.1.18",
|
||||
"version": "0.1.19",
|
||||
"description": "Magpie/OpenCode model provider that connects your local agy CLI through the Agent Client Protocol (agy acp), so Antigravity subscription models run through the real CLI",
|
||||
"type": "module",
|
||||
"main": "./opencode.mjs",
|
||||
|
||||
@@ -888,6 +888,37 @@ let nativeConv
|
||||
check("tools/list preserves JSON schema", listed?.tools?.[0] === "echo" || logs().some(event => event.type === "toolsList" && event.tools.includes("echo")))
|
||||
}
|
||||
|
||||
{
|
||||
// #989: agy left tools with larger schemas (the reporter's bash at ~1005
|
||||
// tokens, grep at ~691) out of the model's function list and loaded them on
|
||||
// demand, while small ones (read at ~561 and below) were listed. The report
|
||||
// gives sizes, not the schemas, so these are sized to match.
|
||||
const words = n => Array.from({ length: n }, (_, i) => `word${i}`).join(" ")
|
||||
const bigTool = {
|
||||
name: "bash",
|
||||
description: words(600),
|
||||
input_schema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
command: { type: "string", description: words(200) },
|
||||
timeout: { type: "number", description: words(40) },
|
||||
workdir: { type: "string", description: words(40) },
|
||||
description: { type: "string", description: words(60) },
|
||||
},
|
||||
required: ["command", "description"],
|
||||
},
|
||||
}
|
||||
const smallTool = { name: "read", description: "Read a file", input_schema: { type: "object", properties: { filePath: { type: "string" } }, required: ["filePath"] } }
|
||||
const res = await callFetch({ model, messages: [{ role: "user", content: "large tool schema listed" }], tools: [bigTool, smallTool, echoTool] })
|
||||
await readSSE(res)
|
||||
const listed = inits().at(-1)?.tools || []
|
||||
check("every client tool is listed always loaded, a large schema too (#989)",
|
||||
res.status === 200 && listed.length === 3 &&
|
||||
listed.every(tool => tool._meta?.["antigravity/alwaysLoad"] === true) &&
|
||||
listed.find(tool => tool.name === "bash")?.inputSchema?.properties?.command?.type === "string",
|
||||
JSON.stringify(listed.map(tool => [tool.name, tool._meta, JSON.stringify(tool).length])))
|
||||
}
|
||||
|
||||
{
|
||||
const secondBody = continuation(nativeBody, nativeEvents, "native-result")
|
||||
const assistant = secondBody.messages[1]
|
||||
|
||||
Reference in New Issue
Block a user