*/ class PromptReference extends ElementReference { /** * @param Handler $handler * @param array $completionProviders */ public function __construct( public readonly Prompt $prompt, \Closure|array|string $handler, bool $isManual = false, public readonly array $completionProviders = [], ) { parent::__construct($handler, $isManual); } /** * Formats the raw result of a prompt generator into an array of MCP PromptMessages. * * @param mixed $promptGenerationResult expected: array of message structures * * @return PromptMessage[] array of PromptMessage objects * * @throws \RuntimeException if the result cannot be formatted * @throws \JsonException if JSON encoding fails */ public function formatResult(mixed $promptGenerationResult): array { return (new PromptResultFormatter())->format($promptGenerationResult); } }