Skip to content

Commit d343a28

Browse files
committed
Add resource_templates to MCP::Client
Also remove unused require from logging_message_notification.rb
1 parent 0ab77c3 commit d343a28

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

lib/mcp/client.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,20 @@ def resources
5858
response.dig("result", "resources") || []
5959
end
6060

61+
# Returns the list of resource templates available from the server.
62+
# Each call will make a new request – the result is not cached.
63+
#
64+
# @return [Array<Hash>] An array of available resource templates.
65+
def resource_templates
66+
response = transport.send_request(request: {
67+
jsonrpc: JsonRpcHandler::Version::V2_0,
68+
id: request_id,
69+
method: "resources/templates/list",
70+
})
71+
72+
response.dig("result", "resourceTemplates") || []
73+
end
74+
6175
# Returns the list of prompts available from the server.
6276
# Each call will make a new request – the result is not cached.
6377
#

lib/mcp/logging_message_notification.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# frozen_string_literal: true
22

3-
require "json_rpc_handler"
4-
53
module MCP
64
class LoggingMessageNotification
75
LOG_LEVEL_SEVERITY = {

0 commit comments

Comments
 (0)