Update content according to latest spec (#513)

* Update content according to latest spec

* Add Title to a bunch of types

* Add _meta to lots of types

* Address feedback, more cleanup, fix NAOT test failure
This commit is contained in:
Stephen Toub 2025-06-16 19:39:41 -04:00 • committed by GitHub
commit 2bcff315f8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -15,25 +15,22 @@ public class AnnotatedMessageTool
}
[McpServerTool(Name = "annotatedMessage"), Description("Generates an annotated message")]
public static IEnumerable<Content> AnnotatedMessage(MessageType messageType, bool includeImage = true)
public static IEnumerable<ContentBlock> AnnotatedMessage(MessageType messageType, bool includeImage = true)
{
List<Content> contents = messageType switch
List<ContentBlock> contents = messageType switch
{
MessageType.Error => [new()
MessageType.Error => [new TextContentBlock
{
Type = "text",
Text = "Error: Operation failed",
Annotations = new() { Audience = [Role.User, Role.Assistant], Priority = 1.0f }
}],
MessageType.Success => [new()
MessageType.Success => [new TextContentBlock
{
Type = "text",
Text = "Operation completed successfully",
Annotations = new() { Audience = [Role.User], Priority = 0.7f }
}],
MessageType.Debug => [new()
MessageType.Debug => [new TextContentBlock
{
Type = "text",
Text = "Debug: Cache hit ratio 0.95, latency 150ms",
Annotations = new() { Audience = [Role.Assistant], Priority = 0.3f }
}],
@ -42,9 +39,8 @@ public class AnnotatedMessageTool
if (includeImage)
{
contents.Add(new()
contents.Add(new ImageContentBlock()
{
Type = "image",
Data = TinyImageTool.MCP_TINY_IMAGE.Split(",").Last(),
MimeType = "image/png",
Annotations = new() { Audience = [Role.User], Priority = 0.5f }