Skip to content

Commit 547571e

Browse files
use meta naming for _meta field on tool schema
1 parent 3127bb6 commit 547571e

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/mcp/server.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ def handle_json(request)
9999
end
100100
end
101101

102-
def define_tool(name: nil, title: nil, description: nil, input_schema: nil, annotations: nil, metadata: nil, &block)
103-
tool = Tool.define(name:, title:, description:, input_schema:, annotations:, metadata:, &block)
102+
def define_tool(name: nil, title: nil, description: nil, input_schema: nil, annotations: nil, meta: nil, &block)
103+
tool = Tool.define(name:, title:, description:, input_schema:, annotations:, meta:, &block)
104104
@tools[tool.name_value] = tool
105105
end
106106

lib/mcp/tool.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class << self
88
attr_reader :title_value
99
attr_reader :description_value
1010
attr_reader :annotations_value
11-
attr_reader :metadata_value
11+
attr_reader :meta_value
1212

1313
def call(*args, server_context: nil)
1414
raise NotImplementedError, "Subclasses must implement call"
@@ -21,7 +21,7 @@ def to_h
2121
description: description_value,
2222
inputSchema: input_schema_value.to_h,
2323
}
24-
result[:_meta] = metadata_value if metadata_value
24+
result[:_meta] = meta_value if meta_value
2525
result[:annotations] = annotations_value.to_h if annotations_value
2626
result
2727
end
@@ -33,7 +33,7 @@ def inherited(subclass)
3333
subclass.instance_variable_set(:@description_value, nil)
3434
subclass.instance_variable_set(:@input_schema_value, nil)
3535
subclass.instance_variable_set(:@annotations_value, nil)
36-
subclass.instance_variable_set(:@metadata_value, nil)
36+
subclass.instance_variable_set(:@meta_value, nil)
3737
end
3838

3939
def tool_name(value = NOT_SET)
@@ -80,11 +80,11 @@ def input_schema(value = NOT_SET)
8080
end
8181
end
8282

83-
def metadata(value = NOT_SET)
83+
def meta(value = NOT_SET)
8484
if value == NOT_SET
85-
@metadata_value
85+
@meta_value
8686
else
87-
@metadata_value = value
87+
@meta_value = value
8888
end
8989
end
9090

@@ -96,7 +96,7 @@ def annotations(hash = NOT_SET)
9696
end
9797
end
9898

99-
def define(name: nil, title: nil, description: nil, input_schema: nil, metadata: nil, annotations: nil, &block)
99+
def define(name: nil, title: nil, description: nil, input_schema: nil, meta: nil, annotations: nil, &block)
100100
Class.new(self) do
101101
tool_name name
102102
title title

0 commit comments

Comments
 (0)