Expose server tool annotations on MCP::Client::Tool

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 commit is contained in:
rickreyhsig-wealthbox 2026-07-27 09:54:54 -04:00
commit 3591acdfaa
2 changed files with 27 additions and 2 deletions

View file

@ -131,6 +131,7 @@ module MCP
description: tool["description"],
input_schema: tool["inputSchema"],
output_schema: tool["outputSchema"],
annotations: tool["annotations"],
)
end

View file

@ -3,13 +3,14 @@
module MCP
class Client
class Tool
attr_reader :name, :description, :input_schema, :output_schema
attr_reader :name, :description, :input_schema, :output_schema, :annotations
def initialize(name:, description:, input_schema:, output_schema: nil)
def initialize(name:, description:, input_schema:, output_schema: nil, annotations: nil)
@name = name
@description = description
@input_schema = input_schema
@output_schema = output_schema
@annotations = annotations
end
end
end