Hand the body back from send instead of holding it for a lookup

Holding an unsaved body against its response id let a plugin stash the id
and read it in a later call, which would throw only sometimes and only
for ad-hoc sends. Documenting that was never going to be enough.

send now returns the response and its body together, so there is nothing
to stash: an unsaved body is a value you were handed. ctx.httpResponse
.body() goes back to meaning one thing, a saved response read by id, and
refuses ids it has no row for. Reading is identical either way, so no
caller has to know which kind of send it made.
This commit is contained in:
Gregory Schier
2026-08-16 10:07:44 -07:00
parent 8c72538102
commit 0e14625e62
8 changed files with 73 additions and 74 deletions
@@ -80,7 +80,7 @@ export function registerHttpRequestTools(server: McpServer, ctx: McpServerContex
throw new Error(`HTTP request with ID ${id} not found`);
}
const response = await workspaceCtx.yaak.httpRequest.send({ httpRequest });
const { httpResponse: response } = await workspaceCtx.yaak.httpRequest.send({ httpRequest });
return {
content: [