Skip to content

Conversation

jlhood
Copy link
Contributor

@jlhood jlhood commented Sep 21, 2025

Issue #, if available: #2789

Description of changes:

This PR improves the MCP prompts feature, focusing on better user experience and discoverability:

New Features

  • Details command: Added /prompts details to show comprehensive prompt information including metadata and argument details
  • Enhanced list view: Improved /prompts list with three-column layout showing descriptions and better formatting
  • Content preview: Display fetched prompt content before AI processing to eliminate user confusion

Improvements

  • Better error handling: Replace raw JSON MCP server errors with user-friendly, actionable messages
  • Usage guidance: Generate helpful usage examples from PromptBundle data for invalid parameter errors
  • Visual formatting: Consistent terminal styling and proper content display for all prompt message types

Here are screenshots to see key differences before and after these changes:

/prompts list before fix:
Screenshot 2025-09-21 at 16 05 40

/prompts list after fix:
Screenshot 2025-09-21 at 16 05 49

New /prompts details command:
Screenshot 2025-09-21 at 16 07 23

Invoking a prompt now displays the prompt before sending to the model:
Screenshot 2025-09-21 at 16 28 46

Better error messaging (no longer just raw MCP server responses):

Before fix:
Screenshot 2025-09-21 at 16 31 25

After fix:
Screenshot 2025-09-21 at 16 31 34

🤖 Assisted by Amazon Q Developer

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

- Add description display in three-column layout (Prompt | Description | Arguments)
- Implement description truncation at 40 characters with ellipsis
- Handle missing descriptions with '(no description)' placeholder
- Support multi-line descriptions by showing first line only
- Fix existing bug in longest_name calculation for proper alignment
- Add comprehensive tests for description formatting functions

🤖 Assisted by Amazon Q Developer
Add new Details subcommand to show comprehensive prompt information
including full metadata and argument details. This addresses the
discoverability issue where users couldn't easily understand prompt
capabilities and requirements.

- Add Details variant to PromptsSubcommand enum
- Implement prompt resolution with server/prompt disambiguation
- Add detailed formatting for prompt metadata and arguments
- Include usage examples in details display
- Maintain consistent error handling with existing patterns
- Add comprehensive unit tests for new functionality

🤖 Assisted by Amazon Q Developer
Replace raw JSON MCP server errors with helpful, actionable error messages:
- Handle -32602 (Invalid params) with usage hints and argument descriptions
- Handle -32603 (Internal error) with user-friendly retry message
- Parse MCP error JSON to identify specific subcases
- Generate usage examples from PromptBundle data
- Preserve existing good error handling for PromptNotFound and AmbiguousPrompt

Addresses GitHub issue aws#2789 UX improvement for MCP prompt error handling.

🤖 Assisted by Amazon Q Developer
Display retrieved MCP prompt content immediately after fetching from server
to eliminate user confusion about what happens during 'Thinking' phase.
Users now see exactly what prompt was retrieved before AI processing begins.

- Add display_prompt_content helper function with proper terminal formatting
- Handle all PromptMessageContent variants (Text, Image, Resource, ResourceLink)
- Preserve existing error handling and AI processing flow
- Use consistent crossterm styling with existing prompt commands

🤖 Assisted by Amazon Q Developer
@mr-lee mr-lee requested review from brandonskiser, dingfeli and mr-lee and removed request for brandonskiser September 22, 2025 16:56
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.

1 participant