Skip to content

Commit a69d61c

Browse files
Simplify AIFunction tool adapter.
1 parent 3972597 commit a69d61c

File tree

1 file changed

+1
-11
lines changed

1 file changed

+1
-11
lines changed

src/ModelContextProtocol/Client/McpClientExtensions.cs

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -466,24 +466,14 @@ private static JsonRpcRequest CreateRequest(string method, Dictionary<string, ob
466466
/// <summary>Provides an AI function that calls a tool through <see cref="IMcpClient"/>.</summary>
467467
private sealed class McpAIFunction(IMcpClient client, Tool tool) : AIFunction
468468
{
469-
private JsonElement? _jsonSchema = tool.InputSchema;
470-
471469
/// <inheritdoc/>
472470
public override string Name => tool.Name;
473471

474472
/// <inheritdoc/>
475473
public override string Description => tool.Description ?? string.Empty;
476474

477475
/// <inheritdoc/>
478-
public override JsonElement JsonSchema => _jsonSchema ??=
479-
JsonSerializer.SerializeToElement(new Dictionary<string, object>
480-
{
481-
["type"] = "object",
482-
["title"] = tool.Name,
483-
["description"] = tool.Description ?? string.Empty,
484-
["properties"] = new Dictionary<string, object?>(),
485-
["required"] = Array.Empty<object>(),
486-
}, McpJsonUtilities.JsonContext.Default.DictionaryStringObject);
476+
public override JsonElement JsonSchema => tool.InputSchema;
487477

488478
/// <inheritdoc/>
489479
protected async override Task<object?> InvokeCoreAsync(

0 commit comments

Comments
 (0)