powerautomate-mcp 0.9.2 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -8664,9 +8664,10 @@ async function handleDiagnoseFlow(api, input) {
8664
8664
  try {
8665
8665
  const actions = await api.getFlowRunActions(parsed.flowId, failedRun.name, parsed.environment);
8666
8666
  const failedActions = actions.filter((a) => a.properties.status === "Failed");
8667
+ const ioFetches = [];
8667
8668
  for (const action of failedActions) {
8668
8669
  const errorCode = action.properties.error?.code || "Unknown";
8669
- const errorMessage = action.properties.error?.message || "Unknown error";
8670
+ let errorMessage = action.properties.error?.message || "Unknown error";
8670
8671
  let category2 = "Unknown Error";
8671
8672
  let suggestedFixes2 = ["Review the error message and action inputs"];
8672
8673
  for (const pattern of ERROR_PATTERNS) {
@@ -8676,13 +8677,56 @@ async function handleDiagnoseFlow(api, input) {
8676
8677
  break;
8677
8678
  }
8678
8679
  }
8679
- failedActionsInfo.push({
8680
+ const info = {
8680
8681
  name: action.name,
8681
8682
  errorCode,
8682
8683
  errorMessage,
8683
8684
  category: category2,
8684
8685
  suggestedFixes: suggestedFixes2
8685
- });
8686
+ };
8687
+ failedActionsInfo.push(info);
8688
+ if (action.properties.outputsLink?.uri) {
8689
+ ioFetches.push(
8690
+ api.fetchResourceLink(action.properties.outputsLink.uri).then(
8691
+ (data) => {
8692
+ const d = data;
8693
+ if (d.statusCode) info.httpStatus = Number(d.statusCode);
8694
+ const body = d.body;
8695
+ if (body) {
8696
+ const bodyStr = typeof body === "object" ? JSON.stringify(body) : String(body);
8697
+ info.outputs = bodyStr.length > 800 ? bodyStr.slice(0, 800) + "\u2026" : bodyStr;
8698
+ if ((errorMessage === "Unknown error" || errorMessage.includes("An action failed")) && bodyStr.length > 5) {
8699
+ info.errorMessage = bodyStr.slice(0, 300);
8700
+ for (const pattern of ERROR_PATTERNS) {
8701
+ if (pattern.pattern.test(bodyStr)) {
8702
+ info.category = pattern.category;
8703
+ info.suggestedFixes = pattern.fixes;
8704
+ break;
8705
+ }
8706
+ }
8707
+ }
8708
+ }
8709
+ },
8710
+ () => {
8711
+ }
8712
+ )
8713
+ );
8714
+ }
8715
+ if (action.properties.inputsLink?.uri) {
8716
+ ioFetches.push(
8717
+ api.fetchResourceLink(action.properties.inputsLink.uri).then(
8718
+ (data) => {
8719
+ const str = typeof data === "object" ? JSON.stringify(data) : String(data);
8720
+ info.inputs = str.length > 800 ? str.slice(0, 800) + "\u2026" : str;
8721
+ },
8722
+ () => {
8723
+ }
8724
+ )
8725
+ );
8726
+ }
8727
+ }
8728
+ if (ioFetches.length > 0) {
8729
+ await Promise.all(ioFetches);
8686
8730
  }
8687
8731
  if (failedActionsInfo.length > 0) {
8688
8732
  primaryErrorCode = failedActionsInfo[0].errorCode;
@@ -8779,10 +8823,20 @@ async function handleDiagnoseFlow(api, input) {
8779
8823
  output += `**Failed Actions (${result.failedRun.failedActions.length}):**
8780
8824
  `;
8781
8825
  for (const action of result.failedRun.failedActions) {
8782
- output += ` \u274C **${action.name}** - ${action.category}
8826
+ output += ` \u274C **${action.name}** - ${action.category}`;
8827
+ if (action.httpStatus) output += ` (HTTP ${action.httpStatus})`;
8828
+ output += `
8829
+ `;
8830
+ output += ` Error: ${action.errorMessage.slice(0, 300)}${action.errorMessage.length > 300 ? "..." : ""}
8783
8831
  `;
8784
- output += ` Error: ${action.errorMessage.slice(0, 100)}${action.errorMessage.length > 100 ? "..." : ""}
8832
+ if (action.outputs && action.outputs !== action.errorMessage.slice(0, 300)) {
8833
+ output += ` Response: ${action.outputs.slice(0, 500)}${action.outputs.length > 500 ? "..." : ""}
8785
8834
  `;
8835
+ }
8836
+ if (action.inputs) {
8837
+ output += ` Request: ${action.inputs.slice(0, 300)}${action.inputs.length > 300 ? "..." : ""}
8838
+ `;
8839
+ }
8786
8840
  output += ` Fix: ${action.suggestedFixes[0]}
8787
8841
  `;
8788
8842
  }