Skip to content

Commit 798d5d0

Browse files
committed
feat(core): add convenience operators for TextContent
1 parent 835e8cf commit 798d5d0

File tree

1 file changed

+7
-0
lines changed
  • src/ModelContextProtocol.NET.Core/Models/Protocol/Shared/Content

1 file changed

+7
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
1+
using System.Collections;
2+
using System.Runtime.CompilerServices;
3+
14
namespace ModelContextProtocol.NET.Core.Models.Protocol.Shared.Content;
25

36
public record TextContent : Annotated
47
{
58
public string Type => "text";
69
public required string Text { get; init; }
10+
11+
public static implicit operator Annotated[](TextContent textContent) => [textContent];
12+
13+
public static implicit operator TextContent(string text) => new TextContent { Text = text };
714
}

0 commit comments

Comments
 (0)