modelcontextprotocol / modelcontextprotocol/csharp-sdk

Allow to specify `JsonSerializerOptions` and `AIJsonSchemaCreateOptions` when adding capabilities to MCP server

Open
#795 1 comment 0 reactions 1 assignee View on GitHub

@eiriktsarpalis is already working on this.

Since Sep 19, 2025.

enhancement needs confirmation
Dominant language
C#
Stars
4.5k
Forks
814
Avg merge
9d 19h
Merged PRs (30d)
4

Description

Is your feature request related to a problem? Please describe.
Customizing json schema generation is currently not possible via AIJsonSchemaCreateOptions when adding capabilities e.g. via IMcpServerBuilder.WithResources(), IMcpServerBuilder.WithTools() etc.
WithPrompts and WithTools methods allow to specify JsonSerializerOptions while this cannot be done for WithResources.

Describe the solution you'd like
Add optional AIJsonSchemaCreateOptions argument to WithResources, WithTools , and WithPrompts method to allow schema customization.
Add optional JsonSerializerOptions argument to each WithResources method to allow setting serializer options.

Describe alternatives you've considered
none

Additional context
n/a

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.