fix(core): restore the v1 content default for tools/call results on the legacy era (#2456)
This commit is contained in:
parent
3834921074
commit
44797d7779
1 changed files with 347 additions and 96 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in a new issue