Add DebuggerDisplay attributes to Protocol types (#1068)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com> Co-authored-by: Stephen Halter <halter73@gmail.com>
This commit is contained in:
parent
970207989e
commit
1b52ddacba
1 changed files with 175 additions and 0 deletions
|
|
@ -1,3 +1,4 @@
|
|||
using System.Diagnostics;
|
||||
using Microsoft.Extensions.AI;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
|
|
@ -26,6 +27,7 @@ namespace ModelContextProtocol.Protocol;
|
|||
/// See the <see href="https://github.com/modelcontextprotocol/specification/blob/main/schema/">schema</see> for details.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
[DebuggerDisplay("{DebuggerDisplay,nq}")]
|
||||
public sealed class PromptMessage
|
||||
{
|
||||
/// <summary>
|
||||
|
|
@ -49,4 +51,19 @@ public sealed class PromptMessage
|
|||
/// </remarks>
|
||||
[JsonPropertyName("role")]
|
||||
public required Role Role { get; set; }
|
||||
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
private string DebuggerDisplay
|
||||
{
|
||||
get
|
||||
{
|
||||
// Show actual text content if it's a TextContentBlock
|
||||
if (Content is TextContentBlock textBlock)
|
||||
{
|
||||
return $"Role = {Role}, Text = \"{textBlock.Text}\"";
|
||||
}
|
||||
|
||||
return $"Role = {Role}, ContentType = {Content.Type}";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue