Skip to content

Commit 4617ebb

Browse files
authored
Merge pull request #24 from josh-m-sharpe/description_fix
include description in all complex types
2 parents 56384bb + d6a21f0 commit 4617ebb

File tree

112 files changed

+1180
-2875
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

112 files changed

+1180
-2875
lines changed

lib/ruby_llm/mcp/providers/anthropic/complex_parameter_support.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,24 @@ def build_properties(param)
2323
if param.item_type == :object
2424
{
2525
type: param.type,
26+
description: param.description,
2627
items: { type: param.item_type, properties: clean_parameters(param.properties) }
27-
}
28+
}.compact
2829
else
2930
{
3031
type: param.type,
32+
description: param.description,
3133
default: param.default,
3234
items: { type: param.item_type, enum: param.enum }.compact
3335
}.compact
3436
end
3537
when :object
3638
{
3739
type: param.type,
40+
description: param.description,
3841
properties: clean_parameters(param.properties),
3942
required: required_parameters(param.properties)
40-
}
43+
}.compact
4144
when :union
4245
{
4346
param.union_type => param.properties.map { |property| build_properties(property) }

lib/ruby_llm/mcp/providers/gemini/complex_parameter_support.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,33 @@ def format_parameters(parameters)
1616
}
1717
end
1818

19-
def build_properties(param)
19+
def build_properties(param) # rubocop:disable Metrics/MethodLength
2020
properties = case param.type
2121
when :array
2222
if param.item_type == :object
2323
{
2424
type: param_type_for_gemini(param.type),
25+
description: param.description,
2526
items: {
2627
type: param_type_for_gemini(param.item_type),
2728
properties: param.properties.transform_values { |value| build_properties(value) }
2829
}
29-
}
30+
}.compact
3031
else
3132
{
3233
type: param_type_for_gemini(param.type),
34+
description: param.description,
3335
default: param.default,
3436
items: { type: param_type_for_gemini(param.item_type), enum: param.enum }.compact
3537
}.compact
3638
end
3739
when :object
3840
{
3941
type: param_type_for_gemini(param.type),
42+
description: param.description,
4043
properties: param.properties.transform_values { |value| build_properties(value) },
4144
required: param.properties.select { |_, p| p.required }.keys
42-
}
45+
}.compact
4346
when :union
4447
{
4548
param.union_type => param.properties.map { |properties| build_properties(properties) }

lib/ruby_llm/mcp/providers/openai/complex_parameter_support.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,30 +7,33 @@ module OpenAI
77
module ComplexParameterSupport
88
module_function
99

10-
def param_schema(param)
10+
def param_schema(param) # rubocop:disable Metrics/MethodLength
1111
properties = case param.type
1212
when :array
1313
if param.item_type == :object
1414
{
1515
type: param.type,
16+
description: param.description,
1617
items: {
1718
type: param.item_type,
1819
properties: param.properties.transform_values { |value| param_schema(value) }
1920
}
20-
}
21+
}.compact
2122
else
2223
{
2324
type: param.type,
25+
description: param.description,
2426
default: param.default,
2527
items: { type: param.item_type, enum: param.enum }.compact
2628
}.compact
2729
end
2830
when :object
2931
{
3032
type: param.type,
33+
description: param.description,
3134
properties: param.properties.transform_values { |value| param_schema(value) },
3235
required: param.properties.select { |_, p| p.required }.keys
33-
}
36+
}.compact
3437
when :union
3538
{
3639
param.union_type => param.properties.map { |property| param_schema(property) }

spec/fixtures/vcr_cassettes/with_stdio_with_anthropic_claude-3-5-sonnet-20240620_ask_prompt_get_one_prompts_by_name.yml

Lines changed: 19 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/fixtures/vcr_cassettes/with_stdio_with_anthropic_claude-3-5-sonnet-20240620_ask_prompt_handles_prompts_when_available.yml

Lines changed: 10 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/fixtures/vcr_cassettes/with_stdio_with_anthropic_claude-3-5-sonnet-20240620_ask_prompt_handles_prompts_with_arguments.yml

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

spec/fixtures/vcr_cassettes/with_stdio_with_anthropic_claude-3-5-sonnet-20240620_with_resource_adds_a_markdown_resource_to_the_chat.yml

Lines changed: 13 additions & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)