mcp 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/mcp/client.rb +11 -3
- data/lib/mcp/server/transports/streamable_http_transport.rb +2 -0
- data/lib/mcp/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ea7153eeac471b5934dcca889a340ae7f484c71ddbf7a3d2f0fde8471857c91f
|
|
4
|
+
data.tar.gz: d2a84adc151f14fac5cb610daf215dac48e92f91bc83aae3ba403160b3fff44f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 48340be2274f11fb80abfa55fc9cb63f921db503eaa1b6d262c6b90c36a751dd38cb84e6c38ddc7b05a22d1d3f75ddde8da3ddceafcce0a94986baaae8db019d
|
|
7
|
+
data.tar.gz: 6459cc62430d03d2c137315a37cfe18d415c1bb66da15909e9ee96df82e5b13665b89f3acb409ded744346fba1ba1c69551945db45b261eddfb2597583d61d55
|
data/lib/mcp/client.rb
CHANGED
|
@@ -92,12 +92,17 @@ module MCP
|
|
|
92
92
|
|
|
93
93
|
# Calls a tool via the transport layer and returns the full response from the server.
|
|
94
94
|
#
|
|
95
|
+
# @param name [String] The name of the tool to call.
|
|
95
96
|
# @param tool [MCP::Client::Tool] The tool to be called.
|
|
96
97
|
# @param arguments [Object, nil] The arguments to pass to the tool.
|
|
97
98
|
# @param progress_token [String, Integer, nil] A token to request progress notifications from the server during tool execution.
|
|
98
99
|
# @return [Hash] The full JSON-RPC response from the transport.
|
|
99
100
|
#
|
|
100
|
-
# @example
|
|
101
|
+
# @example Call by name
|
|
102
|
+
# response = client.call_tool(name: "my_tool", arguments: { foo: "bar" })
|
|
103
|
+
# content = response.dig("result", "content")
|
|
104
|
+
#
|
|
105
|
+
# @example Call with a tool object
|
|
101
106
|
# tool = client.tools.first
|
|
102
107
|
# response = client.call_tool(tool: tool, arguments: { foo: "bar" })
|
|
103
108
|
# structured_content = response.dig("result", "structuredContent")
|
|
@@ -105,8 +110,11 @@ module MCP
|
|
|
105
110
|
# @note
|
|
106
111
|
# The exact requirements for `arguments` are determined by the transport layer in use.
|
|
107
112
|
# Consult the documentation for your transport (e.g., MCP::Client::HTTP) for details.
|
|
108
|
-
def call_tool(tool
|
|
109
|
-
|
|
113
|
+
def call_tool(name: nil, tool: nil, arguments: nil, progress_token: nil)
|
|
114
|
+
tool_name = name || tool&.name
|
|
115
|
+
raise ArgumentError, "Either `name:` or `tool:` must be provided." unless tool_name
|
|
116
|
+
|
|
117
|
+
params = { name: tool_name, arguments: arguments }
|
|
110
118
|
if progress_token
|
|
111
119
|
params[:_meta] = { progressToken: progress_token }
|
|
112
120
|
end
|
|
@@ -155,8 +155,10 @@ module MCP
|
|
|
155
155
|
end
|
|
156
156
|
|
|
157
157
|
return missing_session_id_response unless (session_id = request.env["HTTP_MCP_SESSION_ID"])
|
|
158
|
+
return session_not_found_response unless session_exists?(session_id)
|
|
158
159
|
|
|
159
160
|
cleanup_session(session_id)
|
|
161
|
+
|
|
160
162
|
success_response
|
|
161
163
|
end
|
|
162
164
|
|
data/lib/mcp/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: mcp
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.9.
|
|
4
|
+
version: 0.9.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Model Context Protocol
|
|
@@ -75,7 +75,7 @@ licenses:
|
|
|
75
75
|
- Apache-2.0
|
|
76
76
|
metadata:
|
|
77
77
|
allowed_push_host: https://rubygems.org
|
|
78
|
-
changelog_uri: https://github.com/modelcontextprotocol/ruby-sdk/releases/tag/v0.9.
|
|
78
|
+
changelog_uri: https://github.com/modelcontextprotocol/ruby-sdk/releases/tag/v0.9.1
|
|
79
79
|
homepage_uri: https://github.com/modelcontextprotocol/ruby-sdk
|
|
80
80
|
source_code_uri: https://github.com/modelcontextprotocol/ruby-sdk
|
|
81
81
|
bug_tracker_uri: https://github.com/modelcontextprotocol/ruby-sdk/issues
|