Skip to content

Auto-populate completion handlers from AllowedValuesAttribute on prompt/resource parameters#1380

Open
Copilot wants to merge 8 commits intomainfrom
copilot/implement-allowed-values-completion
Open

Auto-populate completion handlers from AllowedValuesAttribute on prompt/resource parameters#1380
Copilot wants to merge 8 commits intomainfrom
copilot/implement-allowed-values-completion

Conversation

Copy link
Contributor

Copilot AI commented Feb 24, 2026

  • Remove intermediate array in completion value filtering (use direct foreach with StartsWith check)
  • Guard against non-object properties JSON value before enumerating
  • Use is instead of == for JsonValueKind comparison
  • Guard against non-string enum array items using ValueKind is JsonValueKind.String check
  • Update XML docs on McpServerPromptAttribute, McpServerResourceAttribute, McpServerPrompt, and McpServerResource to note that string parameters with AllowedValuesAttribute automatically surface completions
  • Guard AllowedValues test methods with #if NET for net472 compatibility

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits February 24, 2026 14:46
…ce JSON schemas and provide automatic completions

Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
…mpt and resource parameters

Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
…More state

Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
@stephentoub stephentoub marked this pull request as ready for review February 24, 2026 15:55
@stephentoub
Copy link
Contributor

@jeffhandley / @mikekistler / @halter73 / @eiriktsarpalis , thoughts on using [AllowedValues] for this?

…d add AllowedValues docs

Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
@stephentoub stephentoub added this to the Future Minor Version milestone Feb 25, 2026
@stephentoub
Copy link
Contributor

@copilot there are build failures for net472; the use of AllowedValues needs to be guarded to just #if NET

Co-authored-by: stephentoub <2642209+stephentoub@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 25, 2026

@copilot there are build failures for net472; the use of AllowedValues needs to be guarded to just #if NET

Wrapped all 5 AllowedValues test methods with #if NET / #endif in 90dd295. The AllowedValuesAttribute type isn't available on net472, so those tests are now excluded from that TFM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants