From the course: Unboxing AI: Build a Remote MCP Server from Zero to Deployed with OAuth

Unlock this course with a free trial

Join today to access over 24,900 courses taught by industry experts.

MCP sampling: The server uses AI tools

MCP sampling: The server uses AI tools

- That's elicitation. Now let's look at sampling. Sampling is the ability of the MCP server to request more generation from an LLM. This is usually done by the MCP server sending a request back to the original LLM to perform some action. That action happens in the background. Then the MCP server surfaces a response. Just like with elicitation, that means we now have a back and forth, except instead of the server requesting a response from a user, a human user, the server's requesting a response from an LLM agent to do something. And there are multiple scenarios where that might make sense. You may get a response from a database and then you want to convert it into something specific before you pass it back to the user. In that case, you could use sampling to send it to the LLM, get the LLM to do something with the data, then capture it, check it, or whatever, and then pass it to the user, et cetera. There's a bunch of different scenarios where you can use this. Sampling is also…

Contents