Expose server tool annotations on MCP::Client::Tool#445
Open
rickreyhsig-wealthbox wants to merge 1 commit into
Open
Expose server tool annotations on MCP::Client::Tool#445rickreyhsig-wealthbox wants to merge 1 commit into
rickreyhsig-wealthbox wants to merge 1 commit into
Conversation
Client#tools/#list_tools built Tool objects without an annotations field even though the server includes annotations in every tools/list response. Add the reader and pass the raw hash through, mirroring how output_schema is already handled.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #446
Summary
Client#tools/Client#list_toolssilently drop the server'sannotationsfield when building
MCP::Client::Toolobjects, even though the server sendsit in every
tools/listresponse (Tool#as_jsonincludesannotations: annotations_value&.to_h). Callers have no way to read a tool'sreadOnlyHint/destructiveHint/title/ etc. from the client side today— they have to bypass the public API and re-page
tools/listvia the private#requestmethod just to get at the raw definition.Change
MCP::Client::Toolgains anannotationsreader, populated the same way asthe existing
output_schema(optional kwarg, raw hash passed through asreceived on the wire — no reshaping into
MCP::Tool::Annotations, sincethat class's constructor expects snake_case keys and the wire format is
camelCase).
Client#list_toolspassesannotations: tool["annotations"]through whenconstructing each
Tool.Test plan
test/mcp/client/tool_test.rbandtest/mcp/client_test.rbcovering: annotations present, annotations absent(nil), and the full-parameters constructor case.
bundle exec rake test— 1270 runs, 0 failures.bundle exec rubocop— no offenses on changed files.