ask-mcp 0.4.3 → 0.4.4

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: 216830ce0b59a08b19729d557bb9401779636c1dca5330fb0e051a23bbdb9f5c
4
- data.tar.gz: 15d71f1b331f2e4cd6df5b22f44fa99f05b83ec1ae101ebb6f532b978492aa41
3
+ metadata.gz: 4cccd828fe9bafe8d0873dab258aeef03824f1cce4c425869e9cd777924b7ff7
4
+ data.tar.gz: d30dbfb82b6e75cc953985f7a8035c71b3b1e31681c42fd1e14133ed19208068
5
5
  SHA512:
6
- metadata.gz: 3a7911d8b7e26ef924f799caa3e6a22d716245ed8ae3aec3575f9b28da71ee636ff83bd3fcd8af79f9789ecd2c5790a0f0f49f06fa9388dbb5275549b9a075fc
7
- data.tar.gz: e5a56e4364d6c6048199151dfb09e117fcf86cc272d4f9a98958899e36ef603ff1d5e903be9f31cac59f20fa6f89faf8221f9ca951230886b6f23ba275a02c58
6
+ metadata.gz: aa666b423416bf1c5b28181ac7fa535165e23fb1d4f9190dfb02f3395b8788c123a5d4c611784f3df59829d118c6b866fa50bf1bd3dfdbddfe43846d0bcedfd1
7
+ data.tar.gz: 407317ef9ab950450398c062cacba0c8c8ee05b1e37c7f81897aac6921937ec1bbb6f69ae331631410615f743989bf1b430175b4329f4071837dfa2e382eca85
data/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ ## [0.4.4] - 2026-08-10
2
+
3
+ ### Fixed
4
+
5
+ - **Hash tool results are JSON-serialized instead of emitted raw** —
6
+ `ToolServer#wrap_result`/`success_result` used `result[:summary]` as the
7
+ content `text` whenever a Hash result had a `summary` key. When `summary`
8
+ was itself a Hash (e.g. `schema_graph`'s summary), the server emitted a
9
+ non-string content item that spec-compliant MCP clients reject. String
10
+ `summary` values are still honored as a shorthand; any other Hash result is
11
+ `JSON.generate`d so `text` is always a String.
12
+
1
13
  ## [0.4.3] - 2026-08-04
2
14
 
3
15
  ### Added
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "json"
4
+
3
5
  module Ask
4
6
  module MCP
5
7
  module Adapters
@@ -69,14 +71,24 @@ module Ask
69
71
  return error_result(result.respond_to?(:error_message) ? result.error_message : result.to_s)
70
72
  end
71
73
 
72
- # Everything else — treat as success
73
- text = result.is_a?(Hash) ? (result[:summary] || result.to_s) : result.to_s
74
+ # Everything else — treat as success. Hashes are JSON-serialized so
75
+ # the content text is always a String (MCP content items require
76
+ # string `text`). A String `:summary` is honored as a shorthand.
77
+ text = if result.is_a?(Hash)
78
+ result[:summary].is_a?(String) ? result[:summary] : JSON.generate(result)
79
+ else
80
+ result.to_s
81
+ end
74
82
  { content: [{ type: "text", text: text }], isError: false }
75
83
  end
76
84
 
77
85
  def success_result(result, _ok)
78
86
  output = result.respond_to?(:output) ? result.output : result.to_s
79
- text = output.is_a?(Hash) ? (output[:summary] || output.to_s) : output.to_s
87
+ text = if output.is_a?(Hash)
88
+ output[:summary].is_a?(String) ? output[:summary] : JSON.generate(output)
89
+ else
90
+ output.to_s
91
+ end
80
92
  { content: [{ type: "text", text: text }], isError: false }
81
93
  end
82
94
 
@@ -1,5 +1,5 @@
1
1
  module Ask
2
2
  module MCP
3
- VERSION = "0.4.3"
3
+ VERSION = "0.4.4"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ask-mcp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaka Ruto