address review comments

This commit is contained in:
BarreiroT
2026-10-22 21:18:47 -03:00
parent 5949ba3539
commit 5e34ed16ff
3 changed files with 25 additions and 21 deletions
+6 -5
View File
@@ -495,13 +495,14 @@ uses those same connections. Hosts reach it through `ClineCore`:
Reads and calls reach every enabled settings and Agent Plugin server, including
ones that failed to list tools at startup; the manager reconnects on demand.
`resolveMcpAppTool` only searches servers that loaded tools at startup, since
the agent can only call tools from those. Neither method checks which server an app came from, so a host bridging
app requests must pass the `serverName` from the app's `resolveMcpAppTool`
binding rather than one the app supplies.
the agent can only call tools from those. Neither method checks which server an
app came from, so a host bridging app requests must pass the `serverName` from
the app's `resolveMcpAppTool` binding rather than one the app supplies.
`readMcpAppResource` and `callMcpAppTool` throw when the session was started
without `mcpApps` or has no MCP servers. Hub-backed hosts send these as the `session.mcp_apps.*`
commands, so the hub daemon serves them from the session's own MCP manager.
without `mcpApps` or has no MCP servers. Hub-backed hosts send these as the
`session.mcp_apps.*` commands, so the hub daemon serves them from the session's
own MCP manager.
## Run stall telemetry
@@ -1959,10 +1959,14 @@ describe("HubRuntimeHost MCP Apps commands", () => {
});
it("resolves no app tool when the hub does not support MCP Apps", async () => {
commandMock.mockResolvedValue({
ok: false,
error: { code: "unsupported_command", message: "unsupported" },
});
commandMock.mockRejectedValue(
Object.assign(
new Error(
"Unsupported hub schedule command: session.mcp_apps.resolve_tool",
),
{ code: "unsupported_command" },
),
);
const { HubRuntimeHost } = await import("./hub-runtime-host");
const host = new HubRuntimeHost({ url: "ws://127.0.0.1:25463/hub" });
@@ -1325,21 +1325,20 @@ export class HubRuntimeHost implements RuntimeHost {
sessionId: string,
toolName: string,
): Promise<McpAppToolBinding | undefined> {
const reply = await this.client.command(
"session.mcp_apps.resolve_tool",
{ sessionId, toolName },
sessionId,
{ timeoutMs: null },
);
if (!reply.ok) {
if (reply.error?.code === "unsupported_command") {
try {
const reply = await this.client.command(
"session.mcp_apps.resolve_tool",
{ sessionId, toolName },
sessionId,
{ timeoutMs: null },
);
return reply.payload?.binding as McpAppToolBinding | undefined;
} catch (error) {
if ((error as { code?: unknown })?.code === "unsupported_command") {
return undefined;
}
throw new Error(
hubReplyErrorMessage(reply, "session.mcp_apps.resolve_tool"),
);
throw error;
}
return reply.payload?.binding as McpAppToolBinding | undefined;
}
async readMcpAppResource(