From the course: Claude with Amazon Bedrock by Anthropic

Unlock this course with a free trial

Join today to access over 25,300 courses taught by industry experts.

Accessing resources

Accessing resources

We have defined two separate resources inside of our MCP server. So now our client needs the ability to request these resources. To do so, we're going to add in a single function inside of our MCP client. And remember, this MCP client is going to have some functionality that we're putting together that is going to be used by the rest of our application. And I've already put together that code already. So somewhere else inside this project, something is going to try to make use of this function that we're about to add into the MCP client. To get started I'm going to open up the MCP client file again. I'm going to scroll down and find read resource right here. So our goal inside here is to read a particular resource by making a request off to our MCP server and then parse the contents that come back depending upon its MIME type and then just return whatever data we get. So you'll notice that a argument to it is the URI. This is going to be the URI of the resource that we want to fetch…

Contents