@@ -356,6 +356,7 @@ public override void Write(Utf8JsonWriter writer, ContentBlock value, JsonSerial
356356}
357357
358358/// <summary>Represents text provided to or from an LLM.</summary>
359+ [ DebuggerDisplay ( "{DebuggerDisplay,nq}" ) ]
359360public sealed class TextContentBlock : ContentBlock
360361{
361362 /// <inheritdoc/>
@@ -366,9 +367,16 @@ public sealed class TextContentBlock : ContentBlock
366367 /// </summary>
367368 [ JsonPropertyName ( "text" ) ]
368369 public required string Text { get ; set ; }
370+
371+ /// <inheritdoc/>
372+ public override string ToString ( ) => Text ;
373+
374+ [ DebuggerBrowsable ( DebuggerBrowsableState . Never ) ]
375+ private string DebuggerDisplay => $ "Text = \" { Text } \" ";
369376}
370377
371378/// <summary>Represents an image provided to or from an LLM.</summary>
379+ [ DebuggerDisplay ( "{DebuggerDisplay,nq}" ) ]
372380public sealed class ImageContentBlock : ContentBlock
373381{
374382 /// <inheritdoc/>
@@ -388,9 +396,21 @@ public sealed class ImageContentBlock : ContentBlock
388396 /// </remarks>
389397 [ JsonPropertyName ( "mimeType" ) ]
390398 public required string MimeType { get ; set ; }
399+
400+ [ DebuggerBrowsable ( DebuggerBrowsableState . Never ) ]
401+ private string DebuggerDisplay
402+ {
403+ get
404+ {
405+ const int MaxLength = 80 ;
406+ string dataPreview = Data . Length <= MaxLength ? Data : $ "{ Data . Substring ( 0 , MaxLength ) } ...";
407+ return $ "MimeType = { MimeType } , Data = { dataPreview } ";
408+ }
409+ }
391410}
392411
393412/// <summary>Represents audio provided to or from an LLM.</summary>
413+ [ DebuggerDisplay ( "{DebuggerDisplay,nq}" ) ]
394414public sealed class AudioContentBlock : ContentBlock
395415{
396416 /// <inheritdoc/>
@@ -410,12 +430,24 @@ public sealed class AudioContentBlock : ContentBlock
410430 /// </remarks>
411431 [ JsonPropertyName ( "mimeType" ) ]
412432 public required string MimeType { get ; set ; }
433+
434+ [ DebuggerBrowsable ( DebuggerBrowsableState . Never ) ]
435+ private string DebuggerDisplay
436+ {
437+ get
438+ {
439+ const int MaxLength = 80 ;
440+ string dataPreview = Data . Length <= MaxLength ? Data : $ "{ Data . Substring ( 0 , MaxLength ) } ...";
441+ return $ "MimeType = { MimeType } , Data = { dataPreview } ";
442+ }
443+ }
413444}
414445
415446/// <summary>Represents the contents of a resource, embedded into a prompt or tool call result.</summary>
416447/// <remarks>
417448/// It is up to the client how best to render embedded resources for the benefit of the LLM and/or the user.
418449/// </remarks>
450+ [ DebuggerDisplay ( "{DebuggerDisplay,nq}" ) ]
419451public sealed class EmbeddedResourceBlock : ContentBlock
420452{
421453 /// <inheritdoc/>
@@ -433,12 +465,16 @@ public sealed class EmbeddedResourceBlock : ContentBlock
433465 /// </remarks>
434466 [ JsonPropertyName ( "resource" ) ]
435467 public required ResourceContents Resource { get ; set ; }
468+
469+ [ DebuggerBrowsable ( DebuggerBrowsableState . Never ) ]
470+ private string DebuggerDisplay => $ "Uri = { Resource . Uri } ";
436471}
437472
438473/// <summary>Represents a resource that the server is capable of reading, included in a prompt or tool call result.</summary>
439474/// <remarks>
440475/// Resource links returned by tools are not guaranteed to appear in the results of `resources/list` requests.
441476/// </remarks>
477+ [ DebuggerDisplay ( "{DebuggerDisplay,nq}" ) ]
442478public sealed class ResourceLinkBlock : ContentBlock
443479{
444480 /// <inheritdoc/>
@@ -500,9 +536,13 @@ public sealed class ResourceLinkBlock : ContentBlock
500536 /// </remarks>
501537 [ JsonPropertyName ( "size" ) ]
502538 public long ? Size { get ; set ; }
539+
540+ [ DebuggerBrowsable ( DebuggerBrowsableState . Never ) ]
541+ private string DebuggerDisplay => $ "Name = { Name } , Uri = { Uri } ";
503542}
504543
505544/// <summary>Represents a request from the assistant to call a tool.</summary>
545+ [ DebuggerDisplay ( "{DebuggerDisplay,nq}" ) ]
506546public sealed class ToolUseContentBlock : ContentBlock
507547{
508548 /// <inheritdoc/>
@@ -528,9 +568,13 @@ public sealed class ToolUseContentBlock : ContentBlock
528568 /// </summary>
529569 [ JsonPropertyName ( "input" ) ]
530570 public required JsonElement Input { get ; set ; }
571+
572+ [ DebuggerBrowsable ( DebuggerBrowsableState . Never ) ]
573+ private string DebuggerDisplay => $ "Name = { Name } , Id = { Id } ";
531574}
532575
533576/// <summary>Represents the result of a tool use, provided by the user back to the assistant.</summary>
577+ [ DebuggerDisplay ( "{DebuggerDisplay,nq}" ) ]
534578public sealed class ToolResultContentBlock : ContentBlock
535579{
536580 /// <inheritdoc/>
@@ -575,4 +619,7 @@ public sealed class ToolResultContentBlock : ContentBlock
575619 /// </remarks>
576620 [ JsonPropertyName ( "isError" ) ]
577621 public bool ? IsError { get ; set ; }
622+
623+ [ DebuggerBrowsable ( DebuggerBrowsableState . Never ) ]
624+ private string DebuggerDisplay => $ "ToolUseId = { ToolUseId } , ContentCount = { Content . Count } , IsError = { IsError ?? false } ";
578625}
0 commit comments