Skip to content

Class: ResultProcessor

Mastra output processor that trims the bulky, redundant payload fields off targeted outbound stream frames.

Mastra emits step / finish / tool-result frames whose payloads echo the full tool output / result / assistant messages / response - data the chat client already received inline and doesn’t need re-sent. This processor empties those keys on the targeted frame types so the outbound SSE stream stays lean; every other frame passes through untouched.

  • Processor

new ResultProcessor(): ResultProcessor

ResultProcessor

id: string = "result-processor"

Processor.id


processDataParts: boolean = true

When true, this processor will also receive data-* chunks in processOutputStream. Default: false.

Processor.processDataParts

processOutputStream(__namedParameters): Promise<any>

Process output stream chunks with built-in state management This allows processors to accumulate chunks and make decisions based on larger context Return null or undefined to skip emitting the part

any

Promise<any>

Processor.processOutputStream