This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Define tool functions | |
| static string GetWeather(string city) => $"Weather in {city}: 18°C, partly cloudy."; // Replace with real API call | |
| static string GetForecast(string city, int days) => $"{days}-day forecast for {city}: mostly sunny with occasional showers."; | |
| // Create tool descriptors | |
| var weatherTools = new[] | |
| { | |
| AIFunctionFactory.Create(GetWeather, "get_weather", "Get the current weather for a city"), | |
| AIFunctionFactory.Create(GetForecast, "get_forecast", "Get a multi-day weather forecast"), | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.Agents.AI.DevUI; | |
| using Microsoft.Agents.AI.Hosting; | |
| using Microsoft.AspNetCore.Mvc.ModelBinding; | |
| using Microsoft.Extensions.AI; | |
| using OllamaSharp; | |
| using OpenTelemetry.Resources; | |
| using System.Net; | |
| var builder = WebApplication.CreateBuilder(args); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .AddMcpServer(options => | |
| { | |
| options.ServerInfo = new Implementation | |
| { | |
| Name = "My MCP Server", | |
| Version = "1.0.0", | |
| Title = "My MCP Server", | |
| WebsiteUrl = "http://localhost:5295/", | |
| Icons = [ | |
| new Icon |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .WithTools([ | |
| McpServerTool.Create( | |
| typeof(EchoTool).GetMethod(nameof(EchoTool.Echo))!, | |
| options: new McpServerToolCreateOptions | |
| { | |
| Icons = [ | |
| new Icon | |
| { | |
| Source = "http://localhost:5295/echo-icon-light.svg", | |
| MimeType = "image/svg+xml", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [McpServerTool(Title = "Echo", IconSource = "http://localhost:5295/echo-icon.svg")] | |
| public static string Echo(string message) => message; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "version": 1, | |
| "hooks": { | |
| "postToolUse": [ | |
| { | |
| "type": "command", | |
| "powershell": "./.github/hooks/scripts/format-csharp.ps1", | |
| "timeoutSec": 30 | |
| } | |
| ] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $input_data = [Console]::In.ReadToEnd() | ConvertFrom-Json | |
| $toolName = $input_data.toolName | |
| $toolArgs = $input_data.toolArgs | ConvertFrom-Json | |
| $filePath = $toolArgs.path | |
| # Only act on edit/create tools touching a .cs file | |
| if ($toolName -notin @("edit", "create")) { exit 0 } | |
| if (-not $filePath.EndsWith(".cs")) { exit 0 } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using OpenTelemetry.Resources; | |
| builder.Services.AddOpenTelemetry() | |
| .ConfigureResource(r => r.AddAttributes(new[] | |
| { | |
| new KeyValuePair<string, object>( | |
| "runtime.dotnet.version", | |
| Environment.Version.ToString() | |
| ) | |
| })) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ALTER USER [usr_SampleDB_reader] | |
| WITH NAME = [usr_SampleDB_reader], -- preserve the username | |
| LOGIN = [VLM\lg_SampleDB_dev_db-reader]; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| USE [ONT_SampleDB]; | |
| GO | |
| IF EXISTS (SELECT * FROM sys.database_principals WHERE name = N'usr_SampleDB_reader') | |
| BEGIN | |
| ALTER USER [usr_SampleDB_reader] WITH LOGIN = [lg_SampleDB_dev_db-reader]; | |
| END | |
| ELSE | |
| BEGIN | |
| CREATE USER [usr_SampleDB_reader] FOR LOGIN [lg_SampleDB_dev_db-reader]; | |
| END |
NewerOlder