Feature Request
Add warnings field to tool output structs to communicate validation warnings to MCP clients about risky operations.
Motivation
Users need to be warned about operations that are lossy, irreversible, or have known issues. Currently, warnings are only logged server-side (stderr) which MCP clients cannot see.
Background
MCP Protocol: Uses stdin/stdout for JSON messages, stderr for logs
Current logging: mtlog writes to stderr (correct for server-side)
Problem: Claude Code and other MCP clients cannot see stderr logs
Proposed Solution
Add warnings to both server-side logs AND client-side JSON responses:
1. Add warnings field to output structs
type QuantizePaletteOutput struct {
Success bool `json:"success"`
Warnings []string `json:"warnings,omitempty"` // NEW
// ... existing fields
}
2. Log warnings server-side AND return in response
var warnings []string
// Server-side logging (stderr, for debugging)
if input.ConvertToIndexed && currentMode == "rgb" {
opLogger.Warning("Converting RGB to indexed",
"lossy", true,
"original_mode", "rgb")
}
// Client-side warning (JSON response)
if input.ConvertToIndexed && currentMode == "rgb" {
warnings = append(warnings,
"Converting RGB to indexed is lossy - colors will be quantized to palette")
}
return &QuantizePaletteOutput{
Success: true,
Warnings: warnings,
// ...
}
Operations Needing Warnings
quantize_palette:
- RGB → indexed conversion (lossy)
- Target colors < current colors (color loss)
flatten_layers:
- Operation cannot be undone without snapshots
- Layer organization will be lost
Any operation changing color mode:
- RGB → indexed (lossy)
- Indexed → RGB (palette info lost)
- Grayscale conversions (color info lost)
scale_sprite:
- Upscaling with non-pixel-perfect scaling (interpolation artifacts)
Example Output
{
"success": true,
"warnings": [
"Converting RGB to indexed is lossy - colors will be quantized to palette",
"Target palette size (16) is smaller than original (42) - 26 colors will be lost"
],
"original_colors": 42,
"quantized_colors": 16,
...
}
Implementation Checklist
Benefits
- MCP clients can display warnings to users
- Users make informed decisions about risky operations
- Known issues are communicated proactively
- Server-side logs still available for debugging
Feature Request
Add
warningsfield to tool output structs to communicate validation warnings to MCP clients about risky operations.Motivation
Users need to be warned about operations that are lossy, irreversible, or have known issues. Currently, warnings are only logged server-side (stderr) which MCP clients cannot see.
Background
MCP Protocol: Uses stdin/stdout for JSON messages, stderr for logs
Current logging: mtlog writes to stderr (correct for server-side)
Problem: Claude Code and other MCP clients cannot see stderr logs
Proposed Solution
Add warnings to both server-side logs AND client-side JSON responses:
1. Add warnings field to output structs
2. Log warnings server-side AND return in response
Operations Needing Warnings
quantize_palette:
flatten_layers:
Any operation changing color mode:
scale_sprite:
Example Output
{ "success": true, "warnings": [ "Converting RGB to indexed is lossy - colors will be quantized to palette", "Target palette size (16) is smaller than original (42) - 26 colors will be lost" ], "original_colors": 42, "quantized_colors": 16, ... }Implementation Checklist
warnings []stringfield to all tool output structsquantize_paletteflatten_layersBenefits