Merge pull request #225 from sjrct/add-client-resource-templates

Add resource_templates to MCP::Client
This commit is contained in:
Koichi ITO 2026-02-07 02:58:52 +09:00 • committed by GitHub
commit 0e30dff80b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -58,6 +58,20 @@ module MCP
response.dig("result", "resources") || []
end
# Returns the list of resource templates available from the server.
# Each call will make a new request – the result is not cached.
#
# @return [Array<Hash>] An array of available resource templates.
def resource_templates
response = transport.send_request(request: {
jsonrpc: JsonRpcHandler::Version::V2_0,
id: request_id,
method: "resources/templates/list",
})
response.dig("result", "resourceTemplates") || []
end
# Returns the list of prompts available from the server.
# Each call will make a new request – the result is not cached.
#