Skip to content

Conversation

dak2
Copy link
Contributor

@dak2 dak2 commented Oct 11, 2025

Motivation and Context

This commit adds two new methods to MCP::Client:

  • prompts: Lists available prompts from the server via prompts/list
  • get_prompt: Retrieves a specific prompt by name via prompts/get

Both methods follow the same pattern as the existing resources support, including comprehensive test coverage and README documentation updates.

ref. https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/docs/specification/2025-03-26/server/prompts.mdx#protocol-messages

How Has This Been Tested?

Check existing and added test cases for this case.
https://github.com/modelcontextprotocol/ruby-sdk/pull/163/files#diff-7daf60c70888017747b710518764087efc6171bb2f5419506cf21a8ac7ef4a5a

Breaking Changes

None

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

@dak2 dak2 force-pushed the add-client-prompts-support branch 2 times, most recently from 6eede35 to 67225d7 Compare October 13, 2025 02:18
params: { name: name },
})

response.dig("result") || {}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems there's no test for the default value. Also, fetch might be more suitable in this kind of case.

Suggested change
response.dig("result") || {}
response.fetch("result", {})

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit adds two new methods to `MCP::Client`:
- prompts: Lists available prompts from the server via `prompts/list`
- get_prompt: Retrieves a specific prompt by name via `prompts/get`

Both methods follow the same pattern as the existing resources support,
including comprehensive test coverage and README documentation updates.

ref. https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/docs/specification/2025-03-26/server/prompts.mdx#protocol-messages
@dak2 dak2 force-pushed the add-client-prompts-support branch from 67225d7 to e88deb6 Compare October 15, 2025 04:16
@koic koic merged commit ad87c8d into modelcontextprotocol:main Oct 18, 2025
5 checks passed
@dak2 dak2 deleted the add-client-prompts-support branch October 19, 2025 00:58
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.

2 participants