mcp-rb 0.3.2 → 0.3.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c5b2677ddf71a4e2597cae1bb3f5806308e33beb5c5a28032741788a1c0b7b6
4
- data.tar.gz: 63c873245f9af796df2b60072167bac6a4810f6233a3f872e9295e52e1d42b38
3
+ metadata.gz: 89a4d1cb8ae8957cb8a1d3a867e93218215dc4224eb2e03ab81baf81c0a1c6ba
4
+ data.tar.gz: 5f16964ddf22038d610967d3ae8781fcf7a7f91b17d0b7b749a5c1d38251a967
5
5
  SHA512:
6
- metadata.gz: 9672f55327ee861ba8777447b5b04724d4ffac344a268245a8dc53f9aa5715a048af67f226d8856e2066b28268aff98e7ed5b82fcb8dd59a97710f6f4e4e3ae6
7
- data.tar.gz: 2d82cf39dd04173518e7b2365513d07536661dbc80a0db72a38b759401808651ff186f2bb0910c24ac73ecbc613a709db66c4c89c7d9422d71d93b7fd0478665
6
+ metadata.gz: 9f743d921b897ae532ee48343ab3b318c0688e740a90b7b8a2e23fda1a3996669b5385ab49f59027c1c9d5333d57c65c54baa577c71970d6e5fa32e7ca209c75
7
+ data.tar.gz: 441afb473c07c345647a036ae778dd7e36dad5cab6ad3bbad010a97d1ecc863d28bca0b4f5c6898cc86750566f8e0aabe99c93409f3f93c43d68b194c3aea973
data/CHANGELOG.md CHANGED
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.3.3] - 2025-03-12
9
+
10
+ ### Fixed
11
+ - Fix error response style: https://github.com/funwarioisii/mcp-rb/pull/12
12
+ - Follow the return style of `handle_*` methods
13
+ - Omit `nextCursor` key when no additional pages exist: https://github.com/funwarioisii/mcp-rb/pull/13
14
+
8
15
  ## [0.3.2] - 2025-03-07
9
16
 
10
17
  ### Added
@@ -79,7 +79,7 @@ module MCP
79
79
  {
80
80
  resources: paginated.map { |r| format_resource(r) },
81
81
  nextCursor: next_cursor
82
- }
82
+ }.compact
83
83
  end
84
84
 
85
85
  def read_resource(uri)
@@ -124,7 +124,7 @@ module MCP
124
124
  {
125
125
  resourceTemplates: paginated.map { |t| format_resource_template(t) },
126
126
  nextCursor: next_cursor
127
- }
127
+ }.compact
128
128
  end
129
129
 
130
130
  private
data/lib/mcp/app/tool.rb CHANGED
@@ -112,8 +112,9 @@ module MCP
112
112
  def list_tools(cursor: nil, page_size: 10)
113
113
  start = cursor ? cursor.to_i : 0
114
114
  paginated = tools.values[start, page_size]
115
+
115
116
  next_cursor = (start + page_size < tools.length) ? (start + page_size).to_s : nil
116
- {tools: paginated.map { |t| {name: t[:name], description: t[:description], inputSchema: t[:input_schema]} }, nextCursor: next_cursor}
117
+ {tools: paginated.map { |t| {name: t[:name], description: t[:description], inputSchema: t[:input_schema]} }, nextCursor: next_cursor}.compact
117
118
  end
118
119
 
119
120
  # Calls a tool with the provided arguments
data/lib/mcp/server.rb CHANGED
@@ -169,7 +169,11 @@ module MCP
169
169
  arguments = request.dig(:params, :arguments)
170
170
  begin
171
171
  result = @app.call_tool(name, **arguments.transform_keys(&:to_sym))
172
- success_response(request[:id], result)
172
+ if result[:isError]
173
+ error_response(request[:id], Constants::ErrorCodes::INVALID_REQUEST, result[:content].first[:text])
174
+ else
175
+ success_response(request[:id], result)
176
+ end
173
177
  rescue ArgumentError => e
174
178
  error_response(request[:id], Constants::ErrorCodes::INVALID_REQUEST, e.message)
175
179
  end
data/lib/mcp/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MCP
4
- VERSION = "0.3.2"
4
+ VERSION = "0.3.3"
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mcp-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - funwarioisii
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2025-03-08 00:00:00.000000000 Z
10
+ date: 2025-03-12 00:00:00.000000000 Z
12
11
  dependencies: []
13
12
  description: MCP-RB is a Ruby framework that provides a Sinatra-like DSL for implementing
14
13
  Model Context Protocol servers.
@@ -38,7 +37,6 @@ metadata:
38
37
  homepage_uri: https://github.com/funwarioisii/mcp-rb
39
38
  source_code_uri: https://github.com/funwarioisii/mcp-rb
40
39
  changelog_uri: https://github.com/funwarioisii/mcp-rb/blob/main/CHANGELOG.md
41
- post_install_message:
42
40
  rdoc_options: []
43
41
  require_paths:
44
42
  - lib
@@ -46,15 +44,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
46
44
  requirements:
47
45
  - - ">="
48
46
  - !ruby/object:Gem::Version
49
- version: 3.0.0
47
+ version: 3.3.0
50
48
  required_rubygems_version: !ruby/object:Gem::Requirement
51
49
  requirements:
52
50
  - - ">="
53
51
  - !ruby/object:Gem::Version
54
52
  version: '0'
55
53
  requirements: []
56
- rubygems_version: 3.4.1
57
- signing_key:
54
+ rubygems_version: 3.6.2
58
55
  specification_version: 4
59
56
  summary: A lightweight Ruby framework for implementing MCP (Model Context Protocol)
60
57
  servers