Enhance the tool call validations.
For example if a tool required a branch / username, check if the branch exists and the branch user correct with an extra api call.
Check out all tools which have weak validation to ensure the tool not getting for example http 404 code.
Add better, concise and short error messages if tool call fails.
Enhance the tool call validations.
For example if a tool required a branch / username, check if the branch exists and the branch user correct with an extra api call.
Check out all tools which have weak validation to ensure the tool not getting for example http 404 code.
Add better, concise and short error messages if tool call fails.
Analyzing all tools to identify weak validation points
Adding pre-validation checks (e.g., branch existence, user existence) before API calls
Implementing better error messages when validation or API calls fail
Ensuring we catch 404 errors and other common failures with clear messages
Let me review the codebase and implement these improvements.
@fszontagh I'm starting work on this issue now!
I'll enhance tool call validation by:
1. Analyzing all tools to identify weak validation points
2. Adding pre-validation checks (e.g., branch existence, user existence) before API calls
3. Implementing better error messages when validation or API calls fail
4. Ensuring we catch 404 errors and other common failures with clear messages
Let me review the codebase and implement these improvements.
All changes have been committed and pushed to the main branch.
Summary
This enhancement significantly improves the developer experience by:
Preventing common errors - Pre-validation catches issues before making API calls
Better error messages - Instead of cryptic axios errors, users get clear, actionable messages
Helpful suggestions - Error messages include suggestions like available branches or valid label IDs
Reduced debugging time - Context-aware errors make it immediately clear what went wrong
Example Improvements
Before:
Error: Request failed with status code 404
After:
assignee: User 'nonexistentuser' not found. Please check the username is correct.
or
Branch 'feature-xyz' not found in repository 'claude/gogs-mcp'. Available branches: main, develop
The validation module is also extensible for future enhancements!
## Changes Committed and Pushed 🚀
**Commit:** `8ea9776`
All changes have been committed and pushed to the main branch.
### Summary
This enhancement significantly improves the developer experience by:
1. **Preventing common errors** - Pre-validation catches issues before making API calls
2. **Better error messages** - Instead of cryptic axios errors, users get clear, actionable messages
3. **Helpful suggestions** - Error messages include suggestions like available branches or valid label IDs
4. **Reduced debugging time** - Context-aware errors make it immediately clear what went wrong
### Example Improvements
**Before:**
```
Error: Request failed with status code 404
```
**After:**
```
assignee: User 'nonexistentuser' not found. Please check the username is correct.
```
or
```
Branch 'feature-xyz' not found in repository 'claude/gogs-mcp'. Available branches: main, develop
```
The validation module is also extensible for future enhancements!
Enhance the tool call validations. For example if a tool required a branch / username, check if the branch exists and the branch user correct with an extra api call.
Check out all tools which have weak validation to ensure the tool not getting for example http 404 code.
Add better, concise and short error messages if tool call fails.
@fszontagh I'm starting work on this issue now!
I'll enhance tool call validation by:
Let me review the codebase and implement these improvements.
Analysis Complete
I've analyzed the codebase and identified validation improvement areas:
Current State
error.messageTools with Weak Validation:
High Priority:
get_commits- should validate branch/SHA existsget_tree- should validate SHA existsupdate_issue- should validate assignee user existscreate_issue- should validate assignee user existsadd_collaborator- should validate username existsadd_organization_member- should validate username existsadd_team_member- should validate username existsMedium Priority:
Implementation Plan:
validateUserExists(username)validateRepoExists(owner, repo)validateBranchExists(owner, repo, branch)Starting implementation now...
Implementation Complete ✅
I've successfully implemented enhanced tool call validation. Here's what was done:
Created New Validation Module (
src/validation.ts)Enhanced error formatter (
formatGogsError): Extracts meaningful information from axios errorsValidation helper functions:
validateUserExists()- validates username before operationsvalidateRepoExists()- validates repository existencevalidateBranchExists()- validates branch and provides available branches if not foundvalidateIssueExists()- validates issue numbervalidateLabelExists()- validates single label IDvalidateLabelsExist()- validates multiple label IDs with helpful errorvalidateMilestoneExists()- validates milestone IDvalidateOrgExists()- validates organization namevalidateTeamExists()- validates team IDEnhanced Tool Handlers (in
src/server.ts)Added pre-validation to these high-priority tools:
get_commits- validates branch exists when SHA is providedcreate_issue- validates assignee, milestone, and labelsupdate_issue- validates assignee, milestone, and labelsadd_collaborator- validates username existsadd_organization_member- validates org and username existadd_team_member- validates team and username existadd_issue_labels- validates all label IDs existreplace_issue_labels- validates all label IDs existImproved Error Handling
Replaced generic error handler with
formatGogsError()that provides:Build Status
✅ TypeScript compilation successful
Ready for testing and deployment!
Changes Committed and Pushed 🚀
Commit:
8ea9776All changes have been committed and pushed to the main branch.
Summary
This enhancement significantly improves the developer experience by:
Example Improvements
Before:
After:
or
The validation module is also extensible for future enhancements!