MCPcopy Create free account
hub / github.com/Openpanel-dev/openpanel / toText

Function toText

packages/mcp/src/tools/shared.ts:77–83  ·  view source on GitHub ↗
(data: unknown)

Source from the content-addressed store, hash-verified

75 * Serialize a tool result to MCP content format.
76 */
77export function toText(data: unknown): {
78 content: [{ type: 'text'; text: string }];
79} {
80 return {
81 content: [{ type: 'text' as const, text: JSON.stringify(data, null, 2) }],
82 };
83}
84
85/**
86 * Wrap a tool handler to catch errors and return them as MCP error content.

Callers 1

withErrorHandlingFunction · 0.85

Calls 1

stringifyMethod · 0.45

Tested by

no test coverage detected