-
Notifications
You must be signed in to change notification settings - Fork 296
Add server-level description field to MCP runtime configuration #3016
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
base: main
Are you sure you want to change the base?
Changes from all commits
e24dbf1
dd623b5
839c081
fa008ee
9acfb7f
3042ef8
73aa356
21beebb
466192f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -810,7 +810,15 @@ private static bool TryUpdateConfiguredRuntimeOptions( | |
|
|
||
| // MCP: Enabled and Path | ||
| if (options.RuntimeMcpEnabled != null || | ||
| options.RuntimeMcpPath != null) | ||
| options.RuntimeMcpPath != null || | ||
| options.RuntimeMcpDescription != null || | ||
| options.RuntimeMcpDmlToolsEnabled != null || | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How is this change related to the PR?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This change fixes a bug where MCP configuration updates weren't being persisted to the config file. The condition check needed to include all MCP-related options (description and DML tools) to ensure the |
||
| options.RuntimeMcpDmlToolsDescribeEntitiesEnabled != null || | ||
| options.RuntimeMcpDmlToolsCreateRecordEnabled != null || | ||
| options.RuntimeMcpDmlToolsReadRecordsEnabled != null || | ||
| options.RuntimeMcpDmlToolsUpdateRecordEnabled != null || | ||
| options.RuntimeMcpDmlToolsDeleteRecordEnabled != null || | ||
| options.RuntimeMcpDmlToolsExecuteEntityEnabled != null) | ||
| { | ||
| McpRuntimeOptions updatedMcpOptions = runtimeConfig?.Runtime?.Mcp ?? new(); | ||
| bool status = TryUpdateConfiguredMcpValues(options, ref updatedMcpOptions); | ||
|
|
@@ -1066,6 +1074,14 @@ private static bool TryUpdateConfiguredMcpValues( | |
| } | ||
| } | ||
|
|
||
| // Runtime.Mcp.Description | ||
| updatedValue = options?.RuntimeMcpDescription; | ||
| if (updatedValue != null) | ||
| { | ||
| updatedMcpOptions = updatedMcpOptions! with { Description = (string)updatedValue }; | ||
| _logger.LogInformation("Updated RuntimeConfig with Runtime.Mcp.Description as '{updatedValue}'", updatedValue); | ||
| } | ||
|
|
||
| // Handle DML tools configuration | ||
| bool hasToolUpdates = false; | ||
| DmlToolsConfig? currentDmlTools = updatedMcpOptions?.DmlTools; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -65,12 +65,13 @@ internal McpRuntimeOptionsConverter(DeserializationVariableReplacementSettings? | |
| bool enabled = true; | ||
| string? path = null; | ||
| DmlToolsConfig? dmlTools = null; | ||
| string? description = null; | ||
|
|
||
| while (reader.Read()) | ||
| { | ||
| if (reader.TokenType == JsonTokenType.EndObject) | ||
| { | ||
| return new McpRuntimeOptions(enabled, path, dmlTools); | ||
| return new McpRuntimeOptions(enabled, path, dmlTools, description); | ||
| } | ||
|
|
||
| string? propertyName = reader.GetString(); | ||
|
|
@@ -98,6 +99,14 @@ internal McpRuntimeOptionsConverter(DeserializationVariableReplacementSettings? | |
| dmlTools = dmlToolsConfigConverter.Read(ref reader, typeToConvert, options); | ||
| break; | ||
|
|
||
| case "description": | ||
| if (reader.TokenType is not JsonTokenType.Null) | ||
| { | ||
| description = reader.DeserializeString(_replacementSettings); | ||
| } | ||
|
|
||
| break; | ||
|
|
||
| default: | ||
| throw new JsonException($"Unexpected property {propertyName}"); | ||
| } | ||
|
|
@@ -134,6 +143,13 @@ public override void Write(Utf8JsonWriter writer, McpRuntimeOptions value, JsonS | |
| dmlToolsOptionsConverter.Write(writer, value.DmlTools, options); | ||
| } | ||
|
|
||
| // Write description if it's provided | ||
| if (value is not null && !string.IsNullOrWhiteSpace(value.Description)) | ||
| { | ||
| writer.WritePropertyName("description"); | ||
| JsonSerializer.Serialize(writer, value.Description, options); | ||
| } | ||
|
Comment on lines
+146
to
+151
|
||
|
|
||
| writer.WriteEndObject(); | ||
| } | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.