fix: include required result members in 2026-07-28 mock responses (#341)

At the 2026-07-28 revision every server result must include resultType,
and cacheable results (server/discover, tools/list, prompts/list,
resources/list, resources/templates/list, resources/read) must also
include ttlMs and cacheScope. The client-direction mock servers omitted
these, so a strictly-validating client was failed by the suite's own
non-conformant mock.

The shared stateless mock now stamps the missing members onto handler
results and its server/discover response (withRequiredDraftResultFields),
and the hand-rolled per-scenario servers set them explicitly or route
their fallbacks through the helper. The deliberately resultType-less
probe in sep-2322-client-request-state is unchanged. New tests pin the
response shapes.
This commit is contained in:
Felix Weinberger 2026-06-16 15:13:23 +01:00 • committed by GitHub
commit b9041ea41b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -276,6 +276,9 @@ export class HttpCustomHeadersScenario extends BaseHttpScenario {
jsonrpc: '2.0',
id: request.id,
result: {
resultType: 'complete',
ttlMs: 0,
cacheScope: 'private',
tools: [
{
name: 'test_custom_headers',
@ -591,6 +594,7 @@ export class HttpCustomHeadersScenario extends BaseHttpScenario {
jsonrpc: '2.0',
id: request.id,
result: {
resultType: 'complete',
content: [{ type: 'text', text: 'Custom headers test completed' }]
}
});
@ -760,6 +764,9 @@ export class HttpInvalidToolHeadersScenario extends BaseHttpScenario {
jsonrpc: '2.0',
id: request.id,
result: {
resultType: 'complete',
ttlMs: 0,
cacheScope: 'private',
tools: [
// ── Valid tool (should be kept by client) ──
{
@ -938,6 +945,7 @@ export class HttpInvalidToolHeadersScenario extends BaseHttpScenario {
jsonrpc: '2.0',
id: request.id,
result: {
resultType: 'complete',
content: [{ type: 'text', text: 'Tool call received' }]
}
});