logErrors property

bool logErrors
final

Whether to log internal errors to stderr for troubleshooting.

When true, generated tool handlers will write the full exception message and stack trace to stderr before returning a generic error to the MCP client. This helps developers diagnose issues (file I/O errors, type mismatches, etc.) while keeping client-facing error messages safe and generic.

stderr output is visible in the MCP Inspector's "Error output from MCP server" pane, in terminal output when running via dart run, and in any client that captures the subprocess's stderr stream.

When false (the default), no diagnostic output is produced, keeping logs clean for production deployments.

Defaults to false.

Implementation

final bool logErrors;