mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-12 07:20:45 +00:00
15 lines
453 B
TypeScript
15 lines
453 B
TypeScript
export function jsonToolResult(data: unknown) {
|
|
return {
|
|
content: [{ type: "text" as const, text: JSON.stringify(data, null, 2) }],
|
|
details: data,
|
|
};
|
|
}
|
|
|
|
export function unknownToolActionResult(action: unknown) {
|
|
return jsonToolResult({ error: `Unknown action: ${String(action)}` });
|
|
}
|
|
|
|
export function toolExecutionErrorResult(error: unknown) {
|
|
return jsonToolResult({ error: error instanceof Error ? error.message : String(error) });
|
|
}
|