Skip to content
Alessandro Autiero
Go back

Sampling should support embedded resources

Hello, I’m working on a project using the dotnet SDK for MCP servers. I was running a sampling request that looks like this:

  var request = new CreateMessageRequestParams
        {
            MaxTokens = 1_000_000,
            Messages =
            [
                new SamplingMessage
                {
                    Content = new TextContentBlock
                    {
                        Text = "Some long instructions on what to do with the PDF"
                    },
                    Role = Role.User
                },
                new SamplingMessage
                {
                    Content = new EmbeddedResourceBlock
                    {
                        Resource = new BlobResourceContents
                        {
                            Uri = "file://source.pdf"
                            MimeType = "application/pdf",
                            Blob = source
                        }
                    },
                    Role = Role.User
                }
            ]
        };
        var response = await context.Server.SampleAsync(request);

When I tried to use the MCP server I created with fast-agent, I got an error that I was passing invalid parameters. I tried to figure out the issue for a while, but, as I couldn’t really find anything wrong with my code, I went to the MCP specification for sampling and noticed that the following contents are supported for sampling requests:

  • Text content
  • Image content
  • Audio content

Notably, Embedded resources are missing. I was confused as to why this class even exists if it’s not possible to use it and after some research I figured out that prompts support contents as well, but they support:

  • Text content
  • Image content
  • Audio content
  • Resource content

The reason why I could pass EmbeddedResource to Content is that the dotnet SDK is using the ContentBlock type for both prompts and sampling and the authors probably didn’t notice that sampling doesn’t support resources. At this point though I’m wondering if there is a reason as to why we can’t pass resources in a sampling request while we can for prompts. I think the feature would be very useful, for example in my case I need to pass a PDF and I don’t really understand why there is this limitation just for sampling. Thanks in advance


Originally opened as a GitHub issue, modelcontextprotocol/modelcontextprotocol#1423, on September 5, 2025.



Previous Post
Proposal: Allow annotations on module directives
Next Post
PEXT/PDEP intrinsics cause a performance regression on AMD pre-Zen 3 CPUs