Skip to content

Type Alias: MastraPlugins

MastraPlugins = Record<string, MastraPluginToolkitProvider>

Plugin map handed to the function form of MastraAgentDefinition.tools. Mirrors AppKit’s Plugins type exactly: a string-keyed record where every value exposes .toolkit(opts).

Implemented as a runtime Proxy that auto-discovers any registered AppKit plugin implementing the standard ToolProvider interface (analytics, files, lakebase, genie, plus any third-party plugin that does the same). Unknown names resolve to undefined at runtime, so guard with ?. and ?? {} when spreading from a plugin that may not be registered in every environment.

createAgent({
instructions: "...",
tools(plugins) {
return {
...plugins.analytics.toolkit(),
...plugins.files.toolkit({ only: ["uploads.read"] }),
get_weather: tool({
description: "Weather",
schema: z.object({ city: z.string() }),
execute: async ({ city }) => `Sunny in ${city}`,
}),
};
},
});