@@ -160,6 +160,7 @@ class ApplicationController < ActionController::Base
160160 def index
161161 server = MCP ::Server .new (
162162 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.
163164 version: " 1.0.0" ,
164165 instructions: " Use the tools of this server as a last resort" ,
165166 tools: [SomeTool , AnotherTool ],
@@ -216,6 +217,7 @@ You can run this script and then type in requests to the server at the command l
216217$ ruby examples/stdio_server.rb
217218{"jsonrpc":"2.0","id":"1","method":"ping"}
218219{"jsonrpc":"2.0","id":"2","method":"tools/list"}
220+ {"jsonrpc":"2.0","id":"3","method":"tools/call","params":{"name":"example_tool","arguments":{"message":"Hello"}}}
219221```
220222
221223### Configuration
@@ -422,10 +424,10 @@ e.g. around authentication state.
422424
423425Tools can include annotations that provide additional metadata about their behavior. The following annotations are supported:
424426
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
429431- ` title ` : A human-readable title for the tool
430432
431433Annotations 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
560562
561563MCP spec includes [ Resources] ( https://modelcontextprotocol.io/specification/2025-06-18/server/resources ) .
562564
565+ ### Reading Resources
566+
563567The ` MCP::Resource ` class provides a way to register resources with the server.
564568
565569``` ruby
@@ -587,11 +591,29 @@ server.resources_read_handler do |params|
587591 text: " Hello from example resource! URI: #{ params[:uri ] } "
588592 }]
589593end
590-
591594```
592595
593596otherwise ` resources/read ` requests will be a no-op.
594597
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+
595617## Building an MCP Client
596618
597619The ` MCP::Client ` class provides an interface for interacting with MCP servers.
0 commit comments