ask-mcp 0.4.2 → 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 +4 -4
- data/CHANGELOG.md +23 -0
- data/lib/ask/mcp/adapters/tool_server.rb +15 -3
- data/lib/ask/mcp/server/stdio.rb +4 -3
- data/lib/ask/mcp/server.rb +4 -2
- data/lib/ask/mcp/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4cccd828fe9bafe8d0873dab258aeef03824f1cce4c425869e9cd777924b7ff7
|
|
4
|
+
data.tar.gz: d30dbfb82b6e75cc953985f7a8035c71b3b1e31681c42fd1e14133ed19208068
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: aa666b423416bf1c5b28181ac7fa535165e23fb1d4f9190dfb02f3395b8788c123a5d4c611784f3df59829d118c6b866fa50bf1bd3dfdbddfe43846d0bcedfd1
|
|
7
|
+
data.tar.gz: 407317ef9ab950450398c062cacba0c8c8ee05b1e37c7f81897aac6921937ec1bbb6f69ae331631410615f743989bf1b430175b4329f4071837dfa2e382eca85
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,26 @@
|
|
|
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
|
+
|
|
13
|
+
## [0.4.3] - 2026-08-04
|
|
14
|
+
|
|
15
|
+
### Added
|
|
16
|
+
|
|
17
|
+
- **serverInfo version passthrough** — `Ask::MCP::Server.start_stdio` and
|
|
18
|
+
`Ask::MCP::Server::Stdio.new` accept a `version:` option reported in the
|
|
19
|
+
`serverInfo` of both the legacy `initialize` handshake and
|
|
20
|
+
`server/discover`. Defaults to the ask-mcp version when omitted, so
|
|
21
|
+
wrapper servers (ask-web-search-mcp, ask-web-fetch-mcp) can advertise
|
|
22
|
+
their own gem version instead of ask-mcp's.
|
|
23
|
+
|
|
1
24
|
## [0.4.2] - 2026-08-04
|
|
2
25
|
|
|
3
26
|
### 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
|
|
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)
|
|
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
|
|
data/lib/ask/mcp/server/stdio.rb
CHANGED
|
@@ -16,8 +16,9 @@ module Ask
|
|
|
16
16
|
|
|
17
17
|
def initialize(name:, tools: [], capabilities: {}, resources: {}, prompts: {},
|
|
18
18
|
resource_templates: {}, debug: false, tool_timeout: nil,
|
|
19
|
-
cache_ttl_ms: 60_000, cache_scope: "private")
|
|
19
|
+
cache_ttl_ms: 60_000, cache_scope: "private", version: nil)
|
|
20
20
|
@name = name
|
|
21
|
+
@server_version = version || Ask::MCP::VERSION
|
|
21
22
|
@capabilities = capabilities
|
|
22
23
|
@resources = resources
|
|
23
24
|
@prompts = prompts
|
|
@@ -173,7 +174,7 @@ module Ask
|
|
|
173
174
|
send_result(id, {
|
|
174
175
|
protocolVersions: Ask::MCP::SUPPORTED_PROTOCOL_VERSIONS,
|
|
175
176
|
capabilities: @capabilities,
|
|
176
|
-
serverInfo: { name: @name, version:
|
|
177
|
+
serverInfo: { name: @name, version: @server_version }
|
|
177
178
|
})
|
|
178
179
|
debug_log "server/discover answered"
|
|
179
180
|
end
|
|
@@ -188,7 +189,7 @@ module Ask
|
|
|
188
189
|
capabilities: @capabilities,
|
|
189
190
|
serverInfo: {
|
|
190
191
|
name: @name,
|
|
191
|
-
version:
|
|
192
|
+
version: @server_version
|
|
192
193
|
}
|
|
193
194
|
})
|
|
194
195
|
debug_log "Initialize complete"
|
data/lib/ask/mcp/server.rb
CHANGED
|
@@ -41,14 +41,16 @@ module Ask
|
|
|
41
41
|
# Blocking — designed to be the last line of an entry-point script.
|
|
42
42
|
#
|
|
43
43
|
# @param name [String] server name
|
|
44
|
+
# @param version [String, nil] server version reported in serverInfo;
|
|
45
|
+
# defaults to the ask-mcp version when nil
|
|
44
46
|
# @param tools [Array<#call, #name, #description, #params_schema>] tool instances to expose
|
|
45
47
|
# @param capabilities [Hash] MCP capabilities (default: { tools: {} })
|
|
46
48
|
# @param resources [Hash{String => #to_h, #content}] uri → resource objects
|
|
47
49
|
# @param prompts [Hash{String => #to_h, #messages}] name → prompt objects
|
|
48
50
|
# @param debug [Boolean] enable stderr debug logging
|
|
49
|
-
def self.start_stdio(name:, tools: [], capabilities: { tools: {} }, resources: {},
|
|
51
|
+
def self.start_stdio(name:, version: nil, tools: [], capabilities: { tools: {} }, resources: {},
|
|
50
52
|
prompts: {}, resource_templates: {}, debug: false)
|
|
51
|
-
Stdio.new(name: name, tools: tools, capabilities: capabilities,
|
|
53
|
+
Stdio.new(name: name, version: version, tools: tools, capabilities: capabilities,
|
|
52
54
|
resources: resources, prompts: prompts,
|
|
53
55
|
resource_templates: resource_templates, debug: debug).start
|
|
54
56
|
end
|
data/lib/ask/mcp/version.rb
CHANGED