@turbot/powerpipe-mcp
Version:
Powerpipe MCP server to run benchmarks, detections and controls using AI.
32 lines (31 loc) • 1.06 kB
TypeScript
/**
* Handle the output from powerpipe run commands that return JSON.
*
* Powerpipe run commands (benchmark, control, detection) may exit with non-zero status
* even when they successfully execute and return valid JSON output. This happens when
* the checks detect issues:
*
* Exit codes:
* - 0: Success - ran successfully with no alarms or errors
* - 1: Alarm - completed successfully but there were one or more alarms
* - 2: Error - completed but one or more control errors occurred
*
* In these cases, we want to return the JSON output (which contains the failure details)
* rather than treating it as a command error.
*
* @param error The error from executeCommand
* @param cmd The command that was executed
* @returns Formatted response with either parsed JSON output or error message
*/
export declare function handlePowerpipeRunOutput(error: unknown, cmd: string): {
isError: true;
content: {
type: "text";
text: string;
}[];
} | {
content: {
type: string;
text: string;
}[];
};