Skip to content

[plan] Implement enhanced MCP error messages with actionable guidance #7952

@github-actions

Description

@github-actions

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

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions