@@ -160,6 +160,7 @@ class ApplicationController < ActionController::Base
160
160
def index
161
161
server = MCP ::Server .new (
162
162
name: " my_server" ,
163
+ title: " Example Server Display Name" , # WARNING: This is a `Draft` and is not supported in the `Version 2025-06-18 (latest)` specification.
163
164
version: " 1.0.0" ,
164
165
instructions: " Use the tools of this server as a last resort" ,
165
166
tools: [SomeTool , AnotherTool ],
@@ -216,6 +217,7 @@ You can run this script and then type in requests to the server at the command l
216
217
$ ruby examples/stdio_server.rb
217
218
{"jsonrpc":"2.0","id":"1","method":"ping"}
218
219
{"jsonrpc":"2.0","id":"2","method":"tools/list"}
220
+ {"jsonrpc":"2.0","id":"3","method":"tools/call","params":{"name":"example_tool","arguments":{"message":"Hello"}}}
219
221
```
220
222
221
223
### Configuration
@@ -422,10 +424,10 @@ e.g. around authentication state.
422
424
423
425
Tools can include annotations that provide additional metadata about their behavior. The following annotations are supported:
424
426
425
- - ` destructive_hint ` : Indicates if the tool performs destructive operations
426
- - ` idempotent_hint ` : Indicates if the tool's operations are idempotent
427
- - ` open_world_hint ` : Indicates if the tool operates in an open world context
428
- - ` read_only_hint ` : Indicates if the tool only reads data (doesn't modify state)
427
+ - ` destructive_hint ` : Indicates if the tool performs destructive operations. Defaults to true
428
+ - ` idempotent_hint ` : Indicates if the tool's operations are idempotent. Defaults to false
429
+ - ` open_world_hint ` : Indicates if the tool operates in an open world context. Defaults to true
430
+ - ` read_only_hint ` : Indicates if the tool only reads data (doesn't modify state). Defaults to false
429
431
- ` title ` : A human-readable title for the tool
430
432
431
433
Annotations can be set either through the class definition using the ` annotations ` class method or when defining a tool using the ` define ` method.
@@ -560,6 +562,8 @@ This is to avoid potential issues with metric cardinality
560
562
561
563
MCP spec includes [ Resources] ( https://modelcontextprotocol.io/specification/2025-06-18/server/resources ) .
562
564
565
+ ### Reading Resources
566
+
563
567
The ` MCP::Resource ` class provides a way to register resources with the server.
564
568
565
569
``` ruby
@@ -587,11 +591,29 @@ server.resources_read_handler do |params|
587
591
text: " Hello from example resource! URI: #{ params[:uri ] } "
588
592
}]
589
593
end
590
-
591
594
```
592
595
593
596
otherwise ` resources/read ` requests will be a no-op.
594
597
598
+ ### Resource Templates
599
+
600
+ The ` MCP::ResourceTemplate ` class provides a way to register resource templates with the server.
601
+
602
+ ``` ruby
603
+ resource_template = MCP ::ResourceTemplate .new (
604
+ uri_template: " https://example.com/my_resource_template" ,
605
+ name: " my-resource-template" ,
606
+ title: " My Resource Template" , # WARNING: This is a `Draft` and is not supported in the `Version 2025-06-18 (latest)` specification.
607
+ description: " Lorem ipsum dolor sit amet" ,
608
+ mime_type: " text/html" ,
609
+ )
610
+
611
+ server = MCP ::Server .new (
612
+ name: " my_server" ,
613
+ resource_templates: [resource_template],
614
+ )
615
+ ```
616
+
595
617
## Building an MCP Client
596
618
597
619
The ` MCP::Client ` class provides an interface for interacting with MCP servers.
0 commit comments