Skip to contents

Serialize R object to JSON string for MCP

Usage

mcp_serialize(x, pretty = FALSE, auto_unbox = TRUE)

Arguments

x

An R object to serialize

pretty

Whether to pretty-print the JSON

auto_unbox

Whether to automatically unbox single-element vectors

Value

A JSON string representation of the R object

Examples

mcp_serialize(list(result = 42, message = "success"))
#> {"result":42,"message":"success"}