-
Notifications
You must be signed in to change notification settings - Fork 342
Add ToolMetadataExporter #992
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
conniey
wants to merge
53
commits into
microsoft:main
Choose a base branch
from
conniey:exporter
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
53 commits
Select commit
Hold shift + click to select a range
2409e1b
Add PackageVersion for Kusto.Data and Kusto.Ingest
conniey 6ed1764
Add Id to shared McpModels.
conniey 9e969b4
Initial commit
conniey 401a5c3
Remove AoT
conniey c408b27
Add initial mock up
conniey d457f28
Split to use Query and Ingestion endpoint.
conniey 1f9aa3c
Add Query to create table.
conniey 2821837
Add LaunchSettings.
conniey 489992e
Set Default queries folder.
conniey ab17337
Adding Appsettings.json. Copy to output
conniey 85307e6
Update Json serialization to output Enum names.
conniey dd00c3c
Start host
conniey cab589b
Move JsonOutput parsing. Fix command line arguments to pass to exe
conniey 43156a5
Pass in command rather than just name in changes.
conniey c185cc2
Update Logging
conniey b24854a
Change interface to use List. Update Ingestion settings for singlejson
conniey 218c005
Fix column mappings
conniey eb6feb4
Change to use Direct Ingestion client
conniey b368386
Fix formatting issues
conniey b1a39ba
Fix formatting
conniey 518db94
Add Friend assembly
conniey addcfcc
Add unit test project
conniey 7733529
Make method virtual
conniey 3ba8162
Fix formatting issue.
conniey c66ffe8
Add header
conniey b8f8909
Add dev settings
conniey 7bd7bd9
Add header
conniey 398ad9d
Add ServerName support.
conniey fcadc9e
Remove test template.
conniey fc3e09b
Add ServerName
conniey 1e7eee5
Propagate cancellation
conniey a527261
Moving classes into src/tests
conniey 5ab55ab
Move parsing from command line to use IConfiguration.
conniey dd8d9b9
Add ServerName column to Kusto mapping at the end.
conniey f868255
Add documentation to CommandLineOptions
conniey 9b88050
Add ServerInfoResult for `server info`
conniey dd909a6
Add IsDryRun, AzMcp to app configuration
conniey 1b1449a
Update Program to configure AppConfiguration and CommandLineOptions
conniey dd6dad3
Add FileName parameter to utility methods.
conniey 836c3b3
Update ToolAnalyzer to use file name parameter from Utility.
conniey 01082f5
Create functions for AzMcp program.
conniey c6bcca4
Change utility classes into a class
conniey d8e65c9
- Add utility into DI container
conniey d7bc8cd
Use lazy initialization.
conniey 0249c0b
Add tests
conniey 0c90ff6
Make methods virtual for testability
conniey ec744b3
Add tests for AzaureMcpKustoDatastore
conniey 4657c44
Add ToolAnalyzerTests
conniey c23ca90
Add tool projects to solution
conniey bcdfa4b
Fix formatting error in AzureMcpKustoDatastore
conniey f2c0d38
Fix formatting error in ToolAnalyzerTests
conniey cab9ecf
Fix whitespace AzmcpProgram
conniey d30a9b6
Add Ticks to FileName.
conniey 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
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,25 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| namespace ToolMetadataExporter; | ||
|
|
||
| public class AppConfiguration | ||
| { | ||
| public string? IngestionEndpoint { get; set; } | ||
|
|
||
| public string? QueryEndpoint { get; set; } | ||
|
|
||
| public string? DatabaseName { get; set; } | ||
|
|
||
| public string? McpToolEventsTableName { get; set; } | ||
|
|
||
| public string? QueriesFolder { get; set; } = "Resources/queries"; | ||
|
|
||
| public string? WorkDirectory { get; set; } | ||
|
|
||
| public bool IsDryRun { get; set; } | ||
|
|
||
| public string? AzmcpExe { get; set; } | ||
|
|
||
| public bool IsAzmcpExeSpecified { get; set; } | ||
| } |
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,7 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System.Runtime.CompilerServices; | ||
|
|
||
| [assembly: InternalsVisibleTo("ToolMetadataExporter.UnitTests")] | ||
| [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] |
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,5 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| global using System; | ||
| global using System.Text.Json; |
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,9 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| namespace ToolMetadataExporter.Models; | ||
|
|
||
| public record AzureMcpTool( | ||
| string ToolId, | ||
| string ToolName, | ||
| string ToolArea); | ||
26 changes: 26 additions & 0 deletions
26
eng/tools/ToolMetadataExporter/src/Models/CommandLineOptions.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,26 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| namespace ToolMetadataExporter.Models; | ||
|
|
||
| /// <summary> | ||
| /// Options specified via command line arguments. Supported options are: | ||
| /// <list type="bullet"> | ||
| /// <item><c>--dry-run</c>: If specified, the tool will run in dry-run mode, meaning no changes will be made to the target datastore.</item> | ||
| /// <item><c>--azmcp-exe <path></c>: The path to the azmcp executable to use for interacting with the MCP server.</item> | ||
| /// </list> | ||
| /// </summary> | ||
| internal class CommandLineOptions | ||
| { | ||
| /// <summary> | ||
| /// Gets or sets a value indicating whether the tool analysis should be performed as a dry run. | ||
| /// </summary> | ||
| /// <remarks>When set to <see langword="true"/>, the operation is performed, output to the console, but not persisted to the datastore. When set to | ||
| /// <see langword="false"/>, the operation is executed normally.</remarks> | ||
| public bool? IsDryRun { get; set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the full path to the AzMcp executable file. | ||
| /// </summary> | ||
| public string? AzmcpExe { get; set; } | ||
| } |
62 changes: 62 additions & 0 deletions
62
eng/tools/ToolMetadataExporter/src/Models/Kusto/McpToolEvent.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,62 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System.Text.Json.Serialization; | ||
| using Kusto.Data.Common; | ||
|
|
||
| namespace ToolMetadataExporter.Models.Kusto; | ||
|
|
||
| public class McpToolEvent | ||
| { | ||
| private const string EventTimeColumn = "EventTime"; | ||
| private const string EventTypeColumn = "EventType"; | ||
| private const string ServerNameColumn = "ServerName"; | ||
| private const string ServerVersionColumn = "ServerVersion"; | ||
| private const string ToolIdColumn = "ToolId"; | ||
| private const string ToolNameColumn = "ToolName"; | ||
| private const string ToolAreaColumn = "ToolArea"; | ||
| private const string ReplacedByToolNameColumn = "ReplacedByToolName"; | ||
| private const string ReplacedByToolAreaColumn = "ReplacedByToolArea"; | ||
|
|
||
| [JsonPropertyName(EventTimeColumn)] | ||
| public DateTimeOffset? EventTime { get; set; } | ||
|
|
||
| [JsonPropertyName(EventTypeColumn)] | ||
| public McpToolEventType? EventType { get; set; } | ||
|
|
||
| [JsonPropertyName(ServerNameColumn)] | ||
| public string? ServerName { get; set; } | ||
|
|
||
| [JsonPropertyName(ServerVersionColumn)] | ||
| public string? ServerVersion { get; set; } | ||
|
|
||
| [JsonPropertyName(ToolIdColumn)] | ||
| public string? ToolId { get; set; } | ||
|
|
||
| [JsonPropertyName(ToolNameColumn)] | ||
| public string? ToolName { get; set; } | ||
|
|
||
| [JsonPropertyName(ToolAreaColumn)] | ||
| public string? ToolArea { get; set; } | ||
|
|
||
| [JsonPropertyName(ReplacedByToolNameColumn)] | ||
| public string? ReplacedByToolName { get; set; } | ||
|
|
||
| [JsonPropertyName(ReplacedByToolAreaColumn)] | ||
| public string? ReplacedByToolArea { get; set; } | ||
|
|
||
| public static ColumnMapping[] GetColumnMappings() | ||
| { | ||
| return [ | ||
| new ColumnMapping { ColumnName = EventTimeColumn, ColumnType = "datetime" }, | ||
| new ColumnMapping { ColumnName = EventTypeColumn, ColumnType = "string"}, | ||
| new ColumnMapping { ColumnName = ReplacedByToolAreaColumn, ColumnType = "string"}, | ||
| new ColumnMapping { ColumnName = ReplacedByToolNameColumn, ColumnType = "string"}, | ||
| new ColumnMapping { ColumnName = ServerVersionColumn, ColumnType = "string" }, | ||
| new ColumnMapping { ColumnName = ToolAreaColumn , ColumnType = "string" }, | ||
| new ColumnMapping { ColumnName = ToolIdColumn, ColumnType = "string"}, | ||
| new ColumnMapping { ColumnName = ToolNameColumn, ColumnType = "string" }, | ||
| new ColumnMapping { ColumnName = ServerNameColumn, ColumnType = "string" }, | ||
| ]; | ||
| } | ||
| } |
16 changes: 16 additions & 0 deletions
16
eng/tools/ToolMetadataExporter/src/Models/Kusto/McpToolEventType.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,16 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace ToolMetadataExporter.Models.Kusto; | ||
|
|
||
| public enum McpToolEventType | ||
| { | ||
| [JsonStringEnumMemberName("Created")] | ||
| Created, | ||
| [JsonStringEnumMemberName("Updated")] | ||
| Updated, | ||
| [JsonStringEnumMemberName("Deleted")] | ||
| Deleted | ||
| } |
17 changes: 17 additions & 0 deletions
17
eng/tools/ToolMetadataExporter/src/Models/ModelsSerializationContext.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,17 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System.Text.Json.Serialization; | ||
| using ToolMetadataExporter.Models.Kusto; | ||
|
|
||
| namespace ToolMetadataExporter.Models; | ||
|
|
||
| [JsonSerializable(typeof(ServerInfo))] | ||
| [JsonSerializable(typeof(ServerInfoResult))] | ||
| [JsonSerializable(typeof(McpToolEvent))] | ||
| [JsonSerializable(typeof(McpToolEventType))] | ||
| [JsonSerializable(typeof(List<McpToolEvent>))] | ||
| [JsonSourceGenerationOptions(Converters = [typeof(JsonStringEnumConverter<McpToolEventType>)])] | ||
| public partial class ModelsSerializationContext : JsonSerializerContext | ||
| { | ||
| } |
31 changes: 31 additions & 0 deletions
31
eng/tools/ToolMetadataExporter/src/Models/ServerInfoResult.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,31 @@ | ||
| // Copyright (c) Microsoft Corporation. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System.Text.Json.Serialization; | ||
|
|
||
| namespace ToolMetadataExporter.Models; | ||
|
|
||
| /// <summary> | ||
| /// The result of a `server info` request from the MCP server. | ||
| /// </summary> | ||
| public class ServerInfoResult | ||
| { | ||
| [JsonPropertyName("status")] | ||
|
|
||
| public int Status { get; set; } | ||
|
|
||
| [JsonPropertyName("message")] | ||
| public string? Message { get; set; } | ||
|
|
||
| [JsonPropertyName("results")] | ||
| public ServerInfo? Results { get; set; } | ||
| } | ||
|
|
||
| public class ServerInfo | ||
| { | ||
| [JsonPropertyName("name")] | ||
| public string Name { get; set; } = string.Empty; | ||
|
|
||
| [JsonPropertyName("version")] | ||
| public string Version { get; set; } = 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.
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.
Missing copyright header. According to the coding standards, all C# files should include the copyright header:
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.
????????????