@@ -83,6 +83,95 @@ export class LoggingSetLevelScenario implements ClientScenario {
8383 }
8484}
8585
86+ export class PingScenario implements ClientScenario {
87+ name = 'ping' ;
88+ description = `Test ping utility for connection health check.
89+
90+ **Server Implementation Requirements:**
91+
92+ **Endpoint**: \`ping\`
93+
94+ **Requirements**:
95+ - Accept ping request with no parameters
96+ - Respond promptly with empty object \`{}\`
97+
98+ **Request Format**:
99+
100+ \`\`\`json
101+ {
102+ "jsonrpc": "2.0",
103+ "id": "123",
104+ "method": "ping"
105+ }
106+ \`\`\`
107+
108+ **Response Format**:
109+
110+ \`\`\`json
111+ {
112+ "jsonrpc": "2.0",
113+ "id": "123",
114+ "result": {}
115+ }
116+ \`\`\`
117+
118+ **Implementation Note**: The ping utility allows either party to verify that their counterpart is still responsive and the connection is alive.` ;
119+
120+ async run ( serverUrl : string ) : Promise < ConformanceCheck [ ] > {
121+ const checks : ConformanceCheck [ ] = [ ] ;
122+
123+ try {
124+ const connection = await connectToServer ( serverUrl ) ;
125+
126+ // Send ping request
127+ const result = await connection . client . ping ( ) ;
128+
129+ // Validate response (should return empty object {})
130+ const errors : string [ ] = [ ] ;
131+ if ( result && Object . keys ( result ) . length > 0 ) {
132+ errors . push ( 'Expected empty object {} response' ) ;
133+ }
134+
135+ checks . push ( {
136+ id : 'ping' ,
137+ name : 'Ping' ,
138+ description : 'Server responds to ping requests' ,
139+ status : errors . length === 0 ? 'SUCCESS' : 'FAILURE' ,
140+ timestamp : new Date ( ) . toISOString ( ) ,
141+ errorMessage : errors . length > 0 ? errors . join ( '; ' ) : undefined ,
142+ specReferences : [
143+ {
144+ id : 'MCP-Ping' ,
145+ url : 'https://modelcontextprotocol.io/specification/2025-06-18/basic/utilities/ping'
146+ }
147+ ] ,
148+ details : {
149+ result
150+ }
151+ } ) ;
152+
153+ await connection . close ( ) ;
154+ } catch ( error ) {
155+ checks . push ( {
156+ id : 'ping' ,
157+ name : 'Ping' ,
158+ description : 'Server responds to ping requests' ,
159+ status : 'FAILURE' ,
160+ timestamp : new Date ( ) . toISOString ( ) ,
161+ errorMessage : `Failed: ${ error instanceof Error ? error . message : String ( error ) } ` ,
162+ specReferences : [
163+ {
164+ id : 'MCP-Ping' ,
165+ url : 'https://modelcontextprotocol.io/specification/2025-06-18/basic/utilities/ping'
166+ }
167+ ]
168+ } ) ;
169+ }
170+
171+ return checks ;
172+ }
173+ }
174+
86175export class CompletionCompleteScenario implements ClientScenario {
87176 name = 'completion-complete' ;
88177 description = `Test completion endpoint.
0 commit comments