import {
  runWorkflow
} from "./chunk-XRQNXN2Z.js";
import "./chunk-CAY57CKF.js";
import "./chunk-KOO5733S.js";

// src/tools/run-workflow.ts
async function handleRunWorkflow(params) {
  let parsedInput = {};
  if (params.input) {
    try {
      parsedInput = JSON.parse(params.input);
    } catch {
      return "Error: `input` must be a valid JSON object.";
    }
  }
  const result = await runWorkflow(params.id, parsedInput);
  const lines = [];
  lines.push(`Workflow "${params.id}" executed successfully.
`);
  if (typeof result === "object" && result !== null) {
    const output = result.output;
    if (output !== void 0) {
      lines.push("**Output:**");
      lines.push(typeof output === "string" ? output : JSON.stringify(output, null, 2));
    } else {
      lines.push("**Result:**");
      lines.push(JSON.stringify(result, null, 2));
    }
  }
  return lines.join("\n");
}
export {
  handleRunWorkflow
};
//# sourceMappingURL=run-workflow-RWX2D752.js.map