import type { JsonValue, JsonSchemaType } from "./jsonUtils.js"; import type { ValidateFunction } from "ajv"; import type { Tool, JSONRPCMessage } from "@modelcontextprotocol/sdk/types.js"; /** * Compiles and caches output schema validators for a list of tools * Following the same pattern as SDK's Client.cacheToolOutputSchemas * @param tools Array of tools that may have output schemas */ export declare function cacheToolOutputSchemas(tools: Tool[]): void; /** * Gets the cached output schema validator for a tool * Following the same pattern as SDK's Client.getToolOutputValidator * @param toolName Name of the tool * @returns The compiled validator function, or undefined if not found */ export declare function getToolOutputValidator(toolName: string): ValidateFunction | undefined; /** * Validates structured content against a tool's output schema * Returns validation result with detailed error messages * @param toolName Name of the tool * @param structuredContent The structured content to validate * @returns An object with isValid boolean and optional error message */ export declare function validateToolOutput(toolName: string, structuredContent: unknown): { isValid: boolean; error?: string; }; /** * Checks if a tool has an output schema * @param toolName Name of the tool * @returns true if the tool has an output schema */ export declare function hasOutputSchema(toolName: string): boolean; /** * Attempts to extract JSON from content[] text blocks. * Used as fallback when structuredContent is not present. * MCP allows tools to return valid JSON in standard content blocks * even when they define an outputSchema. * @param content Array of content blocks from tool response * @returns Parsed JSON object or null if no valid JSON found */ export declare function tryExtractJsonFromContent(content: Array<{ type: string; text?: string; [key: string]: unknown; }>): unknown | null; /** * Generates a default value based on a JSON schema type * @param schema The JSON schema definition * @param propertyName Optional property name for checking if it's required in parent schema * @param parentSchema Optional parent schema to check required array * @returns A default value matching the schema type */ export declare function generateDefaultValue(schema: JsonSchemaType, propertyName?: string, parentSchema?: JsonSchemaType): JsonValue; /** * Helper function to check if a property is required in a schema * @param propertyName The name of the property to check * @param schema The parent schema containing the required array * @returns true if the property is required, false otherwise */ export declare function isPropertyRequired(propertyName: string, schema: JsonSchemaType): boolean; /** * Resolves $ref references in JSON schema * @param schema The schema that may contain $ref * @param rootSchema The root schema to resolve references against * @returns The resolved schema without $ref */ export declare function resolveRef(schema: JsonSchemaType, rootSchema: JsonSchemaType): JsonSchemaType; /** * Normalizes union types (like string|null from FastMCP) to simple types for form rendering * @param schema The JSON schema to normalize * @returns A normalized schema or the original schema */ export declare function normalizeUnionType(schema: JsonSchemaType): JsonSchemaType; /** * Formats a field key into a human-readable label * @param key The field key to format * @returns A formatted label string */ export declare function formatFieldLabel(key: string): string; /** * Resolves `$ref` references in a JSON-RPC "elicitation/create" message's `requestedSchema` field * @param message The JSON-RPC message that may contain $ref references * @returns A new message with resolved $ref references, or the original message if no resolution is needed */ export declare function resolveRefsInMessage(message: JSONRPCMessage): JSONRPCMessage; //# sourceMappingURL=schemaUtils.d.ts.map