Add support for the optional websiteUrl parameter in serverInfo
This PR adds support for the optional `websiteUrl` parameter in `serverInfo`. This parameter has been supported since the 2025-11-25 MCP specification. This PR also implements part of https://github.com/modelcontextprotocol/ruby-sdk/issues/127.
This commit is contained in:
parent
171baa876e
commit
62615d65e4
1 changed files with 33 additions and 5 deletions
|
|
@ -31,13 +31,14 @@ module MCP
|
|||
|
||||
include Instrumentation
|
||||
|
||||
attr_accessor :description, :name, :title, :version, :instructions, :tools, :prompts, :resources, :server_context, :configuration, :capabilities, :transport
|
||||
attr_accessor :description, :name, :title, :version, :website_url, :instructions, :tools, :prompts, :resources, :server_context, :configuration, :capabilities, :transport
|
||||
|
||||
def initialize(
|
||||
description: nil,
|
||||
name: "model_context_protocol",
|
||||
title: nil,
|
||||
version: DEFAULT_VERSION,
|
||||
website_url: nil,
|
||||
instructions: nil,
|
||||
tools: [],
|
||||
prompts: [],
|
||||
|
|
@ -52,6 +53,7 @@ module MCP
|
|||
@name = name
|
||||
@title = title
|
||||
@version = version
|
||||
@website_url = website_url
|
||||
@instructions = instructions
|
||||
@tools = tools.to_h { |t| [t.name_value, t] }
|
||||
@prompts = prompts.to_h { |p| [p.name_value, p] }
|
||||
|
|
@ -185,8 +187,8 @@ module MCP
|
|||
end
|
||||
|
||||
if @configuration.protocol_version <= "2025-03-26"
|
||||
if server_info.key?(:title)
|
||||
message = "Error occurred in server_info. `title` is not supported in protocol version 2025-03-26 or earlier"
|
||||
if server_info.key?(:title) || server_info.key?(:websiteUrl)
|
||||
message = "Error occurred in server_info. `title` or `website_url` are not supported in protocol version 2025-03-26 or earlier"
|
||||
raise ArgumentError, message
|
||||
end
|
||||
|
||||
|
|
@ -268,6 +270,7 @@ module MCP
|
|||
name:,
|
||||
title:,
|
||||
version:,
|
||||
websiteUrl: website_url,
|
||||
}.compact
|
||||
end
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue