Remove server back-references from protocol DTO types (#1345)
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 Toub <stoub@microsoft.com>
This commit is contained in:
parent
2c9bb5d368
commit
74622d0c9c
7 changed files with 195 additions and 96 deletions
|
|
@ -1,7 +1,6 @@
|
|||
using System.Diagnostics;
|
||||
using System.Text.Json.Nodes;
|
||||
using System.Text.Json.Serialization;
|
||||
using ModelContextProtocol.Server;
|
||||
|
||||
namespace ModelContextProtocol.Protocol;
|
||||
|
||||
|
|
@ -72,12 +71,6 @@ public sealed class Prompt : IBaseMetadata
|
|||
[JsonPropertyName("_meta")]
|
||||
public JsonObject? Meta { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the callable server prompt corresponding to this metadata if any.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public McpServerPrompt? McpServerPrompt { get; set; }
|
||||
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
private string DebuggerDisplay
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ using System.Diagnostics;
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json.Nodes;
|
||||
using System.Text.Json.Serialization;
|
||||
using ModelContextProtocol.Server;
|
||||
|
||||
namespace ModelContextProtocol.Protocol;
|
||||
|
||||
|
|
@ -101,10 +100,4 @@ public sealed class Resource : IBaseMetadata
|
|||
/// </remarks>
|
||||
[JsonPropertyName("_meta")]
|
||||
public JsonObject? Meta { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the callable server resource corresponding to this metadata if any.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public McpServerResource? McpServerResource { get; set; }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System.Text.Json.Nodes;
|
||||
using System.Text.Json.Serialization;
|
||||
using ModelContextProtocol.Server;
|
||||
|
||||
namespace ModelContextProtocol.Protocol;
|
||||
|
||||
|
|
@ -94,12 +93,6 @@ public sealed class ResourceTemplate : IBaseMetadata
|
|||
[JsonIgnore]
|
||||
public bool IsTemplated => UriTemplate.Contains('{');
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the callable server resource corresponding to this metadata, if any.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public McpServerResource? McpServerResource { get; set; }
|
||||
|
||||
/// <summary>Converts the <see cref="ResourceTemplate"/> into a <see cref="Resource"/>.</summary>
|
||||
/// <returns>A <see cref="Resource"/> if <see cref="IsTemplated"/> is <see langword="false"/>; otherwise, <see langword="null"/>.</returns>
|
||||
public Resource? AsResource()
|
||||
|
|
@ -119,7 +112,6 @@ public sealed class ResourceTemplate : IBaseMetadata
|
|||
Annotations = Annotations,
|
||||
Icons = Icons,
|
||||
Meta = Meta,
|
||||
McpServerResource = McpServerResource,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using ModelContextProtocol.Server;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.Json;
|
||||
|
|
@ -158,12 +157,6 @@ public sealed class Tool : IBaseMetadata
|
|||
[JsonPropertyName("_meta")]
|
||||
public JsonObject? Meta { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the callable server tool corresponding to this metadata if any.
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public McpServerTool? McpServerTool { get; set; }
|
||||
|
||||
[DebuggerBrowsable(DebuggerBrowsableState.Never)]
|
||||
private string DebuggerDisplay
|
||||
{
|
||||
|
|
|
|||
|
|
@ -182,7 +182,6 @@ internal sealed class AIFunctionMcpServerPrompt : McpServerPrompt
|
|||
{
|
||||
AIFunction = function;
|
||||
ProtocolPrompt = prompt;
|
||||
ProtocolPrompt.McpServerPrompt = this;
|
||||
_metadata = metadata;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -294,7 +294,6 @@ internal sealed class AIFunctionMcpServerResource : McpServerResource
|
|||
{
|
||||
AIFunction = function;
|
||||
ProtocolResourceTemplate = resourceTemplate;
|
||||
ProtocolResourceTemplate.McpServerResource = this;
|
||||
ProtocolResource = resourceTemplate.AsResource();
|
||||
_metadata = metadata;
|
||||
|
||||
|
|
|
|||
|
|
@ -234,7 +234,6 @@ internal sealed partial class AIFunctionMcpServerTool : McpServerTool
|
|||
|
||||
AIFunction = function;
|
||||
ProtocolTool = tool;
|
||||
ProtocolTool.McpServerTool = this;
|
||||
|
||||
_structuredOutputRequiresWrapping = structuredOutputRequiresWrapping;
|
||||
_metadata = metadata;
|
||||
|
|
|
|||
Loading…
Reference in a new issue