Table of Contents

Method FormatException

Namespace
GrindFest.GameMaster.Helpers
Assembly
GrindFest.dll

FormatException(Exception, string, object)

Formats an exception into a detailed JSON error response for MCP tools. Includes exception type, message, stack trace, inner exceptions (recursively), and tool context. Also logs the exception to Unity console for debugging.

public static string FormatException(Exception ex, string toolName, object context = null)

Parameters

ex Exception

The exception to format

toolName string

Name of the MCP tool that encountered the error

context object

Optional additional context (e.g., parameter values)

Returns

string

JSON string with detailed error information