ask-mcp 0.4.4 → 0.4.6
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 +11 -0
- data/lib/ask/mcp/adapters/tool_server.rb +46 -3
- data/lib/ask/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: 8719aff67887e47eec36f7e8b8b7c822261cbf6e1120380580747691c4d2ef2b
|
|
4
|
+
data.tar.gz: a5c2006a33be93158838aa8fc0f0ae69c8f3a1ec2aa07fd1478cf88c50f2aa62
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d5a909234ffdc34be3ee993118ae8145b971f120516e7eef66be8c1bf95b5a9b18e767a366e0abca51f5fd1d573186e60496404afeebcc2d66cc3d371a907a74
|
|
7
|
+
data.tar.gz: 8c058d280dd5da3aac82fcebe7aacddb3a7c5e8861375e987835294d99cfd6f4f79e12589f47b53773397267fbf7992a44f9548321b65cc6d6a108175fe800af
|
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
|
|
@@ -47,6 +47,9 @@ module Ask
|
|
|
47
47
|
end
|
|
48
48
|
|
|
49
49
|
normalized = deep_stringify_keys(arguments)
|
|
50
|
+
violation = schema_violation(tool, normalized)
|
|
51
|
+
return error_result(violation) if violation
|
|
52
|
+
|
|
50
53
|
result = tool.call(normalized)
|
|
51
54
|
wrap_result(result)
|
|
52
55
|
rescue StandardError => e
|
|
@@ -58,10 +61,34 @@ module Ask
|
|
|
58
61
|
|
|
59
62
|
private
|
|
60
63
|
|
|
64
|
+
# Rejects arguments that don't match the tool's declared schema with
|
|
65
|
+
# a clear message — an unknown or missing parameter surfaces as such
|
|
66
|
+
# instead of leaking a raw ArgumentError from deep inside the tool.
|
|
67
|
+
# A tool that declares no schema (or no properties) accepts anything,
|
|
68
|
+
# preserving the duck-typed behavior for minimal tools.
|
|
69
|
+
def schema_violation(tool, args)
|
|
70
|
+
schema = tool.params_schema
|
|
71
|
+
return nil if schema.nil? || schema.empty?
|
|
72
|
+
|
|
73
|
+
properties = schema["properties"] || schema[:properties] || {}
|
|
74
|
+
allowed = properties.keys.map(&:to_s)
|
|
75
|
+
return nil if allowed.empty?
|
|
76
|
+
|
|
77
|
+
required = Array(schema["required"] || schema[:required]).map(&:to_s)
|
|
78
|
+
|
|
79
|
+
missing = required - args.keys
|
|
80
|
+
return "Missing required parameter(s) for #{tool.name}: #{missing.join(", ")}" if missing.any?
|
|
81
|
+
|
|
82
|
+
extra = args.keys - allowed
|
|
83
|
+
return "Unknown parameter(s) #{extra.join(", ")} for #{tool.name}. Expected: #{allowed.join(", ")}" if extra.any?
|
|
84
|
+
|
|
85
|
+
nil
|
|
86
|
+
end
|
|
87
|
+
|
|
61
88
|
def wrap_result(result)
|
|
62
89
|
# Plain strings are always a success
|
|
63
90
|
if result.is_a?(String)
|
|
64
|
-
return
|
|
91
|
+
return text_result(result)
|
|
65
92
|
end
|
|
66
93
|
|
|
67
94
|
# Result-like objects (Ask::Result, OpenStruct, etc.)
|
|
@@ -79,7 +106,7 @@ module Ask
|
|
|
79
106
|
else
|
|
80
107
|
result.to_s
|
|
81
108
|
end
|
|
82
|
-
|
|
109
|
+
text_result(text)
|
|
83
110
|
end
|
|
84
111
|
|
|
85
112
|
def success_result(result, _ok)
|
|
@@ -89,13 +116,29 @@ module Ask
|
|
|
89
116
|
else
|
|
90
117
|
output.to_s
|
|
91
118
|
end
|
|
92
|
-
|
|
119
|
+
text_result(text)
|
|
93
120
|
end
|
|
94
121
|
|
|
95
122
|
def error_result(message)
|
|
96
123
|
{ content: [{ type: "text", text: "Error: #{message}" }], isError: true }
|
|
97
124
|
end
|
|
98
125
|
|
|
126
|
+
# Builds a success result. Mirrors JSON text into `structuredContent`
|
|
127
|
+
# (MCP 2025-06-18) when it parses, so clients can render a structured
|
|
128
|
+
# view instead of an empty section.
|
|
129
|
+
def text_result(text)
|
|
130
|
+
{ content: [{ type: "text", text: text }], isError: false }.merge(structured_content_for(text))
|
|
131
|
+
end
|
|
132
|
+
|
|
133
|
+
def structured_content_for(text)
|
|
134
|
+
parsed = JSON.parse(text)
|
|
135
|
+
return {} unless parsed.is_a?(Hash) || parsed.is_a?(Array)
|
|
136
|
+
|
|
137
|
+
{ structuredContent: parsed }
|
|
138
|
+
rescue JSON::ParserError
|
|
139
|
+
{}
|
|
140
|
+
end
|
|
141
|
+
|
|
99
142
|
def deep_stringify_keys(obj)
|
|
100
143
|
case obj
|
|
101
144
|
when Hash then obj.each_with_object({}) { |(k, v), h| h[k.to_s] = deep_stringify_keys(v) }
|
data/lib/ask/mcp/version.rb
CHANGED
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
|
+
version: 0.4.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kaka Ruto
|
|
@@ -149,7 +149,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
149
149
|
- !ruby/object:Gem::Version
|
|
150
150
|
version: '0'
|
|
151
151
|
requirements: []
|
|
152
|
-
rubygems_version: 4.0.
|
|
152
|
+
rubygems_version: 4.0.18
|
|
153
153
|
specification_version: 4
|
|
154
154
|
summary: Model Context Protocol (MCP) client and server for Ruby
|
|
155
155
|
test_files: []
|