/** * Tool Wrapper Utility * Standardizes error handling and reduces repetitive try-catch blocks */ import type { IWordPressClient } from "../types/client.js"; import type { BaseToolParams } from "../types/tools.js"; /** * Wrapper for tool methods that standardizes error handling */ export declare function withErrorHandling(operation: string, fn: (...args: T) => Promise): (...args: T) => Promise; /** * Wrapper for tool methods with validation */ export declare function withValidation(operation: string, validator: (...args: T) => void, fn: (...args: T) => Promise): (...args: T) => Promise; /** * Common validation functions */ export declare const validators: { requireSite: (client: IWordPressClient | null | undefined, params: BaseToolParams) => void; requireId: (params: { id?: number | string; }) => void; requireNonEmpty: (value: unknown, fieldName: string) => void; requireFields: (params: Record, fields: readonly string[]) => void; }; /** * Decorator for class methods to add error handling */ export declare function errorHandler(operation: string): (target: unknown, propertyKey: string, descriptor: PropertyDescriptor) => PropertyDescriptor; /** * Helper to format success responses consistently */ export declare function formatSuccessResponse(content: string): string; /** * Helper to format error responses consistently */ export declare function formatErrorResponse(operation: string, error: unknown): never; /** * Simple tool wrapper for standalone async functions */ export declare function toolWrapper(fn: () => Promise): Promise; //# sourceMappingURL=toolWrapper.d.ts.map