@mastra/core
Version:
48 lines • 2.1 kB
TypeScript
import type { ProviderDefinedTool } from '../../_types/@internal_external-types@0.0.101/dist/index.js';
import { MastraBase } from '../../base.js';
import type { ToolOptions } from '../../utils/index.js';
import type { CoreTool, ToolAction, VercelTool, VercelToolV5 } from '../types.js';
/**
* Types that can be converted to Mastra tools.
* Includes provider-defined tools from external packages via ProviderDefinedTool.
*/
export type ToolToConvert = VercelTool | ToolAction<any, any, any> | VercelToolV5 | ProviderDefinedTool;
export type LogType = 'tool' | 'toolset' | 'client-tool';
export declare class CoreToolBuilder extends MastraBase {
private originalTool;
private options;
private logType?;
/**
* Builder-local copy of the user's input schema with the framework-injected
* keys (`_background`, `suspendedToolRunId`, `resumeData`) spliced in.
*
* It must NOT be written back onto `originalTool.inputSchema`: `createTool()`
* results are commonly module-level singletons shared across several agents,
* while background eligibility is resolved per agent — a write-back would
* leak one agent's injected keys into every other agent's model-facing
* parameters (issue #22843).
*/
private injectedInputSchema?;
private isResumableTool;
constructor(input: {
originalTool: ToolToConvert;
options: ToolOptions;
logType?: LogType;
autoResumeSuspendedTools?: boolean;
backgroundTaskEnabled?: boolean;
});
private getParameters;
/** Compat-layer validation schema for execute-time checks (when a layer applies). */
private buildCompatValidationSchema;
private getOutputSchema;
private getResumeSchema;
private getSuspendSchema;
private buildProviderTool;
private createLogMessageOptions;
/** Enforces the TOOLS_EXECUTE FGA permission for this tool when an FGA provider is configured. */
private requireToolExecuteFGA;
private createExecute;
buildV5(): VercelToolV5;
build(): CoreTool;
}
//# sourceMappingURL=builder.d.ts.map