Skip to content

Commit 742cc35

Browse files
committed
Monkey patch json schema until new release
1 parent 17e85ce commit 742cc35

File tree

4 files changed

+16
-8
lines changed

4 files changed

+16
-8
lines changed

lib/tidewave/tools/execute_sql_query.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,13 @@ class Tidewave::Tools::ExecuteSqlQuery < Tidewave::Tools::Base
1919

2020
arguments do
2121
required(:query).filled(:string).description("The SQL query to execute. For PostgreSQL, use $1, $2 placeholders. For MySQL, use ? placeholders.")
22-
optional(:arguments).array(:str?, :bool?, :int?, :float?, :nil?, :hash?, :array?).description("The arguments to pass to the query. The query must contain corresponding parameter placeholders.")
22+
optional(:arguments).value(:array).description("The arguments to pass to the query. The query must contain corresponding parameter placeholders.")
23+
end
24+
25+
def @input_schema.json_schema
26+
schema = super
27+
schema[:properties][:arguments][:items] = {}
28+
schema
2329
end
2430

2531
RESULT_LIMIT = 50

lib/tidewave/tools/project_eval.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,17 @@ class Tidewave::Tools::ProjectEval < Tidewave::Tools::Base
1818

1919
arguments do
2020
required(:code).filled(:string).description("The Ruby code to evaluate")
21-
optional(:arguments).array(:str?, :bool?, :int?, :float?, :nil?, :hash?, :array?).description("The arguments to pass to evaluation. They are available inside the evaluated code as `arguments`.")
21+
optional(:arguments).value(:array).description("The arguments to pass to evaluation. They are available inside the evaluated code as `arguments`.")
2222
optional(:timeout).filled(:integer).description("The timeout in milliseconds. If the evaluation takes longer than this, it will be terminated. Defaults to 30000 (30 seconds).")
2323
optional(:json).hidden().filled(:bool).description("Whether to return the result as JSON with structured output containing result, success, stdout, and stderr fields. Defaults to false.")
2424
end
2525

26+
def @input_schema.json_schema
27+
schema = super
28+
schema[:properties][:arguments][:items] = {}
29+
schema
30+
end
31+
2632
def call(code:, arguments: [], timeout: 30_000, json: false)
2733
original_stdout = $stdout
2834
original_stderr = $stderr

spec/tools/execute_sql_query_spec.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,7 @@
4141
},
4242
arguments: {
4343
type: "array",
44-
items: {
45-
type: [ "string", "boolean", "integer", "number", "null", "object", "array" ]
46-
},
44+
items: {},
4745
description: "The arguments to pass to the query. The query must contain corresponding parameter placeholders."
4846
}
4947
},

spec/tools/project_eval_spec.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,7 @@
1414
properties: {
1515
arguments: {
1616
description: "The arguments to pass to evaluation. They are available inside the evaluated code as `arguments`.",
17-
items: {
18-
type: [ "string", "boolean", "integer", "number", "null", "object", "array" ]
19-
},
17+
items: {},
2018
type: "array"
2119
},
2220
code: {

0 commit comments

Comments
 (0)