MCPcopy
hub / github.com/infinitered/reactotron / safeSerialize

Function safeSerialize

lib/reactotron-mcp/src/serialization.ts:30–37  ·  view source on GitHub ↗
(
  data: unknown,
  limit: number = MAX_RESPONSE_CHARS,
  guidance?: string
)

Source from the content-addressed store, hash-verified

28 * The guidance string tells the LLM what to do to get a smaller response.
29 */
30export function safeSerialize(
31 data: unknown,
32 limit: number = MAX_RESPONSE_CHARS,
33 guidance?: string
34): string {
35 const text = compactJson(data)
36 return truncate(text, limit, guidance)
37}
38
39/** One-line preview of an api.response command payload. */
40function apiResponsePreview(payload: any): string {

Callers 3

textResultFunction · 0.90
jsonFunction · 0.90

Calls 2

compactJsonFunction · 0.85
truncateFunction · 0.85

Tested by

no test coverage detected