Skip to content

fix: forward template arguments in get_prompt - #753

Open
yorzi wants to merge 1 commit into
modelcontextprotocol:mainfrom
yorzi:fix/client-get-prompt-arguments
Open

yorzi wants to merge 1 commit into
modelcontextprotocol:mainfrom
yorzi:fix/client-get-prompt-arguments

Conversation

@yorzi

@yorzi yorzi commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Motivation and Context

Client#get_prompt had no arguments: keyword, so a prompt with a required argument could not be retrieved through it.

It now takes an optional arguments: Hash and sends it as params.arguments. The params go through the existing input_required driver, so a retry carries the same arguments as the first request. A call without arguments: sends the same params as before. The client docs page shows a call with arguments.

Fixes #746

How Has This Been Tested?

  • test/mcp/client_test.rb: the input_required test now passes arguments and checks that both requests carry them, next to the input response and the request state. The name-only test checks that the params hold only name.
  • The new assertions fail on main with ArgumentError: unknown keyword: :arguments.
  • With this change the script in the issue prints "Hello, Ari!", and the call without arguments still gets Invalid Params.

bundle exec rake passes on Ruby 4.0.10 (RuboCop, 2857 runs with 0 failures, and the conformance baseline). yard --no-output passes.

  • Automated unit / integration tests
  • Tested manually
  • Tested in a real application

Breaking Changes

None. Calls without arguments: send the same request as before.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Test update (non-breaking change which adds or updates tests)
  • Refactoring (non-breaking change which makes things better)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • CI/build script update (update CI workflow or build scripts)

Checklist

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

Accept an optional argument map and carry it through the existing retry
driver. Name-only calls keep their original wire shape. The client guide
includes a template example.

Fixes modelcontextprotocol#746.

This branch has not been deployed

No deployments
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.

Client#get_prompt cannot send prompt arguments

1 participant