import { z } from 'zod'; /** * Common tool helper utilities for creating MCP tools */ /** * Create a simple echo/ping tool for testing */ export declare function createEchoTool(): { name: string; description: string; parameters: z.ZodObject<{ message: z.ZodString; }, "strip", z.ZodTypeAny, { message: string; }, { message: string; }>; execute: ({ message }: { message: string; }) => Promise; }; /** * Create a version info tool */ export declare function createVersionTool(version: string, additionalInfo?: Record): { name: string; description: string; parameters: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>; execute: () => Promise; }; /** * Create a status tool that reports server status */ export declare function createStatusTool(statusProvider: () => Promise> | Record): { name: string; description: string; parameters: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>; execute: () => Promise; }; /** * Wrap a tool with error handling */ export declare function withErrorHandling(tool: any, errorHandler?: (error: Error) => string): any; /** * Wrap a tool with logging */ export declare function withLogging(tool: any, logger?: (message: string, data?: any) => void): any; /** * MCPToolResult - MCP protocol response format (content-only) * * This is the format FastMCP returns after wrapping tool responses. * Tools return JSON strings, FastMCP wraps them as {content: [{type: 'text', text: '...'}]}. * * Use extractMCPResult() to parse the content[0].text string back to structured data. */ export interface MCPToolResult { content: Array<{ type: 'text'; text: string; }>; isError?: boolean; } /** * Extract result from MCPToolResult (content-only format) * * Parses content[0].text as JSON to get structured data. * FastMCP wraps tool responses as {content: [{type: 'text', text: '...'}]}. * * @param result Tool execution result (MCPToolResult or plain object) * @returns Structured data parsed from content[0].text or plain object * * @example * // MCPToolResult format (from FastMCP) * const result = { * content: [{ type: 'text', text: '{"data":"value"}' }] * }; * extractMCPResult(result); // { data: 'value' } * * @example * // Plain object (backward compatibility for direct tool calls) * const result = { plain: 'object' }; * extractMCPResult(result); // { plain: 'object' } */ export declare function extractMCPResult(result: unknown): Record; /** * Create MCP tool result from data * * Returns JSON string that FastMCP automatically wraps as {content: [{type: 'text', text: '...'}]}. * This is the content-only format - no structuredContent field. * * @param data The data to serialize * @param meta Optional metadata to merge into the response * @returns JSON string representation * * @example * // Simple usage * const result = createMCPToolResult({ response: 'test' }); * // Returns: '{"response":"test"}' * // FastMCP wraps as: {content: [{type: 'text', text: '{"response":"test"}'}]} * * @example * // With metadata * const result = createMCPToolResult( * { response: 'test' }, * { conversationId: '123' } * ); * // Returns: '{"response":"test","conversationId":"123"}' */ export declare function createMCPToolResult(data: Record, meta?: Record): string; //# sourceMappingURL=ToolHelpers.d.ts.map