-
Notifications
You must be signed in to change notification settings - Fork 35
Closed
Labels
Description
Objective
Improve MCP server error messages to include actionable guidance that helps agents self-correct when they make parameter validation errors.
Context
When agents call MCP tools with missing parameters, they receive generic errors like "missing or empty 'item_number'" without guidance on how to fix it. Enhanced errors should teach agents the correct usage.
Approach
- Locate the MCP server error handling code (likely in
actions/setup/js/orpkg/workflow/js/) - Identify where parameter validation errors are generated
- Enhance error responses to include:
- Parameter name and what it represents
- Expected format/type
- Example of a correct tool call
- Ensure error format is consistent across all MCP tools
Files to Modify
Search for:
- MCP server implementation files containing error handling
- Look for files with "MCP error -32602" or parameter validation logic
- Likely in
actions/setup/js/*.cjs(source) orpkg/workflow/js/*.cjs(generated)
Example Enhancement
Current error:
MCP error -32602: Invalid arguments: missing or empty 'item_number'
Enhanced error:
MCP error -32602: Invalid arguments: missing or empty 'item_number'
Required parameter 'item_number' is missing. Please provide the numeric ID of the issue, PR, or discussion to comment on.
Example:
{
"item_number": 123,
"body": "Your comment text"
}
Acceptance Criteria
- All MCP validation errors include parameter description
- Errors include example of correct usage
- Error format is consistent across all safe output MCP tools
- JavaScript changes pass
make lint-cjsvalidation - Changes are synced to
pkg/workflow/js/viamake build
Testing
After making changes:
make build # Sync JS changes and rebuild binary
make lint-cjs # Validate JavaScript code
make recompile # Recompile workflows
# Test with a workflow that intentionally has validation errorsRelated to #7950
AI generated by Plan Command for discussion #7934
Copilot