Skip to content

fix: forward metadata when defining a server prompt - #755

Open
yorzi wants to merge 1 commit into
modelcontextprotocol:mainfrom
yorzi:fix/server-define-prompt-metadata
Open

yorzi wants to merge 1 commit into
modelcontextprotocol:mainfrom
yorzi:fix/server-define-prompt-metadata

Conversation

@yorzi

@yorzi yorzi commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Motivation and Context

The Prompts docs page passes meta: to Server#define_prompt, which did not accept it. define_prompt now takes meta: and passes it to Prompt.define, which already serializes it as _meta, as define_tool and define_resource do.

Fixes #748

How Has This Been Tested?

  • test/mcp/server_test.rb: a prompt defined with meta: is listed with _meta, and one defined without it has no _meta.
  • The test fails on main with ArgumentError: unknown keyword: :meta.
  • With this change the script in the issue lists the prompt with its _meta.

bundle exec rake passes on Ruby 4.0.10 (RuboCop, 2858 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.

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

Forward the optional meta: keyword to the existing prompt builder so
normal descriptor serialization supplies _meta.

Fixes modelcontextprotocol#748.

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.

Server#define_prompt rejects the documented meta: keyword

1 participant