You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[McpServerToolType]publicstaticclassMyTools{[McpServerTool,Description("Description of what the tool does")]publicstaticstringToolName([Description("Parameter description")]stringparam)=>$"Result: {param}";}
Tool with Dependency Injection
[McpServerTool,Description("Fetches data from a URL")]publicstaticasyncTask<string>FetchData(HttpClienthttpClient,[Description("The URL to fetch")]stringurl,CancellationTokencancellationToken)=>awaithttpClient.GetStringAsync(url,cancellationToken);
Tool with Sampling
[McpServerTool,Description("Analyzes content using the client's LLM")]publicstaticasyncTask<string>Analyze(McpServerserver,[Description("Content to analyze")]stringcontent,CancellationTokencancellationToken){varmessages=newChatMessage[]{new(ChatRole.User,$"Analyze this: {content}")};returnawaitserver.AsSamplingChatClient().GetResponseAsync(messages,cancellationToken:cancellationToken);}