Skip to content

Commit 28df906

Browse files
committed
Merge branch 'master' of https://github.com/afrise/MCPSharp
2 parents 997482c + 22a41fc commit 28df906

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

MCPSharp/Core/ServerRpcTarget.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,20 @@ class ServerRpcTarget(ToolManager toolManager, ResourceManager resourceManager,
2020
/// <param name="clientInfo">The client information.</param>
2121
/// <returns>The result of the initialization process.</returns>
2222
[JsonRpcMethod("initialize")]
23-
public async Task<InitializeResult> InitializeAsync(string protocolVersion, ClientCapabilities capabilities, Implementation clientInfo)
23+
public async Task<InitializeResult> InitializeAsync(string protocolVersion, object capabilities, Implementation clientInfo)
2424
{
25+
26+
if (capabilities is ClientCapabilities cc)
27+
{
28+
_clientCapabilities = cc;
29+
}
30+
2531
_clientInfo = clientInfo ?? new();
26-
_clientCapabilities = capabilities ?? new();
2732

28-
if (_clientCapabilities.Tools.TryGetValue("listChanged", out bool value))
33+
if (_clientCapabilities.Tools.TryGetValue("listChanged", out object value))
2934
{
30-
MCPServer.EnableToolChangeNotification = value;
35+
if (value is bool boolValue)
36+
MCPServer.EnableToolChangeNotification = boolValue;
3137
}
3238

3339
return await Task.FromResult<InitializeResult>(
@@ -93,4 +99,4 @@ public async Task<ToolsListResult> ListToolsAsync(object parameters = null)
9399
[JsonRpcMethod("prompts/list")]
94100
public static async Task<PromptListResult> ListPromptsAsync() => await Task.Run(() => new PromptListResult());
95101
}
96-
}
102+
}

MCPSharp/Model/Capabilities/ClientCapabilities.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,27 @@ public class ClientCapabilities
88
/// <summary>
99
/// Gets or sets a value indicating wether roots are supported.
1010
/// </summary>
11-
public Dictionary<string, bool> Roots { get; set; } = [];
11+
public Dictionary<string, object> Roots { get; set; } = [];
1212

1313
/// <summary>
1414
/// Gets or sets a value indicating whether sampling is supported.
1515
/// </summary>
1616

17-
public Dictionary<string, bool> Sampling { get; set; } = [];
17+
public Dictionary<string, object> Sampling { get; set; } = [];
1818

1919
/// <summary>
2020
/// Gets or sets a value indicating whether tools are supported.
2121
/// </summary>
22-
public Dictionary<string, bool> Tools { get; set; } = [];
22+
public Dictionary<string, object> Tools { get; set; } = [];
2323

2424
/// <summary>
2525
/// Gets or sets a value indicating whether resources are supported.
2626
/// </summary>
27-
public Dictionary<string, bool> Resources { get; set; } = [];
27+
public Dictionary<string, object> Resources { get; set; } = [];
2828

2929
/// <summary>
3030
/// Gets or sets a value indicating whether prompts are supported.
3131
/// </summary>
32-
public Dictionary<string, bool> Prompts { get; set; } = [];
32+
public Dictionary<string, object> Prompts { get; set; } = [];
3333
}
3434
}

0 commit comments

Comments
 (0)