Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 28, 2025

  • Explore repository structure and locate MCP server error handling code
  • Identify error generation locations (mcp_server_core.cjs, safe_inputs_mcp_server_http.cjs)
  • Review tool definitions in safe_outputs_tools.json
  • Create enhanced error helper function with actionable guidance
  • Integrate enhanced errors into mcp_server_core.cjs (2 locations)
  • Integrate enhanced errors into safe_inputs_mcp_server_http.cjs (1 location)
  • Add tests for enhanced error messages
  • Run make build to sync JS changes
  • Run make lint-cjs to validate JavaScript
  • Run make recompile to recompile workflows
  • Verify error messages work correctly with integration test
  • Add demonstration script showing enhanced error format
  • Run Go linting (make golint) - fixed formatting issue
Original prompt

This section details on the original issue you should resolve

<issue_title>[plan] Implement enhanced MCP error messages with actionable guidance</issue_title>
<issue_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

  1. Locate the MCP server error handling code (likely in actions/setup/js/ or pkg/workflow/js/)
  2. Identify where parameter validation errors are generated
  3. Enhance error responses to include:
    • Parameter name and what it represents
    • Expected format/type
    • Example of a correct tool call
  4. 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) or pkg/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-cjs validation
  • Changes are synced to pkg/workflow/js/ via make 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 errors

Related to #7950

AI generated by Plan Command for discussion #7934

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Dec 28, 2025
Copilot AI and others added 2 commits December 28, 2025 07:12
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
Copilot AI changed the title [WIP] Implement enhanced MCP error messages with actionable guidance Enhance MCP error messages with actionable guidance for parameter validation failures Dec 28, 2025
Copilot AI requested a review from mnkiefer December 28, 2025 07:19
@pelikhan pelikhan marked this pull request as ready for review December 28, 2025 15:58
@pelikhan
Copy link
Contributor

@copilot format and lint

Copy link
Contributor Author

Copilot AI commented Dec 28, 2025

@copilot format and lint

All JavaScript files are already properly formatted and pass linting checks (make lint-cjs passes). No changes needed - the code was formatted with Prettier during the initial implementation in commits 747275e and 476f820.

@pelikhan
Copy link
Contributor

@copilot lint go

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 28, 2025

@copilot lint go

Go linting now passes (make golint returns 0 issues). Fixed formatting issue in pkg/workflow/permissions_shortcut_included_test.go in commit 7e4e3c5.

@pelikhan pelikhan merged commit 13d5c6d into main Dec 28, 2025
57 of 58 checks passed
@pelikhan pelikhan deleted the copilot/enhance-mcp-error-messages branch December 28, 2025 16:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[plan] Implement enhanced MCP error messages with actionable guidance

3 participants