import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js"; import { toToolError } from "./errors.js"; export function toolSuccess(structuredContent: Record): CallToolResult { return { structuredContent, content: [ { type: "text", text: JSON.stringify(structuredContent, null, 2), }, ], }; } export function toolFailure(error: unknown): CallToolResult { const message = toToolError(error); return { isError: true, content: [ { type: "text", text: message, }, ], }; }