fix(core): restore the v1 content default for tools/call results on the legacy era (#2456)

This commit is contained in:
Felix Weinberger 2026-07-09 14:02:08 +01:00 • committed by GitHub
commit 44797d7779
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -52,6 +52,7 @@ import {
missingClientCapabilities,
MissingRequiredClientCapabilityError,
modernProtocolVersions,
normalizeContentlessToolResult,
parseSchema,
Protocol,
ProtocolError,
@ -524,7 +525,12 @@ export class Server extends Protocol<ServerContext> {
return result;
}
const validationResult = codec.validateResult('tools/call', result);
// v1-parity authoring affordance, era-independent: a content-less
// handler result normalizes to content: [] before era validation.
// Other result families' bodies stay un-normalized and fail loudly.
const normalizedResult = normalizeContentlessToolResult(result);
const validationResult = codec.validateResult('tools/call', normalizedResult);
if (!validationResult.ok) {
throw new ProtocolError(
validationResult.reason === 'not-in-era' ? ProtocolErrorCode.InternalError : ProtocolErrorCode.InvalidParams,