import { type AuthInfo, type CallToolRequest, type CallToolResult, type Notification, type Request, type RequestHandlerExtra } from '@frontmcp/protocol'; import type ProviderRegistry from '../../provider/provider.registry'; import { type ToolInputOf, type ToolOutputOf } from '../decorators'; import { type ToolContext } from '../interfaces'; import { type ToolInputType, type ToolMetadata, type ToolOutputType } from '../metadata'; import { type ToolRecord } from '../records'; import { BaseEntry, type EntryOwnerRef } from './base.entry'; export type ToolCallArgs = CallToolRequest['params']['arguments']; export type ToolCallExtra = RequestHandlerExtra & { authInfo: AuthInfo; /** Progress token from the request's _meta, used for progress notifications */ progressToken?: string | number; /** * AbortSignal provided by the task runner for task-augmented calls * (MCP 2025-11-25 tasks spec). Fires on `tasks/cancel`. Absent for non-task * invocations. */ signal?: AbortSignal; }; export type ParsedToolResult = CallToolResult; export type SafeTransformResult = { success: true; data: T; } | { success: false; error: Error; }; export declare abstract class ToolEntry, Out = ToolOutputOf<{ outputSchema: OutSchema; }>> extends BaseEntry, ToolMetadata> { owner: EntryOwnerRef; /** * The name of the tool, as declared in the metadata. */ name: string; /** * The full name of the tool, including the owner name as prefix. */ fullName: string; /** * Get the provider registry for this tool. * Used by flows to build context-aware providers for CONTEXT-scoped dependencies. */ abstract get providers(): ProviderRegistry; inputSchema: InSchema; /** * Raw JSON Schema for input, set internally by OpenAPI adapter or remote tools. * Not part of the user-facing decorator API (removed in v1.0.0). */ rawInputSchema: unknown; outputSchema?: OutSchema; /** * Raw JSON Schema for output, set internally by OpenAPI adapter or remote tools. * Not part of the user-facing decorator API (removed in v1.0.0). */ rawOutputSchema?: unknown; /** * Accessor used by tools/list to expose the tool's declared outputSchema. * This returns the exact value from metadata (string literal, zod schema, * raw shape, or an array of those). */ getOutputSchema(): OutSchema | undefined; /** * Accessor used by tools/list to expose the tool's output schema as JSON Schema. * Returns the raw JSON Schema representation if available. */ getRawOutputSchema(): unknown | undefined; /** Cached JSON Schema result (undefined = not yet computed) */ private _cachedInputJsonSchema?; /** * Get the tool's input schema as JSON Schema (cached after first call). * Returns rawInputSchema if available, otherwise converts from Zod schema shape. * * This is the single source of truth for tool input schema conversion. * Used by skill HTTP utilities and other consumers needing JSON Schema format. * * @returns JSON Schema object or null if no schema is available */ getInputJsonSchema(): Record | null; private computeInputJsonSchema; /** Cached output JSON Schema result (undefined = not yet computed, null = none) */ private _cachedOutputJsonSchema?; /** * Get the tool's output schema as JSON Schema (cached after first call). * * Prefers an explicit `rawOutputSchema` (the JSON Schema set by the OpenAPI adapter / * remote tools); otherwise converts a Zod-shape or `z.object()` `outputSchema` to JSON * Schema — symmetric with {@link getInputJsonSchema}. Returns `null` for output forms * that have no object-typed schema to advertise: primitive / media string literals * (`'string'`, `'image'`, …), multi-content arrays (`['string', 'image']`), and any * schema that does not serialize to a top-level `type: 'object'` (e.g. a union) — those * flow through `content`, not `structuredContent`, per the MCP spec. * * @returns JSON Schema object, or null if there is no advertisable output schema. */ getOutputJsonSchema(): Record | null; private computeOutputJsonSchema; /** * Create a tool context (class or function wrapper). */ abstract create(input: ToolCallArgs, ctx: ToolCallExtra): ToolContext; /** * Convert the raw tool request input into an MCP CallToolRequest-shaped object. */ abstract parseInput(input: CallToolRequest['params']): CallToolRequest['params']['arguments']; /** * Convert the raw tool return value (Out) into an MCP CallToolResult-shaped object. * Concrete logic is implemented in ToolInstance. */ abstract parseOutput(result: Out | Partial | any): ParsedToolResult; /** * Convert the raw tool return value (Out) into an MCP CallToolResult-shaped object. * Concrete logic is implemented in ToolInstance. */ abstract safeParseOutput(raw: Out | Partial | any): SafeTransformResult; } //# sourceMappingURL=tool.entry.d.ts.map