namespace PostFundManagement.Application.Mcp; /// /// Token-optimized standardized tool response wrapper for MCP tool execution. /// public record Records(bool Success, T? Data = default, string? Message = null, IReadOnlyList? Errors = null) { public static Records Ok(T data, string? message = null) => new(true, data, message, null); public static Records Fail(string error, IReadOnlyList? errors = null) => new(false, default, error, errors); } /// /// Token-optimized standardized non-generic tool response wrapper for MCP tool execution. /// public record McpToolResult(bool Success, string Message, IReadOnlyList? Errors = null) { public static McpToolResult Ok(string message = "Operation completed successfully.") => new(true, message); public static McpToolResult Fail(string error, IReadOnlyList? errors = null) => new(false, error, errors); } public sealed record McpToolDefinition(string Name, string Title, string Description, string Group, bool ReadOnly, IReadOnlyList Parameters); public sealed record McpToolParameter(string Name, string Type, string Description, bool IsRequired, object? DefaultValue); public sealed record McpToolExecutionResult(bool Success, object? Data, string? Error, string? SerializedResult) { public static McpToolExecutionResult Ok(object? data, JsonSerializerOptions? options = null) => new(true, data, null, data != null ? JsonSerializer.Serialize(data, options ?? DefaultJsonOptions) : null); public static McpToolExecutionResult Fail(string error) => new(false, null, error, null); private static readonly JsonSerializerOptions DefaultJsonOptions = new() { PropertyNamingPolicy = JsonNamingPolicy.CamelCase, WriteIndented = false }; } public sealed record ToolMethodInfo(Type TargetType, MethodInfo Method, ParameterInfo[] Parameters);