Add resource_templates to MCP::Client
Includes relevant README addition and tests
This commit is contained in:
parent
0ab77c318f
commit
c145fe39df
1 changed files with 52 additions and 0 deletions
|
|
@ -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.
|
||||
#
|
||||
|
|
|
|||
Loading…
Reference in a new issue