modelcontextprotocol / modelcontextprotocol/csharp-sdk
Tool annotation default values are not applied
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 4.5k
- Forks
- 814
- Avg merge
- 9d 19h
- Merged PRs (30d)
- 4
Description
I was taking a try at the tool annotations. According to the code XML comments, there are default values for them. I was expecting that those default annotations are attached. But it's not, so I took some investigation on source.
The code checks nullability on internal fields instead of public properties. The public properties getter will use the default values while internal fields won't. So the default values are not applied.
Is this intended? Seems a choice between null annotation vs default values annotation.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in src/ModelContextProtocol.Core/Server/AIFunctionMcpServerTool.cs around lines 165-188, comparing the internal-field nullability checks with the public property getters described in the issue. Reproduce the generated tool annotations and determine whether null values or documented defaults are intended. Done means the chosen behavior is consistent and verified for the affected annotations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100