-
-
Notifications
You must be signed in to change notification settings - Fork 554
Modelcontextprotocol #968
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modelcontextprotocol #968
Conversation
conversation add title query
merge latest code
merge latest code
merge with main
1、Json Data Save to State 2、mcpdotnet with source ref
mcpdotnet now is mcp offical sdk
use ModelContextProtocol nuget package replace source ref
merge mcp into master
merge to botsharp
|
||
namespace BotSharp.Core.Mcp.Functions; | ||
|
||
public class McpToolFunction : IFunctionCallback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you think the name McpToolAdapter
is better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is primarily responsible for converting calls or responses from the MCP tools to fit the API expected by BotSharp, “Adapter” would immediately signal this role to other developers. It interacts with mcp server and converts data between incompatible mcp tools interfaces, then McpToolAdapter is a clearer, more descriptive choice
if(agent.McpTools.Any(item => item.Functions.Any(x=> x.Name == message.FunctionName))) | ||
{ | ||
var data = JsonDocument.Parse(JsonSerializer.Serialize(message.Data)); | ||
state.SaveStateByArgs(data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we save function response to state? normally speaking, we only store model extracted function input args into state.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mainly dealing with the example of this order_number.
return "The order number is P123-01: {order_number = \"P123-01\" }"; |
|
||
foreach (var fn in functions) | ||
{ | ||
if (!agent.SecondaryFunctions.Any(x => x.Name.Equals(fn.Name, StringComparison.OrdinalIgnoreCase))) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iceljc Is it the recommended way to use agent.SecondaryFunctions
for McpTool?
if (mcpClient != null) | ||
{ | ||
var tools = await mcpClient.ListToolsAsync().ToListAsync(); | ||
var funcnames = item.Functions.Select(x => x.Name).ToList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
funcNames
1、Integrated model context protocol ,use offical dotnet sdk https://github.com/modelcontextprotocol/csharp-sdk
2、map mcp tools to botsharp IFunctionCallback
3、test pizzabot with mcp sse server