ToolResult always returns as "Text" with without be decoded
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
Research direction
The issue names no source files, tests, or entry points; begin by tracing how an MCP tool returning DTO lists becomes the standard ToolResult text content. Compare the serialized result with the requested representation and define the expected behavior with maintainers. Done when the result avoids unnecessary encoding and tests cover the DTO-list case.
Written by the indexing model from the issue text.
Description
Is your feature request related to a problem? Please describe.
I've created a tool using the McpServerTool attribute that returns a list of DTOs.
I'm using this tool through a MCP Client inside a chat, everything works fine but I noticed that the result of the tool is a JSON serialized with the result of the tool like this:
{"content":[{"type":"text","text":"[\r\n {\r\n \u0022id\u0022: \u00224309-76-LQ21\u0022,\r\n \u0022procuringEntityName\u0022: \u0022HOSPITAL GUILLERMO GRANT BENAVENTE DE CO\u0022\r\n },\r\n {\r\n \u0022id\u0022: \u00221380-4-LQ21\u0022,\r\n \u0022procuringEntityName\u0022: \u0022Hospital Doctor Hern\\u00E1n Henr\\u00EDquez Aravena\u0022\r\n },\r\n {\r\n \u0022id\u0022: \u00221058095-30-LE21\u0022,\r\n \u0022procuringEntityName\u0022: \u0022COMPLEJO ASISTENCIAL DR. SOTERO DEL RIO\u0022\r\n },\r\n {\r\n \u0022id\u0022: \u00221058095-34-LE21\u0022,\r\n \u0022procuringEntityName\u0022: \u0022COMPLEJO ASISTENCIAL DR. SOTERO DEL RIO\u0022\r\n },\r\n {\r\n \u0022id\u0022: \u0022359-30-LP21\u0022,\r\n \u0022procuringEntityName\u0022: \u0022Instituto Nacional del Cancer\u0022\r\n }\r\n]"}]}
That content contains a lot of extra characters that causes that the token consumption be more than the expected.
Describe the solution you'd like
Is there any chance to modify the standard result to avoid this behavior?
Describe alternatives you've considered
I went deep into the codebase looking for any option that help me to accomplish that but I found nothing.
Additional context
- Dominant language
- C#
- Stars
- 4.5k
- Forks
- 814
- Avg merge
- 9d 19h
- Merged PRs (30d)
- 4
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.
More from modelcontextprotocol/csharp-sdk
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
modelcontextprotocol/csharp-sdk#1867 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
modelcontextprotocol/csharp-sdk#1840 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
modelcontextprotocol/csharp-sdk#1836 ·
-
enhancement needs confirmation
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
modelcontextprotocol/csharp-sdk#678 · 1 comment ·
-
enhancement needs confirmation P3 ready for work
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
modelcontextprotocol/csharp-sdk#515 · 6 comments · 3 reactions ·
All issues in modelcontextprotocol/csharp-sdk
Similar issues
-
priority-0
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 1/5 Under an hour Newbie friendliness 78/100
StackExchange/StackExchange.Redis#3249 ·
-
[Feat] 조합 영역 구분선 개선 Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
type/automation type/tech-debt
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100