modelcontextprotocol / modelcontextprotocol/csharp-sdk
Dictionary<string, JsonElement> overload for CallToolAsync
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 4.5k
- Forks
- 814
- Avg merge
- 9d 19h
- Merged PRs (30d)
- 4
Description
Currently, if a caller has a Dictionary<string, JsonElement>, they must convert each JsonElement to object to use the CallToolAsync API since it requires Dictionary<string, object?>. But given internally CallToolAsync already special handles JsonElement and underlying SendRequestAsync supports JsonElement, would it make sense to add an overload that accepts Dictionary<string, JsonElement>? This would avoid requiring callers to perform to-object conversion or rely on implementation details by casting.
We encountered this in Azure MCP Server, and due to the Dictionary<string, object?> constraint, it requires unnecessary conversions or serialization and deserialization operations within hot path
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/Client/McpClientExtensions.cs, around the CallToolAsync implementation and the linked handling at line 1088. Check how SendRequestAsync accepts JsonElement, then verify that the API supports a Dictionary<string, JsonElement> without caller-side conversion or serialization overhead.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100