Surface server-level instructions in MCP tool discovery - #263
Conversation
Add an optional instructions property to MCPServerConfig and populate it in both the tooling-gateway and manifest server parsers. Discovery responses that declare per-server instructions now flow through ListToolServersAsync / EnumerateToolsFromServersAsync to callers; servers without instructions leave the property null. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
gikasivi-ms please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
There was a problem hiding this comment.
Pull request overview
Adds support for surfacing per-server natural-language instructions from MCP server discovery metadata through the Tooling core model so consumers can incorporate server-authored guidance when building prompts/tool usage flows.
Changes:
- Added nullable
instructionstoMCPServerConfig. - Updated both gateway and local-manifest parsing paths to read
"instructions"from discovery JSON and populate it on returned server configs. - Added unit tests covering gateway discovery responses with/without
instructions.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Tooling/Core/Services/McpToolServerConfigurationService.cs | Parses optional "instructions" from gateway and manifest JSON and populates MCPServerConfig.instructions. |
| src/Tooling/Core/Models/MCPServerConfig.cs | Introduces instructions as new nullable server-level metadata with XML docs. |
| src/Tests/Microsoft.Agents.A365.Tooling.Tests/Services/McpToolServerConfigurationServiceTests.cs | Adds gateway-path tests validating instructions is populated or left null. |
| if (serverElement.TryGetProperty("instructions", out var instructionsElement) && | ||
| instructionsElement.ValueKind == JsonValueKind.String) | ||
| { | ||
| instructions = instructionsElement.GetString(); | ||
| } |
What
Adds an optional
instructionsproperty toMCPServerConfigand populates it in the tool-discovery parsers (ParseServerConfigfor the tooling-gateway path andParseServerConfigFromManifestfor the local manifest path). When a discovery response declares per-serverinstructions, the value now flows throughListToolServersAsyncandEnumerateToolsFromServersAsyncto callers. Servers that declare no instructions leave the propertynull.Why
Discovery already carries other server-level metadata (
scope,audience,publisher), but dropsinstructions. Consumers that build agent/tool prompts from discovered servers had no way to read server-authored usage guidance even when the server provided it.Scope / compatibility
null).Tests
ListToolServersAsync_GatewayResponseWithInstructions_PopulatesInstructionsListToolServersAsync_GatewayResponseWithoutInstructions_LeavesInstructionsNullValidation
Microsoft.Agents.A365.Toolingbuilds 0 warnings / 0 errors.Microsoft.Agents.A365.Tooling.Tests: 23/23 pass;Microsoft.Agents.A365.Tooling.Core.Tests: 76/76 pass.dotnet formatclean on changed lines.