@@ -348,7 +348,8 @@ func (b *KafkaSchemaRegistryToolBuilder) handleSchemaSubjectDelete(ctx context.C
348348 return b .handleError ("get subject name" , err ), nil
349349 }
350350
351- versions , err := client .DeleteSubject (ctx , subject )
351+ // Delete subject using correct API signature (soft delete by default)
352+ versions , err := client .DeleteSubject (ctx , subject , sr .SoftDelete )
352353 if err != nil {
353354 return b .handleError ("delete schema subject" , err ), nil
354355 }
@@ -416,30 +417,41 @@ func (b *KafkaSchemaRegistryToolBuilder) handleSchemaVersionDelete(ctx context.C
416417 return b .handleError ("parse version number" , err ), nil
417418 }
418419
419- deletedVersion , err := client .DeleteSchemaVersion (ctx , subject , version )
420+ // Delete schema version using correct API signature (soft delete by default)
421+ err = client .DeleteSchema (ctx , subject , version , sr .SoftDelete )
420422 if err != nil {
421423 return b .handleError ("delete schema version" , err ), nil
422424 }
423- return b .marshalResponse (deletedVersion )
425+
426+ return mcp .NewToolResultText (fmt .Sprintf ("Schema version %d for subject %s deleted successfully" , version , subject )), nil
424427}
425428
426429// handleSchemaCompatibilityGet handles getting compatibility setting
427430func (b * KafkaSchemaRegistryToolBuilder ) handleSchemaCompatibilityGet (ctx context.Context , client * sr.Client , request mcp.CallToolRequest ) (* mcp.CallToolResult , error ) {
428- subject := request .GetString ("subject" ) // Optional for global compatibility
429-
430- var compatibility sr.CompatibilityLevel
431- var err error
431+ subject := request .GetString ("subject" , "" ) // Optional for global compatibility
432432
433+ var results []sr.CompatibilityResult
433434 if subject != "" {
434- compatibility , err = client .Compatibility (ctx , subject )
435+ // Get compatibility for specific subject
436+ results = client .Compatibility (ctx , subject )
435437 } else {
436- compatibility , err = client .Config (ctx )
438+ // Get global compatibility
439+ results = client .Compatibility (ctx )
437440 }
438441
439- if err != nil {
440- return b .handleError ("get compatibility setting" , err ), nil
442+ // Check for errors in results
443+ for _ , result := range results {
444+ if result .Err != nil {
445+ return b .handleError ("get compatibility setting" , result .Err ), nil
446+ }
447+ }
448+
449+ // Return the first result (there should only be one)
450+ if len (results ) > 0 {
451+ return b .marshalResponse (map [string ]string {"compatibility" : results [0 ].Level .String ()})
441452 }
442- return b .marshalResponse (map [string ]string {"compatibility" : string (compatibility )})
453+
454+ return mcp .NewToolResultError ("No compatibility result returned" ), nil
443455}
444456
445457// handleSchemaCompatibilitySet handles setting compatibility level
@@ -449,31 +461,42 @@ func (b *KafkaSchemaRegistryToolBuilder) handleSchemaCompatibilitySet(ctx contex
449461 return b .handleError ("get compatibility level" , err ), nil
450462 }
451463
452- subject := request .GetString ("subject" ) // Optional for global compatibility
464+ subject := request .GetString ("subject" , "" ) // Optional for global compatibility
453465
454466 // Parse compatibility level
455467 var compatibility sr.CompatibilityLevel
456468 switch strings .ToUpper (compatibilityStr ) {
457469 case "BACKWARD" :
458- compatibility = sr .CompatibilityBackward
470+ compatibility = sr .CompatBackward
459471 case "FORWARD" :
460- compatibility = sr .CompatibilityForward
472+ compatibility = sr .CompatForward
461473 case "FULL" :
462- compatibility = sr .CompatibilityFull
474+ compatibility = sr .CompatFull
463475 case "NONE" :
464- compatibility = sr .CompatibilityNone
476+ compatibility = sr .CompatNone
465477 default :
466478 return mcp .NewToolResultError (fmt .Sprintf ("Invalid compatibility level: %s. Valid levels: BACKWARD, FORWARD, FULL, NONE" , compatibilityStr )), nil
467479 }
468480
481+ // Create SetCompatibility request
482+ setCompat := sr.SetCompatibility {
483+ Level : compatibility ,
484+ }
485+
486+ var results []sr.CompatibilityResult
469487 if subject != "" {
470- _ , err = client .SetCompatibility (ctx , subject , compatibility )
488+ // Set compatibility for specific subject
489+ results = client .SetCompatibility (ctx , setCompat , subject )
471490 } else {
472- _ , err = client .SetConfig (ctx , compatibility )
491+ // Set global compatibility
492+ results = client .SetCompatibility (ctx , setCompat )
473493 }
474494
475- if err != nil {
476- return b .handleError ("set compatibility level" , err ), nil
495+ // Check for errors in results
496+ for _ , result := range results {
497+ if result .Err != nil {
498+ return b .handleError ("set compatibility level" , result .Err ), nil
499+ }
477500 }
478501
479502 return mcp .NewToolResultText (fmt .Sprintf ("Compatibility level set to %s" , compatibilityStr )), nil
0 commit comments