ask-mcp 0.4.4 → 0.4.5

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: 4cccd828fe9bafe8d0873dab258aeef03824f1cce4c425869e9cd777924b7ff7
4
- data.tar.gz: d30dbfb82b6e75cc953985f7a8035c71b3b1e31681c42fd1e14133ed19208068
3
+ metadata.gz: 5d5c902336445279874512b3b83fea5c1f19b0de0640ceefe6d0bc61c6dd6f4e
4
+ data.tar.gz: a4b94e8307ef2d7b8aa2b2a6fee63a14dd45584f910f6db1c1db4b0826728699
5
5
  SHA512:
6
- metadata.gz: aa666b423416bf1c5b28181ac7fa535165e23fb1d4f9190dfb02f3395b8788c123a5d4c611784f3df59829d118c6b866fa50bf1bd3dfdbddfe43846d0bcedfd1
7
- data.tar.gz: 407317ef9ab950450398c062cacba0c8c8ee05b1e37c7f81897aac6921937ec1bbb6f69ae331631410615f743989bf1b430175b4329f4071837dfa2e382eca85
6
+ metadata.gz: ef659cb4cedd858c26a7cb8acb5a5cbef3f7dc4d4ec8bd88967cfbcb0437e94d333eb34d7336147298b172ea04fd1715bcae7e2de2ba5133e0b3b81a3d3cd1bf
7
+ data.tar.gz: 2bf513b38edd2eb62c72ad385908c7483972d11a802f22c5f6b7f8389110d55f2650c5c7ac6ba4a733a135a5de3424b35f2437455d43f466667dfe22c1a3c88d
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## [0.4.5] - 2026-08-12
2
+
3
+ ### Added
4
+
5
+ - **`structuredContent` mirroring in ToolServer results** — success results
6
+ now include a machine-readable `structuredContent` field (MCP 2025-06-18)
7
+ populated from the JSON text when it parses to an object or array. MCP
8
+ clients that render structured views (e.g. ZCode's "Structured content"
9
+ section) now display the parsed result instead of an empty block. Plain
10
+ text and `:summary` shorthand outputs are unaffected.
11
+
1
12
  ## [0.4.4] - 2026-08-10
2
13
 
3
14
  ### Fixed
@@ -61,7 +61,7 @@ module Ask
61
61
  def wrap_result(result)
62
62
  # Plain strings are always a success
63
63
  if result.is_a?(String)
64
- return { content: [{ type: "text", text: result }], isError: false }
64
+ return text_result(result)
65
65
  end
66
66
 
67
67
  # Result-like objects (Ask::Result, OpenStruct, etc.)
@@ -79,7 +79,7 @@ module Ask
79
79
  else
80
80
  result.to_s
81
81
  end
82
- { content: [{ type: "text", text: text }], isError: false }
82
+ text_result(text)
83
83
  end
84
84
 
85
85
  def success_result(result, _ok)
@@ -89,13 +89,29 @@ module Ask
89
89
  else
90
90
  output.to_s
91
91
  end
92
- { content: [{ type: "text", text: text }], isError: false }
92
+ text_result(text)
93
93
  end
94
94
 
95
95
  def error_result(message)
96
96
  { content: [{ type: "text", text: "Error: #{message}" }], isError: true }
97
97
  end
98
98
 
99
+ # Builds a success result. Mirrors JSON text into `structuredContent`
100
+ # (MCP 2025-06-18) when it parses, so clients can render a structured
101
+ # view instead of an empty section.
102
+ def text_result(text)
103
+ { content: [{ type: "text", text: text }], isError: false }.merge(structured_content_for(text))
104
+ end
105
+
106
+ def structured_content_for(text)
107
+ parsed = JSON.parse(text)
108
+ return {} unless parsed.is_a?(Hash) || parsed.is_a?(Array)
109
+
110
+ { structuredContent: parsed }
111
+ rescue JSON::ParserError
112
+ {}
113
+ end
114
+
99
115
  def deep_stringify_keys(obj)
100
116
  case obj
101
117
  when Hash then obj.each_with_object({}) { |(k, v), h| h[k.to_s] = deep_stringify_keys(v) }
@@ -1,5 +1,5 @@
1
1
  module Ask
2
2
  module MCP
3
- VERSION = "0.4.4"
3
+ VERSION = "0.4.5"
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.4
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kaka Ruto