Repository: IBM/mcp-context-forge

Issue:
[Bug]:Vague/Unclear Error Message "Validation Failed" When Adding a REST Tool
### 🐞 Bug Summary


Screenshot Attached.
<img width="1752" height="946" alt="Image" src="https://github.com/user-attachments/assets/71d84b8e-b36e-4bf8-a504-c3b1017ec01c" />

When a user attempts to add a new REST tool and the configuration is invalid (example: Invalid Tool Name ), the system displays a generic "Validation Failed" error message. This message does not provide any specific details about which part of the configuration is incorrect, making it difficult and time-consuming for the user to troubleshoot and correct the issue.

Container log says:
"ERROR [mcpgateway] ValidationError in admin_add_tool: 1 validation error for ToolCreate
name
  Value error, Tool name must start with a letter and contain only letters, numbers, and underscore [type=value_error, input_value='Langsmith Workspaces', input_type=str]"

---

### 🧩 Affected Component
Select the area of the project impacted:

- [ ] `mcpgateway` - API
- [ ] `mcpgateway` - UI (admin panel)
- [ ] `mcpgateway.wrapper` - stdio wrapper
- [ ] Federation or Transports
- [ ] CLI, Makefiles, or shell scripts
- [ ] Container setup (Docker/Podman/Compose)
- [ ] Other (explain below)

---

### 🔁 Steps to Reproduce

1. ...
2. ...
3. ...

---

### 🤔 Expected Behavior
What should have happened instead?

---

### 📓 Logs / Error Output
Paste any relevant stack traces or logs here.
⚠️ **Do not paste secrets, credentials, or tokens.**

---

### 🧠 Environment Info
You can retrieve most of this from the `/version` endpoint.

| Key | Value |
|-----|-------|
| Version or commit | `e.g. v0.9.0 or main@a1b2c3d` |
| Runtime | `e.g. Python 3.11, Gunicorn` |
| Platform / OS | `e.g. Ubuntu 22.04, macOS` |
| Container | `e.g. Docker, Podman, none` |

---

### 🧩 Additional Context (optional)
Add any configuration details, flags, or related issues.



Discussion:

Patch:
diff --git a/mcpgateway/utils/error_formatter.py b/mcpgateway/utils/error_formatter.py
index 14bccb98..ba264ace 100644
--- a/mcpgateway/utils/error_formatter.py
+++ b/mcpgateway/utils/error_formatter.py
@@ -83,7 +83,7 @@ def format_validation_error(error: ValidationError) -> Dict[str, Any]:
             ...     result = ErrorFormatter.format_validation_error(e)
             <class 'pydantic_core._pydantic_core.ValidationError'>
             >>> result['message']
-            'Validation failed'
+            'Validation failed: Name must start with a letter and contain only letters, numbers, and underscores'
             >>> result['success']
             False
             >>> len(result['details']) > 0
@@ -134,7 +134,7 @@ def format_validation_error(error: ValidationError) -> Dict[str, Any]:
         # Log the full error for debugging
         logger.debug(f"Validation error: {error}")
 
-        return {"message": "Validation failed", "details": errors, "success": False}
+        return {"message": f"Validation failed: {user_message}", "details": errors, "success": False}
 
     @staticmethod
     def _get_user_message(field: str, technical_msg: str) -> str:


Test patch:
diff --git a/tests/unit/mcpgateway/utils/test_error_formatter.py b/tests/unit/mcpgateway/utils/test_error_formatter.py
index 20beca6f..e1f39c6e 100644
--- a/tests/unit/mcpgateway/utils/test_error_formatter.py
+++ b/tests/unit/mcpgateway/utils/test_error_formatter.py
@@ -71,7 +71,7 @@ def test_format_validation_error_letter_requirement():
     with pytest.raises(ValidationError) as exc:
         NameModel(name="Bobby")
     result = ErrorFormatter.format_validation_error(exc.value)
-    assert result["message"] == "Validation failed"
+    assert result["message"] == "Validation failed: Name must start with a letter and contain only letters, numbers, and underscores"
     assert result["success"] is False
     assert result["details"][0]["field"] == "name"
     assert "must start with a letter" in result["details"][0]["message"]