using System.Collections.Generic;
namespace io.github.hatayama.uLoopMCP
{
///
/// Response for dynamic code execution tool
/// Related classes: ExecuteDynamicCodeTool, ExecuteDynamicCodeSchema
///
public class ExecuteDynamicCodeResponse : BaseToolResponse
{
private const bool EmitTimingsInJsonResponses = false;
/// Execution success flag
public bool Success { get; set; }
/// Execution result
public string Result { get; set; }
/// Log messages
public List Logs { get; set; } = new();
/// Compilation errors
public List CompilationErrors { get; set; } = new();
/// Error message (on failure)
public string ErrorMessage { get; set; }
/// Current security level
public string SecurityLevel { get; set; }
/// Error message (alias for ErrorMessage)
public string Error
{
get => ErrorMessage;
set => ErrorMessage = value;
}
///
/// Code formatted for compilation
/// (After extracting/moving using statements and applying class/method wrapping)
/// Allows checking the actual compiled code during debugging
///
public string UpdatedCode { get; set; }
///
/// Summary of diagnostics (unique count, total count, first error brief)
///
public string DiagnosticsSummary { get; set; }
///
/// Structured diagnostics for rich clients (line/column/code/message/hint/suggestions)
///
public List Diagnostics { get; set; } = new();
///
/// Lightweight internal timings for benchmark comparison.
///
public List Timings { get; set; } = new();
// Keep timings available in memory for diagnostics and readiness decisions
// while avoiding noisy default payloads for normal execute-dynamic-code users.
public bool ShouldSerializeTimings()
{
return EmitTimingsInJsonResponses;
}
}
///
/// DTO for compilation error information
///
public class CompilationErrorDto
{
/// Error message
public string Message { get; set; }
/// Line number
public int Line { get; set; }
/// Column number
public int Column { get; set; }
/// Compiler error code (e.g., CS0103)
public string ErrorCode { get; set; }
/// Optional hint for resolving the error
public string Hint { get; set; }
/// Suggested fixes (e.g., add using or qualify)
public List Suggestions { get; set; } = new();
/// Context lines around the error with a caret pointer
public string Context { get; set; }
/// Pointer column for caret rendering (1-based)
public int PointerColumn { get; set; }
}
}