Styling: remove a few redundant parens from object initializer expressions. (#548)

* Styling: remove a few redundant parens from object initializer expressions.

* Fix build error.
This commit is contained in:
Eirik Tsarpalis 2025-06-26 16:55:54 +03:00 • committed by GitHub
commit 55bda787ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 108 additions and 108 deletions

View file

@ -188,21 +188,21 @@ public static class AIContentExtensions
Text = textContent.Text,
},
DataContent dataContent when dataContent.HasTopLevelMediaType("image") => new ImageContentBlock()
DataContent dataContent when dataContent.HasTopLevelMediaType("image") => new ImageContentBlock
{
Data = dataContent.Base64Data.ToString(),
MimeType = dataContent.MediaType,
},
DataContent dataContent when dataContent.HasTopLevelMediaType("audio") => new AudioContentBlock()
DataContent dataContent when dataContent.HasTopLevelMediaType("audio") => new AudioContentBlock
{
Data = dataContent.Base64Data.ToString(),
MimeType = dataContent.MediaType,
},
DataContent dataContent => new EmbeddedResourceBlock()
DataContent dataContent => new EmbeddedResourceBlock
{
Resource = new BlobResourceContents()
Resource = new BlobResourceContents
{
Blob = dataContent.Base64Data.ToString(),
MimeType = dataContent.MediaType,

View file

@ -149,7 +149,7 @@ public abstract class ContentBlock
Meta = meta,
},
"image" => new ImageContentBlock()
"image" => new ImageContentBlock
{
Data = data ?? throw new JsonException("Image data must be provided for 'image' type."),
MimeType = mimeType ?? throw new JsonException("MIME type must be provided for 'image' type."),
@ -157,7 +157,7 @@ public abstract class ContentBlock
Meta = meta,
},
"audio" => new AudioContentBlock()
"audio" => new AudioContentBlock
{
Data = data ?? throw new JsonException("Audio data must be provided for 'audio' type."),
MimeType = mimeType ?? throw new JsonException("MIME type must be provided for 'audio' type."),
@ -165,14 +165,14 @@ public abstract class ContentBlock
Meta = meta,
},
"resource" => new EmbeddedResourceBlock()
"resource" => new EmbeddedResourceBlock
{
Resource = resource ?? throw new JsonException("Resource contents must be provided for 'resource' type."),
Annotations = annotations,
Meta = meta,
},
"resource_link" => new ResourceLinkBlock()
"resource_link" => new ResourceLinkBlock
{
Uri = uri ?? throw new JsonException("URI must be provided for 'resource_link' type."),
Name = name ?? throw new JsonException("Name must be provided for 'resource_link' type."),

View file

@ -98,7 +98,7 @@ public sealed class ProgressNotificationParams : NotificationParams
return new ProgressNotificationParams
{
ProgressToken = progressToken.GetValueOrDefault(),
Progress = new ProgressNotificationValue()
Progress = new ProgressNotificationValue
{
Progress = progress.GetValueOrDefault(),
Total = total,

View file

@ -421,14 +421,14 @@ internal sealed class AIFunctionMcpServerResource : McpServerResource
Contents = aiContents.Select<AIContent, ResourceContents>(
ac => ac switch
{
TextContent tc => new TextResourceContents()
TextContent tc => new TextResourceContents
{
Uri = request.Params!.Uri,
MimeType = ProtocolResourceTemplate.MimeType,
Text = tc.Text
},
DataContent dc => new BlobResourceContents()
DataContent dc => new BlobResourceContents
{
Uri = request.Params!.Uri,
MimeType = dc.MediaType,
@ -441,7 +441,7 @@ internal sealed class AIFunctionMcpServerResource : McpServerResource
IEnumerable<string> strings => new()
{
Contents = strings.Select<string, ResourceContents>(text => new TextResourceContents()
Contents = strings.Select<string, ResourceContents>(text => new TextResourceContents
{
Uri = request.Params!.Uri,
MimeType = ProtocolResourceTemplate.MimeType,

View file

@ -103,12 +103,12 @@ public static class McpServerExtensions
{
Role = role,
Content = dataContent.HasTopLevelMediaType("image") ?
new ImageContentBlock()
new ImageContentBlock
{
MimeType = dataContent.MediaType,
Data = dataContent.Base64Data.ToString(),
} :
new AudioContentBlock()
new AudioContentBlock
{
MimeType = dataContent.MediaType,
Data = dataContent.Base64Data.ToString(),
@ -344,7 +344,7 @@ public static class McpServerExtensions
void Log(LogLevel logLevel, string message)
{
_ = server.SendNotificationAsync(NotificationMethods.LoggingMessageNotification, new LoggingMessageNotificationParams()
_ = server.SendNotificationAsync(NotificationMethods.LoggingMessageNotification, new LoggingMessageNotificationParams
{
Level = McpServer.ToLoggingLevel(logLevel),
Data = JsonSerializer.SerializeToElement(message, McpJsonUtilities.JsonContext.Default.String),