import type { CallToolRequest } from '@frontmcp/protocol'; import { ToolContext, ToolEntry, type EntryOwnerRef, type ParsedToolResult, type SafeTransformResult, type ScopeEntry, type ToolCallArgs, type ToolCallExtra, type ToolInputOf, type ToolInputType, type ToolOutputOf, type ToolOutputType, type ToolRecord } from '../common'; import type HookRegistry from '../hooks/hook.registry'; import type ProviderRegistry from '../provider/provider.registry'; /** * Concrete implementation of a tool that can be executed. * * **Scope Binding:** The ToolInstance captures its scope and providers at construction time. * All operations (hook registration, tool context creation) use the captured scope. * If you need a tool to operate in a different scope (e.g., agent scope), you must * create a new ToolInstance with that scope's providers. */ export declare class ToolInstance, Out = ToolOutputOf<{ outputSchema: OutSchema; }>> extends ToolEntry { /** The provider registry this tool is bound to (captured at construction) */ private readonly _providers; /** The scope this tool operates in (captured at construction from providers) */ readonly scope: ScopeEntry; /** The hook registry for this tool's scope (captured at construction) */ readonly hooks: HookRegistry; constructor(record: ToolRecord, providers: ProviderRegistry, owner: EntryOwnerRef); protected initialize(): Promise; getMetadata(): import("../common").ToolMetadata>; }>, ToolOutputType>; getOutputSchema(): OutSchema | undefined; /** * Get the raw JSON Schema for output, optionally extended with elicitation fallback type. * * When elicitation is enabled in scope configuration, the output schema is * automatically wrapped in a oneOf union to allow either the original output * OR an elicitation pending response. This is transparent to consumers. */ getRawOutputSchema(): unknown; /** * Get the provider registry for this tool. * Used by flows to build context-aware providers for CONTEXT-scoped dependencies. */ get providers(): ProviderRegistry; create(input: ToolCallArgs, ctx: ToolCallExtra): ToolContext; parseInput(input: CallToolRequest['params']): CallToolRequest['params']['arguments']; /** * Turn the raw tool function result into an MCP-compliant CallToolResult: * - `content`: list of ContentBlocks (text / image / audio / resource / resource_link) * - `structuredContent`: sanitized JSON when outputSchema is "json-like" * * Rules: * - If outputSchema is a JS array → multiple content items, each with its own type. * - Primitive → stringifies into a TextContent block. * - image/audio/resource/resource_link → passed through as-is. * - JSON / structured → JSON.stringify for text, and full sanitized JSON in structuredContent. */ parseOutput(raw: Out | Partial | any): ParsedToolResult; safeParseOutput(raw: Out | Partial | any): SafeTransformResult; } //# sourceMappingURL=tool.instance.d.ts.map