Skip to content

Commit e526009

Browse files
committed
[Doc] Fix invalid syntax in README examples
This PR corrects invalid syntax in the README examples. Additionally, all lambda blocks using `->` have been consistently formatted with `{}`.
1 parent 18f3e87 commit e526009

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -116,17 +116,17 @@ The gem can be configured using the `ModelContextProtocol.configure` block:
116116

117117
```ruby
118118
ModelContextProtocol.configure do |config|
119-
config.exception_reporter = do |exception, server_context|
119+
config.exception_reporter = ->(exception, server_context) {
120120
# Your exception reporting logic here
121121
# For example with Bugsnag:
122122
Bugsnag.notify(exception) do |report|
123123
report.add_metadata(:model_context_protocol, server_context)
124124
end
125-
end
125+
}
126126

127-
config.instrumentation_callback = do |data|
127+
config.instrumentation_callback = ->(data) {
128128
puts "Got instrumentation data #{data.inspect}"
129-
end
129+
}
130130
end
131131
```
132132

@@ -136,17 +136,17 @@ they might require different instrumentation callbacks.
136136

137137
```ruby
138138
configuration = ModelContextProtocol::Configuration.new
139-
configuration.exception_reporter = do |exception, server_context|
139+
configuration.exception_reporter = ->(exception, server_context) {
140140
# Your exception reporting logic here
141141
# For example with Bugsnag:
142142
Bugsnag.notify(exception) do |report|
143143
report.add_metadata(:model_context_protocol, server_context)
144144
end
145-
end
145+
}
146146

147-
configuration.instrumentation_callback = do |data|
147+
configuration.instrumentation_callback = ->(data) {
148148
puts "Got instrumentation data #{data.inspect}"
149-
end
149+
}
150150

151151
server = ModelContextProtocol::Server.new(
152152
# ... all other options
@@ -208,9 +208,9 @@ instrumentation_callback = ->(data) { ... }
208208

209209
**Example:**
210210
```ruby
211-
config.instrumentation_callback = ->(data) do
211+
config.instrumentation_callback = ->(data) {
212212
puts "Instrumentation: #{data.inspect}"
213-
end
213+
}
214214
```
215215

216216
### Server Protocol Version
@@ -418,10 +418,10 @@ To register a handler pass a proc/lambda to as `instrumentation_callback` into t
418418

419419
```ruby
420420
ModelContextProtocol.configure do |config|
421-
config.instrumentation_callback = do |data|
421+
config.instrumentation_callback = ->(data) {
422422
puts "Got instrumentation data #{data.inspect}"
423423
end
424-
end
424+
}
425425
```
426426

427427
The data contains the following keys:

0 commit comments

Comments
 (0)