powerautomate-mcp 0.9.2 → 0.9.4

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
@@ -721,7 +721,8 @@ function validateResourceLinkUrl(uri) {
721
721
  "microsoft.com",
722
722
  "sharepoint.com",
723
723
  "office.com",
724
- "azure.com"
724
+ "azure.com",
725
+ "powerplatformusercontent.com"
725
726
  ];
726
727
  const isAllowed = allowedDomains.some(
727
728
  (d) => hostname === d || hostname.endsWith(`.${d}`)
@@ -8664,9 +8665,10 @@ async function handleDiagnoseFlow(api, input) {
8664
8665
  try {
8665
8666
  const actions = await api.getFlowRunActions(parsed.flowId, failedRun.name, parsed.environment);
8666
8667
  const failedActions = actions.filter((a) => a.properties.status === "Failed");
8668
+ const ioFetches = [];
8667
8669
  for (const action of failedActions) {
8668
8670
  const errorCode = action.properties.error?.code || "Unknown";
8669
- const errorMessage = action.properties.error?.message || "Unknown error";
8671
+ let errorMessage = action.properties.error?.message || "Unknown error";
8670
8672
  let category2 = "Unknown Error";
8671
8673
  let suggestedFixes2 = ["Review the error message and action inputs"];
8672
8674
  for (const pattern of ERROR_PATTERNS) {
@@ -8676,13 +8678,56 @@ async function handleDiagnoseFlow(api, input) {
8676
8678
  break;
8677
8679
  }
8678
8680
  }
8679
- failedActionsInfo.push({
8681
+ const info = {
8680
8682
  name: action.name,
8681
8683
  errorCode,
8682
8684
  errorMessage,
8683
8685
  category: category2,
8684
8686
  suggestedFixes: suggestedFixes2
8685
- });
8687
+ };
8688
+ failedActionsInfo.push(info);
8689
+ if (action.properties.outputsLink?.uri) {
8690
+ ioFetches.push(
8691
+ api.fetchResourceLink(action.properties.outputsLink.uri).then(
8692
+ (data) => {
8693
+ const d = data;
8694
+ if (d.statusCode) info.httpStatus = Number(d.statusCode);
8695
+ const body = d.body;
8696
+ if (body) {
8697
+ const bodyStr = typeof body === "object" ? JSON.stringify(body) : String(body);
8698
+ info.outputs = bodyStr.length > 800 ? bodyStr.slice(0, 800) + "\u2026" : bodyStr;
8699
+ if ((errorMessage === "Unknown error" || errorMessage.includes("An action failed")) && bodyStr.length > 5) {
8700
+ info.errorMessage = bodyStr.slice(0, 300);
8701
+ for (const pattern of ERROR_PATTERNS) {
8702
+ if (pattern.pattern.test(bodyStr)) {
8703
+ info.category = pattern.category;
8704
+ info.suggestedFixes = pattern.fixes;
8705
+ break;
8706
+ }
8707
+ }
8708
+ }
8709
+ }
8710
+ },
8711
+ () => {
8712
+ }
8713
+ )
8714
+ );
8715
+ }
8716
+ if (action.properties.inputsLink?.uri) {
8717
+ ioFetches.push(
8718
+ api.fetchResourceLink(action.properties.inputsLink.uri).then(
8719
+ (data) => {
8720
+ const str = typeof data === "object" ? JSON.stringify(data) : String(data);
8721
+ info.inputs = str.length > 800 ? str.slice(0, 800) + "\u2026" : str;
8722
+ },
8723
+ () => {
8724
+ }
8725
+ )
8726
+ );
8727
+ }
8728
+ }
8729
+ if (ioFetches.length > 0) {
8730
+ await Promise.all(ioFetches);
8686
8731
  }
8687
8732
  if (failedActionsInfo.length > 0) {
8688
8733
  primaryErrorCode = failedActionsInfo[0].errorCode;
@@ -8779,10 +8824,20 @@ async function handleDiagnoseFlow(api, input) {
8779
8824
  output += `**Failed Actions (${result.failedRun.failedActions.length}):**
8780
8825
  `;
8781
8826
  for (const action of result.failedRun.failedActions) {
8782
- output += ` \u274C **${action.name}** - ${action.category}
8827
+ output += ` \u274C **${action.name}** - ${action.category}`;
8828
+ if (action.httpStatus) output += ` (HTTP ${action.httpStatus})`;
8829
+ output += `
8830
+ `;
8831
+ output += ` Error: ${action.errorMessage.slice(0, 300)}${action.errorMessage.length > 300 ? "..." : ""}
8783
8832
  `;
8784
- output += ` Error: ${action.errorMessage.slice(0, 100)}${action.errorMessage.length > 100 ? "..." : ""}
8833
+ if (action.outputs && action.outputs !== action.errorMessage.slice(0, 300)) {
8834
+ output += ` Response: ${action.outputs.slice(0, 500)}${action.outputs.length > 500 ? "..." : ""}
8785
8835
  `;
8836
+ }
8837
+ if (action.inputs) {
8838
+ output += ` Request: ${action.inputs.slice(0, 300)}${action.inputs.length > 300 ? "..." : ""}
8839
+ `;
8840
+ }
8786
8841
  output += ` Fix: ${action.suggestedFixes[0]}
8787
8842
  `;
8788
8843
  }