11<#
22. SYNOPSIS
3- Evaluates tool and prompt descriptions and produces a Markdown results report using Tool Description Evaluator from Mcp repo.
3+ Evaluates tool and prompt descriptions and produces a Markdown results report using Tool Description Evaluator from Mcp repo.
44
55. DESCRIPTION
6- This script builds and runs the ToolDescriptionEvaluator (.NET) against a set of tool and prompt definitions.
7- It restores and compiles the evaluator, executes it with the provided JSON inputs, and emits a `results.md`
8- report. The script supports configuration via parameters and environment variables for the embedding model
9- service used during evaluation.
6+ This script builds and runs the ToolDescriptionEvaluator (.NET) against a set of tool and prompt definitions.
7+ It restores and compiles the evaluator, executes it with the provided JSON inputs, and emits a `results.md`
8+ report. The script supports configuration via parameters and environment variables for the embedding model
9+ service used during evaluation.
10+
11+ . LINK
12+ https://github.com/microsoft/mcp/tree/main/eng/tools/ToolDescriptionEvaluator
1013
1114. PARAMETER EvaluatorPath
12- The path to the evaluator project root (or its `src` directory) that will be restored, built, and executed.
15+ The path to the evaluator project root (or its `src` directory) that will be restored, built, and executed.
1316
1417. PARAMETER ToolsFilePath
15- The path to the JSON file containing tool definitions to be evaluated.
18+ The path to the JSON file containing tool definitions to be evaluated.
1619
1720. PARAMETER PromptsFilePath
18- The path to the JSON file containing prompt definitions to be evaluated.
21+ The path to the JSON file containing prompt definitions to be evaluated.
1922
2023. PARAMETER OutputFilePath
21- The target folder where the generated `results.md` will be moved after the evaluator runs.
24+ The target file path where the generated `results.md` will be moved after the evaluator runs.
2225
2326. PARAMETER AoaiEndpoint
24- The full endpoint URL for the embedding model (e.g., Azure OpenAI embeddings) used by the evaluator.
27+ The full endpoint URL for the embedding model (e.g., Azure OpenAI embeddings) used by the evaluator.
2528
2629. PARAMETER TextEmbeddingApiKey
27- The API key used to authenticate with the embedding endpoint. Prefer providing this via a secure
28- secret store or environment variable rather than hard-coding.
30+ The API key used to authenticate with the embedding endpoint. Prefer providing this via a secure
31+ secret store or environment variable rather than hard-coding.
2932
3033. NOTES
31- - The evaluator emits `results.md` in the evaluator folder; this script moves it to `OutputFilePath`.
32- - Requires .NET SDK available on PATH.
33- - Set-StrictMode is enabled.
34+ - The evaluator emits `results.md` in the evaluator folder; this script moves it to `OutputFilePath`.
35+ - Requires .NET SDK available on PATH.
36+ - Set-StrictMode is enabled.
3437
3538. EXAMPLE
36- .\Run-Evaluator .ps1 `
37- -EvaluatorPath "C:\work\mcp\eng\tools\ToolDescriptionEvaluator\src" `
38- -ToolsFilePath "C:\work\azure-sdk-tools\tools\azsdk-cli\azure-sdk-tools.json" `
39- -PromptsFilePath "C:\work\azure-sdk-tools\tools\azsdk-cli\azure-sdk-prompts.json" `
40- -OutputFilePath "C:\work\azure-sdk-tools\tools\azsdk-cli" `
41- -AoaiEndpoint "https://<your-endpoint>/openai/deployments/text-embedding-3-large/embeddings?api-version=2023-05-15" `
42- -TextEmbeddingApiKey (Get-Secret -Name 'TextEmbeddingApiKey')
43-
44- Runs the evaluator with the specified tools and prompts files, then moves the generated results to the output path.
39+ .\Invoke-ToolDescriptionEvaluator .ps1 `
40+ -EvaluatorPath "C:\work\mcp\eng\tools\ToolDescriptionEvaluator\src" `
41+ -ToolsFilePath "C:\work\azure-sdk-tools\tools\azsdk-cli\azure-sdk-tools.json" `
42+ -PromptsFilePath "C:\work\azure-sdk-tools\tools\azsdk-cli\azure-sdk-prompts.json" `
43+ -OutputFilePath "C:\work\azure-sdk-tools\tools\azsdk-cli" `
44+ -AoaiEndpoint "https://<your-endpoint>/openai/deployments/text-embedding-3-large/embeddings?api-version=2023-05-15" `
45+ -TextEmbeddingApiKey (Get-Secret -Name 'TextEmbeddingApiKey')
46+
47+ Runs the evaluator with the specified tools and prompts files, then moves the generated results to the output path.
4548#>
4649param (
4750 [Parameter (Mandatory = $true )]
@@ -66,24 +69,34 @@ param (
6669
6770Set-StrictMode - Version 3
6871
72+ # Validate input paths
73+ $pathsToCheck = @ {
74+ " EvaluatorPath" = $EvaluatorPath
75+ " ToolsFilePath" = $ToolsFilePath
76+ " PromptsFilePath" = $PromptsFilePath
77+ " OutputFilePath" = $OutputFilePath
78+ }
79+
80+ foreach ($p in $pathsToCheck.GetEnumerator ()) {
81+ if (-not (Test-Path - Path $p.Value )) {
82+ throw " Path does not exist for parameter '$ ( $p.Key ) ': $ ( $p.Value ) "
83+ }
84+ }
85+
6986# Build & run the evaluator
7087Write-Host " Changing directory to evaluator: $EvaluatorPath "
7188Push-Location $EvaluatorPath
7289try {
7390 $env: AOAI_ENDPOINT = $AoaiEndpoint
7491 $env: TEXT_EMBEDDING_API_KEY = $TextEmbeddingApiKey
7592
76- Write-Host " Restoring packages..."
77- dotnet restore
78-
79- Write-Host " Building (Release)..."
80- dotnet build -- configuration Release
81-
8293 Write-Host " Running Tool..."
83- dotnet run -- -- tools- file " $ToolsFilePath " -- prompts- file " $PromptsFilePath "
94+ dotnet run -- configuration Release -- -- tools- file " $ToolsFilePath " -- prompts- file " $PromptsFilePath "
8495}
8596finally {
8697 Pop-Location
98+ Remove-Item Env:\AOAI_ENDPOINT - ErrorAction SilentlyContinue
99+ Remove-Item Env:\TEXT_EMBEDDING_API_KEY - ErrorAction SilentlyContinue
87100}
88101
89102# The tool emits results.md in the evaluator folder
0 commit comments