mcp: render blank text field in TextContent instead of omitempty (#91)
The text field is required, but current implementation omits the text field when it is a blank string. Some clients fail to parse the response if the text field is omitted. A blank text result is a valid MCP response. Claude desktop error message: ``` ClaudeAiToolResultRequest.content.0.text.text: Field required ``` The solution is to return the field even when it is blank by removing `omitempty`.
This commit is contained in:
parent
ba7a06461a
commit
c6b229c855
1 changed files with 20 additions and 2 deletions
|
|
@ -22,6 +22,14 @@ func TestContent(t *testing.T) {
|
|||
&mcp.TextContent{Text: "hello"},
|
||||
`{"type":"text","text":"hello"}`,
|
||||
},
|
||||
{
|
||||
&mcp.TextContent{Text: ""},
|
||||
`{"type":"text","text":""}`,
|
||||
},
|
||||
{
|
||||
&mcp.TextContent{},
|
||||
`{"type":"text","text":""}`,
|
||||
},
|
||||
{
|
||||
&mcp.TextContent{
|
||||
Text: "hello",
|
||||
|
|
|
|||
Loading…
Reference in a new issue