AI-assisted draft prepared for the AI Relay Check account. The examples below use local fixtures.
Valid JSON can still miss a required tool argument. If a stream ends early, the same tool may never receive a complete invocation. A local fixture separates argument parsing from the backend, and it can be run before testing a paid route.
Start with a tool whose required arguments are a string named label and an integer named count. Use known values and check the results before executing any tool.
import assert from "node:assert/strict";
function readFixtureArguments(chunks, complete) {
if (!complete) throw new Error("Incomplete tool invocation");
const args = JSON.parse(chunks.join(""));
if (args.label !== "sample" || args.count !== 2) {
throw new Error("Unexpected tool arguments");
}
return args;
}
assert.deepEqual(readFixtureArguments(['{"label":"sample",', '"count":2}'], true),
{ label: "sample", count: 2 });
assert.throws(() => readFixtureArguments(['{"label":"sample"}'], true), /Unexpected/);
assert.throws(() => readFixtureArguments(['{"label":"sample",'], false), /Incomplete/);
In a live client, set the completion flag from the actual protocol event and associate fragments with the correct invocation ID. Then return a mock result and confirm the model continues using that result. A transport-level HTTP 200 alone cannot validate the tool workflow.
Top comments (0)