When can CallToolResult support returning JSON formatted content
When can CallToolResult support returning JSON formatted content
When can CallToolResult support returning JSON formatted content
The MCP protocol itself does not care about the format of the text content; It just passes it as a string. If structured data needs to be returned, it can be serialized as a JSON string.
jsonData := `{"id": "123", "name": "John Doe"}`
callToolResult := &mcp.CallToolResult{
Content: []mcp.Content{
mcp.TextContent{
Type: "text",
Text: jsonData,
},
},
}
how to add CallToolResult field descriptions?
@mengmengpengpeng Not sure I understand your question. Could you please clarify?
Currently the SDK supports sending results as described by the MCP spec: https://modelcontextprotocol.io/specification/2025-03-26/server/tools#tool-result
ok