You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This will make all new server instances use the specified protocol version instead of the default version. The protocol version can be reset to the default by setting it to `nil`:
Be sure to check the [MCP spec](https://spec.modelcontextprotocol.io/specification/2024-11-05/) for the protocol version to understand the supported features for the version being set.
@@ -253,12 +271,12 @@ If no exception reporter is configured, a default no-op reporter is used that si
253
271
254
272
MCP spec includes [Tools](https://modelcontextprotocol.io/docs/concepts/tools) which provide functionality to LLM apps.
255
273
256
-
This gem provides a `ModelContextProtocol::Tool` class that can be used to create tools in two ways:
274
+
This gem provides a `MCP::Tool` class that can be used to create tools in two ways:
257
275
258
276
1. As a class definition:
259
277
260
278
```ruby
261
-
classMyTool < ModelContextProtocol::Tool
279
+
classMyTool < MCP::Tool
262
280
description "This tool performs specific functionality..."
263
281
input_schema(
264
282
properties: {
@@ -275,17 +293,17 @@ class MyTool < ModelContextProtocol::Tool
2. By using the `ModelContextProtocol::Tool.define` method with a block:
303
+
2. By using the `MCP::Tool.define` method with a block:
286
304
287
305
```ruby
288
-
tool =ModelContextProtocol::Tool.define(
306
+
tool =MCP::Tool.define(
289
307
name:"my_tool",
290
308
description:"This tool performs specific functionality...",
291
309
annotations: {
@@ -316,12 +334,12 @@ Annotations can be set either through the class definition using the `annotation
316
334
317
335
MCP spec includes [Prompts](https://modelcontextprotocol.io/docs/concepts/prompts), which enable servers to define reusable prompt templates and workflows that clients can easily surface to users and LLMs.
318
336
319
-
The `ModelContextProtocol::Prompt` class provides two ways to create prompts:
337
+
The `MCP::Prompt` class provides two ways to create prompts:
320
338
321
339
1. As a class definition with metadata:
322
340
323
341
```ruby
324
-
classMyPrompt < ModelContextProtocol::Prompt
342
+
classMyPrompt < MCP::Prompt
325
343
prompt_name "my_prompt"# Optional - defaults to underscored class name
326
344
description "This prompt performs specific functionality..."
327
345
arguments [
@@ -354,10 +372,10 @@ end
354
372
prompt =MyPrompt
355
373
```
356
374
357
-
2. Using the `ModelContextProtocol::Prompt.define` method:
375
+
2. Using the `MCP::Prompt.define` method:
358
376
359
377
```ruby
360
-
prompt =ModelContextProtocol::Prompt.define(
378
+
prompt =MCP::Prompt.define(
361
379
name:"my_prompt",
362
380
description:"This prompt performs specific functionality...",
363
381
arguments: [
@@ -399,7 +417,7 @@ e.g. around authentication state or user preferences.
399
417
Register prompts with the MCP server:
400
418
401
419
```ruby
402
-
server =ModelContextProtocol::Server.new(
420
+
server =MCP::Server.new(
403
421
name:"my_server",
404
422
prompts: [MyPrompt],
405
423
server_context: { user_id: current_user.id },
@@ -417,7 +435,7 @@ The server allows registering a callback to receive information about instrument
417
435
To register a handler pass a proc/lambda to as `instrumentation_callback` into the server constructor.
418
436
419
437
```ruby
420
-
ModelContextProtocol.configure do |config|
438
+
MCP.configure do |config|
421
439
config.instrumentation_callback =->(data) {
422
440
puts"Got instrumentation data #{data.inspect}"
423
441
end
@@ -439,16 +457,16 @@ This is to avoid potential issues with metric cardinality
439
457
440
458
MCP spec includes [Resources](https://modelcontextprotocol.io/docs/concepts/resources)
441
459
442
-
The `ModelContextProtocol::Resource` class provides a way to register resources with the server.
460
+
The `MCP::Resource` class provides a way to register resources with the server.
0 commit comments