mirror of
https://github.com/morluto/rea.git
synced 2026-10-26 17:35:11 +00:00
test(mcp): reuse advertised schema in inventory check (#2469)
Reuse the current advertised binary_session definition for real SDK reply validation while preserving all inventory assertions and the 10-second deadline. Avoid initializing validators for unrelated tools in this correctness check. Closes #2453. Assisted-by: Reimu (gensokyo-skills:reimu-incident-triage)
This commit is contained in:
1 parent
172407787f
commit
a6efa4fcef
1 file changed
+11
-4
@@ -122,11 +122,18 @@ it("advertises the complete currently available inventory with a session", async
|
||||
|
||||
const listed = await client.listTools();
|
||||
const names = listed.tools.map((t) => t.name);
|
||||
const sessionTool = listed.tools.find(
|
||||
({ name }) => name === "binary_session",
|
||||
);
|
||||
if (sessionTool === undefined)
|
||||
throw new Error("Missing advertised binary_session tool");
|
||||
// Validate this reply with its current advertised schema. The SDK otherwise
|
||||
// builds output validators for the entire catalog on the first cached call.
|
||||
const status = structured(
|
||||
await client.callTool({
|
||||
name: "binary_session",
|
||||
arguments: {},
|
||||
}),
|
||||
await client.callTool(
|
||||
{ name: "binary_session", arguments: {} },
|
||||
{ toolDefinition: sessionTool },
|
||||
),
|
||||
);
|
||||
const inventory = expandToolAvailability(
|
||||
toolContract("binary_session").outputSchema.parse(status).result
|
||||
|
||||
Reference in new issue
Block a user