Skip to content

MCP: switch from JSON TextContent to StructuredContent #4070

@AkihiroSuda

Description

@AkihiroSuda

resJ, err := json.Marshal(res)
if err != nil {
return nil, nil, err
}
return &mcp.CallToolResult{
Content: []mcp.Content{&mcp.TextContent{Text: string(resJ)}},
}, nil, nil

https://modelcontextprotocol.io/specification/2025-06-18/server/tools#structured-content says:

For backwards compatibility, a tool that returns structured content SHOULD also return the serialized JSON in a TextContent block

However, probably we do not need to retain the JSON TextContent block if StructuredContent is supported by well-known agents (Gemini, Claude, Codex, etc.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions