-
Notifications
You must be signed in to change notification settings - Fork 16
Add evaluation pipeline for MCP quality #362
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
Open
ashragrawal
wants to merge
32
commits into
main
Choose a base branch
from
users/ashragrawal/evaluate
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
0263947
Add `a365 evaluate` command for MCP tool schema quality evaluation
ashragrawal 8bab9ec
Fix code review findings for `a365 evaluate` command
ashragrawal e1cde5f
Remove dead code from evaluate pipeline
ashragrawal 2661ab5
Move `a365 evaluate` under `a365 develop-mcp evaluate`
ashragrawal 7dc6d75
Harden coding agent invocation in evaluate pipeline
ashragrawal ba37732
Merge remote-tracking branch 'origin/main' into users/ashragrawal/eva…
ashragrawal 092782b
Address PR review: fix misleading comment and unknown-category fallback
ashragrawal 6167199
Align SchemaDiscoveryService with project HttpClient convention
ashragrawal f911f1b
Show positive box in report when at max maturity level
ashragrawal 5de5eef
Polish evaluate command output for better CLI experience
ashragrawal 254c2b7
Address outstanding PR review comments on evaluate pipeline
ashragrawal dbb0a6a
Surface coding-agent dependency in evaluate help and intro output
ashragrawal 203d285
Remove unused Microsoft.Extensions.Http package reference
ashragrawal 9983355
Make BYOL round-trip work in evaluate — detect and resume from scored…
ashragrawal a29a82f
Rename schema-quality "smell" terminology to "issue" across evaluate …
ashragrawal 8fcde15
Address PR review: escape inline script XSS, fix docstrings, use Argu…
ashragrawal ed073b0
Sandbox coding-agent invocations and narrow Copilot tool permissions
ashragrawal f86e69f
Fix Copilot tool restriction and fall back to manual scoring on agent…
ashragrawal 73f199d
Tell agents their exact tool names in the prompt; add Write to Claude
ashragrawal a29cff5
Switch agent tool restriction from allowlist to shell+web denylist
ashragrawal ed4173c
Address PR review: branding, filename sanitization, unused params
ashragrawal f85d01d
Retry agent up to 3 times when scoring leaves items null
ashragrawal 99eb989
Scale per-tool agent timeout to the number of semantic checks
ashragrawal 8ab681c
Bump per-check timeout from 15s to 20s
ashragrawal 95e9f59
Retry agent through timeouts, not just null-scoring
ashragrawal 1589ac2
Address PR review: drop null guards on non-nullable params, reword sa…
ashragrawal 940c57f
Switch scoring agent from whole-file write to id-unique edit
ashragrawal 7028040
Tolerate duplicate/empty check ids from coding-agent output
ashragrawal e1bda5e
Address PR review: stamp real engine in report, gate explicit engines…
ashragrawal b2866b5
Harden evaluate pipeline against adversarial MCP servers
ashragrawal a29f8f9
Merge remote-tracking branch 'origin/main' into users/ashragrawal/eva…
ashragrawal d5af4a8
Merge branch 'main' into users/ashragrawal/evaluate
ashragrawal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
33 changes: 33 additions & 0 deletions
33
src/Microsoft.Agents.A365.DevTools.Cli/Exceptions/EvaluationException.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using Microsoft.Agents.A365.DevTools.Cli.Constants; | ||
|
|
||
| namespace Microsoft.Agents.A365.DevTools.Cli.Exceptions; | ||
|
|
||
| /// <summary> | ||
| /// Exception thrown when MCP server schema evaluation fails. | ||
| /// Covers schema discovery errors, checklist generation errors, | ||
| /// and report generation errors. | ||
| /// </summary> | ||
| public sealed class EvaluationException : Agent365Exception | ||
| { | ||
| public override int ExitCode => 3; | ||
|
|
||
| public EvaluationException( | ||
| string errorCode, | ||
| string issueDescription, | ||
| List<string>? errorDetails = null, | ||
| List<string>? mitigationSteps = null, | ||
| Dictionary<string, string>? context = null, | ||
| Exception? innerException = null) | ||
| : base( | ||
| errorCode: errorCode, | ||
| issueDescription: issueDescription, | ||
| errorDetails: errorDetails, | ||
| mitigationSteps: mitigationSteps, | ||
| context: context, | ||
| innerException: innerException) | ||
| { | ||
| } | ||
| } |
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
42 changes: 42 additions & 0 deletions
42
src/Microsoft.Agents.A365.DevTools.Cli/Models/Evaluate/ActionItem.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace Microsoft.Agents.A365.DevTools.Cli.Models.Evaluate; | ||
|
|
||
| /// <summary> | ||
| /// A prioritized remediation action generated from a failed check. | ||
| /// </summary> | ||
| public class ActionItem | ||
| { | ||
| [JsonPropertyName("tool_name")] | ||
| public string? ToolName { get; init; } | ||
|
|
||
| [JsonPropertyName("param_name")] | ||
| public string? ParamName { get; init; } | ||
|
|
||
| [JsonPropertyName("priority")] | ||
| public Priority Priority { get; init; } | ||
|
|
||
| [JsonPropertyName("title")] | ||
| public string Title { get; init; } = string.Empty; | ||
|
|
||
| [JsonPropertyName("description")] | ||
| public string Description { get; init; } = string.Empty; | ||
|
|
||
| [JsonPropertyName("issue_ids")] | ||
| public List<int> IssueIds { get; init; } = []; | ||
|
|
||
| [JsonPropertyName("impact_areas")] | ||
| public List<ImpactArea> ImpactAreas { get; init; } = []; | ||
|
|
||
| [JsonPropertyName("remediation")] | ||
| public string Remediation { get; init; } = string.Empty; | ||
|
|
||
| [JsonPropertyName("score_impact")] | ||
| public float ScoreImpact { get; set; } | ||
|
|
||
| [JsonPropertyName("issue_leads_to")] | ||
| public List<string> IssueLeadsTo { get; init; } = []; | ||
| } |
43 changes: 43 additions & 0 deletions
43
src/Microsoft.Agents.A365.DevTools.Cli/Models/Evaluate/ChecklistItem.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace Microsoft.Agents.A365.DevTools.Cli.Models.Evaluate; | ||
|
|
||
| /// <summary> | ||
| /// A single check item in the evaluation checklist. | ||
| /// Score is null until evaluated (deterministic checks are pre-filled, semantic checks start null). | ||
| /// </summary> | ||
| public class ChecklistItem | ||
| { | ||
| [JsonPropertyName("id")] | ||
| public string Id { get; init; } = string.Empty; | ||
|
|
||
| [JsonPropertyName("type")] | ||
| public CheckType Type { get; init; } | ||
|
|
||
| [JsonPropertyName("prompt")] | ||
| public string Prompt { get; init; } = string.Empty; | ||
|
|
||
| [JsonPropertyName("score")] | ||
| public bool? Score { get; set; } | ||
|
|
||
| [JsonPropertyName("reason")] | ||
| public string? Reason { get; set; } | ||
|
|
||
| [JsonPropertyName("severity")] | ||
| public Priority Severity { get; init; } | ||
|
|
||
| [JsonPropertyName("category")] | ||
| public CheckCategory Category { get; init; } | ||
|
|
||
| [JsonPropertyName("issue_ids")] | ||
| public List<int> IssueIds { get; init; } = []; | ||
|
|
||
| [JsonPropertyName("impact_areas")] | ||
| public List<ImpactArea> ImpactAreas { get; init; } = []; | ||
|
|
||
| [JsonPropertyName("remediation")] | ||
| public string Remediation { get; init; } = string.Empty; | ||
| } |
53 changes: 53 additions & 0 deletions
53
src/Microsoft.Agents.A365.DevTools.Cli/Models/Evaluate/EvalReportData.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace Microsoft.Agents.A365.DevTools.Cli.Models.Evaluate; | ||
|
|
||
| /// <summary> | ||
| /// Final JSON blob fed to the HTML template. Contains everything the template needs | ||
| /// to render the report. All evaluation logic, descriptions, and assertions are | ||
| /// pre-computed in C# code -- the HTML template is a pure display layer. | ||
| /// </summary> | ||
| public class EvalReportData | ||
| { | ||
| [JsonPropertyName("result")] | ||
| public SchemaEvalResult Result { get; init; } = new(); | ||
|
|
||
| [JsonPropertyName("impact_map")] | ||
| public Dictionary<string, IssueImpactInfo> ImpactMap { get; init; } = []; | ||
|
|
||
| [JsonPropertyName("maturity_ladder")] | ||
| public List<MaturityLadderEntry> MaturityLadder { get; init; } = []; | ||
| } | ||
|
|
||
| public class IssueImpactInfo | ||
| { | ||
| [JsonPropertyName("name")] | ||
| public string Name { get; init; } = string.Empty; | ||
|
|
||
| [JsonPropertyName("category")] | ||
| public string Category { get; init; } = string.Empty; | ||
|
|
||
| [JsonPropertyName("impact")] | ||
| public string Impact { get; init; } = string.Empty; | ||
|
|
||
| [JsonPropertyName("areas")] | ||
| public List<string> Areas { get; init; } = []; | ||
| } | ||
|
|
||
| public class MaturityLadderEntry | ||
| { | ||
| [JsonPropertyName("level")] | ||
| public int Level { get; init; } | ||
|
|
||
| [JsonPropertyName("label")] | ||
| public string Label { get; init; } = string.Empty; | ||
|
|
||
| [JsonPropertyName("description")] | ||
| public string Description { get; init; } = string.Empty; | ||
|
|
||
| [JsonPropertyName("is_current")] | ||
| public bool IsCurrent { get; init; } | ||
| } |
60 changes: 60 additions & 0 deletions
60
src/Microsoft.Agents.A365.DevTools.Cli/Models/Evaluate/EvaluateEnums.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace Microsoft.Agents.A365.DevTools.Cli.Models.Evaluate; | ||
|
|
||
| [JsonConverter(typeof(JsonStringEnumConverter))] | ||
| public enum CheckCategory | ||
| { | ||
| ToolName, | ||
| ToolDescription, | ||
| ParamName, | ||
| ParamDescription, | ||
| SchemaStructure, | ||
| ToolsetDesign | ||
| } | ||
|
|
||
| [JsonConverter(typeof(JsonStringEnumConverter))] | ||
| public enum Priority | ||
| { | ||
| P0, | ||
| P1, | ||
| P2, | ||
| P3 | ||
| } | ||
|
|
||
| [JsonConverter(typeof(JsonStringEnumConverter))] | ||
| public enum ImpactArea | ||
| { | ||
| ToolSelection, | ||
| ParamAccuracy, | ||
| Completeness, | ||
| Conciseness | ||
| } | ||
|
|
||
| [JsonConverter(typeof(JsonStringEnumConverter))] | ||
| public enum IssueCategory | ||
| { | ||
| Accuracy, | ||
| Functionality, | ||
| Completeness, | ||
| Conciseness | ||
| } | ||
|
|
||
| [JsonConverter(typeof(JsonStringEnumConverter))] | ||
| public enum CheckType | ||
| { | ||
| Deterministic, | ||
| Semantic | ||
| } | ||
|
|
||
| [JsonConverter(typeof(JsonStringEnumConverter))] | ||
| public enum EvalEngine | ||
| { | ||
| Auto, | ||
| GitHubCopilot, | ||
| ClaudeCode, | ||
| None | ||
| } |
40 changes: 40 additions & 0 deletions
40
src/Microsoft.Agents.A365.DevTools.Cli/Models/Evaluate/EvaluationChecklist.cs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace Microsoft.Agents.A365.DevTools.Cli.Models.Evaluate; | ||
|
|
||
| /// <summary> | ||
| /// Root of the evaluation checklist JSON. Intermediate artifact that is auditable | ||
| /// and can be evaluated by a coding agent or manually. | ||
| /// </summary> | ||
| public class EvaluationChecklist | ||
| { | ||
| [JsonPropertyName("metadata")] | ||
| public ChecklistMetadata Metadata { get; init; } = new(); | ||
|
|
||
| [JsonPropertyName("tools")] | ||
| public List<ToolChecklist> Tools { get; init; } = []; | ||
|
|
||
| [JsonPropertyName("server_checks")] | ||
| public List<ChecklistItem> ServerChecks { get; init; } = []; | ||
| } | ||
|
|
||
| public class ChecklistMetadata | ||
| { | ||
| [JsonPropertyName("server_name")] | ||
| public string ServerName { get; init; } = string.Empty; | ||
|
|
||
| [JsonPropertyName("server_url")] | ||
| public string ServerUrl { get; init; } = string.Empty; | ||
|
|
||
| [JsonPropertyName("tool_count")] | ||
| public int ToolCount { get; init; } | ||
|
|
||
| [JsonPropertyName("generated_at")] | ||
| public DateTime GeneratedAt { get; init; } = DateTime.UtcNow; | ||
|
|
||
| [JsonPropertyName("generator_version")] | ||
| public string GeneratorVersion { get; init; } = string.Empty; | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.