Skip to content

Function: buildSummarizeTool()

buildSummarizeTool(config): Tool<{ instructions?: string; maxWords?: number; text: string; }, unknown, unknown, unknown, ToolExecutionContext<unknown, unknown, unknown>, "summarize", unknown>

Build the summarize tool. Exposed as an ambient system tool (like render_data) so every agent can offload condensing long content, notes, transcripts, or bulky tool results to the fast tier instead of spending its primary chat model. The tool reads the live requestContext / abortSignal off the Mastra execution context so its model call stays user-scoped and cancels with the turn.

MastraPluginConfig

Tool<{ instructions?: string; maxWords?: number; text: string; }, unknown, unknown, unknown, ToolExecutionContext<unknown, unknown, unknown>, "summarize", unknown>