Skip to content

Commit 674cc9b

Browse files
committed
chore: implement passing scenario through everything-client.ts
1 parent c6dbe6a commit 674cc9b

1 file changed

Lines changed: 65 additions & 0 deletions

File tree

examples/clients/typescript/everything-client.ts

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,71 @@ async function runBasicClient(serverUrl: string): Promise<void> {
8787

8888
registerScenarios(['initialize', 'tools-call'], runBasicClient);
8989

90+
// ============================================================================
91+
// Stateless scenario (SEP-2575)
92+
// ============================================================================
93+
94+
async function runStatelessClient(serverUrl: string): Promise<void> {
95+
logger.debug('Starting stateless client flow...');
96+
97+
// Call server/discover
98+
logger.debug('Calling server/discover...');
99+
const discoverResponse = await fetch(serverUrl, {
100+
method: 'POST',
101+
headers: { 'Content-Type': 'application/json' },
102+
body: JSON.stringify({
103+
jsonrpc: '2.0',
104+
id: 'discover-1',
105+
method: 'server/discover'
106+
})
107+
});
108+
109+
if (!discoverResponse.ok) {
110+
throw new Error(`Discovery failed: ${discoverResponse.status}`);
111+
}
112+
const discoverResult = await discoverResponse.json();
113+
logger.debug(
114+
'Successfully discovered server capabilities:',
115+
JSON.stringify(discoverResult.result)
116+
);
117+
118+
// Call tools/list with required inline _meta tags
119+
logger.debug('Calling tools/list with inline _meta...');
120+
const toolsResponse = await fetch(serverUrl, {
121+
method: 'POST',
122+
headers: { 'Content-Type': 'application/json' },
123+
body: JSON.stringify({
124+
jsonrpc: '2.0',
125+
id: 2,
126+
method: 'tools/list',
127+
params: {
128+
_meta: {
129+
'io.modelcontextprotocol/protocolVersion': 'DRAFT-2026-v1',
130+
'io.modelcontextprotocol/clientInfo': {
131+
name: 'conformance-test-client',
132+
version: '1.0.0'
133+
},
134+
'io.modelcontextprotocol/clientCapabilities': { roots: {} }
135+
}
136+
}
137+
})
138+
});
139+
140+
if (!toolsResponse.ok) {
141+
throw new Error(`Tools list failed: ${toolsResponse.status}`);
142+
}
143+
const toolsResult = await toolsResponse.json();
144+
logger.debug(
145+
'Successfully listed tools statelessly:',
146+
JSON.stringify(toolsResult.result)
147+
);
148+
149+
logger.debug('Stateless client flow completed successfully');
150+
}
151+
152+
// Register the scenario handler
153+
registerScenario('stateless-client', runStatelessClient);
154+
90155
// ============================================================================
91156
// Auth scenarios - well-behaved client
92157
// ============================================================================

0 commit comments

Comments
 (0)