@@ -49,6 +49,7 @@ func init() {
4949 registerScenario ("elicitation-sep1034-client-defaults" , runElicitationDefaultsClient )
5050 registerScenario ("sse-retry" , runSSERetryClient )
5151 registerScenario ("json-schema-ref-no-deref" , runJSONSchemaRefNoDerefClient )
52+ registerScenario ("json-schema-2020-12-preservation" , runJSONSchemaPreservationClient )
5253 registerScenario ("sep-2322-client-request-state" , runMrtrClient )
5354 registerScenario ("http-standard-headers" , runHTTPStandardHeadersClient )
5455 registerScenario ("http-custom-headers" , runHTTPCustomHeadersClient )
@@ -343,6 +344,46 @@ func runJSONSchemaRefNoDerefClient(ctx context.Context, serverURL string, _ map[
343344 return nil
344345}
345346
347+ // ============================================================================
348+ // json-schema-2020-12-preservation scenario (SEP-1613, SEP-2106)
349+ // ============================================================================
350+
351+ // runJSONSchemaPreservationClient echoes the focal tool's inputSchema back to
352+ // the referee verbatim, through the permissive json_schema_echo tool, so that
353+ // it can observe which 2020-12 keywords survived the client's parse of
354+ // tools/list. The Go SDK surfaces a server's schema as the raw JSON object it
355+ // received, so nothing is stripped.
356+ func runJSONSchemaPreservationClient (ctx context.Context , serverURL string , _ map [string ]any ) error {
357+ session , err := connectToServer (ctx , serverURL )
358+ if err != nil {
359+ return err
360+ }
361+ defer session .Close ()
362+
363+ tools , err := session .ListTools (ctx , nil )
364+ if err != nil {
365+ return fmt .Errorf ("session.ListTools(): %v" , err )
366+ }
367+
368+ const focalTool = "json_schema_2020_12_tool"
369+ idx := slices .IndexFunc (tools .Tools , func (t * mcp.Tool ) bool {
370+ return t .Name == focalTool
371+ })
372+ if idx == - 1 {
373+ return fmt .Errorf ("tool %q not found" , focalTool )
374+ }
375+
376+ const echoTool = "json_schema_echo"
377+ if _ , err := session .CallTool (ctx , & mcp.CallToolParams {
378+ Name : echoTool ,
379+ Arguments : map [string ]any {"schema" : tools .Tools [idx ].InputSchema },
380+ }); err != nil {
381+ return fmt .Errorf ("session.CallTool(%q): %v" , echoTool , err )
382+ }
383+
384+ return nil
385+ }
386+
346387// ============================================================================
347388// SEP-2322 multi-round-trip client scenario
348389// ============================================================================
0 commit comments